class ArrayRule implements Stringable

Properties

protected array $keys

The accepted keys.

protected array $constraints

The additional constraints for the array rule.

Methods

__construct(mixed $keys = null)

Create a new array rule instance.

between(int $min, int $max)

The field under validation must have between the given min and max number of items (inclusive).

exactly(int $value)

The field under validation must have exactly the given number of items.

max(int $value)

The field under validation must not have more than the given number of items.

min(int $value)

The field under validation must have at least the given number of items.

string
__toString()

Convert the rule to a validation string.

array
toArray()

Convert the rule to an array of validation rules.

string
arrayRule()

Get the array rule with its accepted keys.

addRule(array|string $rules)

Add custom rules to the validation rules array.

Details

at line 28
__construct(mixed $keys = null)

Create a new array rule instance.

Parameters

mixed $keys

at line 43
ArrayRule between(int $min, int $max)

The field under validation must have between the given min and max number of items (inclusive).

Parameters

int $min
int $max

Return Value

ArrayRule

at line 51
ArrayRule exactly(int $value)

The field under validation must have exactly the given number of items.

Parameters

int $value

Return Value

ArrayRule

at line 61
ArrayRule max(int $value)

The field under validation must not have more than the given number of items.

Parameters

int $value

Return Value

ArrayRule

at line 69
ArrayRule min(int $value)

The field under validation must have at least the given number of items.

Parameters

int $value

Return Value

ArrayRule

at line 77
string __toString()

Convert the rule to a validation string.

Return Value

string

at line 87
array toArray()

Convert the rule to an array of validation rules.

Return Value

array

at line 95
protected string arrayRule()

Get the array rule with its accepted keys.

Return Value

string

at line 112
protected ArrayRule addRule(array|string $rules)

Add custom rules to the validation rules array.

Parameters

array|string $rules

Return Value

ArrayRule