| 1 | <?php |
||
| 25 | class MapIterator extends IteratorIterator |
||
| 26 | { |
||
| 27 | /** |
||
| 28 | * The function to be apply on all InnerIterator element |
||
| 29 | * |
||
| 30 | * @var callable |
||
| 31 | */ |
||
| 32 | private $callable; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Create a map iterator from another iterator |
||
| 36 | * |
||
| 37 | * @param Iterator $iterator the iterator to run through the callable function |
||
| 38 | * @param callable $callable callable to run for each element in the Iterator |
||
| 39 | */ |
||
| 40 | public function __construct(Iterator $iterator, callable $callable) |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Get the value of the current element |
||
| 48 | */ |
||
| 49 | public function current() |
||
| 55 | } |
||
| 56 |