function StackTraceFormatter::writeFrames
@phan-suppress-next-line PhanTypeMismatchDeclaredParam @psalm-param Frames $frames @phan-suppress-next-line PhanTypeMismatchDeclaredParam @psalm-param Frames|null $enclosing
1 call to StackTraceFormatter::writeFrames()
- StackTraceFormatter::format in vendor/
open-telemetry/ sdk/ Common/ Exception/ StackTraceFormatter.php - Formats an exception in a java-like format.
File
-
vendor/
open-telemetry/ sdk/ Common/ Exception/ StackTraceFormatter.php, line 74
Class
- StackTraceFormatter
- @psalm-type Frame = array{ function: string, class: ?class-string, file: ?string, line: ?int, } @psalm-type Frames = non-empty-list<Frame>
Namespace
OpenTelemetry\SDK\Common\ExceptionCode
private static function writeFrames(string &$s, array $frames, ?array $enclosing) : void {
$n = count($frames);
if ($enclosing) {
for ($m = count($enclosing); $n && $m && $frames[$n - 1] === $enclosing[$m - 1]; $n--, $m--) {
}
}
for ($i = 0; $i < $n; $i++) {
$frame = $frames[$i];
self::writeNewline($s, 1);
$s .= 'at ';
if ($frame['class'] !== null) {
$s .= self::formatName($frame['class']);
$s .= '.';
}
$s .= self::formatName($frame['function']);
$s .= '(';
if ($frame['file'] !== null) {
$s .= basename($frame['file']);
if ($frame['line']) {
$s .= ':';
$s .= $frame['line'];
}
}
else {
$s .= 'Unknown Source';
}
$s .= ')';
}
if ($n !== count($frames)) {
self::writeNewline($s, 1);
$s .= sprintf('... %d more', count($frames) - $n);
}
}