renders a file form a twig template

@param string $template   template filename
@param string $target     where to generate to
@param array  $parameters template params

@return void
543129
protected function renderFile($template, $target, $parameters)
    {
        $this->fs->dumpFile(
            $target,
            $this->render($template, $parameters)
        );
    }
1115954
protected function _setTemplate($template)
    {
        if ($template !== null && !($template instanceof TemplateInterface)) {
            throw $this->_createInvalidArgumentException($this->__('Invalid template'), null, null, $template);
        }

        $this->template = $template;
    }
556654
public function twigRender ($template_file = null, $render = null, $template_dir_list = [], $options = []) {
		$this->renderSetting();
		$template = $this->twigLoadFileTemplate($template_file, $template_dir_list, $options);
		$render = $this->adjustRender($render);
		return $template->render($render);
	}
798284
protected function renderTemplateToFile(string $templateName, array $variables, string $fileName)
    {
        /** @var StandaloneView $renderer */
        $renderer = GeneralUtility::makeInstance(StandaloneView::class);
        $renderer->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($templateName));
        $renderer->assignMultiple($variables);
        $content = \trim((string)$renderer->render());
        // Note: Create even empty htaccess files (do not check!!!), so the delete is in sync
        GeneralUtility::writeFile($fileName, $content);
    }
1020711
protected function _outputMessage($template) {
		if (!empty($template)) {
			$template = 'CakeTheme.' . $template;
		}
		$this->controller->layout = 'CakeTheme.error';
		try {
			$this->controller->render($template);
			$this->_shutdown();
			$this->controller->response->send();
		} catch (MissingViewException $e) {
			$attributes = $e->getAttributes();
			if (isset($attributes['file']) && strpos($attributes['file'], 'error500') !== false) {
				$this->_outputMessageSafe('error500');
			} else {
				$this->_outputMessage('error500');
			}
		} catch (MissingPluginException $e) {
			$attributes = $e->getAttributes();
			if (isset($attributes['plugin']) && $attributes['plugin'] === $this->controller->plugin) {
				$this->controller->plugin = null;
			}
			$this->_outputMessageSafe('error500');
		} catch (Exception $e) {
			$this->_outputMessageSafe('error500');
		}
	}
811148
public function render($template, array $context = array())
    {
        $template = $this->twig->createTemplate($template);

        return $template->render($context);
    }
941603
protected function render(Template $template)
    {
        $presenter = $this->createPresenter($template->getPresenter());

        try {
            $arguments = $this->getArguments($presenter, $template);
            $this->logger->debug($arguments);
            $result = call_user_func_array($presenter, $arguments);
        } catch(Exception $e) {
            if ($this->throwRenderExceptions) {
                throw $e;
            }

            $this->logger->error($e->getMessage() .
                    "\n\nURL: " . URLUtils::fullUrl() .
                    "\n\nTemplate:\n" . print_r($template, true) .
                    (isset($arguments) ? "\n\n$presenter args:\n" . print_r($arguments, true) : '')
                );

            $result = '';
        }

        return $result;
    }
570943
public function onParseTemplate(Template $template): void
    {
        if (!$this->environment->isEnabled()) {
            return;
        }

        $this->initialize();
        if ($this->isAutoMappingDisabled($template->getName())) {
            return;
        }

        $templateName = $this->getMappedTemplateName($template->getName());
        if ($templateName) {
            $template->setName($templateName);
        }
    }
738766
private function _renderTemplate($template, $vars)
	{
		extract($vars, EXTR_SKIP);
		ob_start();

		try
		{
			require($template);
			$contents = ob_get_contents();
		}
		catch (Exception $e)
		{
			// TODO: come up with a clever way of chaining exceptions
			ob_end_clean();
			throw $e;
		}

		ob_end_clean();
		return $contents;
	}
425972
public function render($template, array $parameters = null, Response $response = null)
    {
        return parent::render($this->bundle->getBaseDirectory().DIRECTORY_SEPARATOR.'Templates'.DIRECTORY_SEPARATOR.'scripts'.DIRECTORY_SEPARATOR.$template, $parameters, $response);
    }
977235
public static function display($template, $target_id) {
		if(self::$twig === null)
			self::initialize();

		self::$render_actions[] = array(
			"type"      => "display_tpl",
			"template"  => $template,
			"target_id" => $target_id
		);
	}
908193
public function template($template, $data = Array()){
        \Template::with($template, $data);
        \View::serve();
    }
1138071
public static function template($template, $parameter = array(), $status = 200, $headers = array())
    {
        View::setTemplate($template, $parameter);

        return new Response('', $status, $headers);
    }
1167469
public function generateFile(string $targetPath, string $templateName, array $variables)
    {
        $variables = array_merge($variables, [
            'helper' => $this->twigHelper,
        ]);

        $this->addOperation($targetPath, $templateName, $variables);
    }
180366
public function templateFile($path, array $arguments = [])
    {
        $this->file($path)->template($this->makePath($path), $arguments);
    }
764188
protected function render(Response $response, $template, array $params = [])
    {
        return $this->container['twig']->render($response, $template, $params);
    }
236349
private function render($proxyTemplateFile, $parameters = array())
    {
        $proxyTemplateContent = file_get_contents($proxyTemplateFile);

        foreach ($parameters as $key => $val) {
            $proxyTemplateContent = str_replace("<<$key>>", $val, $proxyTemplateContent);
        }

        return $proxyTemplateContent;
    }