{@inheritdoc}

@param  TemplateInterface $template
@return mixed|string
169715
public function getMessage(TemplateInterface $template)
    {
        $vars = $this->getTemplateVars($template);

        $tpl = $this->match->isNegated()
            ? $template->getNegatedTemplate()
            : $template->getDefaultTemplate();

        foreach ($vars as $name => $value) {
            $tpl = str_replace('{{' . $name . '}}', $this->objectToString($value), $tpl);
        }

        return $tpl;
    }
1292160
protected function templateExists($template)
    {
        $loader = $this->twig->getLoader();
        if ($loader instanceof ExistsLoaderInterface) {
            return $loader->exists($template);
        }

        try {
            if ($loader instanceof SourceContextLoaderInterface || method_exists($loader, 'getSourceContext')) {
                $loader->getSourceContext($template);
            } else {
                $loader->getSource($template);
            }

            return true;
        } catch (LoaderError $e) {
        }

        return false;
    }
837038
public function getTemplateQuery($template)
    {
        if(isset($this->template[$template]))
        {
            return $this->template[$template];
        }

        return FALSE;
    }
1160274
protected function getTemplate(InputInterface $input)
    {
        $template = $this->getTemplateFactory()->get('twig');
        $template->setName($input->getOption('template'));

        return $template;
    }
495999
public function filter(&$text, TemplateInterface $template)
    {
        if (strpos($text, '<ktml:wrapper') !== false)
        {
            if(preg_match_all('#<ktml:wrapper\s+template="([^"]+)"\s*>#siU', $text, $matches, PREG_SET_ORDER))
            {
                foreach ($matches as $match)
                {
                    $wrapper_template = html_entity_decode($match[1]);

                    if ($wrapper_template) {
                        $text = sprintf($wrapper_template, $text);
                        $text = str_replace($matches[0], '', $text);

                        return;
                    }
                }
            }
        }
    }
364545
public function retrieveForTemplate(Template $template)
    {
        return $this->toEntityCollection(
            $this->getEntityRepository()
                ->createQueryBuilder('zone')
                    ->select('zone', 'components')
                        ->leftJoin('zone.components', 'components')
                    ->where('zone.template = :template')
                        ->setParameter(':template', $template)
                    ->addOrderBy('components.ranking', 'asc')
                ->getQuery()
                    ->getResult()
        );
    }
1050763
public function resolve($template, $view = null)
    {
        if (!$template) {
            return '';
        }

        $segments = explode('/', $template);
        $page = end($segments);

        foreach ($this->baseDirectories as $dirs) {
            foreach ($dirs as $dir) {
                if ($t = $this->tryTemplate($dir, $template, $view)) {
                    return $t;
                }

                if ($t = $this->tryTemplate($dir, $template.$this->extension, $view)) {
                    return $t;
                }
            }
        }

        if ($template[0] !== '_') {

            foreach ($this->baseDirectories as $dirs) {
                foreach ($dirs as $dir) {
                    if ($t = $this->tryTemplate($dir, 'shared'.DIRECTORY_SEPARATOR.$page, $view)) {
                        return $t;
                    }

                    if ($t = $this->tryTemplate($dir, 'shared'.DIRECTORY_SEPARATOR.$page.$this->extension, $view)) {
                        return $t;
                    }
                }
            }

        }

    }
678833
private function scanFor($template)
    {
        $in = $this->dirs;
        $found = false;
        while (! $found && ! empty($in)) {
            $dir = array_shift($in);
            $found = $this->exists($dir, $template);
        }

        return $found;
    }
962650
public function load(TemplateReferenceInterface $template)
    {
        $file = $template->get('name');

        if (self::isAbsolutePath($file) && is_file($file)) {
            return new FileStorage($file);
        }

        $replacements = [];
        foreach ($template->all() as $key => $value) {
            $replacements['%'.$key.'%'] = $value;
        }

        $fileFailures = [];
        foreach ($this->templatePathPatterns as $templatePathPattern) {
            if (is_file($file = strtr($templatePathPattern, $replacements)) && is_readable($file)) {
                if (null !== $this->logger) {
                    $this->logger->debug('Loaded template file.', ['file' => $file]);
                }

                return new FileStorage($file);
            }

            if (null !== $this->logger) {
                $fileFailures[] = $file;
            }
        }

        // only log failures if no template could be loaded at all
        foreach ($fileFailures as $file) {
            if (null !== $this->logger) {
                $this->logger->debug('Failed loading template file.', ['file' => $file]);
            }
        }

        return false;
    }
827245
public function render($template = 'Index'): string
    {
        $class = '\Themes\\' . $this->theme . '\\' . $template . 'Template';

        $template = new $class($this);

        ob_start();

        $template->render();

        $result = ob_get_clean();

        return $result;
    }
1156180
public function render(\Laasti\Views\Template $template)
    {
        $filepath = $this->findTemplateFile($template->getView());
        if ($template->getData() instanceof \Laasti\Views\Data\DataInterface) {
            $data = $template->getData()->toArray();
        } else {
            $data = $template->getData();
        }
        foreach ($data as $key => $value) {
            ${$key} = $value;
        }
        ob_start();
        include $filepath;
        $content = ob_get_contents();
        @ob_end_clean();
        return $content;
    }
1321102
private function findTemplatesInBundle(BundleInterface $bundle)
    {
        $name = $bundle->getName();
        $templates = array_unique(array_merge(
            $this->findTemplatesInFolder($bundle->getPath().'/Resources/views'),
            $this->findTemplatesInFolder($this->rootDir.'/'.$name.'/views')
        ));

        foreach ($templates as $i => $template) {
            $templates[$i] = $template->set('bundle', $name);
        }

        return $templates;
    }
469033
protected function getTemplate($template)
    {
        $path = realpath(__DIR__.'/../templates/'.$template.'.txt');

        return $this->files->get($path);
    }
1196494
public function getTemplateParameters($template) {
        if (count(self::$_config->template->{$template})) {
            $tplConfig = self::$_config->template->{$template}->toArray();
            return $tplConfig;
        }
        throw new Exception('The template "' . $template . '" is not configured.');
    }
926662
protected function templateExists($template)
    {
        try {
            $class = $this->templating->getTemplateClass($template);
        } catch (Twig_Error_Loader $e) {
            return false;
        }

        return $template;
    }
635766
protected function recursiveRender($template)
    {
        $output = '';
        foreach ($template as $val) {
            if (is_array($val)) {
                $output .= $this->recursiveRender($val);
            } else {
                $output .= $val;
            }
        }

        return $output;
    }
995218
public function get($template)
    {
        $response = $this->request(self::REQUEST_GET, 'templates/'.$template);
        return $response->response;
    }