src/TemplateUtils.php
public static function findTemplate (\Twig_Loader_Filesystem $filesystem, $name)
    {
        $name = self::normalizeName($name);
        self::validateName($name);
        list($namespace, $shortname) = self::parseName($name);
        $paths = $filesystem->getPaths($namespace);
        if (empty($paths)) {
            throw new Twig_Error_Loader(sprintf('There are no registered paths for namespace "%s".', $namespace));
        }
        foreach ($paths as $path) {
            if (is_file($path . '/' . $shortname)) {
                if (false !== $realpath = realpath($path . '/' . $shortname)) {
                    return $realpath;
                }
                return $path . '/' . $shortname;
            }
        }
        throw new Twig_Error_Loader(sprintf('Unable to find template "%s" (looked into: %s).', $name, implode(', ', $paths)));
    }
public static function findTemplate (\Twig_Loader_Filesystem $filesystem, $name)
    {
        $name = self::normalizeName($name);
        self::validateName($name);
        list($namespace, $shortname) = self::parseName($name);
        $paths = $filesystem->getPaths($namespace);
        if (empty($paths)) {
            throw new Twig_Error_Loader(sprintf('There are no registered paths for namespace "%s".', $namespace));
        }
        foreach ($paths as $path) {
            if (is_file($path . '/' . $shortname)) {
                if (false !== $realpath = realpath($path . '/' . $shortname)) {
                    return $realpath;
                }
                return $path . '/' . $shortname;
            }
        }
        throw new Twig_Error_Loader(sprintf('Unable to find template "%s" (looked into: %s).', $name, implode(', ', $paths)));
    }
public static function findTemplate ( \ Twig_Loader_Filesystem $ filesystem , $ name ) { $ name = self :: normalizeName ( $ name ) ; self :: validateName ( $ name ) ; list ( $ namespace , $ shortname ) = self :: parseName ( $ name ) ; $ paths = $ filesystem -> getPaths ( $ namespace ) ; if ( empty ( $ paths ) ) { throw new Twig_Error_Loader ( sprintf ( 'There are no registered paths for namespace "%s".' , $ namespace ) ) ; } foreach ( $ paths as $ path ) { if ( is_file ( $ path . '/' . $ shortname ) ) { if ( false !== $ realpath = realpath ( $ path . '/' . $ shortname ) ) { return $ realpath ; } return $ path . '/' . $ shortname ; } } throw new Twig_Error_Loader ( sprintf ( 'Unable to find template "%s" (looked into: %s).' , $ name , implode ( ', ' , $ paths ) ) ) ; }
Determine the path of a template based on its name

@param \Twig_Loader_Filesystem $filesystem
@param string                  $name

@return string

@throws Twig_Error_Loader
Determine the path of a template based on its name