Swat/SwatError.php
public function toString()
    {
        ob_start();

        printf(
            "%s:\n\nMessage:\n\t%s\n\n" . "In file '%s' on line %s.\n\n",
            $this->getSeverityString(),
            $this->message,
            $this->file,
            $this->line
        );

        echo "Stack Trace:\n";
        $count = count($this->backtrace);

        foreach ($this->backtrace as $entry) {
            $class = array_key_exists('class', $entry) ? $entry['class'] : null;

            $function = array_key_exists('function', $entry)
                ? $entry['function']
                : null;

            if (array_key_exists('args', $entry)) {
                $arguments = $this->getArguments(
                    $entry['args'],
                    $function,
                    $class
                );
            } else {
                $arguments = '';
            }

            printf(
                "%s. In file '%s' on line %s.\n%sMethod: %s%s%s(%s)\n",
                str_pad(--$count, 6, ' ', STR_PAD_LEFT),
                array_key_exists('file', $entry) ? $entry['file'] : 'unknown',
                array_key_exists('line', $entry) ? $entry['line'] : 'unknown',
                str_repeat(' ', 8),
                $class === null ? '' : $class,
                array_key_exists('type', $entry) ? $entry['type'] : '',
                $function === null ? '' : $function,
                $arguments
            );
        }

        echo "\n";

        return ob_get_clean();
    }
public function toString()
    {
        ob_start();

        printf(
            "%s:\n\nMessage:\n\t%s\n\n" . "In file '%s' on line %s.\n\n",
            $this->getSeverityString(),
            $this->message,
            $this->file,
            $this->line
        );

        echo "Stack Trace:\n";
        $count = count($this->backtrace);

        foreach ($this->backtrace as $entry) {
            $class = array_key_exists('class', $entry) ? $entry['class'] : null;

            $function = array_key_exists('function', $entry)
                ? $entry['function']
                : null;

            if (array_key_exists('args', $entry)) {
                $arguments = $this->getArguments(
                    $entry['args'],
                    $function,
                    $class
                );
            } else {
                $arguments = '';
            }

            printf(
                "%s. In file '%s' on line %s.\n%sMethod: %s%s%s(%s)\n",
                str_pad(--$count, 6, ' ', STR_PAD_LEFT),
                array_key_exists('file', $entry) ? $entry['file'] : 'unknown',
                array_key_exists('line', $entry) ? $entry['line'] : 'unknown',
                str_repeat(' ', 8),
                $class === null ? '' : $class,
                array_key_exists('type', $entry) ? $entry['type'] : '',
                $function === null ? '' : $function,
                $arguments
            );
        }

        echo "\n";

        return ob_get_clean();
    }
public function toString ( ) { ob_start ( ) ; printf ( "%s:\n\nMessage:\n\t%s\n\n" . "In file '%s' on line %s.\n\n" , $ this -> getSeverityString ( ) , $ this -> message , $ this -> file , $ this -> line ) ; echo "Stack Trace:\n" ; $ count = count ( $ this -> backtrace ) ; foreach ( $ this -> backtrace as $ entry ) { $ class = array_key_exists ( 'class' , $ entry ) ? $ entry [ 'class' ] : null ; $ function = array_key_exists ( 'function' , $ entry ) ? $ entry [ 'function' ] : null ; if ( array_key_exists ( 'args' , $ entry ) ) { $ arguments = $ this -> getArguments ( $ entry [ 'args' ] , $ function , $ class ) ; } else { $ arguments = '' ; } printf ( "%s. In file '%s' on line %s.\n%sMethod: %s%s%s(%s)\n" , str_pad ( -- $ count , 6 , ' ' , STR_PAD_LEFT ) , array_key_exists ( 'file' , $ entry ) ? $ entry [ 'file' ] : 'unknown' , array_key_exists ( 'line' , $ entry ) ? $ entry [ 'line' ] : 'unknown' , str_repeat ( ' ' , 8 ) , $ class === null ? '' : $ class , array_key_exists ( 'type' , $ entry ) ? $ entry [ 'type' ] : '' , $ function === null ? '' : $ function , $ arguments ) ; } echo "\n" ; return ob_get_clean ( ) ; }
Gets this error as a nicely formatted text block

This is useful for text-based logs and emails.

@return string this error formatted as text.
Gets this error as a nicely formatted text block