InflectorConfig::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 1
1
<?php
2
3
namespace TomPHP\ContainerConfigurator;
4
5
use ArrayIterator;
6
use IteratorAggregate;
7
8
/**
9
 * @internal
10
 */
11
final class InflectorConfig implements IteratorAggregate
12
{
13
    /**
14
     * @var array
15
     */
16
    private $inflectors;
17
18
    /**
19
     * @param array $config
20
     */
21
    public function __construct(array $config)
22
    {
23
        $this->inflectors = [];
24
25
        foreach ($config as $interfaceName => $methods) {
26
            $this->inflectors[] = new InflectorDefinition(
27
                $interfaceName,
28
                $methods
29
            );
30
        }
31
    }
32
33
    public function getIterator()
34
    {
35
        return new ArrayIterator($this->inflectors);
36
    }
37
}
38