Skip to content

Commit 27c3cc0

Browse files
authored
Add custom trace formatter helper (php-debugbar#556)
* Add custom trace formatter helper * Fix * Add string trace helper on ExceptionsCollector
1 parent 1d87377 commit 27c3cc0

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

src/DebugBar/DataCollector/ExceptionsCollector.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,26 @@ public function formatExceptionData(Exception $e)
113113
return $this->formatThrowableData($e);
114114
}
115115

116+
/**
117+
* Returns Throwable trace as an formated array
118+
*
119+
* @return array
120+
*/
121+
public function formatTrace(array $trace)
122+
{
123+
return $trace;
124+
}
125+
126+
/**
127+
* Returns Throwable data as an string
128+
*
129+
* @param \Throwable $e
130+
* @return string
131+
*/
132+
public function formatTraceAsString($e)
133+
{
134+
return $e->getTraceAsString();
135+
}
116136
/**
117137
* Returns Throwable data as an array
118138
*
@@ -132,7 +152,7 @@ public function formatThrowableData($e)
132152

133153
$traceHtml = null;
134154
if ($this->isHtmlVarDumperUsed()) {
135-
$traceHtml = $this->getVarDumper()->renderVar($e->getTrace());
155+
$traceHtml = $this->getVarDumper()->renderVar($this->formatTrace($e->getTrace()));
136156
}
137157

138158
return array(
@@ -141,7 +161,7 @@ public function formatThrowableData($e)
141161
'code' => $e->getCode(),
142162
'file' => $this->normalizeFilePath($filePath),
143163
'line' => $e->getLine(),
144-
'stack_trace' => $e->getTraceAsString(),
164+
'stack_trace' => $this->formatTraceAsString($e),
145165
'stack_trace_html' => $traceHtml,
146166
'surrounding_lines' => $lines,
147167
'xdebug_link' => $this->getXdebugLink($filePath, $e->getLine())

0 commit comments

Comments
 (0)