Conditions | 7 |
Paths | 7 |
Total Lines | 31 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
25 | public function __invoke(array $array) |
||
26 | { |
||
27 | $result = []; |
||
28 | $json = json_decode(file_get_contents($this->installed), true); |
||
29 | |||
30 | foreach ($array as $definition) { |
||
31 | if (false === array_key_exists('package', $definition)) { |
||
32 | continue; |
||
33 | } |
||
34 | |||
35 | $definition['url'] = ''; |
||
36 | |||
37 | foreach ($json as $installed) { |
||
38 | if ($installed['name'] === $definition['package']) { |
||
39 | if (false === array_key_exists('source', $installed)) { |
||
40 | continue; |
||
41 | } |
||
42 | |||
43 | if (false === array_key_exists('url', $installed['source'])) { |
||
44 | continue; |
||
45 | } |
||
46 | |||
47 | $definition['url'] = $installed['source']['url']; |
||
48 | } |
||
49 | } |
||
50 | |||
51 | $result[] = $definition; |
||
52 | } |
||
53 | |||
54 | return $result; |
||
55 | } |
||
56 | } |
||
57 |