sort output

master
Dirk Heilig 2024-11-19 14:36:49 +01:00
parent 2a07084f9e
commit 6328e90823
1 changed files with 12 additions and 0 deletions

View File

@ -314,6 +314,17 @@ function output(): void
$filteredData[$hash] = $entry; $filteredData[$hash] = $entry;
} }
usort($filteredData, function ($a, $b) {
$r = strcmp($a["name"], $b["name"]);
if ($r !== 0) {
return $r;
}
return strcmp(
strval(json_encode($a["labels"])),
strval(json_encode($b["labels"]))
);
});
foreach ($filteredData as $entry) { foreach ($filteredData as $entry) {
$labels = []; $labels = [];
if (isset($entry["labels"])) { if (isset($entry["labels"])) {
@ -423,6 +434,7 @@ function getEnvWithDefaultInt(string $key, int $default): int
{ {
return intval(getEnvWithDefault($key, $default)); return intval(getEnvWithDefault($key, $default));
} }
function getEnvWithDefault( function getEnvWithDefault(
string $key, string $key,
bool|string|int $default bool|string|int $default