* @package PHPCI * @subpackage Core */ class Project extends ProjectBase { public function getLatestBuild($branch = 'master', $status = null) { $criteria = array('branch' => $branch, 'project_id' => $this->getId()); if (isset($status)) { $criteria['status'] = $status; } $order = array('id' => 'DESC'); $builds = Store\Factory::getStore('Build')->getWhere($criteria, 1, 0, array(), $order); if (is_array($builds['items']) && count($builds['items'])) { $latest = array_shift($builds['items']); if (isset($latest) && $latest instanceof Build) { return $latest; } } return null; } public function getAccessInformation($key = null) { $data = unserialize($this->data['access_information']); if (is_null($key)) { $rtn = $data; } elseif (isset($data[$key])) { $rtn = $data[$key]; } else { $rtn = null; } return $rtn; } /** * Get the value of Branch / branch. * * @return string */ public function getBranch() { if (empty($this->data['branch'])) { return $this->getType() === 'hg' ? 'default' : 'master'; } else { return $this->data['branch']; } } }