Conditions | 4 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
20 | 12 | public function __construct(array $config) |
|
21 | { |
||
22 | 12 | foreach ($config as $networkPrefixConfig) { |
|
23 | 12 | if (!($networkPrefixConfig instanceof NetworkConfig)) { |
|
24 | 1 | throw new \InvalidArgumentException("expecting array of NetworkPrefixConfig"); |
|
25 | } |
||
26 | |||
27 | 11 | $networkClass = get_class($networkPrefixConfig->getNetwork()); |
|
28 | 11 | if (array_key_exists($networkClass, $this->networkConfigs)) { |
|
29 | 1 | throw new \InvalidArgumentException("multiple configs for network"); |
|
30 | } |
||
31 | |||
32 | 11 | $this->networkConfigs[$networkClass] = $networkPrefixConfig; |
|
33 | } |
||
34 | 10 | } |
|
35 | |||
50 |