.. $iterator->next(); } With Pinq extension: $iterator->rewind(); while (list($key, $value) = $iterator->fetch()) { ... } Or with value by reference: $iterator->rewind(); while ($element = $iterator->fetch()) { $key = $element[0]; $value =& $element[1]; ... } Iterators can implement this interface while maintaining compatibility with the native API.
Author: Elliot Levin (elliotlevin@hotmail.com)
Inheritance: extends Iterator, extends Pinq\Iterators\IIterator
Example #1
0
 public function __construct(IIterator $values = null)
 {
     if ($values !== null) {
         $values->rewind();
         while ($element = $values->fetch()) {
             $this->addRef($element[1]);
         }
     }
 }
Example #2
0
 protected function doFetch()
 {
     while ((list($innerKey, $innerValue) = $this->innerValuesIterator->fetch()) === null) {
         if ((list($this->outerKey, $this->outerValue) = $this->outerIterator->fetch()) === null) {
             return null;
         }
         $this->innerValuesIterator = $this->getInnerValuesIterator($this->outerKey, $this->outerValue);
         $this->innerValuesIterator->rewind();
     }
     $projectionFunction = $this->projectionFunction;
     return [$this->count++, $projectionFunction($this->outerValue, $innerValue, $this->outerKey, $innerKey)];
 }
Example #3
0
 protected function doRewind()
 {
     $this->iterator->rewind();
 }