PHPComposter\PHPComposter\BaseAction::recursiveGlob PHP Method

recursiveGlob() protected method

Recursively iterate over folders and look for $pattern.
Since: 0.1.3
protected recursiveGlob ( string $pattern, integer $flags ) : mixed
$pattern string Pattern to look for.
$flags integer Optional. Flags to PHP glob() function. Defaults to 0.
return mixed
    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;
    }