/opt/cpanel/ea-wappspector/vendor/rector/rector/vendor/nette/utils/src/Utils
Edit: /opt/cpanel/ea-wappspector/vendor/rector/rector/vendor/nette/utils/src/Utils/Helpers.php (3412B)
$max) {
throw new Nette\InvalidArgumentException("Minimum ({$min}) is not less than maximum ({$max}).");
}
return \min(\max($value, $min), $max);
}
/**
* Looks for a string from possibilities that is most similar to value, but not the same (for 8-bit encoding).
* @param string[] $possibilities
*/
public static function getSuggestion(array $possibilities, string $value) : ?string
{
$best = null;
$min = (\strlen($value) / 4 + 1) * 10 + 0.1;
foreach (\array_unique($possibilities) as $item) {
if ($item !== $value && ($len = \levenshtein($item, $value, 10, 11, 10)) < $min) {
$min = $len;
$best = $item;
}
}
return $best;
}
/**
* Compares two values in the same way that PHP does. Recognizes operators: >, >=, <, <=, =, ==, ===, !=, !==, <>
* @param mixed $left
* @param mixed $right
*/
public static function compare($left, string $operator, $right) : bool
{
switch ($operator) {
case '>':
return $left > $right;
case '>=':
return $left >= $right;
case '<':
return $left < $right;
case '<=':
return $left <= $right;
case '=':
case '==':
return $left == $right;
case '===':
return $left === $right;
case '!=':
case '<>':
return $left != $right;
case '!==':
return $left !== $right;
default:
throw new Nette\InvalidArgumentException("Unknown operator '{$operator}'");
}
}
}