*/
public function exists($name)
{
- $name = (string) $name;
+ $name = $this->normalizeName($name);
+
if (isset($this->cache[$name])) {
return true;
}
{
return filemtime($this->findTemplate($name)) <= $time;
}
-
- protected function normalize($name)
- {
- return preg_replace('#/{2,}#', '/', strtr((string) $name, '\\', '/'));
- }
protected function findTemplate($name)
{
- $name = $this->normalize($name);
+ $name = $this->normalizeName($name);
if (isset($this->cache[$name])) {
return $this->cache[$name];
throw new Twig_Error_Loader(sprintf('Unable to find template "%s" (looked into: %s).', $name, implode(', ', $this->paths[$namespace])));
}
+ protected function normalizeName($name)
+ {
+ return preg_replace('#/{2,}#', '/', strtr((string) $name, '\\', '/'));
+ }
+
protected function validateName($name)
{
if (false !== strpos($name, "\0")) {