2declare(strict_types=1);
19 if (!preg_match(
'#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i',
$test, $matches)) {
20 throw new \InvalidArgumentException(sprintf(
'Don\'t understand "%s" as a number test.',
$test));
25 throw new \InvalidArgumentException(sprintf(
'Invalid number "%s".',
$target));
28 if (isset($matches[3])) {
30 switch (strtolower($matches[3])) {
An exception for terminatinating execution or to throw for unit testing.
setOperator(string $operator)
setTarget(string $target)
__construct(string $test)
NumberComparator constructor.