function ProjectCoreCompatibility::getCompatibilityRanges
Same name in other branches
- 9 core/modules/update/src/ProjectCoreCompatibility.php \Drupal\update\ProjectCoreCompatibility::getCompatibilityRanges()
- 8.9.x core/modules/update/src/ProjectCoreCompatibility.php \Drupal\update\ProjectCoreCompatibility::getCompatibilityRanges()
- 10 core/modules/update/src/ProjectCoreCompatibility.php \Drupal\update\ProjectCoreCompatibility::getCompatibilityRanges()
Gets the compatibility ranges for a semantic version constraint.
Parameters
string $core_compatibility_constraint: A semantic version constraint.
Return value
array[] An array compatibility ranges. If a range array has 2 elements then this denotes a range of compatibility between and including the 2 versions. If the range has 1 element then it denotes compatibility with a single version.
1 call to ProjectCoreCompatibility::getCompatibilityRanges()
- ProjectCoreCompatibility::createMessageFromCoreCompatibility in core/
modules/ update/ src/ ProjectCoreCompatibility.php - Creates core a compatibility message from a semantic version constraint.
File
-
core/
modules/ update/ src/ ProjectCoreCompatibility.php, line 218
Class
- ProjectCoreCompatibility
- Utility class to set core compatibility messages for project releases.
Namespace
Drupal\updateCode
protected function getCompatibilityRanges($core_compatibility_constraint) {
$compatibility_ranges = [];
foreach ($this->possibleCoreUpdateVersions as $possible_core_update_version) {
if (Semver::satisfies($possible_core_update_version, $core_compatibility_constraint)) {
if (empty($range)) {
$range[] = $possible_core_update_version;
}
else {
$range[1] = $possible_core_update_version;
}
}
else {
// If core version does not satisfy the constraint and there is a non
// empty range, add it to the list of ranges.
if (!empty($range)) {
$compatibility_ranges[] = $range;
// Start a new range.
$range = [];
}
}
}
if (!empty($range)) {
$compatibility_ranges[] = $range;
}
return $compatibility_ranges;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.