Provides description for IANA registered HTTP codes.
If not registered code was specified respective group description is returned.

@param int $code

@return string
423441
public static function getReasonPhraseByCode($code)
    {
        if (isset(self::$codesDescription[$code])) {
            return self::$codesDescription[$code];
        }

        $group = self::getGroupFromCode($code);

        return self::getReasonPhraseByGroup($group);
    }
841141
public static function vendorToHttp($code = Code::OK): int
    {
        if (Code::OK === $code) {
            return HttpCode::HTTP_OK;
        }

        switch ($code) {
            case Code::CANCELLED:
                return HttpCode::HTTP_CLIENT_CLOSED_REQUEST;

            case Code::UNKNOWN:
                return HttpCode::HTTP_INTERNAL_SERVER_ERROR;

            case Code::INVALID_ARGUMENT:
                return HttpCode::HTTP_BAD_REQUEST;

            case Code::DEADLINE_EXCEEDED:
                return HttpCode::HTTP_GATEWAY_TIMEOUT;

            case Code::NOT_FOUND:
                return HttpCode::HTTP_NOT_FOUND;

            case Code::ALREADY_EXISTS:
                return HttpCode::HTTP_CONFLICT;

            case Code::PERMISSION_DENIED:
                return HttpCode::HTTP_FORBIDDEN;

            case Code::UNAUTHENTICATED:
                return HttpCode::HTTP_UNAUTHORIZED;

            case Code::RESOURCE_EXHAUSTED:
                return HttpCode::HTTP_TOO_MANY_REQUESTS;

            // questionable... may not always be etag related.
            case Code::FAILED_PRECONDITION:
                return HttpCode::HTTP_PRECONDITION_FAILED;

            case Code::ABORTED:
                return HttpCode::HTTP_CONFLICT;

            case Code::OUT_OF_RANGE:
                return HttpCode::HTTP_BAD_REQUEST;

            case Code::UNIMPLEMENTED:
                return HttpCode::HTTP_NOT_IMPLEMENTED;

            case Code::INTERNAL:
                return HttpCode::HTTP_INTERNAL_SERVER_ERROR;

            case Code::UNAVAILABLE:
                return HttpCode::HTTP_SERVICE_UNAVAILABLE;

            case Code::DATA_LOSS:
                return HttpCode::HTTP_INTERNAL_SERVER_ERROR;

            default:
                return HttpCode::HTTP_UNPROCESSABLE_ENTITY;
        }
    }
1041938
public static function get( $code = 200 )
	{
		if( isset( self::$http_status_codes[$code] ) )
		{
			return( self::$http_status_codes[ $code ] );
		}
		return( false );
	}
1328004
public function parseCode($code)
    {
        $segments = (new NamespacedItemResolver)->parseKey($code);

        if (is_null($segments[0])) {
            $segments[0] = '*';
        }

        return $segments;
    }
461810
public static function GetCodeName( $code ) : string
   {

      switch ( $code )
      {

         case \E_ERROR:
         case \E_USER_ERROR:
            return 'ERROR';

         case \E_WARNING:
         case \E_USER_WARNING:
            return 'WARNING';

         case \E_DEPRECATED:
         case \E_USER_DEPRECATED:
            return 'DEPRECATED';

         case \E_NOTICE:
         case \E_USER_NOTICE:
            return 'NOTICE';

         case \E_PARSE:
            return 'PARSE';
         case \E_RECOVERABLE_ERROR:
            return 'RECOVERABLE ERROR';

         case \E_STRICT:
            return 'STRICT';

         default:
            if ( \is_string( $code ) )
            {
               return $code;
            }
            return 'OTHER';

      }

   }
18954
public static function getStatusMessage($code) {
    if (array_key_exists($code, self::$status_messages)) {
      return self::$status_messages[$code];
    }
    return sprintf("Unknown Code %d", $code);
  }
1114030
public static function getErrText($code)
    {
        if (isset(self::$errCode[$code])) {
            return self::$errCode[$code];
        }
        return false;
    }
283901
public function code(int $code = 200) : Rest
  {
    $this->code = $code;
    header('HTTP/1.1 '.$this->code);
    return $this;
  }
1210082
public static function statusCode($code)
    {
        $status = [
            // Informational 1xx
            100 => 'Continue',
            101 => 'Switching Protocols',
            // Success 2xx
            200 => 'OK',
            201 => 'Created',
            202 => 'Accepted',
            203 => 'Non-Authoritative Information',
            204 => 'No Content',
            205 => 'Reset Content',
            206 => 'Partial Content',
            // Redirection 3xx
            300 => 'Multiple Choices',
            301 => 'Moved Permanently',
            302 => 'Moved Temporarily ',  // 1.1
            303 => 'See Other',
            304 => 'Not Modified',
            305 => 'Use Proxy',
            // 306 is deprecated but reserved
            307 => 'Temporary Redirect',
            // Client Error 4xx
            400 => 'Bad Request',
            401 => 'Unauthorized',
            402 => 'Payment Required',
            403 => 'Forbidden',
            404 => 'Not Found',
            405 => 'Method Not Allowed',
            406 => 'Not Acceptable',
            407 => 'Proxy Authentication Required',
            408 => 'Request Timeout',
            409 => 'Conflict',
            410 => 'Gone',
            411 => 'Length Required',
            412 => 'Precondition Failed',
            413 => 'Request Entity Too Large',
            414 => 'Request-URI Too Long',
            415 => 'Unsupported Media Type',
            416 => 'Requested Range Not Satisfiable',
            417 => 'Expectation Failed',
            // Server Error 5xx
            500 => 'Internal Server Error',
            501 => 'Not Implemented',
            502 => 'Bad Gateway',
            503 => 'Service Unavailable',
            504 => 'Gateway Timeout',
            505 => 'HTTP Version Not Supported',
            509 => 'Bandwidth Limit Exceeded'
        ];
        if (array_key_exists($code, $status)) {
            header('HTTP/1.1 ' . $code . ' ' . $status[$code]);
        }
    }
1137572
protected function getResponseDescription($code)
  {
    $codes = array(

      // Informational 1xx
      100 => 'Continue',
      101 => 'Switching Protocols',
      // Success 2xx
      200 => 'OK',
      201 => 'Created',
      202 => 'Accepted',
      203 => 'Non-Authoritative Information',
      204 => 'No Content',
      205 => 'Reset Content',
      206 => 'Partial Content',
      // Redirection 3xx
      300 => 'Multiple Choices',
      301 => 'Moved Permanently',
      302 => 'Found', // 1.1
      303 => 'See Other',
      304 => 'Not Modified',
      305 => 'Use Proxy',
      // 306 is deprecated but reserved
      307 => 'Temporary Redirect',
      // Client Error 4xx
      400 => 'Bad Request',
      401 => 'Unauthorized',
      402 => 'Payment Required',
      403 => 'Forbidden',
      404 => 'Not Found',
      405 => 'Method Not Allowed',
      406 => 'Not Acceptable',
      407 => 'Proxy Authentication Required',
      408 => 'Request Timeout',
      409 => 'Conflict',
      410 => 'Gone',
      411 => 'Length Required',
      412 => 'Precondition Failed',
      413 => 'Request Entity Too Large',
      414 => 'Request-URI Too Long',
      415 => 'Unsupported Media Type',
      416 => 'Requested Range Not Satisfiable',
      417 => 'Expectation Failed',
      // Server Error 5xx
      500 => 'Internal Server Error',
      501 => 'Not Implemented',
      502 => 'Bad Gateway',
      503 => 'Service Unavailable',
      504 => 'Gateway Timeout',
      505 => 'HTTP Version Not Supported',
      509 => 'Bandwidth Limit Exceeded'
    );

    $result = (isset($codes[$code])) ? $codes[$code] : 'Unknown Status Code';

    return $result;
  }
431722
public function getGroup($code) {
        $groupId = is_numeric($code) ? $code : \CGroup::GetIDByCode($code);

        if (empty($groupId)) {
            return false;
        }

        /* extract SECURITY_POLICY */
        $item = \CGroup::GetByID($groupId)->Fetch();
        if (empty($item)) {
            return false;
        }

        if (!empty($item['SECURITY_POLICY'])) {
            $item['SECURITY_POLICY'] = unserialize($item['SECURITY_POLICY']);
        }

        if ($item['ID'] == 1) {
            $item['STRING_ID'] = 'administrators';
        } elseif ($item['ID'] == 2) {
            $item['STRING_ID'] = 'everyone';
        }

        return $item;

    }
920755
protected static function sns_token_uri($code)
    {
        $param = [
            'appid' => static::$appid,
            'secret' => static::$secret,
            'code' => $code,
            'grant_type' => 'authorization_code',
        ];

        return self::SNS_TOKEN_URI . http_build_query($param);
    }
437403
public static function phoneCode($code): string
    {
        return (isset(static::$phoneCodes[strtoupper($code)])) ? static::$phoneCodes[strtoupper($code)] : 'N/A';
    }
1358401
protected function makeResetUrl($code)
    {
        $params = [
            $this->property('paramCode') => $code
        ];

        if ($pageName = $this->property('resetPage')) {
            $url = $this->pageUrl($pageName, $params);
        }
        else {
            $url = $this->currentPageUrl($params);
        }

        if (strpos($url, $code) === false) {
            $url .= '?reset=' . $code;
        }

        return $url;
    }
319186
static public function getText( $code ){
		if( !array_key_exists( (int) $code, self::$codes ) )
			throw new InvalidArgumentException( 'Unknown HTTP status code: '.$code );
		return self::$codes[(int) $code];
	}
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;
    }
823096
public static function getMessageFor($code)
    {
        if (isset(self::$errorMessages[$code])) {
            $message = self::$errorMessages[$code];
        } else {
            $message = 'Unknown error code: "' . $code . '"';
        }

        return $message;
    }