Conditions | 3 |
Paths | 1 |
Total Lines | 13 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
18 | 2 | public function getAsWhereArguments(array $arguments, array $handlers): array |
|
19 | { |
||
20 | 2 | $this->validateArguments($arguments); |
|
21 | 2 | return [ |
|
22 | 2 | static function (QueryBuilder $select) use ($arguments, $handlers) { |
|
23 | 2 | foreach ($arguments[0] as $subFilter) { |
|
24 | 2 | $operation = array_shift($subFilter); |
|
25 | 2 | $handler = $handlers[$operation] ?? null; |
|
26 | 2 | if ($handler === null) { |
|
27 | 1 | throw new \RuntimeException(sprintf('Filter operator "%s" is not supported.', $operation)); |
|
28 | } |
||
29 | /** @var QueryBuilderFilterHandler $handler */ |
||
30 | 1 | $select->orWhere(...$handler->getAsWhereArguments($subFilter, $handlers)); |
|
31 | } |
||
36 |