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)));
    }
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)));
    }
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 ) ) ) ; }
Tries to load a template consecutively from an array.

Similar to loadTemplate() but it also accepts Twig_TemplateInterface instances and an array
of templates where each is tried to be loaded.

@param string|Twig_Template|array $names A template or an array of templates to try consecutively

@return Twig_Template

@throws Twig_Error_Loader When none of the templates can be found
@throws Twig_Error_Syntax When an error occurred during compilation
Tries to load a template consecutively from an array .