diff --git a/src/BusProNet/DataProvider/CountryDataProvider.php b/src/BusProNet/DataProvider/CountryDataProvider.php index 4f884c4..00621a7 100644 --- a/src/BusProNet/DataProvider/CountryDataProvider.php +++ b/src/BusProNet/DataProvider/CountryDataProvider.php @@ -32,8 +32,12 @@ class CountryDataProvider return $countries; } - public function get(string $token): ?Country + public function get(?string $token): ?Country { + if (null === $token) { + return null; + } + return $this->getAll()[$token] ?? null; } } \ No newline at end of file diff --git a/src/Twig/AppRuntime.php b/src/Twig/AppRuntime.php index 42ebeda..566b82a 100644 --- a/src/Twig/AppRuntime.php +++ b/src/Twig/AppRuntime.php @@ -36,7 +36,7 @@ class AppRuntime implements RuntimeExtensionInterface return sprintf('Offizielle %slehrer*innenlizenz', ucfirst(strtolower($type))); } - public function bpnCountryLabel(string $token, string $property = 'name'): string + public function bpnCountryLabel(?string $token, string $property = 'name'): string { $country = $this->countries->get($token);