class Helpers

Rendering helpers for Debugger.

Methods

static string
editorLink(string $file, int|null $line = null)

Returns HTML link to editor.

static string|null
editorUri(string $file, int|null $line = null, string $action = 'open', string $search = '', string $replace = '')

Returns link to editor.

static string
formatHtml(string $mask)

Formats an HTML string by replacing each % placeholder with the next argument, HTML-escaped.

static string
escapeHtml(mixed $s)

No description

static string
escapeMd(mixed $s)

No description

static string
htmlToText(string $s)

No description

static array|null
findCallerLocation(array|null $paths = null)

Finds the file+line in user code from which a Tracy call originated.

static int
countTransparentFrames(array $trace, array|null $paths = null)

Returns the index of the first user-visible frame in $trace. A frame is transparent when its file is missing, synthetic, in $paths, or its containing function (trace[n+1]) is annotated @tracySkipLocation.

static array|null
findTrace(array $trace, array|string $method, int|null $index = null)

No description

static string
errorTypeToString(int $type)

No description

static string
getSource()

No description

static void
improveException(Throwable $e)

No description

static string
improveError(string $message)

No description

static string|null
guessClassFile(string $class)

No description

static string|null
getSuggestion(array $items, string $value)

Finds the best suggestion.

static bool
isHtmlMode()

No description

static void
consoleLog(string $data)

No description

static bool
isAgent()

No description

static bool
isRedirect()

No description

static string
createId()

No description

static bool
isCli()

No description

static string|null
getNonce(bool $attr = false)

No description

static string
capture(callable $func)

No description

static string
encodeString(string $s, int|null $maxLength = null, bool $showWhitespaces = true)

No description

static int
utf8Length(string $s)

No description

static bool
isUtf8(string $s)

No description

static string
truncateString(string $s, int $len, bool $utf8)

No description

static string
htmlToAnsi(string $s, array $colors)

No description

static string
minifyJs(string $s)

No description

static string
minifyCss(string $s)

No description

static bool
detectColors()

No description

static array
getExceptionChain(Throwable $ex)

No description

static void
traverseValue(mixed $val, callable $callback, array $skip = [], string|null $refId = null)

No description

static array|null
decomposeFlags(int $flags, bool $set, array $constants)

Decomposes an integer flags value into matching constant names.

static string
jsonEncode(mixed $value, bool $inScript = false)

Encodes a value to JSON safe for use in any HTML context (attributes, script tags, etc.)

Details

Returns HTML link to editor.

Parameters

string $file
int|null $line

Return Value

string

at line 52
static string|null editorUri(string $file, int|null $line = null, string $action = 'open', string $search = '', string $replace = '')

Returns link to editor.

Parameters

string $file
int|null $line
string $action
string $search
string $replace

Return Value

string|null

at line 81
static string formatHtml(string $mask)

Formats an HTML string by replacing each % placeholder with the next argument, HTML-escaped.

Parameters

string $mask

Return Value

string

at line 90
static string escapeHtml(mixed $s)

No description

Parameters

mixed $s

Return Value

string

at line 96
static string escapeMd(mixed $s)

No description

Parameters

mixed $s

Return Value

string

at line 108
static string htmlToText(string $s)

No description

Parameters

string $s

Return Value

string

at line 119
static array|null findCallerLocation(array|null $paths = null)

Finds the file+line in user code from which a Tracy call originated.

Parameters

array|null $paths

defaults to Debugger::$transparentPaths

Return Value

array|null

at line 137
static int countTransparentFrames(array $trace, array|null $paths = null)

internal  
 

Returns the index of the first user-visible frame in $trace. A frame is transparent when its file is missing, synthetic, in $paths, or its containing function (trace[n+1]) is annotated @tracySkipLocation.

Parameters

array $trace
array|null $paths

defaults to Debugger::$transparentPaths

Return Value

int

at line 171
static array|null findTrace(array $trace, array|string $method, int|null $index = null)

No description

Parameters

array $trace
array|string $method
int|null $index

Return Value

array|null

at line 191
static string errorTypeToString(int $type)

internal  
 

No description

Parameters

int $type

Return Value

string

at line 214
static string getSource()

internal  
 

No description

Return Value

string

at line 232
static void improveException(Throwable $e)

internal  
 

No description

Parameters

Throwable $e

Return Value

void

at line 308
static string improveError(string $message)

internal  
 

No description

Parameters

string $message

Return Value

string

at line 322
static string|null guessClassFile(string $class)

internal  
 

No description

Parameters

string $class

Return Value

string|null

at line 351
static string|null getSuggestion(array $items, string $value)

internal  
 

Finds the best suggestion.

Parameters

array $items
string $value

Return Value

string|null

at line 368
static bool isHtmlMode()

internal  
 

No description

Return Value

bool

at line 379
static void consoleLog(string $data)

internal  
 

No description

Parameters

string $data

Return Value

void

at line 386
static bool isAgent()

internal  
 

No description

Return Value

bool

at line 393
static bool isRedirect()

internal  
 

No description

Return Value

bool

at line 400
static string createId()

internal  
 

No description

Return Value

string

at line 407
static bool isCli()

internal  
 

No description

Return Value

bool

at line 414
static string|null getNonce(bool $attr = false)

internal  
 

No description

Parameters

bool $attr

Return Value

string|null

at line 441
static string capture(callable $func)

No description

Parameters

callable $func

Return Value

string

at line 455
static string encodeString(string $s, int|null $maxLength = null, bool $showWhitespaces = true)

internal  
 

No description

Parameters

string $s
int|null $maxLength
bool $showWhitespaces

Return Value

string

at line 517
static int utf8Length(string $s)

internal  
 

No description

Parameters

string $s

Return Value

int

at line 528
static bool isUtf8(string $s)

internal  
 

No description

Parameters

string $s

Return Value

bool

at line 535
static string truncateString(string $s, int $len, bool $utf8)

internal  
 

No description

Parameters

string $s
int $len
bool $utf8

Return Value

string

at line 556
static string htmlToAnsi(string $s, array $colors)

internal  
 

No description

Parameters

string $s
array $colors

Return Value

string

at line 578
static string minifyJs(string $s)

internal  
 

No description

Parameters

string $s

Return Value

string

at line 623
static string minifyCss(string $s)

internal  
 

No description

Parameters

string $s

Return Value

string

at line 661
static bool detectColors()

No description

Return Value

bool

at line 674
static array getExceptionChain(Throwable $ex)

No description

Parameters

Throwable $ex

Return Value

array

at line 689
static void traverseValue(mixed $val, callable $callback, array $skip = [], string|null $refId = null)

No description

Parameters

mixed $val
callable $callback
array $skip
string|null $refId

Return Value

void

at line 723
static array|null decomposeFlags(int $flags, bool $set, array $constants)

internal  
 

Decomposes an integer flags value into matching constant names.

When $set is true, finds all flags set in the value (bitmask decomposition). When $set is false, finds a single constant that equals the value exactly.

Parameters

int $flags
bool $set
array $constants

Return Value

array|null

at line 750
static string jsonEncode(mixed $value, bool $inScript = false)

Encodes a value to JSON safe for use in any HTML context (attributes, script tags, etc.)

Parameters

mixed $value
bool $inScript

Return Value

string