Filter.php
public static function filterPlain(Node $node, $indent, $newLine)
    {

        $text = trim($node->text());

        //Normalize newlines to $newLine and append our indent
        $i = 0;

        return implode($newLine, array_map(function ($value) use (
            $indent, $newLine, &$i
        ) {

            if (strlen($indent) < 1 && $i++ !== 0 && strlen($value) > 0) {

                //Make sure we separate with at least one white-space
                $indent = ' ';
            }

            return $indent.trim($value);
        }, explode("\n", $text)));
    }
public static function filterPlain(Node $node, $indent, $newLine)
    {

        $text = trim($node->text());

        //Normalize newlines to $newLine and append our indent
        $i = 0;

        return implode($newLine, array_map(function ($value) use (
            $indent, $newLine, &$i
        ) {

            if (strlen($indent) < 1 && $i++ !== 0 && strlen($value) > 0) {

                //Make sure we separate with at least one white-space
                $indent = ' ';
            }

            return $indent.trim($value);
        }, explode("\n", $text)));
    }
public static function filterPlain ( Node $ node , $ indent , $ newLine ) { $ text = trim ( $ node -> text ( ) ) ; //Normalize newlines to $newLine and append our indent $ i = 0 ; return implode ( $ newLine , array_map ( function ( $ value ) use ( $ indent , $ newLine , & $ i ) { if ( strlen ( $ indent ) < 1 && $ i ++ !== 0 && strlen ( $ value ) > 0 ) { //Make sure we separate with at least one white-space $ indent = ' ' ; } return $ indent . trim ( $ value ) ; } , explode ( "\n" , $ text ) ) ) ; }
A plain-text filter that just corrects indentation and new-lines.

@param Node   $node    the node to be wrapped
@param string $indent  the indentation to use on each child
@param string $newLine the new-line to append after each line

@return string the wrapped PTHML-string
A plain - text filter that just corrects indentation and new - lines .