Returns the registered template identifier.

@throws \RuntimeException

@return \Closure
978027
public function getTemplateIdentifier()
    {
        $options = $this->options;
        $contentView = $this->contentView;
        $twig = $this->twig;
        $layout = $this->configResolver->getParameter('view_default_layout', 'ezpublish_legacy');

        return static function (array $params) use ($options, $contentView, $twig, $layout) {
            $contentViewClosure = $contentView->getTemplateIdentifier();
            if (isset($params['noLayout']) && $params['noLayout']) {
                $layout = $options['viewbaseLayout'];
            }
            $twigContentTemplate = <<<EOT
{% extends "{$layout}" %}

{% block {$options['contentBlockName']} %}
{{ viewResult|raw }}
{% endblock %}
EOT;

            return $twig->render(
                $twigContentTemplate,
                $params + [
                    'viewResult' => $contentViewClosure($params),
                ]
            );
        };
    }
558285
public static function getContext()
    {
        $coID = Coroutine::getuid();
        if(!isset(static::$context[$coID]))
        {
            throw new \RuntimeException('get context failed, current context is not found');
        }
        return static::$context[$coID];
    }
715589
public function getNextId()
    {
        try {
            return $this->innerGateway->getNextId();
        } catch (DBALException $e) {
            throw new \RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new \RuntimeException('Database error', 0, $e);
        }
    }
412625
public function getNextIdentifier()
    {
        $next = $this->getNext();

        if (!$next->isIdentifier()) {
            throw SyntaxErrorException::unexpectedToken('identifier', $next);
        }

        return $next->getValue();
    }
728461
public function getFormTemplate()
    {
        if (null === $this->formTemplate) {
            $template = rtrim($this->getTemplatePrefix(), '/') . '/' . $this->getFormSuffix();
            $this->setFormTemplate($template);
        }

        return $this->formTemplate;
    }
166903
public static function getEngine()
    {
        if (null === self::$instance) {
            Template::addPath(self::getPath());
            $template = new Template();
            self::$instance = $template->initialize();
        }
        return self::$instance;
    }
694439
public function templateOptionsStructure()
    {
        if ($this->areTemplateOptionsFinalized === false) {
            $this->areTemplateOptionsFinalized = true;
            $this->prepareTemplateOptions();
        }

        $key  = 'template_options';
        $prop = $this->property($key);
        $val  = $this->propertyValue($key);
        $obj  = $prop->structureVal($val, $this->templateOptionsMetadata());

        return $obj;
    }
894785
public function getTemplate($code)
    {
        if (!isset($this->templates[$code])) {
            throw new \RuntimeException(sprintf('No template references with the code : %s', $code));
        }

        return $this->templates[$code];
    }
1257446
public function getTemplate() : ?string 
    {
        if ( ! $this->hasTemplate()) {
            $this->setTemplate($this->getDefaultTemplate());
        }
        return $this->template;
    }
511228
public function getRuntimeConfigurableWrapper()
    {
        if ($this->wrapper === null) {
            $this->wrapper = new RuntimeConfigurable($this, $this->getTaskName());
        }

        return $this->wrapper;
    }
562078
protected static function cacheId($callable)
    {

        if (is_array($callable)) {
            $class = is_string($callable[0]) ? $callable[0] : get_class($callable[0]);
            return "$class::" . $callable[1];
        }

        if (is_string($callable)) {
            return $callable;
        }

        if (!$callable instanceof \Closure) {
            return get_class($callable);
        }

        $r = new ReflectionFunction($callable);
        return 'Closure:' . $r->getFileName() . ':' . $r->getStartLine() . ':' . $r->getEndLine();

    }
539878
protected function exportInternal()
    {
        // Read the linked TypoScript
        if ($this->template !== null) {
            $this->config = [
                'template' => $this->template,
                'section'  => $this->section,
            ];
            $templateFile = GeneralUtility::getFileAbsFileName($this->template);
            if (!strlen($templateFile) || !is_file($templateFile)) {
                throw new \RuntimeException(sprintf('Invalid template file "%s"', $templateFile), 1481552328);
            }
            $this->template = file_get_contents($templateFile);
        }

        return array_merge(
            ['parameters' => $this->parameters],
            parent::exportInternal()
        );
    }
234582
private function generateProxyClass(): string
    {
        $class = $this->reflectionClass;

        if ($class->isFinal()) {
            throw new \RuntimeException(sprintf(
                'Can not generate proxy for final class "%s".',
                $class->getName()
            ));
        }

        if ($class->isAbstract()) {
            throw new \RuntimeException(sprintf(
                'Can not generate proxy for abstract class "%s".',
                $class->getName()
            ));
        }

        $methodCodes = [];

        $uses = $this->getAllUseStatementsMarkedAsAnnotation($class);
        $uses[] = 'FiveLab\Component\Transactional\Proxy\ProxyInterface as FiveLabTransactionalProxyInterface';

        $uses = \array_map(function ($use) {
            return 'use '.$use.';';
        }, $uses);

        $interfaces = [
            'FiveLabTransactionalProxyInterface',
        ];

        foreach ($this->getProxyMethods() as $method) {
            $methodCodes[] = $this->generateProxyMethod($method);
        }

        $docComment = $class->getDocComment();

        $templateVariables = [
            'uses'           => \implode("\n", $uses),
            'namespace'      => $class->getNamespaceName(),
            'docComment'     => $docComment,
            'proxyClassName' => $class->getShortName().'Proxy',
            'className'      => '\\'.$class->getName(),
            'proxyMethods'   => \implode("\n\n", $methodCodes),
            'interfaces'     => \implode(', ', $interfaces),
            'realClassName'  => $class->getName(),
        ];

        $template = $this->getTemplateForProxyClass();
        $code = $this->replaceVariables($template, $templateVariables);

        $lines = \explode("\n", $code);
        $lines = \array_map('rtrim', $lines);

        return \implode("\n", $lines);
    }
746146
protected function compiled($template)
    {
        $template = ltrim($template, '/');
        if (strrchr($template, '.') == $this->extension)
            $template = substr($template, 0, -strlen($this->extension));
        $file = $this->dir . DIRECTORY_SEPARATOR . $template . $this->extension;
        if (!is_file($file))
            throw new \RuntimeException("template not found:$file!");

        $modified = filemtime($file);
        $compiled = $this->temp . DIRECTORY_SEPARATOR . $template . ".{$modified}.php";
        if (!$this->debug && is_file($compiled) && filemtime($compiled) >= $modified)
            return $compiled;

        $content = self::compile(file_get_contents($file), $this->left, $this->right);
        self::writeFile($compiled, $content, $this->temp);

        return $compiled;
    }
1250728
public function getIdentifier()
    {
        if (is_array($this->callback)) {
            $class = $this->callback[0];

            if (is_object($class)) {
                $class = get_class($class);
            }

            return $class . '::' . $this->callback[1];
        }
        else if (is_object($this->callback)) {
            return spl_object_hash((object) $this->callback);
        }

        return (string) $this->callback;
    }
1313608
public function getTemplateName()
    {
        if ($this->templateName == null) {
            // The template name should be the second token.
            $this->templateName = $this->tokens[1];
        }

        return $this->templateName;
    }
1217461
public function templateName()
    {
        $key = substr(strrchr('\\'.get_class($this), '\\'), 1);

        if (!isset(static::$templateNameCache[$key])) {
            $value = $key;

            if (!ctype_lower($value)) {
                $value = preg_replace('/\s+/u', '', $value);
                $value = mb_strtolower(preg_replace('/(.)(?=[A-Z])/u', '$1-', $value), 'UTF-8');
            }

            $value = str_replace(
                [ 'abstract', 'trait', 'interface', 'template', '\\' ],
                '',
                $value
            );

            static::$templateNameCache[$key] = trim($value, '-');
        }

        return static::$templateNameCache[$key];
    }