Passed
Pull Request — master (#5)
by Yo
02:29
created

ConfigurationNormalizer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 29
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A normalize() 0 4 1
A supportsNormalization() 0 4 1
1
<?php
2
namespace Yoanm\ComposerConfigManager\Infrastructure\Serializer\Normalizer;
3
4
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
5
use Yoanm\ComposerConfigManager\Application\Serializer\Normalizer\ConfigurationNormalizer as AppConfigNormalizer;
6
use Yoanm\ComposerConfigManager\Domain\Model\Configuration;
7
8
class ConfigurationNormalizer implements NormalizerInterface
9
{
10
    /** @var AppConfigNormalizer */
11
    private $appConfigurationNormalizer;
12
13
    /**
14
     * @param AppConfigNormalizer $appConfigurationNormalizer
15
     */
16 3
    public function __construct(AppConfigNormalizer $appConfigurationNormalizer)
17
    {
18 3
        $this->appConfigurationNormalizer = $appConfigurationNormalizer;
19 3
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24 1
    public function normalize($object, $format = null, array $context = array())
25
    {
26 1
        return $this->appConfigurationNormalizer->normalize($object);
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32 2
    public function supportsNormalization($data, $format = null)
33
    {
34 2
        return $data instanceof Configuration;
35
    }
36
}
37