36 $this->loaders[] = $loader;
37 $this->hasSourceCache = array();
42 @trigger_error(sprintf(
'Calling "getSource" on "%s" is deprecated since 1.27. Use getSourceContext() instead.', get_class($this)), E_USER_DEPRECATED);
45 foreach ($this->loaders as $loader) {
51 return $loader->getSource(
$name);
63 foreach ($this->loaders as $loader) {
70 return $loader->getSourceContext(
$name);
86 if (isset($this->hasSourceCache[
$name])) {
87 return $this->hasSourceCache[
$name];
90 foreach ($this->loaders as $loader) {
92 if ($loader->exists($name)) {
93 return $this->hasSourceCache[
$name] =
true;
101 $loader->getSourceContext($name);
103 $loader->getSource($name);
106 return $this->hasSourceCache[
$name] =
true;
111 return $this->hasSourceCache[
$name] =
false;
117 foreach ($this->loaders as $loader) {
123 return $loader->getCacheKey(
$name);
125 $exceptions[] = get_class($loader).
': '.$e->getMessage();
135 foreach ($this->loaders as $loader) {
143 $exceptions[] = get_class($loader).
': '.$e->getMessage();
151 class_alias(
'Twig_Loader_Chain',
'Twig\Loader\ChainLoader',
false);
exists($name)
Check if we have the source code of a template, given its name.
__construct(array $loaders=array())
addLoader(Twig_LoaderInterface $loader)
Exception thrown when an error occurs during template loading.
getCacheKey($name)
Gets the cache key to use for the cache for a given template name.
Adds an exists() method for loaders.
Adds a getSourceContext() method for loaders.
exists($name)
Check if we have the source code of a template, given its name.
Loads templates from other loaders.
getSourceContext($name)
Returns the source context for a given template logical name.
Holds information about a non-compiled Twig template.
Interface all loaders must implement.
isFresh($name, $time)
Returns true if the template is still fresh.
getSource($name)
Gets the source code of a template, given its name.