当前位置: 首页>>代码示例>>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;未经允许,请勿转载。