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

Breadcrumb

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

function Response::__construct

Same name in this branch
  1. 11.1.x vendor/composer/composer/src/Composer/Util/Http/Response.php \Composer\Util\Http\Response::__construct()
  2. 11.1.x vendor/symfony/browser-kit/Response.php \Symfony\Component\BrowserKit\Response::__construct()
  3. 11.1.x vendor/symfony/http-foundation/Response.php \Symfony\Component\HttpFoundation\Response::__construct()

Parameters

int $status Status code:

(string|string[])[] $headers Response headers:

string|resource|StreamInterface|null $body Response body:

string $version Protocol version:

string|null $reason Reason phrase (when empty a default will be used based on the status code):

File

vendor/guzzlehttp/psr7/src/Response.php, line 94

Class

Response
PSR-7 response implementation.

Namespace

GuzzleHttp\Psr7

Code

public function __construct(int $status = 200, array $headers = [], $body = null, string $version = '1.1', ?string $reason = null) {
    $this->assertStatusCodeRange($status);
    $this->statusCode = $status;
    if ($body !== '' && $body !== null) {
        $this->stream = Utils::streamFor($body);
    }
    $this->setHeaders($headers);
    if ($reason == '' && isset(self::PHRASES[$this->statusCode])) {
        $this->reasonPhrase = self::PHRASES[$this->statusCode];
    }
    else {
        $this->reasonPhrase = (string) $reason;
    }
    $this->protocol = $version;
}

API Navigation

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