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

YamlTransformer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 25
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A transform() 0 4 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