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