added __toString() to Node_Set
authorfabien <fabien@93ef8e89-cb99-4229-a87c-7fa0fa45744b>
Sun, 13 Dec 2009 08:47:28 +0000 (08:47 +0000)
committerfabien <fabien@93ef8e89-cb99-4229-a87c-7fa0fa45744b>
Sun, 13 Dec 2009 08:47:28 +0000 (08:47 +0000)
git-svn-id: http://svn.twig-project.org/trunk@159 93ef8e89-cb99-4229-a87c-7fa0fa45744b

lib/Twig/Node/Set.php

index 0d367c6..767f567 100644 (file)
@@ -15,6 +15,21 @@ class Twig_Node_Set extends Twig_Node
     $this->values = $values;
   }
 
+  public function __toString()
+  {
+    $repr = array(get_class($this).'('.($this->isMultitarget ? implode(', ', $this->names) : $this->names).',');
+    foreach ($this->isMultitarget ? $this->values : array($this->values) as $node)
+    {
+      foreach (explode("\n", $node->__toString()) as $line)
+      {
+        $repr[] = '  '.$line;
+      }
+    }
+    $repr[] = ')';
+
+    return implode("\n", $repr);
+  }
+
   public function compile($compiler)
   {
     $compiler->addDebugInfo($this);