mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 03:46:39 +00:00
Revert "removed an unneeded protected method"
This reverts commit 7de9a57b92.
This commit is contained in:
@@ -143,9 +143,40 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function exists($name)
|
||||
{
|
||||
return $this->doFindTemplate($this->normalizeName($name));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isFresh($name, $time)
|
||||
{
|
||||
return filemtime($this->findTemplate($name)) <= $time;
|
||||
}
|
||||
|
||||
protected function findTemplate($name)
|
||||
{
|
||||
$name = $this->normalizeName($name);
|
||||
|
||||
if ($this->doFindTemplate($name)) {
|
||||
return $this->cache[$name];
|
||||
}
|
||||
|
||||
throw new Twig_Error_Loader($this->errorCache[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the template can be found.
|
||||
*
|
||||
* @param string $name The template name
|
||||
*
|
||||
* @return bool true if the template exists, false otherwise
|
||||
*/
|
||||
protected function doFindTemplate($name)
|
||||
{
|
||||
$this->validateName($name);
|
||||
|
||||
if (isset($this->cache[$name])) {
|
||||
return true;
|
||||
}
|
||||
@@ -154,8 +185,6 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->validateName($name);
|
||||
|
||||
list($namespace, $shortname) = $this->parseName($name);
|
||||
|
||||
if (!isset($this->paths[$namespace])) {
|
||||
@@ -183,25 +212,6 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isFresh($name, $time)
|
||||
{
|
||||
return filemtime($this->findTemplate($name)) <= $time;
|
||||
}
|
||||
|
||||
protected function findTemplate($name)
|
||||
{
|
||||
$name = $this->normalizeName($name);
|
||||
|
||||
if ($this->exists($name)) {
|
||||
return $this->cache[$name];
|
||||
}
|
||||
|
||||
throw new Twig_Error_Loader($this->errorCache[$name]);
|
||||
}
|
||||
|
||||
protected function normalizeName($name)
|
||||
{
|
||||
return preg_replace('#/{2,}#', '/', strtr($name, '\\', '/'));
|
||||
|
||||
Reference in New Issue
Block a user