From e4afc9fd7b14eaa6fe4d52998ffee570f688035b Mon Sep 17 00:00:00 2001 From: fabien Date: Sun, 13 Dec 2009 12:22:53 +0000 Subject: [PATCH] added __toString() to Node_If git-svn-id: http://svn.twig-project.org/trunk@163 93ef8e89-cb99-4229-a87c-7fa0fa45744b --- lib/Twig/Node/If.php | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/lib/Twig/Node/If.php b/lib/Twig/Node/If.php index 4cb6869..6763ee7 100644 --- a/lib/Twig/Node/If.php +++ b/lib/Twig/Node/If.php @@ -29,6 +29,29 @@ class Twig_Node_If extends Twig_Node implements Twig_NodeListInterface $this->else = $else; } + public function __toString() + { + $repr = array(get_class($this).'('); + foreach ($this->tests as $test) + { + foreach (explode("\n", $test[0].' => '.$test[1]) as $line) + { + $repr[] = ' '.$line; + } + } + $repr[] = ')'; + + if ($this->else) + { + foreach (explode("\n", $this->else) as $line) + { + $repr[] = ' '.$line; + } + } + + return implode("\n", $repr); + } + public function getNodes() { $nodes = array(); -- 1.7.2.5