public static function matchesStrategy($strategy, Release $release1, Release $release2 = null)
    {
        if (in_array($strategy, array(self::MATCH_MAJOR_DIFFERENCE, self::MATCH_MINOR_DIFFERENCE, self::MATCH_ALWAYS)) === false) {
            throw new InvalidArgumentException(sprintf('The match strategy "%s" is invalid.', $strategy));
        }

        if ($strategy === self::MATCH_ALWAYS) {
            return true;
        }

        $match = false;
        $versionCategoryDifference = self::getDifference($release1, $release2);
        if ($strategy === self::MATCH_MAJOR_DIFFERENCE && $versionCategoryDifference === self::MAJOR) {
            $match = true;
        } elseif ($strategy === self::MATCH_MINOR_DIFFERENCE && in_array($versionCategoryDifference, array(self::MAJOR, self::MINOR))) {
            $match = true;
        }

        return $match;
    }
public static function matchesStrategy($strategy, Release $release1, Release $release2 = null)
    {
        if (in_array($strategy, array(self::MATCH_MAJOR_DIFFERENCE, self::MATCH_MINOR_DIFFERENCE, self::MATCH_ALWAYS)) === false) {
            throw new InvalidArgumentException(sprintf('The match strategy "%s" is invalid.', $strategy));
        }

        if ($strategy === self::MATCH_ALWAYS) {
            return true;
        }

        $match = false;
        $versionCategoryDifference = self::getDifference($release1, $release2);
        if ($strategy === self::MATCH_MAJOR_DIFFERENCE && $versionCategoryDifference === self::MAJOR) {
            $match = true;
        } elseif ($strategy === self::MATCH_MINOR_DIFFERENCE && in_array($versionCategoryDifference, array(self::MAJOR, self::MINOR))) {
            $match = true;
        }

        return $match;
    }
public static function matchesStrategy ( $ strategy , Release $ release1 , Release $ release2 = null ) { if ( in_array ( $ strategy , array ( self :: MATCH_MAJOR_DIFFERENCE , self :: MATCH_MINOR_DIFFERENCE , self :: MATCH_ALWAYS ) ) === false ) { throw new InvalidArgumentException ( sprintf ( 'The match strategy "%s" is invalid.' , $ strategy ) ) ; } if ( $ strategy === self :: MATCH_ALWAYS ) { return true ; } $ match = false ; $ versionCategoryDifference = self :: getDifference ( $ release1 , $ release2 ) ; if ( $ strategy === self :: MATCH_MAJOR_DIFFERENCE && $ versionCategoryDifference === self :: MAJOR ) { $ match = true ; } elseif ( $ strategy === self :: MATCH_MINOR_DIFFERENCE && in_array ( $ versionCategoryDifference , array ( self :: MAJOR , self :: MINOR ) ) ) { $ match = true ; } return $ match ; }
Returns true when the version category difference matches the supplied match strategy.

@param string  $strategy
@param Release $release1
@param Release $release2

@return bool

@throws InvalidArgumentException
Returns true when the version category difference matches the supplied match strategy .