Yaml   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

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
declare(strict_types = 1);
3
4
namespace FlyCrud\Formats;
5
6
use FlyCrud\FormatInterface;
7
use Symfony\Component\Yaml\Yaml as YamlConverter;
8
9
class Yaml implements FormatInterface
10
{
11
    public function getExtension(): string
12
    {
13
        return 'yml';
14
    }
15
16
    public function stringify(array $data): string
17
    {
18
        return YamlConverter::dump($data);
19
    }
20
21
    public function parse(string $source): array
22
    {
23
        return (array) YamlConverter::parse($source);
24
    }
25
}
26