Skip to content

Commit a3bfa9f

Browse files
committed
update
1 parent f7298de commit a3bfa9f

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/DebuggerTool.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -423,9 +423,10 @@ public function getQueriesTabPaneTabPaneResult(int $requestId, Query $query, int
423423
} else if (is_array($query->result)) {
424424
$html[] = '<tr><th>#</th><th>Table</th><th>Field</th><th>Value</th></tr>';
425425
$html[] = '</thead><tbody>';
426+
/** @var array<string, array<string, mixed>> $tables */
426427
foreach ($query->result as $i => $tables) {
427428
$f = 0;
428-
$fc = array_sum(array_map('count', $tables));
429+
$fc = array_sum(array_map(fn($x) => count($x), $tables));
429430
foreach ($tables as $table => $fields) {
430431
$t = 0;
431432
$tc = count($fields);
@@ -465,9 +466,10 @@ public function getQueriesTabPaneTabPaneExplain(int $requestId, Query $query, in
465466
} else if (is_array($query->explain)) {
466467
$html[] = '<tr><th>#</th><th>Table</th><th>Field</th><th>Value</th></tr>';
467468
$html[] = '</thead><tbody>';
469+
/** @var array<string, array<string, mixed>> $tables */
468470
foreach ($query->explain as $i => $tables) {
469471
$f = 0;
470-
$fc = array_sum(array_map("count", $tables));
472+
$fc = array_sum(array_map(fn($x) => count($x), $tables));
471473
foreach ($tables as $table => $fields) {
472474
$t = 0;
473475
$tc = count($fields);
@@ -570,9 +572,9 @@ public function getApiCallsTabPane(int $requestId, Request $request): string
570572
$tables['details']['data_received'] = $call->body ? '<a href="data:application/json;charset=UTF-8;base64,' . base64_encode($call->body) . '">View (' . strlen($call->body) . ' bytes)</a>' : '-';
571573
$tables['details']['headers_sent'] = $call->headers ? '<a href="data:application/json;charset=UTF-8;base64,' . base64_encode(json_encode($call->headers, JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES + JSON_UNESCAPED_UNICODE) ?: '') . '">' . count($call->headers) . ' headers</a>' : '-';
572574
$tables['details']['headers_received'] = $call->responseHeaders ? '<a href="data:application/json;charset=UTF-8;base64,' . base64_encode(json_encode($call->responseHeaders, JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES + JSON_UNESCAPED_UNICODE) ?: '') . '">' . count($call->responseHeaders) . ' headers</a>' : '-';
573-
$tables['timing'] = array_map(function ($v) {
575+
$tables['timing'] = array_map(function (float $v) {
574576
return sprintf('%.2f ms', $v * 1000);
575-
}, $call->timing);
577+
}, $call->timing->toArray());
576578

577579
$tables['options'] = $call->options;
578580
foreach ($tables as $table => $fields) {
@@ -618,7 +620,7 @@ public function getCacheTabPane(int $requestId, Request $request): string
618620

619621
$html[] = '<tr>';
620622
$html[] = '<td>' . strtoupper($call->command) . ' ' . implode(' ', $call->arguments) . '</td>';
621-
$html[] = '<td>' . $call->result . '</td>';
623+
$html[] = '<td>' . htmlspecialchars(is_string($call->result) ? $call->result : '') . '</td>';
622624
$html[] = '<td>' . sprintf('%.2f ms', $call->duration * 1000) . '</td>';
623625
$html[] = '</tr>';
624626
}

0 commit comments

Comments
 (0)