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

ConfigurationNormalizer::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 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