Translates the error number into human readable text.

It also includes the corresponding config
setting, so we can decide if we want to output
anything.

@param int $errorint
The error number.

@return array
The translated type and the setting.
551539
protected function translateErrorType($errorint)
    {
        if (isset($this->errorTranslation[$errorint]) === true) {
            return $this->errorTranslation[$errorint];
        }

        // Fallback to 'unknown'.
        return array('Unknown error', 'unknown');
    }
929774
public static function toRoman($int)
    {
        if (!is_int($int) || $int < 1 || $int > 3999) {
            throw new \InvalidArgumentException("A roman numeral must be an integer between 1 and 3999, $int given.");
        }

        $roman = '';
        foreach (self::$characters as $number => $character) {
            while ($int >= $number) {
                $roman .= $character;
                $int -= $number;
            }
        }

        return $roman;
    }
1299898
public function handleError($errNumber, $errString, $errFile ='', $errLine = 0)
	{
		$interfaceSettings = $this->cmd->getConfigOpt('interface');
		$textColor = $interfaceSettings['error']['text_color'];
		$textBgColor = $interfaceSettings['error']['text_background'];

		$this->env->sendOutput('Error: ' . $errString, $textColor, $textBgColor);
		exit;
	}
1184309
public static function getErrorName($errorCode)
    {
        if (!isset(static::$errorNames[$errorCode])) {
            throw new InvalidArgumentException(sprintf('The error code "%s" does not exist for constraint of type "%s".', $errorCode, \get_called_class()));
        }

        return static::$errorNames[$errorCode];
    }
584747
public static function getUploadErrorMessage($errorId)
    {
        $messagesArray = self::getUploadErrorMessages();
        return isset($messagesArray[$errorId]) ? $messagesArray[$errorId] : 'Unknown upload error.';
    }
313064
protected function int2letter($int)
    {
        $lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
        $size = strlen($lookup);

        $letters = '';
        while ($int > 0) {
            $int--;
            $letters = $lookup[$int % $size] . $letters;
            $int = floor($int / $size);
        }
        return $letters;
    }
550621
public static function errorToString($error) {
        if (!is_int($error)) throw new IllegalTypeException('Illegal type of parameter $error: '.gettype($error));

        if (key_exists($error, self::$win32Errors))
            return self::$win32Errors[$error][0];
        return (string) $error;
    }
1001101
public function alphaNum($error) {
        if ($this->_exist) {
            array_push($this->_constraints, ['type' => self::ALPHANUM, 'message' => $error]);
        }

        return $this;
    }
170790
public function getMessageString($errorCode)
	{
		return isset($this->errorMessages[$errorCode]) ? $this->errorMessages[$errorCode] : null;
	}
432856
public function countIn($countIn, $error) {
        if ($this->_exist) {
            array_push($this->_constraints, ['type' => self::COUNTIN, 'value' => $countIn, 'message' => $error]);
        }

        return $this;
    }
1209483
public function setErrorType($error)
    {
        if (isset($this->errorTypes[$error])) {
            $this->message = trim($this->errorTypes[$error].': '.$this->message);
        }
    }
180414
public static function fromPhpErrorNo($errorNo)
	{
		switch ($errorNo)
		{
			case E_ERROR:
				return self::ERROR;
			case E_WARNING:
				return self::WARNING;
			case E_PARSE:
				return self::ERROR;
			case E_NOTICE:
				return self::NOTICE;
			case E_CORE_ERROR:
				return self::ERROR;
			case E_CORE_WARNING:
				return self::WARNING;
			case E_COMPILE_ERROR:
				return self::ERROR;
			case E_COMPILE_WARNING:
				return self::WARNING;
			case E_USER_ERROR:
				return self::ERROR;
			case E_USER_WARNING:
				return self::WARNING;
			case E_USER_NOTICE:
				return self::NOTICE;
			case E_STRICT:
				return self::INFO;
			case E_RECOVERABLE_ERROR:
				return self::ERROR;
			case E_DEPRECATED:
				return self::WARNING;
			case E_USER_DEPRECATED:
				return self::WARNING;
		}

		return self::ERROR;
	}
593435
protected function formatErrors(string $errors)
    {
        $errors = json_decode($errors);
        $output = '';

        foreach ($errors as $error)
            foreach ($error as $message)
                $output .= $message . "\r\n";

        return $output;
    }
446765
public static function formatErrorMessage(array $error_message)
    {
        $msg = $error_message['msg'] ?? "";
        $context = $error_message['context'] ?? [];
        if (class_exists("Wedeto\I18n\I18nShortcut"))
        {
            return t($msg, $context);
        }

        return WF::fillPlaceholders($msg, $context);
    }
890854
private function raiseException($errorNum)
    {
        $errMessage = isset($this->listError[$errorNum]) ? $this->listError[$errorNum] : 'Unknown Exception';

        throw new \Exception($errMessage, $errorNum);
    }
30987
private function _errorNumberString($intval)
	{
		$errorlevels = array(
			E_ALL => 'E_ALL',
			E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR',
			E_STRICT => 'E_STRICT',
			E_USER_NOTICE => 'E_USER_NOTICE',
			E_USER_WARNING => 'E_USER_WARNING',
			E_USER_ERROR => 'E_USER_ERROR',
			E_COMPILE_WARNING => 'E_COMPILE_WARNING',
			E_COMPILE_ERROR => 'E_COMPILE_ERROR',
			E_CORE_WARNING => 'E_CORE_WARNING',
			E_CORE_ERROR => 'E_CORE_ERROR',
			E_NOTICE => 'E_NOTICE',
			E_PARSE => 'E_PARSE',
			E_WARNING => 'E_WARNING',
			E_ERROR => 'E_ERROR'
		);

		if (defined('E_DEPRECATED'))
		{
			$errorlevels[E_DEPRECATED] = 'E_DEPRECATED';
			$errorlevels[E_USER_DEPRECATED] = 'E_USER_DEPRECATED';
		}

		return $errorlevels[$intval];
	}
198956
public function commandError($errorMessage)
    {
        $output = PHP_EOL.Colors::BG_RED.str_repeat(" ", strlen($errorMessage)+4).PHP_EOL.
        Colors::WHITE ."  $errorMessage  ".PHP_EOL.
        Colors::BG_RED.str_repeat(" ", strlen($errorMessage)+4).PHP_EOL.
        Colors::BG_BLACK.Colors::WHITE;
        return $output;
    }