protected final function split($text, $keepEmpty = false)
    {
        $lines = array_map(function ($line) {
            return trim($line);
        }, explode("\n", $text));

        if (!$keepEmpty) {
            $lines = array_filter($lines);
            return array_values($lines);
        }

        return $lines;
    }
protected final function split($text, $keepEmpty = false)
    {
        $lines = array_map(function ($line) {
            return trim($line);
        }, explode("\n", $text));

        if (!$keepEmpty) {
            $lines = array_filter($lines);
            return array_values($lines);
        }

        return $lines;
    }
protected final function split ( $ text , $ keepEmpty = false ) { $ lines = array_map ( function ( $ line ) { return trim ( $ line ) ; } , explode ( "\n" , $ text ) ) ; if ( ! $ keepEmpty ) { $ lines = array_filter ( $ lines ) ; return array_values ( $ lines ) ; } return $ lines ; }
Splits text on newlines filtering out empty lines.

@param $text
@param bool $keepEmpty
@return array
Splits text on newlines filtering out empty lines .