+ foreach (self::parseBacktrace($backTrace, $showArgs, $maxArgLen) as $idx => $trace) {
+ $message .= sprintf("#%s %s\n", $idx, $trace);
+ }
+ $message .= sprintf("#%s {main}\n", 1+$idx);
+ return $message;
+ }
+
+ /**
+ * Render a backtrace array as an array
+ *
+ * @param array $backTrace array of stack frames
+ * @param boolean $showArgs TRUE if we should try to display content of function arguments (which could be sensitive); FALSE to display only the type of each function argument
+ * @param int $maxArgLen maximum number of characters to show from each argument string
+ * @return array
+ * @see debug_backtrace
+ * @see Exception::getTrace()
+ */
+ static function parseBacktrace($backTrace, $showArgs = TRUE, $maxArgLen = 80) {
+ $ret = array();
+ foreach ($backTrace as $trace) {