\Symfony\Component\Finder\ComparatorNumberComparator

NumberComparator compiles a simple comparison to an anonymous subroutine, which you can call with a value to be tested again.

Now this would be very pointless, if NumberCompare didn't understand magnitudes.

The target value may use magnitudes of kilobytes (k, ki), megabytes (m, mi), or gigabytes (g, gi). Those suffixed with an i use the appropriate 2**n version in accordance with the IEC standard: http://physics.nist.gov/cuu/Units/binary.html

Based on the Perl Number::Compare module.

Summary

Methods
Properties
Constants
__construct()
getTarget()
setTarget()
getOperator()
setOperator()
test()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
doSetOperator()
$target
$operator
N/A

Properties

$target

$target

$operator

$operator

Methods

__construct()

__construct(string|null  $test) : mixed

Parameters

string|null $test

A comparison string or null

Throws

\InvalidArgumentException

If the test is not understood

Returns

mixed —

getTarget()

getTarget() : string

Gets the target value.

Returns

string —

setTarget()

setTarget(string  $target) : mixed

Parameters

string $target

Returns

mixed —

getOperator()

getOperator() : string

Gets the comparison operator.

Returns

string —

setOperator()

setOperator(string  $operator) : mixed

Sets the comparison operator.

Parameters

string $operator

Throws

\InvalidArgumentException

Returns

mixed —

test()

test(mixed  $test) : bool

Tests against the target.

Parameters

mixed $test

A test value

Returns

bool —

doSetOperator()

doSetOperator(string  $operator) : void

Parameters

string $operator