Conditions | 4 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
25 | 40 | public function match(object|array $item, FilterInterface $filter, array $iterableFilterHandlers): bool |
|
26 | { |
||
27 | 40 | if (!$filter instanceof GreaterThanOrEqual) { |
|
28 | 1 | throw new InvalidArgumentException('Incorrect filter.'); |
|
29 | } |
||
30 | |||
31 | 39 | $itemValue = ArrayHelper::getValue($item, $filter->field); |
|
32 | 39 | $argumentValue = $filter->getValue(); |
|
33 | |||
34 | 39 | if (!$itemValue instanceof DateTimeInterface) { |
|
35 | 36 | return $itemValue >= $argumentValue; |
|
36 | } |
||
37 | |||
38 | 3 | return $argumentValue instanceof DateTimeInterface |
|
39 | 3 | && $itemValue->getTimestamp() >= $argumentValue->getTimestamp(); |
|
40 | } |
||
42 |