protected static function Semver::satisfiedByStability in Markdown 8.2
Return all versions that satisfy a given minimum stability.
Parameters
array $versions: An array of versions that must be satisfied by a given stability.
string $minimumStability: The minimum stability the passed versions must satisfy. Can be one of: stable, RC, beta, alpha, or dev.
Return value
array The versions that are satisfied by the given minimum stability.
2 calls to Semver::satisfiedByStability()
- Semver::satisfiedBy in src/
Util/ Semver.php - Return all versions that satisfy given constraints.
- Semver::satisfies in src/
Util/ Semver.php - Determine if given version satisfies given constraints.
File
- src/
Util/ Semver.php, line 147
Class
- Semver
- Extends the base Composer SemVer class with additional functionality.
Namespace
Drupal\markdown\UtilCode
protected static function satisfiedByStability(array $versions, $minimumStability = 'stable') {
// Semver doesn't have a clean way to satisfy by stability.
// https://github.com/composer/semver/issues/49#issuecomment-266287082
$versionParser = static::versionParser();
$minimumStability = array_search($minimumStability, static::$stabilities, TRUE) ?: 0;
return array_filter($versions, function ($version) use ($versionParser, $minimumStability) {
$normalized = $versionParser
->normalize($version);
$stability = array_search($versionParser::parseStability($normalized), static::$stabilities, TRUE) ?: 0;
return $stability >= $minimumStability;
});
}