You are here

protected function Twig_Loader_Filesystem::findTemplate in Translation template extractor 6.3

Same name and namespace in other branches
  1. 7.3 vendor/Twig/Loader/Filesystem.php \Twig_Loader_Filesystem::findTemplate()
4 calls to Twig_Loader_Filesystem::findTemplate()
Twig_Loader_Filesystem::exists in vendor/Twig/Loader/Filesystem.php
Check if we have the source code of a template, given its name.
Twig_Loader_Filesystem::getCacheKey in vendor/Twig/Loader/Filesystem.php
Gets the cache key to use for the cache for a given template name.
Twig_Loader_Filesystem::getSource in vendor/Twig/Loader/Filesystem.php
Gets the source code of a template, given its name.
Twig_Loader_Filesystem::isFresh in vendor/Twig/Loader/Filesystem.php
Returns true if the template is still fresh.

File

vendor/Twig/Loader/Filesystem.php, line 169

Class

Twig_Loader_Filesystem
Loads template from the filesystem.

Code

protected function findTemplate($name) {
  $name = $this
    ->normalizeName($name);
  if (isset($this->cache[$name])) {
    return $this->cache[$name];
  }
  $this
    ->validateName($name);
  list($namespace, $shortname) = $this
    ->parseName($name);
  if (!isset($this->paths[$namespace])) {
    throw new Twig_Error_Loader(sprintf('There are no registered paths for namespace "%s".', $namespace));
  }
  foreach ($this->paths[$namespace] as $path) {
    if (is_file($path . '/' . $shortname)) {
      return $this->cache[$name] = $path . '/' . $shortname;
    }
  }
  throw new Twig_Error_Loader(sprintf('Unable to find template "%s" (looked into: %s).', $name, implode(', ', $this->paths[$namespace])));
}