output = $output; } public function print($value): void { if (!is_array($value)) { return; } $html[] = ''; $html[] = '
'; $html[] = sprintf( '
Backtrace — last %d call(s)
' . PHP_EOL . PHP_EOL, count($value) ); foreach ($value as $i => $entry) { $file = $entry['file'] ?? '[internal]'; $line = $entry['line'] ?? '-'; $function = ($entry['class'] ?? '') . ($entry['type'] ?? '') . $entry['function']; $html[] = sprintf( '
#%d - %s: Called from %s:%s
', $i + 1, htmlspecialchars($function, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'), htmlspecialchars($file, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'), htmlspecialchars($line, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') ); } $html[] = '
'; $outputCallback = $this->output; $outputCallback(implode('', $html)); } }