Methods

Invoke chain as command

__invoke(mixed $value) : bool

Parameters

$value

mixed

Returns

bool

Prepare validator chain for serialization

__sleep() : array

Plugin manager (property 'plugins') cannot be serialized. On wakeup the property remains unset and next invokation to getPluginManager() sets the default plugin manager instance (ValidatorPluginManager).

Returns

array

Proxy to attachByName() to keep BC

addByName(string $name, array $options, bool $breakChainOnFailure) : \Zend\Validator\ValidatorChain

deprecated Please use attachByName()

Parameters

$name

string

$options

array

$breakChainOnFailure

bool

Returns

Proxy to attach() to keep BC

addValidator(\Zend\Validator\ValidatorInterface $validator, bool $breakChainOnFailure) : \Zend\Validator\ValidatorChain

deprecated Please use attach()

Parameters

$breakChainOnFailure

bool

Returns

\Zend\Validator\ValidatorChainProvides a fluent interface

Attach a validator to the end of the chain

attach(\Zend\Validator\ValidatorInterface $validator, bool $breakChainOnFailure) : \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

$breakChainOnFailure

bool

Returns

\Zend\Validator\ValidatorChainProvides a fluent interface

Use the plugin manager to add a validator by name

attachByName(string $name, array $options, bool $breakChainOnFailure) : \Zend\Validator\ValidatorChain

Parameters

$name

string

$options

array

$breakChainOnFailure

bool

Returns

Return the count of attached validators

count() : int

Returns

int

Returns array of validation failure messages

getMessages() : array

The array keys are validation failure message identifiers, and the array values are the corresponding human-readable message strings.

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

Returns

array

Get plugin manager instance

getPluginManager() : \Zend\Validator\ValidatorPluginManager

Get all the validators

getValidators() : array

Returns

array

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

isValid(mixed $value, mixed $context) : bool

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

Parameters

$value

mixed

$context

mixed

Extra "context" to provide the validator

Exceptions

\Zend\Validator\Exception\RuntimeException If validation of $value is impossible

Returns

bool

Merge the validator chain with the one given in parameter

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

Retrieve a validator by name

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

Parameters

$name

string

Name of validator to return

$options

nullarray

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

Returns

Use the plugin manager to prepend a validator by name

prependByName(string $name, array $options, bool $breakChainOnFailure) : \Zend\Validator\ValidatorChain

Parameters

$name

string

$options

array

$breakChainOnFailure

bool

Returns

Adds a validator to the beginning of the chain

prependValidator(\Zend\Validator\ValidatorInterface $validator, bool $breakChainOnFailure) : \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

$breakChainOnFailure

bool

Returns

\Zend\Validator\ValidatorChainProvides a fluent interface

Set plugin manager instance

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

 Properties

 

Array of validation failure messages

$messages : array

   

Validator chain

$validators : array