Skip to content

Commit

Permalink
Merge pull request #2 from zaporylie/read
Browse files Browse the repository at this point in the history
Dynamically determine provider
  • Loading branch information
zaporylie committed Jul 15, 2018
2 parents 27974b4 + 984b852 commit cc5eb9f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
foreach (self::$lowestTags as $package => $lowestVersion) {
foreach (self::$lowestTags as $package => $lowestVersion) {
if (!isset($data['packages'][$package][$lowestVersion])) {
continue;
}
Expand Down

0 comments on commit cc5eb9f

Please sign in to comment.