Skip to content
PHP Ecosystem
Explore

DbQueryRenderer

API reference › Debug Core › Panel › Db › DbQueryRenderer

final classPHPForge\Debug\Panel\Db\DbQueryRenderer
Sourcesrc/Panel/Db/DbQueryRenderer.php

Renders the typed cells of the queries grid for the DB debug panel.

MethodDescriptionDefined by
renderDurationCell() staticRenders the statement duration formatted as N.N ms.DbQueryRenderer
renderNPlusOneSummary() staticRenders an actionable summary linking each potential N+1 group to its first query.DbQueryRenderer
renderQueryCell() staticRenders the SQL statement column with its optional collapsed backtrace and EXPLAIN toggle.DbQueryRenderer
renderRowsCell() staticRenders the rows-affected cell, falling back to an en dash (–) when the driver did not report the count.DbQueryRenderer
renderTimeCell() staticRenders the capture time as H:i:s.mmm, derived from the row’s millisecond timestamp.DbQueryRenderer
renderTypeCell() staticRenders the statement-type pill (SELECT, INSERT, UPDATE, …), tinted by its vocabulary verb.DbQueryRenderer
public static function renderDurationCell(PHPForge\Debug\Panel\Db\QueryRow $row): string

Renders the statement duration formatted as N.N ms.

Parameters

ParameterTypeDescription
$rowQueryRow

Returns

string

public static function renderNPlusOneSummary(list<PHPForge\Debug\Panel\Db\NPlusOneFinding> $findings, string $context = ''): string

Renders an actionable summary linking each potential N+1 group to its first query.

Parameters

ParameterTypeDescription
$findingslist<NPlusOneFinding>
$contextstringOptional plain-text scope appended to the visible heading and accessible label.

Returns

string

public static function renderQueryCell(PHPForge\Debug\Panel\Db\QueryRow $row, Closure(array<string, mixed>): string $traceLine, bool $hasExplain, callable(int): string $explainUrlBuilder, PHPForge\Debug\Panel\Db\NPlusOneFinding|null $nPlusOneFinding = null): string

Renders the SQL statement column with its optional collapsed backtrace and EXPLAIN toggle.

The caller supplies a URL builder so the renderer stays free of routing concerns and easy to test in isolation (typically static fn(int $seq) => Url::to(['db-explain', 'seq' => $seq, ...])).

Parameters

ParameterTypeDescription
$rowQueryRowTyped query record.
$traceLineClosure(array<string, mixed>): stringRenders one backtrace frame as a link line.
$hasExplainbooltrue when the active driver supports EXPLAIN; the row must also be EXPLAIN-eligible.
$explainUrlBuildercallable(int): stringBuilds the EXPLAIN URL for the given query sequence index.
$nPlusOneFindingNPlusOneFinding|null

Returns

string

public static function renderRowsCell(PHPForge\Debug\Panel\Db\QueryRow $row): string

Renders the rows-affected cell, falling back to an en dash (–) when the driver did not report the count.

Parameters

ParameterTypeDescription
$rowQueryRow

Returns

string

public static function renderTimeCell(PHPForge\Debug\Panel\Db\QueryRow $row): string

Renders the capture time as H:i:s.mmm, derived from the row’s millisecond timestamp.

Parameters

ParameterTypeDescription
$rowQueryRow

Returns

string

public static function renderTypeCell(PHPForge\Debug\Panel\Db\QueryRow $row): string

Renders the statement-type pill (SELECT, INSERT, UPDATE, …), tinted by its vocabulary verb.

Parameters

ParameterTypeDescription
$rowQueryRow

Returns

string