1: <?php
2: /*
3: * This file was automatically generated.
4: */
5: namespace Worldline\Acquiring\Sdk\V1\Domain;
6:
7: use UnexpectedValueException;
8: use Worldline\Acquiring\Sdk\Domain\DataObject;
9:
10: /**
11: * @package Worldline\Acquiring\Sdk\V1\Domain
12: */
13: class ServiceLocationData extends DataObject
14: {
15: /**
16: * @var ServiceLocationAddress|null
17: */
18: public ?ServiceLocationAddress $address = null;
19:
20: /**
21: * @var GeoCoordinates|null
22: */
23: public ?GeoCoordinates $geoCoordinates = null;
24:
25: /**
26: * @return object
27: */
28: public function toObject(): object
29: {
30: $object = parent::toObject();
31: if (!is_null($this->address)) {
32: $object->address = $this->address->toObject();
33: }
34: if (!is_null($this->geoCoordinates)) {
35: $object->geoCoordinates = $this->geoCoordinates->toObject();
36: }
37: return $object;
38: }
39:
40: /**
41: * @param object $object
42: *
43: * @return $this
44: * @throws UnexpectedValueException
45: */
46: public function fromObject(object $object): ServiceLocationData
47: {
48: parent::fromObject($object);
49: if (property_exists($object, 'address')) {
50: if (!is_object($object->address)) {
51: throw new UnexpectedValueException('value \'' . print_r($object->address, true) . '\' is not an object');
52: }
53: $value = new ServiceLocationAddress();
54: $this->address = $value->fromObject($object->address);
55: }
56: if (property_exists($object, 'geoCoordinates')) {
57: if (!is_object($object->geoCoordinates)) {
58: throw new UnexpectedValueException('value \'' . print_r($object->geoCoordinates, true) . '\' is not an object');
59: }
60: $value = new GeoCoordinates();
61: $this->geoCoordinates = $value->fromObject($object->geoCoordinates);
62: }
63: return $this;
64: }
65: }
66: