Bolt\Translation\TranslationFile::scanTwigFiles PHP Method

scanTwigFiles() private method

..' and __("..." and add the strings found to the list of translatable strings.
private scanTwigFiles ( )
    private function scanTwigFiles()
    {
        $finder = new Finder();
        $finder->files()->ignoreVCS(true)->name('*.twig')->notName('*~')->exclude(['cache', 'config', 'database', 'resources', 'tests', 'bower_components', 'node_modules'])->in(dirname($this->app['resources']->getPath('themepath')))->in($this->app['resources']->getPath('apppath'));
        // Regex from: stackoverflow.com/questions/5695240/php-regex-to-ignore-escaped-quotes-within-quotes
        $twigRegex = ["/\\b__\\(\\s*'([^'\\\\]*(?:\\\\.[^'\\\\]*)*)'(?U).*\\)/s" => ['\\\'' => '\''], '/\\b__\\(\\s*"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"(?U).*\\)/s' => ['\\"' => '"']];
        foreach ($finder as $file) {
            /** @var \Symfony\Component\Finder\SplFileInfo $file */
            foreach ($twigRegex as $regex => $stripslashes) {
                if (preg_match_all($regex, $file->getContents(), $matches)) {
                    foreach ($matches[1] as $foundString) {
                        $this->addTranslatable(strtr($foundString, $stripslashes));
                    }
                }
            }
        }
    }