Zend\Http\Response\Stream
Represents an HTTP response message as PHP stream resource
Synopsis
class Stream
extends Response
{
- // Inherited constants from Response
- const STATUS_CODE_CUSTOM = 0;
- const STATUS_CODE_100 = 100;
- const STATUS_CODE_101 = 101;
- const STATUS_CODE_102 = 102;
- const STATUS_CODE_200 = 200;
- const STATUS_CODE_201 = 201;
- const STATUS_CODE_202 = 202;
- const STATUS_CODE_203 = 203;
- const STATUS_CODE_204 = 204;
- const STATUS_CODE_205 = 205;
- const STATUS_CODE_206 = 206;
- const STATUS_CODE_207 = 207;
- const STATUS_CODE_208 = 208;
- const STATUS_CODE_300 = 300;
- const STATUS_CODE_301 = 301;
- const STATUS_CODE_302 = 302;
- const STATUS_CODE_303 = 303;
- const STATUS_CODE_304 = 304;
- const STATUS_CODE_305 = 305;
- const STATUS_CODE_306 = 306;
- const STATUS_CODE_307 = 307;
- const STATUS_CODE_400 = 400;
- const STATUS_CODE_401 = 401;
- const STATUS_CODE_402 = 402;
- const STATUS_CODE_403 = 403;
- const STATUS_CODE_404 = 404;
- const STATUS_CODE_405 = 405;
- const STATUS_CODE_406 = 406;
- const STATUS_CODE_407 = 407;
- const STATUS_CODE_408 = 408;
- const STATUS_CODE_409 = 409;
- const STATUS_CODE_410 = 410;
- const STATUS_CODE_411 = 411;
- const STATUS_CODE_412 = 412;
- const STATUS_CODE_413 = 413;
- const STATUS_CODE_414 = 414;
- const STATUS_CODE_415 = 415;
- const STATUS_CODE_416 = 416;
- const STATUS_CODE_417 = 417;
- const STATUS_CODE_418 = 418;
- const STATUS_CODE_422 = 422;
- const STATUS_CODE_423 = 423;
- const STATUS_CODE_424 = 424;
- const STATUS_CODE_425 = 425;
- const STATUS_CODE_426 = 426;
- const STATUS_CODE_428 = 428;
- const STATUS_CODE_429 = 429;
- const STATUS_CODE_431 = 431;
- const STATUS_CODE_500 = 500;
- const STATUS_CODE_501 = 501;
- const STATUS_CODE_502 = 502;
- const STATUS_CODE_503 = 503;
- const STATUS_CODE_504 = 504;
- const STATUS_CODE_505 = 505;
- const STATUS_CODE_506 = 506;
- const STATUS_CODE_507 = 507;
- const STATUS_CODE_508 = 508;
- const STATUS_CODE_511 = 511;
- // Inherited constants from AbstractMessage
- const VERSION_10 = '1.0';
- const VERSION_11 = '1.1';
- // members
- protected int $contentLength;
- protected integer $contentStreamed;
- protected resource $stream;
- protected string $streamName;
- protected bool $cleanup;
- // Inherited members from Response
- protected array $recommendedReasonPhrases;
- protected integer $statusCode;
- protected string|null $reasonPhrase;
- // Inherited members from AbstractMessage
- protected string $version;
- protected Headers|null $headers;
- // methods
- public void setContentLength()
- public int|null getContentLength()
- public resource getStream()
- public Stream setStream()
- public bool getCleanup()
- public void setCleanup()
- public string getStreamName()
- public Stream setStreamName()
- public static Stream fromStream()
- public string getBody()
- public string getRawBody()
- protected string readStream()
- public void __destruct()
- // Inherited methods from Response
- public static self fromString()
- public array getCookie()
- public self setStatusCode()
- public int getStatusCode()
- public self setCustomStatusCode()
- public self setReasonPhrase()
- public string getReasonPhrase()
- public string getBody()
- public bool isClientError()
- public bool isForbidden()
- public bool isInformational()
- public bool isNotFound()
- public bool isOk()
- public bool isServerError()
- public bool isRedirect()
- public bool isSuccess()
- public string renderStatusLine()
- public string toString()
- protected string decodeChunkedBody()
- protected string decodeGzip()
- protected string decodeDeflate()
- // Inherited methods from AbstractMessage
- public AbstractMessage setVersion()
- public string getVersion()
- public AbstractMessage setHeaders()
- public Headers getHeaders()
- public string __toString()
- // Inherited methods from Message
- public Message setMetadata()
- public mixed getMetadata()
- public Message setContent()
- public mixed getContent()
- public string toString()
Hierarchy
Extends
Constants
Name | Value |
---|---|
STATUS_CODE_CUSTOM | 0 |
STATUS_CODE_100 | 100 |
STATUS_CODE_101 | 101 |
STATUS_CODE_102 | 102 |
STATUS_CODE_200 | 200 |
STATUS_CODE_201 | 201 |
STATUS_CODE_202 | 202 |
STATUS_CODE_203 | 203 |
STATUS_CODE_204 | 204 |
STATUS_CODE_205 | 205 |
STATUS_CODE_206 | 206 |
STATUS_CODE_207 | 207 |
STATUS_CODE_208 | 208 |
STATUS_CODE_300 | 300 |
STATUS_CODE_301 | 301 |
STATUS_CODE_302 | 302 |
STATUS_CODE_303 | 303 |
STATUS_CODE_304 | 304 |
STATUS_CODE_305 | 305 |
STATUS_CODE_306 | 306 |
STATUS_CODE_307 | 307 |
STATUS_CODE_400 | 400 |
STATUS_CODE_401 | 401 |
STATUS_CODE_402 | 402 |
STATUS_CODE_403 | 403 |
STATUS_CODE_404 | 404 |
STATUS_CODE_405 | 405 |
STATUS_CODE_406 | 406 |
STATUS_CODE_407 | 407 |
STATUS_CODE_408 | 408 |
STATUS_CODE_409 | 409 |
STATUS_CODE_410 | 410 |
STATUS_CODE_411 | 411 |
STATUS_CODE_412 | 412 |
STATUS_CODE_413 | 413 |
STATUS_CODE_414 | 414 |
STATUS_CODE_415 | 415 |
STATUS_CODE_416 | 416 |
STATUS_CODE_417 | 417 |
STATUS_CODE_418 | 418 |
STATUS_CODE_422 | 422 |
STATUS_CODE_423 | 423 |
STATUS_CODE_424 | 424 |
STATUS_CODE_425 | 425 |
STATUS_CODE_426 | 426 |
STATUS_CODE_428 | 428 |
STATUS_CODE_429 | 429 |
STATUS_CODE_431 | 431 |
STATUS_CODE_500 | 500 |
STATUS_CODE_501 | 501 |
STATUS_CODE_502 | 502 |
STATUS_CODE_503 | 503 |
STATUS_CODE_504 | 504 |
STATUS_CODE_505 | 505 |
STATUS_CODE_506 | 506 |
STATUS_CODE_507 | 507 |
STATUS_CODE_508 | 508 |
STATUS_CODE_511 | 511 |
VERSION_10 | '1.0' |
VERSION_11 | '1.1' |
Members
protected
- $cleanup
—
Zend\Http\Response\bool
Should we clean up the stream file when this response is closed? - $content — string
- $contentLength
—
int
The Content-Length value, if set - $contentStreamed
—
int
The portion of the body that has already been streamed - $headers — Zend\Http\Headers|null
- $metadata — array
- $reasonPhrase — Zend\Http\string|null
- $recommendedReasonPhrases — array
- $statusCode — int
- $stream
—
resource
Response as stream - $streamName
—
string
The name of the file containing the stream - $version — string
Methods
protected
- readStream() — Read stream content and return it as string
public
- __destruct() — Destructor
- fromStream() — Create a new Zend\Http\Response\Stream object from a stream
- getBody() — Get the response body as string
- getCleanup() — Get the cleanup trigger
- getContentLength() — Get content length
- getRawBody() — Get the raw response body (as transferred "on wire") as string
- getStream() — Get the response as stream
- getStreamName() — Get file name associated with the stream
- setCleanup() — Set the cleanup trigger
- setContentLength() — Set content length
- setStream() — Set the response stream
- setStreamName() — Set file name associated with the stream
Inherited from Zend\Http\Response
protected
- decodeChunkedBody() — Decode a "chunked" transfer-encoded body and return the decoded text
- decodeDeflate() — Decode a zlib deflated message (when Content-encoding = deflate)
- decodeGzip() — Decode a gzip encoded message (when Content-encoding = gzip)
public
- fromString() — Populate object from string
- getBody() — Get the body of the response
- getCookie()
- getReasonPhrase() — Get HTTP status message
- getStatusCode() — Retrieve HTTP status code
- isClientError() — Does the status code indicate a client error?
- isForbidden() — Is the request forbidden due to ACLs?
- isInformational() — Is the current status "informational"?
- isNotFound() — Does the status code indicate the resource is not found?
- isOk() — Do we have a normal, OK response?
- isRedirect() — Do we have a redirect?
- isServerError() — Does the status code reflect a server error?
- isSuccess() — Was the response successful?
- renderStatusLine() — Render the status line header
- setCustomStatusCode() — Set custom HTTP status code
- setReasonPhrase()
- setStatusCode() — Set HTTP status code and (optionally) message
- toString() — Render entire response as HTTP response string
Inherited from Zend\Http\AbstractMessage
public
- __toString() — Allow PHP casting of this object
- getHeaders() — Return the header container responsible for headers
- getVersion() — Return the HTTP version for this request
- 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())
- setVersion() — Set the HTTP version for this object, one of 1.0 or 1.1 (AbstractMessage::VERSION_10, AbstractMessage::VERSION_11)
Inherited from Zend\Stdlib\Message
public
- getContent() — Get message content
- getMetadata() — Retrieve all metadata or a single metadatum as specified by key
- setContent() — Set message content
- setMetadata() — Set message metadata
- toString()