Skip to content

Commit

Permalink
fixed Twig_Node_Module::__toString() to include information about blo…
Browse files Browse the repository at this point in the history
…cks and macros
  • Loading branch information
fabpot committed May 6, 2010
1 parent 0b38082 commit b030645
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions lib/Twig/Node/Module.php
Expand Up @@ -42,22 +42,33 @@ public function __construct(Twig_NodeList $body, $extends, array $blocks, array

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);
Expand Down

0 comments on commit b030645

Please sign in to comment.