function LegacyVersionUtility::convertToSemanticVersion
Converts a version number to a semantic version if needed.
Parameters
string $version: The version number.
Return value
string The version number, converted if needed.
1 call to LegacyVersionUtility::convertToSemanticVersion()
- ProjectInfo::getInstallableReleases in core/
modules/ package_manager/ src/ ProjectInfo.php - Gets all project releases to which the site can update.
File
-
core/
modules/ package_manager/ src/ LegacyVersionUtility.php, line 27
Class
- LegacyVersionUtility
- A utility class for dealing with legacy version numbers.
Namespace
Drupal\package_managerCode
public static function convertToSemanticVersion(string $version) : string {
if (self::isLegacyVersion($version)) {
$version = substr($version, 4);
$version_parts = explode('-', $version);
$version = $version_parts[0] . '.0';
if (count($version_parts) === 2) {
$version .= '-' . $version_parts[1];
}
}
return $version;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.