dolibarr 21.0.0-alpha
PhpCollector Class Reference

Class PhpCollector. More...

Inheritance diagram for PhpCollector:
Collaboration diagram for PhpCollector:

Public Member Functions

 __construct ($name='Error handler')
 PHPCollector constructor.
 
 collect ()
 Called by the DebugBar when data needs to be collected.
 
 getMessages ()
 Returns a list of messages ordered by their timestamp.
 
 getWidgets ()
 Returns a hash where keys are control names and their values an array of options as defined in {.
 
 getName ()
 Returns the unique name of the collector.
 
 errorHandler ($severity, $message, $fileName, $line)
 Exception error handler.
 

Private Member Functions

 friendlyErrorType ($type)
 Return error name from error code.
 

Detailed Description

Class PhpCollector.

This class collects all PHP errors, notice, advices, trigger_error,... Supports 15 different types included.

Definition at line 34 of file DolPhpCollector.php.

Constructor & Destructor Documentation

◆ __construct()

PhpCollector::__construct ( $name = 'Error handler')

PHPCollector constructor.

Parameters
string$nameThe name used by this collector widget.

Definition at line 56 of file DolPhpCollector.php.

References name.

Member Function Documentation

◆ collect()

PhpCollector::collect ( )

Called by the DebugBar when data needs to be collected.

Returns
array Array of collected data

Definition at line 67 of file DolPhpCollector.php.

References getMessages().

◆ errorHandler()

PhpCollector::errorHandler ( $severity,
$message,
$fileName,
$line )

Exception error handler.

Called from constructor with set_error_handler to add all details.

Parameters
int$severityError type.
string$messageMessage of error.
string$fileNameFile where error is generated.
int$lineLine number where error is generated.
Returns
void

Definition at line 146 of file DolPhpCollector.php.

References friendlyErrorType().

◆ friendlyErrorType()

PhpCollector::friendlyErrorType ( $type)
private

Return error name from error code.

@info http://php.net/manual/es/errorfunc.constants.php

Parameters
int$typeError code.
Returns
string Error name.

Definition at line 171 of file DolPhpCollector.php.

Referenced by errorHandler().

◆ getMessages()

PhpCollector::getMessages ( )

Returns a list of messages ordered by their timestamp.

Returns
array<array{time:int}> A list of messages ordered by time.
Parameters
array{time:int}$itemA Message A information
array{time:int}$itemB Message B information
Returns
int<-1,1> -1 if Item A before Item B, 0 if same, 1 if later.

Definition at line 81 of file DolPhpCollector.php.

Referenced by collect().

◆ getName()

PhpCollector::getName ( )

Returns the unique name of the collector.

Returns
string The widget name.

Definition at line 131 of file DolPhpCollector.php.

Referenced by getWidgets().

◆ getWidgets()

PhpCollector::getWidgets ( )

Returns a hash where keys are control names and their values an array of options as defined in {.

See also
DebugBar\JavascriptRendereraddControl()}
Returns
array Array of details to render the widget.

Definition at line 109 of file DolPhpCollector.php.

References getName().


The documentation for this class was generated from the following file: