<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class Address implements \JsonSerializable { private $addressLine1; private $addressLine2; private $addressLine3; private $locality; private $sublocality; private $administrativeDistrictLevel1; private $postalCode; private $country; public function getAddressLine1(): ?string { return $this->addressLine1; } public function setAddressLine1(?string $addressLine1): void { $this->addressLine1 = $addressLine1; } public function getAddressLine2(): ?string { return $this->addressLine2; } public function setAddressLine2(?string $addressLine2): void { $this->addressLine2 = $addressLine2; } public function getAddressLine3(): ?string { return $this->addressLine3; } public function setAddressLine3(?string $addressLine3): void { $this->addressLine3 = $addressLine3; } public function getLocality(): ?string { return $this->locality; } public function setLocality(?string $locality): void { $this->locality = $locality; } public function getSublocality(): ?string { return $this->sublocality; } public function setSublocality(?string $sublocality): void { $this->sublocality = $sublocality; } public function getAdministrativeDistrictLevel1(): ?string { return $this->administrativeDistrictLevel1; } public function setAdministrativeDistrictLevel1(?string $administrativeDistrictLevel1): void { $this->administrativeDistrictLevel1 = $administrativeDistrictLevel1; } public function getPostalCode(): ?string { return $this->postalCode; } public function setPostalCode(?string $postalCode): void { $this->postalCode = $postalCode; } public function getCountry(): ?string { return $this->country; } public function setCountry(?string $country): void { $this->country = $country; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->addressLine1)) { $json['address_line_1'] = $this->addressLine1; } if (isset($this->addressLine2)) { $json['address_line_2'] = $this->addressLine2; } if (isset($this->addressLine3)) { $json['address_line_3'] = $this->addressLine3; } if (isset($this->locality)) { $json['locality'] = $this->locality; } if (isset($this->sublocality)) { $json['sublocality'] = $this->sublocality; } if (isset($this->administrativeDistrictLevel1)) { $json['administrative_district_level_1'] = $this->administrativeDistrictLevel1; } if (isset($this->postalCode)) { $json['postal_code'] = $this->postalCode; } if (isset($this->country)) { $json['country'] = $this->country; } $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 