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