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

ComposerEncoder::supportsEncoding()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
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\Encoder;
3
4
use Symfony\Component\Serializer\Encoder\EncoderInterface;
5
use Yoanm\ComposerConfigManager\Application\Serializer\Encoder\ComposerEncoder as AppComposerEncoder;
6
7
class ComposerEncoder implements EncoderInterface
8
{
9
    const FORMAT = 'composer';
10
11
    /** @var AppComposerEncoder */
12
    private $appComposerEncoder;
13
14 3
    public function __construct(AppComposerEncoder $appComposerEncoder)
15
    {
16 3
        $this->appComposerEncoder = $appComposerEncoder;
17 3
    }
18
19
    /**
20
     * {@inheritdoc}
21
     */
22 1
    public function encode($data, $format, array $context = array())
23
    {
24 1
        return $this->appComposerEncoder->encode($data);
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30 2
    public function supportsEncoding($format)
31
    {
32 2
        return self::FORMAT === $format;
33
    }
34
}
35