fixed Twig_Node_Module::__toString() to include information about blocks and macros

This commit is contained in:
Fabien Potencier
2010-05-06 08:14:28 +02:00
parent 0b38082d58
commit b030645847
+14 -3
View 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);