Habari\Error::print_backtrace PHP Method

print_backtrace() private static method

Print a backtrace in a format that looks reasonable in both rendered HTML and text
private static print_backtrace ( array $trace = null )
$trace array An optional array of trace data
    private static function print_backtrace($trace = null)
    {
        if (!isset($trace)) {
            $trace = debug_backtrace();
        }
        print "<pre class=\"backtrace\">\n";
        $defaults = array('file' => '[core]', 'line' => '(eval)', 'class' => '', 'type' => '', 'args' => array());
        foreach ($trace as $n => $a) {
            $a = array_merge($defaults, $a);
            if ($a['class'] == 'Error') {
                continue;
            }
            if (strpos($a['file'], HABARI_PATH) === 0) {
                $a['file'] = substr($a['file'], strlen(HABARI_PATH) + 1);
            }
            if (defined('DEBUG_ARGS')) {
                $args = array();
                foreach ($a['args'] as $arg) {
                    $args[] = htmlentities(str_replace(array("\n", "\r"), array("\n   ", ''), var_export($arg, true)));
                }
                $args = implode(",    ", $args);
                if (strlen($args) > 1024) {
                    $args = substr($args, 0, 1021) . '&hellip;';
                }
            } else {
                $args = count($a['args']) == 0 ? ' ' : sprintf(_n(' &hellip;%d arg&hellip; ', ' &hellip;%d args&hellip; ', count($a['args'])), $a['args']);
            }
            printf(_t("%s line %d:\n  %s(%s)\n"), $a['file'], $a['line'], $a['class'] . $a['type'] . $a['function'], $args);
        }
        print "\n</pre>\n";
    }