當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Iterator::valid方法代碼示例

本文整理匯總了PHP中Iterator::valid方法的典型用法代碼示例。如果您正苦於以下問題:PHP Iterator::valid方法的具體用法?PHP Iterator::valid怎麽用?PHP Iterator::valid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Iterator的用法示例。


在下文中一共展示了Iterator::valid方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: lazyAppend

 /**
  * Lazily append the next iterator to the chain
  */
 private function lazyAppend()
 {
     if (!parent::valid() and $this->iterators->valid()) {
         $this->append($this->iterators->current());
         $this->iterators->next();
     }
 }
開發者ID:indigophp,項目名稱:iterators,代碼行數:10,代碼來源:LazyAppendIterator.php

示例2: valid

 public function valid()
 {
     get_next:
     // Return true if this function has already been called for iteration.
     if ($this->currentRequest) {
         return true;
     }
     // Return false if we are at the end of the provided commands iterator.
     if (!$this->commands->valid()) {
         return false;
     }
     $command = $this->commands->current();
     if (!$command instanceof CommandInterface) {
         throw new \RuntimeException('All commands provided to the ' . __CLASS__ . ' must implement GuzzleHttp\\Command\\CommandInterface.' . ' Encountered a ' . Core::describeType($command) . ' value.');
     }
     $command->setFuture('lazy');
     $this->attachListeners($command, $this->eventListeners);
     // Prevent transfer exceptions from throwing.
     $command->getEmitter()->on('process', function (ProcessEvent $e) {
         if ($e->getException()) {
             $e->setResult(null);
         }
     }, RequestEvents::LATE);
     $builder = $this->requestBuilder;
     $result = $builder($command);
     // Skip commands that were intercepted with a result.
     if (isset($result['result'])) {
         $this->commands->next();
         goto get_next;
     }
     $this->currentRequest = $result['request'];
     return true;
 }
開發者ID:artoscopus,項目名稱:command,代碼行數:33,代碼來源:CommandToRequestIterator.php

示例3: valid

 private function valid()
 {
     if (!$this->data->valid()) {
         $this->rewind();
     }
     return TRUE;
 }
開發者ID:h4kuna,項目名稱:iterators,代碼行數:7,代碼來源:ArrayRound.php

示例4: next

 /**
  * {@inheritdoc}
  */
 public function next()
 {
     $this->neighbour->next();
     if (!$this->neighbour->valid()) {
         $this->neighbour->rewind();
         parent::next();
     }
 }
開發者ID:th3n3rd,項目名稱:cartesian-product,代碼行數:11,代碼來源:Set.php

示例5: valid

	public function valid(){
		if ($this->isFirstValidCall === true){
			$this->innerHasItems = $this->innerIterator->valid();
			$this->isFirstValidCall = false;
			return true;
		}
		return $this->innerIterator->valid();
	}
開發者ID:gpanda,項目名稱:security-scan-tool,代碼行數:8,代碼來源:DefaultIterator.php

示例6: next

 public function next()
 {
     $this->currentIt->next();
     if ($this->state === 1 && !$this->currentIt->valid()) {
         $this->currentIt = $this->it2;
         $this->state = 2;
     }
 }
開發者ID:ugochimbo,項目名稱:collections,代碼行數:8,代碼來源:LazyConcatIterator.php

示例7: memo

 private function memo()
 {
     if (!$this->it->valid()) {
         return;
     }
     array_push($this->cache, array($this->it->key(), $this->it->current()));
     $this->cacheSize++;
 }
開發者ID:gunjiro,項目名稱:ginq,代碼行數:8,代碼來源:MemoizeIterator.php

示例8: fetch

 private function fetch()
 {
     if ($this->it->valid()) {
         $this->v = $this->it->current();
         $this->k = $this->it->key();
         $fn = $this->fn;
         $fn($this->v, $this->k);
     }
 }
開發者ID:gunjiro,項目名稱:ginq,代碼行數:9,代碼來源:EachIterator.php

示例9: fetch

 private function fetch()
 {
     if ($this->it->valid()) {
         $v = $this->it->current();
         $k = $this->it->key();
         $this->v = $this->valueSelector->select($v, $k);
         $this->k = $this->keySelector->select($v, $k);
     }
 }
開發者ID:gunjiro,項目名稱:ginq,代碼行數:9,代碼來源:SelectIterator.php

示例10: valid

 public function valid()
 {
     if (!parent::valid()) {
         if ($this->source->valid()) {
             $this->append($this->transform($this->source->current()));
         }
     }
     return parent::valid();
 }
開發者ID:bugadani,項目名稱:monad,代碼行數:9,代碼來源:ArrayCallbackIterator.php

示例11: dir_readdir

 /**
  * @return string
  */
 public function dir_readdir()
 {
     if ($this->iterator->valid()) {
         $result = $this->iterator->current();
         $this->iterator->next();
         return $result;
     } else {
         return false;
     }
 }
開發者ID:win10calendar,項目名稱:3rdparty,代碼行數:13,代碼來源:IteratorDirectory.php

示例12: initSuspended

 /**
  * Initialize isSuspended.
  *
  * Called in walk() method.
  *
  * @return void
  */
 protected function initSuspended()
 {
     if ($this->lineHandler instanceof \IteratorIterator) {
         $this->isSuspended = $this->lineHandler->getInnerIterator()->valid();
     } elseif ($this->lineHandler instanceof \Iterator) {
         $this->isSuspended = $this->lineHandler->valid();
     } else {
         $this->isSuspended = false;
     }
 }
開發者ID:ngangchill,項目名稱:FileClient,代碼行數:17,代碼來源:AbstractFileIterator.php

示例13: collect

 /**
  * @param $limit
  * @return Resource[]
  */
 public function collect($limit = -1)
 {
     $resources = array();
     while ($limit && $this->iterator->valid()) {
         $resources[] = $this->iterator->current();
         $this->iterator->next();
         $limit--;
     }
     return $resources;
 }
開發者ID:devhelp,項目名稱:resource-core,代碼行數:14,代碼來源:ResourceCollector.php

示例14: fetch

 protected function fetch()
 {
     $this->buffer = array();
     for ($i = 0; $i < $this->chunkSize; $i++) {
         if (!$this->it->valid()) {
             return;
         }
         array_push($this->buffer, $this->it->current());
         $this->it->next();
     }
 }
開發者ID:evaneos,項目名稱:berthe,代碼行數:11,代碼來源:BufferedIterator.php

示例15: valid

 public function valid()
 {
     if ($this->usingCache) {
         return isset($this->array[$this->position]);
     }
     $valid = $this->innerIterator->valid();
     if (!$valid) {
         $this->usingCache = true;
     }
     return $valid;
 }
開發者ID:wearebase,項目名稱:base-core,代碼行數:11,代碼來源:CachingIterator.php


注:本文中的Iterator::valid方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。