protected function renderTemplates()
    {
        $finder = new Finder;

        $finder->files()->name('*'.self::TEMPLATE_FILENAME_EXTENSION)->in($this->targetPath);

        $twigRenderer = TwigRenderer::create(
            [
                'twig_extensions' => [ new ProjectExtension($this->configProvider) ],
                'twig_options' => [
                    'autoescape' => false,
                    'cache' => false,
                    'debug' => true,
                    'strict_variables' => true
                ],
                'template_paths' => [
                    $this->targetPath
                ]
            ]
        );

        foreach ($finder as $template) {
            $targetFilePath = $template->getPath().DIRECTORY_SEPARATOR.
                $template->getBasename(self::TEMPLATE_FILENAME_EXTENSION);

            if (!file_exists($targetFilePath) || (is_readable($targetFilePath) && $this->overwriteEnabled)) {
                $twigRenderer->renderToFile(
                    $template->getRelativePathname(),
                    $targetFilePath,
                    $this->data
                );
            }

            $msg = '[render] '.$template->getRelativePathname().' => '.$targetFilePath;

            if ($this->reportingEnabled) {
                $this->report[] = $msg;
            }
        }

        $this->fs->remove($finder);
    }
protected function renderTemplates()
    {
        $finder = new Finder;

        $finder->files()->name('*'.self::TEMPLATE_FILENAME_EXTENSION)->in($this->targetPath);

        $twigRenderer = TwigRenderer::create(
            [
                'twig_extensions' => [ new ProjectExtension($this->configProvider) ],
                'twig_options' => [
                    'autoescape' => false,
                    'cache' => false,
                    'debug' => true,
                    'strict_variables' => true
                ],
                'template_paths' => [
                    $this->targetPath
                ]
            ]
        );

        foreach ($finder as $template) {
            $targetFilePath = $template->getPath().DIRECTORY_SEPARATOR.
                $template->getBasename(self::TEMPLATE_FILENAME_EXTENSION);

            if (!file_exists($targetFilePath) || (is_readable($targetFilePath) && $this->overwriteEnabled)) {
                $twigRenderer->renderToFile(
                    $template->getRelativePathname(),
                    $targetFilePath,
                    $this->data
                );
            }

            $msg = '[render] '.$template->getRelativePathname().' => '.$targetFilePath;

            if ($this->reportingEnabled) {
                $this->report[] = $msg;
            }
        }

        $this->fs->remove($finder);
    }
protected function renderTemplates ( ) { $ finder = new Finder ; $ finder -> files ( ) -> name ( '*' . self :: TEMPLATE_FILENAME_EXTENSION ) -> in ( $ this -> targetPath ) ; $ twigRenderer = TwigRenderer :: create ( [ 'twig_extensions' => [ new ProjectExtension ( $ this -> configProvider ) ] , 'twig_options' => [ 'autoescape' => false , 'cache' => false , 'debug' => true , 'strict_variables' => true ] , 'template_paths' => [ $ this -> targetPath ] ] ) ; foreach ( $ finder as $ template ) { $ targetFilePath = $ template -> getPath ( ) . DIRECTORY_SEPARATOR . $ template -> getBasename ( self :: TEMPLATE_FILENAME_EXTENSION ) ; if ( ! file_exists ( $ targetFilePath ) || ( is_readable ( $ targetFilePath ) && $ this -> overwriteEnabled ) ) { $ twigRenderer -> renderToFile ( $ template -> getRelativePathname ( ) , $ targetFilePath , $ this -> data ) ; } $ msg = '[render] ' . $ template -> getRelativePathname ( ) . ' => ' . $ targetFilePath ; if ( $ this -> reportingEnabled ) { $ this -> report [ ] = $ msg ; } } $ this -> fs -> remove ( $ finder ) ; }
Renders all files within the target location whose extension is
".tmpl.twig" onto a file that has the same name without that extension.
After the rendering all the ".tmpl.twig" files will be deleted in the
target location.
Renders all files within the target location whose extension is . tmpl . twig onto a file that has the same name without that extension . After the rendering all the . tmpl . twig files will be deleted in the target location .