ResponseBodyStream
in package
implements
ResultStream
Stream a HTTP response body.
This class is a BC layer for Http Response that does not support toStream()
.
When calling getChunks
you must read all the chunks before being able to call this method (or another method) again.
When calling getContentAsResource
, it first, fully read the Response Body in a blocking way.
Tags
Table of Contents
Interfaces
- ResultStream
- Stream for a Result.
Properties
- $fallback : ResponseBodyResourceStream|null
- $partialRead : bool
- $responseStream : ResponseStreamInterface
Methods
- __construct() : mixed
- __toString() : string
- getChunks() : iterable<string|int, string>
- Download the response in chunks.
- getContentAsResource() : resource
- Download content into a resource and then return that resource.
- getContentAsString() : string
- Download content into a temporary resource and return a string.
Properties
$fallback
private
ResponseBodyResourceStream|null
$fallback
$partialRead
private
bool
$partialRead
= false
$responseStream
private
ResponseStreamInterface
$responseStream
Methods
__construct()
public
__construct(ResponseStreamInterface $responseStream) : mixed
Parameters
- $responseStream : ResponseStreamInterface
__toString()
public
__toString() : string
Return values
stringgetChunks()
Download the response in chunks.
public
getChunks() : iterable<string|int, string>
Return values
iterable<string|int, string>getContentAsResource()
Download content into a resource and then return that resource.
public
getContentAsResource() : resource
Return values
resourcegetContentAsString()
Download content into a temporary resource and return a string.
public
getContentAsString() : string