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

ConfigLoader::add()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
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
15
    public function add($data)
16
    {
17
        if ($data instanceof ConfigLoaderInterface) {
18
            $data = $data->export();
19
        }
20
        $this->config = Expander::expandArrayProperties($data, $this->config);
21
    }
22
23
    public function export()
24
    {
25
        return $this->config;
26
    }
27
}
28