コード例 #1
0
ファイル: Scanner.php プロジェクト: KhaosLibrary/Console
 /**
  * Fetch Next Token
  *
  * @return Token
  */
 public function pop()
 {
     if ($token = $this->peeked) {
         $this->peeked = null;
         return $token;
     }
     $token = $this->generator->current();
     $this->generator->next();
     return $token;
 }
コード例 #2
0
ファイル: RecordSet.php プロジェクト: Ekhvalov/recordsman
 public function next()
 {
     if ($this->_currentGen) {
         return $this->_currentGen->next();
     }
     return next($this->_records);
 }
コード例 #3
0
 /**
  * Rewind the Iterator to the first element
  * @see Iterator::rewind
  * @link http://php.net/manual/en/iterator.rewind.php
  */
 public function rewind()
 {
     $this->generateGenerator();
     if (is_callable($this->onRewind)) {
         call_user_func($this->onRewind);
     }
     if (defined('HHVM_VERSION')) {
         $this->generator->next();
     }
 }
コード例 #4
0
ファイル: Psr7Stream.php プロジェクト: genkgo/archive-stream
 /**
  * {@inheritdoc}
  */
 public function read($length)
 {
     $this->initializeBeforeRead();
     if (!$this->generator->valid()) {
         return '';
     }
     if ($this->resource->eof()) {
         $this->generator->next();
         if (!$this->generator->valid()) {
             return '';
         }
         $this->resource = $this->generator->current();
         $this->resource->rewind();
     }
     return $this->resource->fread($length);
 }
コード例 #5
0
ファイル: Parser.php プロジェクト: TeaMeow/Avane
 /**
  * Moves the generator on by one token.
  *
  * (It calls ->next() on the generator, look at the PHP doc)
  *
  * @see \Generator->next
  *
  * @return $this
  */
 protected function nextToken()
 {
     $this->tokens->next();
     return $this;
 }
コード例 #6
0
/**
 *
 * @param int $n
 * @param \Generator $gen
 *
 * @return \Generator
 */
function take($n, Generator $gen)
{
    while ($n-- > 0 && $gen->valid()) {
        (yield $gen->current());
        $gen->next();
    }
}
コード例 #7
0
ファイル: iter.rewindable.php プロジェクト: nikic/iter
 public function next()
 {
     if (!$this->generator) {
         $this->rewind();
     }
     $this->generator->next();
 }
コード例 #8
0
 /**
  * @param \Generator $logs
  *
  * @return int
  */
 protected function cntGeneratorLogs($logs)
 {
     $cnt = 0;
     while ($logs->valid()) {
         $cnt++;
         $logs->next();
     }
     return $cnt;
 }
コード例 #9
0
ファイル: CallableIterator.php プロジェクト: xphere/lazzzy
 /**
  * Get next item
  */
 public function next()
 {
     if ($this->generator) {
         $this->generator->next();
     }
 }