SupportListNormalizer::denormalize()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
crap 2
1
<?php
2
namespace Yoanm\ComposerConfigManager\Application\Serializer\Normalizer;
3
4
use Yoanm\ComposerConfigManager\Domain\Model\Support;
5
6
class SupportListNormalizer implements DenormalizerInterface
7
{
8
    /**
9
     * @param Support[] $supportList
10
     *
11
     * @return array
12
     */
13 1
    public function normalize(array $supportList)
14
    {
15 1
        $normalizedList = [];
16 1
        foreach ($supportList as $support) {
17 1
            $normalizedList[$support->getType()] = $support->getUrl();
18 1
        }
19
20 1
        return $normalizedList;
21
    }
22
23
    /**
24
     * @param array $supportList
25
     *
26
     * @return Support[]
27
     */
28 1
    public function denormalize(array $supportList)
29
    {
30 1
        $denormalizedList = [];
31 1
        foreach ($supportList as $supportType => $supportUrl) {
32 1
            $denormalizedList[] = new Support($supportType, $supportUrl);
33 1
        }
34
35 1
        return $denormalizedList;
36
    }
37
}
38