fixed Twig_Node_Module::__toString() to include information about blocks and macros
authorFabien Potencier <fabien.potencier@gmail.com>
Thu, 6 May 2010 06:14:28 +0000 (08:14 +0200)
committerFabien Potencier <fabien.potencier@gmail.com>
Thu, 6 May 2010 06:14:28 +0000 (08:14 +0200)
lib/Twig/Node/Module.php

index c7cb37a..d22a990 100644 (file)
@@ -42,22 +42,33 @@ class Twig_Node_Module extends Twig_Node implements Twig_NodeListInterface
 
   public function __toString()
   {
-    $repr = array(get_class($this).'(');
+    $repr = array(get_class($this).'(', '  body:');
     foreach ($this->body->getNodes() as $node)
     {
       foreach (explode("\n", $node->__toString()) as $line)
       {
-        $repr[] = '  '.$line;
+        $repr[] = '    '.$line;
       }
     }
 
+    $repr[] = '  blocks: ';
     foreach ($this->blocks as $node)
     {
       foreach (explode("\n", $node->__toString()) as $line)
       {
-        $repr[] = '  '.$line;
+        $repr[] = '    '.$line;
       }
     }
+
+    $repr[] = '  macros: ';
+    foreach ($this->macros as $node)
+    {
+      foreach (explode("\n", $node->__toString()) as $line)
+      {
+        $repr[] = '    '.$line;
+      }
+    }
+
     $repr[] = ')';
 
     return implode("\n", $repr);