You are here

public function Response::__construct in Zircon Profile 8

Same name in this branch
  1. 8 vendor/symfony/http-foundation/Response.php \Symfony\Component\HttpFoundation\Response::__construct()
  2. 8 vendor/symfony/browser-kit/Response.php \Symfony\Component\BrowserKit\Response::__construct()
  3. 8 vendor/zendframework/zend-diactoros/src/Response.php \Zend\Diactoros\Response::__construct()
  4. 8 vendor/guzzlehttp/psr7/src/Response.php \GuzzleHttp\Psr7\Response::__construct()
  5. 8 vendor/jcalderonzumba/gastonjs/src/NetworkTraffic/Response.php \Zumba\GastonJS\NetworkTraffic\Response::__construct()
  6. 8 vendor/symfony/psr-http-message-bridge/Tests/Fixtures/Response.php \Symfony\Bridge\PsrHttpMessage\Tests\Fixtures\Response::__construct()
Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/psr7/src/Response.php \GuzzleHttp\Psr7\Response::__construct()

Parameters

int $status Status code for the response, if any.:

array $headers Headers for the response, if any.:

mixed $body Stream body.:

string $version Protocol version.:

string $reason Reason phrase (a default will be used if possible).:

File

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

Class

Response
PSR-7 response implementation.

Namespace

GuzzleHttp\Psr7

Code

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