protected function addFormValidators(ReflectionClass $refl, array $additional_validators, Form $form)
    {
        $classdoc = $refl->getDocComment();
        if (!empty($classdoc))
        {
            $classdoc = new DocComment($classdoc);
            foreach ($classdoc->getAnnotations('validator') as $validator)
            {
                if (!is_a($validator, Validator::class, true))
                    throw new BinderException("Invalid validator class: $validator");
                $validator = DI::getInjector()->getInstance($validator);
                $form->addFormValidator($validator);
            }
        }

        foreach ($additional_validators as $validator)
            $form->addFormValidator($validator);

        return $form;
    }
protected function addFormValidators(ReflectionClass $refl, array $additional_validators, Form $form)
    {
        $classdoc = $refl->getDocComment();
        if (!empty($classdoc))
        {
            $classdoc = new DocComment($classdoc);
            foreach ($classdoc->getAnnotations('validator') as $validator)
            {
                if (!is_a($validator, Validator::class, true))
                    throw new BinderException("Invalid validator class: $validator");
                $validator = DI::getInjector()->getInstance($validator);
                $form->addFormValidator($validator);
            }
        }

        foreach ($additional_validators as $validator)
            $form->addFormValidator($validator);

        return $form;
    }
protected function addFormValidators ( ReflectionClass $ refl , array $ additional_validators , Form $ form ) { $ classdoc = $ refl -> getDocComment ( ) ; if ( ! empty ( $ classdoc ) ) { $ classdoc = new DocComment ( $ classdoc ) ; foreach ( $ classdoc -> getAnnotations ( 'validator' ) as $ validator ) { if ( ! is_a ( $ validator , Validator :: class , true ) ) throw new BinderException ( "Invalid validator class: $validator" ) ; $ validator = DI :: getInjector ( ) -> getInstance ( $ validator ) ; $ form -> addFormValidator ( $ validator ) ; } } foreach ( $ additional_validators as $ validator ) $ form -> addFormValidator ( $ validator ) ; return $ form ; }
Add validators for the whole form

@param ReflectionClass The reflection class to get validators from
@param array $additional_validators Validators to add
@param Form $form The form to add the validators to
Add validators for the whole form