Return message string by code

@param $errorCode
@return string|null
170790
public function getMessageString($errorCode)
	{
		return isset($this->errorMessages[$errorCode]) ? $this->errorMessages[$errorCode] : null;
	}
1269119
public function getStatusMessageFromCode(int $code) : string
    {
        if (isset($this->statusMessageList[$code])) {
            return $this->statusMessageList[$code];
        }
        throw new \InvalidArgumentException(
            'Invalid status code'
        );
    }
655224
public static function get($code)
  {
    if (array_key_exists($code, self::$translations)) {
      return self::$translations[$code];
    }
    return sprintf('[%s]', $code);
  }
731862
private function getHumanResultCode($code)
    {
        if (isset($this->resultCodes[$code])) {
            return $this->resultCodes[$code];
        }

        if (is_scalar($code)) {
            return $code;
        }

        return self::UNKNOWN_CODE;
    }
1029605
public function unauthorized($msg = '', $errorCode = null, $headers = [])
    {
        return $this->getErrorResponse($msg, $errorCode, self::HTTP_UNAUTHORIZED, $headers);
    }
1203361
public function statusCode($code = null, $reasonPhrase = null)
    {
        if (func_num_args() < 1 || empty($code)) {
            return $this->response->getStatusCode();
        }
        $this->response = $this->response->withStatus($code, $reasonPhrase);
        return $this;
    }
796708
protected function getErrorMessage($nCode, $strMessage = null)
    {
        $strReturn = 'Failure: ';
        if (null !== $this->strResourcePath) {
            $strReturn = 'Path: "'.$this->strResourcePath.'" ';
        }
        $strReturn .= 'Name: "'.$this->strResourceName.'"';
        $strReturn .= ' Code: ';
        switch ($nCode) {
            case self::FAILURE_IO:
                $strReturn .= 'General IO Error';
                break;
            case self::FAILURE_NOT_WRITEABLE:
                $strReturn .= 'not writeable';
                break;
            case self::FAILURE_NOT_READABLE:
                $strReturn .= 'not readable';
                break;
            case self::FAILURE_NOT_FOUND:
                $strReturn .= 'not found';
                break;
            default:
                $strReturn .= (string) $nCode;
                break;
        }
        if (null !== $strMessage) {
            $strReturn .= ' with message: "'.$strMessage.'"';
        }

        return $strReturn;
    }
802749
protected function buildErrorResponse($error, $code = null)
    {
        if ($code !== null && (!is_int($code) || $code < 400)) {
            $code = null;
        }
        if (is_object($error)) {
            if ($error instanceof AccessDeniedException) {
                $error = $error->getMessage();
                if ($code === null) {
                    $code = Response::HTTP_UNAUTHORIZED;
                }
            } elseif ($error instanceof UserMessageException) {
                if ($error->getCode() >= 400) {
                    $code = $error->getCode();
                }
                $error = $error->getMessage();
            } elseif ($error instanceof Exception || $error instanceof Throwable) {
                $error = t('An unexpected error occurred');
            } elseif (is_callable([$error, '__toString'])) {
                $error = (string) $error;
            } else {
                $error = get_class($error);
            }
        }
        if ($code === null) {
            $code = Response::HTTP_INTERNAL_SERVER_ERROR;
        }

        return $this->getResponseFactory()->create(
            $error,
            $code,
            [
                'Content-Type' => 'text/plain; charset=UTF-8',
            ]
        );
    }
550290
public function getLanguageByCode($code)
    {
        $returnValue = null;


        $langClass = new core_kernel_classes_Class(static::CLASS_URI_LANGUAGES);
	    $langs = $langClass->searchInstances(array(
            OntologyRdf::RDF_VALUE => $code
	    ), array(
	    	'like' => false
	    ));
	    if (count($langs) == 1) {
	    	$returnValue = current($langs);
	    } else {
	    	common_Logger::w('Could not find language with code '.$code);
	    }


        return $returnValue;
    }
896032
public function getReasonCode()
    {
        $code = null;

        if (isset($this->data['messages'])) {
            // In case of a successful transaction, a "messages" element is present
            $code = (string)$this->data['messages']['message']['code'];
        }

        return $code;
    }
1145117
public static function getStatusMessage($code) {
		if (!$code) {
			return '';
		}

		return isset(self::$statusMessages[$code]) ? self::$statusMessages[$code] : '';
	}
1231303
public function getReasonCode()
    {
        $code = null;

        if (isset($this->data->transactionResponse->messages)) {
            // In case of a successful transaction, a "messages" element is present
            $code = intval((string)$this->data->transactionResponse->messages->message->code);
        } elseif (isset($this->data->transactionResponse->errors)) {
            // In case of an unsuccessful transaction, an "errors" element is present
            $code = intval((string)$this->data->transactionResponse->errors->error->errorCode);
        } elseif (isset($this->data->messages->message)) {
            // In case of invalid request, the top-level message provides details.
            $code = (string)$this->data->messages->message->code;
        }

        return $code;
    }
687092
protected static function find_error_record($errorCode)
    {
        $result = static::singleton()->invokeWithExtensions('getErrorRecordFor', $errorCode);
        $result = array_filter($result);
        if ($result) {
            return reset($result);
        }

        return null;
    }
1331667
public function getMessage()
    {
        if (!$this->isSuccessful() && isset($this->data['errorCode'])) {
            return $this->data['errorCode'] . ': ' . $this->data['message'];
        }

        if (!$this->isSuccessful() && isset($this->data['responseCode'])) {
            return $this->data['responseCode'] . ': ' . $this->data['responseMessage'];
        }

        return null;
    }
526229
public function getLanguage($languageCode = null): ?string
    {
        $languageCode = $languageCode ? mb_strtoupper($languageCode) : null;

        return $this->get("languages.{$languageCode}") ?: (current($this->get('languages', [])) ?: null);
    }
486683
private function jsonDecodeErrorMessage($jsonErrorCode)
    {
        if (function_exists('json_last_error_msg')) {
            return json_last_error_msg();
        }
        switch ($jsonErrorCode) {
            case JSON_ERROR_DEPTH:
                return 'Maximum stack depth exceeded';
            case JSON_ERROR_STATE_MISMATCH:
                return 'Underflow or the modes mismatch';
            case JSON_ERROR_CTRL_CHAR:
                return 'Unexpected control character found';
            case JSON_ERROR_SYNTAX:
                return 'Syntax error, malformed JSON';
            case JSON_ERROR_UTF8:
                return 'Malformed UTF-8 characters, possibly incorrectly encoded';
        }

        return 'Unknown JSON decode error';
    }
195544
public static function reasonPhraseFor(int $statusCode): string
    {
        if (isset(self::$reasonPhrases[$statusCode])) {
            return self::$reasonPhrases[$statusCode];
        }

        throw new \InvalidArgumentException(
                'Invalid or unknown HTTP status code ' . $statusCode
        );
    }