Class Stream

Summary

Fully Qualified Name: Zend\Http\Response\Stream
Extends: Response

Description

Represents an HTTP response message as PHP stream resource

Methods

Name Description Defined By
__destruct() Destructor Stream
__toString() Allow PHP casting of this object AbstractMessage
fromStream() Create a new Zend\Http\Response\Stream object from a stream Stream
fromString() Populate object from string Response
getBody() Get the response body as string Stream
getCleanup() Get the cleanup trigger Stream
getContent() Get message content Message
getContentLength() Get content length Stream
getCookie() Response
getHeaders() Return the header container responsible for headers AbstractMessage
getMetadata() Retrieve all metadata or a single metadatum as specified by key Message
getRawBody() Get the raw response body (as transferred "on wire") as string Stream
getReasonPhrase() Get HTTP status message Response
getStatusCode() Retrieve HTTP status code Response
getStream() Get the response as stream Stream
getStreamName() Get file name associated with the stream Stream
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
setCleanup() Set the cleanup trigger Stream
setContent() Set message content Message
setContentLength() Set content length Stream
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
setStream() Set the response stream Stream
setStreamName() Set file name associated with the stream Stream
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

__destruct()

Destructor

Returns:

__toString()

Allow PHP casting of this object

Returns: string

fromStream()

Create a new Zend\Http\Response\Stream object from a stream

Parameter Name Type Description
$responseString string
$stream resource

Returns: \Stream

fromString()

Populate object from string

Parameter Name Type Description
$string string

Returns: self

getBody()

Get the response body as string

This method returns the body of the HTTP response (the content), as it should be in it's readable version - that is, after decoding it (if it was decoded), deflating it (if it was gzip compressed), etc.

If you want to get the raw body (as transferred on wire) use $this->getRawBody() instead.

Returns: string

getCleanup()

Get the cleanup trigger

Returns: bool

getContent()

Get message content

Returns: mixed

getContentLength()

Get content length

Returns: int|null

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

getRawBody()

Get the raw response body (as transferred "on wire") as string

If the body is encoded (with Transfer-Encoding, not content-encoding - IE "chunked" body), gzip compressed, etc. it will not be decoded.

Returns: string

getReasonPhrase()

Get HTTP status message

Returns: string

getStatusCode()

Retrieve HTTP status code

Returns: int

getStream()

Get the response as stream

Returns: resource

getStreamName()

Get file name associated with the stream

Returns: string

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

setCleanup()

Set the cleanup trigger

Parameter Name Type Description
$cleanup bool

Returns:

setContent()

Set message content

Parameter Name Type Description
$value mixed

Returns: \Message

setContentLength()

Set content length

Parameter Name Type Description
$contentLength int

Returns:

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

setStream()

Set the response stream

Parameter Name Type Description
$stream resource

Returns: \Stream

setStreamName()

Set file name associated with the stream

Parameter Name Type Description
$streamName string Name

Returns: \Stream

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