Composer

InstalledVersions::satisfies()public staticWPSCache 1.0

Checks whether the given package satisfies a version constraint

e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:

Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')

Метод класса: InstalledVersions{}

Хуков нет.

Возвращает

true|false.

Использование

$result = InstalledVersions::satisfies( $parser, $packageName, $constraint );
$parser(VersionParser) (обязательный)
Install composer/semver to have access to this class and functionality
$packageName(строка) (обязательный)
-
$constraint(строка|null) (обязательный)
A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package

Код InstalledVersions::satisfies() WPSCache 1.9.2

public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
    $constraint = $parser->parseConstraints($constraint);
    $provided = $parser->parseConstraints(self::getVersionRanges($packageName));

    return $provided->matches($constraint);
}