Zend Framework
3.0
|
Public Member Functions | |
__construct () | |
Initialize validator chain. | |
count () | |
Return the count of attached validators. | |
getPluginManager () | |
Get plugin manager instance. | |
setPluginManager (ValidatorPluginManager $plugins) | |
Set plugin manager instance. | |
plugin ($name, array $options=null) | |
Retrieve a validator by name. | |
attach (ValidatorInterface $validator, $breakChainOnFailure=false, $priority=self::DEFAULT_PRIORITY) | |
Attach a validator to the end of the chain. | |
addValidator (ValidatorInterface $validator, $breakChainOnFailure=false, $priority=self::DEFAULT_PRIORITY) | |
Proxy to attach() to keep BC. | |
prependValidator (ValidatorInterface $validator, $breakChainOnFailure=false) | |
Adds a validator to the beginning of the chain. | |
attachByName ($name, $options=[], $breakChainOnFailure=false, $priority=self::DEFAULT_PRIORITY) | |
Use the plugin manager to add a validator by name. | |
addByName ($name, $options=[], $breakChainOnFailure=false) | |
Proxy to attachByName() to keep BC. | |
prependByName ($name, $options=[], $breakChainOnFailure=false) | |
Use the plugin manager to prepend a validator by name. | |
isValid ($value, $context=null) | |
Returns true if and only if $value passes all validations in the chain. | |
merge (ValidatorChain $validatorChain) | |
Merge the validator chain with the one given in parameter. | |
getMessages () | |
Returns array of validation failure messages. | |
getValidators () | |
Get all the validators. | |
__invoke ($value) | |
Invoke chain as command. | |
__clone () | |
Deep clone handling. | |
__sleep () | |
Prepare validator chain for serialization. | |
Public Member Functions inherited from ValidatorInterface | |
isValid ($value) | |
Returns true if and only if $value meets the validation requirements. | |
Public Attributes | |
const | DEFAULT_PRIORITY = 1 |
Default priority at which validators are added. | |
Protected Attributes | |
$plugins | |
$validators | |
$messages = [] | |
__construct | ( | ) |
Initialize validator chain.
__clone | ( | ) |
Deep clone handling.
__invoke | ( | $value | ) |
Invoke chain as command.
mixed | $value |
__sleep | ( | ) |
Prepare validator chain for serialization.
Plugin manager (property 'plugins') cannot be serialized. On wakeup the property remains unset and next invocation to getPluginManager() sets the default plugin manager instance (ValidatorPluginManager).
addByName | ( | $name, | |
$options = [] , |
|||
$breakChainOnFailure = false |
|||
) |
Proxy to attachByName() to keep BC.
string | $name | |
array | $options | |
bool | $breakChainOnFailure |
addValidator | ( | ValidatorInterface | $validator, |
$breakChainOnFailure = false , |
|||
$priority = self::DEFAULT_PRIORITY |
|||
) |
Proxy to attach() to keep BC.
ValidatorInterface | $validator | |
bool | $breakChainOnFailure | |
int | $priority |
attach | ( | ValidatorInterface | $validator, |
$breakChainOnFailure = false , |
|||
$priority = self::DEFAULT_PRIORITY |
|||
) |
Attach a validator to the end of the chain.
If $breakChainOnFailure is true, then if the validator fails, the next validator in the chain, if one exists, will not be executed.
ValidatorInterface | $validator | |
bool | $breakChainOnFailure | |
int | $priority | Priority at which to enqueue validator; defaults to 1 (higher executes earlier) |
Exception\InvalidArgumentException |
attachByName | ( | $name, | |
$options = [] , |
|||
$breakChainOnFailure = false , |
|||
$priority = self::DEFAULT_PRIORITY |
|||
) |
Use the plugin manager to add a validator by name.
string | $name | |
array | $options | |
bool | $breakChainOnFailure | |
int | $priority |
count | ( | ) |
Return the count of attached validators.
getMessages | ( | ) |
getPluginManager | ( | ) |
Get plugin manager instance.
getValidators | ( | ) |
Get all the validators.
isValid | ( | $value, | |
$context = null |
|||
) |
Returns true if and only if $value passes all validations in the chain.
Validators are run in the order in which they were added to the chain (FIFO).
mixed | $value | |
mixed | $context | Extra "context" to provide the validator |
merge | ( | ValidatorChain | $validatorChain | ) |
Merge the validator chain with the one given in parameter.
ValidatorChain | $validatorChain |
plugin | ( | $name, | |
array | $options = null |
||
) |
Retrieve a validator by name.
string | $name | Name of validator to return |
null | array | $options | Options to pass to validator constructor (if not already instantiated) |
prependByName | ( | $name, | |
$options = [] , |
|||
$breakChainOnFailure = false |
|||
) |
Use the plugin manager to prepend a validator by name.
string | $name | |
array | $options | |
bool | $breakChainOnFailure |
prependValidator | ( | ValidatorInterface | $validator, |
$breakChainOnFailure = false |
|||
) |
Adds a validator to the beginning of the chain.
If $breakChainOnFailure is true, then if the validator fails, the next validator in the chain, if one exists, will not be executed.
ValidatorInterface | $validator | |
bool | $breakChainOnFailure |
setPluginManager | ( | ValidatorPluginManager | $plugins | ) |
Set plugin manager instance.
ValidatorPluginManager | $plugins | Plugin manager |
|
protected |
|
protected |
|
protected |
const DEFAULT_PRIORITY = 1 |
Default priority at which validators are added.