|
MediaWiki master
|
Convenience class for generating iterators from iterators. More...
Inherits FilterIterator.

Public Member Functions | |
| __construct ( $iter, $vCallback, array $options=[]) | |
| Build a 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 () | |
Protected Member Functions | |
| init () | |
| Obviate the usual need for rewind() before using a FilterIterator in a manual loop. | |
Protected Attributes | |
| callable null | $aCallback |
| array | $cache = [] |
| bool | $rewound = false |
| whether rewind() has been called | |
| callable | $vCallback |
Convenience class for generating iterators from iterators.
Definition at line 21 of file MappedIterator.php.
| Wikimedia\Iterators\MappedIterator::__construct | ( | $iter, | |
| $vCallback, | |||
| array | $options = [] ) |
Build a 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).
| Iterator | array | $iter | |
| callable | $vCallback | Value transformation callback |
| array | $options | Options map (includes "accept") (since 1.22) |
| UnexpectedValueException |
Definition at line 48 of file MappedIterator.php.
References Wikimedia\Iterators\MappedIterator\$vCallback.
| Wikimedia\Iterators\MappedIterator::accept | ( | ) |
Definition at line 72 of file MappedIterator.php.
| Wikimedia\Iterators\MappedIterator::current | ( | ) |
Definition at line 100 of file MappedIterator.php.
|
protected |
Obviate the usual need for rewind() before using a FilterIterator in a manual loop.
Definition at line 112 of file MappedIterator.php.
| Wikimedia\Iterators\MappedIterator::key | ( | ) |
Definition at line 86 of file MappedIterator.php.
| Wikimedia\Iterators\MappedIterator::next | ( | ) |
Definition at line 61 of file MappedIterator.php.
| Wikimedia\Iterators\MappedIterator::rewind | ( | ) |
Definition at line 66 of file MappedIterator.php.
| Wikimedia\Iterators\MappedIterator::valid | ( | ) |
Definition at line 92 of file MappedIterator.php.
|
protected |
Definition at line 25 of file MappedIterator.php.
|
protected |
Definition at line 27 of file MappedIterator.php.
|
protected |
whether rewind() has been called
Definition at line 30 of file MappedIterator.php.
|
protected |
Definition at line 23 of file MappedIterator.php.
Referenced by Wikimedia\Iterators\MappedIterator\__construct().