You are here

public function Twig_Loader_Chain::getCacheKey in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/twig/twig/lib/Twig/Loader/Chain.php \Twig_Loader_Chain::getCacheKey()

Gets the cache key to use for the cache for a given template name.

Parameters

string $name The name of the template to load:

Return value

string The cache key

Throws

Twig_Error_Loader When $name is not found

Overrides Twig_LoaderInterface::getCacheKey

File

vendor/twig/twig/lib/Twig/Loader/Chain.php, line 100

Class

Twig_Loader_Chain
Loads templates from other loaders.

Code

public function getCacheKey($name) {
  $exceptions = array();
  foreach ($this->loaders as $loader) {
    if ($loader instanceof Twig_ExistsLoaderInterface && !$loader
      ->exists($name)) {
      continue;
    }
    try {
      return $loader
        ->getCacheKey($name);
    } catch (Twig_Error_Loader $e) {
      $exceptions[] = get_class($loader) . ': ' . $e
        ->getMessage();
    }
  }
  throw new Twig_Error_Loader(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' (' . implode(', ', $exceptions) . ')' : ''));
}