Conditions | 6 |
Paths | 6 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
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->field); |
|
29 | |||
30 | 11 | if (!$value instanceof DateTimeInterface) { |
|
31 | 6 | return $value >= $filter->minValue && $value <= $filter->maxValue; |
|
32 | } |
||
33 | |||
34 | 5 | return $filter->minValue instanceof DateTimeInterface |
|
35 | 5 | && $filter->maxValue instanceof DateTimeInterface |
|
36 | 5 | && $value->getTimestamp() >= $filter->minValue->getTimestamp() |
|
37 | 5 | && $value->getTimestamp() <= $filter->maxValue->getTimestamp(); |
|
38 | } |
||
40 |