@author Bernhard Schussek <bschussek@gmail.com>
@api
Expanded class hierarchy of AllValidator
class AllValidator extends ConstraintValidator {
/**
* {@inheritDoc}
*/
public function validate($value, Constraint $constraint) {
if (null === $value) {
return;
}
if (!is_array($value) && !$value instanceof \Traversable) {
throw new UnexpectedTypeException($value, 'array or Traversable');
}
$group = $this->context
->getGroup();
foreach ($value as $key => $element) {
foreach ($constraint->constraints as $constr) {
$this->context
->validateValue($element, $constr, '[' . $key . ']', $group);
}
}
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AllValidator:: |
public | function |
Checks if the passed value is valid. Overrides ConstraintValidatorInterface:: |
|
ConstraintValidator:: |
protected | property | ||
ConstraintValidator:: |
public | function |
Initializes the constraint validator. Overrides ConstraintValidatorInterface:: |
1 |