abstract class AbstractCompositeValidator implements ObjectValidatorInterface, Countable (View source)

An abstract composite validator consisting of other validators

Properties

protected array $supportedOptions

This contains the supported options, their default values and descriptions.

protected array $options
protected SplObjectStorage $validators
protected SplObjectStorage $validatedInstancesContainer

Methods

__construct(array $options = [])

Constructs the composite validator and sets validation options

void
setValidatedInstancesContainer(SplObjectStorage $validatedInstancesContainer)

Allows to set a container to keep track of validated instances.

void
addValidator(ValidatorInterface $validator)

Adds a new validator to the conjunction.

removeValidator(ValidatorInterface $validator)

Removes the specified validator.

int
count()

Returns the number of validators contained in this conjunction.

getValidators()

Returns the child validators of this Composite Validator

array
getOptions()

Returns the options for this validator

Details

__construct(array $options = [])

Constructs the composite validator and sets validation options

Parameters

array $options

Options for the validator

Exceptions

InvalidValidationOptionsException

void setValidatedInstancesContainer(SplObjectStorage $validatedInstancesContainer)

Allows to set a container to keep track of validated instances.

Parameters

SplObjectStorage $validatedInstancesContainer

A container to keep track of validated instances

Return Value

void

void addValidator(ValidatorInterface $validator)

Adds a new validator to the conjunction.

Parameters

ValidatorInterface $validator

The validator that should be added

Return Value

void

removeValidator(ValidatorInterface $validator)

Removes the specified validator.

Parameters

ValidatorInterface $validator

The validator to remove

Exceptions

NoSuchValidatorException

int count()

Returns the number of validators contained in this conjunction.

Return Value

int

The number of validators

SplObjectStorage getValidators()

Returns the child validators of this Composite Validator

Return Value

SplObjectStorage

array getOptions()

Returns the options for this validator

Return Value

array