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