Passed
Push — master ( 80b57f...2460a5 )
by Yo
02:49
created

AutoloadListNormalizer::normalize()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 4

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 10
cts 10
cp 1
rs 9.2
c 0
b 0
f 0
cc 4
eloc 7
nc 4
nop 1
crap 4
1
<?php
2
namespace Yoanm\ComposerConfigManager\Application\Serializer\Normalizer;
3
4
use Yoanm\ComposerConfigManager\Domain\Model\Autoload;
5
6
class AutoloadListNormalizer
7
{
8
    /**
9
     * @param Autoload[] $autoloadList
10
     *
11
     * @return array
12
     */
13 2
    public function normalize(array $autoloadList)
14
    {
15 2
        $normalizeList = [];
16 2
        foreach ($autoloadList as $autoload) {
17 2
            if (count($autoload->getEntryList())) {
18 2
                foreach ($autoload->getEntryList() as $entry) {
19 2
                    $normalizeList[$autoload->getType()][$entry->getNamespace()] = $entry->getPath();
20 2
                }
21 2
            }
22 2
        }
23
24 2
        return $normalizeList;
25
    }
26
}
27