Total Complexity | 193 |
Total Lines | 1368 |
Duplicated Lines | 0 % |
Changes | 0 |
Complex classes like EwsAppendToItemFieldType often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use EwsAppendToItemFieldType, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
16 | class EwsAppendToItemFieldType extends EwsItemChangeDescriptionType |
||
17 | { |
||
18 | /** |
||
19 | * The Item |
||
20 | * Meta information extracted from the WSDL |
||
21 | * - choice: Item | Message | CalendarItem | Contact | DistributionList | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking | XrmOrganization |
||
22 | * - choiceMaxOccurs: 1 |
||
23 | * - choiceMinOccurs: 1 |
||
24 | * @var \StructType\EwsItemType|null |
||
25 | */ |
||
26 | protected ?\StructType\EwsItemType $Item = null; |
||
27 | /** |
||
28 | * The Message |
||
29 | * Meta information extracted from the WSDL |
||
30 | * - choice: Item | Message | CalendarItem | Contact | DistributionList | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking | XrmOrganization |
||
31 | * - choiceMaxOccurs: 1 |
||
32 | * - choiceMinOccurs: 1 |
||
33 | * @var \StructType\EwsMessageType|null |
||
34 | */ |
||
35 | protected ?\StructType\EwsMessageType $Message = null; |
||
36 | /** |
||
37 | * The CalendarItem |
||
38 | * Meta information extracted from the WSDL |
||
39 | * - choice: Item | Message | CalendarItem | Contact | DistributionList | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking | XrmOrganization |
||
40 | * - choiceMaxOccurs: 1 |
||
41 | * - choiceMinOccurs: 1 |
||
42 | * @var \StructType\EwsCalendarItemType|null |
||
43 | */ |
||
44 | protected ?\StructType\EwsCalendarItemType $CalendarItem = null; |
||
45 | /** |
||
46 | * The Contact |
||
47 | * Meta information extracted from the WSDL |
||
48 | * - choice: Item | Message | CalendarItem | Contact | DistributionList | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking | XrmOrganization |
||
49 | * - choiceMaxOccurs: 1 |
||
50 | * - choiceMinOccurs: 1 |
||
51 | * @var \StructType\EwsContactItemType|null |
||
52 | */ |
||
53 | protected ?\StructType\EwsContactItemType $Contact = null; |
||
54 | /** |
||
55 | * The DistributionList |
||
56 | * Meta information extracted from the WSDL |
||
57 | * - choice: Item | Message | CalendarItem | Contact | DistributionList | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking | XrmOrganization |
||
58 | * - choiceMaxOccurs: 1 |
||
59 | * - choiceMinOccurs: 1 |
||
60 | * @var \StructType\EwsDistributionListType|null |
||
61 | */ |
||
62 | protected ?\StructType\EwsDistributionListType $DistributionList = null; |
||
63 | /** |
||
64 | * The MeetingMessage |
||
65 | * Meta information extracted from the WSDL |
||
66 | * - choice: Item | Message | CalendarItem | Contact | DistributionList | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking | XrmOrganization |
||
67 | * - choiceMaxOccurs: 1 |
||
68 | * - choiceMinOccurs: 1 |
||
69 | * @var \StructType\EwsMeetingMessageType|null |
||
70 | */ |
||
71 | protected ?\StructType\EwsMeetingMessageType $MeetingMessage = null; |
||
72 | /** |
||
73 | * The MeetingRequest |
||
74 | * Meta information extracted from the WSDL |
||
75 | * - choice: Item | Message | CalendarItem | Contact | DistributionList | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking | XrmOrganization |
||
76 | * - choiceMaxOccurs: 1 |
||
77 | * - choiceMinOccurs: 1 |
||
78 | * @var \StructType\EwsMeetingRequestMessageType|null |
||
79 | */ |
||
80 | protected ?\StructType\EwsMeetingRequestMessageType $MeetingRequest = null; |
||
81 | /** |
||
82 | * The MeetingResponse |
||
83 | * Meta information extracted from the WSDL |
||
84 | * - choice: Item | Message | CalendarItem | Contact | DistributionList | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking | XrmOrganization |
||
85 | * - choiceMaxOccurs: 1 |
||
86 | * - choiceMinOccurs: 1 |
||
87 | * @var \StructType\EwsMeetingResponseMessageType|null |
||
88 | */ |
||
89 | protected ?\StructType\EwsMeetingResponseMessageType $MeetingResponse = null; |
||
90 | /** |
||
91 | * The MeetingCancellation |
||
92 | * Meta information extracted from the WSDL |
||
93 | * - choice: Item | Message | CalendarItem | Contact | DistributionList | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking | XrmOrganization |
||
94 | * - choiceMaxOccurs: 1 |
||
95 | * - choiceMinOccurs: 1 |
||
96 | * @var \StructType\EwsMeetingCancellationMessageType|null |
||
97 | */ |
||
98 | protected ?\StructType\EwsMeetingCancellationMessageType $MeetingCancellation = null; |
||
99 | /** |
||
100 | * The Task |
||
101 | * Meta information extracted from the WSDL |
||
102 | * - choice: Item | Message | CalendarItem | Contact | DistributionList | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking | XrmOrganization |
||
103 | * - choiceMaxOccurs: 1 |
||
104 | * - choiceMinOccurs: 1 |
||
105 | * @var \StructType\EwsTaskType|null |
||
106 | */ |
||
107 | protected ?\StructType\EwsTaskType $Task = null; |
||
108 | /** |
||
109 | * The PostItem |
||
110 | * Meta information extracted from the WSDL |
||
111 | * - choice: Item | Message | CalendarItem | Contact | DistributionList | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking | XrmOrganization |
||
112 | * - choiceMaxOccurs: 1 |
||
113 | * - choiceMinOccurs: 1 |
||
114 | * @var \StructType\EwsPostItemType|null |
||
115 | */ |
||
116 | protected ?\StructType\EwsPostItemType $PostItem = null; |
||
117 | /** |
||
118 | * The RoleMember |
||
119 | * Meta information extracted from the WSDL |
||
120 | * - choice: Item | Message | CalendarItem | Contact | DistributionList | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking | XrmOrganization |
||
121 | * - choiceMaxOccurs: 1 |
||
122 | * - choiceMinOccurs: 1 |
||
123 | * @var \StructType\EwsRoleMemberItemType|null |
||
124 | */ |
||
125 | protected ?\StructType\EwsRoleMemberItemType $RoleMember = null; |
||
126 | /** |
||
127 | * The Network |
||
128 | * Meta information extracted from the WSDL |
||
129 | * - choice: Item | Message | CalendarItem | Contact | DistributionList | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking | XrmOrganization |
||
130 | * - choiceMaxOccurs: 1 |
||
131 | * - choiceMinOccurs: 1 |
||
132 | * @var \StructType\EwsNetworkItemType|null |
||
133 | */ |
||
134 | protected ?\StructType\EwsNetworkItemType $Network = null; |
||
135 | /** |
||
136 | * The Person |
||
137 | * Meta information extracted from the WSDL |
||
138 | * - choice: Item | Message | CalendarItem | Contact | DistributionList | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking | XrmOrganization |
||
139 | * - choiceMaxOccurs: 1 |
||
140 | * - choiceMinOccurs: 1 |
||
141 | * @var \StructType\EwsAbchPersonItemType|null |
||
142 | */ |
||
143 | protected ?\StructType\EwsAbchPersonItemType $Person = null; |
||
144 | /** |
||
145 | * The Booking |
||
146 | * Meta information extracted from the WSDL |
||
147 | * - choice: Item | Message | CalendarItem | Contact | DistributionList | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking | XrmOrganization |
||
148 | * - choiceMaxOccurs: 1 |
||
149 | * - choiceMinOccurs: 1 |
||
150 | * @var \StructType\EwsBookingItemType|null |
||
151 | */ |
||
152 | protected ?\StructType\EwsBookingItemType $Booking = null; |
||
153 | /** |
||
154 | * The XrmOrganization |
||
155 | * Meta information extracted from the WSDL |
||
156 | * - choice: Item | Message | CalendarItem | Contact | DistributionList | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking | XrmOrganization |
||
157 | * - choiceMaxOccurs: 1 |
||
158 | * - choiceMinOccurs: 1 |
||
159 | * @var \StructType\EwsXrmOrganizationItemType|null |
||
160 | */ |
||
161 | protected ?\StructType\EwsXrmOrganizationItemType $XrmOrganization = null; |
||
162 | /** |
||
163 | * Constructor method for AppendToItemFieldType |
||
164 | * @uses EwsAppendToItemFieldType::setItem() |
||
165 | * @uses EwsAppendToItemFieldType::setMessage() |
||
166 | * @uses EwsAppendToItemFieldType::setCalendarItem() |
||
167 | * @uses EwsAppendToItemFieldType::setContact() |
||
168 | * @uses EwsAppendToItemFieldType::setDistributionList() |
||
169 | * @uses EwsAppendToItemFieldType::setMeetingMessage() |
||
170 | * @uses EwsAppendToItemFieldType::setMeetingRequest() |
||
171 | * @uses EwsAppendToItemFieldType::setMeetingResponse() |
||
172 | * @uses EwsAppendToItemFieldType::setMeetingCancellation() |
||
173 | * @uses EwsAppendToItemFieldType::setTask() |
||
174 | * @uses EwsAppendToItemFieldType::setPostItem() |
||
175 | * @uses EwsAppendToItemFieldType::setRoleMember() |
||
176 | * @uses EwsAppendToItemFieldType::setNetwork() |
||
177 | * @uses EwsAppendToItemFieldType::setPerson() |
||
178 | * @uses EwsAppendToItemFieldType::setBooking() |
||
179 | * @uses EwsAppendToItemFieldType::setXrmOrganization() |
||
180 | * @param \StructType\EwsItemType $item |
||
181 | * @param \StructType\EwsMessageType $message |
||
182 | * @param \StructType\EwsCalendarItemType $calendarItem |
||
183 | * @param \StructType\EwsContactItemType $contact |
||
184 | * @param \StructType\EwsDistributionListType $distributionList |
||
185 | * @param \StructType\EwsMeetingMessageType $meetingMessage |
||
186 | * @param \StructType\EwsMeetingRequestMessageType $meetingRequest |
||
187 | * @param \StructType\EwsMeetingResponseMessageType $meetingResponse |
||
188 | * @param \StructType\EwsMeetingCancellationMessageType $meetingCancellation |
||
189 | * @param \StructType\EwsTaskType $task |
||
190 | * @param \StructType\EwsPostItemType $postItem |
||
191 | * @param \StructType\EwsRoleMemberItemType $roleMember |
||
192 | * @param \StructType\EwsNetworkItemType $network |
||
193 | * @param \StructType\EwsAbchPersonItemType $person |
||
194 | * @param \StructType\EwsBookingItemType $booking |
||
195 | * @param \StructType\EwsXrmOrganizationItemType $xrmOrganization |
||
196 | */ |
||
197 | public function __construct(?\StructType\EwsItemType $item = null, ?\StructType\EwsMessageType $message = null, ?\StructType\EwsCalendarItemType $calendarItem = null, ?\StructType\EwsContactItemType $contact = null, ?\StructType\EwsDistributionListType $distributionList = null, ?\StructType\EwsMeetingMessageType $meetingMessage = null, ?\StructType\EwsMeetingRequestMessageType $meetingRequest = null, ?\StructType\EwsMeetingResponseMessageType $meetingResponse = null, ?\StructType\EwsMeetingCancellationMessageType $meetingCancellation = null, ?\StructType\EwsTaskType $task = null, ?\StructType\EwsPostItemType $postItem = null, ?\StructType\EwsRoleMemberItemType $roleMember = null, ?\StructType\EwsNetworkItemType $network = null, ?\StructType\EwsAbchPersonItemType $person = null, ?\StructType\EwsBookingItemType $booking = null, ?\StructType\EwsXrmOrganizationItemType $xrmOrganization = null) |
||
198 | { |
||
199 | $this |
||
200 | ->setItem($item) |
||
201 | ->setMessage($message) |
||
202 | ->setCalendarItem($calendarItem) |
||
203 | ->setContact($contact) |
||
204 | ->setDistributionList($distributionList) |
||
205 | ->setMeetingMessage($meetingMessage) |
||
206 | ->setMeetingRequest($meetingRequest) |
||
207 | ->setMeetingResponse($meetingResponse) |
||
208 | ->setMeetingCancellation($meetingCancellation) |
||
209 | ->setTask($task) |
||
210 | ->setPostItem($postItem) |
||
211 | ->setRoleMember($roleMember) |
||
212 | ->setNetwork($network) |
||
213 | ->setPerson($person) |
||
214 | ->setBooking($booking) |
||
215 | ->setXrmOrganization($xrmOrganization); |
||
216 | } |
||
217 | /** |
||
218 | * Get Item value |
||
219 | * @return \StructType\EwsItemType|null |
||
220 | */ |
||
221 | public function getItem(): ?\StructType\EwsItemType |
||
222 | { |
||
223 | return isset($this->Item) ? $this->Item : null; |
||
224 | } |
||
225 | /** |
||
226 | * This method is responsible for validating the value passed to the setItem method |
||
227 | * This method is willingly generated in order to preserve the one-line inline validation within the setItem method |
||
228 | * This has to validate that the property which is being set is the only one among the given choices |
||
229 | * @param mixed $value |
||
230 | * @return string A non-empty message if the values does not match the validation rules |
||
231 | */ |
||
232 | public function validateItemForChoiceConstraintsFromSetItem($value): string |
||
233 | { |
||
234 | $message = ''; |
||
235 | if (is_null($value)) { |
||
236 | return $message; |
||
237 | } |
||
238 | $properties = [ |
||
239 | 'Message', |
||
240 | 'CalendarItem', |
||
241 | 'Contact', |
||
242 | 'DistributionList', |
||
243 | 'MeetingMessage', |
||
244 | 'MeetingRequest', |
||
245 | 'MeetingResponse', |
||
246 | 'MeetingCancellation', |
||
247 | 'Task', |
||
248 | 'PostItem', |
||
249 | 'RoleMember', |
||
250 | 'Network', |
||
251 | 'Person', |
||
252 | 'Booking', |
||
253 | 'XrmOrganization', |
||
254 | ]; |
||
255 | try { |
||
256 | foreach ($properties as $property) { |
||
257 | if (isset($this->{$property})) { |
||
258 | throw new InvalidArgumentException(sprintf('The property Item can\'t be set as the property %s is already set. Only one property must be set among these properties: Item, %s.', $property, implode(', ', $properties)), __LINE__); |
||
259 | } |
||
260 | } |
||
261 | } catch (InvalidArgumentException $e) { |
||
262 | $message = $e->getMessage(); |
||
263 | } |
||
264 | |||
265 | return $message; |
||
266 | } |
||
267 | /** |
||
268 | * Set Item value |
||
269 | * This property belongs to a choice that allows only one property to exist. It is |
||
270 | * therefore removable from the request, consequently if the value assigned to this |
||
271 | * property is null, the property is removed from this object |
||
272 | * @throws InvalidArgumentException |
||
273 | * @param \StructType\EwsItemType $item |
||
274 | * @return \StructType\EwsAppendToItemFieldType |
||
275 | */ |
||
276 | public function setItem(?\StructType\EwsItemType $item = null): self |
||
277 | { |
||
278 | // validation for constraint: choice(Item, Message, CalendarItem, Contact, DistributionList, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking, XrmOrganization) |
||
279 | if ('' !== ($itemChoiceErrorMessage = self::validateItemForChoiceConstraintsFromSetItem($item))) { |
||
|
|||
280 | throw new InvalidArgumentException($itemChoiceErrorMessage, __LINE__); |
||
281 | } |
||
282 | if (is_null($item) || (is_array($item) && empty($item))) { |
||
283 | unset($this->Item); |
||
284 | } else { |
||
285 | $this->Item = $item; |
||
286 | } |
||
287 | |||
288 | return $this; |
||
289 | } |
||
290 | /** |
||
291 | * Get Message value |
||
292 | * @return \StructType\EwsMessageType|null |
||
293 | */ |
||
294 | public function getMessage(): ?\StructType\EwsMessageType |
||
295 | { |
||
296 | return isset($this->Message) ? $this->Message : null; |
||
297 | } |
||
298 | /** |
||
299 | * This method is responsible for validating the value passed to the setMessage method |
||
300 | * This method is willingly generated in order to preserve the one-line inline validation within the setMessage method |
||
301 | * This has to validate that the property which is being set is the only one among the given choices |
||
302 | * @param mixed $value |
||
303 | * @return string A non-empty message if the values does not match the validation rules |
||
304 | */ |
||
305 | public function validateMessageForChoiceConstraintsFromSetMessage($value): string |
||
306 | { |
||
307 | $message = ''; |
||
308 | if (is_null($value)) { |
||
309 | return $message; |
||
310 | } |
||
311 | $properties = [ |
||
312 | 'Item', |
||
313 | 'CalendarItem', |
||
314 | 'Contact', |
||
315 | 'DistributionList', |
||
316 | 'MeetingMessage', |
||
317 | 'MeetingRequest', |
||
318 | 'MeetingResponse', |
||
319 | 'MeetingCancellation', |
||
320 | 'Task', |
||
321 | 'PostItem', |
||
322 | 'RoleMember', |
||
323 | 'Network', |
||
324 | 'Person', |
||
325 | 'Booking', |
||
326 | 'XrmOrganization', |
||
327 | ]; |
||
328 | try { |
||
329 | foreach ($properties as $property) { |
||
330 | if (isset($this->{$property})) { |
||
331 | throw new InvalidArgumentException(sprintf('The property Message can\'t be set as the property %s is already set. Only one property must be set among these properties: Message, %s.', $property, implode(', ', $properties)), __LINE__); |
||
332 | } |
||
333 | } |
||
334 | } catch (InvalidArgumentException $e) { |
||
335 | $message = $e->getMessage(); |
||
336 | } |
||
337 | |||
338 | return $message; |
||
339 | } |
||
340 | /** |
||
341 | * Set Message value |
||
342 | * This property belongs to a choice that allows only one property to exist. It is |
||
343 | * therefore removable from the request, consequently if the value assigned to this |
||
344 | * property is null, the property is removed from this object |
||
345 | * @throws InvalidArgumentException |
||
346 | * @param \StructType\EwsMessageType $message |
||
347 | * @return \StructType\EwsAppendToItemFieldType |
||
348 | */ |
||
349 | public function setMessage(?\StructType\EwsMessageType $message = null): self |
||
350 | { |
||
351 | // validation for constraint: choice(Item, Message, CalendarItem, Contact, DistributionList, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking, XrmOrganization) |
||
352 | if ('' !== ($messageChoiceErrorMessage = self::validateMessageForChoiceConstraintsFromSetMessage($message))) { |
||
353 | throw new InvalidArgumentException($messageChoiceErrorMessage, __LINE__); |
||
354 | } |
||
355 | if (is_null($message) || (is_array($message) && empty($message))) { |
||
356 | unset($this->Message); |
||
357 | } else { |
||
358 | $this->Message = $message; |
||
359 | } |
||
360 | |||
361 | return $this; |
||
362 | } |
||
363 | /** |
||
364 | * Get CalendarItem value |
||
365 | * @return \StructType\EwsCalendarItemType|null |
||
366 | */ |
||
367 | public function getCalendarItem(): ?\StructType\EwsCalendarItemType |
||
368 | { |
||
369 | return isset($this->CalendarItem) ? $this->CalendarItem : null; |
||
370 | } |
||
371 | /** |
||
372 | * This method is responsible for validating the value passed to the setCalendarItem method |
||
373 | * This method is willingly generated in order to preserve the one-line inline validation within the setCalendarItem method |
||
374 | * This has to validate that the property which is being set is the only one among the given choices |
||
375 | * @param mixed $value |
||
376 | * @return string A non-empty message if the values does not match the validation rules |
||
377 | */ |
||
378 | public function validateCalendarItemForChoiceConstraintsFromSetCalendarItem($value): string |
||
379 | { |
||
380 | $message = ''; |
||
381 | if (is_null($value)) { |
||
382 | return $message; |
||
383 | } |
||
384 | $properties = [ |
||
385 | 'Item', |
||
386 | 'Message', |
||
387 | 'Contact', |
||
388 | 'DistributionList', |
||
389 | 'MeetingMessage', |
||
390 | 'MeetingRequest', |
||
391 | 'MeetingResponse', |
||
392 | 'MeetingCancellation', |
||
393 | 'Task', |
||
394 | 'PostItem', |
||
395 | 'RoleMember', |
||
396 | 'Network', |
||
397 | 'Person', |
||
398 | 'Booking', |
||
399 | 'XrmOrganization', |
||
400 | ]; |
||
401 | try { |
||
402 | foreach ($properties as $property) { |
||
403 | if (isset($this->{$property})) { |
||
404 | throw new InvalidArgumentException(sprintf('The property CalendarItem can\'t be set as the property %s is already set. Only one property must be set among these properties: CalendarItem, %s.', $property, implode(', ', $properties)), __LINE__); |
||
405 | } |
||
406 | } |
||
407 | } catch (InvalidArgumentException $e) { |
||
408 | $message = $e->getMessage(); |
||
409 | } |
||
410 | |||
411 | return $message; |
||
412 | } |
||
413 | /** |
||
414 | * Set CalendarItem value |
||
415 | * This property belongs to a choice that allows only one property to exist. It is |
||
416 | * therefore removable from the request, consequently if the value assigned to this |
||
417 | * property is null, the property is removed from this object |
||
418 | * @throws InvalidArgumentException |
||
419 | * @param \StructType\EwsCalendarItemType $calendarItem |
||
420 | * @return \StructType\EwsAppendToItemFieldType |
||
421 | */ |
||
422 | public function setCalendarItem(?\StructType\EwsCalendarItemType $calendarItem = null): self |
||
423 | { |
||
424 | // validation for constraint: choice(Item, Message, CalendarItem, Contact, DistributionList, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking, XrmOrganization) |
||
425 | if ('' !== ($calendarItemChoiceErrorMessage = self::validateCalendarItemForChoiceConstraintsFromSetCalendarItem($calendarItem))) { |
||
426 | throw new InvalidArgumentException($calendarItemChoiceErrorMessage, __LINE__); |
||
427 | } |
||
428 | if (is_null($calendarItem) || (is_array($calendarItem) && empty($calendarItem))) { |
||
429 | unset($this->CalendarItem); |
||
430 | } else { |
||
431 | $this->CalendarItem = $calendarItem; |
||
432 | } |
||
433 | |||
434 | return $this; |
||
435 | } |
||
436 | /** |
||
437 | * Get Contact value |
||
438 | * @return \StructType\EwsContactItemType|null |
||
439 | */ |
||
440 | public function getContact(): ?\StructType\EwsContactItemType |
||
441 | { |
||
442 | return isset($this->Contact) ? $this->Contact : null; |
||
443 | } |
||
444 | /** |
||
445 | * This method is responsible for validating the value passed to the setContact method |
||
446 | * This method is willingly generated in order to preserve the one-line inline validation within the setContact method |
||
447 | * This has to validate that the property which is being set is the only one among the given choices |
||
448 | * @param mixed $value |
||
449 | * @return string A non-empty message if the values does not match the validation rules |
||
450 | */ |
||
451 | public function validateContactForChoiceConstraintsFromSetContact($value): string |
||
452 | { |
||
453 | $message = ''; |
||
454 | if (is_null($value)) { |
||
455 | return $message; |
||
456 | } |
||
457 | $properties = [ |
||
458 | 'Item', |
||
459 | 'Message', |
||
460 | 'CalendarItem', |
||
461 | 'DistributionList', |
||
462 | 'MeetingMessage', |
||
463 | 'MeetingRequest', |
||
464 | 'MeetingResponse', |
||
465 | 'MeetingCancellation', |
||
466 | 'Task', |
||
467 | 'PostItem', |
||
468 | 'RoleMember', |
||
469 | 'Network', |
||
470 | 'Person', |
||
471 | 'Booking', |
||
472 | 'XrmOrganization', |
||
473 | ]; |
||
474 | try { |
||
475 | foreach ($properties as $property) { |
||
476 | if (isset($this->{$property})) { |
||
477 | throw new InvalidArgumentException(sprintf('The property Contact can\'t be set as the property %s is already set. Only one property must be set among these properties: Contact, %s.', $property, implode(', ', $properties)), __LINE__); |
||
478 | } |
||
479 | } |
||
480 | } catch (InvalidArgumentException $e) { |
||
481 | $message = $e->getMessage(); |
||
482 | } |
||
483 | |||
484 | return $message; |
||
485 | } |
||
486 | /** |
||
487 | * Set Contact value |
||
488 | * This property belongs to a choice that allows only one property to exist. It is |
||
489 | * therefore removable from the request, consequently if the value assigned to this |
||
490 | * property is null, the property is removed from this object |
||
491 | * @throws InvalidArgumentException |
||
492 | * @param \StructType\EwsContactItemType $contact |
||
493 | * @return \StructType\EwsAppendToItemFieldType |
||
494 | */ |
||
495 | public function setContact(?\StructType\EwsContactItemType $contact = null): self |
||
496 | { |
||
497 | // validation for constraint: choice(Item, Message, CalendarItem, Contact, DistributionList, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking, XrmOrganization) |
||
498 | if ('' !== ($contactChoiceErrorMessage = self::validateContactForChoiceConstraintsFromSetContact($contact))) { |
||
499 | throw new InvalidArgumentException($contactChoiceErrorMessage, __LINE__); |
||
500 | } |
||
501 | if (is_null($contact) || (is_array($contact) && empty($contact))) { |
||
502 | unset($this->Contact); |
||
503 | } else { |
||
504 | $this->Contact = $contact; |
||
505 | } |
||
506 | |||
507 | return $this; |
||
508 | } |
||
509 | /** |
||
510 | * Get DistributionList value |
||
511 | * @return \StructType\EwsDistributionListType|null |
||
512 | */ |
||
513 | public function getDistributionList(): ?\StructType\EwsDistributionListType |
||
514 | { |
||
515 | return isset($this->DistributionList) ? $this->DistributionList : null; |
||
516 | } |
||
517 | /** |
||
518 | * This method is responsible for validating the value passed to the setDistributionList method |
||
519 | * This method is willingly generated in order to preserve the one-line inline validation within the setDistributionList method |
||
520 | * This has to validate that the property which is being set is the only one among the given choices |
||
521 | * @param mixed $value |
||
522 | * @return string A non-empty message if the values does not match the validation rules |
||
523 | */ |
||
524 | public function validateDistributionListForChoiceConstraintsFromSetDistributionList($value): string |
||
525 | { |
||
526 | $message = ''; |
||
527 | if (is_null($value)) { |
||
528 | return $message; |
||
529 | } |
||
530 | $properties = [ |
||
531 | 'Item', |
||
532 | 'Message', |
||
533 | 'CalendarItem', |
||
534 | 'Contact', |
||
535 | 'MeetingMessage', |
||
536 | 'MeetingRequest', |
||
537 | 'MeetingResponse', |
||
538 | 'MeetingCancellation', |
||
539 | 'Task', |
||
540 | 'PostItem', |
||
541 | 'RoleMember', |
||
542 | 'Network', |
||
543 | 'Person', |
||
544 | 'Booking', |
||
545 | 'XrmOrganization', |
||
546 | ]; |
||
547 | try { |
||
548 | foreach ($properties as $property) { |
||
549 | if (isset($this->{$property})) { |
||
550 | throw new InvalidArgumentException(sprintf('The property DistributionList can\'t be set as the property %s is already set. Only one property must be set among these properties: DistributionList, %s.', $property, implode(', ', $properties)), __LINE__); |
||
551 | } |
||
552 | } |
||
553 | } catch (InvalidArgumentException $e) { |
||
554 | $message = $e->getMessage(); |
||
555 | } |
||
556 | |||
557 | return $message; |
||
558 | } |
||
559 | /** |
||
560 | * Set DistributionList value |
||
561 | * This property belongs to a choice that allows only one property to exist. It is |
||
562 | * therefore removable from the request, consequently if the value assigned to this |
||
563 | * property is null, the property is removed from this object |
||
564 | * @throws InvalidArgumentException |
||
565 | * @param \StructType\EwsDistributionListType $distributionList |
||
566 | * @return \StructType\EwsAppendToItemFieldType |
||
567 | */ |
||
568 | public function setDistributionList(?\StructType\EwsDistributionListType $distributionList = null): self |
||
569 | { |
||
570 | // validation for constraint: choice(Item, Message, CalendarItem, Contact, DistributionList, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking, XrmOrganization) |
||
571 | if ('' !== ($distributionListChoiceErrorMessage = self::validateDistributionListForChoiceConstraintsFromSetDistributionList($distributionList))) { |
||
572 | throw new InvalidArgumentException($distributionListChoiceErrorMessage, __LINE__); |
||
573 | } |
||
574 | if (is_null($distributionList) || (is_array($distributionList) && empty($distributionList))) { |
||
575 | unset($this->DistributionList); |
||
576 | } else { |
||
577 | $this->DistributionList = $distributionList; |
||
578 | } |
||
579 | |||
580 | return $this; |
||
581 | } |
||
582 | /** |
||
583 | * Get MeetingMessage value |
||
584 | * @return \StructType\EwsMeetingMessageType|null |
||
585 | */ |
||
586 | public function getMeetingMessage(): ?\StructType\EwsMeetingMessageType |
||
587 | { |
||
588 | return isset($this->MeetingMessage) ? $this->MeetingMessage : null; |
||
589 | } |
||
590 | /** |
||
591 | * This method is responsible for validating the value passed to the setMeetingMessage method |
||
592 | * This method is willingly generated in order to preserve the one-line inline validation within the setMeetingMessage method |
||
593 | * This has to validate that the property which is being set is the only one among the given choices |
||
594 | * @param mixed $value |
||
595 | * @return string A non-empty message if the values does not match the validation rules |
||
596 | */ |
||
597 | public function validateMeetingMessageForChoiceConstraintsFromSetMeetingMessage($value): string |
||
598 | { |
||
599 | $message = ''; |
||
600 | if (is_null($value)) { |
||
601 | return $message; |
||
602 | } |
||
603 | $properties = [ |
||
604 | 'Item', |
||
605 | 'Message', |
||
606 | 'CalendarItem', |
||
607 | 'Contact', |
||
608 | 'DistributionList', |
||
609 | 'MeetingRequest', |
||
610 | 'MeetingResponse', |
||
611 | 'MeetingCancellation', |
||
612 | 'Task', |
||
613 | 'PostItem', |
||
614 | 'RoleMember', |
||
615 | 'Network', |
||
616 | 'Person', |
||
617 | 'Booking', |
||
618 | 'XrmOrganization', |
||
619 | ]; |
||
620 | try { |
||
621 | foreach ($properties as $property) { |
||
622 | if (isset($this->{$property})) { |
||
623 | throw new InvalidArgumentException(sprintf('The property MeetingMessage can\'t be set as the property %s is already set. Only one property must be set among these properties: MeetingMessage, %s.', $property, implode(', ', $properties)), __LINE__); |
||
624 | } |
||
625 | } |
||
626 | } catch (InvalidArgumentException $e) { |
||
627 | $message = $e->getMessage(); |
||
628 | } |
||
629 | |||
630 | return $message; |
||
631 | } |
||
632 | /** |
||
633 | * Set MeetingMessage value |
||
634 | * This property belongs to a choice that allows only one property to exist. It is |
||
635 | * therefore removable from the request, consequently if the value assigned to this |
||
636 | * property is null, the property is removed from this object |
||
637 | * @throws InvalidArgumentException |
||
638 | * @param \StructType\EwsMeetingMessageType $meetingMessage |
||
639 | * @return \StructType\EwsAppendToItemFieldType |
||
640 | */ |
||
641 | public function setMeetingMessage(?\StructType\EwsMeetingMessageType $meetingMessage = null): self |
||
642 | { |
||
643 | // validation for constraint: choice(Item, Message, CalendarItem, Contact, DistributionList, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking, XrmOrganization) |
||
644 | if ('' !== ($meetingMessageChoiceErrorMessage = self::validateMeetingMessageForChoiceConstraintsFromSetMeetingMessage($meetingMessage))) { |
||
645 | throw new InvalidArgumentException($meetingMessageChoiceErrorMessage, __LINE__); |
||
646 | } |
||
647 | if (is_null($meetingMessage) || (is_array($meetingMessage) && empty($meetingMessage))) { |
||
648 | unset($this->MeetingMessage); |
||
649 | } else { |
||
650 | $this->MeetingMessage = $meetingMessage; |
||
651 | } |
||
652 | |||
653 | return $this; |
||
654 | } |
||
655 | /** |
||
656 | * Get MeetingRequest value |
||
657 | * @return \StructType\EwsMeetingRequestMessageType|null |
||
658 | */ |
||
659 | public function getMeetingRequest(): ?\StructType\EwsMeetingRequestMessageType |
||
660 | { |
||
661 | return isset($this->MeetingRequest) ? $this->MeetingRequest : null; |
||
662 | } |
||
663 | /** |
||
664 | * This method is responsible for validating the value passed to the setMeetingRequest method |
||
665 | * This method is willingly generated in order to preserve the one-line inline validation within the setMeetingRequest method |
||
666 | * This has to validate that the property which is being set is the only one among the given choices |
||
667 | * @param mixed $value |
||
668 | * @return string A non-empty message if the values does not match the validation rules |
||
669 | */ |
||
670 | public function validateMeetingRequestForChoiceConstraintsFromSetMeetingRequest($value): string |
||
671 | { |
||
672 | $message = ''; |
||
673 | if (is_null($value)) { |
||
674 | return $message; |
||
675 | } |
||
676 | $properties = [ |
||
677 | 'Item', |
||
678 | 'Message', |
||
679 | 'CalendarItem', |
||
680 | 'Contact', |
||
681 | 'DistributionList', |
||
682 | 'MeetingMessage', |
||
683 | 'MeetingResponse', |
||
684 | 'MeetingCancellation', |
||
685 | 'Task', |
||
686 | 'PostItem', |
||
687 | 'RoleMember', |
||
688 | 'Network', |
||
689 | 'Person', |
||
690 | 'Booking', |
||
691 | 'XrmOrganization', |
||
692 | ]; |
||
693 | try { |
||
694 | foreach ($properties as $property) { |
||
695 | if (isset($this->{$property})) { |
||
696 | throw new InvalidArgumentException(sprintf('The property MeetingRequest can\'t be set as the property %s is already set. Only one property must be set among these properties: MeetingRequest, %s.', $property, implode(', ', $properties)), __LINE__); |
||
697 | } |
||
698 | } |
||
699 | } catch (InvalidArgumentException $e) { |
||
700 | $message = $e->getMessage(); |
||
701 | } |
||
702 | |||
703 | return $message; |
||
704 | } |
||
705 | /** |
||
706 | * Set MeetingRequest value |
||
707 | * This property belongs to a choice that allows only one property to exist. It is |
||
708 | * therefore removable from the request, consequently if the value assigned to this |
||
709 | * property is null, the property is removed from this object |
||
710 | * @throws InvalidArgumentException |
||
711 | * @param \StructType\EwsMeetingRequestMessageType $meetingRequest |
||
712 | * @return \StructType\EwsAppendToItemFieldType |
||
713 | */ |
||
714 | public function setMeetingRequest(?\StructType\EwsMeetingRequestMessageType $meetingRequest = null): self |
||
715 | { |
||
716 | // validation for constraint: choice(Item, Message, CalendarItem, Contact, DistributionList, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking, XrmOrganization) |
||
717 | if ('' !== ($meetingRequestChoiceErrorMessage = self::validateMeetingRequestForChoiceConstraintsFromSetMeetingRequest($meetingRequest))) { |
||
718 | throw new InvalidArgumentException($meetingRequestChoiceErrorMessage, __LINE__); |
||
719 | } |
||
720 | if (is_null($meetingRequest) || (is_array($meetingRequest) && empty($meetingRequest))) { |
||
721 | unset($this->MeetingRequest); |
||
722 | } else { |
||
723 | $this->MeetingRequest = $meetingRequest; |
||
724 | } |
||
725 | |||
726 | return $this; |
||
727 | } |
||
728 | /** |
||
729 | * Get MeetingResponse value |
||
730 | * @return \StructType\EwsMeetingResponseMessageType|null |
||
731 | */ |
||
732 | public function getMeetingResponse(): ?\StructType\EwsMeetingResponseMessageType |
||
733 | { |
||
734 | return isset($this->MeetingResponse) ? $this->MeetingResponse : null; |
||
735 | } |
||
736 | /** |
||
737 | * This method is responsible for validating the value passed to the setMeetingResponse method |
||
738 | * This method is willingly generated in order to preserve the one-line inline validation within the setMeetingResponse method |
||
739 | * This has to validate that the property which is being set is the only one among the given choices |
||
740 | * @param mixed $value |
||
741 | * @return string A non-empty message if the values does not match the validation rules |
||
742 | */ |
||
743 | public function validateMeetingResponseForChoiceConstraintsFromSetMeetingResponse($value): string |
||
744 | { |
||
745 | $message = ''; |
||
746 | if (is_null($value)) { |
||
747 | return $message; |
||
748 | } |
||
749 | $properties = [ |
||
750 | 'Item', |
||
751 | 'Message', |
||
752 | 'CalendarItem', |
||
753 | 'Contact', |
||
754 | 'DistributionList', |
||
755 | 'MeetingMessage', |
||
756 | 'MeetingRequest', |
||
757 | 'MeetingCancellation', |
||
758 | 'Task', |
||
759 | 'PostItem', |
||
760 | 'RoleMember', |
||
761 | 'Network', |
||
762 | 'Person', |
||
763 | 'Booking', |
||
764 | 'XrmOrganization', |
||
765 | ]; |
||
766 | try { |
||
767 | foreach ($properties as $property) { |
||
768 | if (isset($this->{$property})) { |
||
769 | throw new InvalidArgumentException(sprintf('The property MeetingResponse can\'t be set as the property %s is already set. Only one property must be set among these properties: MeetingResponse, %s.', $property, implode(', ', $properties)), __LINE__); |
||
770 | } |
||
771 | } |
||
772 | } catch (InvalidArgumentException $e) { |
||
773 | $message = $e->getMessage(); |
||
774 | } |
||
775 | |||
776 | return $message; |
||
777 | } |
||
778 | /** |
||
779 | * Set MeetingResponse value |
||
780 | * This property belongs to a choice that allows only one property to exist. It is |
||
781 | * therefore removable from the request, consequently if the value assigned to this |
||
782 | * property is null, the property is removed from this object |
||
783 | * @throws InvalidArgumentException |
||
784 | * @param \StructType\EwsMeetingResponseMessageType $meetingResponse |
||
785 | * @return \StructType\EwsAppendToItemFieldType |
||
786 | */ |
||
787 | public function setMeetingResponse(?\StructType\EwsMeetingResponseMessageType $meetingResponse = null): self |
||
788 | { |
||
789 | // validation for constraint: choice(Item, Message, CalendarItem, Contact, DistributionList, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking, XrmOrganization) |
||
790 | if ('' !== ($meetingResponseChoiceErrorMessage = self::validateMeetingResponseForChoiceConstraintsFromSetMeetingResponse($meetingResponse))) { |
||
791 | throw new InvalidArgumentException($meetingResponseChoiceErrorMessage, __LINE__); |
||
792 | } |
||
793 | if (is_null($meetingResponse) || (is_array($meetingResponse) && empty($meetingResponse))) { |
||
794 | unset($this->MeetingResponse); |
||
795 | } else { |
||
796 | $this->MeetingResponse = $meetingResponse; |
||
797 | } |
||
798 | |||
799 | return $this; |
||
800 | } |
||
801 | /** |
||
802 | * Get MeetingCancellation value |
||
803 | * @return \StructType\EwsMeetingCancellationMessageType|null |
||
804 | */ |
||
805 | public function getMeetingCancellation(): ?\StructType\EwsMeetingCancellationMessageType |
||
806 | { |
||
807 | return isset($this->MeetingCancellation) ? $this->MeetingCancellation : null; |
||
808 | } |
||
809 | /** |
||
810 | * This method is responsible for validating the value passed to the setMeetingCancellation method |
||
811 | * This method is willingly generated in order to preserve the one-line inline validation within the setMeetingCancellation method |
||
812 | * This has to validate that the property which is being set is the only one among the given choices |
||
813 | * @param mixed $value |
||
814 | * @return string A non-empty message if the values does not match the validation rules |
||
815 | */ |
||
816 | public function validateMeetingCancellationForChoiceConstraintsFromSetMeetingCancellation($value): string |
||
817 | { |
||
818 | $message = ''; |
||
819 | if (is_null($value)) { |
||
820 | return $message; |
||
821 | } |
||
822 | $properties = [ |
||
823 | 'Item', |
||
824 | 'Message', |
||
825 | 'CalendarItem', |
||
826 | 'Contact', |
||
827 | 'DistributionList', |
||
828 | 'MeetingMessage', |
||
829 | 'MeetingRequest', |
||
830 | 'MeetingResponse', |
||
831 | 'Task', |
||
832 | 'PostItem', |
||
833 | 'RoleMember', |
||
834 | 'Network', |
||
835 | 'Person', |
||
836 | 'Booking', |
||
837 | 'XrmOrganization', |
||
838 | ]; |
||
839 | try { |
||
840 | foreach ($properties as $property) { |
||
841 | if (isset($this->{$property})) { |
||
842 | throw new InvalidArgumentException(sprintf('The property MeetingCancellation can\'t be set as the property %s is already set. Only one property must be set among these properties: MeetingCancellation, %s.', $property, implode(', ', $properties)), __LINE__); |
||
843 | } |
||
844 | } |
||
845 | } catch (InvalidArgumentException $e) { |
||
846 | $message = $e->getMessage(); |
||
847 | } |
||
848 | |||
849 | return $message; |
||
850 | } |
||
851 | /** |
||
852 | * Set MeetingCancellation value |
||
853 | * This property belongs to a choice that allows only one property to exist. It is |
||
854 | * therefore removable from the request, consequently if the value assigned to this |
||
855 | * property is null, the property is removed from this object |
||
856 | * @throws InvalidArgumentException |
||
857 | * @param \StructType\EwsMeetingCancellationMessageType $meetingCancellation |
||
858 | * @return \StructType\EwsAppendToItemFieldType |
||
859 | */ |
||
860 | public function setMeetingCancellation(?\StructType\EwsMeetingCancellationMessageType $meetingCancellation = null): self |
||
861 | { |
||
862 | // validation for constraint: choice(Item, Message, CalendarItem, Contact, DistributionList, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking, XrmOrganization) |
||
863 | if ('' !== ($meetingCancellationChoiceErrorMessage = self::validateMeetingCancellationForChoiceConstraintsFromSetMeetingCancellation($meetingCancellation))) { |
||
864 | throw new InvalidArgumentException($meetingCancellationChoiceErrorMessage, __LINE__); |
||
865 | } |
||
866 | if (is_null($meetingCancellation) || (is_array($meetingCancellation) && empty($meetingCancellation))) { |
||
867 | unset($this->MeetingCancellation); |
||
868 | } else { |
||
869 | $this->MeetingCancellation = $meetingCancellation; |
||
870 | } |
||
871 | |||
872 | return $this; |
||
873 | } |
||
874 | /** |
||
875 | * Get Task value |
||
876 | * @return \StructType\EwsTaskType|null |
||
877 | */ |
||
878 | public function getTask(): ?\StructType\EwsTaskType |
||
879 | { |
||
880 | return isset($this->Task) ? $this->Task : null; |
||
881 | } |
||
882 | /** |
||
883 | * This method is responsible for validating the value passed to the setTask method |
||
884 | * This method is willingly generated in order to preserve the one-line inline validation within the setTask method |
||
885 | * This has to validate that the property which is being set is the only one among the given choices |
||
886 | * @param mixed $value |
||
887 | * @return string A non-empty message if the values does not match the validation rules |
||
888 | */ |
||
889 | public function validateTaskForChoiceConstraintsFromSetTask($value): string |
||
890 | { |
||
891 | $message = ''; |
||
892 | if (is_null($value)) { |
||
893 | return $message; |
||
894 | } |
||
895 | $properties = [ |
||
896 | 'Item', |
||
897 | 'Message', |
||
898 | 'CalendarItem', |
||
899 | 'Contact', |
||
900 | 'DistributionList', |
||
901 | 'MeetingMessage', |
||
902 | 'MeetingRequest', |
||
903 | 'MeetingResponse', |
||
904 | 'MeetingCancellation', |
||
905 | 'PostItem', |
||
906 | 'RoleMember', |
||
907 | 'Network', |
||
908 | 'Person', |
||
909 | 'Booking', |
||
910 | 'XrmOrganization', |
||
911 | ]; |
||
912 | try { |
||
913 | foreach ($properties as $property) { |
||
914 | if (isset($this->{$property})) { |
||
915 | throw new InvalidArgumentException(sprintf('The property Task can\'t be set as the property %s is already set. Only one property must be set among these properties: Task, %s.', $property, implode(', ', $properties)), __LINE__); |
||
916 | } |
||
917 | } |
||
918 | } catch (InvalidArgumentException $e) { |
||
919 | $message = $e->getMessage(); |
||
920 | } |
||
921 | |||
922 | return $message; |
||
923 | } |
||
924 | /** |
||
925 | * Set Task value |
||
926 | * This property belongs to a choice that allows only one property to exist. It is |
||
927 | * therefore removable from the request, consequently if the value assigned to this |
||
928 | * property is null, the property is removed from this object |
||
929 | * @throws InvalidArgumentException |
||
930 | * @param \StructType\EwsTaskType $task |
||
931 | * @return \StructType\EwsAppendToItemFieldType |
||
932 | */ |
||
933 | public function setTask(?\StructType\EwsTaskType $task = null): self |
||
934 | { |
||
935 | // validation for constraint: choice(Item, Message, CalendarItem, Contact, DistributionList, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking, XrmOrganization) |
||
936 | if ('' !== ($taskChoiceErrorMessage = self::validateTaskForChoiceConstraintsFromSetTask($task))) { |
||
937 | throw new InvalidArgumentException($taskChoiceErrorMessage, __LINE__); |
||
938 | } |
||
939 | if (is_null($task) || (is_array($task) && empty($task))) { |
||
940 | unset($this->Task); |
||
941 | } else { |
||
942 | $this->Task = $task; |
||
943 | } |
||
944 | |||
945 | return $this; |
||
946 | } |
||
947 | /** |
||
948 | * Get PostItem value |
||
949 | * @return \StructType\EwsPostItemType|null |
||
950 | */ |
||
951 | public function getPostItem(): ?\StructType\EwsPostItemType |
||
952 | { |
||
953 | return isset($this->PostItem) ? $this->PostItem : null; |
||
954 | } |
||
955 | /** |
||
956 | * This method is responsible for validating the value passed to the setPostItem method |
||
957 | * This method is willingly generated in order to preserve the one-line inline validation within the setPostItem method |
||
958 | * This has to validate that the property which is being set is the only one among the given choices |
||
959 | * @param mixed $value |
||
960 | * @return string A non-empty message if the values does not match the validation rules |
||
961 | */ |
||
962 | public function validatePostItemForChoiceConstraintsFromSetPostItem($value): string |
||
963 | { |
||
964 | $message = ''; |
||
965 | if (is_null($value)) { |
||
966 | return $message; |
||
967 | } |
||
968 | $properties = [ |
||
969 | 'Item', |
||
970 | 'Message', |
||
971 | 'CalendarItem', |
||
972 | 'Contact', |
||
973 | 'DistributionList', |
||
974 | 'MeetingMessage', |
||
975 | 'MeetingRequest', |
||
976 | 'MeetingResponse', |
||
977 | 'MeetingCancellation', |
||
978 | 'Task', |
||
979 | 'RoleMember', |
||
980 | 'Network', |
||
981 | 'Person', |
||
982 | 'Booking', |
||
983 | 'XrmOrganization', |
||
984 | ]; |
||
985 | try { |
||
986 | foreach ($properties as $property) { |
||
987 | if (isset($this->{$property})) { |
||
988 | throw new InvalidArgumentException(sprintf('The property PostItem can\'t be set as the property %s is already set. Only one property must be set among these properties: PostItem, %s.', $property, implode(', ', $properties)), __LINE__); |
||
989 | } |
||
990 | } |
||
991 | } catch (InvalidArgumentException $e) { |
||
992 | $message = $e->getMessage(); |
||
993 | } |
||
994 | |||
995 | return $message; |
||
996 | } |
||
997 | /** |
||
998 | * Set PostItem value |
||
999 | * This property belongs to a choice that allows only one property to exist. It is |
||
1000 | * therefore removable from the request, consequently if the value assigned to this |
||
1001 | * property is null, the property is removed from this object |
||
1002 | * @throws InvalidArgumentException |
||
1003 | * @param \StructType\EwsPostItemType $postItem |
||
1004 | * @return \StructType\EwsAppendToItemFieldType |
||
1005 | */ |
||
1006 | public function setPostItem(?\StructType\EwsPostItemType $postItem = null): self |
||
1007 | { |
||
1008 | // validation for constraint: choice(Item, Message, CalendarItem, Contact, DistributionList, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking, XrmOrganization) |
||
1009 | if ('' !== ($postItemChoiceErrorMessage = self::validatePostItemForChoiceConstraintsFromSetPostItem($postItem))) { |
||
1010 | throw new InvalidArgumentException($postItemChoiceErrorMessage, __LINE__); |
||
1011 | } |
||
1012 | if (is_null($postItem) || (is_array($postItem) && empty($postItem))) { |
||
1013 | unset($this->PostItem); |
||
1014 | } else { |
||
1015 | $this->PostItem = $postItem; |
||
1016 | } |
||
1017 | |||
1018 | return $this; |
||
1019 | } |
||
1020 | /** |
||
1021 | * Get RoleMember value |
||
1022 | * @return \StructType\EwsRoleMemberItemType|null |
||
1023 | */ |
||
1024 | public function getRoleMember(): ?\StructType\EwsRoleMemberItemType |
||
1025 | { |
||
1026 | return isset($this->RoleMember) ? $this->RoleMember : null; |
||
1027 | } |
||
1028 | /** |
||
1029 | * This method is responsible for validating the value passed to the setRoleMember method |
||
1030 | * This method is willingly generated in order to preserve the one-line inline validation within the setRoleMember method |
||
1031 | * This has to validate that the property which is being set is the only one among the given choices |
||
1032 | * @param mixed $value |
||
1033 | * @return string A non-empty message if the values does not match the validation rules |
||
1034 | */ |
||
1035 | public function validateRoleMemberForChoiceConstraintsFromSetRoleMember($value): string |
||
1036 | { |
||
1037 | $message = ''; |
||
1038 | if (is_null($value)) { |
||
1039 | return $message; |
||
1040 | } |
||
1041 | $properties = [ |
||
1042 | 'Item', |
||
1043 | 'Message', |
||
1044 | 'CalendarItem', |
||
1045 | 'Contact', |
||
1046 | 'DistributionList', |
||
1047 | 'MeetingMessage', |
||
1048 | 'MeetingRequest', |
||
1049 | 'MeetingResponse', |
||
1050 | 'MeetingCancellation', |
||
1051 | 'Task', |
||
1052 | 'PostItem', |
||
1053 | 'Network', |
||
1054 | 'Person', |
||
1055 | 'Booking', |
||
1056 | 'XrmOrganization', |
||
1057 | ]; |
||
1058 | try { |
||
1059 | foreach ($properties as $property) { |
||
1060 | if (isset($this->{$property})) { |
||
1061 | throw new InvalidArgumentException(sprintf('The property RoleMember can\'t be set as the property %s is already set. Only one property must be set among these properties: RoleMember, %s.', $property, implode(', ', $properties)), __LINE__); |
||
1062 | } |
||
1063 | } |
||
1064 | } catch (InvalidArgumentException $e) { |
||
1065 | $message = $e->getMessage(); |
||
1066 | } |
||
1067 | |||
1068 | return $message; |
||
1069 | } |
||
1070 | /** |
||
1071 | * Set RoleMember value |
||
1072 | * This property belongs to a choice that allows only one property to exist. It is |
||
1073 | * therefore removable from the request, consequently if the value assigned to this |
||
1074 | * property is null, the property is removed from this object |
||
1075 | * @throws InvalidArgumentException |
||
1076 | * @param \StructType\EwsRoleMemberItemType $roleMember |
||
1077 | * @return \StructType\EwsAppendToItemFieldType |
||
1078 | */ |
||
1079 | public function setRoleMember(?\StructType\EwsRoleMemberItemType $roleMember = null): self |
||
1080 | { |
||
1081 | // validation for constraint: choice(Item, Message, CalendarItem, Contact, DistributionList, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking, XrmOrganization) |
||
1082 | if ('' !== ($roleMemberChoiceErrorMessage = self::validateRoleMemberForChoiceConstraintsFromSetRoleMember($roleMember))) { |
||
1083 | throw new InvalidArgumentException($roleMemberChoiceErrorMessage, __LINE__); |
||
1084 | } |
||
1085 | if (is_null($roleMember) || (is_array($roleMember) && empty($roleMember))) { |
||
1086 | unset($this->RoleMember); |
||
1087 | } else { |
||
1088 | $this->RoleMember = $roleMember; |
||
1089 | } |
||
1090 | |||
1091 | return $this; |
||
1092 | } |
||
1093 | /** |
||
1094 | * Get Network value |
||
1095 | * @return \StructType\EwsNetworkItemType|null |
||
1096 | */ |
||
1097 | public function getNetwork(): ?\StructType\EwsNetworkItemType |
||
1098 | { |
||
1099 | return isset($this->Network) ? $this->Network : null; |
||
1100 | } |
||
1101 | /** |
||
1102 | * This method is responsible for validating the value passed to the setNetwork method |
||
1103 | * This method is willingly generated in order to preserve the one-line inline validation within the setNetwork method |
||
1104 | * This has to validate that the property which is being set is the only one among the given choices |
||
1105 | * @param mixed $value |
||
1106 | * @return string A non-empty message if the values does not match the validation rules |
||
1107 | */ |
||
1108 | public function validateNetworkForChoiceConstraintsFromSetNetwork($value): string |
||
1109 | { |
||
1110 | $message = ''; |
||
1111 | if (is_null($value)) { |
||
1112 | return $message; |
||
1113 | } |
||
1114 | $properties = [ |
||
1115 | 'Item', |
||
1116 | 'Message', |
||
1117 | 'CalendarItem', |
||
1118 | 'Contact', |
||
1119 | 'DistributionList', |
||
1120 | 'MeetingMessage', |
||
1121 | 'MeetingRequest', |
||
1122 | 'MeetingResponse', |
||
1123 | 'MeetingCancellation', |
||
1124 | 'Task', |
||
1125 | 'PostItem', |
||
1126 | 'RoleMember', |
||
1127 | 'Person', |
||
1128 | 'Booking', |
||
1129 | 'XrmOrganization', |
||
1130 | ]; |
||
1131 | try { |
||
1132 | foreach ($properties as $property) { |
||
1133 | if (isset($this->{$property})) { |
||
1134 | throw new InvalidArgumentException(sprintf('The property Network can\'t be set as the property %s is already set. Only one property must be set among these properties: Network, %s.', $property, implode(', ', $properties)), __LINE__); |
||
1135 | } |
||
1136 | } |
||
1137 | } catch (InvalidArgumentException $e) { |
||
1138 | $message = $e->getMessage(); |
||
1139 | } |
||
1140 | |||
1141 | return $message; |
||
1142 | } |
||
1143 | /** |
||
1144 | * Set Network value |
||
1145 | * This property belongs to a choice that allows only one property to exist. It is |
||
1146 | * therefore removable from the request, consequently if the value assigned to this |
||
1147 | * property is null, the property is removed from this object |
||
1148 | * @throws InvalidArgumentException |
||
1149 | * @param \StructType\EwsNetworkItemType $network |
||
1150 | * @return \StructType\EwsAppendToItemFieldType |
||
1151 | */ |
||
1152 | public function setNetwork(?\StructType\EwsNetworkItemType $network = null): self |
||
1153 | { |
||
1154 | // validation for constraint: choice(Item, Message, CalendarItem, Contact, DistributionList, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking, XrmOrganization) |
||
1155 | if ('' !== ($networkChoiceErrorMessage = self::validateNetworkForChoiceConstraintsFromSetNetwork($network))) { |
||
1156 | throw new InvalidArgumentException($networkChoiceErrorMessage, __LINE__); |
||
1157 | } |
||
1158 | if (is_null($network) || (is_array($network) && empty($network))) { |
||
1159 | unset($this->Network); |
||
1160 | } else { |
||
1161 | $this->Network = $network; |
||
1162 | } |
||
1163 | |||
1164 | return $this; |
||
1165 | } |
||
1166 | /** |
||
1167 | * Get Person value |
||
1168 | * @return \StructType\EwsAbchPersonItemType|null |
||
1169 | */ |
||
1170 | public function getPerson(): ?\StructType\EwsAbchPersonItemType |
||
1171 | { |
||
1172 | return isset($this->Person) ? $this->Person : null; |
||
1173 | } |
||
1174 | /** |
||
1175 | * This method is responsible for validating the value passed to the setPerson method |
||
1176 | * This method is willingly generated in order to preserve the one-line inline validation within the setPerson method |
||
1177 | * This has to validate that the property which is being set is the only one among the given choices |
||
1178 | * @param mixed $value |
||
1179 | * @return string A non-empty message if the values does not match the validation rules |
||
1180 | */ |
||
1181 | public function validatePersonForChoiceConstraintsFromSetPerson($value): string |
||
1182 | { |
||
1183 | $message = ''; |
||
1184 | if (is_null($value)) { |
||
1185 | return $message; |
||
1186 | } |
||
1187 | $properties = [ |
||
1188 | 'Item', |
||
1189 | 'Message', |
||
1190 | 'CalendarItem', |
||
1191 | 'Contact', |
||
1192 | 'DistributionList', |
||
1193 | 'MeetingMessage', |
||
1194 | 'MeetingRequest', |
||
1195 | 'MeetingResponse', |
||
1196 | 'MeetingCancellation', |
||
1197 | 'Task', |
||
1198 | 'PostItem', |
||
1199 | 'RoleMember', |
||
1200 | 'Network', |
||
1201 | 'Booking', |
||
1202 | 'XrmOrganization', |
||
1203 | ]; |
||
1204 | try { |
||
1205 | foreach ($properties as $property) { |
||
1206 | if (isset($this->{$property})) { |
||
1207 | throw new InvalidArgumentException(sprintf('The property Person can\'t be set as the property %s is already set. Only one property must be set among these properties: Person, %s.', $property, implode(', ', $properties)), __LINE__); |
||
1208 | } |
||
1209 | } |
||
1210 | } catch (InvalidArgumentException $e) { |
||
1211 | $message = $e->getMessage(); |
||
1212 | } |
||
1213 | |||
1214 | return $message; |
||
1215 | } |
||
1216 | /** |
||
1217 | * Set Person value |
||
1218 | * This property belongs to a choice that allows only one property to exist. It is |
||
1219 | * therefore removable from the request, consequently if the value assigned to this |
||
1220 | * property is null, the property is removed from this object |
||
1221 | * @throws InvalidArgumentException |
||
1222 | * @param \StructType\EwsAbchPersonItemType $person |
||
1223 | * @return \StructType\EwsAppendToItemFieldType |
||
1224 | */ |
||
1225 | public function setPerson(?\StructType\EwsAbchPersonItemType $person = null): self |
||
1226 | { |
||
1227 | // validation for constraint: choice(Item, Message, CalendarItem, Contact, DistributionList, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking, XrmOrganization) |
||
1228 | if ('' !== ($personChoiceErrorMessage = self::validatePersonForChoiceConstraintsFromSetPerson($person))) { |
||
1229 | throw new InvalidArgumentException($personChoiceErrorMessage, __LINE__); |
||
1230 | } |
||
1231 | if (is_null($person) || (is_array($person) && empty($person))) { |
||
1232 | unset($this->Person); |
||
1233 | } else { |
||
1234 | $this->Person = $person; |
||
1235 | } |
||
1236 | |||
1237 | return $this; |
||
1238 | } |
||
1239 | /** |
||
1240 | * Get Booking value |
||
1241 | * @return \StructType\EwsBookingItemType|null |
||
1242 | */ |
||
1243 | public function getBooking(): ?\StructType\EwsBookingItemType |
||
1244 | { |
||
1245 | return isset($this->Booking) ? $this->Booking : null; |
||
1246 | } |
||
1247 | /** |
||
1248 | * This method is responsible for validating the value passed to the setBooking method |
||
1249 | * This method is willingly generated in order to preserve the one-line inline validation within the setBooking method |
||
1250 | * This has to validate that the property which is being set is the only one among the given choices |
||
1251 | * @param mixed $value |
||
1252 | * @return string A non-empty message if the values does not match the validation rules |
||
1253 | */ |
||
1254 | public function validateBookingForChoiceConstraintsFromSetBooking($value): string |
||
1255 | { |
||
1256 | $message = ''; |
||
1257 | if (is_null($value)) { |
||
1258 | return $message; |
||
1259 | } |
||
1260 | $properties = [ |
||
1261 | 'Item', |
||
1262 | 'Message', |
||
1263 | 'CalendarItem', |
||
1264 | 'Contact', |
||
1265 | 'DistributionList', |
||
1266 | 'MeetingMessage', |
||
1267 | 'MeetingRequest', |
||
1268 | 'MeetingResponse', |
||
1269 | 'MeetingCancellation', |
||
1270 | 'Task', |
||
1271 | 'PostItem', |
||
1272 | 'RoleMember', |
||
1273 | 'Network', |
||
1274 | 'Person', |
||
1275 | 'XrmOrganization', |
||
1276 | ]; |
||
1277 | try { |
||
1278 | foreach ($properties as $property) { |
||
1279 | if (isset($this->{$property})) { |
||
1280 | throw new InvalidArgumentException(sprintf('The property Booking can\'t be set as the property %s is already set. Only one property must be set among these properties: Booking, %s.', $property, implode(', ', $properties)), __LINE__); |
||
1281 | } |
||
1282 | } |
||
1283 | } catch (InvalidArgumentException $e) { |
||
1284 | $message = $e->getMessage(); |
||
1285 | } |
||
1286 | |||
1287 | return $message; |
||
1288 | } |
||
1289 | /** |
||
1290 | * Set Booking value |
||
1291 | * This property belongs to a choice that allows only one property to exist. It is |
||
1292 | * therefore removable from the request, consequently if the value assigned to this |
||
1293 | * property is null, the property is removed from this object |
||
1294 | * @throws InvalidArgumentException |
||
1295 | * @param \StructType\EwsBookingItemType $booking |
||
1296 | * @return \StructType\EwsAppendToItemFieldType |
||
1297 | */ |
||
1298 | public function setBooking(?\StructType\EwsBookingItemType $booking = null): self |
||
1311 | } |
||
1312 | /** |
||
1313 | * Get XrmOrganization value |
||
1314 | * @return \StructType\EwsXrmOrganizationItemType|null |
||
1315 | */ |
||
1316 | public function getXrmOrganization(): ?\StructType\EwsXrmOrganizationItemType |
||
1317 | { |
||
1318 | return isset($this->XrmOrganization) ? $this->XrmOrganization : null; |
||
1319 | } |
||
1320 | /** |
||
1321 | * This method is responsible for validating the value passed to the setXrmOrganization method |
||
1322 | * This method is willingly generated in order to preserve the one-line inline validation within the setXrmOrganization method |
||
1323 | * This has to validate that the property which is being set is the only one among the given choices |
||
1324 | * @param mixed $value |
||
1325 | * @return string A non-empty message if the values does not match the validation rules |
||
1326 | */ |
||
1327 | public function validateXrmOrganizationForChoiceConstraintsFromSetXrmOrganization($value): string |
||
1328 | { |
||
1329 | $message = ''; |
||
1330 | if (is_null($value)) { |
||
1331 | return $message; |
||
1332 | } |
||
1333 | $properties = [ |
||
1334 | 'Item', |
||
1335 | 'Message', |
||
1336 | 'CalendarItem', |
||
1337 | 'Contact', |
||
1338 | 'DistributionList', |
||
1339 | 'MeetingMessage', |
||
1340 | 'MeetingRequest', |
||
1341 | 'MeetingResponse', |
||
1342 | 'MeetingCancellation', |
||
1343 | 'Task', |
||
1344 | 'PostItem', |
||
1345 | 'RoleMember', |
||
1346 | 'Network', |
||
1347 | 'Person', |
||
1348 | 'Booking', |
||
1349 | ]; |
||
1350 | try { |
||
1351 | foreach ($properties as $property) { |
||
1352 | if (isset($this->{$property})) { |
||
1353 | throw new InvalidArgumentException(sprintf('The property XrmOrganization can\'t be set as the property %s is already set. Only one property must be set among these properties: XrmOrganization, %s.', $property, implode(', ', $properties)), __LINE__); |
||
1354 | } |
||
1355 | } |
||
1356 | } catch (InvalidArgumentException $e) { |
||
1357 | $message = $e->getMessage(); |
||
1358 | } |
||
1359 | |||
1360 | return $message; |
||
1361 | } |
||
1362 | /** |
||
1363 | * Set XrmOrganization value |
||
1364 | * This property belongs to a choice that allows only one property to exist. It is |
||
1365 | * therefore removable from the request, consequently if the value assigned to this |
||
1366 | * property is null, the property is removed from this object |
||
1367 | * @throws InvalidArgumentException |
||
1368 | * @param \StructType\EwsXrmOrganizationItemType $xrmOrganization |
||
1369 | * @return \StructType\EwsAppendToItemFieldType |
||
1370 | */ |
||
1371 | public function setXrmOrganization(?\StructType\EwsXrmOrganizationItemType $xrmOrganization = null): self |
||
1384 | } |
||
1385 | } |
||
1386 |