Making PHPMD happy.
This commit is contained in:
parent
771bee0aa3
commit
11445304d6
|
@ -37,45 +37,39 @@ class BuildFactory
|
||||||
/**
|
/**
|
||||||
* Takes a generic build and returns a type-specific build model.
|
* Takes a generic build and returns a type-specific build model.
|
||||||
* @param Build $build The build from which to get a more specific build type.
|
* @param Build $build The build from which to get a more specific build type.
|
||||||
* @param string $type Set the type manually if you already know it.
|
|
||||||
* @return Build
|
* @return Build
|
||||||
*/
|
*/
|
||||||
public static function getBuild(Build $build, $type = null)
|
public static function getBuild(Build $build)
|
||||||
{
|
{
|
||||||
if (is_null($type) && !is_null($build->getProject())) {
|
$project = $build->getProject();
|
||||||
$type = $build->getProject()->getType();
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ($type) {
|
if (!empty($project)) {
|
||||||
case 'remote':
|
switch ($project->getType()) {
|
||||||
$type = 'RemoteGitBuild';
|
case 'remote':
|
||||||
break;
|
$type = 'RemoteGitBuild';
|
||||||
case 'local':
|
break;
|
||||||
$type = 'LocalBuild';
|
case 'local':
|
||||||
break;
|
$type = 'LocalBuild';
|
||||||
case 'github':
|
break;
|
||||||
$type = 'GithubBuild';
|
case 'github':
|
||||||
break;
|
$type = 'GithubBuild';
|
||||||
case 'bitbucket':
|
break;
|
||||||
$type = 'BitbucketBuild';
|
case 'bitbucket':
|
||||||
break;
|
$type = 'BitbucketBuild';
|
||||||
case 'gitlab':
|
break;
|
||||||
$type = 'GitlabBuild';
|
case 'gitlab':
|
||||||
break;
|
$type = 'GitlabBuild';
|
||||||
case 'hg':
|
break;
|
||||||
$type = 'MercurialBuild';
|
case 'hg':
|
||||||
break;
|
$type = 'MercurialBuild';
|
||||||
case 'svn':
|
break;
|
||||||
$type = 'SubversionBuild';
|
case 'svn':
|
||||||
break;
|
$type = 'SubversionBuild';
|
||||||
default:
|
break;
|
||||||
$type = null;
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_null($type)) {
|
$class = '\\PHPCI\\Model\\Build\\' . $type;
|
||||||
$type = '\\PHPCI\\Model\\Build\\' . $type;
|
$build = new $class($build->getDataArray());
|
||||||
$build = new $type($build->getDataArray());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $build;
|
return $build;
|
||||||
|
|
|
@ -87,7 +87,7 @@ class BuildService
|
||||||
|
|
||||||
$build = $this->buildStore->save($build);
|
$build = $this->buildStore->save($build);
|
||||||
|
|
||||||
$build = BuildFactory::getBuild($build, $project->getType());
|
$build = BuildFactory::getBuild($build);
|
||||||
$build->sendStatusPostback();
|
$build->sendStatusPostback();
|
||||||
$this->addBuildToQueue($build);
|
$this->addBuildToQueue($build);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue