Gets errors list

@param boll $convert_to_string
@return array|null
762094
public function get_errors_array($convert_to_string = false) {
        if (empty($this->errors)) {
            return ($convert_to_string) ? null : array();
        }

        $resp = array();

        foreach ($this->errors as $e) {
            $field = ucwords(str_replace(array('_', '-'), chr(32), $e['field']));
            $param = $e['param'];

            // Let's fetch explicit field names if they exist
            if (array_key_exists($e['field'], self::$fields)) {
                $field = self::$fields[$e['field']];
            }

            switch ($e['rule']) {
                case 'mismatch' :
                    $resp[$field] = "There is no validation rule for $field";
                    break;
                case 'validate_required':
                    $resp[$field] = "The $field field is required";
                    break;
                case 'validate_valid_email':
                    $resp[$field] = "The $field field is required to be a valid email address";
                    break;
                case 'validate_max_len':
                    $resp[$field] = "The $field field needs to be $param or shorter in length";
                    break;
                case 'validate_min_len':
                    $resp[$field] = "The $field field needs to be $param or longer in length";
                    break;
                case 'validate_exact_len':
                    $resp[$field] = "The $field field needs to be exactly $param characters in length";
                    break;
                case 'validate_alpha':
                    $resp[$field] = "The $field field may only contain alpha characters(a-z)";
                    break;
                case 'validate_alpha_numeric':
                    $resp[$field] = "The $field field may only contain alpha-numeric characters";
                    break;
                case 'validate_alpha_dash':
                    $resp[$field] = "The $field field may only contain alpha characters &amp; dashes";
                    break;
                case 'validate_numeric':
                    $resp[$field] = "The $field field may only contain numeric characters";
                    break;
                case 'validate_integer':
                    $resp[$field] = "The $field field may only contain a numeric value";
                    break;
                case 'validate_boolean':
                    $resp[$field] = "The $field field may only contain a true or false value";
                    break;
                case 'validate_float':
                    $resp[$field] = "The $field field may only contain a float value";
                    break;
                case 'validate_valid_url':
                    $resp[$field] = "The $field field is required to be a valid URL";
                    break;
                case 'validate_url_exists':
                    $resp[$field] = "The $field URL does not exist";
                    break;
                case 'validate_valid_ip':
                    $resp[$field] = "The $field field needs to contain a valid IP address";
                    break;
                case 'validate_valid_cc':
                    $resp[$field] = "The $field field needs to contain a valid credit card number";
                    break;
                case 'validate_valid_name':
                    $resp[$field] = "The $field field needs to contain a valid human name";
                    break;
                case 'validate_contains':
                    $resp[$field] = "The $field field needs to contain one of these values: " . implode(', ', $param);
                    break;
                case 'validate_contains_list':
                    $resp[$field] = "The $field field needs to contain a value from its drop down list";
                    break;
                case 'validate_doesnt_contain_list':
                    $resp[$field] = "The $field field contains a value that is not accepted";
                    break;
                case 'validate_street_address':
                    $resp[$field] = "The $field field needs to be a valid street address";
                    break;
                case 'validate_date':
                    $resp[$field] = "The $field field needs to be a valid date";
                    break;
                case 'validate_min_numeric':
                    $resp[$field] = "The $field field needs to be a numeric value, equal to, or higher than $param";
                    break;
                case 'validate_max_numeric':
                    $resp[$field] = "The $field field needs to be a numeric value, equal to, or lower than $param";
                    break;
                case 'validate_min_age':
                    $resp[$field] = "The $field field needs to have an age greater than or equal to $param";
                    break;
                case 'validate_unique':
                    $resp[$field] = "The $field field needs to have unique value";
                    break;
                default:
                    $resp[$field] = "The $field field is invalid";
            }
        }

        return $resp;
    }
1254925
public function get($send_to)
    {
        $res = static::check($send_to);
        if ($res['errcode']) {
            return $res;
        }
        
        $code = DataHelper::randomNumber(4);
        
        static::getCache()->set($send_to, [
            'send_to' => $send_to,
            'code'    => $code,
            'expire_time' => time() + $this->options['interval'],
        ]);
        
        return ErrorInfo::success(['code' => $code]);
    }
1336563
function ErrorMsg()
	{
		if (!$this->_connectionID) return "No connection established";
		$errmsg = '';

		try {
			$errc = $this->_connectionID->Errors;
			if (!$errc) return "No Errors object found";
			if ($errc->Count == 0) return '';
			$err = $errc->Item($errc->Count-1);
			$errmsg = $err->Description;
		}catch(exception $e) {
		}
		return $errmsg;
	}
817871
public function log_php_errors( $error_types = NULL ) {

		static $done = FALSE;
		if ( $done ) {
			return $this;
		}

		$done = TRUE;
		is_int( $error_types ) or $error_types = E_ALL | E_STRICT;

		$controller = new PhpErrorController();
		register_shutdown_function( [ $controller, 'on_fatal', ] );
		set_error_handler( [ $controller, 'on_error' ], $error_types );
		set_exception_handler( [ $controller, 'on_exception', ] );

		// Ensure that channel Channels::PHP_ERROR error is there
		add_filter(
			Channels::FILTER_CHANNELS,
			function ( array $channels ) {

				$channels[] = Channels::PHP_ERROR;

				return $channels;
			},
			PHP_INT_MAX
		);

		return $this;
	}
167516
public function getErrorMessages()
    {
        $errors = [];
        foreach ($this->fields as $field) {
            if ($field instanceof AbstractFormField && !$field->isValid()) {
                $fldErrors = $field->getErrorMessages();
                $errors = array_merge($errors, $fldErrors);
            }
        }

        return $errors;
    }
970930
private function _getErrorMessage($header_string) {
        list($status, $stash) = explode("\r\n", $header_string, 2);
        list($v, $code, $message) = explode(" ", $status, 3);
        return $message . " X-Request-Id: " . $this->getXRequestId();
    }
428562
public function getErrors ($str = FALSE)
	{
		
		// Copy the errors array
		
		$errors	= $this->errors;
		
		// Reset errors
		
		$this->resetErrors ();
		
		// If return as string
		
		if ($str)
		{
			
			// Convert to string and return
			
			return implode ('<br />', $errors);
			
		}
		
		// Else
		
		else
		{
			
			// Return the errors array
			
			return $errors;
			
		}
		
	}
993687
public function getErrors($key = null) {
        if (isset($key)) {
            return !empty($this->errors[$key]) ? $this->errors[$key] : array();
        }
        else {
            return $this->errors;
        }
    }
524935
public static function getUploadErrorMessages()
    {
        return [
            UPLOAD_ERR_OK => Module::t('upload_err_message_0'),
            UPLOAD_ERR_INI_SIZE => Module::t('upload_err_message_1'),
            UPLOAD_ERR_FORM_SIZE =>  Module::t('upload_err_message_2'),
            UPLOAD_ERR_PARTIAL =>  Module::t('upload_err_message_3'),
            UPLOAD_ERR_NO_FILE =>  Module::t('upload_err_message_4'),
            UPLOAD_ERR_NO_TMP_DIR =>  Module::t('upload_err_message_6'),
            UPLOAD_ERR_CANT_WRITE =>  Module::t('upload_err_message_7'),
            UPLOAD_ERR_EXTENSION =>  Module::t('upload_err_message_8'),
        ];
    }
380072
public function encodeError($error_code, $error_message) {

        $payload  = '<?xml version="1.0" encoding="'.$this->encoding.'"?>';
        $payload .= "<methodResponse>";
        $payload .= $this->encodeFault($error_code, $error_message);
        $payload .= "</methodResponse>";

        return $payload;

    }
756738
public function getErrorString()
    {
        $this->execute();
        
        return $this->error ? $this->error['errcode'] . ':' . $this->error['errmsg'] : null;
    }
1127684
final public function getErrorString()
    {

        $errors = self::getErrors();
        $string = '<ul>';
        foreach ($errors as $error) {
            $string .= '<li>' . $error . '</li>';
        }

        //An ordered lists of all errors;
        return $string . '</ul>';
    }
518651
public function check($send_to)
    {
        if (!DataHelper::verify_mobile($send_to) && !DataHelper::verify_email($send_to)) {
            return ErrorInfo::error('手机号或邮箱不正确');
        }
        
        // check if already send
        $sdata = static::getCache()->get($send_to);
        
        if ($sdata && $sdata['expire_time'] > (time() - $this->options['interval'])) {
            return ErrorInfo::error('信息已发送注意查收[1]');
        }
        
        return ErrorInfo::success();
    }
383184
public function getErrorMessages($recursive = false): ?array
  {
    $ret = [];
    if ($recursive)
    {
      foreach ($this->controls as $control)
      {
        $tmp = $control->getErrorMessages(true);
        if (is_array($tmp))
        {
          $ret = array_merge($ret, $tmp);
        }
      }
    }

    if (isset($this->errorMessages))
    {
      $ret = array_merge($ret, $this->errorMessages);
    }

    if (empty($ret)) $ret = null;

    return $ret;
  }
834138
public List<String> toList() {

        List<String> errorStrings = new ArrayList<String>();
        ErrorIterator errIterator = iterator();
        while (errIterator.hasNext()) {
            ValidationError err = errIterator.next();
            errorStrings.add(err.getMessage());
        }
        return errorStrings;
    }
152338
public function hasErrors($error_names = null) {
		if (empty($error_names)) {
			return !empty($this->errors['flag_error_in_fields']) || !empty($this->errors['general']['danger']);
		} else {
			if (!is_array($error_names)) {
				$error_names = [$error_names];
			}
			foreach ($error_names as $v) {
				if (!empty($this->errors['fields'][$v]['danger'])) {
					return true;
				}
			}
			return false;
		}
	}
444569
public function get_error_messages(
		/** @noinspection PhpUnusedParameterInspection */
		$key, $errors
	) {
		$columns = $this->app->db->get_columns( $this->get_related_table_name() );
		unset( $columns['id'] );
		$columns = $this->app->utility->array_combine( $columns, 'name' );

		return array_map( function ( $d ) use ( $key, $columns ) {
			$key = $this->table_column_to_name( $key, $columns );

			return "$d: [{$key}]";
		}, $errors );
	}