getIterator(); } $this->_iterator = $iterator; $this->_demuxer = $demuxer; return; } /** * Return the current element. * * @return mixed */ public function current() { if (null !== $this->_current) { return $this->_current; } $demuxer = $this->_demuxer; return $this->_current = $demuxer($this->_iterator->current()); } /** * Return the key of the current element. * * @return mixed */ public function key() { return $this->_iterator->key(); } /** * Move forward to next element. * * @return void */ public function next() { $this->_current = null; return $this->_iterator->next(); } /** * Rewind the iterator to the first element. * * @return void */ public function rewind() { return $this->_iterator->rewind(); } /** * Check if current position is valid. * * @return bool */ public function valid() { return $this->_iterator->valid(); } }