Initial work on PSR2 compliance for issue #18

This commit is contained in:
Dan Cryer 2013-05-16 02:57:02 +01:00
commit e4d32b3ea1
7 changed files with 431 additions and 374 deletions

View file

@ -2,42 +2,41 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2013, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link http://www.phptesting.org/
* @copyright Copyright 2013, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link http://www.phptesting.org/
*/
namespace PHPCI;
use PHPCI\Model\Build,
PHPCI\Model\Build\LocalBuild,
PHPCI\Model\Build\GithubBuild,
PHPCI\Model\Build\BitbucketBuild;
use PHPCI\Model\Build;
use PHPCI\Model\Build\LocalBuild;
use PHPCI\Model\Build\GithubBuild;
use PHPCI\Model\Build\BitbucketBuild;
/**
* PHPCI Build Factory - Takes in a generic "Build" and returns a type-specific build model.
* @author Dan Cryer <dan@block8.co.uk>
* @author Dan Cryer <dan@block8.co.uk>
*/
class BuildFactory
{
public static function getBuild(Build $base)
{
switch($base->getProject()->getType())
{
case 'local':
$type = 'LocalBuild';
break;
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;
}
case 'github':
$type = 'GithubBuild';
break;
$type = '\\PHPCI\\Model\\Build\\' . $type;
case 'bitbucket':
$type = 'BitbucketBuild';
break;
}
$type = '\\PHPCI\\Model\\Build\\' . $type;
return new $type($base->getDataArray());
}
}
return new $type($base->getDataArray());
}
}