SupportListNormalizer   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 32
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A normalize() 0 9 2
A denormalize() 0 9 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