iterator = new IteratorIterator($traversable); $this->callback = $callback; } /** * @see http://php.net/iterator.current * @return mixed */ public function current() { return ($this->callback)($this->iterator->current()); } /** * @see http://php.net/iterator.key * @return mixed */ public function key() { return $this->iterator->key(); } /** * @see http://php.net/iterator.next * @return void */ public function next() { $this->iterator->next(); } /** * @see http://php.net/iterator.rewind * @return void */ public function rewind() { $this->iterator->rewind(); } /** * @see http://php.net/iterator.valid * @return boolean */ public function valid() { return $this->iterator->valid(); } }