/** * Dump block node to string. * * @param BlockNode $node block node * @param integer $level indentation level * * @return string */ protected function dumpBlock(BlockNode $node, $level = 0) { $html = ''; $last = ''; $childs = $node->getChilds(); foreach ($childs as $i => $child) { if (!empty($html) && !empty($last)) { $html .= "\n"; } $this->nextExtendsIf[$level] = isset($childs[$i + 1]) && $childs[$i + 1] instanceof CodeNode && preg_match($this->nextExtendsIfRegexp, $childs[$i + 1]->getCode()); $last = $this->dumpNode($child, $level); $html .= $last; } return $html; }