public static function formatFrame($ti, $html = null, $context_lines = 2)
{
if ($html === null) {
$html = ini_get('html_errors') ? true : false;
}
$context = false;
if ($context_lines && isset($ti['file']) && isset($ti['line']) && $ti['file'] && $ti['line']) {
$context = self::formatSourceLines($ti['file'], $ti['line'], $html, $context_lines);
}
$args = '()';
if (isset($ti['args'])) {
$argsCnt = count($ti['args']);
if ($argsCnt > 0) {
$args = '(' . $argsCnt . ')';
}
}
$str = $html ? '<span class="function">' : '';
$str .= (isset($ti['type']) ? $ti['class'] . $ti['type'] : '::') . $ti['function'] . $args;
if ($html) {
$str .= '</span>';
}
$str .= ' called in ';
$str .= $html ? '<span class="location">' : '';
$str .= isset($ti['file']) && $ti['file'] ? h(gb_relpath(gb::$site_dir, $ti['file'])) : '?';
$str .= isset($ti['line']) && $ti['line'] ? ':' . $ti['line'] : '';
$str .= $html ? '</span>' : '';
if ($context) {
$str .= $html ? '<pre class="context">' . $context . '</pre>' : "\n\n" . $context . "\n\n";
}
return $str;
}