public function Twig_Loader_Chain::getSource in Translation template extractor 6.3
Same name and namespace in other branches
- 7.3 vendor/Twig/Loader/Chain.php \Twig_Loader_Chain::getSource()
Gets the source code of a template, given its name.
Parameters
string $name The name of the template to load:
Return value
string The template source code
Throws
Twig_Error_Loader When $name is not found
Overrides Twig_LoaderInterface::getSource
File
- vendor/
Twig/ Loader/ Chain.php, line 48
Class
- Twig_Loader_Chain
- Loads templates from other loaders.
Code
public function getSource($name) {
$exceptions = array();
foreach ($this->loaders as $loader) {
if ($loader instanceof Twig_ExistsLoaderInterface && !$loader
->exists($name)) {
continue;
}
try {
return $loader
->getSource($name);
} catch (Twig_Error_Loader $e) {
$exceptions[] = $e
->getMessage();
}
}
throw new Twig_Error_Loader(sprintf('Template "%s" is not defined (%s).', $name, implode(', ', $exceptions)));
}