public function getChainedTrace(Exception $e) { $stackTrace = $e->getStackTrace(); $trace = array(); foreach ($stackTrace as $exception) { $exceptionTrace = $exception->getTrace(); $trace[] = array('exception' => get_class($exception), 'code' => $exception->getCode(), 'message' => $exception->getMessage(), 'function' => $exceptionTrace[0]['function'], 'file' => self::getSafeFilePath($exception->getFile()), 'line' => $exception->getLine(), 'trace' => $exception->getTraceAsString()); if (isset($exceptionTrace['class'])) { $trace['class'] = $exceptionTrace[0]['class']; $trace['type'] = $exceptionTrace[0]['type']; } } return $trace; }