public static function getBuild(Build $build)
    {
        $project = $build->getProject();

        if (!empty($project)) {
            switch ($project->getType()) {
                case 'remote':
                    $type = 'RemoteGitBuild';
                    break;
                case 'local':
                    $type = 'LocalBuild';
                    break;
                case 'github':
                    $type = 'GithubBuild';
                    break;
                case 'bitbucket':
                    $type = 'BitbucketBuild';
                    break;
                case 'gitlab':
                    $type = 'GitlabBuild';
                    break;
                case 'hg':
                    $type = 'MercurialBuild';
                    break;
                case 'svn':
                    $type = 'SubversionBuild';
                    break;
                default:
                    return $build;
            }

            $class = '\\PHPCI\\Model\\Build\\' . $type;
            $build = new $class($build->getDataArray());
        }

        return $build;
    }
public static function getBuild(Build $build)
    {
        $project = $build->getProject();

        if (!empty($project)) {
            switch ($project->getType()) {
                case 'remote':
                    $type = 'RemoteGitBuild';
                    break;
                case 'local':
                    $type = 'LocalBuild';
                    break;
                case 'github':
                    $type = 'GithubBuild';
                    break;
                case 'bitbucket':
                    $type = 'BitbucketBuild';
                    break;
                case 'gitlab':
                    $type = 'GitlabBuild';
                    break;
                case 'hg':
                    $type = 'MercurialBuild';
                    break;
                case 'svn':
                    $type = 'SubversionBuild';
                    break;
                default:
                    return $build;
            }

            $class = '\\PHPCI\\Model\\Build\\' . $type;
            $build = new $class($build->getDataArray());
        }

        return $build;
    }
public static function getBuild ( Build $ build ) { $ project = $ build -> getProject ( ) ; if ( ! empty ( $ project ) ) { switch ( $ project -> getType ( ) ) { case 'remote' : $ type = 'RemoteGitBuild' ; break ; case 'local' : $ type = 'LocalBuild' ; break ; case 'github' : $ type = 'GithubBuild' ; break ; case 'bitbucket' : $ type = 'BitbucketBuild' ; break ; case 'gitlab' : $ type = 'GitlabBuild' ; break ; case 'hg' : $ type = 'MercurialBuild' ; break ; case 'svn' : $ type = 'SubversionBuild' ; break ; default : return $ build ; } $ class = '\\PHPCI\\Model\\Build\\' . $ type ; $ build = new $ class ( $ build -> getDataArray ( ) ) ; } return $ build ; }
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.
@return Build
Takes a generic build and returns a type - specific build model .