Conditions | 4 |
Paths | 4 |
Total Lines | 22 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
12 | public function __invoke(array $array) |
||
13 | { |
||
14 | $result = []; |
||
15 | |||
16 | foreach ($array as $definition) { |
||
17 | if (false === array_key_exists('composer', $definition)) { |
||
18 | continue; |
||
19 | } |
||
20 | |||
21 | $json = json_decode(file_get_contents($definition['composer']), true); |
||
22 | |||
23 | if (false === array_key_exists('name', $json)) { |
||
24 | continue; |
||
25 | } |
||
26 | |||
27 | $definition['package'] = $json['name']; |
||
28 | |||
29 | $result[] = $definition; |
||
30 | } |
||
31 | |||
32 | return $result; |
||
33 | } |
||
34 | } |
||
35 |