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


PHP IteratorIterator類代碼示例

本文整理匯總了PHP中IteratorIterator的典型用法代碼示例。如果您正苦於以下問題:PHP IteratorIterator類的具體用法?PHP IteratorIterator怎麽用?PHP IteratorIterator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: createIteratorFromIterable

 /**
  * @param array|\Traversable $iterable
  *
  * @return \Iterator
  */
 private function createIteratorFromIterable($iterable)
 {
     if (is_array($iterable)) {
         return new \ArrayIterator($iterable);
     }
     $iterator = new \IteratorIterator($iterable);
     $iterator->rewind();
     return $iterator;
 }
開發者ID:phpspec,項目名稱:phpspec,代碼行數:14,代碼來源:IterablesMatcher.php

示例2: findChangelog

 /**
  * @param \nochso\WriteMe\Document $document
  *
  * @return \SplFileInfo
  */
 private function findChangelog(Document $document)
 {
     $changelogName = $this->options->getValue('changelog.file');
     $searchDepth = $this->options->getValue('changelog.search-depth');
     $folder = dirname($document->getFilepath());
     $files = new \IteratorIterator(Finder::findFiles($changelogName)->from($folder)->limitDepth($searchDepth));
     $files->next();
     if (!$files->valid()) {
         throw new \RuntimeException(sprintf("Unable to find changelog '%s' in folder '%s'", $changelogName, $folder));
     }
     return $files->current();
 }
開發者ID:nochso,項目名稱:writeme,代碼行數:17,代碼來源:Changelog.php

示例3: __construct

 /**
  * constructor
  *
  * @param Diggin_Scraper_Evaluator_Abstract $callback
  */
 public function __construct(\Diggin\Scraper\Evaluator\AbstractEvaluator $callback)
 {
     if ($filters = $callback->getProcess()->getFilters()) {
         $callback = $this->_apply($callback, $filters);
     }
     return parent::__construct($callback);
 }
開發者ID:sasezaki,項目名稱:Diggin_Scraper,代碼行數:12,代碼來源:Iterator.php

示例4: current

 function current()
 {
     $value = parent::current();
     $fn = $this->callback;
     $fn($value);
     return $value;
 }
開發者ID:Garcy111,項目名稱:Garcy-Framework-2,代碼行數:7,代碼來源:Iterator.php

示例5: current

 public function current()
 {
     $consumer = $this->consumer;
     $current = parent::current();
     $consumer($current);
     return $current;
 }
開發者ID:intrawarez,項目名稱:sabertooth,代碼行數:7,代碼來源:CallbackConsumerIterator.php

示例6: valid

 public function valid()
 {
     if (!parent::valid()) {
         return false;
     }
     return $this->range->contains($this->current()->getKey());
 }
開發者ID:malkusch,項目名稱:php-index,代碼行數:7,代碼來源:RangeIterator.php

示例7: current

 public function current()
 {
     $row = parent::current();
     $keys = array_keys($row);
     $column = $this->_column ?: array_shift($keys);
     return $row[$column];
 }
開發者ID:lox,項目名稱:pheasant,代碼行數:7,代碼來源:ColumnIterator.php

示例8: rewind

 public function rewind()
 {
     parent::rewind();
     if ($this->valid()) {
         $this->currentResult = $this->handleItem($this->current());
     }
 }
開發者ID:fabpot,項目名稱:php-cs-fixer,代碼行數:7,代碼來源:FileLintingIterator.php

示例9: current

 public function current()
 {
     $value = parent::current();
     foreach ($this->transformers as $fn) {
         $value = $fn($value);
     }
     return $value;
 }
開發者ID:mikevanwinkle,項目名稱:cli,代碼行數:8,代碼來源:Transform.php

示例10: current

 /**
  * for each configured field, if it's in the results, translate it
  *
  * @return array
  **/
 public function current()
 {
     $value = parent::current();
     foreach ($this->_settings['fields'] as $field) {
         $this->_update($value, $field);
     }
     return $value;
 }
開發者ID:nodesagency,項目名稱:Translations,代碼行數:13,代碼來源:TranslateInjector.php

示例11: current

 /**
  * Return the current element
  * This method is required by the interface [[\Iterator]].
  * @return mixed current row
  */
 public function current()
 {
     $value = parent::current();
     if (!isset($value['file'])) {
         $value['file'] = $this->collection->createDownload(array_intersect_key($value, ['_id' => true, 'filename' => true, 'length' => true, 'chunkSize' => true]));
     }
     return $value;
 }
開發者ID:mootensai,項目名稱:yii2-mongodb,代碼行數:13,代碼來源:Cursor.php

示例12: next

 public function next()
 {
     if ($this->isfirstrun) {
         $this->firstrun();
         $this->isfirstrun = FALSE;
     }
     parent::next();
 }
開發者ID:halfnelson,項目名稱:LINQ4PHP,代碼行數:8,代碼來源:DelayedExecutionIterator.php

示例13: __construct

 /**
  * Constructor
  *
  * @param PMF_Category $parent Parent PMF_Category object
  * 
  * @return void
  */
 public function __construct(PMF_Category_Tree_DataProvider_Interface $dataProvider, PMF_Category $parent = NULL)
 {
     $parentId = $parent ? (int) $parent->getId() : 0;
     $resultset = $dataProvider->getData($parentId);
     parent::__construct($resultset);
     $this->parent = $parent;
     $this->dataProvider = $dataProvider;
 }
開發者ID:nosch,項目名稱:phpMyFAQ,代碼行數:15,代碼來源:Tree.php

示例14: current

 /**
  * @inheritDoc
  */
 public function current()
 {
     if (empty($this->_headers)) {
         $this->_headers = parent::current();
         parent::next();
     }
     return array_combine($this->_headers, parent::current());
 }
開發者ID:ExpandOnline,項目名稱:CakePHPUtil,代碼行數:11,代碼來源:CsvFileIterator.php

示例15: next

 public function next()
 {
     $this->chunk = array();
     for ($i = 0; $i < $this->chunkSize && parent::valid(); $i++) {
         $this->chunk[] = parent::current();
         parent::next();
     }
 }
開發者ID:jorjoh,項目名稱:Varden,代碼行數:8,代碼來源:ChunkedIterator.php


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