ValidatorAwareInterface
in
Provides methods for managing multiple validators.
Table of Contents
Methods
- getValidator() : Validator
- Returns the validation rules tagged with $name.
- hasValidator() : bool
- Checks whether a validator has been set.
- setValidator() : $this
- This method stores a custom validator under the given name.
Methods
getValidator()
Returns the validation rules tagged with $name.
public
getValidator([string|null $name = null ]) : Validator
If a $name argument has not been provided, the default validator will be returned.
You can configure your default validator name in a DEFAULT_VALIDATOR
class constant.
Parameters
- $name : string|null = null
-
The name of the validation set to return.
Return values
ValidatorhasValidator()
Checks whether a validator has been set.
public
hasValidator(string $name) : bool
Parameters
- $name : string
-
The name of a validator.
Return values
boolsetValidator()
This method stores a custom validator under the given name.
public
setValidator(string $name, Validator $validator) : $this
Parameters
- $name : string
-
The name of a validator to be set.
- $validator : Validator
-
Validator object to be set.