Completed
Push — master ( 5e4c69...6bf127 )
by Tom
02:18
created

InflectorConfig::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

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