Skip to content

Commit e29fe59

Browse files
committed
Introduce getProfilingChart()
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
1 parent 3a7baa4 commit e29fe59

1 file changed

Lines changed: 17 additions & 14 deletions

File tree

src/Sql.php

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,13 +1005,7 @@ private function getQueryResponseForNoResultsReturned(
10051005
true,
10061006
);
10071007

1008-
$profilingChart = '';
1009-
if ($profilingResults !== []) {
1010-
$profiling = $this->getDetailedProfilingStats($profilingResults);
1011-
if ($profiling !== []) {
1012-
$profilingChart = $this->template->render('sql/profiling_chart', ['profiling' => $profiling]);
1013-
}
1014-
}
1008+
$profilingChart = $this->getProfilingChart($profilingResults);
10151009

10161010
$bookmark = '';
10171011
$bookmarkFeature = $this->relation->getRelationParameters()->bookmarkFeature;
@@ -1428,13 +1422,7 @@ private function getQueryResponseForResultsReturned(
14281422
$dispMessage ?? '',
14291423
);
14301424

1431-
$profilingChartHtml = '';
1432-
if ($profilingResults !== []) {
1433-
$profiling = $this->getDetailedProfilingStats($profilingResults);
1434-
if ($profiling !== []) {
1435-
$profilingChartHtml = $this->template->render('sql/profiling_chart', ['profiling' => $profiling]);
1436-
}
1437-
}
1425+
$profilingChartHtml = $this->getProfilingChart($profilingResults);
14381426

14391427
$missingUniqueColumnMessage = $this->getMessageIfMissingColumnIndex($table, $db, $editable, $hasUnique);
14401428

@@ -1733,4 +1721,19 @@ private function getIndexList(string $table, string $db): string
17331721
'indexes_duplicates' => $indexesDuplicates,
17341722
]);
17351723
}
1724+
1725+
/** @psalm-param list<array{Status: non-empty-string, Duration: numeric-string}> $profilingResults */
1726+
private function getProfilingChart(array $profilingResults): string
1727+
{
1728+
if ($profilingResults === []) {
1729+
return '';
1730+
}
1731+
1732+
$profiling = $this->getDetailedProfilingStats($profilingResults);
1733+
if ($profiling === []) {
1734+
return '';
1735+
}
1736+
1737+
return $this->template->render('sql/profiling_chart', ['profiling' => $profiling]);
1738+
}
17361739
}

0 commit comments

Comments
 (0)