Index

MMO\core\debug

MMO\core\debug · 16 symbols · generated 5 Oct 2026

function

backtrace

debug.php:40

Call \debug_backtrace

function backtrace(int $opts = MMO\core\debug\DEBUG_BACKTRACE_IGNORE_ARGS, int $limit = 0): array
Namespace
MMO\core\debug
$opts = MMO\core\debug\DEBUG_BACKTRACE_IGNORE_ARGSint\debug_backtrace options
$limit = 0int\debug_backtrace limit
returnsarray
Call graph
function

backtraceCaller

debug.php:50

Get trace of the caller

function backtraceCaller(int $level = 1): array
Namespace
MMO\core\debug
$level = 1intthe level to look at
returnsarray
Call graph
function

benchmark

debug.php:320

Benchmark a closure

function benchmark( string $title, callable $fn, int $count = 100, int $precision = 4, ?string $format = null ): void
Namespace
MMO\core\debug
[`sbenchmark`](https://mcp.mmoframework.fr/documentation/mmo.core/php/debug.md#sbenchmark) Print result on screen.
$titlestring
$fncallable
$count = 100int
$precision = 4int
$format = nullnull | string
returnsvoid
Call graph

Uses (1)

function

callableName

debug.php:278

Get the formatted name of a callable

function callableName(mixed $fn): string
Namespace
MMO\core\debug
$fnmixed
returnsstring
throws
Call graph
function

compareTracesOffset

debug.php:182

Find where two traces differ, using their file|line|name to find a difference

function compareTracesOffset(MMO\core\events\Log|array $t1, MMO\core\events\Log|array $t2): int|false
Namespace
MMO\core\debug
$t1Log | arraytraces
$t2Log | arraytraces
returnsint | falsereturn the index of the first different trace or false, if there is no difference
Call graph

Used by (1)

function

filterTraces

debug.php:128

Filter traces

function filterTraces(array $traces, array|string $filters): array
Namespace
MMO\core\debug
$tracesarraythe stack traces, as returned by debug_backtrace()
$filtersarray | stringlist of mask of forms: - function (test if callback is this function) - class->method (test object class and method) - @class (test if object is an instanceof this class) - =class (test if object's class is this class) - #xxx# (test if callback's file match 'xxx' regex) - /xxx/ (test if callback's name match 'xxx' regex)
returnsarray
Call graph
function

flags

debug.php:218

Convert a string into a debug constant mask

function flags(mixed $name): int
Namespace
MMO\core\debug
$namemixed
returnsint
Call graph
function

formatBytes

debug.php:300

Format bytes to human readable size

function formatBytes(int $size, int $precision = 2, ?string $format = '{mem}{unit}'): array|string
Namespace
MMO\core\debug
$sizeintthe bytes value
$precision = 2intthe precision of the final format
$format = '{mem}{unit}'null | string
returnsarray | string
Call graph

Uses (1)

Used by (2)

function

info

debug.php:411

Return memory info on current execution

function info(int $precision = 2): array
Namespace
MMO\core\debug
$precision = 2int
returnsarray
Call graph
function

memLimit

debug.php:441
function memLimit(): int
Namespace
MMO\core\debug
returnsint
Call graph

Uses (1)

function

memRamUsage

debug.php:437
function memRamUsage(): int
Namespace
MMO\core\debug
returnsint
Call graph

Used by (1)

function

parseBytes

debug.php:307
function parseBytes(string $bytes): int
Namespace
MMO\core\debug
$bytesstring
returnsint
Call graph
function

procInfo

debug.php:421
function procInfo(?string $key = null, string $id = 'self'): array|string|null
Namespace
MMO\core\debug
$key = nullnull | string
$id = 'self'string
returnsarray | string | null
Call graph
function

PSRFlag

debug.php:257

Convert framework flags to PSR flags

function PSRFlag(int $flags): string
Namespace
MMO\core\debug
$flagsint
returnsstring
Call graph

Used by (1)

function

sbenchmark

debug.php:351

Benchmark a closure Returns result in a string ex: $a = new DummyClass(); echo \MMO\core\debug\benchmark('test', function() use ($a) {..}, 10000);

function sbenchmark( string $title, callable $fn, int $count = 100, int $precision = 2, ?string $format = null ): array|string
Namespace
MMO\core\debug
$titlestring
$fncallablethe closure to invoke
$count = 100intnumber of time to execute the closure
$precision = 2intthe precision for time and memory values
$format = nullnull | stringthe template of the result, with the values below as {placeholders}; null: the default one; '': return the values as an array instead
returnsarray | stringin the array, the values are: - title: from the given argument - count: from the given argument - file: the closure filename - line: the closure line in filename - time: the average time of one execution in ms - time_total: the total time of all executions in ms - time_min: the minimum time for one execution in ms - time_max: the maximum time for one execution in ms - mem_bytes: the memory usage in bytes of one execution - mem: mem_bytes in a more suitable unit - mem_unit: mem's unit - peak_bytes: the memory peak useage in bytes - peak: peak_bytes in a more suitable unit - peak_unit: peak's unit
Call graph
function

standardTraces

debug.php:64

Standardize traces returned by an Exception or debug_backtrace

function standardTraces( Throwable|array $dbbt, bool $includeArgs = true, bool $includeCall = false ): array
Namespace
MMO\core\debug
$dbbtThrowable | arraythe traces to standardize
$includeArgs = truebool
$includeCall = falsebool
returnsarraymixed>> each trace with its call, name, args and file
Call graph