for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace DevBoardLib\GithubObjectApiFacade\Repo\CommitStatus\Converter;
use DateTime;
use DevBoardLib\GithubCore\Commit\GithubCommitId;
use DevBoardLib\GithubCore\Commit\GithubCommitSha;
use DevBoardLib\GithubCore\CommitStatus\GithubCommitStatusId;
use DevBoardLib\GithubCore\CommitStatus\GithubCommitStatusSource;
use DevBoardLib\GithubCore\CommitStatus\State\GithubCommitStatusStateFactory;
use DevBoardLib\GithubCore\External\ExternalServiceId;
/**
* Class GithubCommitStatusConvertTrait.
*/
trait GithubCommitStatusConvertTrait
{
* @param $data
*
* @throws \Exception
* @return GithubCommitStatusSource
protected function convertCommitStatus($data)
return new GithubCommitStatusSource(
new GithubCommitStatusId($data['id']),
new GithubCommitId($this->githubRepo->getId(), new GithubCommitSha($data['sha'])),
githubRepo
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
new ExternalServiceId($data['context']),
$data['description'],
$data['target_url'],
GithubCommitStatusStateFactory::create($data['state']),
new DateTime($data['created_at']),
new DateTime($data['updated_at'])
);
}
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: