Exclude files based on path before applying the sorting

Sorting can be slow, so it is best to applied it after all filtering
rules are applied instead of using a bigger list and filtering again
after that.
This commit is contained in:
Christophe Coevoet 2015-09-15 11:15:55 +02:00
parent 47b17ebef4
commit e5bf0ab877
1 changed files with 4 additions and 4 deletions

View File

@ -68,15 +68,15 @@ class PhpAdapter extends AbstractAdapter
$iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
}
if ($this->paths || $this->notPaths) {
$iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
}
if ($this->sort) {
$iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
$iterator = $iteratorAggregate->getIterator();
}
if ($this->paths || $this->notPaths) {
$iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
}
return $iterator;
}