(mixed $value, mixed $target, string $option)
| 374 | } |
| 375 | |
| 376 | private function matchesThreshold(mixed $value, mixed $target, string $option): bool { |
| 377 | $option = strtoupper($option); |
| 378 | $option = ['=' => 'EQ', '>' => 'GT', '<' => 'LT', '>=' => 'GE', '<=' => 'LE', '!=' => 'NE'][$option] ?? $option; |
| 379 | return match ($option) { |
| 380 | 'EQ' => $this->compareValues($value, $target) === 0, |
| 381 | 'NE' => $this->compareValues($value, $target) !== 0, |
| 382 | 'GT' => $this->compareValues($value, $target) > 0, |
| 383 | 'GE' => $this->compareValues($value, $target) >= 0, |
| 384 | 'LT' => $this->compareValues($value, $target) < 0, |
| 385 | 'LE' => $this->compareValues($value, $target) <= 0, |
| 386 | 'LIKE' => strpos((string)$value, (string)$target) !== false, |
| 387 | 'IN' => $this->matchesInThreshold($value, (string)$target), |
| 388 | default => false, |
| 389 | }; |
| 390 | } |
| 391 | |
| 392 | private function matchesInThreshold(mixed $value, string $target): bool { |
| 393 | preg_match_all("/'(?:[^'\\\\]|\\\\.)*'|[^,;]+/", $target, $matches); |
no test coverage detected