1 | <?php |
||
10 | class MapIterator implements Iterator { |
||
11 | |||
12 | /** |
||
13 | * @var Iterator |
||
14 | */ |
||
15 | protected $iterator; |
||
16 | |||
17 | /** |
||
18 | * @var callable Modifies the current item in iterator |
||
19 | */ |
||
20 | protected $callable; |
||
21 | |||
22 | /** |
||
23 | * @param $iterator Iterator|array |
||
24 | * @param $callable callable This can have two parameters |
||
25 | * @throws TDBMException |
||
26 | */ |
||
27 | public function __construct($iterator, callable $callable) { |
||
53 | |||
54 | /** |
||
55 | * Alters the current item with $this->callable and returns a new item. |
||
56 | * Be careful with your types as we can't do static type checking here! |
||
57 | * @return mixed |
||
58 | */ |
||
59 | public function current() |
||
64 | |||
65 | public function next() |
||
69 | |||
70 | public function key() |
||
74 | |||
75 | public function valid() |
||
79 | |||
80 | public function rewind() |
||
84 | |||
85 | /** |
||
86 | * Casts the iterator to a PHP array. |
||
87 | * |
||
88 | * @return array |
||
89 | */ |
||
90 | public function toArray() { |
||
93 | } |
||
94 |