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