class ValidatorForSubjectManager extends ValidatorManager implements ValidatorManagerForSubjectInterface (View source)

Properties

protected ValidatorInterface[] $validators

The list of registered validators.

from  ValidatorManager

Methods

string[]
getRequirementStrings()

Get the validator requirements in the form of an array keyed by it's respective error code.

getValidators()

Get a list of all validators keyed by their handles.

bool
hasValidator(string $handle)

Does a validator with this handle exist?

setValidator(string $handle, ValidatorInterface $validator = null)

Add a validator to the stack.

bool
isValid(mixed $mixed, ArrayAccess $error = null)

Is this mixed value valid.

bool
isValidFor(mixed $mixed, mixed $subject = null, ArrayAccess $error = null)

Is this mixed value valid for the specified (optional) subject?

Details

string[] getRequirementStrings()

Get the validator requirements in the form of an array keyed by it's respective error code.

Return Value

string[]

See also

ValidatorInterface::getRequirementStrings

ValidatorInterface[] getValidators()

Get a list of all validators keyed by their handles.

bool hasValidator(string $handle)

Does a validator with this handle exist?

Parameters

string $handle

Return Value

bool

See also

ValidatorManagerInterface::hasValidator

setValidator(string $handle, ValidatorInterface $validator = null)

Add a validator to the stack.

Validators are unique by handle, so adding a validator with the same handle as a validator in the stack replaces the old validator with the new one.

Parameters

string $handle
ValidatorInterface $validator

See also

ValidatorManagerInterface::setValidator

bool isValid(mixed $mixed, ArrayAccess $error = null)

Is this mixed value valid.

Parameters

mixed $mixed

Can be any value

ArrayAccess $error

Return Value

bool

Exceptions

InvalidArgumentException

See also

ValidatorInterface::isValid

bool isValidFor(mixed $mixed, mixed $subject = null, ArrayAccess $error = null)

Is this mixed value valid for the specified (optional) subject?

Parameters

mixed $mixed

Can be any value

mixed $subject

The subject the value should be valid for

ArrayAccess $error

Return Value

bool

Exceptions

InvalidArgumentException

See also

ValidatorForSubjectInterface::isValidFor