Gregwar\Formidable\Form::check PHP Method

check() public method

Error checking
public check ( )
    public function check()
    {
        $toCheck = array_flip(func_get_args());
        $errors = array();
        foreach ($this->getFields() as $name => $field) {
            if (!count($toCheck) || isset($toCheck[$name])) {
                $error = $field->check();
                if ($error) {
                    $errors[] = new Error($field, $error, $this->factory->getLanguage());
                }
                if ($field instanceof Fields\Multiple) {
                    $errors = array_merge($errors, $field->checkForms());
                }
            }
        }
        foreach ($this->constraints as $constraint) {
            $error = $constraint($this);
            if ($error) {
                $errors[] = new Error(null, $error, $this->factory->getLanguage());
            }
        }
        return $errors;
    }