Extracted some hidden file logic to a dedicated method

This commit is contained in:
Chris Kankiewicz
2020-05-01 11:38:24 -07:00
parent 411de8c104
commit 9923712408

View File

@@ -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());
}
}