ValidatorLength
in package
implements
ValidatorInterface
Example config (requires min and/or max): 'admin' => ['length' => ['min' => 1, 'max' => 50]] or 'admin' => ['length' => ['min' => 1]] or 'admin' => ['length' => ['max' => 50]]
Table of Contents
Interfaces
Properties
- $name : string
Methods
- normaliseConfigValue() : mixed
- Normalises the config value for this validator
- validate() : array<string|int, mixed>|bool
- Validates the key and it's value based on the config.
- getLengthOfValue() : int
- getMax() : int
- getMin() : int
Properties
$name
private
string
$name
= 'length'
Methods
normaliseConfigValue()
Normalises the config value for this validator
public
normaliseConfigValue(array<string|int, mixed> $config) : mixed
Parameters
- $config : array<string|int, mixed>
validate()
Validates the key and it's value based on the config.
public
validate(string $key, mixed $value, array<string|int, mixed> $config, array<string|int, mixed> $data[, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>|bool
Parameters
- $key : string
- $value : mixed
- $config : array<string|int, mixed>
- $data : array<string|int, mixed>
- $options : array<string|int, mixed> = []
Return values
array<string|int, mixed>|boolgetLengthOfValue()
private
getLengthOfValue(mixed $value, array<string|int, mixed> $config) : int
Parameters
- $value : mixed
- $config : array<string|int, mixed>
Return values
intgetMax()
private
getMax(array<string|int, mixed> $config, int $length) : int
Parameters
- $config : array<string|int, mixed>
- $length : int
Return values
intgetMin()
private
getMin(array<string|int, mixed> $config) : int
Parameters
- $config : array<string|int, mixed>