baseIterator = new ArrayIterator( $iter ); } elseif ( $iter instanceof Iterator ) { $this->baseIterator = $iter; } else { throw new MWException( "Invalid base iterator provided." ); } $this->vCallback = $vCallback; } /** * @return void */ public function rewind() { $this->baseIterator->rewind(); } /** * @return Mixed|null Returns null if out of range */ public function current() { if ( !$this->baseIterator->valid() ) { return null; // out of range } return call_user_func_array( $this->vCallback, array( $this->baseIterator->current() ) ); } /** * @return Mixed|null Returns null if out of range */ public function key() { if ( !$this->baseIterator->valid() ) { return null; // out of range } return $this->baseIterator->key(); } /** * @return void */ public function next() { $this->baseIterator->next(); } /** * @return bool */ public function valid() { return $this->baseIterator->valid(); } }