Demultiplexer
in package
implements
Iterator
Class \Hoa\Iterator\Demultiplexer.
Demux result from another iterator. This iterator is somehow the opposite of the Hoa\Iterator\Multiple iterator.
Tags
Table of Contents
Interfaces
- Iterator
- Interface \Hoa\Iterator.
Properties
- $_current : mixed
- Current computed value.
- $_demuxer : callable
- Demuxer (callable to execute each time).
- $_iterator : Traversable
- Current iterator.
Methods
- __construct() : mixed
- Constructor.
- current() : mixed
- Return the current element.
- key() : mixed
- Return the key of the current element.
- next() : void
- Move forward to next element.
- rewind() : void
- Rewind the iterator to the first element.
- valid() : bool
- Check if current position is valid.
Properties
$_current
Current computed value.
protected
mixed
$_current
= null
$_demuxer
Demuxer (callable to execute each time).
protected
callable
$_demuxer
= null
$_iterator
Current iterator.
protected
Traversable
$_iterator
= null
Methods
__construct()
Constructor.
public
__construct(Traversable $iterator, callable $demuxer) : mixed
Parameters
- $iterator : Traversable
-
Iterator.
- $demuxer : callable
-
Demuxer.
Tags
current()
Return the current element.
public
current() : mixed
key()
Return the key of the current element.
public
key() : mixed
next()
Move forward to next element.
public
next() : void
rewind()
Rewind the iterator to the first element.
public
rewind() : void
valid()
Check if current position is valid.
public
valid() : bool