<?php
class StackFrame {
var $frame;
const OFFSET_UNKNOWN = -1;
public function __construct($frame) {
$this->frame = $frame;
}
public function GetMethod() {
$className = Utils::ReadValue($this->frame, "class", "<Unknown>");
if (!empty($className)) {
return "$className::{$this->frame['function']}";
} else {
return $this->frame["function"];
}
}
public function GetILOffset() {
return self::OFFSET_UNKNOWN;
}
public function GetFileName() {
$file = $this->frame["file"];
if (!APP_DEBUG) {
# 在非调试模式下,将服务器的文件系统信息隐藏掉
if (defined("PHP_DOTNET")) {
$file = Strings::Replace($file, PHP_DOTNET, "/wwwroot/docker/ubuntu~/->/");
}
if (defined("APP_PATH")) {
$file = Strings::Replace($file, APP_PATH, "/wwwroot/docker/ubuntu~/->/");
}
} else {
# do nothing
}
$file = Strings::Replace($file, "\\", "/");
$file = Strings::Replace($file,
return $file;
}
public function GetFileLineNumber() {
return $this->frame["line"];
}
public function ToString() {
$file = $this->GetFileName();
$line = $this->GetFileLineNumber();
$function = $this->GetMethod();
return " at $function in $file:line $line";
}
}