Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
],
"require": {
"php": "^8.2",
"php-debugbar/php-debugbar": "^3.1",
"php-debugbar/php-debugbar": "^3.3.1",
"php-debugbar/symfony-bridge": "^1.1",
"illuminate/routing": "^11|^12",
"illuminate/session": "^11|^12",
Expand Down
50 changes: 15 additions & 35 deletions src/LaravelDebugbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -635,48 +635,28 @@ protected function isJsonResponse(SymfonyResponse $response): bool
}

/**
* Collects the data from the collectors
*
* Collects meta data about the current request
*/
public function collect(): array
{
$this->data = [
'__meta' => [
'id' => $this->getCurrentRequestId(),
'datetime' => date('Y-m-d H:i:s'),
'utime' => microtime(true),
'method' => $this->request->getMethod(),
'uri' => $this->request->getRequestUri(),
'ip' => $this->request->getClientIp(),
],
public function collectMetaData(): array
{
$meta = [
'id' => $this->getCurrentRequestId(),
'datetime' => date('Y-m-d H:i:s'),
'utime' => microtime(true),
'method' => $this->request->getMethod(),
'uri' => $this->request->getRequestUri(),
'ip' => $this->request->getClientIp(),
];

if ($this->processingJob) {
$this->data['__meta']['method'] = 'JOB';
$this->data['__meta']['uri'] = $this->processingJob->resolveName() . '@' . $this->processingJob->getConnectionName();
$meta['method'] = 'JOB';
$meta['uri'] = $this->processingJob->resolveName() . '@' . $this->processingJob->getConnectionName();
} elseif ($this->app->runningInConsole()) {
$this->data['__meta']['method'] = 'CLI';
$this->data['__meta']['uri'] = implode(' ', (new ArgvInput())->getRawTokens());
}

foreach ($this->collectors as $name => $collector) {
$this->data[$name] = $collector->collect();
}

// Remove all invalid (non UTF-8) characters
array_walk_recursive($this->data, function (&$item): void {
if (is_float($item) && !is_finite($item)) {
$item = '[NON-FINITE FLOAT]';
} elseif (is_string($item) && !mb_check_encoding($item, 'UTF-8')) {
$item = mb_convert_encoding($item, 'UTF-8', 'UTF-8');
}
});

if ($this->storage !== null) {
$this->storage->save($this->getCurrentRequestId(), $this->data);
$meta['method'] = 'CLI';
$meta['uri'] = implode(' ', (new ArgvInput())->getRawTokens());
}

return $this->data;
return $meta;
}

public function terminate(): void
Expand Down
Loading