Skip to content

Commit f71c29c

Browse files
Merge pull request #18826 from kamil-tekiela/cyclomatic-complexity
Introduce private method getProfilingChart in Sql
2 parents c11b620 + 906bf77 commit f71c29c

1 file changed

Lines changed: 18 additions & 22 deletions

File tree

src/Sql.php

Lines changed: 18 additions & 22 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;
@@ -1112,14 +1106,12 @@ private function getHtmlForSqlQueryResultsTable(
11121106
if ($statementInfo->isProcedure) {
11131107
return $this->getHtmlForStoredProcedureResults(
11141108
$result,
1115-
$numRows,
11161109
$displayResultsObject,
11171110
$statementInfo,
11181111
$showTable,
11191112
$printView,
11201113
$editable,
11211114
$isBrowseDistinct,
1122-
$displayParts,
11231115
$isLimitedDisplay,
11241116
);
11251117
}
@@ -1147,20 +1139,15 @@ private function getHtmlForSqlQueryResultsTable(
11471139
return $displayResultsObject->getTable($result, $displayParts, $statementInfo, $isLimitedDisplay);
11481140
}
11491141

1150-
/**
1151-
* @param mixed[]|null $showTable table definitions
1152-
* @psalm-param int|numeric-string $numRows
1153-
*/
1142+
/** @param mixed[]|null $showTable table definitions */
11541143
private function getHtmlForStoredProcedureResults(
11551144
ResultInterface $result,
1156-
int|string $numRows,
11571145
DisplayResults $displayResultsObject,
11581146
StatementInfo $statementInfo,
11591147
array|null $showTable,
11601148
bool $printView,
11611149
bool $editable,
11621150
bool $isBrowseDistinct,
1163-
DisplayParts $displayParts,
11641151
bool $isLimitedDisplay,
11651152
): string {
11661153
$tableHtml = '';
@@ -1428,13 +1415,7 @@ private function getQueryResponseForResultsReturned(
14281415
$dispMessage ?? '',
14291416
);
14301417

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-
}
1418+
$profilingChartHtml = $this->getProfilingChart($profilingResults);
14381419

14391420
$missingUniqueColumnMessage = $this->getMessageIfMissingColumnIndex($table, $db, $editable, $hasUnique);
14401421

@@ -1733,4 +1714,19 @@ private function getIndexList(string $table, string $db): string
17331714
'indexes_duplicates' => $indexesDuplicates,
17341715
]);
17351716
}
1717+
1718+
/** @psalm-param list<array{Status: non-empty-string, Duration: numeric-string}> $profilingResults */
1719+
private function getProfilingChart(array $profilingResults): string
1720+
{
1721+
if ($profilingResults === []) {
1722+
return '';
1723+
}
1724+
1725+
$profiling = $this->getDetailedProfilingStats($profilingResults);
1726+
if ($profiling === []) {
1727+
return '';
1728+
}
1729+
1730+
return $this->template->render('sql/profiling_chart', ['profiling' => $profiling]);
1731+
}
17361732
}

0 commit comments

Comments
 (0)