Completed
Pull Request — master (#552)
by Greg
02:57
created

YamlConfigLoader::load()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
dl 0
loc 12
rs 9.4285
c 2
b 0
f 0
cc 2
eloc 6
nc 2
nop 1
1
<?php
2
3
namespace Robo\Config;
4
5
use Symfony\Component\Yaml\Yaml;
6
7
/**
8
 * Load configuration files, and fill in any property values that
9
 * need to be expanded.
10
 */
11
class YamlConfigLoader extends ConfigLoader
12
{
13
    public function load($path)
14
    {
15
        $this->setSourceName($path);
16
17
        // We silently skip any nonexistent config files, so that
18
        // clients may simply `load` all of their candidates.
19
        if (!file_exists($path)) {
20
            return $this;
21
        }
22
        $this->config = (array) Yaml::parse(file_get_contents($path));
23
        return $this;
24
    }
25
}
26