mirror of
https://github.com/DirectoryLister/DirectoryLister.git
synced 2025-08-25 06:51:18 +02:00
Extracted some hidden file logic to a dedicated method
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user