Completed
Pull Request — master (#552)
by Greg
03:19
created

YamlConfigLoader   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 16
rs 10
c 2
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 11 2
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
    protected $config = [];
14
15
    public function load($path)
16
    {
17
        $this->setSourceName($path);
18
19
        // We silently skip any nonexistent config files, so that
20
        // clients may simply `load` all of their candidates.
21
        if (!file_exists($path)) {
22
            return $this;
23
        }
24
        return $this->import(Yaml::parse(file_get_contents($path)));
25
    }
26
}
27