Yaml::stringify()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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