From 87d4f083bb572117ae8bfb4a2ce67125574aab57 Mon Sep 17 00:00:00 2001 From: Arnaud Buathier Date: Tue, 3 Dec 2013 10:10:53 +0100 Subject: [PATCH] Simple enhancement for easy overloading --- lib/Twig/Loader/Filesystem.php | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) 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]; -- 1.7.2.5