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


PHP Iterator::current方法代碼示例

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


在下文中一共展示了Iterator::current方法的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: current

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

示例3: current

 /**
  * {@inheritdoc}
  */
 public function current()
 {
     if (!$this->iterableResult) {
         $this->rewind();
     }
     return $this->iterableResult->current();
 }
開發者ID:mathielen,項目名稱:import-engine,代碼行數:10,代碼來源:ServiceReader.php

示例4: getCurrentIterator

 private function getCurrentIterator()
 {
     if (null === $this->currentIterator) {
         $this->currentIterator = $this->mainIterator->current();
     }
     return $this->currentIterator;
 }
開發者ID:adrienbrault,項目名稱:pagerfanta-iterator,代碼行數:7,代碼來源:IteratorIterator.php

示例5: subscribe

 /**
  * @param ObserverInterface $observer
  * @param SchedulerInterface|null $scheduler
  * @return \Rx\Disposable\CompositeDisposable|\Rx\DisposableInterface
  */
 public function subscribe(ObserverInterface $observer, SchedulerInterface $scheduler = null)
 {
     $scheduler = $scheduler ?: new ImmediateScheduler();
     $key = 0;
     return $scheduler->scheduleRecursive(function ($reschedule) use(&$observer, &$key) {
         try {
             //HHVM requires you to call next() before current()
             if (defined('HHVM_VERSION')) {
                 $this->items->next();
                 $key = $this->items->key();
             }
             if (null === $key) {
                 $observer->onCompleted();
                 return;
             }
             $current = $this->items->current();
             $observer->onNext($current);
             if (!defined('HHVM_VERSION')) {
                 $this->items->next();
                 $key = $this->items->key();
             }
             $reschedule();
         } catch (\Exception $e) {
             $observer->onError($e);
         }
     });
 }
開發者ID:voryx,項目名稱:Rx.PHP,代碼行數:32,代碼來源:IteratorObservable.php

示例6: 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

示例7: current

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

示例8: current

 /**
  * @return Mixed|null Returns null if out of range
  */
 public function current()
 {
     if (!$this->baseIterator->valid()) {
         return null;
         // out of range
     }
     return call_user_func_array($this->vCallback, array($this->baseIterator->current()));
 }
開發者ID:mangowi,項目名稱:mediawiki,代碼行數:11,代碼來源:MappedIterator.php

示例9: current

 /**
  * Returns the current element.
  *
  * @return \SplFileInfo
  *
  * @throws FileSystemException If called after the last element has been returned.
  */
 public function current()
 {
     try {
         return $this->iterator->current();
     } catch (\RuntimeException $e) {
         throw FileSystemException::wrap($e);
     }
 }
開發者ID:brick,項目名稱:brick,代碼行數:15,代碼來源:RecursiveFileIterator.php

示例10: 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

示例11: 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

示例12: 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

示例13: fetch

 public function fetch($fetchMode = null)
 {
     if (!$this->currentIterator) {
         $this->currentIterator = $this->getIterator();
     }
     $data = $this->currentIterator->current();
     $this->currentIterator->next();
     return $data;
 }
開發者ID:undera,項目名稱:doctrine-dbal-influxdb,代碼行數:9,代碼來源:InfluxDBStatement.php

示例14: current

 public function current()
 {
     if ($this->projectionNeeded) {
         $projection = $this->projection;
         $this->current = $projection($this->innerIterator->current(), $this->innerIterator->key(), $this->innerIterator);
         $this->projectionNeeded = false;
     }
     return $this->current;
 }
開發者ID:pombredanne,項目名稱:yasca,代碼行數:9,代碼來源:ProjectionIterator.php

示例15: current

 public function current()
 {
     $current = $this->iterator->current();
     $fileCrate = new \HQ\ErrorMonitorinq\FileCrate();
     $fileCrate->name = $current["Key"];
     $fileCrate->size = $current["Size"];
     $fileCrate->lastModified = new \DateTime($current["LastModified"]);
     return $fileCrate;
 }
開發者ID:RiKap,項目名稱:ErrorMonitoring,代碼行數:9,代碼來源:S3DataSource.php


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