Exemplo n.º 1
0
 public function rewind()
 {
     parent::rewind();
     if ($this->valid()) {
         $this->currentResult = $this->handleItem($this->current());
     }
 }
 public function rewind()
 {
     if ($this->isfirstrun) {
         $this->firstrun();
         $this->isfirstrun = FALSE;
     }
     parent::rewind();
 }
Exemplo n.º 3
0
 public function rewind()
 {
     parent::rewind();
     $this->found = false;
     if (ComparisonHelper::isEquals($this->current(), $this->to)) {
         $this->found = true;
     }
 }
Exemplo n.º 4
0
 /**
  * Rewind iteration
  */
 public function rewind()
 {
     parent::rewind();
     $this->count = 0;
     $this->window = [];
     if (parent::valid()) {
         $this->advanceWindow();
     }
 }
Exemplo n.º 5
0
 /**
  * @param array|\Traversable $iterable
  *
  * @return \Iterator
  */
 private function createIteratorFromIterable($iterable)
 {
     if (is_array($iterable)) {
         return new \ArrayIterator($iterable);
     }
     $iterator = new \IteratorIterator($iterable);
     $iterator->rewind();
     return $iterator;
 }
Exemplo n.º 6
0
 /**
  * Restarts the iterator
  *
  * @return NULL
  */
 public function rewind()
 {
     if (!$this->rewound) {
         $this->rewound = TRUE;
         return parent::rewind();
     } else {
         throw new PHPUnit_Framework_ExpectationFailedException("Iterator has already been rewound");
     }
 }
Exemplo n.º 7
0
 public function rewind()
 {
     parent::rewind();
     $found = false;
     while ($this->valid()) {
         if (ComparisonHelper::isEquals($this->current(), $this->from)) {
             $found = true;
         }
         $this->next();
         if ($found) {
             break;
         }
     }
 }
 /**
  * Get next bunch of validated rows.
  *
  * @return array|null
  */
 public function getNextBunch()
 {
     if (null === $this->_iterator) {
         $this->_iterator = $this->getIterator();
         $this->_iterator->rewind();
     }
     if ($this->_iterator->valid()) {
         $dataRow = $this->_iterator->current();
         $dataRow = Mage::helper('core')->jsonDecode($dataRow[0]);
         $this->_iterator->next();
     } else {
         $this->_iterator = null;
         $dataRow = null;
     }
     return $dataRow;
 }
Exemplo n.º 9
0
 /**
  * Get next bunch of validatetd rows.
  *
  * @return array|null
  */
 public function getNextBunch()
 {
     if (null === $this->_iterator) {
         $this->_iterator = $this->getIterator();
         $this->_iterator->rewind();
     }
     if ($this->_iterator->valid()) {
         $dataRow = $this->_iterator->current();
         $dataRow = unserialize($dataRow[0]);
         $this->_iterator->next();
     } else {
         $this->_iterator = null;
         $dataRow = null;
     }
     return $dataRow;
 }
Exemplo n.º 10
0
 public function rewind()
 {
     parent::rewind();
     $this->key = 0;
 }
Exemplo n.º 11
0
 public function rewind()
 {
     $this->index = 0;
     parent::rewind();
 }
Exemplo n.º 12
0
 public function rewind()
 {
     parent::rewind();
     $this->it2->rewind();
 }
Exemplo n.º 13
0
 public function rewind()
 {
     parent::rewind();
     //need to loop until first match
     $this->movetonextmatch();
 }
Exemplo n.º 14
0
 public function rewind()
 {
     parent::rewind();
     $this->lineNumber = 1;
     $this->columnNumber = 1;
 }
Exemplo n.º 15
0
 function rewind()
 {
     parent::rewind();
     $this->fetch();
 }
Exemplo n.º 16
0
 public function rewind()
 {
     parent::rewind();
     // Skip head.
     $this->next();
 }
 public function rewind()
 {
     $this->stack = array($this->rootNode);
     parent::rewind();
     $this->build();
 }
Exemplo n.º 18
0
 function rewind()
 {
     $this->index = 0;
     return parent::rewind();
 }
 /**
  * Resets the iterator (as required by the Iterator interface).
  *
  * @return bool true, if the iterator rewinds successfully otherwise false
  */
 public function rewind()
 {
     return $this->iterator->rewind();
 }
Exemplo n.º 20
0
 private function initTokenizer()
 {
     $tokens = new \IteratorIterator($this->tokenizer);
     $tokens->rewind();
     $this->tokenIterator = $tokens;
 }
Exemplo n.º 21
0
 public function rewind()
 {
     $this->_progress->update(0);
     return parent::rewind();
 }
Exemplo n.º 22
0
 public function rewind()
 {
     parent::rewind();
     $this->key = $this->start;
 }
Exemplo n.º 23
0
 /**
  * Rewinds iterator.
  */
 public function rewind()
 {
     $this->peek = null;
     $this->data->rewind();
 }
Exemplo n.º 24
0
 /**
  * ( excerpt from http://php.net/manual/en/cachingiterator.rewind.php )
  *
  *
  * @return     mixed   No value is returned.
  */
 function rewind()
 {
     if ($this->fullCacheIterator) {
         $this->fullCacheIterator = new ArrayIterator();
     }
     parent::rewind();
     $this->moveInnerIteratorNext();
 }
Exemplo n.º 25
0
 /**
  * Restarts the iterator
  *
  * @return NULL
  */
 public function rewind()
 {
     $this->dumpStart(__FUNCTION__);
     $result = parent::rewind();
     $this->dumpEnd(__FUNCTION__, $result);
     return $result;
 }
Exemplo n.º 26
0
 public function find($collection, $filters, $fields = null, $sort = null, $start = 0, $limit = 25, $debug = false)
 {
     $collection = $this->db->selectCollection($collection);
     if (isset($filters['id'])) {
         $filters['_id'] = new \MongoDB\BSON\ObjectID($filters['id']);
         unset($filters['id']);
     }
     $query_filters = [];
     if ($filters != null) {
         $query_filters = ['$and' => self::buildFilter($filters)];
     }
     $count = $collection->count($query_filters);
     if ($count > 0) {
         $results = [];
         $options = ['limit' => (int) $limit, 'skip' => (int) $start, 'typeMap' => ['root' => 'array', 'document' => 'array']];
         if ($fields !== null) {
             $projection = [];
             foreach ($fields as $field) {
                 if ($field == 'id') {
                     $field = '_id';
                 }
                 $projection[$field] = true;
             }
             $options['projection'] = $projection;
         }
         if ($sort !== null) {
             foreach ($sort as $sort_key => $sort_dir) {
                 $sort[$sort_key] = $sort_dir == 'desc' ? -1 : 1;
                 if ($sort_key == 'id') {
                     $sort['_id'] = $sort[$sort_key];
                     unset($sort['id']);
                 }
             }
             $options['sort'] = $sort;
         }
         $cursor = $collection->find($query_filters, $options);
         $iterator = new \IteratorIterator($cursor);
         $iterator->rewind();
         while ($doc = $iterator->current()) {
             if (isset($doc['_id'])) {
                 $doc['id'] = (string) $doc['_id'];
                 unset($doc['_id']);
             }
             $results[] = $doc;
             $iterator->next();
         }
         return ['total' => $count, 'data' => $results];
     }
     return ['total' => 0, 'data' => null];
 }
Exemplo n.º 27
0
 public function rewind()
 {
     parent::rewind();
     $this->next();
 }
<?php

$I = new IteratorIterator(new ArrayIterator(array(1, 2, 3)));
$I->rewind();
var_dump($I->current());
$I->next();
var_dump($I->current());
$I->next();
var_dump($I->current());
$I->next();
var_dump($I->current());
Exemplo n.º 29
0
 /**
  * {@inheritdoc}
  */
 public function rewind()
 {
     $this->neighbour->rewind();
     parent::rewind();
 }
Exemplo n.º 30
0
 private function initByteIterator()
 {
     $bytes = new \IteratorIterator($this->bytestream);
     $bytes->rewind();
     $this->byteIterator = $bytes;
 }