protected function getStatus($projectId)
    {
        $branch = $this->getParam('branch', 'master');
        try {
            $project = $this->projectStore->getById($projectId);
            $status = 'passing';

            if (!$project->getAllowPublicStatus()) {
                return null;
            }

            if (isset($project) && $project instanceof Project) {
                $build = $project->getLatestBuild($branch, array(2,3));

                if (isset($build) && $build instanceof Build && $build->getStatus() != 2) {
                    $status = 'failed';
                }
            }
        } catch (\Exception $e) {
            $status = 'error';
        }

        return $status;
    }
protected function getStatus($projectId)
    {
        $branch = $this->getParam('branch', 'master');
        try {
            $project = $this->projectStore->getById($projectId);
            $status = 'passing';

            if (!$project->getAllowPublicStatus()) {
                return null;
            }

            if (isset($project) && $project instanceof Project) {
                $build = $project->getLatestBuild($branch, array(2,3));

                if (isset($build) && $build instanceof Build && $build->getStatus() != 2) {
                    $status = 'failed';
                }
            }
        } catch (\Exception $e) {
            $status = 'error';
        }

        return $status;
    }
protected function getStatus ( $ projectId ) { $ branch = $ this -> getParam ( 'branch' , 'master' ) ; try { $ project = $ this -> projectStore -> getById ( $ projectId ) ; $ status = 'passing' ; if ( ! $ project -> getAllowPublicStatus ( ) ) { return null ; } if ( isset ( $ project ) && $ project instanceof Project ) { $ build = $ project -> getLatestBuild ( $ branch , array ( 2 , 3 ) ) ; if ( isset ( $ build ) && $ build instanceof Build && $ build -> getStatus ( ) != 2 ) { $ status = 'failed' ; } } } catch ( \ Exception $ e ) { $ status = 'error' ; } return $ status ; }
Returns status of the last build
@param $projectId
@return string
Returns status of the last build