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