Debugger class

Framework\Debug\Debugger

Class Debugger.

Defined in libraries/debug/src/Debugger.php

Properties #

$collections
Contains the Collections. Keys are the names and values are the Collections.
$options
Contains the debug options. The keys are the names of the options.
$debugbarView
Contains the path to the debugbar view file.
$debugbarEnabled
Tells if the debugbar is enabled.

$collections

protected array $collections = array ( )

Contains the Collections. Keys are the names and values are the Collections.

$options

protected array $options = array ( )

Contains the debug options. The keys are the names of the options.

$debugbarView

protected string $debugbarView = 'D:\\WEBISTERS\\libraries\\debug\\src/Views/debugbar/debugbar.php'

Contains the path to the debugbar view file.

$debugbarEnabled

protected bool $debugbarEnabled = true

Tells if the debugbar is enabled.

Methods #

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

addCollection()

public function addCollection(\Framework\Debug\Collection $collection): static

Add a new Collection.

Parameters
  • \Framework\Debug\Collection $collection
Returns static

addCollector()

public function addCollector(\Framework\Debug\Collector $collector, string $collectionName): static

Add a collector to a collection.

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

Parameters
  • \Framework\Debug\Collector $collector - The collector
  • string $collectionName - The name of the collection
Returns static

convertSize()

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

Convert size to unit of measurement.

Parameters
  • int|float $size - The size in bytes
Returns string - Returns the size with unit of measurement

disableDebugbar()

public function disableDebugbar(): static

Disables debugbar rendering.

Returns static

enableDebugbar()

public function enableDebugbar(): static

Enables debugbar rendering.

Returns static

getActivities()

public function getActivities(): array

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

Returns array

getCollection()

public function getCollection(string $name): ?\Framework\Debug\Collection

Get a Collection by name.

Parameters
  • string $name - The name of the Collection
Returns ?\Framework\Debug\Collection - The collection or null if it does not exist

getCollections()

public function getCollections(): array

Get all Collections.

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

getDebugbarView()

public function getDebugbarView(): string

Get the path of the debugbar view.

Returns string

getOption()

public function getOption(string $name): mixed

Get the value of a debug option.

Parameters
  • string $name - The name of the option
Returns mixed - The value of the option or null

getOptions()

public function getOptions(): array

Get all debug options.

Returns array

isDebugbarEnabled()

public function isDebugbarEnabled(): bool

Tells if debugbar rendering is enabled.

Returns bool

makeDebugValue()

public static function makeDebugValue(mixed $value): string

Make a value into a debug value.

Parameters
  • mixed $value - Any value
Returns string - The value made

makeSafeName()

public static function makeSafeName(string $name): string

Replace a list of characters with hyphens.

Parameters
  • string $name - The name to be updated
Returns string - Returns the name with replacements

renderDebugbar()

public function renderDebugbar(): string

Render the debug bar, if it is enabled.

Returns string - The debug bar (if enabled) or a blank string

roundSecondsToMilliseconds()

public static function roundSecondsToMilliseconds(int|float $seconds, int $precision = 3): float

Round seconds to milliseconds.

Parameters
  • int|float $seconds - The number of seconds
  • int $precision - The number of decimal digits to round
Returns float - Returns the value in milliseconds

roundVersion()

public static function roundVersion(string $version): string

Remove dots and zeros from the end of the version.

Parameters
  • string $version - The version
Returns string - The updated version

setDebugbarView()

public function setDebugbarView(string $file): static

Set the path of the debugbar view.

Parameters
  • string $file - The view file path
Returns static

setOption()

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

Set a debug option.

Parameters
  • string $name - The name of the option
  • mixed $value - The value of the option
Returns static

setOptions()

public function setOptions(array $options): static

Set all debug options.

Parameters
  • array $options - All options
Returns static

addActivityValues()

protected function addActivityValues(array &$activity, float $min, float $max): void

Updates the $activity variable.

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
  • array $activity - Current activity
  • float $min - The minimum time of the collected activities
  • float $max - The maximum time of collected activities
Returns void