class Count extends Comparator (View source)

Check if the count of 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 $min = null, int $max = null, bool $inclusive = true)

No description

bool
__invoke(mixed $value)

Compare the input value against the comparator.

static Count
between(int $min, int $max, bool $inclusive = true)

Count must be between the given sizes.

bool
check(mixed $value)

Compare the input value against the comparator.

static Count
equal(int $size)

Count must be equal to the given size.

static Count
make(int $min = null, int $max = null, bool $inclusive = true)

No description

static Count
max(int $max, bool $inclusive = true)

Count must be less than or equal to the given size.

static Count
min(int $min, bool $inclusive = true)

Count must be greater than or equal to the given size.

Details

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

No description

Parameters

int $min

Minimum count. Null means no minimum.

int $max

Maximum count. 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 Count between(int $min, int $max, bool $inclusive = true)

Count must be between the given sizes.

Parameters

int $min

Minimum size

int $max

Maximum size

bool $inclusive

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

Return Value

Count

bool check(mixed $value)

Compare the input value against the comparator.

Parameters

mixed $value

Return Value

bool

static Count equal(int $size)

Count must be equal to the given size.

Parameters

int $size

Size to compare to

Return Value

Count

static Count make(int $min = null, int $max = null, bool $inclusive = true)

No description

Parameters

int $min

Minimum count. Null means no minimum.

int $max

Maximum count. Null means no maximum.

bool $inclusive

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

Return Value

Count

static Count max(int $max, bool $inclusive = true)

Count must be less than or equal to the given size.

Parameters

int $max

Maximum size

bool $inclusive

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

Return Value

Count

static Count min(int $min, bool $inclusive = true)

Count must be greater than or equal to the given size.

Parameters

int $min

Minimum size

bool $inclusive

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

Return Value

Count