JsonFile
extends Coveralls
in package
Data represents "json_file" of Coveralls API.
Tags
Table of Contents
Properties
- $flagName : string
- If this is set, the job being reported will be named in the view and have it’s own independent status reported to your VCS provider.
- $git : null|Git
- Git data.
- $metrics : Metrics
- Metrics.
- $parallel : bool
- If this is set, the build will not be considered done until a webhook has been sent to https://coveralls.io/webhook?repo_token=….
- $repoToken : null|string
- Repository token.
- $runAt : null|string
- A timestamp when the job ran. Must be parsable by Ruby.
- $serviceBranch : string
- Branch name (not documented).
- $serviceBuildUrl : string
- Build URL of the project (not documented).
- $serviceEventType : string
- Service event type (not documented).
- $serviceJobId : null|string
- Service job id.
- $serviceName : null|string
- Service name.
- $serviceNumber : string
- Service number (not documented).
- $servicePullRequest : string
- Pull request info (not documented).
- $sourceFiles : array<string|int, SourceFile>
- Source files.
Methods
- __toString() : string
- String expression (convert to json).
- addSourceFile() : mixed
- Add source file.
- excludeNoStatementsFiles() : mixed
- Exclude source files that have no executable statements.
- fillJobs() : $this
- Fill environment variables.
- getFlagName() : null|string
- Return flag name.
- getGit() : null|Git
- Return git data.
- getMetrics() : Metrics
- Return metrics.
- getParallel() : null|bool
- Return parallel.
- getRepoToken() : null|string
- Return repository token.
- getRunAt() : null|string
- Return timestamp when the job ran.
- getServiceBranch() : string
- Return branch name.
- getServiceBuildUrl() : string
- Return build URL of the project.
- getServiceEventType() : string
- Return service event type.
- getServiceJobId() : null|string
- Return service job id.
- getServiceName() : null|string
- Return service name.
- getServiceNumber() : string
- Return service number.
- getServicePullRequest() : string
- Return pull request info.
- getSourceFile() : null|SourceFile
- Return source file.
- getSourceFiles() : array<string|int, SourceFile>
- Return source files.
- hasSourceFile() : bool
- Return whether the json file has source file.
- hasSourceFiles() : bool
- Return whether the json file has a source file.
- reportLineCoverage() : float
- Return line coverage.
- setFlagName() : $this
- Set flag name.
- setGit() : $this
- Set git data.
- setParallel() : $this
- Set parallel.
- setRepoToken() : $this
- Set repository token.
- setRunAt() : $this
- Set timestamp when the job ran.
- setServiceJobId() : $this
- Set service job id.
- setServiceName() : $this
- Set service name.
- sortSourceFiles() : mixed
- Sort source files by path.
- toArray() : array<string|int, mixed>
- Convert to an array.
- ensureJobs() : $this
- Ensure data consistency for jobs API.
- fillStandardizedEnvVars() : $this
- Fill standardized environment variables.
- isUnsupportedServiceJob() : bool
- Return whether the job is running on unsupported service.
- onJsonError() : mixed
- requireGithubActions() : bool
- Return whether the job requires "service_number", "service_job_id" and "repo_token" (for GithubActions).
- requireRepoToken() : bool
- Return whether the job requires "repo_token" (for Travis PRO).
- requireServiceEventType() : bool
- Return whether the job requires "service_event_type" (for local environment).
- requireServiceJobId() : bool
- Return whether the job requires "service_job_id" (for Travis CI).
- requireServiceNumber() : bool
- Return whether the job requires "service_number" (for CircleCI, Jenkins, Codeship or other CIs).
- toJsonProperty() : mixed
- Convert to json property.
- toJsonPropertyArray() : array<string|int, mixed>
- Convert to array as json property.
- throwWhenInvalidJson() : mixed
Properties
$flagName
If this is set, the job being reported will be named in the view and have it’s own independent status reported to your VCS provider.
protected
string
$flagName
$git
Git data.
protected
null|Git
$git
$metrics
Metrics.
protected
Metrics
$metrics
$parallel
If this is set, the build will not be considered done until a webhook has been sent to https://coveralls.io/webhook?repo_token=….
protected
bool
$parallel
$repoToken
Repository token.
protected
null|string
$repoToken
$runAt
A timestamp when the job ran. Must be parsable by Ruby.
protected
null|string
$runAt
"2013-02-18 00:52:48 -0800"
$serviceBranch
Branch name (not documented).
protected
string
$serviceBranch
$serviceBuildUrl
Build URL of the project (not documented).
protected
string
$serviceBuildUrl
$serviceEventType
Service event type (not documented).
protected
string
$serviceEventType
$serviceJobId
Service job id.
protected
null|string
$serviceJobId
$serviceName
Service name.
protected
null|string
$serviceName
$serviceNumber
Service number (not documented).
protected
string
$serviceNumber
$servicePullRequest
Pull request info (not documented).
protected
string
$servicePullRequest
$sourceFiles
Source files.
protected
array<string|int, SourceFile>
$sourceFiles
= []
Methods
__toString()
String expression (convert to json).
public
__toString() : string
Return values
stringaddSourceFile()
Add source file.
public
addSourceFile(SourceFile $sourceFile) : mixed
Parameters
- $sourceFile : SourceFile
excludeNoStatementsFiles()
Exclude source files that have no executable statements.
public
excludeNoStatementsFiles() : mixed
fillJobs()
Fill environment variables.
public
fillJobs(array<string|int, mixed> $env) : $this
Parameters
- $env : array<string|int, mixed>
-
$_SERVER environment
Tags
Return values
$thisgetFlagName()
Return flag name.
public
getFlagName() : null|string
Return values
null|stringgetGit()
Return git data.
public
getGit() : null|Git
Return values
null|GitgetMetrics()
Return metrics.
public
getMetrics() : Metrics
Return values
MetricsgetParallel()
Return parallel.
public
getParallel() : null|bool
Return values
null|boolgetRepoToken()
Return repository token.
public
getRepoToken() : null|string
Return values
null|stringgetRunAt()
Return timestamp when the job ran.
public
getRunAt() : null|string
Return values
null|stringgetServiceBranch()
Return branch name.
public
getServiceBranch() : string
Return values
stringgetServiceBuildUrl()
Return build URL of the project.
public
getServiceBuildUrl() : string
Return values
stringgetServiceEventType()
Return service event type.
public
getServiceEventType() : string
Return values
stringgetServiceJobId()
Return service job id.
public
getServiceJobId() : null|string
Return values
null|stringgetServiceName()
Return service name.
public
getServiceName() : null|string
Return values
null|stringgetServiceNumber()
Return service number.
public
getServiceNumber() : string
Return values
stringgetServicePullRequest()
Return pull request info.
public
getServicePullRequest() : string
Return values
stringgetSourceFile()
Return source file.
public
getSourceFile(string $path) : null|SourceFile
Parameters
- $path : string
-
absolute path to source file
Return values
null|SourceFilegetSourceFiles()
Return source files.
public
getSourceFiles() : array<string|int, SourceFile>
Return values
array<string|int, SourceFile>hasSourceFile()
Return whether the json file has source file.
public
hasSourceFile(string $path) : bool
Parameters
- $path : string
-
absolute path to source file
Return values
boolhasSourceFiles()
Return whether the json file has a source file.
public
hasSourceFiles() : bool
Return values
boolreportLineCoverage()
Return line coverage.
public
reportLineCoverage() : float
Return values
floatsetFlagName()
Set flag name.
public
setFlagName(string $flagName) : $this
Parameters
- $flagName : string
-
flag name
Return values
$thissetGit()
Set git data.
public
setGit(Git $git) : $this
Parameters
- $git : Git
-
git data
Return values
$thissetParallel()
Set parallel.
public
setParallel(string $parallel) : $this
Parameters
- $parallel : string
-
parallel
Return values
$thissetRepoToken()
Set repository token.
public
setRepoToken(string $repoToken) : $this
Parameters
- $repoToken : string
-
repository token
Return values
$thissetRunAt()
Set timestamp when the job ran.
public
setRunAt(string $runAt) : $this
Parameters
- $runAt : string
-
timestamp
Return values
$thissetServiceJobId()
Set service job id.
public
setServiceJobId(string $serviceJobId) : $this
Parameters
- $serviceJobId : string
-
service job id
Return values
$thissetServiceName()
Set service name.
public
setServiceName(string $serviceName) : $this
Parameters
- $serviceName : string
-
service name
Return values
$thissortSourceFiles()
Sort source files by path.
public
sortSourceFiles() : mixed
toArray()
Convert to an array.
public
toArray() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>ensureJobs()
Ensure data consistency for jobs API.
protected
ensureJobs() : $this
Tags
Return values
$thisfillStandardizedEnvVars()
Fill standardized environment variables.
protected
fillStandardizedEnvVars(array<string|int, mixed> $env) : $this
"CI_NAME", "CI_BUILD_NUMBER" must be set.
Env vars are:
- CI_NAME
- CI_BUILD_NUMBER
- CI_BUILD_URL
- CI_BRANCH
- CI_PULL_REQUEST
These vars are supported by Codeship.
Parameters
- $env : array<string|int, mixed>
-
$_SERVER environment
Return values
$thisisUnsupportedServiceJob()
Return whether the job is running on unsupported service.
protected
isUnsupportedServiceJob() : bool
Return values
boolonJsonError()
protected
onJsonError() : mixed
requireGithubActions()
Return whether the job requires "service_number", "service_job_id" and "repo_token" (for GithubActions).
protected
requireGithubActions() : bool
Return values
boolrequireRepoToken()
Return whether the job requires "repo_token" (for Travis PRO).
protected
requireRepoToken() : bool
Return values
boolrequireServiceEventType()
Return whether the job requires "service_event_type" (for local environment).
protected
requireServiceEventType() : bool
Return values
boolrequireServiceJobId()
Return whether the job requires "service_job_id" (for Travis CI).
protected
requireServiceJobId() : bool
Return values
boolrequireServiceNumber()
Return whether the job requires "service_number" (for CircleCI, Jenkins, Codeship or other CIs).
protected
requireServiceNumber() : bool
Return values
booltoJsonProperty()
Convert to json property.
protected
toJsonProperty(mixed $prop) : mixed
Parameters
- $prop : mixed
toJsonPropertyArray()
Convert to array as json property.
protected
toJsonPropertyArray(array<string|int, mixed> $propArray) : array<string|int, mixed>
Parameters
- $propArray : array<string|int, mixed>
Return values
array<string|int, mixed>throwWhenInvalidJson()
private
throwWhenInvalidJson(array<string|int, mixed> $item, string $source) : mixed
Parameters
- $item : array<string|int, mixed>
- $source : string