You are here

public static function VersionParser::parseStability in Automatic Updates 7

Returns the stability of a version.

Parameters

string $version:

Return value

string

1 call to VersionParser::parseStability()
VersionParser::parseConstraint in vendor/composer/semver/src/VersionParser.php

File

vendor/composer/semver/src/VersionParser.php, line 51

Class

VersionParser
Version parser.

Namespace

Composer\Semver

Code

public static function parseStability($version) {
  $version = preg_replace('{#.+$}i', '', $version);
  if (strpos($version, 'dev-') === 0 || '-dev' === substr($version, -4)) {
    return 'dev';
  }
  preg_match('{' . self::$modifierRegex . '(?:\\+.*)?$}i', strtolower($version), $match);
  if (!empty($match[3])) {
    return 'dev';
  }
  if (!empty($match[1])) {
    if ('beta' === $match[1] || 'b' === $match[1]) {
      return 'beta';
    }
    if ('alpha' === $match[1] || 'a' === $match[1]) {
      return 'alpha';
    }
    if ('rc' === $match[1]) {
      return 'RC';
    }
  }
  return 'stable';
}