MathiasGrimm\LaravelDotEnvGen\DotEnvGenCommand::scanFiles PHP Method

scanFiles() protected method

protected scanFiles ( )
    protected function scanFiles()
    {
        $count = iterator_count($this->iterator);
        $this->info("Scanning {$count} files...");
        $this->progressBar = new ProgressBar($this->output, $count);
        $this->progressBar->start();
        foreach ($this->iterator as $i => $v) {
            $this->progressBar->advance();
            $contents = file_get_contents($i);
            $matches = null;
            if (preg_match_all('/[^\\w_]env\\s*\\((\'|").*?(\'|")\\s*.*?\\)/sim', $contents, $matches)) {
                foreach ($matches[0] as $match) {
                    $matches2 = null;
                    preg_match('/\\(\\s*(\'|")(?P<name>.*?)(\'|")(,(?P<default>.*))?\\)/', $match, $matches2);
                    $this->found[$matches2['name']] = '';
                    $this->defaults[$matches2['name']] = isset($matches2['default']) ? trim($matches2['default']) : null;
                }
            }
        }
        $this->progressBar->finish();
        $this->info('');
    }