Completed
Push — master ( 742ff7...9d59a2 )
by Nikola
09:00
created

ConfigLoaderAggregate   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A load() 0 10 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Phoundation\Config;
6
7
use function Phoundation\mergeConfig;
8
9
final class ConfigLoaderAggregate implements ConfigLoader
10
{
11
    /** @var ConfigLoader[] */
12
    private $configLoaders;
13
    
14
    public function __construct(ConfigLoader ...$configLoaders)
15
    {
16
        $this->configLoaders = $configLoaders;
17
    }
18
19
    public function load(): array
20
    {
21
        $config = [];
22
23
        foreach ($this->configLoaders as $configLoader) {
24
            $config = mergeConfig($config, $configLoader->load());
25
        }
26
27
        return $config;
28
    }
29
}
30