PackageName   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 28
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B __invoke() 0 22 4
1
<?php
2
3
namespace Knp\MegaMAN\Filter;
4
5
use Knp\MegaMAN\Filter;
6
7
class PackageName implements Filter
8
{
9
    /**
10
     * {@inheritdoc}
11
     */
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