Returns 501 Not Implemented HTTP Response

@param string $msg
@param int $errorCode
@param array $headers
@return json
12552
public function notImplemented($msg = '', $errorCode = null, $headers = [])
    {
        return $this->getErrorResponse($msg, $errorCode, self::HTTP_NOT_IMPLEMENTED, $headers);
    }
1346733
protected function getErrorMessage($errorCode)
    {
        if (!isset($this->errorMessageMatrix[$errorCode])) {
            $this->errorMessageMatrix[$errorCode] = 'ERROR_MSG_UNKNOWN';
        }

        // if additional information exist -> add it here
        if ($this->info) {
            if (is_string($this->info)) {
                $this->errorMessageMatrix[$errorCode] .= ' '.$this->info;
            } elseif (count($this->info) != 1 || $this->info[0] != null) {
                foreach ($this->info as $info) {
                    $info = serialize($info);
                    $this->errorMessageMatrix[$errorCode] .= ' '.$info;
                }
            }
        }

        // Return constructed error message
        return $this->errorMessageMatrix[$errorCode];
    }
578371
public function respondInternalError($code = ApiResponse::CODE_API_ERROR, $message = null): JsonResponse
    {
        return $this->setStatusCode(IlluminateResponse::HTTP_INTERNAL_SERVER_ERROR)
            ->respondWithError($code, $message);
    }
21501
public function getResponseError($e, array $headers = [])
    {
        $code = false;

        if ($e instanceof Exception) {
            $code = $e->getCode();
        } elseif (is_numeric($e)) {
            $code = (int)$e;
        }

        if (!$code || $code < 400 || $code > 599) {
            $code = self::HTTP_SERVER_ERROR;
        }

        return $this->getHttpResponse($code, $headers);
    }
292417
protected function result($data, $code = 0, $msg = '')
    {
        $result = [
            'code' => $code,
            'msg'  => $msg,
            'time' => Request::instance()->server('REQUEST_TIME'),
            'data' => $data,
        ];
        header('Content-type: application/json; charset=utf-8');
        die(json_encode($result));
    }
41836
public function response_json($code, $msg, $data, $http_num = 200)
    {

        return response()->json([
            'error' => $code,
            'msg' => $msg,
            'data' => $data,
        ], $http_num);
    }
928983
protected function jsonErrorResponse($errorMessage, $statusCode = 400, array $httpHeaders = array())
    {
        $statusTexts = \Symfony\Component\HttpFoundation\Response::$statusTexts;

        return $this->jsonResponse(array(
            'error' => (string) $errorMessage,
        ), array(
            'status' => array(
                'code'    => (int) $statusCode,
                'message' => $statusTexts[$statusCode],
            ),
        ), $httpHeaders);
    }
1247846
public function getError($errorCode) {
        if (array_key_exists($errorCode, $this->_errors)) {
            $result = $this->_errors[$errorCode];
            return $result;
        } else {
            return null;
        }
    }
477089
public function notAvailable($msg = '', $errorCode = null, $headers = [])
    {
        return $this->getErrorResponse($msg, $errorCode, self::HTTP_SERVICE_UNAVAILABLE, $headers);
    }
1228182
public static function json($data = array(), $status = 200, array $headers = array(), $options = 0)
  {
    $etagMatch     = false;
    $headersToExpose = array();

    if (array_key_exists('ETag', $headers)) {
      $headersToExpose[] = 'ETag';

      // Empty the data if If-None-Match header match with ETag value
      $requestEtags = IlluminateRequest::getETags();

      if ( ! empty($requestEtags)) {
        foreach ($requestEtags as $etag) {
          if ($headers['ETag'] == $etag) {
            $etagMatch = true;
            $data    = array();

            break;
          }
        }
      }

      unset($requestEtags);
    }

    if (array_key_exists('Link', $headers)) {
      $headersToExpose[] = 'Link';
    }

    if (array_key_exists('X-Rate-Limit-Limit', $headers)) {
      $headersToExpose[] = 'X-Rate-Limit-Limit';
    }

    if (array_key_exists('X-Rate-Limit-Remaining', $headers)) {
      $headersToExpose[] = 'X-Rate-Limit-Remaining';
    }

    if (array_key_exists('X-Rate-Limit-Reset', $headers)) {
      $headersToExpose[] = 'X-Rate-Limit-Reset';
    }

    $headers['Access-Control-Expose-Headers'] = implode(', ', $headersToExpose);

    if ($etagMatch) {
      $response = parent::make('', 304, $headers);
    } else {
      $response = parent::json($data, $status, $headers);
    }

    $response->setCharset('utf-8');

    if (array_key_exists('ETag', $headers)) {
      $response->setCache(array(
        'etag' => $headers['ETag']
      ));
    }

    return $response;
  }
789551
private function getHttpStatusCode($statusCode)
    {
        if ($statusCode >= 100 && $statusCode < 600) {
            return $statusCode;
        } elseif (
                FrontControllerException::BAD_REQUEST === $statusCode
                || FrontControllerException::INTERNAL_ERROR === $statusCode
                || FrontControllerException::NOT_FOUND === $statusCode
        ) {
            return $statusCode - FrontControllerException::UNKNOWN_ERROR;
        }

        return 500;
    }
1347159
protected function _respondToError($errorMessage, $httpCode) {
        $this->_setHttpStatusCode($httpCode);
        $this->view->result = array(
            'success' => false,
            'errorMessage' => $errorMessage
        );
    }
560483
public function respond(array $data, $status = 200, $code, array $headers = [], $options = 0)
    {
        return $this->response->json(
            array_merge(compact('status', 'code'), $data), $status, $headers, $options
        );
    }
373275
public static function responseError($mdata = array(), $status = null, $msg = null)
    {
        if (!$status) {
            $status = 400;
        }

        if (method_exists($mdata, 'getFile')) {
            $data = [
                "msg" => $msg ?: $mdata->getMessage(),
                "status" => $status,
                "data" => [],
            ];
            if (LEVEL_ENV < 2) {
                $data['data']['file'] = $mdata->getFile();
                $data['data']['line'] = $mdata->getLine();
                $data['data']['code'] = $mdata->getCode();
                $data['data']['debug'] = debug_backtrace();
            }
        } else{
            $data = [
                "msg" => $msg,
                "status" => $status,
                "data" => $mdata,
            ];
        }

        return $data;
    }
295643
public function jsonError($errorCode, $errorMessage = null)
    {
        // Build error from message
        $error = [
            'type' => 'error',
            'code' => $errorCode,
        ];
        if ($errorMessage) {
            $error['value'] = $errorMessage;
        }

        // Support explicit error handling with status = error, or generic message handling
        // with a message of type = error
        $result = [
            'status' => 'error',
            'errors' => [$error]
        ];
        $response = HTTPResponse::create(json_encode($result), $errorCode)
            ->addHeader('Content-Type', 'application/json');

        // Call a handler method such as onBeforeHTTPError404
        $this->extend("onBeforeJSONError{$errorCode}", $request, $response);

        // Call a handler method such as onBeforeHTTPError, passing 404 as the first arg
        $this->extend('onBeforeJSONError', $errorCode, $request, $response);

        // Throw a new exception
        throw new HTTPResponse_Exception($response);
    }
919964
private function getHeaderResponseString($headerCode)
    {
        switch ($headerCode) {
            case 100:
                $text = 'Continue';
                break;
            case 101:
                $text = 'Switching Protocols';
                break;
            case 200:
                $text = 'OK';
                break;
            case 201:
                $text = 'Created';
                break;
            case 202:
                $text = 'Accepted';
                break;
            case 203:
                $text = 'Non-Authoritative Information';
                break;
            case 204:
                $text = 'No Content';
                break;
            case 205:
                $text = 'Reset Content';
                break;
            case 206:
                $text = 'Partial Content';
                break;
            case 300:
                $text = 'Multiple Choices';
                break;
            case 301:
                $text = 'Moved Permanently';
                break;
            case 302:
                $text = 'Moved Temporarily';
                break;
            case 303:
                $text = 'See Other';
                break;
            case 304:
                $text = 'Not Modified';
                break;
            case 305:
                $text = 'Use Proxy';
                break;
            case 400:
                $text = 'Bad Request';
                break;
            case 401:
                $text = 'Unauthorized';
                break;
            case 402:
                $text = 'Payment Required';
                break;
            case 403:
                $text = 'Forbidden';
                break;
            case 404:
                $text = 'Not Found';
                break;
            case 405:
                $text = 'Method Not Allowed';
                break;
            case 406:
                $text = 'Not Acceptable';
                break;
            case 407:
                $text = 'Proxy Authentication Required';
                break;
            case 408:
                $text = 'Request Time-out';
                break;
            case 409:
                $text = 'Conflict';
                break;
            case 410:
                $text = 'Gone';
                break;
            case 411:
                $text = 'Length Required';
                break;
            case 412:
                $text = 'Precondition Failed';
                break;
            case 413:
                $text = 'Request Entity Too Large';
                break;
            case 414:
                $text = 'Request-URI Too Large';
                break;
            case 415:
                $text = 'Unsupported Media Type';
                break;
            case 500:
                $text = 'Internal Server Error';
                break;
            case 501:
                $text = 'Not Implemented';
                break;
            case 502:
                $text = 'Bad Gateway';
                break;
            case 503:
                $text = 'Service Unavailable';
                break;
            case 504:
                $text = 'Gateway Time-out';
                break;
            case 505:
                $text = 'HTTP Version not supported';
                break;
            default:
                throw new UrlObjectException(UrlObjectException::MSG_ARG_OUT_OF_RANGE, [$headerCode]);
                break;
        }

        return $text;
    }
84913
protected function getErrorResponse($msg, $errorCode, $statusText, $headers = [])
    {
        return $this->setStatusText($this->statusTexts[$statusText])
                    ->setStatusCode($statusText)
                    ->setStatusMessage(self::ERROR_TEXT)
                    ->setErrorCode($errorCode)
                    ->setErrorMessage($msg)
                    ->respondWithErrorMessage($headers);
    }