Aplus Framework Docs

Debugger
in package

Class Debugger.

Table of Contents

$collections  : array<string|int, mixed>
Contains the Collections.
$debugbarEnabled  : bool
Tells if the debugbar is enabled.
$debugbarView  : string
Contains the path to the debugbar view file.
$options  : array<string|int, mixed>
Contains the debug options.
addCollection()  : static
Add a new Collection.
addCollector()  : static
Add a collector to a collection.
convertSize()  : string
Convert size to unit of measurement.
disableDebugbar()  : static
Disables debugbar rendering.
enableDebugbar()  : static
Enables debugbar rendering.
getActivities()  : array<string, mixed>
Get an array with the minimum, maximum, and total execution times for all activities. Also, returns an array with all collected activities.
getCollection()  : Collection|null
Get a Collection by name.
getCollections()  : array<string, Collection>
Get all Collections.
getDebugbarView()  : string
Get the path of the debugbar view.
getOption()  : mixed
Get the value of a debug option.
getOptions()  : array<string, mixed>
Get all debug options.
isDebugbarEnabled()  : bool
Tells if debugbar rendering is enabled.
makeDebugValue()  : string
Make a value into a debug value.
makeSafeName()  : string
Replace a list of characters with hyphens.
renderDebugbar()  : string
Render the debug bar, if it is enabled.
roundSecondsToMilliseconds()  : float
Round seconds to milliseconds.
roundVersion()  : string
Remove dots and zeros from the end of the version.
setDebugbarView()  : static
Set the path of the debugbar view.
setOption()  : static
Set a debug option.
setOptions()  : static
Set all debug options.
addActivityValues()  : void
Updates the $activity variable.

Properties

$collections

Contains the Collections.

protected array<string|int, mixed> $collections = []

Keys are the names and values are the Collections.

$debugbarEnabled

Tells if the debugbar is enabled.

protected bool $debugbarEnabled = true

$debugbarView

Contains the path to the debugbar view file.

protected string $debugbarView = __DIR__ . '/Views/debugbar/debugbar.php'

$options

Contains the debug options.

protected array<string|int, mixed> $options = []

The keys are the names of the options.

Methods

addCollection()

Add a new Collection.

public addCollection(Collection $collection) : static
Parameters
$collection : Collection
Return values
static —

addCollector()

Add a collector to a collection.

public addCollector(Collector $collector, string $collectionName) : static

If a collection with the given name does not exist, a new one will be created.

Parameters
$collector : Collector

The collector

$collectionName : string

The name of the collection

Return values
static —

convertSize()

Convert size to unit of measurement.

public static convertSize(float|int $size) : string
Parameters
$size : float|int

The size in bytes

Return values
string —

Returns the size with unit of measurement

disableDebugbar()

Disables debugbar rendering.

public disableDebugbar() : static
Tags
since
4.2
Return values
static —

enableDebugbar()

Enables debugbar rendering.

public enableDebugbar() : static
Tags
since
4.2
Return values
static —

getActivities()

Get an array with the minimum, maximum, and total execution times for all activities. Also, returns an array with all collected activities.

public getActivities() : array<string, mixed>
Return values
array<string, mixed> —

getCollection()

Get a Collection by name.

public getCollection(string $name) : Collection|null
Parameters
$name : string

The name of the Collection

Return values
Collection|null —

The collection or null if it does not exist

getCollections()

Get all Collections.

public getCollections() : array<string, Collection>
Return values
array<string, Collection> —

An array where the keys are the names of the collections and the values are the collections

getDebugbarView()

Get the path of the debugbar view.

public getDebugbarView() : string
Return values
string —

getOption()

Get the value of a debug option.

public getOption(string $name) : mixed
Parameters
$name : string

The name of the option

Tags
since
4.5
Return values
mixed —

The value of the option or null

getOptions()

Get all debug options.

public getOptions() : array<string, mixed>
Return values
array<string, mixed> —

isDebugbarEnabled()

Tells if debugbar rendering is enabled.

public isDebugbarEnabled() : bool
Tags
since
4.2
Return values
bool —

makeDebugValue()

Make a value into a debug value.

public static makeDebugValue(mixed $value) : string
Parameters
$value : mixed

Any value

Return values
string —

The value made

makeSafeName()

Replace a list of characters with hyphens.

public static makeSafeName(string $name) : string
Parameters
$name : string

The name to be updated

Return values
string —

Returns the name with replacements

renderDebugbar()

Render the debug bar, if it is enabled.

public renderDebugbar() : string
Return values
string —

The debug bar (if enabled) or a blank string

roundSecondsToMilliseconds()

Round seconds to milliseconds.

public static roundSecondsToMilliseconds(float|int $seconds[, int $precision = 3 ]) : float
Parameters
$seconds : float|int

The number of seconds

$precision : int = 3

The number of decimal digits to round

Return values
float —

Returns the value in milliseconds

roundVersion()

Remove dots and zeros from the end of the version.

public static roundVersion(string $version) : string
Parameters
$version : string

The version

Return values
string —

The updated version

setDebugbarView()

Set the path of the debugbar view.

public setDebugbarView(string $file) : static
Parameters
$file : string

The view file path

Return values
static —

setOption()

Set a debug option.

public setOption(string $name, mixed $value) : static
Parameters
$name : string

The name of the option

$value : mixed

The value of the option

Tags
since
4.5
Return values
static —

setOptions()

Set all debug options.

public setOptions(array<string, mixed> $options) : static
Parameters
$options : array<string, mixed>

All options

Return values
static —

addActivityValues()

Updates the $activity variable.

protected addActivityValues(array<string, mixed> &$activity, float $min, float $max) : void

Adds the "total" key representing the total execution time.

Adds the "left" and "width" keys representing the CSS margin-left and width properties used to create the time bar.

Parameters
$activity : array<string, mixed>

Current activity

$min : float

The minimum time of the collected activities

$max : float

The maximum time of collected activities

Return values
void —

Search results