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