YAML::getReverseRepresentation()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 1
ccs 0
cts 0
cp 0
nc 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