Skip to content

Commit cc5eb9f

Browse files
authored
Merge pull request zaporylie#2 from zaporylie/read
Dynamically determine provider
2 parents 27974b4 + 984b852 commit cc5eb9f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/Cache.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,20 @@ class Cache extends BaseCache
1616

1717
public function read($file)
1818
{
19-
$content = parent::read($file);
20-
if (0 === strpos($file, 'provider-symfony$')) {
21-
$content = json_encode($this->removeLegacyTags(json_decode($content, true)));
19+
$content = parent::read($file);
20+
foreach (array_keys(self::$lowestTags) as $key) {
21+
list($provider, ) = explode('/', $key, 2);
22+
if (0 === strpos($file, "provider-$provider\$")) {
23+
$content = json_encode($this->removeLegacyTags(json_decode($content, true)));
24+
break;
25+
}
2226
}
2327
return $content;
2428
}
2529

2630
public function removeLegacyTags(array $data)
2731
{
28-
foreach (self::$lowestTags as $package => $lowestVersion) {
32+
foreach (self::$lowestTags as $package => $lowestVersion) {
2933
if (!isset($data['packages'][$package][$lowestVersion])) {
3034
continue;
3135
}

0 commit comments

Comments
 (0)