src/Schema.php
private function callValidators($value, ValidationField $field) {
        $valid = true;

        // Strip array references in the name except for the last one.
        $key = $field->getSchemaPath();
        if (!empty($this->validators[$key])) {
            foreach ($this->validators[$key] as $validator) {
                $r = call_user_func($validator, $value, $field);

                if ($r === false || Invalid::isInvalid($r)) {
                    $valid = false;
                }
            }
        }

        // Add an error on the field if the validator hasn't done so.
        if (!$valid && $field->isValid()) {
            $field->addError('invalid', ['messageCode' => 'The value is invalid.']);
        }
    }
private function callValidators($value, ValidationField $field) {
        $valid = true;

        // Strip array references in the name except for the last one.
        $key = $field->getSchemaPath();
        if (!empty($this->validators[$key])) {
            foreach ($this->validators[$key] as $validator) {
                $r = call_user_func($validator, $value, $field);

                if ($r === false || Invalid::isInvalid($r)) {
                    $valid = false;
                }
            }
        }

        // Add an error on the field if the validator hasn't done so.
        if (!$valid && $field->isValid()) {
            $field->addError('invalid', ['messageCode' => 'The value is invalid.']);
        }
    }
private function callValidators ( $ value , ValidationField $ field ) { $ valid = true ; // Strip array references in the name except for the last one. $ key = $ field -> getSchemaPath ( ) ; if ( ! empty ( $ this -> validators [ $ key ] ) ) { foreach ( $ this -> validators [ $ key ] as $ validator ) { $ r = call_user_func ( $ validator , $ value , $ field ) ; if ( $ r === false || Invalid :: isInvalid ( $ r ) ) { $ valid = false ; } } } // Add an error on the field if the validator hasn't done so. if ( ! $ valid && $ field -> isValid ( ) ) { $ field -> addError ( 'invalid' , [ 'messageCode' => 'The value is invalid.' ] ) ; } }
Call all of the validators attached to a field.

@param mixed $value The field value being validated.
@param ValidationField $field The validation object to add errors.
Call all of the validators attached to a field .