BaseValidator
Piwik\Validators\
BaseValidator
Base class for validators.
Whether an empty value (false, null, '') passes differs per validator and is stated on each one; add
NotEmpty to require a value.
Methods
The abstract class defines the following methods:
validate()— The method to validate a value.check()— Lets you easily check a value against multiple validators.
validate()
The method to validate a value. If the value has not an expected format, an instance of Exception should be thrown.
Signature
- It accepts the following parameter(s):
$value(mixed) — The value to validate.
- It does not return anything or a mixed result.
- It throws one of the following exceptions:
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.