1: <?php
2: /*
3: * This class was auto-generated from the API references found at
4: * https://apireference.connect.worldline-solutions.com/
5: */
6: namespace Worldline\Connect\Sdk\V1\Domain;
7:
8: use UnexpectedValueException;
9: use Worldline\Connect\Sdk\Domain\DataObject;
10:
11: /**
12: * @package Worldline\Connect\Sdk\V1\Domain
13: */
14: class LodgingData extends DataObject
15: {
16: /**
17: * @var LodgingCharge[]|null
18: */
19: public ?array $charges = null;
20:
21: /**
22: * @var string|null
23: */
24: public ?string $checkInDate = null;
25:
26: /**
27: * @var string|null
28: */
29: public ?string $checkOutDate = null;
30:
31: /**
32: * @var string|null
33: */
34: public ?string $folioNumber = null;
35:
36: /**
37: * @var bool|null
38: */
39: public ?bool $isConfirmedReservation = null;
40:
41: /**
42: * @var bool|null
43: */
44: public ?bool $isFacilityFireSafetyConform = null;
45:
46: /**
47: * @var bool|null
48: */
49: public ?bool $isNoShow = null;
50:
51: /**
52: * @var bool|null
53: */
54: public ?bool $isPreferenceSmokingRoom = null;
55:
56: /**
57: * @var int|null
58: */
59: public ?int $numberOfAdults = null;
60:
61: /**
62: * @var int|null
63: */
64: public ?int $numberOfNights = null;
65:
66: /**
67: * @var int|null
68: */
69: public ?int $numberOfRooms = null;
70:
71: /**
72: * @var string|null
73: */
74: public ?string $programCode = null;
75:
76: /**
77: * @var string|null
78: */
79: public ?string $propertyCustomerServicePhoneNumber = null;
80:
81: /**
82: * @var string|null
83: */
84: public ?string $propertyPhoneNumber = null;
85:
86: /**
87: * @var string|null
88: */
89: public ?string $renterName = null;
90:
91: /**
92: * @var LodgingRoom[]|null
93: */
94: public ?array $rooms = null;
95:
96: /**
97: * @return object
98: */
99: public function toObject(): object
100: {
101: $object = parent::toObject();
102: if (!is_null($this->charges)) {
103: $object->charges = [];
104: foreach ($this->charges as $element) {
105: if (!is_null($element)) {
106: $object->charges[] = $element->toObject();
107: }
108: }
109: }
110: if (!is_null($this->checkInDate)) {
111: $object->checkInDate = $this->checkInDate;
112: }
113: if (!is_null($this->checkOutDate)) {
114: $object->checkOutDate = $this->checkOutDate;
115: }
116: if (!is_null($this->folioNumber)) {
117: $object->folioNumber = $this->folioNumber;
118: }
119: if (!is_null($this->isConfirmedReservation)) {
120: $object->isConfirmedReservation = $this->isConfirmedReservation;
121: }
122: if (!is_null($this->isFacilityFireSafetyConform)) {
123: $object->isFacilityFireSafetyConform = $this->isFacilityFireSafetyConform;
124: }
125: if (!is_null($this->isNoShow)) {
126: $object->isNoShow = $this->isNoShow;
127: }
128: if (!is_null($this->isPreferenceSmokingRoom)) {
129: $object->isPreferenceSmokingRoom = $this->isPreferenceSmokingRoom;
130: }
131: if (!is_null($this->numberOfAdults)) {
132: $object->numberOfAdults = $this->numberOfAdults;
133: }
134: if (!is_null($this->numberOfNights)) {
135: $object->numberOfNights = $this->numberOfNights;
136: }
137: if (!is_null($this->numberOfRooms)) {
138: $object->numberOfRooms = $this->numberOfRooms;
139: }
140: if (!is_null($this->programCode)) {
141: $object->programCode = $this->programCode;
142: }
143: if (!is_null($this->propertyCustomerServicePhoneNumber)) {
144: $object->propertyCustomerServicePhoneNumber = $this->propertyCustomerServicePhoneNumber;
145: }
146: if (!is_null($this->propertyPhoneNumber)) {
147: $object->propertyPhoneNumber = $this->propertyPhoneNumber;
148: }
149: if (!is_null($this->renterName)) {
150: $object->renterName = $this->renterName;
151: }
152: if (!is_null($this->rooms)) {
153: $object->rooms = [];
154: foreach ($this->rooms as $element) {
155: if (!is_null($element)) {
156: $object->rooms[] = $element->toObject();
157: }
158: }
159: }
160: return $object;
161: }
162:
163: /**
164: * @param object $object
165: *
166: * @return $this
167: * @throws UnexpectedValueException
168: */
169: public function fromObject(object $object): LodgingData
170: {
171: parent::fromObject($object);
172: if (property_exists($object, 'charges')) {
173: if (!is_array($object->charges) && !is_object($object->charges)) {
174: throw new UnexpectedValueException('value \'' . print_r($object->charges, true) . '\' is not an array or object');
175: }
176: $this->charges = [];
177: foreach ($object->charges as $element) {
178: $value = new LodgingCharge();
179: $this->charges[] = $value->fromObject($element);
180: }
181: }
182: if (property_exists($object, 'checkInDate')) {
183: $this->checkInDate = $object->checkInDate;
184: }
185: if (property_exists($object, 'checkOutDate')) {
186: $this->checkOutDate = $object->checkOutDate;
187: }
188: if (property_exists($object, 'folioNumber')) {
189: $this->folioNumber = $object->folioNumber;
190: }
191: if (property_exists($object, 'isConfirmedReservation')) {
192: $this->isConfirmedReservation = $object->isConfirmedReservation;
193: }
194: if (property_exists($object, 'isFacilityFireSafetyConform')) {
195: $this->isFacilityFireSafetyConform = $object->isFacilityFireSafetyConform;
196: }
197: if (property_exists($object, 'isNoShow')) {
198: $this->isNoShow = $object->isNoShow;
199: }
200: if (property_exists($object, 'isPreferenceSmokingRoom')) {
201: $this->isPreferenceSmokingRoom = $object->isPreferenceSmokingRoom;
202: }
203: if (property_exists($object, 'numberOfAdults')) {
204: $this->numberOfAdults = $object->numberOfAdults;
205: }
206: if (property_exists($object, 'numberOfNights')) {
207: $this->numberOfNights = $object->numberOfNights;
208: }
209: if (property_exists($object, 'numberOfRooms')) {
210: $this->numberOfRooms = $object->numberOfRooms;
211: }
212: if (property_exists($object, 'programCode')) {
213: $this->programCode = $object->programCode;
214: }
215: if (property_exists($object, 'propertyCustomerServicePhoneNumber')) {
216: $this->propertyCustomerServicePhoneNumber = $object->propertyCustomerServicePhoneNumber;
217: }
218: if (property_exists($object, 'propertyPhoneNumber')) {
219: $this->propertyPhoneNumber = $object->propertyPhoneNumber;
220: }
221: if (property_exists($object, 'renterName')) {
222: $this->renterName = $object->renterName;
223: }
224: if (property_exists($object, 'rooms')) {
225: if (!is_array($object->rooms) && !is_object($object->rooms)) {
226: throw new UnexpectedValueException('value \'' . print_r($object->rooms, true) . '\' is not an array or object');
227: }
228: $this->rooms = [];
229: foreach ($object->rooms as $element) {
230: $value = new LodgingRoom();
231: $this->rooms[] = $value->fromObject($element);
232: }
233: }
234: return $this;
235: }
236: }
237: