mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 02:46:29 +00:00
refactored code
This commit is contained in:
@@ -102,10 +102,6 @@ class Twig_Node_Module extends Twig_Node
|
||||
->write("{\n")
|
||||
->indent()
|
||||
;
|
||||
|
||||
if (null !== $this->getNode('parent')) {
|
||||
$compiler->write("protected \$parent;\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
protected function compileConstructor(Twig_Compiler $compiler)
|
||||
|
||||
@@ -20,6 +20,7 @@ abstract class Twig_Template implements Twig_TemplateInterface
|
||||
{
|
||||
static protected $cache = array();
|
||||
|
||||
protected $parents;
|
||||
protected $env;
|
||||
protected $blocks;
|
||||
|
||||
@@ -66,13 +67,13 @@ abstract class Twig_Template implements Twig_TemplateInterface
|
||||
return false;
|
||||
} elseif ($parent instanceof Twig_Template) {
|
||||
$name = $parent->getTemplateName();
|
||||
$this->parent[$name] = $parent;
|
||||
$this->parents[$name] = $parent;
|
||||
$parent = $name;
|
||||
} elseif (!isset($this->parent[$parent])) {
|
||||
$this->parent[$parent] = $this->env->loadTemplate($parent);
|
||||
} elseif (!isset($this->parents[$parent])) {
|
||||
$this->parents[$parent] = $this->env->loadTemplate($parent);
|
||||
}
|
||||
|
||||
return $this->parent[$parent];
|
||||
return $this->parents[$parent];
|
||||
}
|
||||
|
||||
abstract protected function doGetParent(array $context);
|
||||
|
||||
@@ -106,8 +106,6 @@ EOF
|
||||
/* foo.twig */
|
||||
class __TwigTemplate_be925a7b06dda0dfdbd18a1509f7eb34 extends Twig_Template
|
||||
{
|
||||
protected \$parent;
|
||||
|
||||
protected function doGetParent(array \$context)
|
||||
{
|
||||
return "layout.twig";
|
||||
@@ -149,8 +147,6 @@ EOF
|
||||
/* foo.twig */
|
||||
class __TwigTemplate_be925a7b06dda0dfdbd18a1509f7eb34 extends Twig_Template
|
||||
{
|
||||
protected \$parent;
|
||||
|
||||
protected function doGetParent(array \$context)
|
||||
{
|
||||
return ((true) ? ("foo") : ("foo"));
|
||||
|
||||
@@ -117,8 +117,6 @@ EOF
|
||||
/* foo.twig */
|
||||
class __TwigTemplate_be925a7b06dda0dfdbd18a1509f7eb34 extends Twig_Template
|
||||
{
|
||||
protected \$parent;
|
||||
|
||||
protected function doGetParent(array \$context)
|
||||
{
|
||||
return "layout.twig";
|
||||
|
||||
Reference in New Issue
Block a user