protected function cleanupOutput($output)
    {
        $lines = explode("\n", $output);
        foreach ($lines as $index => $line) {
            $line = trim(preg_replace('/^[-,]+/', '', $line, 1));
            $line = preg_replace('/\s\s+/', ' ', $line);
            $lines[$index] = $line;
        }
        // Remove empty lines.
        $lines = array_filter($lines);

        return implode("\n", $lines);
    }
protected function cleanupOutput($output)
    {
        $lines = explode("\n", $output);
        foreach ($lines as $index => $line) {
            $line = trim(preg_replace('/^[-,]+/', '', $line, 1));
            $line = preg_replace('/\s\s+/', ' ', $line);
            $lines[$index] = $line;
        }
        // Remove empty lines.
        $lines = array_filter($lines);

        return implode("\n", $lines);
    }
protected function cleanupOutput ( $ output ) { $ lines = explode ( "\n" , $ output ) ; foreach ( $ lines as $ index => $ line ) { $ line = trim ( preg_replace ( '/^[-,]+/' , '' , $ line , 1 ) ) ; $ line = preg_replace ( '/\s\s+/' , ' ' , $ line ) ; $ lines [ $ index ] = $ line ; } // Remove empty lines. $ lines = array_filter ( $ lines ) ; return implode ( "\n" , $ lines ) ; }
Removes empty lines, leading punctuation, excess whitespace.

@param string $output The output that needs cleanup.

@return string The cleaned up output.
Removes empty lines leading punctuation excess whitespace .