Gibt nur dann Errors zurück, wenn diese ungleich self::OK sind

@return bool
559503
public function hasErrors() {
    foreach ($this->jsonArray as $error) {
      if ($error['type'] != self::OK)
        return TRUE;
    }
    return FALSE;
  }
1156491
public function validate() {
        if ($this->file->validate() === false) {
            $this->errors = $this->file->getErrors();
            return false;
        }

        return true;
    }
435976
public function valid()
    {
        if ($this->fileSize == 0) {
            return false;
        }

        if (feof($this->handle)) {
            return false;
        }

        $current = fgets($this->handle);

        if (trim($current) === '' && feof($this->handle)) {
            return false;
        } else {
            fseek($this->handle, $this->offset);
        }

        return true;
    }
946598
public function isValid() : bool
    {
        $this->validate();

        if ($this->hasErrors()) {
            return false;
        }

        foreach ($this->components as $component) {
            if ($component->hasErrors()) {
                return false;
            }
        }

        return true;
    }
983572
public function isErrored()
    {
        if (null === $this->data) {
            $this->initializeReport();
        }

        return isset($this->data['report']['state']) && 'errored' === $this->data['report']['state'];
    }
1082702
public function check() {
        if ($this->_exist) {
            foreach ($this->_constraints as $constraint) {
                switch ($constraint['type']) {
                    case self::ACCEPT:
                        if (!is_array($this->_data[$this->_field]['type'])) {
                            $this->_data[$this->_field]['type'] = [$this->_data[$this->_field]['type']];
                        }

                        foreach ($this->_data[$this->_field]['type'] as $value) {
                            if ($value != '') {
                                if (!in_array($value, $constraint['value'])) {
                                    array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                                }
                            }
                        }
                        break;

                    case self::EXTENSION:
                        if (!is_array($this->_data[$this->_field]['name'])) {
                            $this->_data[$this->_field]['name'] = [$this->_data[$this->_field]['name']];
                        }

                        foreach ($this->_data[$this->_field]['name'] as $value) {
                            if ($value != '') {
                                if (!in_array(pathinfo($value)['extension'], $constraint['value'])) {
                                    array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                                }
                            }
                        }
                        break;

                    case self::SIZEMIN:
                        if (!is_array($this->_data[$this->_field]['size'])) {
                            $this->_data[$this->_field]['size'] = [$this->_data[$this->_field]['size']];
                        }

                        foreach ($this->_data[$this->_field]['size'] as $value) {
                            if ($value != 0) {
                                if ($value < $constraint['value']) {
                                    array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                                }
                            }
                        }
                        break;

                    case self::SIZEMAX:
                        if (!is_array($this->_data[$this->_field]['size'])) {
                            $this->_data[$this->_field]['size'] = [$this->_data[$this->_field]['size']];
                        }

                        foreach ($this->_data[$this->_field]['size'] as $value) {
                            if ($value != 0) {
                                if ($value > $constraint['value']) {
                                    array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                                }
                            }
                        }
                        break;

                    case self::SIZEBETWEEN:
                        if (!is_array($this->_data[$this->_field]['size'])) {
                            $this->_data[$this->_field]['size'] = [$this->_data[$this->_field]['size']];
                        }

                        foreach ($this->_data[$this->_field]['size'] as $value) {
                            if ($value != 0) {
                                if ($value < $constraint['value'][0] || $value > $constraint['value'][1]) {
                                    array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                                }
                            }
                        }
                        break;

                    case self::COUNT:
                        if (!is_array($this->_data[$this->_field]['name'])) {
                            $this->_data[$this->_field]['name'] = [$this->_data[$this->_field]['name']];
                        }

                        if (count($this->_data[$this->_field]['name']) != $constraint['value']) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                        }
                        break;

                    case self::COUNTMIN:
                        if (!is_array($this->_data[$this->_field]['name'])) {
                            $this->_data[$this->_field]['name'] = [$this->_data[$this->_field]['name']];
                        }

                        if (count($this->_data[$this->_field]['name']) < $constraint['value']) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                        }
                        break;

                    case self::COUNTMAX:
                        if (!is_array($this->_data[$this->_field]['name'])) {
                            $this->_data[$this->_field]['name'] = [$this->_data[$this->_field]['name']];
                        }

                        if (count($this->_data[$this->_field]['name']) > $constraint['value']) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                        }
                        break;

                    case self::COUNTIN:
                        if (!is_array($this->_data[$this->_field]['name'])) {
                            $this->_data[$this->_field]['name'] = [$this->_data[$this->_field]['name']];
                        }

                        if (!in_array(count($this->_data[$this->_field]['name']), $constraint['value'])) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                        }
                        break;

                    case self::CUSTOM:
                        /** @var object[] $constraints */
                        if ($constraints['value']->filter() == false) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['value']->error()]);
                        }
                        break;
                }
            }
        }
    }
1274453
public function isValid()
    {
        $result = true;
        //waliduje poprawnie jeśli niewymagane, ale tylko gdy niepuste
        if (!($this->getRequired() || empty($this->getFiles()))) {
            return $result;
        }
        //iteracja po walidatorach
        foreach ($this->getValidators() as $validator) {
            if ($validator->isValid($this->getFiles())) {
                continue;
            }
            $result = false;
            //dodawanie wiadomości z walidatora
            $this->addError($validator->getMessage() ? $validator->getMessage() : $validator->getError());
        }
        //zwrot rezultatu wszystkich walidacji (iloczyn)
        return $result;
    }
1090901
public function isValid()
    {
        $this->errors = array();

        foreach ($this->rules() as $rule) {
            $fields = array_map('trim', explode(',', $rule[0]));
            $ruleName = $rule[1];
            $params = array_slice($rule, 2);

            // check scenario
            if (!empty($rule['on'])) {
                $onScenarios = explode(',', $rule['on']);
                if (!in_array($this->getScenario(), $onScenarios)) {
                    continue;
                }
            }

            if (!empty($rule['except'])) {
                $exceptScenarios = explode(',', $rule['except']);
                if (in_array($this->getScenario(), $exceptScenarios)) {
                    continue;
                }
            }

            if (method_exists($this, $ruleName)) {
                // method
                foreach ($fields as $field) {
                    $this->{$ruleName}($field, $params);
                }
            } else {
                // validator class
                $validatorClassName = $this->getValidatorClassNameByRuleName($ruleName);

                /* @var $validator \Sokil\Mongo\Validator */
                $validator = new $validatorClassName;
                if (!$validator instanceof Validator) {
                    throw new Exception('Validator class must implement \Sokil\Mongo\Validator class');
                }

                $validator->validate($this, $fields, $params);
            }
        }

        return !$this->hasErrors();
    }
932048
public function validate()
    {
        $errors = [];

        foreach ($this->fields as $field) {
            $result = $field->validate();

            if ($result->isFailure()) {
                $errors[] = $result;
            }
        }

        if ($errors) {
            $this->setErrors($errors);

            return false;
        }

        return true;
    }
602452
public function isTrue(): bool
    {
        return (
            in_array($this->string, ['ok']) ||
            (true === filter_var($this->string, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE))
        );
    }
899779
public static function hasError() {
		$error        = json_last_error();
		$errorMessage = array_key_exists($error, self::$errors) ? self::$errors[$error] : "Unknown error ({$error})";
		return $errorMessage;
	}
111243
protected function tooManyErrors()
    {
        $count = count($this->_errors);
        if($count < $this->maxErrorTimes) {
            return false;
        }

        return ($this->_errors[$count - 1] - $this->_errors[$count - $this->maxErrorTimes]) <= $this->errorInterval;
    }
698851
public function check() {
        $this->_errors = [];

        foreach ($this->_constraints as $constraints) {
            if (!isset($this->_data[$this->_field])) {
                $this->_data[$this->_field] = [];
            }

            if (!is_array($this->_data[$this->_field])) {
                $this->_data[$this->_field] = [$this->_data[$this->_field]];
            }

            foreach ($this->_data[$this->_field] as $value) {
                switch ($constraints['type']) {
                    case self::EQUAL:
                        if ($value != $constraints['value']) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                        }
                        break;

                    case self::DIFFERENT:
                        if ($value == $constraints['value']) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                        }
                        break;

                    case self::MORETHAN:
                        if ($value <= $constraints['value']) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                        }
                        break;

                    case self::LESSTHAN:
                        if ($value >= $constraints['value']) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                        }
                        break;

                    case self::BETWEEN:
                        if ($value < $constraints['value'][0] || $value > $constraints['value'][1]) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                        }
                        break;

                    case self::IN:
                        if (!in_array($value, $constraints['value'])) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                        }
                        break;

                    case self::NOTIN:
                        if (in_array($value, $constraints['value'])) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                        }
                        break;

                    case self::LENGTH:
                        if (strlen($value) != $constraints['value']) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                        }
                        break;

                    case self::LENGTHMIN:
                        if (strlen($value) < $constraints['value']) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                        }
                        break;

                    case self::LENGTHMAX:
                        if (strlen($value) > $constraints['value']) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                        }
                        break;

                    case self::LENGTHIN:
                        if (!in_array(strlen($value), $constraints['value'])) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                        }
                        break;

                    case self::LENGTHBETWEEN:
                        if (strlen($value) < $constraints['value'][0] || strlen($value) > $constraints['value'][1]) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                        }
                        break;

                    case self::REGEX:
                        if (!preg_match($constraints['value'], $value)) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                        }
                        break;

                    case self::URL:
                        if (!filter_var($value, FILTER_VALIDATE_URL)) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                        }
                        break;

                    case self::MAIL:
                        if (!filter_var($value, FILTER_VALIDATE_EMAIL)) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                        }
                        break;

                    case self::INT:
                        if (!filter_var($value, FILTER_VALIDATE_INT)) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                        }
                        break;

                    case self::FLOAT:
                        if (!filter_var($value, FILTER_VALIDATE_FLOAT)) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                        }
                        break;

                    case self::ALPHA:
                        if (!preg_match('#^([a-zA-Z]+)$#', $value)) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                        }
                        break;

                    case self::ALPHANUM:
                        if (!preg_match('#^([a-zA-Z0-9]+)$#', $value)) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                        }
                        break;

                    case self::ALPHADASH:
                        if (!preg_match('#^([a-zA-Z0-9_-]+)$#', $value)) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                        }
                        break;

                    case self::IP:
                        if (!filter_var($value, FILTER_VALIDATE_IP)) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                        }
                        break;

                    case self::SQL:
                        $sql = new Sql();
                        $sql->query('query-form-validation', $constraints['value']['query']);
                        $sql->vars('value', $value);
                        $sql->vars($constraints['value']['vars']);
                        $data = $sql->fetch('query-form-validation', Sql::PARAM_FETCHCOLUMN);

                        $querySuccess = true;

                        switch ($constraints['value']['constraint']) {
                            case '==':
                                if ($data != $constraints['value']['value']) {
                                    $querySuccess = false;
                                }
                                break;

                            case '!=':
                                if ($data == $constraints['value']['value']) {
                                    $querySuccess = false;
                                }
                                break;

                            case '>':
                                if ($data <= $constraints['value']['value']) {
                                    $querySuccess = false;
                                }
                                break;

                            case '<':
                                if ($data >= $constraints['value']['value']) {
                                    $querySuccess = false;
                                }
                                break;
                        }

                        if (!$querySuccess) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                        }
                        break;

                    case self::CUSTOM:
                        /** @var object[] $constraints */
                        if ($constraints['value']->filter() == false) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['value']->error()]);
                        }
                        break;
                }
            }

            switch ($constraints['type']) {
                case self::COUNT:
                    if (count($this->_data[$this->_field]) != $constraints['value']) {
                        array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                    }
                    break;

                case self::COUNTMIN:
                    if (count($this->_data[$this->_field]) < $constraints['value']) {
                        array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                    }
                    break;

                case self::COUNTMAX:
                    if (count($this->_data[$this->_field]) > $constraints['value']) {
                        array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                    }
                    break;

                case self::COUNTIN:
                    /** @var array $constraints */
                    if (!in_array(count($this->_data[$this->_field]), $constraints['value'])) {
                        array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                    }
                    break;

                case self::EXIST:
                    if (count($this->_data[$this->_field]) == 0) {
                        array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                    }
                    break;

                case self::NOTEXIST:
                    if (count($this->_data[$this->_field]) > 0) {
                        array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['message']]);
                    }
                    break;
            }
        }
    }
1084701
public function error()
    {
        $errors = $this->validator->errors();

        $this->error = empty($errors) ?: array_pop($errors)[0];

        return $this->error;
    }
755473
function error() {
        if ($this->error) {
            //Put some template variables for debugging here ...
            $debug_tpl_vars = array(
                '{LANGUAGE}' => $this->language,
                '{PATH}' => $this->language_path
            );
            $msg = str_replace(
                array_keys($debug_tpl_vars),
                array_values($debug_tpl_vars),
                $this->error_messages[$this->error]);

            return "<br /><strong>GeSHi Error:</strong> $msg (code {$this->error})<br />";
        }
        return false;
    }
108020
public function check() {
        $this->_errors = [];

        /** @var $element \Gcs\Framework\Core\Orm\Validation\Element\Element */
        foreach ($this->_elements as $element) {
            $element->check();

            if ($element->valid() == false) {
                $this->_errors = array_merge($this->_errors, $element->errors());
            }
        }
    }
1220525
public function error()
    {
        $errorNo = $_FILES[$this->file]['error'] ?? NULL;

        if( $errorNo === NULL )
        {
            return $this->getLang['upload:unknownError'];
        }

        if( is_array($errorNo) )
        {
            $errno = 0;

            foreach( $errorNo as $no )
            {
                if( ! empty($no) )
                {
                    $errno = $no;
                    break;
                }
            }

            $errorNo = $errno;
        }

        $lang = $this->getLang;

        $this->errors =
        [
            '0'  => "scc",            
            '1'  => $lang['upload:1'],
            '2'  => $lang['upload:2'], 
            '3'  => $lang['upload:3'], 
            '4'  => $lang['upload:4'], 
            '6'  => $lang['upload:6'], 
            '7'  => $lang['upload:7'], 
            '8'  => $lang['upload:8'], 
            '9'  => $lang['upload:9'],
            '10' => $lang['upload:10']
        ];
       
        if( ! empty($this->manuelError) )
        {
            return $this->errors[$this->manuelError];
        }
        elseif( ! empty($this->extensionControl) )
        {
            return $this->extensionControl;
        }
        elseif( ! empty($this->errors[$errorNo]) )
        {
            if( $this->errors[$errorNo] === "scc" )
            {
                return false;
            }
            return $this->errors[$errorNo];
        }
        else
        {
            return $lang['upload:unknownError'];
        }
    }