Skip to content

Commit

Permalink
the documentation was wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalvb committed Nov 25, 2024
1 parent e8cc59d commit a9dde3b
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/Service/PolisClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,9 @@ public function __construct(
) {
}

private function translatePolisLanguageCode(string $languageCode): string
{
return match ($languageCode) {
'rm' => 'rr',
default => $languageCode,
};
}

public function fetchPolisCaseByVotationId(int $id, string $language): PolisCase
{
$votationResponse = $this->client->request('GET', sprintf('/polis-api/v2/votations/%s?lang=%s', $id, $this->translatePolisLanguageCode($language)));
$votationResponse = $this->client->request('GET', sprintf('/polis-api/v2/votations/%s?lang=%s', $id, $language));
$data = $votationResponse->toArray();

$case = [];
Expand Down Expand Up @@ -99,12 +91,12 @@ public function fetchPolisCaseByVotationId(int $id, string $language): PolisCase

public function fetchPolisVotationById(int $id, string $language): PolisVotation
{
return $this->fetchPolisCaseByVotationId($id, $this->translatePolisLanguageCode($language))->votations[0];
return $this->fetchPolisCaseByVotationId($id, $language)->votations[0];
}

public function fetchPolisCaseById(int $id, string $language = 'de'): PolisCase
{
$caseData = $this->client->request('GET', sprintf('/polis-api/v2/cases/%s?lang=%s', $id, $this->translatePolisLanguageCode($language)));
$caseData = $this->client->request('GET', sprintf('/polis-api/v2/cases/%s?lang=%s', $id, $language));
$data = $caseData->toArray();

return $this->denormalizePolisCase($data['Case'][0]);
Expand All @@ -114,7 +106,7 @@ public function fetchPolisCases(string $language = 'de', bool $onlyActive = true
{
$caseData = $this->client->request('GET', sprintf(
'/polis-api/v2/cases?lang=%s&listAllCases=%s',
$this->translatePolisLanguageCode($language),
$language,
$onlyActive ? 'false' : 'true'
));
$data = $caseData->toArray();
Expand Down

0 comments on commit a9dde3b

Please sign in to comment.