public function VersionParser::normalizeBranch in Automatic Updates 7
Normalizes a branch name to be able to perform comparisons on it.
Parameters
string $name:
Return value
string
1 call to VersionParser::normalizeBranch()
- VersionParser::normalize in vendor/
composer/ semver/ src/ VersionParser.php - Normalizes a version string to be able to perform comparisons on it.
File
- vendor/
composer/ semver/ src/ VersionParser.php, line 202
Class
- VersionParser
- Version parser.
Namespace
Composer\SemverCode
public function normalizeBranch($name) {
$name = trim($name);
if (in_array($name, array(
'master',
'trunk',
'default',
))) {
return $this
->normalize($name);
}
if (preg_match('{^v?(\\d++)(\\.(?:\\d++|[xX*]))?(\\.(?:\\d++|[xX*]))?(\\.(?:\\d++|[xX*]))?$}i', $name, $matches)) {
$version = '';
for ($i = 1; $i < 5; ++$i) {
$version .= isset($matches[$i]) ? str_replace(array(
'*',
'X',
), 'x', $matches[$i]) : '.x';
}
return str_replace('x', '9999999', $version) . '-dev';
}
return 'dev-' . $name;
}