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:
parent
47b17ebef4
commit
e5bf0ab877
@ -68,15 +68,15 @@ class PhpAdapter extends AbstractAdapter
|
|||||||
$iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
|
$iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->paths || $this->notPaths) {
|
||||||
|
$iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->sort) {
|
if ($this->sort) {
|
||||||
$iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
|
$iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
|
||||||
$iterator = $iteratorAggregate->getIterator();
|
$iterator = $iteratorAggregate->getIterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->paths || $this->notPaths) {
|
|
||||||
$iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $iterator;
|
return $iterator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user