From a5feee5594a4e5f1ec498cb81d4eee5bad976d47 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 10 Feb 2025 16:47:22 +0100 Subject: better handling of package with version in name --- class/PackagistClient.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'class/PackagistClient.php') diff --git a/class/PackagistClient.php b/class/PackagistClient.php index 2120d36..5ea8429 100644 --- a/class/PackagistClient.php +++ b/class/PackagistClient.php @@ -68,10 +68,9 @@ class PackagistClient return ($rep ? json_decode($rep, true) : false); } - function getPackage($name) + function getPackage($name, $crt=0, $max=0) { $unstable = array('alpha', 'beta', 'rc'); - $ret = false; $pkgs = $this->getPackageData($name); if ($pkgs) { @@ -83,6 +82,9 @@ class PackagistClient ); foreach ($pkgs['package']['versions'] as $notused => $pkg) { $pkver = $pkg['version']; + if ($pkver < $crt || $pkver > $max) { + continue; + } if (preg_match('/^v[0-9]/', $pkver)) { $pkver = substr($pkver, 1); } -- cgit