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[]
18: */
19: public $charges = null;
20:
21: /**
22: * @var string
23: */
24: public $checkInDate = null;
25:
26: /**
27: * @var string
28: */
29: public $checkOutDate = null;
30:
31: /**
32: * @var string
33: */
34: public $folioNumber = null;
35:
36: /**
37: * @var bool
38: */
39: public $isConfirmedReservation = null;
40:
41: /**
42: * @var bool
43: */
44: public $isFacilityFireSafetyConform = null;
45:
46: /**
47: * @var bool
48: */
49: public $isNoShow = null;
50:
51: /**
52: * @var bool
53: */
54: public $isPreferenceSmokingRoom = null;
55:
56: /**
57: * @var int
58: */
59: public $numberOfAdults = null;
60:
61: /**
62: * @var int
63: */
64: public $numberOfNights = null;
65:
66: /**
67: * @var int
68: */
69: public $numberOfRooms = null;
70:
71: /**
72: * @var string
73: */
74: public $programCode = null;
75:
76: /**
77: * @var string
78: */
79: public $propertyCustomerServicePhoneNumber = null;
80:
81: /**
82: * @var string
83: */
84: public $propertyPhoneNumber = null;
85:
86: /**
87: * @var string
88: */
89: public $renterName = null;
90:
91: /**
92: * @var LodgingRoom[]
93: */
94: public $rooms = null;
95:
96: /**
97: * @return object
98: */
99: public function toObject()
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: * @return $this
166: * @throws UnexpectedValueException
167: */
168: public function fromObject($object)
169: {
170: parent::fromObject($object);
171: if (property_exists($object, 'charges')) {
172: if (!is_array($object->charges) && !is_object($object->charges)) {
173: throw new UnexpectedValueException('value \'' . print_r($object->charges, true) . '\' is not an array or object');
174: }
175: $this->charges = [];
176: foreach ($object->charges as $element) {
177: $value = new LodgingCharge();
178: $this->charges[] = $value->fromObject($element);
179: }
180: }
181: if (property_exists($object, 'checkInDate')) {
182: $this->checkInDate = $object->checkInDate;
183: }
184: if (property_exists($object, 'checkOutDate')) {
185: $this->checkOutDate = $object->checkOutDate;
186: }
187: if (property_exists($object, 'folioNumber')) {
188: $this->folioNumber = $object->folioNumber;
189: }
190: if (property_exists($object, 'isConfirmedReservation')) {
191: $this->isConfirmedReservation = $object->isConfirmedReservation;
192: }
193: if (property_exists($object, 'isFacilityFireSafetyConform')) {
194: $this->isFacilityFireSafetyConform = $object->isFacilityFireSafetyConform;
195: }
196: if (property_exists($object, 'isNoShow')) {
197: $this->isNoShow = $object->isNoShow;
198: }
199: if (property_exists($object, 'isPreferenceSmokingRoom')) {
200: $this->isPreferenceSmokingRoom = $object->isPreferenceSmokingRoom;
201: }
202: if (property_exists($object, 'numberOfAdults')) {
203: $this->numberOfAdults = $object->numberOfAdults;
204: }
205: if (property_exists($object, 'numberOfNights')) {
206: $this->numberOfNights = $object->numberOfNights;
207: }
208: if (property_exists($object, 'numberOfRooms')) {
209: $this->numberOfRooms = $object->numberOfRooms;
210: }
211: if (property_exists($object, 'programCode')) {
212: $this->programCode = $object->programCode;
213: }
214: if (property_exists($object, 'propertyCustomerServicePhoneNumber')) {
215: $this->propertyCustomerServicePhoneNumber = $object->propertyCustomerServicePhoneNumber;
216: }
217: if (property_exists($object, 'propertyPhoneNumber')) {
218: $this->propertyPhoneNumber = $object->propertyPhoneNumber;
219: }
220: if (property_exists($object, 'renterName')) {
221: $this->renterName = $object->renterName;
222: }
223: if (property_exists($object, 'rooms')) {
224: if (!is_array($object->rooms) && !is_object($object->rooms)) {
225: throw new UnexpectedValueException('value \'' . print_r($object->rooms, true) . '\' is not an array or object');
226: }
227: $this->rooms = [];
228: foreach ($object->rooms as $element) {
229: $value = new LodgingRoom();
230: $this->rooms[] = $value->fromObject($element);
231: }
232: }
233: return $this;
234: }
235: }
236: