Documentation

ReadableIterableStream
in package
implements ReadableStream, IteratorAggregate uses ReadableStreamIteratorAggregate, ForbidCloning, ForbidSerialization

FinalYes

Creates a stream from an iterable emitting strings. If the iterable throws an exception, the exception will be thrown from {@see read()} and {@see buffer()}. Consider wrapping any exceptions in {@see StreamException} if you do not wish for another type of exception to be thrown from the stream.

Tags
implements

Table of Contents

Interfaces

ReadableStream
A `ReadableStream` allows reading byte streams in chunks.
IteratorAggregate

Properties

$exception  : Throwable|null
$iterator  : ConcurrentIterator<string|int, string>|null
$onClose  : DeferredFuture
$pending  : bool

Methods

__construct()  : mixed
__serialize()  : never
__unserialize()  : never
close()  : void
Closes the resource, marking it as unusable.
getIterator()  : Traversable<int, string>
isClosed()  : bool
Returns whether this resource has been closed.
isReadable()  : bool
onClose()  : void
Registers a callback that is invoked when this resource is closed.
read()  : string|null
Reads data from the stream.
__clone()  : mixed

Properties

Methods

__construct()

public __construct(iterable<mixed, string> $iterable) : mixed
Parameters
$iterable : iterable<mixed, string>

__unserialize()

public final __unserialize(array<string|int, mixed> $data) : never
Parameters
$data : array<string|int, mixed>
Return values
never

close()

Closes the resource, marking it as unusable.

public close() : void

Whether pending operations are aborted or not is implementation dependent.

isClosed()

Returns whether this resource has been closed.

public isClosed() : bool
Return values
bool

true if closed, otherwise false.

isReadable()

public isReadable() : bool
Return values
bool

A stream may become unreadable if the underlying source is closed or lost.

onClose()

Registers a callback that is invoked when this resource is closed.

public onClose(Closure $onClose) : void
Parameters
$onClose : Closure

read()

Reads data from the stream.

public read([Cancellation|null $cancellation = null ]) : string|null
Parameters
$cancellation : Cancellation|null = null

Cancel the read operation. The state in which the stream will be after a cancelled operation is implementation dependent.

Return values
string|null

Returns a string when new data is available or null if the stream has closed.


        
On this page

Search results