| Conditions | 5 |
| Paths | 5 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | 9 | public function match(object|array $item, FilterInterface $filter, array $iterableFilterHandlers): bool |
|
| 25 | { |
||
| 26 | 9 | if (!$filter instanceof Any) { |
|
| 27 | 1 | throw new InvalidArgumentException('Incorrect filter.'); |
|
| 28 | } |
||
| 29 | |||
| 30 | 8 | foreach ($filter->getFilters() as $subFilter) { |
|
| 31 | 8 | $filterHandler = $iterableFilterHandlers[$subFilter::class] ?? null; |
|
| 32 | 8 | if ($filterHandler === null) { |
|
| 33 | 1 | throw new LogicException(sprintf('Filter "%s" is not supported.', $subFilter::class)); |
|
| 34 | } |
||
| 35 | 7 | if ($filterHandler->match($item, $subFilter, $iterableFilterHandlers)) { |
|
| 36 | 6 | return true; |
|
| 37 | } |
||
| 38 | } |
||
| 39 | |||
| 40 | 2 | return false; |
|
| 41 | } |
||
| 43 |