You are here

public static function Semver::latestVersion in Markdown 8.2

Retrieves the latest version from an array of versions.

Parameters

array $versions: The versions to search.

string $constraints: The constraints for which each version must satisfy.

Return value

string|void The latest version or NULL if one does not exist.

1 call to Semver::latestVersion()
InstallableLibrary::getLatestVersion in src/Annotation/InstallableLibrary.php
Retrieves the latest version based on available versions.

File

src/Util/Semver.php, line 112

Class

Semver
Extends the base Composer SemVer class with additional functionality.

Namespace

Drupal\markdown\Util

Code

public static function latestVersion(array $versions, $constraints) {
  $versions = static::satisfiedBy($versions, $constraints);
  if ($versions && ($versions = static::sort($versions))) {
    return array_pop($versions);
  }
}