public function getIterator()
{
if (!$this->paths) {
throw new Nette\InvalidStateException('Call in() or from() to specify directory to search.');
} elseif (count($this->paths) === 1) {
return $this->buildIterator($this->paths[0]);
} else {
$iterator = new \AppendIterator();
$iterator->append($workaround = new \ArrayIterator(['workaround PHP bugs #49104, #63077']));
foreach ($this->paths as $path) {
$iterator->append($this->buildIterator($path));
}
unset($workaround[0]);
return $iterator;
}
}
/** * Returns iterator. * @return \Iterator */ public function getIterator() { $iterator = parent::getIterator(); if ($this->order === NULL) { return $iterator; } $iterator = new \ArrayIterator(\iterator_to_array($iterator)); $iterator->uasort($this->order); return $iterator; }