@internal - private

@param int $statusCode

@return string
541325
protected function guessFile($statusCode)
    {
        $fileName = sprintf('%s/%s.html', $this->templatePath, (int) $statusCode);

        if (is_readable($fileName)) {
            return $fileName;
        } else {
            return $this->defaultErrorFileName;
        }
    }
702222
protected function getMetaResponse($meta, $statusCode = Response::HTTP_OK)
    {
        $this->checkParameters();

        /** @var ResponsesInterface $responses */
        $responses       = $this->getIntegration()->getFromContainer(ResponsesInterface::class);
        $encoder         = $this->codecMatcher->getEncoder();
        $outputMediaType = $this->codecMatcher->getEncoderRegisteredMatchedType();
        $content         = $encoder->encodeMeta($meta);

        return $responses->getResponse($statusCode, $outputMediaType, $content, $this->supportedExtensions);
    }
175420
public static function isError(int $statusCode): bool
    {
        return ($statusCode >= HttpStatus::CLIENT_ERROR) && ($statusCode < HttpStatus::SERVER_ERROR_END);
    }
63902
protected function getStatusMessage($code)
    {
        return (
            isset($this->statusMessages[$code])
                ? $this->statusMessages[$code] : $this->statusMessages[500]
        );
    }
921826
public function getStatus($includeStatusCode = false)
    {
        if (!isset($this->data->status))
            return null;
        return ($includeStatusCode) ? sprintf("%s: %s", $this->data->status, $this->data->statusCode) : $this->data->status;
    }
1280152
public static function isInformational(int $statusCode): bool
    {
        return ($statusCode >= HttpStatus::INFORMATIONAL) && ($statusCode < HttpStatus::SUCCESSFUL);
    }
136304
public static function getStatusIdList($statusCode)
    {
        if (! isset(self::$statusIdListsCache[$statusCode])) {
            $statusIdList = [];

            $statusList = OrderStatusQuery::create()->find();

            /** @var OrderStatus $status */
            foreach ($statusList as $status) {
                switch ($statusCode) {
                    case OrderStatus::CODE_NOT_PAID:
                        $match = $status->isNotPaid(false);
                        break;
                    case OrderStatus::CODE_PAID:
                        $match = $status->isPaid(false);
                        break;

                    case OrderStatus::CODE_PROCESSING:
                        $match = $status->isProcessing(false);
                        break;

                    case OrderStatus::CODE_SENT:
                        $match = $status->isSent(false);
                        break;
                    case OrderStatus::CODE_CANCELED:
                        $match = $status->isCancelled(false);
                        break;
                    case OrderStatus::CODE_REFUNDED:
                        $match = $status->isRefunded(false);
                        break;

                    default:
                        throw new InvalidArgumentException("Status code '$statusCode' is not a valid value.");
                }

                if ($match) {
                    $statusIdList[] = $status->getId();
                }
            }

            self::$statusIdListsCache[$statusCode] = $statusIdList;
        }

        return self::$statusIdListsCache[$statusCode];
    }
859686
public function setStatusCode($statusCode)
    {
        $statusCode = (int)$statusCode;
        if ($statusCode < 100 || $statusCode >= 600) {
            throw new \Exception("Invalid status code: {$statusCode}.");
        }
        $this->statusCode = $statusCode;
        return $this;
    }
808916
protected function makeHtmlResponse($statusCode)
    {
        $view = $this->getView();

        if ($statusCode !== SymfonyResponse::HTTP_OK) {
            $view->withErrors($this->getErrorBagForStatusCode($statusCode));
        }

        return new IlluminateHtmlResponse($view, $statusCode);
    }
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);
  }
113216
protected function generateResponse($statusCode, $json)
    {
        if (empty($json) && $statusCode == Response::REST_SUCCESS_NO_CONTENT) {
            return new Response(array(), $statusCode);
        } else {
            $body = json_decode($json, true);
            if ($body == null) {
                throw new ClientException('Error while sending request to api; Received invalid json: ' . $json, ClientException::SERVER_UNAVAILABLE);
            }
            $response = new Response($body, $statusCode);
            $this->validateServerResponse($response);

            return $response;
        }
    }
1177001
public function toUrl($url, $statusCode = 302)
    {
        $server = $this->getServer();

        $response = $server->getResponse(false)
            ->withHeader('Location', $url)
            ->withStatus($statusCode);

        return $response;
    }
206560
public static function getMessageForCode($status)
    {
        if (isset(self::$messages[$status])) {
            return self::$messages[$status];
        } else {
            return null;
        }
    }
983812
public function output($statusCode)
    {
        // TODO: Refactor into a content-type option
        if (Director::is_ajax()) {
            return $this->getTitle();
        }

        $renderer = Debug::create_debug_view();
        $output = $renderer->renderHeader();
        $output .= $renderer->renderInfo("Website Error", $this->getTitle(), $this->getBody());

        $adminEmail = Email::config()->get('admin_email');
        if ($adminEmail) {
            $mailto = Email::obfuscate($adminEmail);
            $output .= $renderer->renderParagraph('Contact an administrator: ' . $mailto . '');
        }

        $output .= $renderer->renderFooter();
        return $output;
    }
1368810
public static function isRedirection(int $statusCode): bool
    {
        return ($statusCode >= HttpStatus::REDIRECTION) && ($statusCode < HttpStatus::CLIENT_ERROR);
    }
1022672
private function isError($statusCode)
    {
        if ($this->statusCodeValidator) {
            return call_user_func($this->statusCodeValidator, $statusCode);
        }

        return $statusCode >= 400 && $statusCode < 600;
    }
217167
public function setStatus(int $statusCode): void
    {
        if (!isset($this->statusMessages[$statusCode])) {
            throw new \InvalidArgumentException('Invalid HTTP status code.');
        }
        $this->statusCode = $statusCode;
    }