Completed
Push — master ( 68fe25...8e1e8c )
by Woody
11s
created

YamlLoader   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 25
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getParser() 0 7 2
A load() 0 4 1
1
<?php
2
3
namespace Northwoods\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 2
    protected static function getParser()
20
    {
21 2
        if (null === self::$parser) {
22 1
            self::$parser = new Parser();
23
        }
24 2
        return self::$parser;
25
    }
26
27 2
    public static function load($file)
28
    {
29 2
        return self::getParser()->parse(file_get_contents($file));
30
    }
31
}
32