41 public function getTrace(
int $start = 0, ?array $trace =
null) : array{
43 if(function_exists(
"xdebug_get_function_stack") && count($trace = @xdebug_get_function_stack()) !== 0){
44 $trace = array_reverse($trace);
46 $e = new \Exception();
47 $trace = $e->getTrace();
53 for($i = $start; isset($trace[$i]); ++$i, ++$j){
55 if(isset($trace[$i][
"args"]) or isset($trace[$i][
"params"])){
56 if(isset($trace[$i][
"args"])){
57 $args = $trace[$i][
"args"];
59 $args = $trace[$i][
"params"];
61 foreach($args as $name => $value){
62 $params .= (is_object($value) ? get_class($value) .
" " . (method_exists($value,
"__toString") ? $value->__toString() :
"object") : gettype($value) .
" " . @strval($value)) .
", ";
65 $messages[] =
"#$j " . (isset($trace[$i][
"file"]) ? $this->cleanPath($trace[$i][
"file"]) :
"") .
"(" . (isset($trace[$i][
"line"]) ? $trace[$i][
"line"] :
"") .
"): " . (isset($trace[$i][
"class"]) ? $trace[$i][
"class"] . (($trace[$i][
"type"] ===
"dynamic" or $trace[$i][
"type"] ===
"->") ?
"->" :
"::") :
"") . $trace[$i][
"function"] .
"(" . substr($params, 0, -2) .
")";