src/Collection/FilesCollection.php
public function paths(array $patterns): self
    {
        $filter = new Iterator\PathFilterIterator($this->getIterator(), $patterns, []);

        return new self(iterator_to_array($filter));
    }
public function paths(array $patterns): self
    {
        $filter = new Iterator\PathFilterIterator($this->getIterator(), $patterns, []);

        return new self(iterator_to_array($filter));
    }
public function paths ( array $ patterns ) : self { $ filter = new Iterator \ PathFilterIterator ( $ this -> getIterator ( ) , $ patterns , [ ] ) ; return new self ( iterator_to_array ( $ filter ) ) ; }
Filter by paths.

$collection->paths(['/^spec\/','/^src\/'])
Filter by paths .