You are here

public static function VersionParser::parseStability in Zircon Profile 8

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

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 41

Class

VersionParser
Version parser.

Namespace

Composer\Semver

Code

public static function parseStability($version) {
  $version = preg_replace('{#.+$}i', '', $version);
  if ('dev-' === substr($version, 0, 4) || '-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';
}