Test Failed
Branch v0.2 (3b8de8)
by Freddie
02:14
created

ChainDefinitionLoader   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 2
A load() 0 4 2
A addLoader() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace Simplex\DefinitionLoader;
4
5
use DI\ContainerBuilder as ContainerBuilder;
6
7
class ChainDefinitionLoader implements DefinitionLoader
8
{
9
    /** @var DefinitionLoader[] */
10
    private $loaders;
11
12
    /** @param DefinitionLoader[] $loaders */
13
    public function __construct(...$loaders)
14
    {
15
        foreach ($loaders as $loader) {
16
            $this->addLoader($loader);
0 ignored issues
show
Bug introduced by
$loader of type Simplex\DefinitionLoader\DefinitionLoader[] is incompatible with the type Simplex\DefinitionLoader\DefinitionLoader expected by parameter $loader of Simplex\DefinitionLoader...tionLoader::addLoader(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

16
            $this->addLoader(/** @scrutinizer ignore-type */ $loader);
Loading history...
17
        }
18
    }
19
20
    private function addLoader(DefinitionLoader $loader): void
21
    {
22
        $this->loaders[] = $loader;
23
    }
24
25
    public function load(ContainerBuilder $containerBuilder): void
26
    {
27
        foreach ($this->loaders as $loader) {
28
            $loader->load($containerBuilder);
29
        }
30
    }
31
}
32