Convenience class for generating iterators from iterators.
More...
|
| __construct ( $iter, $vCallback, array $options=[]) |
| Build an new iterator from a base iterator by having the former wrap the later, returning the result of "value" callback for each current() invocation.
|
|
| accept () |
|
| current () |
|
| key () |
|
| next () |
|
| rewind () |
|
| valid () |
|
|
| init () |
| Obviate the usual need for rewind() before using a FilterIterator in a manual loop.
|
|
Convenience class for generating iterators from iterators.
- Since
- 1.21
Definition at line 28 of file MappedIterator.php.
◆ __construct()
MappedIterator::__construct |
( |
| $iter, |
|
|
| $vCallback, |
|
|
array | $options = [] ) |
Build an new iterator from a base iterator by having the former wrap the later, returning the result of "value" callback for each current() invocation.
The callback takes the result of current() on the base iterator as an argument. The keys of the base iterator are reused verbatim.
An "accept" callback can also be provided which will be called for each value in the base iterator (post-callback) and will return true if that value should be included in iteration of the MappedIterator (otherwise it will be filtered out).
- Parameters
-
Iterator | array | $iter | |
callable | $vCallback | Value transformation callback |
array | $options | Options map (includes "accept") (since 1.22) |
- Exceptions
-
Definition at line 54 of file MappedIterator.php.
References $vCallback.
◆ accept()
MappedIterator::accept |
( |
| ) |
|
◆ current()
MappedIterator::current |
( |
| ) |
|
◆ init()
◆ key()
◆ next()
◆ rewind()
MappedIterator::rewind |
( |
| ) |
|
◆ valid()
MappedIterator::valid |
( |
| ) |
|
◆ $aCallback
callable null MappedIterator::$aCallback |
|
protected |
◆ $cache
array MappedIterator::$cache = [] |
|
protected |
◆ $rewound
MappedIterator::$rewound = false |
|
protected |
◆ $vCallback
callable MappedIterator::$vCallback |
|
protected |
The documentation for this class was generated from the following file: