diff --git a/app/src/Factories/FinderFactory.php b/app/src/Factories/FinderFactory.php index ef32876..37fd424 100644 --- a/app/src/Factories/FinderFactory.php +++ b/app/src/Factories/FinderFactory.php @@ -51,9 +51,7 @@ class FinderFactory if ($this->hiddenFiles()->isNotEmpty()) { $finder->filter(function (SplFileInfo $file): bool { - return (bool) ! Glob::pattern( - sprintf('%s/{%s}', $this->container->get('base_path'), $this->hiddenFiles()->implode(',')) - )->matchStart($file->getRealPath()); + return ! $this->isHidden($file); }); } @@ -92,4 +90,18 @@ class FinderFactory return $collection->merge(self::APP_FILES); })->unique(); } + + /** + * Determine if a file should be hidden. + * + * @param \Symfony\Component\Finder\SplFileInfo $file + * + * @return bool + */ + protected function isHidden(SplFileInfo $file): bool + { + return Glob::pattern( + sprintf('%s/{%s}', $this->container->get('base_path'), $this->hiddenFiles()->implode(',')) + )->matchStart($file->getRealPath()); + } }