public function Twig_Environment::getTemplateClass in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/twig/twig/lib/Twig/Environment.php \Twig_Environment::getTemplateClass()
Gets the template class associated with the given string.
The generated template class is based on the following parameters:
- The cache key for the given template;
- The currently enabled extensions;
- Whether the Twig C extension is available or not.
Parameters
string $name The name for which to calculate the template class name:
int|null $index The index if it is an embedded template:
Return value
string The template class name
2 calls to Twig_Environment::getTemplateClass()
- Twig_Environment::getCacheFilename in vendor/
twig/ twig/ lib/ Twig/ Environment.php - Gets the cache filename for a given template.
- Twig_Environment::loadTemplate in vendor/
twig/ twig/ lib/ Twig/ Environment.php - Loads a template by name.
File
- vendor/
twig/ twig/ lib/ Twig/ Environment.php, line 310
Class
- Twig_Environment
- Stores the Twig configuration.
Code
public function getTemplateClass($name, $index = null) {
$key = $this
->getLoader()
->getCacheKey($name);
$key .= json_encode(array_keys($this->extensions));
$key .= function_exists('twig_template_get_attributes');
return $this->templateClassPrefix . hash('sha256', $key) . (null === $index ? '' : '_' . $index);
}