Updated ShippingAddress

This commit is contained in:
netkas 2024-10-04 15:15:56 -04:00
parent fdf6e3addc
commit f20f86a2fb

View file

@ -7,35 +7,12 @@
class ShippingAddress implements ObjectTypeInterface class ShippingAddress implements ObjectTypeInterface
{ {
/** private ?string $country_code;
* @var string|null private ?string $state;
*/ private ?string $city;
private $country_code; private ?string $street_line1;
private ?string $street_line2;
/** private ?string $post_code;
* @var string|null
*/
private $state;
/**
* @var string|null
*/
private $city;
/**
* @var string|null
*/
private $street_line1;
/**
* @var string|null
*/
private $street_line2;
/**
* @var string|null
*/
private $post_code;
/** /**
* Two-letter ISO 3166-1 alpha-2 country code * Two-letter ISO 3166-1 alpha-2 country code
@ -98,9 +75,7 @@
} }
/** /**
* Returns an array representation of the object. * @inheritDoc
*
* @return array
*/ */
public function toArray(): array public function toArray(): array
{ {
@ -115,15 +90,16 @@
} }
/** /**
* Constructs object from an array representation. * @inheritDoc
*
* @param array $data
* @return ShippingAddress
*/ */
public static function fromArray(array $data): self public static function fromArray(?array $data): ?ShippingAddress
{ {
$object = new self(); if($data === null)
{
return null;
}
$object = new self();
$object->country_code = $data['country_code'] ?? null; $object->country_code = $data['country_code'] ?? null;
$object->state = $data['state'] ?? null; $object->state = $data['state'] ?? null;
$object->city = $data['city'] ?? null; $object->city = $data['city'] ?? null;