public function Target::getFinder in Drupal 7 to 8/9 Module Upgrader 8
Returns a fully configured Finder which can iterate over the target module's code files. Any file type which doesn't contain PHP code should be ignored.
Return value
\Symfony\Component\Finder\Finder
Overrides TargetInterface::getFinder
File
- src/
Target.php, line 112
Class
- Target
- Default implementation of TargetInterface.
Namespace
Drupal\drupalmoduleupgraderCode
public function getFinder() {
// We do NOT want to include submodules. We can detect one by the presence
// of an info file -- if there is one, its directory is a submodule.
$directories = (new Finder())
->directories()
->in($this
->getBasePath())
->filter(function (\SplFileInfo $dir) {
return (new Finder())
->files()
->in($dir
->getPathname())
->depth('== 0')
->name('*.info')
->count() === 0;
});
$directories = array_keys(iterator_to_array($directories));
$directories[] = $this
->getBasePath();
return (new Finder())
->files()
->in($directories)
->depth('== 0')
->name('*.module')
->name('*.install')
->name('*.inc')
->name('*.php')
->name('*.test');
}