You are here

public static function Semver::satisfies in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/composer/semver/src/Semver.php \Composer\Semver\Semver::satisfies()

Determine if given version satisfies given constraints.

Parameters

string $version:

string $constraints:

Return value

bool

1 call to Semver::satisfies()
Semver::satisfiedBy in vendor/composer/semver/src/Semver.php
Return all versions that satisfy given constraints.

File

vendor/composer/semver/src/Semver.php, line 32

Class

Semver

Namespace

Composer\Semver

Code

public static function satisfies($version, $constraints) {
  if (null === self::$versionParser) {
    self::$versionParser = new VersionParser();
  }
  $versionParser = self::$versionParser;
  $provider = new Constraint('==', $versionParser
    ->normalize($version));
  $constraints = $versionParser
    ->parseConstraints($constraints);
  return $constraints
    ->matches($provider);
}