Method that switches the error code constants till it finds the messages
that belongs to the error code and then returns the message.

@param   int                 The error code
@return  string              The error message
979231
private function codeToMessage($code) {
        // get the error message belong to the given code
        switch ($code) {
            case \Th\FileDownloader::FILE_WRONG_MIME:
                $message = "File is of the wrong MIME type";
                break;
            case \Th\FileDownloader::FILE_WRONG_EXTENSION:
                $message = "File is of the wrong extension";
                break;
            case \Th\FileDownloader::INVALID_DOWNLOAD_DIR:
                $message = "User set download directory does not exist";
                break;
            default:
                $message = "Unknown download error";
                break;
        }

        // done, return the error message
        return $message;
    }
495253
protected function getErrorTypeByCode($code) {
		if(!static::$errorsConstantsValues) {
			foreach(static::$errorsConstantsNames as $constantName) {
				if(defined($constantName)) {
					static::$errorsConstantsValues[constant($constantName)] = $constantName;
				}
			}
		}
		if(isset(static::$errorsConstantsValues[$code])) {
			return static::$errorsConstantsValues[$code];
		}
		return (string)$code;
	}
879295
protected function getErrorMessage(array $errors)
    {
        $error_message = '';
        foreach ($errors as $error) {
            $error_message .= $this->parseError($error) . PHP_EOL . PHP_EOL;
        }

        return $error_message;
    }
702370
public function getErrorMessage()
    {
        if (array_key_exists('error', $this->responseData?: [])) {
            if (is_string($this->responseData['error'])) {
                return json_encode($this->responseData['error']);
            } elseif(array_key_exists('error', $this->responseData['error'])) {
                return json_encode($this->responseData['error']['error']);
            } else {
                return json_encode($this->responseData['error']);
            }
        } else {
            return null;
        }
    }
761038
public function getError()
    {
        if ($this->errorCode !== null || $this->success === false) {
            return [
                'code'    => $this->errorCode === null ? self::UNKNOWN_ERROR_CODE : $this->errorCode,
                'message' => $this->errorMessage === null ? self::UNKNOWN_ERROR_MSG : $this->errorMessage
            ];
        } else {
            return null;
        }
    }
893799
protected function getExceptionCode()
    {
        $exception = $this->getException();

        $code = $exception->getCode();
        if ($exception instanceof \ErrorException) {
            // ErrorExceptions wrap the php-error types within the 'severity' property
            $code = Misc::translateErrorCode($exception->getSeverity());
        }

        return (string) $code;
    }
978018
public function getReceptionCode($code)
    {
        static $codes = array();

        if (! isset($codes[$code])) {
            $codes[$code] = $this->_loadClass('receptionCode', true, array($code));
        }

        return $codes[$code];
    }
1336959
private function errorCode()
    {
        if ($this->preparedExec == false){
    		$returnValue = $this->dbConnector->errorCode();
    	}
    	else{
    		$returnValue = $this->lastPreparedExecStatement->errorCode();
    	}
        return (string) $returnValue;
    }
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;
    }
162910
public function error()
	{
		$error = array('code' => '00000', 'message' => '');
		$pdo_error = $this->conn_id->errorInfo();

		if (empty($pdo_error[0]))
		{
			return $error;
		}

		$error['code'] = isset($pdo_error[1]) ? $pdo_error[0].'/'.$pdo_error[1] : $pdo_error[0];
		if (isset($pdo_error[2]))
		{
			 $error['message'] = $pdo_error[2];
		}

		return $error;
	}
419657
public static function getCodeByMessage(string $errorMessage): int
    {
        $code = array_search($errorMessage, self::MESSAGES);
        if ($code === false) {
            $code = self::UNKNOWN_ERROR;
        }
        return (int)$code;
    }
219659
public function getCode(): int {
        if ($status = $this->getMainCode()) {
            return $status;
        }

        if ($this->isValid()) {
            return 200;
        }

        // There was no status so loop through the errors and look for the highest one.
        $max = 0;
        foreach ($this->getRawErrors() as $error) {
            if (isset($error['code']) && $error['code'] > $max) {
                $max = $error['code'];
            }
        }

        return $max ?: 400;
    }
1293931
public function getErrorMessage($code)
    {
        $error[0] = 'Success';
        $error[1] = 'Syntax or usage error';
        $error[2] = 'Protocol incompatibility';
        $error[3] = 'Errors selecting input/output files, dirs';
        $error[4] = 'Requested action not supported: an attempt was made to manipulate '
            . '64-bit files on a platform that cannot support them; or an option '
            . 'was specified that is supported by the client and not by the server';
        $error[5] = 'Error starting client-server protocol';
        $error[10] = 'Error in socket I/O';
        $error[11] = 'Error in file I/O';
        $error[12] = 'Error in rsync protocol data stream';
        $error[13] = 'Errors with program diagnostics';
        $error[14] = 'Error in IPC code';
        $error[20] = 'Received SIGUSR1 or SIGINT';
        $error[21] = 'Some error returned by waitpid()';
        $error[22] = 'Error allocating core memory buffers';
        $error[23] = 'Partial transfer due to error';
        $error[24] = 'Partial transfer due to vanished source files';
        $error[30] = 'Timeout in data send/receive';

        if (array_key_exists($code, $error)) {
            return $error[$code];
        }

        return null;
    }
596184
public function getErrorText()
    {
        $message = '';
        if ($this->isError()) {
            $message = $this->messages->message[0]->text;
            if (@$this->transactionResponse->errors[0]->errorText) {
                $message = $this->transactionResponse->errors[0]->errorText;
            }
        }
        return $message;
    }
994223
public function getErrorMessage()
    {
        $messages = array();
        foreach ($this->errors as $error) {
            if (isset($this->errorMessages[$error])) {
                $messages[] = $this->errorMessages[$error];
            } else{
                $messages[] = $error;
            }
        }

        return implode(' ', $messages);
    }
1013041
private function getErrorMessage(FormError $error)
    {
        if (null !== $error->getMessagePluralization()) {
            return $this->translator->transChoice($error->getMessageTemplate(), $error->getMessagePluralization(), $error->getMessageParameters(), 'validators');
        }

        return $this->translator->trans($error->getMessageTemplate(), $error->getMessageParameters(), 'validators');
    }
823824
public static function code($code = 200) : String
    {
        $messages = Datatype::multikey(self::$messages);

        if( isset($messages[$code]) )
        {
            return $messages[$code];
        }

        return false;
    }