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

ConfigLoader   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 17
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 0 7 2
A export() 0 4 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