DETAILS
%s
', e(print_r($value, true)) ); } return; } /** * Highlights a line of php code with php syntax highlighting * * @param string $str * @return string */ function phpSyntaxHighlight(string $str): string { $regexes = [ 'control' => '/\b(for|foreach|while|class |extends|yield from|yield|echo|fn|implements|try|catch|finally|throw|new|instanceof| parent|final|function|return|unset|static|public|protected|private|count|global|if|else|else if|intval|int|array)\b/', 'bool' => '/(\bnull\b|\btrue\b|\bfalse\b)/', 'string' => [ 'pattern' => '/(\221[^\221]*\221|\222[^\222]*\222)/', 'before' => fn ($s) => str_replace(''', "\221", str_replace('"', "\222", $s)), 'after' => fn ($s) => str_replace("\221", ''', str_replace("\222", '"', $s)), ], 'number' => [ 'pattern' => '/(=\(\s)?(\d+)(?=(\s|;|,|\)|=))/', 'replace' => '$2', 'before' => fn ($s) => str_replace(''', '\'', $s), 'after' => fn ($s) => str_replace('\'', ''', $s), ], 'bracket' => '/(\(|\)|\[|\]|\{|\})/', 'variable' => '/(\$[a-z]\w*)/', ]; if (preg_match('/(^\s*?\*|^\s*?\*\/|^\s*?\/\*|^\s*?\/\/|^\s*?#)/', $str)) { return sprintf('%s', $str); } foreach ($regexes as $label => $regex) { if (is_string($regex)) { $str = preg_replace($regex, '$1', $str); continue; } $str = preg_replace( $regex['pattern'], sprintf('%s', $label, $regex['replace'] ?? '$1'), isset($regex['before']) ? $regex['before']($str) : $str ); $str = isset($regex['after']) ? $regex['after']($str) : $str; } return $str; } /** * Converts an array of lines into a html snippet of code * * @param array $snippet * @param int|null $highlight * @return string */ function makeSnippet(array $snippet, string $file, ?int $highlight = null): string { return implode( "\n", array_reduce( array_keys($snippet), function (array $carry, $key) use ($snippet, $file, $highlight) { $carry[] = sprintf( '
%3$d: %4$s
', ($key + 1 === $highlight ? ' highlight' : ''), urlencode(str_replace('\\', '/', $file)), $key + 1, phpSyntaxHighlight(e($snippet[$key], true)) ); return $carry; }, [] ) ); } /** * Gets all exceptions in the stack and returns them bottom up * * @param array $value * @return array */ function getOrderedExceptionList(array $value): array { $exceptions = [$value]; $current = $value; while (isset($current['previous']) && ($current = $current['previous'])) { $exceptions[] = $current; } return array_reverse($exceptions); } ?>

$exception): ?>

at line
e(count($exception['trace']))]) ?>
$frame): ?>
# in at line with argument 1 ? 's' : '' ?>: (, ', array_map('e', $frame['arguments'])) ?>)