Exemple #1
0
 /**
  * Resolves the value of the Iterator from the callback
  *
  * @return \Iterator
  */
 public function getInnerIterator()
 {
     if (!isset($this->iterator)) {
         $value = $this->callback->exec();
         unset($this->callback);
         if (!$value instanceof \Iterator) {
             $value = new \ArrayIterator((array) $value);
         }
         $this->iterator = $value;
     }
     return $this->iterator;
 }
Exemple #2
0
 /**
  * Restarts the iterator
  *
  * @return NULL
  */
 public function rewind()
 {
     $this->inner->rewind();
     if ((!$this->called || !$this->once) && !$this->inner->valid()) {
         $this->called = TRUE;
         $this->callback->exec();
     }
 }