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