class Number extends NumberComparator (View source)

Check if the input matches the min and max values.

If min and max are equal, the count must match that value regardless of the inclusive flag.

Methods

__construct(int|float $min = null, int|float $max = null, bool $inclusive = true)

No description

bool
__invoke(mixed $value)

Compare the input value against the comparator.

static Number
between(int|float $min, int|float $max, bool $inclusive = true)

Must be between the given minimum and maximum.

bool
check(mixed $value)

Compare the input number against the comparator.

bool
checkNumber(int|float $value)

Compare the input number against the comparator.

static Number
equal(int|float $size)

Must be equal to the given size.

static Number
make(int|float $min = null, int|float $max = null, bool $inclusive = true)

No description

static Number
max(int|float $max, bool $inclusive = true)

Must be less than or equal to the given maximum.

static Number
min(int|float $min, bool $inclusive = true)

Must be greater than or equal to the given minimum.

Details

__construct(int|float $min = null, int|float $max = null, bool $inclusive = true)

No description

Parameters

int|float $min

Minimum. Null means no minimum.

int|float $max

Maximum. Null means no maximum.

bool $inclusive

Whether to include the minimum and maximum in the comparison (default: true)

final bool __invoke(mixed $value)

Compare the input value against the comparator.

Parameters

mixed $value

Return Value

bool

static Number between(int|float $min, int|float $max, bool $inclusive = true)

Must be between the given minimum and maximum.

Parameters

int|float $min

Minimum count

int|float $max

Maximum count

bool $inclusive

Whether to include the minimum and maximum in the comparison (default: true)

Return Value

Number

final bool check(mixed $value)

Compare the input number against the comparator.

Parameters

mixed $value

Return Value

bool

protected bool checkNumber(int|float $value)

Compare the input number against the comparator.

Parameters

int|float $value

Return Value

bool

static Number equal(int|float $size)

Must be equal to the given size.

Parameters

int|float $size

Size to compare to

Return Value

Number

static Number make(int|float $min = null, int|float $max = null, bool $inclusive = true)

No description

Parameters

int|float $min

Minimum. Null means no minimum.

int|float $max

Maximum. Null means no maximum.

bool $inclusive

Whether to include the minimum and maximum in the comparison (default: true)

Return Value

Number

static Number max(int|float $max, bool $inclusive = true)

Must be less than or equal to the given maximum.

Parameters

int|float $max

Maximum count

bool $inclusive

Whether to include the minimum and maximum in the comparison (default: true)

Return Value

Number

static Number min(int|float $min, bool $inclusive = true)

Must be greater than or equal to the given minimum.

Parameters

int|float $min

Minimum count

bool $inclusive

Whether to include the minimum and maximum in the comparison (default: true)

Return Value

Number