simplify loader constructors

This commit is contained in:
Tobias Schultze
2013-09-04 01:09:57 +02:00
parent ffec8ba902
commit ac23cd7ae4
3 changed files with 5 additions and 9 deletions
+2 -5
View File
@@ -21,7 +21,7 @@
*/
class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterface
{
protected $templates;
protected $templates = array();
/**
* Constructor.
@@ -32,10 +32,7 @@ class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
*/
public function __construct(array $templates)
{
$this->templates = array();
foreach ($templates as $name => $template) {
$this->templates[$name] = $template;
}
$this->templates = $templates;
}
/**
+1 -2
View File
@@ -17,7 +17,7 @@
class Twig_Loader_Chain implements Twig_LoaderInterface, Twig_ExistsLoaderInterface
{
private $hasSourceCache = array();
protected $loaders;
protected $loaders = array();
/**
* Constructor.
@@ -26,7 +26,6 @@ class Twig_Loader_Chain implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
*/
public function __construct(array $loaders = array())
{
$this->loaders = array();
foreach ($loaders as $loader) {
$this->addLoader($loader);
}
+2 -2
View File
@@ -19,8 +19,8 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
/** Identifier of the main namespace. */
const MAIN_NAMESPACE = '__main__';
protected $paths;
protected $cache;
protected $paths = array();
protected $cache = array();
/**
* Constructor.