Example #1
0
 /**
  * Returns a string representation of the given stack trace.
  *
  * @param array $trace The stack trace to format
  * @return string
  */
 public static function getTraceAsString(array $trace)
 {
     $currentTracePosition = count($trace);
     $formattedTrace = array();
     foreach ($trace as $tracePoint) {
         $formattedTrace[] = sprintf('#%d %s: %s%s(%s)', $currentTracePosition--, isset($tracePoint['file']) ? sprintf('%s(%d)', FileUtil::getRelativeAbleronPath($tracePoint['file']), $tracePoint['line']) : '[internal function]', isset($tracePoint['class']) ? $tracePoint['class'] . $tracePoint['type'] : '', $tracePoint['function'], !empty($tracePoint['args']) ? StringUtil::buildPhpArgumentString($tracePoint['args']) : '');
     }
     return implode(StringUtil::CHAR_LINE_FEED, $formattedTrace);
 }