From: Arnaud Buathier Date: Tue, 3 Dec 2013 09:10:53 +0000 (+0100) Subject: Simple enhancement for easy overloading X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=87d4f083bb572117ae8bfb4a2ce67125574aab57;p=web%2Fkonrad%2Ftwig.git Simple enhancement for easy overloading --- diff --git a/lib/Twig/Loader/Filesystem.php b/lib/Twig/Loader/Filesystem.php index 23bac47..62142f6 100644 --- a/lib/Twig/Loader/Filesystem.php +++ b/lib/Twig/Loader/Filesystem.php @@ -164,13 +164,15 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI { return filemtime($this->findTemplate($name)) <= $time; } + + protected function normalize($name) + { + return preg_replace('#/{2,}#', '/', strtr((string) $name, '\\', '/')); + } protected function findTemplate($name) { - $name = (string) $name; - - // normalize name - $name = preg_replace('#/{2,}#', '/', strtr($name, '\\', '/')); + $name = $this->normalize($name); if (isset($this->cache[$name])) { return $this->cache[$name];