Documentation

StreamCollection
in package
implements Countable, Iterator

Phrity\Net\StreamCollection class.

Table of Contents

Interfaces

Countable
Iterator

Properties

$handler  : mixed
$streams  : mixed

Methods

__construct()  : mixed
Create new stream collection instance.
attach()  : string
Attach stream to collection.
count()  : int
Count contained streams.
current()  : mixed
Return the current stream.
detach()  : bool
Detach stream from collection.
getReadable()  : self
Collect all readable streams into new collection.
getWritable()  : self
Collect all writable streams into new collection.
key()  : scalar|null
Return the key of the current stream.
next()  : void
Move forward to next stream.
rewind()  : void
Rewind the Iterator to the first stream.
valid()  : bool
Checks if current position is valid.
waitRead()  : self
Wait for redable content in stream collection.
createKey()  : string
Create unique key.

Properties

Methods

__construct()

Create new stream collection instance.

public __construct() : mixed

attach()

Attach stream to collection.

public attach(Stream $attach[, string|null $key = null ]) : string
Parameters
$attach : Stream

Stream to attach.

$key : string|null = null

Definable name of stream.

Tags
throws
StreamException

If already attached.

Return values
string

Name of stream.

count()

Count contained streams.

public count() : int
Return values
int

Number of streams in collection.

current()

Return the current stream.

public current() : mixed
Return values
mixed

Current stream.

detach()

Detach stream from collection.

public detach(Stream|string $detach) : bool
Parameters
$detach : Stream|string

Stream or name of stream to detach.

Return values
bool

If a stream was detached.

getReadable()

Collect all readable streams into new collection.

public getReadable() : self
Return values
self

New collection instance.

getWritable()

Collect all writable streams into new collection.

public getWritable() : self
Return values
self

New collection instance.

key()

Return the key of the current stream.

public key() : scalar|null
Return values
scalar|null

Current key.

rewind()

Rewind the Iterator to the first stream.

public rewind() : void

valid()

Checks if current position is valid.

public valid() : bool
Return values
bool

True if valid.

waitRead()

Wait for redable content in stream collection.

public waitRead([int $seconds = 60 ]) : self
Parameters
$seconds : int = 60

Timeout in seconds.

Tags
throws
StreamException

If fails to select.

Return values
self

New collection instance.

createKey()

Create unique key.

protected createKey() : string
Return values
string

Unique key.


        
On this page

Search results