Refactoring builds out into separate model types (Github, Bitbucket, Local) and builder to use build->createWorkingCopy() to make build directory. Fixes #29
This commit is contained in:
parent
1a92d1c619
commit
be37a5e821
9 changed files with 304 additions and 150 deletions
32
PHPCI/BuildFactory.php
Normal file
32
PHPCI/BuildFactory.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace PHPCI;
|
||||
use PHPCI\Model\Build,
|
||||
PHPCI\Model\Build\LocalBuild,
|
||||
PHPCI\Model\Build\GithubBuild,
|
||||
PHPCI\Model\Build\BitbucketBuild;
|
||||
|
||||
class BuildFactory
|
||||
{
|
||||
public static function getBuild(Build $base)
|
||||
{
|
||||
switch($base->getProject()->getType())
|
||||
{
|
||||
case 'local':
|
||||
$type = 'LocalBuild';
|
||||
break;
|
||||
|
||||
case 'github':
|
||||
$type = 'GithubBuild';
|
||||
break;
|
||||
|
||||
case 'bitbucket':
|
||||
$type = 'BitbucketBuild';
|
||||
break;
|
||||
}
|
||||
|
||||
$type = '\\PHPCI\\Model\\Build\\' . $type;
|
||||
|
||||
return new $type($base->getDataArray());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue