id; } /** * Get country code * * @return string * * @since 1.0.0 */ public function getCountry() : string { return $this->country; } /** * Set country code * * @param string $country Country name * * @return void * * @since 1.0.0 */ public function setCountry(string $country) : void { $this->country = $country; } /** * {@inheritdoc} */ public function serialize() : string { return (string) \json_encode($this->jsonSerialize()); } /** * {@inheritdoc} */ public function jsonSerialize() : mixed { return $this->toArray(); } /** * {@inheritdoc} */ public function toArray() : array { return [ 'postal' => $this->postal, 'city' => $this->city, 'country' => $this->country, 'address' => $this->address, 'state' => $this->state, 'lat' => $this->lat, 'lon' => $this->lon, ]; } /** * {@inheritdoc} */ public function unserialize(mixed $serialized) : void { if (!\is_string($serialized)) { return; } $data = \json_decode($serialized, true); if (!\is_array($data)) { return; } $this->postal = $data['postal']; $this->city = $data['city']; $this->country = $data['country']; $this->address = $data['address']; $this->state = $data['state']; $this->lat = $data['lat']; $this->lon = $data['lon']; } }