function VersionParser::normalizeBranch
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 217
Class
- VersionParser
- Version parser.
Namespace
Composer\SemverCode
public function normalizeBranch($name) {
$name = trim((string) $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;
}