public function findRecent(Version $version, $major = false, $pre = false)
    {
        /** @var $current Update */
        $current = null;
        $major = $major ? $version->getMajor() : null;

        foreach ($this->updates as $update) {
            if ($major && ($major !== $update->getVersion()->getMajor())) {
                continue;
            }

            if ((false === $pre)
                && !$update->getVersion()->isStable()) {
                continue;
            }

            $test = $current ? $current->getVersion() : $version;

            if (false === $update->isNewer($test)) {
                continue;
            }

            $current = $update;
        }

        return $current;
    }
public function findRecent(Version $version, $major = false, $pre = false)
    {
        /** @var $current Update */
        $current = null;
        $major = $major ? $version->getMajor() : null;

        foreach ($this->updates as $update) {
            if ($major && ($major !== $update->getVersion()->getMajor())) {
                continue;
            }

            if ((false === $pre)
                && !$update->getVersion()->isStable()) {
                continue;
            }

            $test = $current ? $current->getVersion() : $version;

            if (false === $update->isNewer($test)) {
                continue;
            }

            $current = $update;
        }

        return $current;
    }
public function findRecent ( Version $ version , $ major = false , $ pre = false ) { /** @var $current Update */ $ current = null ; $ major = $ major ? $ version -> getMajor ( ) : null ; foreach ( $ this -> updates as $ update ) { if ( $ major && ( $ major !== $ update -> getVersion ( ) -> getMajor ( ) ) ) { continue ; } if ( ( false === $ pre ) && ! $ update -> getVersion ( ) -> isStable ( ) ) { continue ; } $ test = $ current ? $ current -> getVersion ( ) : $ version ; if ( false === $ update -> isNewer ( $ test ) ) { continue ; } $ current = $ update ; } return $ current ; }
Finds the most recent update and returns it.

@param Version $version The current version.
@param boolean $major   Lock to major version?
@param boolean $pre     Allow pre-releases?

@return Update The update.
Finds the most recent update and returns it .