Conditions | 3 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
25 | 7 | public function match(array|object $item, FilterInterface $filter, array $iterableFilterHandlers): bool |
|
26 | { |
||
27 | 7 | if (!$filter instanceof Not) { |
|
28 | 1 | throw new InvalidArgumentException('Incorrect filter.'); |
|
29 | } |
||
30 | |||
31 | 6 | $filterHandler = $iterableFilterHandlers[$filter->filter::class] ?? null; |
|
32 | 6 | if ($filterHandler === null) { |
|
33 | 1 | throw new LogicException(sprintf('Filter "%s" is not supported.', $filter->filter::class)); |
|
34 | } |
||
35 | 5 | return !$filterHandler->match($item, $filter->filter, $iterableFilterHandlers); |
|
36 | } |
||
38 |