ConfigurationSet   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 32
ccs 15
cts 15
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A apply() 0 9 3
A assertValid() 0 10 3
1
<?php
2
3
namespace Equip\Configuration;
4
5
use Auryn\Injector;
6
use Equip\Exception\ConfigurationException;
7
use Equip\Structure\Set;
8
9
class ConfigurationSet extends Set implements ConfigurationInterface
10
{
11
    /**
12
     * @inheritDoc
13
     */
14 2
    public function apply(Injector $injector)
15
    {
16 2
        foreach ($this as $configuration) {
17 2
            if (!is_object($configuration)) {
18 1
                $configuration = $injector->make($configuration);
19 1
            }
20 2
            $configuration->apply($injector);
21 2
        }
22 2
    }
23
24
    /**
25
     * @inheritDoc
26
     *
27
     * @throws ConfigurationException
28
     *  If $classes does not implement the correct interface.
29
     */
30 3
    protected function assertValid(array $classes)
31
    {
32 3
        parent::assertValid($classes);
33
34 3
        foreach ($classes as $config) {
35 3
            if (!is_subclass_of($config, ConfigurationInterface::class)) {
36 1
                throw ConfigurationException::invalidClass($config);
37
            }
38 3
        }
39 3
    }
40
}
41