Simple enhancement for easy overloading
authorArnaud Buathier <arnaud.buathier@livingobjects.fr>
Tue, 3 Dec 2013 09:10:53 +0000 (10:10 +0100)
committerFabien Potencier <fabien.potencier@gmail.com>
Fri, 27 Dec 2013 14:35:40 +0000 (15:35 +0100)
lib/Twig/Loader/Filesystem.php

index 23bac47..62142f6 100644 (file)
@@ -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];