exchangeLocationInfo($location); } public function getCountryName(): string { return $this->countryName ?? ''; } public function getLatitude(): string { return $this->latitude ?? ''; } public function getLongitude(): string { return $this->longitude ?? ''; } public function getCityName(): string { return $this->cityName ?? ''; } private function exchangeLocationInfo(Location $info): void { $this->countryCode = $info->countryCode(); $this->countryName = $info->countryName(); $this->regionName = $info->regionName(); $this->cityName = $info->city(); $this->latitude = (string) $info->latitude(); $this->longitude = (string) $info->longitude(); $this->timezone = $info->timeZone(); } public function jsonSerialize(): array { return [ 'countryCode' => $this->countryCode, 'countryName' => $this->countryName, 'regionName' => $this->regionName, 'cityName' => $this->cityName, 'latitude' => $this->latitude, 'longitude' => $this->longitude, 'timezone' => $this->timezone, ]; } }