/**
  * Rewind the Iterator to the first element.
  *
  * @link  http://php.net/manual/en/iterator.rewind.php
  * @since 5.0.0
  */
 public function rewind()
 {
     if (null === $this->iterator) {
         throw new \LogicException('Missing internal iterator.');
     }
     $this->iterator->rewind();
 }
 public function rewind()
 {
     $this->projectionNeeded = true;
     unset($this->current);
     unset($this->currentKey);
     $this->innerIterator->rewind();
 }
 public function rewind()
 {
     $this->it->rewind();
     $this->buffer = array();
     $this->i = 0;
     $this->fetch();
 }
 /**
  * {@inheritdoc}
  */
 public final function rewind()
 {
     if (null === $this->iterator) {
         throw new \LogicException('Internal iterator is missing.');
     }
     $this->iterator->rewind();
 }
示例#5
0
 /**
  * {@inheritdoc}
  * @see IteratorIterator::rewind()
  */
 public function rewind()
 {
     $this->iterator->rewind();
     if (!$this->accept()) {
         $this->next();
     }
 }
 /**
  * {@inheritdoc}
  */
 public function rewind()
 {
     if (!$this->iterator) {
         $this->initIterator();
     }
     $this->iterator->rewind();
 }
示例#7
0
 /**
  * {@inheritdoc}
  */
 public function rewind()
 {
     if (!$this->iterableResult) {
         $this->iterableResult = new \ArrayIterator($this->getDataFromService());
     }
     $this->iterableResult->rewind();
 }
示例#8
0
 public function rewind()
 {
     $this->groups = Ginq::from($this->it)->toLookup($this->groupingKeySelector, $this->elementSelector, $this->eqComparer)->getIterator();
     $this->groups->rewind();
     if ($this->valid()) {
         $this->fetch();
     }
 }
示例#9
0
 /**
  * @param \Iterator $iterator
  */
 private function initialize(\Iterator $iterator)
 {
     if ($this->innerIterator === null && $this->cache === null) {
         $this->cache = array();
         $this->innerIterator = $iterator;
         $this->innerIterator->rewind();
     }
 }
 /**
  * Initializes the iterator
  */
 protected function initializeIterator()
 {
     $this->iterator = $this->createIterator();
     if ($this->batchMode) {
         $this->iterator = new \ArrayIterator(array(iterator_to_array($this->iterator)));
     }
     $this->iterator->rewind();
 }
示例#11
0
 public function rewind()
 {
     $this->it->rewind();
     if ($this->it->valid()) {
         $this->seen = new Set($this->eqComparer);
         $this->fetch();
     }
 }
示例#12
0
 public function rewind()
 {
     $this->_lines->rewind();
     $this->_key = -1;
     $this->_current = NULL;
     $this->_buffer = $this->_lines->current();
     $this->next();
 }
示例#13
0
 public function rewind()
 {
     $this->i = 0;
     if (!$this->rewinded) {
         $this->it->rewind();
         $this->memo();
         $this->rewinded = true;
     }
 }
示例#14
0
 public function rewind()
 {
     if ($this->continue) {
         $this->continue = false;
         return;
     }
     $this->iterator->rewind();
     $this->stack->push($this->iterator->current());
 }
示例#15
0
 /**
  * {@inheritdoc}
  */
 public function rewind()
 {
     if (!$this->iterableResult) {
         $this->iterableResult = new \SimpleXMLIterator(file_get_contents($this->filename));
         if ($this->xpath) {
             $this->iterableResult = new \ArrayIterator($this->iterableResult->xpath($this->xpath));
         }
     }
     $this->iterableResult->rewind();
 }
示例#16
0
 public function rewind()
 {
     $this->i = 0;
     $this->it0->rewind();
     $this->it1->rewind();
     if ($this->it0->valid()) {
         $this->it = $this->it0;
     } else {
         $this->it = $this->it1;
     }
 }
 public function rewind()
 {
     $this->it1->rewind();
     $this->it2->rewind();
     $this->currentIt = $this->it1;
     $this->state = 1;
     if (!$this->currentIt->valid()) {
         $this->currentIt = $this->it2;
         $this->state = 2;
     }
 }
示例#18
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;
         }
     }
 }
示例#19
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;
         }
     }
 }
示例#20
0
 /**
  * @inheritdoc
  */
 public function rewind()
 {
     $this->iterator->rewind();
     if ($this->iterator->valid()) {
         $this->previousKey = $this->iterator->key();
         $this->previousToken = $this->iterator->current();
         $this->previousValid = $this->iterator->valid();
         $this->previousLine = $this->tokenStream->getLine();
         $this->previousColumn = $this->tokenStream->getColumn();
         // iterate to second element
         $this->iterator->next();
     }
 }
示例#21
0
 public function promise()
 {
     if ($this->aggregate) {
         return $this->aggregate;
     }
     try {
         $this->createPromise();
         $this->iterable->rewind();
         $this->refillPending();
     } catch (\Exception $e) {
         $this->aggregate->reject($e);
     }
     return $this->aggregate;
 }
 /**
  * {@inheritdoc}
  */
 public function rewind()
 {
     $xls = $this->getExcelObject();
     $this->worksheetIterator = new \CallbackFilterIterator(new \ArrayIterator($xls->getWorksheets()), function ($title, $key) use($xls) {
         return $this->isReadableWorksheet($title);
         return false;
     });
     $this->worksheetIterator->rewind();
     if ($this->worksheetIterator->valid()) {
         $this->initializeValuesIterator();
     } else {
         $this->valuesIterator = null;
     }
 }
	public function valid(){
		while($this->innerIterator->valid() === true){
			if ($this->projectionNeeded === true){
				$this->project();
				$this->currentIterator->rewind();
			}
			if ($this->currentIterator->valid() === true){
				return true;
			} else {
				$this->innerIterator->next();
				$this->projectionNeeded = true;
			}
		}
		return false;
	}
示例#24
0
 /**
  * Restarts the iterator
  *
  * @return NULL
  */
 public function rewind()
 {
     if (!isset($this->iterator)) {
         $this->getInnerIterator();
     }
     $this->iterator->rewind();
 }
示例#25
0
 public function rewind()
 {
     $this->queryPathList = $this->parse($this->query);
     $this->iterator = new PreOrderIterator($this->node);
     $this->iterator->rewind();
     $this->next();
 }
示例#26
0
 /**
  * Fetches the next batch of data.
  * @return array the data fetched
  */
 protected function fetchData()
 {
     if ($this->_iterator === null) {
         if (empty($this->query->orderBy)) {
             // setting cursor batch size may setup implicit limit on the query with 'sort'
             // @see https://jira.mongodb.org/browse/PHP-457
             $this->query->addOptions(['batchSize' => $this->batchSize]);
         }
         $cursor = $this->query->buildCursor($this->db);
         $token = 'fetch cursor id = ' . $cursor->getId();
         Yii::info($token, __METHOD__);
         if ($cursor instanceof \Iterator) {
             $this->_iterator = $cursor;
         } else {
             $this->_iterator = new \IteratorIterator($cursor);
         }
         $this->_iterator->rewind();
     }
     $rows = [];
     $count = 0;
     while ($count++ < $this->batchSize) {
         $row = $this->_iterator->current();
         if ($row === null) {
             break;
         }
         $this->_iterator->next();
         //var_dump($row);
         $rows[] = $row;
     }
     return $this->query->populate($rows);
 }
 public function rewind()
 {
     $this->currentRequest = null;
     if (!$this->commands instanceof \Generator) {
         $this->commands->rewind();
     }
 }
示例#28
0
 /**
  * @inheritDoc
  */
 public function rewind()
 {
     $this->it->rewind();
     $this->skipped = 0;
     $this->token = 0;
     $this->acceptValidated = false;
 }
 /**
  * @param \Iterator $operatorChain
  * @param \Iterator $input
  *
  * @return \ArrayIterator
  */
 private function solveIntermediateOperationChain(\Iterator $operatorChain, \Iterator $input)
 {
     $results = new \ArrayIterator();
     $input->rewind();
     $continueWIthNextItem = true;
     while ($input->valid() && $continueWIthNextItem) {
         $result = $input->current();
         $useResult = true;
         // do the whole intermediate operation chain for the current input
         $operatorChain->rewind();
         while ($operatorChain->valid() && $useResult) {
             /** @var IntermediateOperationInterface $current */
             $current = $operatorChain->current();
             // apply intermediate operations
             $result = $current->apply($result, $input->key(), $useResult, $returnedCanContinue);
             // track the continuation flags
             $continueWIthNextItem = $continueWIthNextItem && $returnedCanContinue;
             // iterate
             $operatorChain->next();
         }
         if ($useResult) {
             $results->append($result);
         }
         // goto next item
         $input->next();
     }
     return $results;
 }
示例#30
0
 /**
  * Synchronizes the $className objects from the source system to the destination system.
  *
  * @param string $className
  * @param bool $force
  */
 public function synchronize($className, $force)
 {
     $this->logger->notice('Start of ' . ($force ? 'forced ' : '') . 'synchronization for {className}.', array('className' => $className));
     $this->className = $className;
     $this->mapper->setForce($force);
     $this->sourceQueue = $this->source->getObjectsOrderedById();
     $this->sourceQueue->rewind();
     $this->destinationQueue = $this->destination->getObjectsOrderedById($className);
     $this->destinationQueue->rewind();
     while ($this->sourceQueue->valid() && $this->destinationQueue->valid()) {
         $this->compareQueuesAndReactAccordingly();
     }
     $this->insertRemainingSourceObjects();
     $this->deleteRemainingDestinationObjects();
     $this->destination->commit();
     $this->logger->notice('End of synchronization for {className}.', array('className' => $className));
 }