Passed
Push — master ( f03a56...8d49be )
by Dominik
02:42
created

YamlTransformer::transform()   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
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\Deserialization\Transformer;
6
7
use Symfony\Component\Yaml\Yaml;
8
9
final class YamlTransformer implements TransformerInterface
10
{
11
    /**
12
     * @var int
13
     */
14
    private $flags;
15
16
    /**
17
     * @param int $flags
18
     */
19 1
    public function __construct(int $flags = 0)
20
    {
21 1
        $this->flags = $flags;
22 1
    }
23
24
    /**
25
     * @param string $string
26
     *
27
     * @return array
28
     */
29 1
    public function transform(string $string): array
30
    {
31 1
        return Yaml::parse($string, $this->flags);
32
    }
33
}
34