From 762deda34b430996af49af49168cbdead7c9ba1f Mon Sep 17 00:00:00 2001 From: Christopher Fuchs Date: Sun, 25 Oct 2020 09:24:27 +0100 Subject: [PATCH] Added support for composer 2.0 * Removed thadafinser/package-info and use composer-runtime-api --- composer.json | 2 +- src/Provider/AbstractProvider.php | 19 +++++-------------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/composer.json b/composer.json index 71faf4b..668c3e3 100644 --- a/composer.json +++ b/composer.json @@ -71,7 +71,7 @@ "require": { "php": "~5.6|~7.0", "guzzlehttp/guzzle": "^6.1", - "thadafinser/package-info": "^1.0" + "composer-runtime-api": "^2.0" }, "conflict": { diff --git a/src/Provider/AbstractProvider.php b/src/Provider/AbstractProvider.php index 8c95564..bd56f3f 100644 --- a/src/Provider/AbstractProvider.php +++ b/src/Provider/AbstractProvider.php @@ -1,9 +1,8 @@ getPackageName()); - - return $package->getVersion(); - } catch (PackageNotInstalledException $ex) { + return InstalledVersions::getVersion($this->getPackageName()); + } catch (\OutOfBoundsException $ex) { return; } } @@ -138,13 +135,7 @@ public function getVersion() */ public function getUpdateDate() { - try { - $package = new Package($this->getPackageName()); - - return $package->getVersionReleaseDate(); - } catch (PackageNotInstalledException $ex) { - return; - } + return; } /** @@ -163,7 +154,7 @@ public function getDetectionCapabilities() */ protected function checkIfInstalled() { - if (! Package::isInstalled($this->getPackageName())) { + if (! InstalledVersions::isInstalled($this->getPackageName())) { throw new PackageNotLoadedException('You need to install the package ' . $this->getPackageName() . ' to use this provider'); } }