protected function recursiveGlob($pattern, $flags = 0)
{
$files = glob($pattern, $flags);
foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
// Avoid scanning vendor folder.
if ($dir === $this->root . '/vendor') {
continue;
}
$files = array_merge($files, $this->recursiveGlob($dir . '/' . basename($pattern), $flags));
}
return $files;
}