phpDocumentor

HttpResponse implements Response

Class HttpResponse

Tags
codeCoverageIgnore

Interfaces, Classes and Traits

Response
Interface Response

Table of Contents

$internal  : Response
__construct()  : mixed
Response constructor.
__toString()  : string
Convert response to string.
getBody()  : mixed
getHeader()  : array<string|int, mixed>
getHeaderLine()  : string
getHeaders()  : array<string|int, mixed>
getProtocolVersion()  : string
getReasonPhrase()  : string
getStatusCode()  : int
hasHeader()  : bool
isClientError()  : bool
Is this response a client error?
isEmpty()  : bool
Is this response empty?
isForbidden()  : bool
Is this response forbidden?
isInformational()  : bool
Is this response informational?
isNotFound()  : bool
Is this response not Found?
isOk()  : bool
Is this response OK?
isRedirect()  : bool
Is this response a redirect?
isRedirection()  : bool
Is this response a redirection?
isServerError()  : bool
Is this response a server error?
isSuccessful()  : bool
Is this response successful?
toSlimResponse()  : Response
Returns a slim response instance.
withAddedHeader()  : Response
withBody()  : Response
withFile()  : static
Note: This method is not part of the PSR-7 standard.
withFileDownload()  : static
Note: This method is not part of the PSR-7 standard.
withHeader()  : Response
withJson()  : static
Write JSON to Response Body.
withoutHeader()  : Response
withProtocolVersion()  : Response
withRedirect()  : static
Redirect to specified location
withStatus()  : Response
write()  : static
Write data to the response body.

Properties

Methods

__construct()

Response constructor.

public __construct(Response $internal) : mixed
Parameters
$internal : Response
Return values
mixed

__toString()

Convert response to string.

public __toString() : string
Tags
inheritdoc
Return values
string

getBody()

public getBody() : mixed
Tags
inheritdoc
Return values
mixed

getHeader()

public getHeader(mixed $name) : array<string|int, mixed>
Parameters
$name : mixed
Tags
inheritdoc
Return values
array<string|int, mixed>

getHeaderLine()

public getHeaderLine(mixed $name) : string
Parameters
$name : mixed
Tags
inheritdoc
Return values
string

getHeaders()

public getHeaders() : array<string|int, mixed>
Tags
inheritdoc
Return values
array<string|int, mixed>

getProtocolVersion()

public getProtocolVersion() : string
Tags
inheritdoc
Return values
string

getReasonPhrase()

public getReasonPhrase() : string
Tags
inheritdoc
Return values
string

getStatusCode()

public getStatusCode() : int
Tags
inheritdoc
Return values
int

hasHeader()

public hasHeader(mixed $name) : bool
Parameters
$name : mixed
Tags
inheritdoc
Return values
bool

isClientError()

Is this response a client error?

public isClientError() : bool
Tags
inheritdoc
Return values
bool

isEmpty()

Is this response empty?

public isEmpty() : bool
Tags
inheritdoc
Return values
bool

isForbidden()

Is this response forbidden?

public isForbidden() : bool
Tags
inheritdoc
Return values
bool

isInformational()

Is this response informational?

public isInformational() : bool
Tags
inheritdoc
Return values
bool

isNotFound()

Is this response not Found?

public isNotFound() : bool
Tags
inheritdoc
Return values
bool

isOk()

Is this response OK?

public isOk() : bool
Tags
inheritdoc
Return values
bool

isRedirect()

Is this response a redirect?

public isRedirect() : bool
Tags
inheritdoc
Return values
bool

isRedirection()

Is this response a redirection?

public isRedirection() : bool
Tags
inheritdoc
Return values
bool

isServerError()

Is this response a server error?

public isServerError() : bool
Tags
inheritdoc
Return values
bool

isSuccessful()

Is this response successful?

public isSuccessful() : bool
Tags
inheritdoc
Return values
bool

toSlimResponse()

Returns a slim response instance.

public toSlimResponse() : Response
Return values
Response

withAddedHeader()

public withAddedHeader(mixed $name, mixed $value) : Response
Parameters
$name : mixed
$value : mixed
Tags
inheritdoc
Return values
Response

withBody()

public withBody(StreamInterface $body) : Response
Parameters
$body : StreamInterface
Tags
inheritdoc
Return values
Response

withFile()

Note: This method is not part of the PSR-7 standard.

public withFile(mixed $file[, mixed $contentType = true ]) : static
Parameters
$file : mixed
$contentType : mixed = true
Tags
inheritdoc
Return values
static

withFileDownload()

Note: This method is not part of the PSR-7 standard.

public withFileDownload(mixed $file[, string|null $name = null ][, mixed $contentType = true ]) : static
Parameters
$file : mixed
$name : string|null = null
$contentType : mixed = true
Tags
inheritdoc
Return values
static

withHeader()

public withHeader(mixed $name, mixed $value) : Response
Parameters
$name : mixed
$value : mixed
Tags
inheritdoc
Return values
Response

withJson()

Write JSON to Response Body.

public withJson(mixed $data[, int|null $status = null ], int $options[, int $depth = 512 ]) : static
Parameters
$data : mixed

The data

$status : int|null = null

The HTTP status code

$options : int

Json encoding options

$depth : int = 512

Json encoding max depth

Tags
inheritdoc
Return values
static

withProtocolVersion()

public withProtocolVersion(mixed $version) : Response
Parameters
$version : mixed
Tags
inheritdoc
Return values
Response

withRedirect()

Redirect to specified location

public withRedirect(string $url[, int|null $status = null ]) : static
Parameters
$url : string

The redirect destination.

$status : int|null = null

The redirect HTTP status code.

Tags
inheritdoc
Return values
static

withStatus()

public withStatus(mixed $code[, mixed $reasonPhrase = '' ]) : Response
Parameters
$code : mixed
$reasonPhrase : mixed = ''
Tags
inheritdoc
Return values
Response

write()

Write data to the response body.

public write(string $data) : static
Parameters
$data : string
Tags
inheritdoc
Return values
static

Search results