Parser/Node.php
public function text($indentStyle = '  ', $newLine = "\n", $level = 0)
    {

        $indent = str_repeat($indentStyle, $level);
        $texts = [];
        foreach ($this->children as $child) {

            if ($child->type === 'text') {

                $texts[] = $indent.$child->value;
                $texts[] = $child->text($indentStyle, $newLine, $level + 1);
            }
        }

        return implode($newLine, $texts);
    }
public function text($indentStyle = '  ', $newLine = "\n", $level = 0)
    {

        $indent = str_repeat($indentStyle, $level);
        $texts = [];
        foreach ($this->children as $child) {

            if ($child->type === 'text') {

                $texts[] = $indent.$child->value;
                $texts[] = $child->text($indentStyle, $newLine, $level + 1);
            }
        }

        return implode($newLine, $texts);
    }
public function text ( $ indentStyle = '  ' , $ newLine = "\n" , $ level = 0 ) { $ indent = str_repeat ( $ indentStyle , $ level ) ; $ texts = [ ] ; foreach ( $ this -> children as $ child ) { if ( $ child -> type === 'text' ) { $ texts [ ] = $ indent . $ child -> value ; $ texts [ ] = $ child -> text ( $ indentStyle , $ newLine , $ level + 1 ) ; } } return implode ( $ newLine , $ texts ) ; }
Returns all text and child-texts in a single text.

You can control the text-style with the arguments

@param string $indentStyle the indentation to use (multiplies with level)
@param string $newLine     the new-line style to use
@param int    $level       the initial indentation level

@return string the compiled text-block
Returns all text and child - texts in a single text .