Conditions | 5 |
Paths | 5 |
Total Lines | 19 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 5.0187 |
Changes | 0 |
1 | <?php |
||
26 | 6 | public function configure(string $fqcn, Criteria $criteria, $arguments) |
|
27 | { |
||
28 | 6 | if (!is_array($arguments)) { |
|
29 | 2 | throw NestedConfiguratorException::invalidType('array', gettype($arguments)); |
|
30 | } |
||
31 | |||
32 | 4 | $diff = array_keys(array_diff_key($arguments, $this->filters)); |
|
33 | 4 | if (count($diff) !== 0) { |
|
34 | 2 | throw NestedConfiguratorException::unknown($diff); |
|
35 | } |
||
36 | |||
37 | 2 | foreach ((array)$arguments as $filter => $item) { |
|
38 | try { |
||
39 | 2 | $this->filters[$filter]->configure($fqcn, $criteria, $item); |
|
40 | } catch (CriteriaConfigurationException $exception) { |
||
41 | 2 | throw NestedConfiguratorException::invalidNesting($filter, $exception); |
|
42 | } |
||
43 | } |
||
44 | 2 | } |
|
45 | } |
||
46 |