diff --git a/src/Command/CoreListerVersions.php b/src/Command/CoreListerVersions.php index 11d0aab..0e92f9f 100644 --- a/src/Command/CoreListerVersions.php +++ b/src/Command/CoreListerVersions.php @@ -89,6 +89,22 @@ class CoreListerVersions extends Command { return $liste; } + public static function trouverVersionStable(?array $branches = [], ?array $tags = []) { + if (empty($branches)) { + $branches = self::listerVersions('branches'); + } + if (empty($tags)) { + $tags = self::listerVersions('tags'); + natsort($tags); + } + + $dernier_tag_xy = preg_replace('/(\d+).(\d+).\d+[a-z0-9+-]*$/', '${1}.${2}', end($tags)); + + if (array_search($dernier_tag_xy, $branches)) { + return $dernier_tag_xy; + } + } + /** * trouverVersionPrecedente *