public function Twig_Environment::resolveTemplate

File

drupal/core/vendor/twig/twig/lib/Twig/Environment.php, line 361

Class

Twig_Environment
Stores the Twig configuration.

Code

public function resolveTemplate($names) {
  if (!is_array($names)) {
    $names = array(
      $names,
    );
  }
  foreach ($names as $name) {
    if ($name instanceof Twig_Template) {
      return $name;
    }
    try {
      return $this
        ->loadTemplate($name);
    } catch (Twig_Error_Loader $e) {
    }
  }
  if (1 === count($names)) {
    throw $e;
  }
  throw new Twig_Error_Loader(sprintf('Unable to find one of the following templates: "%s".', implode('", "', $names)));
}