You are here

public function Twig_Loader_Array::getSource in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/twig/twig/lib/Twig/Loader/Array.php \Twig_Loader_Array::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/twig/lib/Twig/Loader/Array.php, line 52

Class

Twig_Loader_Array
Loads a template from an array.

Code

public function getSource($name) {
  $name = (string) $name;
  if (!isset($this->templates[$name])) {
    throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name));
  }
  return $this->templates[$name];
}