MediaWiki  REL1_22
MappedIterator Class Reference

Convenience class for generating iterators from iterators. More...

Collaboration diagram for MappedIterator:

List of all members.

Public Member Functions

 __construct ($iter, $vCallback, array $options=array())
 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 ()

Protected Member Functions

 init ()
 Obviate the usual need for rewind() before using a FilterIterator in a manual loop.

Protected Attributes

callable $aCallback
 *
array $cache = array()
 *
 $rewound = false
callable $vCallback
 *

Detailed Description

Convenience class for generating iterators from iterators.

Since:
1.21

Definition at line 29 of file MappedIterator.php.


Constructor & Destructor Documentation

MappedIterator::__construct ( iter,
vCallback,
array options = array() 
)

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$vCallbackValue transformation callback
array$optionsOptions map (includes "accept") (since 1.22)
Exceptions:
MWException

Definition at line 51 of file MappedIterator.php.


Member Function Documentation

Definition at line 75 of file MappedIterator.php.

Definition at line 94 of file MappedIterator.php.

MappedIterator::init ( ) [protected]

Obviate the usual need for rewind() before using a FilterIterator in a manual loop.

Definition at line 106 of file MappedIterator.php.

Definition at line 84 of file MappedIterator.php.

Definition at line 64 of file MappedIterator.php.

Definition at line 69 of file MappedIterator.php.

Definition at line 89 of file MappedIterator.php.


Member Data Documentation

callable MappedIterator::$aCallback [protected]

*

Definition at line 31 of file MappedIterator.php.

array MappedIterator::$cache = array() [protected]

*

Definition at line 32 of file MappedIterator.php.

MappedIterator::$rewound = false [protected]

Definition at line 34 of file MappedIterator.php.

callable MappedIterator::$vCallback [protected]

*

Definition at line 30 of file MappedIterator.php.


The documentation for this class was generated from the following file: