1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-01-29 03:07:42 +01:00

Add custom trace formatter helper (#556)

* Add custom trace formatter helper

* Fix

* Add string trace helper on ExceptionsCollector
This commit is contained in:
parallels999 2023-09-19 14:51:44 -05:00 committed by GitHub
parent 1d87377810
commit 27c3cc05ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -113,6 +113,26 @@ class ExceptionsCollector extends DataCollector implements Renderable
return $this->formatThrowableData($e);
}
/**
* Returns Throwable trace as an formated array
*
* @return array
*/
public function formatTrace(array $trace)
{
return $trace;
}
/**
* Returns Throwable data as an string
*
* @param \Throwable $e
* @return string
*/
public function formatTraceAsString($e)
{
return $e->getTraceAsString();
}
/**
* Returns Throwable data as an array
*
@ -132,7 +152,7 @@ class ExceptionsCollector extends DataCollector implements Renderable
$traceHtml = null;
if ($this->isHtmlVarDumperUsed()) {
$traceHtml = $this->getVarDumper()->renderVar($e->getTrace());
$traceHtml = $this->getVarDumper()->renderVar($this->formatTrace($e->getTrace()));
}
return array(
@ -141,7 +161,7 @@ class ExceptionsCollector extends DataCollector implements Renderable
'code' => $e->getCode(),
'file' => $this->normalizeFilePath($filePath),
'line' => $e->getLine(),
'stack_trace' => $e->getTraceAsString(),
'stack_trace' => $this->formatTraceAsString($e),
'stack_trace_html' => $traceHtml,
'surrounding_lines' => $lines,
'xdebug_link' => $this->getXdebugLink($filePath, $e->getLine())