| 1 | <?php |
||
| 19 | class MapIterator extends IteratorIterator |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * Function to apply to each iterated element |
||
| 23 | * |
||
| 24 | * @var callable |
||
| 25 | */ |
||
| 26 | private $callable; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * MapIterator constructor. |
||
| 30 | * |
||
| 31 | * @param Traversable $iterator |
||
| 32 | * @param callable $callable |
||
| 33 | */ |
||
| 34 | 4 | public function __construct(Traversable $iterator, callable $callable) |
|
| 39 | |||
| 40 | /** |
||
| 41 | * Get the value of the current element |
||
| 42 | */ |
||
| 43 | 4 | public function current() |
|
| 48 | } |
||
| 49 |