class PhpCollector extends DataCollector implements Renderable (View source)

Class PhpCollector

This class collects all PHP errors, notices, advice, trigger_error,... Supports 15 different types included.

Properties

protected string $name

Collector name.

protected array<array{message: string, message_html: ?string, is_string: bool, label: string, time: float}> $messages

List of messages. Each item includes: 'message', 'message_html', 'is_string', 'label', 'time'.

Methods

__construct(string $name = 'Error handler')

PHPCollector constructor.

array{count: int, messages: array<array{message: string, message_html: ?string, is_string: bool, label: string, time: float}>}
collect()

Called by the DebugBar when data needs to be collected.

array<array{message: string, message_html: ?string, is_string: bool, label: string, time: float}>
getMessages()

Returns a list of messages ordered by their timestamp.

array<array{icon: string, widget: string, map: string, default: string}|array{map: string, default: string}>
getWidgets()

Returns a hash where keys are control names and their values an array of options as defined in {DebugBar\JavascriptRenderer::addControl()}

string
getName()

Returns the unique name of the collector.

void
errorHandler(int $severity, string $message, string $fileName, int $line)

Exception error handler. Called from constructor with set_error_handler to add all details.

Details

__construct(string $name = 'Error handler')

PHPCollector constructor.

Parameters

string $name

The name used by this collector widget.

array{count: int, messages: array<array{message: string, message_html: ?string, is_string: bool, label: string, time: float}>} collect()

Called by the DebugBar when data needs to be collected.

Return Value

array{count: int, messages: array<array{message: string, message_html: ?string, is_string: bool, label: string, time: float}>}

Array of collected data

array<array{message: string, message_html: ?string, is_string: bool, label: string, time: float}> getMessages()

Returns a list of messages ordered by their timestamp.

Return Value

array<array{message: string, message_html: ?string, is_string: bool, label: string, time: float}>

A list of messages ordered by time.

array<array{icon: string, widget: string, map: string, default: string}|array{map: string, default: string}> getWidgets()

Returns a hash where keys are control names and their values an array of options as defined in {DebugBar\JavascriptRenderer::addControl()}

Return Value

array<array{icon: string, widget: string, map: string, default: string}|array{map: string, default: string}>

Array of details to render the widget.

string getName()

Returns the unique name of the collector.

Return Value

string

The widget name.

void errorHandler(int $severity, string $message, string $fileName, int $line)

Exception error handler. Called from constructor with set_error_handler to add all details.

Parameters

int $severity

Error type.

string $message

Message of error.

string $fileName

File where error is generated.

int $line

Line number where error is generated.

Return Value

void