YamlHandler   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 34
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 4 1
A save() 0 4 1
A parseInline() 0 4 1
A dumpInline() 0 4 1
1
<?php
2
3
namespace Incenteev\ParameterHandler\FileHandler;
4
5
use Symfony\Component\Yaml\Inline;
6
use Symfony\Component\Yaml\Yaml;
7
8
class YamlHandler
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function load($filePath)
14
    {
15
        return Yaml::parse(file_get_contents($filePath));
16
    }
17
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function save($filePath, $data)
22
    {
23
        return file_put_contents($filePath, "# This file is auto-generated during the composer install\n" . Yaml::dump($data, 99));
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function parseInline($value)
30
    {
31
        return Inline::parse($value);
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function dumpInline($value)
38
    {
39
        return Inline::dump($value);
40
    }
41
}
42