Handle the compilation of the templates

@param $template
2384
public function parse($template)
	{

		$viewsFromConfig = $this->app['config']->get('view.paths');

		$views = array_merge((array)$viewsFromConfig, (array)$this->paths['theme']);
		$cache = $this->paths['storage'] . '/views';

		$blade = new BladeAdapter($views, $cache);

		if (!$blade->getCompiler()->isExpired($template))
		{
			return $blade->getCompiler()->getCompiledPath($template);
		}

		$blade->getCompiler()->compile($template);

		return $blade->getCompiler()->getCompiledPath($template);

	}
469653
protected function _compileTemplates(array $templates = [])
    {
        if (empty($templates)) {
            $templates = array_keys($this->_config);
        }
        foreach ($templates as $name) {
            $template = $this->get($name);
            if ($template === null) {
                $this->_compiled[$name] = [null, null];
            }

            $template = str_replace('%', '%%', $template);
            preg_match_all('#\{\{([\w\._]+)\}\}#', $template, $matches);
            $this->_compiled[$name] = [
                str_replace($matches[0], '%s', $template),
                $matches[1]
            ];
        }
    }
40965
public static function end_cache($template)
    {
        $key = self::get_key($template);
        self::$template_data[$key]['cache_time'] += microtime(true) - self::$template_data[$key]['start_time'];
    }
1270040
public function onParseTemplate(Template $template): void
    {
        if (strpos($template->getName(), 'fe_') !== 0) {
            return;
        }

        $template->bootstrapEnvironment = $this->environment;
    }
363707
protected function compileTemplate($template)
	{
		$template = $this->normalizer->normalizeTemplate($template);

		// Parse the template
		$ir = TemplateParser::parse($template);

		// Serialize the representation to PHP
		$php = $this->serializer->serialize($ir->documentElement);
		if (isset($this->optimizer))
		{
			$php = $this->optimizer->optimize($php);
		}

		return $php;
	}
817843
public function compile(Compiler $compiler): void
    {
        // Echo line information into the generated code
        $compiler->addDebugInfo($this);

        // If there are no prefix and postfix set, usage
        // of this tag is useless and we just display the
        // contents
        if ($this->getAttribute('prefix') || $this->getAttribute('postfix')) {
            $this->compileComplex($compiler);
        } else {
            $compiler->subcompile($this->getNode('lines'));
        }
    }
1231185
public function compile(Compiler $compiler): void
    {
        if ($this->module->hasAttribute('is_embedded')) {
            return;
        }

        $presentationModel = $this->findPresentationModel->for($this->getSourceContext());

        $compiler
            ->write("\$presentationModel = new $presentationModel(\$context);\n")
            ->write("\$originalContext = \$context;\n\n")
            ->write("\$callback = function (array \$context) use (\$blocks, \$originalContext) {\n")
            ->indent()
            ->write("\$suppressedException = null;\n\n");
    }
481633
public function load($template)
    {
        $template = $this->findFirstExistingTemplate($template);
        if (!isset($this->loadedTemplates[ $template ])) {
            $class = $this->getTemplateClassName($template);

            $this->loadedTemplates[ $template ] = new $class($this);
            if (!$this->loadedTemplates[ $template ] instanceof Template) {
                throw new TemplatingException("The compiled class for {$template} is invalid");
            }
        }

        return $this->loadedTemplates[ $template ];
    }
384446
public static function end_compile($template)
    {
        if (!empty($template->compiler->trace_uid)) {
            $key = $template->compiler->trace_uid;
        } else {
            if (isset(self::$ignore_uid[$template->source->uid])) {
                return;
            }

            $key = self::get_key($template);
        }
        self::$template_data[$key]['compile_time'] += microtime(true) - self::$template_data[$key]['start_time'];
    }
558471
public function include(string $template, array $variables = null): void
    {
        $renderer = new Renderer($this->resolve, $this->sections);
        echo $renderer->render($template, $variables);
    }
1358594
public function addTemplate(Template $template)
    {
        $key = $this->normalizeKey($template->getTemplateName());
        $this->templates[$key] = $template;
    }
106691
private function resolveTemplate($template)
    {
        $template = str_replace(
            getcwd(),
            '',
            $this->viewResolver->resolve($template)
        );
        return $template;
    }
1078927
public function render(string $template, string $module = 'frontend') : void
    {
        if (!$this->assets)
        {
            $this->assets = $this->assetLoaderRepository->getAssetRelPaths();
        }

        $this->template->module = $module;
        $this->template->assets = $this->assets;

        $this->template->setFile(__DIR__ . '/templates/' . $template);
        $this->template->render();
    }
1012703
public function compile(Compiler $compiler): void
    {
        $compiler
            ->raw('$this->env->getExtension(\'Fxp\Component\Mailer\Twig\Extension\TemplaterExtension\')')
            ->raw('->getTranslatedLayout(')
            ->subcompile($this->getAttribute('variables'))
            ->raw(')->getFile()')
        ;
    }
2366
public function setTemplate($type, $template)
    {
        if (!is_callable($template)) {
            $template = (string) $template;
        }

        $this->templates[$type] = $template;
    }
677752
public function set_template($template)
	{
		// make sure the template is a View
		if (is_string($template))
		{
			$this->template = $this->view($template);
		}
		else
		{
			$this->template = $template;
		}

		// return the template view for chaining
		return $this->template;
	}
592227
public function processTemplateAction($template)
    {
        try {
            if (! empty($template)) {
                // If we have a view in the URL, render this view
                return $this->render($template);
            } elseif (null != $view = $this->getRequest()->get('view')) {
                return $this->render($view);
            }
        } catch (\Exception $ex) {
            return $this->errorPage($ex->getMessage());
        }

        return $this->pageNotFound();
    }