WhitelistedValue
Piwik\Validators\
WhitelistedValue
Validator that fails for a value that is not one of the allowed values.
Methods
The class defines the following methods:
validate()— Validates the given value and throws an exception if it is invalid.check()ash; Lets you easily check a value against multiple validators. Inherited fromBaseValidator__construct()
validate()
Validates the given value and throws an exception if it is invalid.
Signature
- It accepts the following parameter(s):
$value(mixed) — The value to validate.
- It does not return anything or a mixed result.
check()
Lets you easily check a value against multiple validators.
Signature
- It accepts the following parameter(s):
$name(string) — The name/description of the field you want to validate the value for. The name will be prefixed in case there is any error.$value(mixed) — The value which needs to be tested$validators(BaseValidator[]) — The validators to apply, in order.
- It does not return anything or a mixed result.
__construct()
Signature
- It accepts the following parameter(s):
$whitelistedValues(array) — The allowed values.