Completed
Push — master ( 059a7f...25fd12 )
by Oscar
02:16
created

Yaml   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 26
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getExtension() 0 4 1
A stringify() 0 4 1
A parse() 0 4 1
1
<?php
2
3
namespace FlyCrud\Formats;
4
5
use FlyCrud\FormatInterface;
6
use Symfony\Component\Yaml\Yaml as YamlConverter;
7
8
class Yaml implements FormatInterface
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function getExtension()
14
    {
15
        return 'yml';
16
    }
17
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function stringify(array $data)
22
    {
23
        return YamlConverter::dump($data);
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function parse($source)
30
    {
31
        return (array) YamlConverter::parse($source);
32
    }
33
}
34