/** * {@inheritdoc} */ public function getSource($name) { try { return file_get_contents($this->findTemplate($name)); } catch (\Exception $exception) { return $this->decoratedLoader->getSource($name); } }
/** * {@inheritdoc} */ public function getSource($name) { $templates = $this->getTemplates($name); foreach ($templates as $template) { try { return $this->loader->getSource($template); } catch (\Twig_Error $e) { } } throw new \RuntimeException(sprintf("Template \"%s\" not found. Tried the following:\n%s", $name, implode("\n", $templates))); }
/** * {@inheritdoc} */ public function exists($name) { if ($this->loader instanceof \Twig_ExistsLoaderInterface) { return $this->loader->exists($name); } else { try { $this->loader->getSource($name); return true; } catch (\Twig_Error_Loader $e) { return false; } } }