Conditions | 6 |
Paths | 6 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
24 | 11 | public function match(array|object $item, FilterInterface $filter, array $iterableFilterHandlers): bool |
|
25 | { |
||
26 | /** @var Between $filter */ |
||
27 | |||
28 | 11 | $value = ArrayHelper::getValue($item, $filter->getField()); |
|
29 | 11 | $min = $filter->getMinValue(); |
|
30 | 11 | $max = $filter->getMaxValue(); |
|
31 | |||
32 | 11 | if (!$value instanceof DateTimeInterface) { |
|
33 | 6 | return $value >= $min && $value <= $max; |
|
34 | } |
||
35 | |||
36 | 5 | return $min instanceof DateTimeInterface |
|
37 | 5 | && $max instanceof DateTimeInterface |
|
38 | 5 | && $value->getTimestamp() >= $min->getTimestamp() |
|
39 | 5 | && $value->getTimestamp() <= $max->getTimestamp(); |
|
40 | } |
||
42 |