YAML   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A toYAML() 0 4 1
A fromYAML() 0 5 1
getRepresentation() 0 1 ?
getReverseRepresentation() 0 1 ?
1
<?php
2
namespace einfach\representer\serializer;
3
4
use Symfony\Component\Yaml\Yaml as YamlDumper;
5
6
/**
7
 * Class JSON
8
 *
9
 * @package einfach\representer\serializer
10
 *
11
 */
12
trait YAML
13
{
14 2
    public function toYAML()
15
    {
16 2
        return YamlDumper::dump($this->getRepresentation());
17
    }
18
19 1
    public function fromYAML($string)
20
    {
21 1
        $projection = YamlDumper::parse($string);
22 1
        return $this->getReverseRepresentation($projection);
23
    }
24
25
    protected abstract function getRepresentation();
26
27
    protected abstract function getReverseRepresentation($projection);
28
}
29