public function getIterator(): \Iterator
{ if (0 === \
count($this->dirs
) && 0 === \
count($this->iterators
)) { throw new \
LogicException('You must call one of in() or append() methods before iterating over a Finder.'
);
} if (1 === \
count($this->dirs
) && 0 === \
count($this->iterators
)) { $iterator =
$this->
searchInDirectory($this->dirs
[0
]);
if ($this->sort ||
$this->reverseSorting
) { $iterator =
(new Iterator\
SortableIterator($iterator,
$this->sort,
$this->reverseSorting
))->
getIterator();
} return $iterator;
} $iterator =
new \
AppendIterator();
foreach ($this->dirs
as $dir) { $iterator->
append(new \
IteratorIterator(new LazyIterator(fn () =>
$this->
searchInDirectory($dir))));
}