Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ResponseInterface.php

function ResponseInterface::withStatus

Return an instance with the specified status code and, optionally, reason phrase.

If no reason phrase is specified, implementations MAY choose to default to the RFC 7231 or IANA recommended reason phrase for the response's status code.

This method MUST be implemented in such a way as to retain the immutability of the message, and MUST return an instance that has the updated status and reason phrase.

@link http://tools.ietf.org/html/rfc7231#section-6 @link http://www.iana.org/assignments/http-status-codes/http-status-codes.xht…

Parameters

int $code The 3-digit integer result code to set.:

string $reasonPhrase The reason phrase to use with the: provided status code; if none is provided, implementations MAY use the defaults as suggested in the HTTP specification.

Return value

static

Throws

\InvalidArgumentException For invalid status code arguments.

1 method overrides ResponseInterface::withStatus()
Response::withStatus in vendor/guzzlehttp/psr7/src/Response.php
Return an instance with the specified status code and, optionally, reason phrase.

File

vendor/psr/http-message/src/ResponseInterface.php, line 52

Class

ResponseInterface
Representation of an outgoing, server-side response.

Namespace

Psr\Http\Message

Code

public function withStatus(int $code, string $reasonPhrase = '') : ResponseInterface;

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal