public function next()
 {
     parent::next();
     if ($this->valid()) {
         $this->currentResult = $this->handleItem($this->current());
     }
 }
 /**
  * @inheritDoc
  */
 public function current()
 {
     if (empty($this->_headers)) {
         $this->_headers = parent::current();
         parent::next();
     }
     return array_combine($this->_headers, parent::current());
 }
 public function next()
 {
     if ($this->isfirstrun) {
         $this->firstrun();
         $this->isfirstrun = FALSE;
     }
     parent::next();
 }
示例#4
0
 public function next()
 {
     $this->chunk = array();
     for ($i = 0; $i < $this->chunkSize && parent::valid(); $i++) {
         $this->chunk[] = parent::current();
         parent::next();
     }
 }
示例#5
0
 /**
  * {@inheritdoc}
  */
 public function next()
 {
     $this->neighbour->next();
     if (!$this->neighbour->valid()) {
         $this->neighbour->rewind();
         parent::next();
     }
 }
示例#6
0
 public function next()
 {
     $this->chunk = array();
     for ($i = 0; $i < $this->size && parent::valid(); ++$i) {
         $this->chunk[] = parent::current();
         parent::next();
     }
     $this->chunk ? $this->key++ : null;
 }
示例#7
0
 /**
  * @param \nochso\WriteMe\Document $document
  *
  * @return \SplFileInfo
  */
 private function findChangelog(Document $document)
 {
     $changelogName = $this->options->getValue('changelog.file');
     $searchDepth = $this->options->getValue('changelog.search-depth');
     $folder = dirname($document->getFilepath());
     $files = new \IteratorIterator(Finder::findFiles($changelogName)->from($folder)->limitDepth($searchDepth));
     $files->next();
     if (!$files->valid()) {
         throw new \RuntimeException(sprintf("Unable to find changelog '%s' in folder '%s'", $changelogName, $folder));
     }
     return $files->current();
 }
示例#8
0
 /**
  * Returns next entity.
  *
  * @return Entity|null
  */
 public function next()
 {
     if (null !== $this->peek) {
         $entity = $this->peek;
         $this->peek = null;
         return $entity;
     }
     $item = $this->data->current();
     if (null === $item) {
         return null;
     }
     $this->data->next();
     return new Entity($item, $this->accessor, $this->options['mapping'], $this->options['id_path']);
 }
示例#9
0
 public function next()
 {
     parent::next();
     // Scroll to the end...
     if ($this->found) {
         while ($this->valid()) {
             parent::next();
         }
         return;
     }
     if (ComparisonHelper::isEquals($this->current(), $this->to)) {
         $this->found = true;
     }
 }
 /**
  * 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;
 }
示例#11
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;
 }
 public function next()
 {
     if ($this->valid()) {
         $token = $this->current();
         if ($token->isGivenKind([T_WHITESPACE, T_OPEN_TAG, T_COMMENT, T_DOC_COMMENT]) && ($n = strpos($token->getContent(), "\n")) !== false) {
             $this->lineNumber += mb_substr_count($token->getContent(), "\n");
             $this->columnNumber = mb_strlen(substr($token->getContent(), $n + 1));
             if ($this->columnNumber === 0) {
                 $this->columnNumber = 1;
             }
         } else {
             $this->columnNumber += mb_strlen($token->getContent());
         }
     }
     parent::next();
 }
示例#13
0
 public function next()
 {
     parent::next();
     $this->movetonextmatch();
 }
示例#14
0
 function next()
 {
     ++$this->index;
     return parent::next();
 }
 public function next()
 {
     $this->_progress->next();
     return parent::next();
 }
示例#16
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];
 }
示例#17
0
 public function next()
 {
     parent::next();
     ++$this->key;
 }
示例#18
0
 public function next()
 {
     ++$this->key;
     parent::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());
示例#20
0
 public function next()
 {
     echo $this->key . ') ' . __METHOD__ . PHP_EOL;
     ++$this->key;
     parent::next();
 }
示例#21
0
 public function next()
 {
     parent::next();
     $this->it2->next();
 }
示例#22
0
 function next()
 {
     parent::next();
     $this->fetch();
 }
$SELECT = 'SELECT val, grp FROM test';
class Test
{
    function __construct($name = 'N/A')
    {
        echo __METHOD__ . "({$name})\n";
    }
}
$stmt = $db->query($SELECT, PDO::FETCH_CLASS, 'Test', array('WOW'));
$it = new IteratorIterator($stmt);
/* check if we can convert that thing */
/*** HINT: If YOU plan to do so remember not to call rewind() -> see below ***/
foreach ($it as $data) {
    var_dump($data);
}
$it->next();
/* must be allowed */
var_dump($it->current());
/* must return NULL */
var_dump($it->valid());
/* must return false */
class PDOStatementAggregate extends PDOStatement implements IteratorAggregate
{
    private function __construct()
    {
        echo __METHOD__ . "\n";
        $this->setFetchMode(PDO::FETCH_NUM);
        /* default fetch mode is BOTH, so we see if the ctor can overwrite that */
    }
    function getIterator()
    {
 /**
  * We need to clear identity map before navigating to next record.
  */
 public function next()
 {
     $this->manager->clear();
     parent::next();
 }
示例#25
0
 /**
  * Move to next element
  */
 public function next()
 {
     parent::next();
     ++$this->count;
     if (parent::valid()) {
         $this->advanceWindow();
     }
 }
 /**
  * Moves to the next element in the iterator (as required by the Iterator interface).
  */
 public function next()
 {
     return $this->iterator->next();
 }
示例#27
0
 public function next()
 {
     $this->index++;
     parent::next();
 }
 public function next()
 {
     parent::next();
     $this->lastDepth = $this->depth;
     $this->lastNode = $this->node;
     $this->build();
 }
示例#29
0
 /**
  * Increments the iterator to the next value
  *
  * @return NULL
  */
 public function next()
 {
     $this->dumpStart(__FUNCTION__);
     $result = parent::next();
     $this->dumpEnd(__FUNCTION__, $result);
     return $result;
 }