MCPcopy Create free account
hub / github.com/Rello/analytics / matchesThreshold

Method matchesThreshold

lib/Service/ThresholdService.php:376–390  ·  view source on GitHub ↗
(mixed $value, mixed $target, string $option)

Source from the content-addressed store, hash-verified

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);

Callers 1

Calls 2

compareValuesMethod · 0.95
matchesInThresholdMethod · 0.95

Tested by

no test coverage detected