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

ConfigLoader::getSourceName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Robo\Config;
4
5
use Grasmash\YamlExpander\Expander;
6
7
/**
8
 * Load configuration files, and fill in any property values that
9
 * need to be expanded.
10
 */
11
class ConfigLoader implements ConfigLoaderInterface
12
{
13
    protected $config = [];
14
    protected $source = '';
15
16
    public function getSourceName()
17
    {
18
        return $this->source;
19
    }
20
21
    public function setSourceName($source)
22
    {
23
        $this->source = $source;
24
    }
25
26
    public function add($data)
27
    {
28
        if ($data instanceof ConfigLoaderInterface) {
29
            $data = $data->export();
30
        }
31
        $this->config = Expander::expandArrayProperties($data, $this->config);
32
    }
33
34
    public function export()
35
    {
36
        return $this->config;
37
    }
38
}
39