Bolt\Controller\Exception::getSafeTrace PHP Method

getSafeTrace() protected method

Get an exception trace that is safe to display publicly.
protected getSafeTrace ( Exception $exception ) : array
$exception Exception
return array
    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;
    }