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

InflectorConfig   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 1
cbo 1
dl 0
loc 25
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 2
A getIterator() 0 4 1
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