本文整理匯總了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;
}
示例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();
}
示例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);
}
示例4: current
function current()
{
$value = parent::current();
$fn = $this->callback;
$fn($value);
return $value;
}
示例5: current
public function current()
{
$consumer = $this->consumer;
$current = parent::current();
$consumer($current);
return $current;
}
示例6: valid
public function valid()
{
if (!parent::valid()) {
return false;
}
return $this->range->contains($this->current()->getKey());
}
示例7: current
public function current()
{
$row = parent::current();
$keys = array_keys($row);
$column = $this->_column ?: array_shift($keys);
return $row[$column];
}
示例8: rewind
public function rewind()
{
parent::rewind();
if ($this->valid()) {
$this->currentResult = $this->handleItem($this->current());
}
}
示例9: current
public function current()
{
$value = parent::current();
foreach ($this->transformers as $fn) {
$value = $fn($value);
}
return $value;
}
示例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;
}
示例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;
}
示例12: next
public function next()
{
if ($this->isfirstrun) {
$this->firstrun();
$this->isfirstrun = FALSE;
}
parent::next();
}
示例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;
}
示例14: current
/**
* @inheritDoc
*/
public function current()
{
if (empty($this->_headers)) {
$this->_headers = parent::current();
parent::next();
}
return array_combine($this->_headers, parent::current());
}
示例15: next
public function next()
{
$this->chunk = array();
for ($i = 0; $i < $this->chunkSize && parent::valid(); $i++) {
$this->chunk[] = parent::current();
parent::next();
}
}