public function cleanNewlines($string) {
        if ($max = $this->getConfig('maxNewlines')) {
            $string = preg_replace('/\n{' . ($max + 1) . ',}/', str_repeat("\n", $max), $string);
        }

        return trim($string);
    }
public function cleanNewlines($string) {
        if ($max = $this->getConfig('maxNewlines')) {
            $string = preg_replace('/\n{' . ($max + 1) . ',}/', str_repeat("\n", $max), $string);
        }

        return trim($string);
    }
public function cleanNewlines ( $ string ) { if ( $ max = $ this -> getConfig ( 'maxNewlines' ) ) { $ string = preg_replace ( '/\n{' . ( $ max + 1 ) . ',}/' , str_repeat ( "\n" , $ max ) , $ string ) ; } return trim ( $ string ) ; }
Remove any newlines above the max.

@param string $string
@return string
Remove any newlines above the max .