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