Пример #1
0
 /**
  * Lazily append the next iterator to the chain
  */
 private function lazyAppend()
 {
     if (!parent::valid() and $this->iterators->valid()) {
         $this->append($this->iterators->current());
         $this->iterators->next();
     }
 }
Пример #2
0
 public function next()
 {
     $this->it->next();
     if ($this->currentLen !== 0) {
         --$this->currentLen;
     }
 }
Пример #3
0
 /**
  * @param ObserverInterface $observer
  * @param SchedulerInterface|null $scheduler
  * @return \Rx\Disposable\CompositeDisposable|\Rx\DisposableInterface
  */
 public function subscribe(ObserverInterface $observer, SchedulerInterface $scheduler = null)
 {
     $scheduler = $scheduler ?: new ImmediateScheduler();
     $key = 0;
     return $scheduler->scheduleRecursive(function ($reschedule) use(&$observer, &$key) {
         try {
             //HHVM requires you to call next() before current()
             if (defined('HHVM_VERSION')) {
                 $this->items->next();
                 $key = $this->items->key();
             }
             if (null === $key) {
                 $observer->onCompleted();
                 return;
             }
             $current = $this->items->current();
             $observer->onNext($current);
             if (!defined('HHVM_VERSION')) {
                 $this->items->next();
                 $key = $this->items->key();
             }
             $reschedule();
         } catch (\Exception $e) {
             $observer->onError($e);
         }
     });
 }
Пример #4
0
 public function next()
 {
     if (!$this->usingCache) {
         $this->innerIterator->next();
     }
     ++$this->position;
 }
Пример #5
0
 public function next()
 {
     $this->i++;
     if ($this->valid()) {
         $this->it->next();
     }
 }
Пример #6
0
 public function next()
 {
     $this->projectionNeeded = true;
     unset($this->current);
     unset($this->currentKey);
     return $this->innerIterator->next();
 }
Пример #7
0
 public function next()
 {
     parent::next();
     if (!parent::valid()) {
         $this->source->next();
     }
 }
Пример #8
0
 public function next()
 {
     while (true) {
         $this->it->next();
         if ($this->it->valid()) {
             if ($this->fetch()) {
                 break;
             }
         } else {
             if ($this->it === $this->it0) {
                 $this->it = $this->it1;
                 $this->it->rewind();
                 if ($this->it->valid()) {
                     if ($this->fetch()) {
                         break;
                     }
                 } else {
                     break;
                 }
             } else {
                 break;
             }
         }
     }
 }
Пример #9
0
 /**
  * {@inheritdoc}
  */
 public function next()
 {
     $this->neighbour->next();
     if (!$this->neighbour->valid()) {
         $this->neighbour->rewind();
         parent::next();
     }
 }
Пример #10
0
 public function next()
 {
     $this->currentIt->next();
     if ($this->state === 1 && !$this->currentIt->valid()) {
         $this->currentIt = $this->it2;
         $this->state = 2;
     }
 }
Пример #11
0
 public function next()
 {
     $this->i++;
     if ($this->cacheSize == $this->i) {
         $this->it->next();
         $this->memo();
     }
 }
Пример #12
0
 public function next()
 {
     $this->i++;
     $this->it->next();
     if ($this->it === $this->it0 && !$this->it->valid()) {
         $this->it = $this->it1;
     }
 }
 public function next()
 {
     $this->points->next();
     if (!$this->points->valid()) {
         $this->series->next();
         $serie = $this->series->current();
         $this->points = new \ArrayIterator($serie ? $serie['values'] : []);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function next()
 {
     $this->key++;
     $this->getCurrentIterator()->next();
     if (!$this->currentIterator->valid()) {
         $this->mainIterator->next();
         $this->currentIterator = $this->mainIterator->current();
     }
 }
Пример #15
0
 public function next()
 {
     $this->i++;
     $this->it->next();
     $v = $this->it->valid();
     if (!$v) {
         $this->it->rewind();
     }
 }
Пример #16
0
 public function next()
 {
     $this->inner->next();
     if (!$this->inner->valid()) {
         $this->outer->next();
         $this->fetchOuter();
     }
     $this->fetchInner();
 }
 public function fetch($fetchMode = null)
 {
     if (!$this->currentIterator) {
         $this->currentIterator = $this->getIterator();
     }
     $data = $this->currentIterator->current();
     $this->currentIterator->next();
     return $data;
 }
Пример #18
0
 public function next()
 {
     if ($this->skipNext === true) {
         $this->skipNext = false;
         return;
     }
     $this->iterator->next();
     $this->stack->push($this->iterator->current());
 }
Пример #19
0
 /**
  * @param $limit
  * @return Resource[]
  */
 public function collect($limit = -1)
 {
     $resources = array();
     while ($limit && $this->iterator->valid()) {
         $resources[] = $this->iterator->current();
         $this->iterator->next();
         $limit--;
     }
     return $resources;
 }
Пример #20
0
 /**
  * @return string
  */
 public function dir_readdir()
 {
     if ($this->iterator->valid()) {
         $result = $this->iterator->current();
         $this->iterator->next();
         return $result;
     } else {
         return false;
     }
 }
 /**
  * {@inheritdoc}
  */
 public function next()
 {
     if ($this->subIterate && $this->subIterate->valid()) {
         $this->subIterate->next();
     }
     if (!$this->subIterate->valid()) {
         $this->toIterate->next();
         $this->initializeSubIterate();
     }
     ++$this->position;
 }
Пример #22
0
 public function rewind()
 {
     $this->i = 0;
     $this->it->rewind();
     for ($j = 0; $j < $this->n; $j++) {
         if ($this->it->valid()) {
             $this->it->next();
         } else {
             break;
         }
     }
 }
Пример #23
0
 public function rewind()
 {
     $this->i = 0;
     $this->it->rewind();
     while ($this->it->valid()) {
         if ($this->predicate->predicate($this->it->current(), $this->it->key())) {
             $this->it->next();
         } else {
             break;
         }
     }
 }
Пример #24
0
 public function next()
 {
     $this->inner->next();
     while (!$this->inner->valid()) {
         $this->outer->next();
         $this->fetchOuter();
         if ($this->inner === null) {
             break;
         }
     }
     $this->fetchInner();
 }
Пример #25
0
 public function next()
 {
     while (true) {
         $this->it->next();
         if ($this->it->valid()) {
             if ($this->fetch()) {
                 break;
             }
         } else {
             break;
         }
     }
 }
Пример #26
0
 /**
  * @inheritdoc
  */
 public function current()
 {
     $current = $this->delegatorReader->current();
     if (!$current) {
         $this->iterator->next();
         if (!$this->iterator->valid()) {
             return false;
         }
         $resource = $this->convertResource($this->resource, $this->iterator->current());
         $this->delegatorReader->open($resource);
         return $this->current();
     }
     return $current;
 }
Пример #27
0
 /**
  * @return Generator
  */
 private function iterateAndCache()
 {
     foreach ($this->cache as $key => $value) {
         (yield $key => $value);
     }
     if ($this->innerIterator !== null) {
         while ($this->innerIterator->valid()) {
             $this->cache[$this->innerIterator->key()] = $this->innerIterator->current();
             (yield $this->innerIterator->key() => $this->innerIterator->current());
             $this->innerIterator->next();
         }
         $this->innerIterator = null;
     }
 }
Пример #28
0
 /**
  * (PHP 5 &gt;= 5.0.0)<br/>
  * Return the current element
  * @link http://php.net/manual/en/iterator.current.php
  * @return array Can return any type.
  */
 public function current()
 {
     if ($this->currentGroup == null) {
         $left = $this->groupSize;
         $this->currentGroup = array();
         while ($this->innerIterator->valid()) {
             if ($left-- <= 0) {
                 break;
             }
             $this->currentGroup[] = $this->innerIterator->current();
             $this->innerIterator->next();
         }
     }
     return $this->currentGroup;
 }
 public function read()
 {
     if (!isset($this->iterator)) {
         $this->initializeIterator();
     }
     if (!$this->iterator->valid()) {
         return null;
     }
     $current = $this->iterator->current();
     if ($this->stepExecution) {
         $this->stepExecution->incrementSummaryInfo('read');
     }
     $this->iterator->next();
     return $current;
 }
 public function read()
 {
     if (!isset($this->iterator)) {
         $this->initializeIterator();
     }
     if (!$this->iterator->valid()) {
         return null;
     }
     $current = $this->iterator->current();
     if ($this->stepExecution) {
         $this->stepExecution->incrementSummaryInfo('read');
     }
     $this->iterator->next();
     return $this->convertNumericIdentifierToString($current);
 }