mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-16 12:26:30 +00:00
simplify loader constructors
This commit is contained in:
@@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterface
|
class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterface
|
||||||
{
|
{
|
||||||
protected $templates;
|
protected $templates = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
@@ -32,10 +32,7 @@ class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
|
|||||||
*/
|
*/
|
||||||
public function __construct(array $templates)
|
public function __construct(array $templates)
|
||||||
{
|
{
|
||||||
$this->templates = array();
|
$this->templates = $templates;
|
||||||
foreach ($templates as $name => $template) {
|
|
||||||
$this->templates[$name] = $template;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
class Twig_Loader_Chain implements Twig_LoaderInterface, Twig_ExistsLoaderInterface
|
class Twig_Loader_Chain implements Twig_LoaderInterface, Twig_ExistsLoaderInterface
|
||||||
{
|
{
|
||||||
private $hasSourceCache = array();
|
private $hasSourceCache = array();
|
||||||
protected $loaders;
|
protected $loaders = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
@@ -26,7 +26,6 @@ class Twig_Loader_Chain implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
|
|||||||
*/
|
*/
|
||||||
public function __construct(array $loaders = array())
|
public function __construct(array $loaders = array())
|
||||||
{
|
{
|
||||||
$this->loaders = array();
|
|
||||||
foreach ($loaders as $loader) {
|
foreach ($loaders as $loader) {
|
||||||
$this->addLoader($loader);
|
$this->addLoader($loader);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
|
|||||||
/** Identifier of the main namespace. */
|
/** Identifier of the main namespace. */
|
||||||
const MAIN_NAMESPACE = '__main__';
|
const MAIN_NAMESPACE = '__main__';
|
||||||
|
|
||||||
protected $paths;
|
protected $paths = array();
|
||||||
protected $cache;
|
protected $cache = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
|||||||
Reference in New Issue
Block a user