fixed wrong commit

This commit is contained in:
Fabien Potencier
2015-08-23 14:21:39 +02:00
parent d6e42d167e
commit d08ceadf4a
+6 -3
View File
@@ -23,7 +23,7 @@
*/
class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterface
{
private $templates = array();
protected $templates = array();
/**
* Constructor.
@@ -43,7 +43,7 @@ class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
*/
public function setTemplate($name, $template)
{
$this->templates[$name] = $template;
$this->templates[(string) $name] = $template;
}
/**
@@ -51,6 +51,7 @@ class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
*/
public function getSource($name)
{
$name = (string) $name;
if (!isset($this->templates[$name])) {
throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name));
}
@@ -63,7 +64,7 @@ class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
*/
public function exists($name)
{
return isset($this->templates[$name]);
return isset($this->templates[(string) $name]);
}
/**
@@ -71,6 +72,7 @@ class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
*/
public function getCacheKey($name)
{
$name = (string) $name;
if (!isset($this->templates[$name])) {
throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name));
}
@@ -83,6 +85,7 @@ class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
*/
public function isFresh($name, $time)
{
$name = (string) $name;
if (!isset($this->templates[$name])) {
throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name));
}