MathiasGrimm\LaravelDotEnvGen\DotEnvGenCommand::gatherFiles PHP 메소드

gatherFiles() 보호된 메소드

protected gatherFiles ( )
    protected function gatherFiles()
    {
        $this->info('Gathering PHP files...');
        $this->info('You can speed up this process by excluding folders. Check the README for more info.');
        $directory = new \RecursiveDirectoryIterator(base_path());
        $iterator = new \RecursiveIteratorIterator($directory);
        $rules = \Config::get('dotenvgen.rules');
        $ignore = implode('|', array_map(function ($path) use($rules) {
            if (!empty($rules[$path])) {
                $excludes = $rules[$path];
                if (is_array($excludes)) {
                    $excluded = implode('|', array_map(function ($sub) {
                        return preg_quote(DIRECTORY_SEPARATOR . $sub, '/');
                    }, array_filter($excludes)));
                } else {
                    $excluded = preg_quote(DIRECTORY_SEPARATOR . $excludes, '/');
                }
            }
            return preg_quote($path, '/') . (!empty($excluded) ? '(?!' . $excluded . ')' : '');
        }, array_filter(array_keys($rules))));
        if (!empty($ignore)) {
            $regex = '/^(?!' . preg_quote(base_path() . DIRECTORY_SEPARATOR, '/') . '(' . $ignore . ')' . ').+\\.php$/i';
        } else {
            $regex = '/^.+\\.php$/i';
        }
        $this->iterator = new \RegexIterator($iterator, $regex, \RecursiveRegexIterator::GET_MATCH);
    }