From 984b8521ca4edabe96a55351a6e3fad5b45fdd88 Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Sun, 15 Jul 2018 19:47:52 +0200 Subject: [PATCH] Dynamically determine provider --- src/Cache.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Cache.php b/src/Cache.php index 8ae6136..c0e74a9 100644 --- a/src/Cache.php +++ b/src/Cache.php @@ -16,16 +16,20 @@ class Cache extends BaseCache public function read($file) { - $content = parent::read($file); - if (0 === strpos($file, 'provider-symfony$')) { - $content = json_encode($this->removeLegacyTags(json_decode($content, true))); + $content = parent::read($file); + foreach (array_keys(self::$lowestTags) as $key) { + list($provider, ) = explode('/', $key, 2); + if (0 === strpos($file, "provider-$provider\$")) { + $content = json_encode($this->removeLegacyTags(json_decode($content, true))); + break; + } } return $content; } public function removeLegacyTags(array $data): array { - foreach (self::$lowestTags as $package => $lowestVersion) { + foreach (self::$lowestTags as $package => $lowestVersion) { if (!isset($data['packages'][$package][$lowestVersion])) { continue; }