Symfony2 API
Class

Symfony\Component\Finder\Comparator\NumberComparator

class NumberComparator extends Comparator

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.

Methods

string getTarget()

Gets the target value.

from Comparator
setTarget(string $target)

Sets the target value.

from Comparator
string getOperator()

Gets the comparison operator.

from Comparator
setOperator(string $operator)

Sets the comparison operator.

from Comparator
Boolean test(mixed $test)

Tests against the target.

from Comparator
__construct(string $test)

Constructor.

Details

in Comparator at line 29
public string getTarget()

Gets the target value.

Return Value

string The target value

in Comparator at line 39
public setTarget(string $target)

Sets the target value.

Parameters

string $target The target value

in Comparator at line 49
public string getOperator()

Gets the comparison operator.

Return Value

string The operator

in Comparator at line 61
public setOperator(string $operator)

Sets the comparison operator.

Parameters

string $operator A valid operator

Exceptions

InvalidArgumentException

in Comparator at line 81
public Boolean test(mixed $test)

Tests against the target.

Parameters

mixed $test A test value

Return Value

Boolean

at line 45
public __construct(string $test)

Constructor.

Parameters

string $test A comparison string

Exceptions

InvalidArgumentException If the test is not understood