public function format($html = false) {
        $format  = '%s: %s';

        if ($this->lastLine > 0) {
            $format .= PHP_EOL;
            $format .= 'From line %d, column %d; ' ;
            $format .= 'to line %d, column %d';
        }

        $message = sprintf(
            $format,
            $html ? '<strong>' . $this->type . '</strong>' : $this->type,
            $html ? htmlentities($this->text, ENT_COMPAT, 'UTF-8') : $this->text,
            $this->firstLine,
            $this->firstColumn,
            $this->lastLine,
            $this->lastColumn
        );

        if (!$html) {
            return $message . PHP_EOL . $this->extract;
        }

        // Check if the user has specified a custom highlighter
        if ($this->highlighter) {
            $highlighter = $this->highlighter;
            $extract = $highlighter($this->extract, $this->hiliteStart, $this->hiliteLength);
        } else {
            $extract = $this->highlight($this->extract, $this->hiliteStart, $this->hiliteLength);
        }

        $message .= PHP_EOL . $extract;
        return nl2br($message, false);
    }
public function format($html = false) {
        $format  = '%s: %s';

        if ($this->lastLine > 0) {
            $format .= PHP_EOL;
            $format .= 'From line %d, column %d; ' ;
            $format .= 'to line %d, column %d';
        }

        $message = sprintf(
            $format,
            $html ? '<strong>' . $this->type . '</strong>' : $this->type,
            $html ? htmlentities($this->text, ENT_COMPAT, 'UTF-8') : $this->text,
            $this->firstLine,
            $this->firstColumn,
            $this->lastLine,
            $this->lastColumn
        );

        if (!$html) {
            return $message . PHP_EOL . $this->extract;
        }

        // Check if the user has specified a custom highlighter
        if ($this->highlighter) {
            $highlighter = $this->highlighter;
            $extract = $highlighter($this->extract, $this->hiliteStart, $this->hiliteLength);
        } else {
            $extract = $this->highlight($this->extract, $this->hiliteStart, $this->hiliteLength);
        }

        $message .= PHP_EOL . $extract;
        return nl2br($message, false);
    }
public function format ( $ html = false ) { $ format = '%s: %s' ; if ( $ this -> lastLine > 0 ) { $ format .= PHP_EOL ; $ format .= 'From line %d, column %d; ' ; $ format .= 'to line %d, column %d' ; } $ message = sprintf ( $ format , $ html ? '<strong>' . $ this -> type . '</strong>' : $ this -> type , $ html ? htmlentities ( $ this -> text , ENT_COMPAT , 'UTF-8' ) : $ this -> text , $ this -> firstLine , $ this -> firstColumn , $ this -> lastLine , $ this -> lastColumn ) ; if ( ! $ html ) { return $ message . PHP_EOL . $ this -> extract ; } // Check if the user has specified a custom highlighter if ( $ this -> highlighter ) { $ highlighter = $ this -> highlighter ; $ extract = $ highlighter ( $ this -> extract , $ this -> hiliteStart , $ this -> hiliteLength ) ; } else { $ extract = $ this -> highlight ( $ this -> extract , $ this -> hiliteStart , $ this -> hiliteLength ) ; } $ message .= PHP_EOL . $ extract ; return nl2br ( $ message , false ) ; }
Format the message in readable format

@param  boolean $html Whether to return an HTML-representation or not
@return string
Format the message in readable format