Yaml   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 21
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 4 1
A fromArray() 0 4 1
1
<?php
2
3
namespace BestServedCold\PhalueObjects\Format;
4
5
use BestServedCold\PhalueObjects\Contract\VOArrayable;
6
use BestServedCold\PhalueObjects\VOString;
7
use Symfony\Component\Yaml\Yaml as SymfonyYaml;
8
use BestServedCold\PhalueObjects\VOArray\Mixin as VOArrayMixin;
9
10
/**
11
 * Class Yaml
12
 *
13
 * @package BestServedCold\PhalueObjects\File
14
 */
15
class Yaml extends VOString implements VOArrayable
16
{
17
    use StringMixin;
18
19
    /**
20
     * @return array
21
     */
22 2
    public function toArray()
23
    {
24 2
        return (array) SymfonyYaml::parse($this->getValue());
25
    }
26
27
    /**
28
     * @param  array  $array
29
     * @return static
30
     */
31 2
    public static function fromArray(array $array)
32
    {
33 2
        return new static(SymfonyYaml::dump($array));
34
    }
35
}
36