function Response::__construct
Same name in this branch
- 11.1.x vendor/composer/composer/src/Composer/Util/Http/Response.php \Composer\Util\Http\Response::__construct()
- 11.1.x vendor/symfony/browser-kit/Response.php \Symfony\Component\BrowserKit\Response::__construct()
- 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\Psr7Code
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;
}