From 5f01b21c5871674c08b7edd96ab85c87684aae8f Mon Sep 17 00:00:00 2001 From: Roman Schenk Date: Wed, 11 Mar 2026 20:01:55 +0100 Subject: [PATCH] Remove unused alternative names of cummunities to prevent warnings --- zefixAPI.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/zefixAPI.php b/zefixAPI.php index 588424f..7d8f6ee 100644 --- a/zefixAPI.php +++ b/zefixAPI.php @@ -107,15 +107,26 @@ function sendAPICommunityRequest(string $username, string $password): string|boo return $response; } + function communityCSV(string $username, string $password): string { $response = sendAPICommunityRequest($username, $password); $communityArray = json_decode($response, true); - $csvOutput = 'id,bfsId,Kanton,Gemeindename,registryOfCommerceId,replacedById,alternateNames\n'; - // Create CSV rows + + $csvOutput = "id,bfsId,Kanton,Gemeindename,registryOfCommerceId,replacedById\n"; foreach ($communityArray as $item) { - $csvOutput .= implode(',', $item) . "\n"; + $row = [ + $item['id'] ?? '', + $item['bfsId'] ?? '', + $item['canton'] ?? '', + $item['name'] ?? '', + $item['registryOfficeId'] ?? '', + $item['replacedById'] ?? '' + ]; + + $csvOutput .= implode(',', $row) . "\n"; } + return $csvOutput; }