{@inheritdoc}

@return TemplateInterface
353587
public function getDefaultTemplate()
    {
        list($default, $negated) = $this->getTemplateStrings();

        $template = new ArrayTemplate([
            'default' => $default,
            'negated' => $negated,
        ]);

        return $template->setTemplateVars([
            'key' => $this->getKey(),
            'value' => $this->getValue(),
            'actualValue' => $this->getActualValue(),
        ]);
    }
1244619
public function renderTranslatableTemplate($templateString)
    {
        if ($templateString instanceof Translation) {
            $origLang = $this->translator()->getLocale();
            foreach ($this->translator()->availableLocales() as $lang) {
                if (!isset($templateString[$lang])) {
                    continue;
                }
                $translation = $templateString[$lang];
                $isBlank = empty($translation) && !is_numeric($translation);
                if (!$isBlank) {
                    $this->translator()->setLocale($lang);
                    $translation = $this->renderTemplate($translation);
                    if ($translation !== null) {
                        $templateString[$lang] = $translation;
                    }
                }
            }
            $this->translator()->setLocale($origLang);
            $templateString->isRendered = true;

            return $templateString;
        } elseif (is_string($templateString)) {
            $isBlank = empty($templateString) && !is_numeric($templateString);
            if (!$isBlank) {
                return $this->renderTemplate($templateString);
            }
        }

        return '';
    }
242825
public function getInspector()
	{
		if (!isset($this->inspector))
		{
			$this->inspector = new TemplateInspector($this->__toString());
		}

		return $this->inspector;
	}
1013381
public function loadTemplate($templateIdent)
    {
        if (!is_string($templateIdent)) {
            throw new InvalidArgumentException(sprintf(
                'Template ident must be a string, received %s',
                is_object($templateIdent) ? get_class($templateIdent) : gettype($templateIdent)
            ));
        }
        if (!$templateIdent) {
            return '';
        }
        return $this->engine()->loadTemplate($templateIdent);
    }
852127
public function render(ViewTemplateInterface $viewTemplate)
    {
        $options = [
            [
                'value'      => 'tl_limit',
                'attributes' => '',
                'content'    => $GLOBALS['TL_LANG']['MSC']['filterRecords']
            ]
        ];

        $optionsPerPage = $this->getItemsPerPage();
        $optionsTotal   = \ceil($this->intTotal / $optionsPerPage);

        for ($i = 0; $i < $optionsTotal; $i++) {
            $first      = ($i * $optionsPerPage);
            $thisLimit  = $first . ',' . $optionsPerPage;
            $upperLimit = ($first + $optionsPerPage);

            if ($upperLimit > $this->intTotal) {
                $upperLimit = $this->intTotal;
            }

            $options[] = [
                'value'      => $thisLimit,
                'attributes' => ($first === $this->getOffset()) ? ' selected' : '',
                'content'    => ($first + 1) . ' - ' . $upperLimit
            ];
        }

        if ($this->intTotal > $optionsPerPage) {
            $options[] = [
                'value'      => 'all',
                'attributes' =>
                    ((0 === $this->getOffset()) && ($this->intTotal === $this->getAmount()))
                        ? 'selected'
                        : '',
                'content'    => $GLOBALS['TL_LANG']['MSC']['filterAll']
            ];
        }

        $viewTemplate->set('options', $options);

        return $this;
    }
160736
protected function getTemplates(InputInterface $input)
    {
        /** @var ConfigurationHelper $configurationHelper */
        $configurationHelper = $this->getHelper('phpdocumentor_configuration');

        $templates = $input->getOption('template');
        if (!$templates) {
            /** @var Template[] $templatesFromConfig */
            $templatesFromConfig = $configurationHelper->getConfigValueFromPath('transformations/templates');
            foreach ($templatesFromConfig as $template) {
                $templates[] = $template->getName();
            }
        }

        if (!$templates) {
            $templates = array('clean');
        }

        return $templates;
    }
462473
public function getTemplate()
    {
        if (!$this->__template instanceof TemplateInterface)
        {
            //Make sure we have a template identifier
            if (!($this->__template instanceof ObjectIdentifier)) {
                $this->setTemplate($this->__template);
            }

            $options = array(
                'filters'   => $this->getConfig()->template_filters,
                'functions' => $this->getConfig()->template_functions,
            );

            $this->__template = $this->getObject($this->__template, $options);

            if(!$this->__template instanceof TemplateInterface)
            {
                throw new \UnexpectedValueException(
                    'Template: '.get_class($this->__template).' does not implement TemplateInterface'
                );
            }
        }

        return $this->__template;
    }
53402
public function templates($templates = null)
    {
        deprecationWarning(
            'StringTemplateTrait::templates() is deprecated. ' .
            'Use setTemplates()/getTemplates() instead.'
        );

        if ($templates === null || is_string($templates)) {
            return $this->templater()->get($templates);
        }

        $this->templater()->add($templates);

        return $this;
    }
336174
public function getTemplate()
    {
        if ($this->templateEngine == false) {
            return false;
        }
        
        $this->view->setTwigEnvironment();

        return $this->view->getTemplate();
    }
990130
public function resolve(ThemeInterface $theme, Content $content, Variation $variation, $templateName)
    {
        $templateTypes = $theme->getTemplateTypes();

        switch (true) {

            // given template name
            case $templateName :
                if (!$templateType = $templateTypes
                    ->search(array('name' => $templateName))
                    ->first()
                ) {
                    throw new InvalidTemplateException(sprintf(
                        'No template named "%s" registered under "%s" theme. Please check your configuration.',
                        $templateName,
                        $theme->getName()
                    ));
                }
            break;

            // default template type
            case $templateType = $templateTypes
                ->filter(function (TemplateType $templateType) use ($variation) {
                    return (bool) $variation->getConfiguration(
                        'templates',
                        $templateType->getName(),
                        'default'
                    );
                })
                ->first()
            :
            break;

            // first template type
            default:
                $templateType = $templateTypes->first();
        }
        if (empty($templateType)) {
            throw new InvalidTemplateException(sprintf(
                'No valid template type found under "%s" theme for "%s" content type. Please check your configuration.',
                $theme->getName(),
                $content->getType()->getName()
            ));
        }

        if (!$template = $this->templateLoader->retrieveDisplayable(
                $templateType,
                $content
            )
        ) {
            throw new InvalidTemplateException(sprintf(
                'Any "%s" template found under "%s" theme for "%s#%d" content.',
                $templateType->getName(),
                $theme->getName(),
                $content->getType()->getName(),
                $content->getContentId()
            ));
        }

        return $template->setContent($content);
    }
72483
public function init(string $templatesPath, string $cachePath = null) : TemplateLoaderInterface
    {
        $loader = new \Twig_Loader_Filesystem($templatesPath);
        if (null !== $cachePath) {
            $this->env = new \Twig_Environment($loader, [
                'cache' => $cachePath,
            ]);
        } else {
            $this->env = new \Twig_Environment($loader);
        }
        return $this;
    }
893976
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeln('Available templates:');
        foreach ($this->factory->getAllNames() as $template_name) {
            $output->writeln('* '.$template_name);
        }
        $output->writeln('');
    }
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;
    }
294889
public function getTemplate()
    {
        if(!$this->__template instanceof TemplateInterface)
        {
            $this->__template = $this->getObject($this->__template);

            if(!$this->__template instanceof TemplateInterface)
            {
                throw new \UnexpectedValueException(
                    'Template: '.get_class($this->_model).' does not implement TemplateInterface'
                );
            }
        }

        return $this->__template;
    }
986697
public function registerTemplate(TemplateInterface $template)
    {
        $templateName = $template->getName();
        $parts = explode('/', $templateName);

        if (count($parts) !== 2) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Template name "%s" is not formatted properly, should be like "domain/template-name"',
                    $templateName
                )
            );
        }

        list($domain, $name) = $parts;

        $this->templates[$domain][$name] = $template;
    }
32234
public function getTemplate($name, $templateSetName)
    {
        if (
            isset($this->templateSet[$templateSetName]) &&
            isset($this->templateSet[$templateSetName]['templates']) &&
            isset($this->templateSet[$templateSetName]['templates'][$name])
        ) {
            return $this->templateSet[$templateSetName]['templates'][$name];
        }

        throw new NonExistingTemplateException();
    }
117726
public function templates($templates = null) {

        if ($templates !== null && ! is_string($templates)) {
            $this->_userChangedTemplates = array_merge(array_keys($templates), $this->_userChangedTemplates);
        }

        return parent::templates($templates);
    }