本文整理汇总了PHP中Generator::next方法的典型用法代码示例。如果您正苦于以下问题:PHP Generator::next方法的具体用法?PHP Generator::next怎么用?PHP Generator::next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Generator
的用法示例。
在下文中一共展示了Generator::next方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pop
/**
* 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: next
public function next()
{
if ($this->_currentGen) {
return $this->_currentGen->next();
}
return next($this->_records);
}
示例3: rewind
/**
* 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: read
/**
* {@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: nextToken
/**
* 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: take
/**
*
* @param int $n
* @param \Generator $gen
*
* @return \Generator
*/
function take($n, Generator $gen)
{
while ($n-- > 0 && $gen->valid()) {
(yield $gen->current());
$gen->next();
}
}
示例7: next
public function next()
{
if (!$this->generator) {
$this->rewind();
}
$this->generator->next();
}
示例8: cntGeneratorLogs
/**
* @param \Generator $logs
*
* @return int
*/
protected function cntGeneratorLogs($logs)
{
$cnt = 0;
while ($logs->valid()) {
$cnt++;
$logs->next();
}
return $cnt;
}
示例9: next
/**
* Get next item
*/
public function next()
{
if ($this->generator) {
$this->generator->next();
}
}