Completed
Pull Request — master (#28)
by Tom
27:09
created

InflectorConfig::getIterator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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