public function getPreviousBuild($branch = 'master')
    {
        $criteria       = array('branch' => $branch, 'project_id' => $this->getId());

        $order          = array('id' => 'DESC');
        $builds         = Store\Factory::getStore('Build')->getWhere($criteria, 1, 1, array(), $order);

        if (is_array($builds['items']) && count($builds['items'])) {
            $previous = array_shift($builds['items']);

            if (isset($previous) && $previous instanceof Build) {
                return $previous;
            }
        }

        return null;
    }
public function getPreviousBuild($branch = 'master')
    {
        $criteria       = array('branch' => $branch, 'project_id' => $this->getId());

        $order          = array('id' => 'DESC');
        $builds         = Store\Factory::getStore('Build')->getWhere($criteria, 1, 1, array(), $order);

        if (is_array($builds['items']) && count($builds['items'])) {
            $previous = array_shift($builds['items']);

            if (isset($previous) && $previous instanceof Build) {
                return $previous;
            }
        }

        return null;
    }
public function getPreviousBuild ( $ branch = 'master' ) { $ criteria = array ( 'branch' => $ branch , 'project_id' => $ this -> getId ( ) ) ; $ order = array ( 'id' => 'DESC' ) ; $ builds = Store \ Factory :: getStore ( 'Build' ) -> getWhere ( $ criteria , 1 , 1 , array ( ) , $ order ) ; if ( is_array ( $ builds [ 'items' ] ) && count ( $ builds [ 'items' ] ) ) { $ previous = array_shift ( $ builds [ 'items' ] ) ; if ( isset ( $ previous ) && $ previous instanceof Build ) { return $ previous ; } } return null ; }
Return the previous build from a specific branch, for this project.
@param string $branch
@return mixed|null
Return the previous build from a specific branch for this project .