YamlLoader::load()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Sinergi\Config\Loader;
4
5
use Symfony\Component\Yaml\Parser;
6
7
class YamlLoader implements LoaderInterface
8
{
9
    const EXTENSION = 'yaml';
10
11
    /**
12
     * @var Parser
13
     */
14
    protected static $parser;
15
16
    /**
17
     * @return Parser
18
     */
19
    protected static function getParser()
20
    {
21
        if (null === self::$parser) {
22
            self::$parser = new Parser();
23
        }
24
        return self::$parser;
25
    }
26
27
    public static function load($file)
28
    {
29
        return self::getParser()->parse(file_get_contents($file));
30
    }
31
}
32