SimpleResultStream
in package
implements
ResultStream
Simple streamable body used for testing.
Tags
Table of Contents
Interfaces
- ResultStream
- Stream for a Result.
Properties
- $data : string
Methods
- __construct() : mixed
- 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
$data
private
string
$data
Methods
__construct()
public
__construct(string $data) : mixed
Parameters
- $data : string
getChunks()
Download the response in chunks.
public
getChunks() : iterable<string|int, string>
$fileHandler = fopen('/output.pdf', 'w'); foreach ($result->getBody()->getChunks() as $chunk) { fwrite($fileHandler, $chunk); }
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