From: fabien Date: Sun, 13 Dec 2009 08:47:28 +0000 (+0000) Subject: added __toString() to Node_Set X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=e2f8adb86aea1005c716d9abb1395a34267bec94;p=konrad%2Ftwig.git added __toString() to Node_Set git-svn-id: http://svn.twig-project.org/trunk@159 93ef8e89-cb99-4229-a87c-7fa0fa45744b --- diff --git a/lib/Twig/Node/Set.php b/lib/Twig/Node/Set.php index 0d367c6..767f567 100644 --- a/lib/Twig/Node/Set.php +++ b/lib/Twig/Node/Set.php @@ -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);