Class Response

Summary

Fully Qualified Name: Zend\Http\Response
Extends: AbstractMessage
Implements: ResponseInterface

Description

HTTP Response

Methods

Name Description Defined By
__toString() Allow PHP casting of this object AbstractMessage
fromString() Populate object from string Response
getBody() Get the body of the response Response
getContent() Get message content Message
getCookie() Response
getHeaders() Return the header container responsible for headers AbstractMessage
getMetadata() Retrieve all metadata or a single metadatum as specified by key Message
getReasonPhrase() Get HTTP status message Response
getStatusCode() Retrieve HTTP status code Response
getVersion() Return the HTTP version for this request AbstractMessage
isClientError() Does the status code indicate a client error? Response
isForbidden() Is the request forbidden due to ACLs? Response
isGone() Does the status code indicate the resource is gone? Response
isInformational() Is the current status "informational"? Response
isNotFound() Does the status code indicate the resource is not found? Response
isOk() Do we have a normal, OK response? Response
isRedirect() Do we have a redirect? Response
isServerError() Does the status code reflect a server error? Response
isSuccess() Was the response successful? Response
renderStatusLine() Render the status line header Response
setContent() Set message content Message
setCustomStatusCode() Set custom HTTP status code Response
setHeaders() Provide an alternate Parameter Container implementation for headers in this object, (this is NOT the primary API for value setting, for that see getHeaders()) AbstractMessage
setMetadata() Set message metadata Message
setReasonPhrase() Response
setStatusCode() Set HTTP status code and (optionally) message Response
setVersion() Set the HTTP version for this object, one of 1.0, 1.1 or 2 (AbstractMessage::VERSION_10, AbstractMessage::VERSION_11, AbstractMessage::VERSION_2) AbstractMessage
toString() Render entire response as HTTP response string Response

Method Details

__toString()

Allow PHP casting of this object

Returns: string

fromString()

Populate object from string

Parameter Name Type Description
$string string

Returns: self

getBody()

Get the body of the response

Returns: string

getContent()

Get message content

Returns: mixed

getCookie()

Returns: \Header\SetCookie[]

getHeaders()

Return the header container responsible for headers

Returns: \Headers

getMetadata()

Retrieve all metadata or a single metadatum as specified by key

Parameter Name Type Description
$key null|string|int
$default null|mixed

Returns: mixed

getReasonPhrase()

Get HTTP status message

Returns: string

getStatusCode()

Retrieve HTTP status code

Returns: int

getVersion()

Return the HTTP version for this request

Returns: string

isClientError()

Does the status code indicate a client error?

Returns: bool

isForbidden()

Is the request forbidden due to ACLs?

Returns: bool

isGone()

Does the status code indicate the resource is gone?

Returns: bool

isInformational()

Is the current status "informational"?

Returns: bool

isNotFound()

Does the status code indicate the resource is not found?

Returns: bool

isOk()

Do we have a normal, OK response?

Returns: bool

isRedirect()

Do we have a redirect?

Returns: bool

isServerError()

Does the status code reflect a server error?

Returns: bool

isSuccess()

Was the response successful?

Returns: bool

renderStatusLine()

Render the status line header

Returns: string

setContent()

Set message content

Parameter Name Type Description
$value mixed

Returns: \Message

setCustomStatusCode()

Set custom HTTP status code

Parameter Name Type Description
$code int

Returns: self

setHeaders()

Provide an alternate Parameter Container implementation for headers in this object, (this is NOT the primary API for value setting, for that see getHeaders())

Parameter Name Type Description
$headers \Headers

Returns: \AbstractMessage

setMetadata()

Set message metadata

Non-destructive setting of message metadata; always adds to the metadata, never overwrites the entire metadata container.

Parameter Name Type Description
$spec string|int|array|\Traversable
$value mixed

Returns: \Message

setReasonPhrase()

Parameter Name Type Description
$reasonPhrase string

Returns: self

setStatusCode()

Set HTTP status code and (optionally) message

Parameter Name Type Description
$code int

Returns: self

setVersion()

Set the HTTP version for this object, one of 1.0, 1.1 or 2 (AbstractMessage::VERSION_10, AbstractMessage::VERSION_11, AbstractMessage::VERSION_2)

Parameter Name Type Description
$version string (Must

Returns: \AbstractMessage

toString()

Render entire response as HTTP response string

Returns: string

Top