package Default

 Methods

Deep clone handling

__clone() 

Initialize validator chain

__construct() 

Invoke chain as command

__invoke(mixed $value) : boolean

Parameters

$value

mixed

Returns

boolean

Prepare validator chain for serialization

__sleep() : array

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).

Returns

array

Proxy to attachByName() to keep BC

addByName(string $name, array $options = array(), boolean $breakChainOnFailure = false) : \Zend\Validator\ValidatorChain
deprecated Please use attachByName()

Parameters

$name

string

$options

array

$breakChainOnFailure

boolean

Returns

\Zend\Validator\ValidatorChain

Proxy to attach() to keep BC

addValidator(\Zend\Validator\ValidatorInterface $validator, boolean $breakChainOnFailure = false, integer $priority = self::DEFAULT_PRIORITY) : \Zend\Validator\ValidatorChain
deprecated Please use attach()

Parameters

$validator

\Zend\Validator\ValidatorInterface

$breakChainOnFailure

boolean

$priority

integer

Returns

\Zend\Validator\ValidatorChainProvides a fluent interface

Attach a validator to the end of the chain

attach(\Zend\Validator\ValidatorInterface $validator, boolean $breakChainOnFailure = false, integer $priority = self::DEFAULT_PRIORITY) : \Zend\Validator\ValidatorChain

If $breakChainOnFailure is true, then if the validator fails, the next validator in the chain, if one exists, will not be executed.

fluent This method is part of a fluent interface and will return the same instance

Parameters

$validator

\Zend\Validator\ValidatorInterface

$breakChainOnFailure

boolean

$priority

integer

Priority at which to enqueue validator; defaults to 1 (higher executes earlier)

Exceptions

\Zend\Validator\Exception\InvalidArgumentException

Returns

\Zend\Validator\ValidatorChain

Use the plugin manager to add a validator by name

attachByName(string $name, array $options = array(), boolean $breakChainOnFailure = false, integer $priority = self::DEFAULT_PRIORITY) : \Zend\Validator\ValidatorChain

Parameters

$name

string

$options

array

$breakChainOnFailure

boolean

$priority

integer

Returns

\Zend\Validator\ValidatorChain

Return the count of attached validators

count() : integer

Returns

integer

Returns array of validation failure messages

getMessages() : array

If isValid() was never called or if the most recent isValid() call returned true, then this method returns an empty array.

inherited_from \Zend\Validator\ValidatorInterface::getMessages()

Returns

array

Get plugin manager instance

getPluginManager() : \Zend\Validator\ValidatorPluginManager

Returns

\Zend\Validator\ValidatorPluginManager

Get all the validators

getValidators() : \Zend\Stdlib\PriorityQueue

Returns

\Zend\Stdlib\PriorityQueue

Returns true if and only if $value passes all validations in the chain

isValid(mixed $value, mixed $context = null) : boolean

Validators are run in the order in which they were added to the chain (FIFO).

inherited_from \Zend\Validator\ValidatorInterface::isValid()

Parameters

$value

mixed

$context

mixed

Extra "context" to provide the validator

Returns

boolean

Merge the validator chain with the one given in parameter

merge(\Zend\Validator\ValidatorChain $validatorChain) : \Zend\Validator\ValidatorChain

Parameters

$validatorChain

\Zend\Validator\ValidatorChain

Returns

\Zend\Validator\ValidatorChain

Retrieve a validator by name

plugin(string $name, null|array $options = null) : \Zend\Validator\ValidatorInterface

Parameters

$name

string

Name of validator to return

$options

nullarray

Options to pass to validator constructor (if not already instantiated)

Returns

\Zend\Validator\ValidatorInterface

Use the plugin manager to prepend a validator by name

prependByName(string $name, array $options = array(), boolean $breakChainOnFailure = false) : \Zend\Validator\ValidatorChain

Parameters

$name

string

$options

array

$breakChainOnFailure

boolean

Returns

\Zend\Validator\ValidatorChain

Adds a validator to the beginning of the chain

prependValidator(\Zend\Validator\ValidatorInterface $validator, boolean $breakChainOnFailure = false) : \Zend\Validator\ValidatorChain

If $breakChainOnFailure is true, then if the validator fails, the next validator in the chain, if one exists, will not be executed.

Parameters

$validator

\Zend\Validator\ValidatorInterface

$breakChainOnFailure

boolean

Returns

\Zend\Validator\ValidatorChainProvides a fluent interface

Set plugin manager instance

setPluginManager(\Zend\Validator\ValidatorPluginManager $plugins) : \Zend\Validator\ValidatorChain

Parameters

$plugins

\Zend\Validator\ValidatorPluginManager

Plugin manager

Returns

\Zend\Validator\ValidatorChain

 Properties

 

Array of validation failure messages

$messages : array

Default

array()
 

$plugins

$plugins : \Zend\Validator\ValidatorPluginManager

Default

 

Validator chain

$validators : \Zend\Stdlib\PriorityQueue

Default

 Constants

 

Default priority at which validators are added

DEFAULT_PRIORITY = 1