protected function getSafeTrace(\Exception $exception)
{
if (!$this->app['debug'] && !($this->app['session']->isStarted() && $this->app['session']->has('authentication'))) {
return [];
}
$rootPath = $this->app['resources']->getPath('root');
$trace = $exception->getTrace();
foreach ($trace as $key => $value) {
$trace[$key]['args_safe'] = $this->getSafeArguments($trace[$key]['args']);
// Don't display the full path, trim 64-char hexadecimal file names.
if (isset($trace[$key]['file'])) {
$trace[$key]['file'] = str_replace($rootPath, '[root]', $trace[$key]['file']);
$trace[$key]['file'] = preg_replace('/([0-9a-f]{16})[0-9a-f]{48}/i', '\\1…', $trace[$key]['file']);
}
}
return $trace;
}