You are here

public function Twig_Loader_Filesystem::exists in Translation template extractor 6.3

Same name and namespace in other branches
  1. 7.3 vendor/Twig/Loader/Filesystem.php \Twig_Loader_Filesystem::exists()

Check if we have the source code of a template, given its name.

Parameters

string $name The name of the template to check if we can load:

Return value

bool If the template source code is handled by this loader or not

Overrides Twig_ExistsLoaderInterface::exists

File

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

Class

Twig_Loader_Filesystem
Loads template from the filesystem.

Code

public function exists($name) {
  $name = $this
    ->normalizeName($name);
  if (isset($this->cache[$name])) {
    return true;
  }
  try {
    $this
      ->findTemplate($name);
    return true;
  } catch (Twig_Error_Loader $exception) {
    return false;
  }
}