3 use DebugBar\DataCollector\DataCollector;
4 use DebugBar\DataCollector\Renderable;
27 protected $messages = [];
37 set_error_handler([$this,
'errorHandler'], E_ALL);
49 'count' => count($messages),
50 'messages' => $messages,
61 $messages = $this->messages;
63 usort($messages,
function ($itemA, $itemB) {
64 if ($itemA[
'time'] === $itemB[
'time']) {
67 return $itemA[
'time'] < $itemB[
'time'] ? -1 : 1;
85 'widget' =>
'PhpDebugBar.Widgets.MessagesWidget',
86 'map' =>
"$name.messages",
90 'map' =>
"$name.count",
118 for ($i = 0; $i < 15; $i++) {
119 if ($type = $severity & (2 ** $i)) {
121 $this->messages[] = [
122 'message' => $message .
' (' . $fileName .
':' . $line .
')',
123 'message_html' =>
null,
126 'time' => microtime(
true),
145 E_WARNING =>
'WARNING',
147 E_NOTICE =>
'NOTICE',
148 E_CORE_ERROR =>
'CORE_ERROR',
149 E_CORE_WARNING =>
'CORE_WARNING',
150 E_COMPILE_ERROR =>
'COMPILE_ERROR',
151 E_COMPILE_WARNING =>
'COMPILE_WARNING',
152 E_USER_ERROR =>
'USER_ERROR',
153 E_USER_WARNING =>
'USER_WARNING',
154 E_USER_NOTICE =>
'USER_NOTICE',
155 E_STRICT =>
'STRICT',
156 E_RECOVERABLE_ERROR =>
'RECOVERABLE_ERROR',
157 E_DEPRECATED =>
'DEPRECATED',
158 E_USER_DEPRECATED =>
'USER_DEPRECATED',
162 if (isset($errors[$type])) {
163 $result = $errors[$type];
collect()
Called by the DebugBar when data needs to be collected.
getWidgets()
Returns a hash where keys are control names and their values an array of options as defined in {.
__construct($name='Error handler')
PHPCollector constructor.
getMessages()
Returns a list of messages ordered by their timestamp.
getName()
Returns the unique name of the collector.
errorHandler($severity, $message, $fileName, $line)
Exception error handler.
friendlyErrorType($type)
Return error name from error code.
$conf db name
Only used if Module[ID]Name translation string is not found.