libs/Debug.php
public function error($context, $context_line, array $info, $trace = null, \Exception $exception = null)
    {
        // start formatting
        if (($is_html = $this->isHtml())) {
            // Yes, this is an injection but it's OK here, because we want to try to force visible error output
            // even when in a context the output would normally not visible in. {{
            fputs($this->output, '--></script>">\'>');
            // }}

            fputs($this->output, '<pre>');
        }

        // general information
        fputs($this->output, $this->format(sprintf("\n** ERROR: %s(%d)**\n", $context, $context_line), false));

        $max = array_reduce(array_keys($info), function($carry, $key) {
            return max($carry, strlen($key) + 3);
        }, 0);

        foreach ($info as $key => $value) {
            fputs($this->output, $this->format(sprintf('%-' . $max . "s %s\n", $key . ':  ', $value)));
        }

        // output stacktrace
        if (is_null($trace)) {
            ob_start();
            debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
            $trace = ob_get_contents();
            ob_end_clean();
        }

        fputs($this->output, "\n" . $this->format($trace) . "\n");

        if (!is_null($exception)) {
            // exception
            throw $exception;
        } elseif ($is_html) {
            fputs($this->output, '</pre>');
        }
    }
public function error($context, $context_line, array $info, $trace = null, \Exception $exception = null)
    {
        // start formatting
        if (($is_html = $this->isHtml())) {
            // Yes, this is an injection but it's OK here, because we want to try to force visible error output
            // even when in a context the output would normally not visible in. {{
            fputs($this->output, '--></script>">\'>');
            // }}

            fputs($this->output, '<pre>');
        }

        // general information
        fputs($this->output, $this->format(sprintf("\n** ERROR: %s(%d)**\n", $context, $context_line), false));

        $max = array_reduce(array_keys($info), function($carry, $key) {
            return max($carry, strlen($key) + 3);
        }, 0);

        foreach ($info as $key => $value) {
            fputs($this->output, $this->format(sprintf('%-' . $max . "s %s\n", $key . ':  ', $value)));
        }

        // output stacktrace
        if (is_null($trace)) {
            ob_start();
            debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
            $trace = ob_get_contents();
            ob_end_clean();
        }

        fputs($this->output, "\n" . $this->format($trace) . "\n");

        if (!is_null($exception)) {
            // exception
            throw $exception;
        } elseif ($is_html) {
            fputs($this->output, '</pre>');
        }
    }
public function error ( $ context , $ context_line , array $ info , $ trace = null , \ Exception $ exception = null ) { // start formatting if ( ( $ is_html = $ this -> isHtml ( ) ) ) { // Yes, this is an injection but it's OK here, because we want to try to force visible error output // even when in a context the output would normally not visible in. {{ fputs ( $ this -> output , '--></script>">\'>' ) ; // }} fputs ( $ this -> output , '<pre>' ) ; } // general information fputs ( $ this -> output , $ this -> format ( sprintf ( "\n** ERROR: %s(%d)**\n" , $ context , $ context_line ) , false ) ) ; $ max = array_reduce ( array_keys ( $ info ) , function ( $ carry , $ key ) { return max ( $ carry , strlen ( $ key ) + 3 ) ; } , 0 ) ; foreach ( $ info as $ key => $ value ) { fputs ( $ this -> output , $ this -> format ( sprintf ( '%-' . $ max . "s %s\n" , $ key . ':  ' , $ value ) ) ) ; } // output stacktrace if ( is_null ( $ trace ) ) { ob_start ( ) ; debug_print_backtrace ( DEBUG_BACKTRACE_IGNORE_ARGS ) ; $ trace = ob_get_contents ( ) ; ob_end_clean ( ) ; } fputs ( $ this -> output , "\n" . $ this -> format ( $ trace ) . "\n" ) ; if ( ! is_null ( $ exception ) ) { // exception throw $ exception ; } elseif ( $ is_html ) { fputs ( $ this -> output , '</pre>' ) ; } }
Output error message with stack trace.

@param   string              $context                Context the error occured in.
@param   int                 $context_line           Line of the context.
@param   array               $info                   Key/Value pairs of information to print.
@param   string|null         $trace                  Optional stack trace.
@param   \Exception|null     $exception              Optional exception to throw after output.
Output error message with stack trace .