GrumPHP\Collection\FilesCollection::filterByFileList PHP Method

filterByFileList() public method

public filterByFileList ( Traversable $fileList ) : FilesCollection
$fileList Traversable
return FilesCollection
    public function filterByFileList(Traversable $fileList)
    {
        $allowedFiles = array_map(function (SplFileInfo $file) {
            return $file->getPathname();
        }, iterator_to_array($fileList));
        return $this->filter(function (SplFileInfo $file) use($allowedFiles) {
            return in_array($file->getPathname(), $allowedFiles);
        });
    }