Conditions | 8 |
Paths | 8 |
Total Lines | 26 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 72 |
Changes | 0 |
1 | <?php |
||
12 | protected function validateArguments(array $arguments): void |
||
13 | { |
||
14 | if (count($arguments) === 0) { |
||
15 | throw new InvalidArgumentException('At least one argument should be provided.'); |
||
16 | } |
||
17 | |||
18 | if (!is_array($arguments[0])) { |
||
19 | throw new InvalidArgumentException('Sub filters is not an array.'); |
||
20 | } |
||
21 | |||
22 | foreach ($arguments[0] as $subFilter) { |
||
23 | if (!is_array($subFilter)) { |
||
24 | throw new InvalidArgumentException('Sub filter is not an array.'); |
||
25 | } |
||
26 | |||
27 | if (count($subFilter) === 0) { |
||
28 | throw new InvalidArgumentException('At least operator should be provided.'); |
||
29 | } |
||
30 | |||
31 | $operator = array_shift($subFilter); |
||
32 | if (!is_string($operator)) { |
||
33 | throw new InvalidArgumentException('Operator is not a string.'); |
||
34 | } |
||
35 | |||
36 | if ($operator === '') { |
||
37 | throw new InvalidArgumentException('The operator string cannot be empty.'); |
||
38 | } |
||
42 |