public function Twig_Loader_Chain::exists in Translation template extractor 7.3
Same name and namespace in other branches
- 6.3 vendor/Twig/Loader/Chain.php \Twig_Loader_Chain::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/ Chain.php, line 69
Class
- Twig_Loader_Chain
- Loads templates from other loaders.
Code
public function exists($name) {
$name = (string) $name;
if (isset($this->hasSourceCache[$name])) {
return $this->hasSourceCache[$name];
}
foreach ($this->loaders as $loader) {
if ($loader instanceof Twig_ExistsLoaderInterface) {
if ($loader
->exists($name)) {
return $this->hasSourceCache[$name] = true;
}
continue;
}
try {
$loader
->getSource($name);
return $this->hasSourceCache[$name] = true;
} catch (Twig_Error_Loader $e) {
}
}
return $this->hasSourceCache[$name] = false;
}