countryZonesDataProvider = $countryZonesDataProvider; } public function getStatesForCountryAction(string $country): ResponseInterface { $countryZones = $this->countryZonesDataProvider->getCountryZonesForCountryIso3($country); $jsonData = []; foreach ($countryZones as $countryZone) { $jsonData[$countryZone->getIsoCode()] = $countryZone->getLocalName(); } return $this->jsonResponse(json_encode($jsonData)); } }