Total Complexity | 113 |
Total Lines | 734 |
Duplicated Lines | 0 % |
Changes | 0 |
Complex classes like EwsNotificationType 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 EwsNotificationType, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
16 | class EwsNotificationType extends AbstractStructBase |
||
17 | { |
||
18 | /** |
||
19 | * The SubscriptionId |
||
20 | * Meta information extracted from the WSDL |
||
21 | * - base: t:NonEmptyStringType |
||
22 | * - minLength: 1 |
||
23 | * @var string|null |
||
24 | */ |
||
25 | protected ?string $SubscriptionId = null; |
||
26 | /** |
||
27 | * The PreviousWatermark |
||
28 | * Meta information extracted from the WSDL |
||
29 | * - base: t:NonEmptyStringType |
||
30 | * - minLength: 1 |
||
31 | * - minOccurs: 0 |
||
32 | * @var string|null |
||
33 | */ |
||
34 | protected ?string $PreviousWatermark = null; |
||
35 | /** |
||
36 | * The MoreEvents |
||
37 | * Meta information extracted from the WSDL |
||
38 | * - minOccurs: 0 |
||
39 | * @var bool|null |
||
40 | */ |
||
41 | protected ?bool $MoreEvents = null; |
||
42 | /** |
||
43 | * The CopiedEvent |
||
44 | * Meta information extracted from the WSDL |
||
45 | * - choice: CopiedEvent | CreatedEvent | DeletedEvent | ModifiedEvent | MovedEvent | NewMailEvent | StatusEvent | FreeBusyChangedEvent |
||
46 | * - choiceMaxOccurs: unbounded |
||
47 | * - choiceMinOccurs: 1 |
||
48 | * @var \StructType\EwsMovedCopiedEventType|null |
||
49 | */ |
||
50 | protected ?\StructType\EwsMovedCopiedEventType $CopiedEvent = null; |
||
51 | /** |
||
52 | * The CreatedEvent |
||
53 | * Meta information extracted from the WSDL |
||
54 | * - choice: CopiedEvent | CreatedEvent | DeletedEvent | ModifiedEvent | MovedEvent | NewMailEvent | StatusEvent | FreeBusyChangedEvent |
||
55 | * - choiceMaxOccurs: unbounded |
||
56 | * - choiceMinOccurs: 1 |
||
57 | * @var \StructType\EwsBaseObjectChangedEventType|null |
||
58 | */ |
||
59 | protected ?\StructType\EwsBaseObjectChangedEventType $CreatedEvent = null; |
||
60 | /** |
||
61 | * The DeletedEvent |
||
62 | * Meta information extracted from the WSDL |
||
63 | * - choice: CopiedEvent | CreatedEvent | DeletedEvent | ModifiedEvent | MovedEvent | NewMailEvent | StatusEvent | FreeBusyChangedEvent |
||
64 | * - choiceMaxOccurs: unbounded |
||
65 | * - choiceMinOccurs: 1 |
||
66 | * @var \StructType\EwsBaseObjectChangedEventType|null |
||
67 | */ |
||
68 | protected ?\StructType\EwsBaseObjectChangedEventType $DeletedEvent = null; |
||
69 | /** |
||
70 | * The ModifiedEvent |
||
71 | * Meta information extracted from the WSDL |
||
72 | * - choice: CopiedEvent | CreatedEvent | DeletedEvent | ModifiedEvent | MovedEvent | NewMailEvent | StatusEvent | FreeBusyChangedEvent |
||
73 | * - choiceMaxOccurs: unbounded |
||
74 | * - choiceMinOccurs: 1 |
||
75 | * @var \StructType\EwsModifiedEventType|null |
||
76 | */ |
||
77 | protected ?\StructType\EwsModifiedEventType $ModifiedEvent = null; |
||
78 | /** |
||
79 | * The MovedEvent |
||
80 | * Meta information extracted from the WSDL |
||
81 | * - choice: CopiedEvent | CreatedEvent | DeletedEvent | ModifiedEvent | MovedEvent | NewMailEvent | StatusEvent | FreeBusyChangedEvent |
||
82 | * - choiceMaxOccurs: unbounded |
||
83 | * - choiceMinOccurs: 1 |
||
84 | * @var \StructType\EwsMovedCopiedEventType|null |
||
85 | */ |
||
86 | protected ?\StructType\EwsMovedCopiedEventType $MovedEvent = null; |
||
87 | /** |
||
88 | * The NewMailEvent |
||
89 | * Meta information extracted from the WSDL |
||
90 | * - choice: CopiedEvent | CreatedEvent | DeletedEvent | ModifiedEvent | MovedEvent | NewMailEvent | StatusEvent | FreeBusyChangedEvent |
||
91 | * - choiceMaxOccurs: unbounded |
||
92 | * - choiceMinOccurs: 1 |
||
93 | * @var \StructType\EwsBaseObjectChangedEventType|null |
||
94 | */ |
||
95 | protected ?\StructType\EwsBaseObjectChangedEventType $NewMailEvent = null; |
||
96 | /** |
||
97 | * The StatusEvent |
||
98 | * Meta information extracted from the WSDL |
||
99 | * - choice: CopiedEvent | CreatedEvent | DeletedEvent | ModifiedEvent | MovedEvent | NewMailEvent | StatusEvent | FreeBusyChangedEvent |
||
100 | * - choiceMaxOccurs: unbounded |
||
101 | * - choiceMinOccurs: 1 |
||
102 | * @var \StructType\EwsBaseNotificationEventType|null |
||
103 | */ |
||
104 | protected ?\StructType\EwsBaseNotificationEventType $StatusEvent = null; |
||
105 | /** |
||
106 | * The FreeBusyChangedEvent |
||
107 | * Meta information extracted from the WSDL |
||
108 | * - choice: CopiedEvent | CreatedEvent | DeletedEvent | ModifiedEvent | MovedEvent | NewMailEvent | StatusEvent | FreeBusyChangedEvent |
||
109 | * - choiceMaxOccurs: unbounded |
||
110 | * - choiceMinOccurs: 1 |
||
111 | * @var \StructType\EwsBaseObjectChangedEventType|null |
||
112 | */ |
||
113 | protected ?\StructType\EwsBaseObjectChangedEventType $FreeBusyChangedEvent = null; |
||
114 | /** |
||
115 | * Constructor method for NotificationType |
||
116 | * @uses EwsNotificationType::setSubscriptionId() |
||
117 | * @uses EwsNotificationType::setPreviousWatermark() |
||
118 | * @uses EwsNotificationType::setMoreEvents() |
||
119 | * @uses EwsNotificationType::setCopiedEvent() |
||
120 | * @uses EwsNotificationType::setCreatedEvent() |
||
121 | * @uses EwsNotificationType::setDeletedEvent() |
||
122 | * @uses EwsNotificationType::setModifiedEvent() |
||
123 | * @uses EwsNotificationType::setMovedEvent() |
||
124 | * @uses EwsNotificationType::setNewMailEvent() |
||
125 | * @uses EwsNotificationType::setStatusEvent() |
||
126 | * @uses EwsNotificationType::setFreeBusyChangedEvent() |
||
127 | * @param string $subscriptionId |
||
128 | * @param string $previousWatermark |
||
129 | * @param bool $moreEvents |
||
130 | * @param \StructType\EwsMovedCopiedEventType $copiedEvent |
||
131 | * @param \StructType\EwsBaseObjectChangedEventType $createdEvent |
||
132 | * @param \StructType\EwsBaseObjectChangedEventType $deletedEvent |
||
133 | * @param \StructType\EwsModifiedEventType $modifiedEvent |
||
134 | * @param \StructType\EwsMovedCopiedEventType $movedEvent |
||
135 | * @param \StructType\EwsBaseObjectChangedEventType $newMailEvent |
||
136 | * @param \StructType\EwsBaseNotificationEventType $statusEvent |
||
137 | * @param \StructType\EwsBaseObjectChangedEventType $freeBusyChangedEvent |
||
138 | */ |
||
139 | public function __construct(?string $subscriptionId = null, ?string $previousWatermark = null, ?bool $moreEvents = null, ?\StructType\EwsMovedCopiedEventType $copiedEvent = null, ?\StructType\EwsBaseObjectChangedEventType $createdEvent = null, ?\StructType\EwsBaseObjectChangedEventType $deletedEvent = null, ?\StructType\EwsModifiedEventType $modifiedEvent = null, ?\StructType\EwsMovedCopiedEventType $movedEvent = null, ?\StructType\EwsBaseObjectChangedEventType $newMailEvent = null, ?\StructType\EwsBaseNotificationEventType $statusEvent = null, ?\StructType\EwsBaseObjectChangedEventType $freeBusyChangedEvent = null) |
||
140 | { |
||
141 | $this |
||
142 | ->setSubscriptionId($subscriptionId) |
||
143 | ->setPreviousWatermark($previousWatermark) |
||
144 | ->setMoreEvents($moreEvents) |
||
145 | ->setCopiedEvent($copiedEvent) |
||
146 | ->setCreatedEvent($createdEvent) |
||
147 | ->setDeletedEvent($deletedEvent) |
||
148 | ->setModifiedEvent($modifiedEvent) |
||
149 | ->setMovedEvent($movedEvent) |
||
150 | ->setNewMailEvent($newMailEvent) |
||
151 | ->setStatusEvent($statusEvent) |
||
152 | ->setFreeBusyChangedEvent($freeBusyChangedEvent); |
||
153 | } |
||
154 | /** |
||
155 | * Get SubscriptionId value |
||
156 | * @return string|null |
||
157 | */ |
||
158 | public function getSubscriptionId(): ?string |
||
159 | { |
||
160 | return $this->SubscriptionId; |
||
161 | } |
||
162 | /** |
||
163 | * Set SubscriptionId value |
||
164 | * @param string $subscriptionId |
||
165 | * @return \StructType\EwsNotificationType |
||
166 | */ |
||
167 | public function setSubscriptionId(?string $subscriptionId = null): self |
||
168 | { |
||
169 | // validation for constraint: string |
||
170 | if (!is_null($subscriptionId) && !is_string($subscriptionId)) { |
||
|
|||
171 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($subscriptionId, true), gettype($subscriptionId)), __LINE__); |
||
172 | } |
||
173 | // validation for constraint: minLength(1) |
||
174 | if (!is_null($subscriptionId) && mb_strlen((string) $subscriptionId) < 1) { |
||
175 | throw new InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be greater than or equal to 1', mb_strlen((string) $subscriptionId)), __LINE__); |
||
176 | } |
||
177 | $this->SubscriptionId = $subscriptionId; |
||
178 | |||
179 | return $this; |
||
180 | } |
||
181 | /** |
||
182 | * Get PreviousWatermark value |
||
183 | * @return string|null |
||
184 | */ |
||
185 | public function getPreviousWatermark(): ?string |
||
186 | { |
||
187 | return $this->PreviousWatermark; |
||
188 | } |
||
189 | /** |
||
190 | * Set PreviousWatermark value |
||
191 | * @param string $previousWatermark |
||
192 | * @return \StructType\EwsNotificationType |
||
193 | */ |
||
194 | public function setPreviousWatermark(?string $previousWatermark = null): self |
||
207 | } |
||
208 | /** |
||
209 | * Get MoreEvents value |
||
210 | * @return bool|null |
||
211 | */ |
||
212 | public function getMoreEvents(): ?bool |
||
213 | { |
||
214 | return $this->MoreEvents; |
||
215 | } |
||
216 | /** |
||
217 | * Set MoreEvents value |
||
218 | * @param bool $moreEvents |
||
219 | * @return \StructType\EwsNotificationType |
||
220 | */ |
||
221 | public function setMoreEvents(?bool $moreEvents = null): self |
||
222 | { |
||
223 | // validation for constraint: boolean |
||
224 | if (!is_null($moreEvents) && !is_bool($moreEvents)) { |
||
225 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($moreEvents, true), gettype($moreEvents)), __LINE__); |
||
226 | } |
||
227 | $this->MoreEvents = $moreEvents; |
||
228 | |||
229 | return $this; |
||
230 | } |
||
231 | /** |
||
232 | * Get CopiedEvent value |
||
233 | * @return \StructType\EwsMovedCopiedEventType|null |
||
234 | */ |
||
235 | public function getCopiedEvent(): ?\StructType\EwsMovedCopiedEventType |
||
236 | { |
||
237 | return isset($this->CopiedEvent) ? $this->CopiedEvent : null; |
||
238 | } |
||
239 | /** |
||
240 | * This method is responsible for validating the value passed to the setCopiedEvent method |
||
241 | * This method is willingly generated in order to preserve the one-line inline validation within the setCopiedEvent method |
||
242 | * This has to validate that the property which is being set is the only one among the given choices |
||
243 | * @param mixed $value |
||
244 | * @return string A non-empty message if the values does not match the validation rules |
||
245 | */ |
||
246 | public function validateCopiedEventForChoiceConstraintsFromSetCopiedEvent($value): string |
||
247 | { |
||
248 | $message = ''; |
||
249 | if (is_null($value)) { |
||
250 | return $message; |
||
251 | } |
||
252 | $properties = [ |
||
253 | 'CreatedEvent', |
||
254 | 'DeletedEvent', |
||
255 | 'ModifiedEvent', |
||
256 | 'MovedEvent', |
||
257 | 'NewMailEvent', |
||
258 | 'StatusEvent', |
||
259 | 'FreeBusyChangedEvent', |
||
260 | ]; |
||
261 | try { |
||
262 | foreach ($properties as $property) { |
||
263 | if (isset($this->{$property})) { |
||
264 | throw new InvalidArgumentException(sprintf('The property CopiedEvent can\'t be set as the property %s is already set. Only one property must be set among these properties: CopiedEvent, %s.', $property, implode(', ', $properties)), __LINE__); |
||
265 | } |
||
266 | } |
||
267 | } catch (InvalidArgumentException $e) { |
||
268 | $message = $e->getMessage(); |
||
269 | } |
||
270 | |||
271 | return $message; |
||
272 | } |
||
273 | /** |
||
274 | * Set CopiedEvent value |
||
275 | * This property belongs to a choice that allows only one property to exist. It is |
||
276 | * therefore removable from the request, consequently if the value assigned to this |
||
277 | * property is null, the property is removed from this object |
||
278 | * @throws InvalidArgumentException |
||
279 | * @param \StructType\EwsMovedCopiedEventType $copiedEvent |
||
280 | * @return \StructType\EwsNotificationType |
||
281 | */ |
||
282 | public function setCopiedEvent(?\StructType\EwsMovedCopiedEventType $copiedEvent = null): self |
||
283 | { |
||
284 | // validation for constraint: choice(CopiedEvent, CreatedEvent, DeletedEvent, ModifiedEvent, MovedEvent, NewMailEvent, StatusEvent, FreeBusyChangedEvent) |
||
285 | if ('' !== ($copiedEventChoiceErrorMessage = self::validateCopiedEventForChoiceConstraintsFromSetCopiedEvent($copiedEvent))) { |
||
286 | throw new InvalidArgumentException($copiedEventChoiceErrorMessage, __LINE__); |
||
287 | } |
||
288 | if (is_null($copiedEvent) || (is_array($copiedEvent) && empty($copiedEvent))) { |
||
289 | unset($this->CopiedEvent); |
||
290 | } else { |
||
291 | $this->CopiedEvent = $copiedEvent; |
||
292 | } |
||
293 | |||
294 | return $this; |
||
295 | } |
||
296 | /** |
||
297 | * Get CreatedEvent value |
||
298 | * @return \StructType\EwsBaseObjectChangedEventType|null |
||
299 | */ |
||
300 | public function getCreatedEvent(): ?\StructType\EwsBaseObjectChangedEventType |
||
301 | { |
||
302 | return isset($this->CreatedEvent) ? $this->CreatedEvent : null; |
||
303 | } |
||
304 | /** |
||
305 | * This method is responsible for validating the value passed to the setCreatedEvent method |
||
306 | * This method is willingly generated in order to preserve the one-line inline validation within the setCreatedEvent method |
||
307 | * This has to validate that the property which is being set is the only one among the given choices |
||
308 | * @param mixed $value |
||
309 | * @return string A non-empty message if the values does not match the validation rules |
||
310 | */ |
||
311 | public function validateCreatedEventForChoiceConstraintsFromSetCreatedEvent($value): string |
||
312 | { |
||
313 | $message = ''; |
||
314 | if (is_null($value)) { |
||
315 | return $message; |
||
316 | } |
||
317 | $properties = [ |
||
318 | 'CopiedEvent', |
||
319 | 'DeletedEvent', |
||
320 | 'ModifiedEvent', |
||
321 | 'MovedEvent', |
||
322 | 'NewMailEvent', |
||
323 | 'StatusEvent', |
||
324 | 'FreeBusyChangedEvent', |
||
325 | ]; |
||
326 | try { |
||
327 | foreach ($properties as $property) { |
||
328 | if (isset($this->{$property})) { |
||
329 | throw new InvalidArgumentException(sprintf('The property CreatedEvent can\'t be set as the property %s is already set. Only one property must be set among these properties: CreatedEvent, %s.', $property, implode(', ', $properties)), __LINE__); |
||
330 | } |
||
331 | } |
||
332 | } catch (InvalidArgumentException $e) { |
||
333 | $message = $e->getMessage(); |
||
334 | } |
||
335 | |||
336 | return $message; |
||
337 | } |
||
338 | /** |
||
339 | * Set CreatedEvent value |
||
340 | * This property belongs to a choice that allows only one property to exist. It is |
||
341 | * therefore removable from the request, consequently if the value assigned to this |
||
342 | * property is null, the property is removed from this object |
||
343 | * @throws InvalidArgumentException |
||
344 | * @param \StructType\EwsBaseObjectChangedEventType $createdEvent |
||
345 | * @return \StructType\EwsNotificationType |
||
346 | */ |
||
347 | public function setCreatedEvent(?\StructType\EwsBaseObjectChangedEventType $createdEvent = null): self |
||
348 | { |
||
349 | // validation for constraint: choice(CopiedEvent, CreatedEvent, DeletedEvent, ModifiedEvent, MovedEvent, NewMailEvent, StatusEvent, FreeBusyChangedEvent) |
||
350 | if ('' !== ($createdEventChoiceErrorMessage = self::validateCreatedEventForChoiceConstraintsFromSetCreatedEvent($createdEvent))) { |
||
351 | throw new InvalidArgumentException($createdEventChoiceErrorMessage, __LINE__); |
||
352 | } |
||
353 | if (is_null($createdEvent) || (is_array($createdEvent) && empty($createdEvent))) { |
||
354 | unset($this->CreatedEvent); |
||
355 | } else { |
||
356 | $this->CreatedEvent = $createdEvent; |
||
357 | } |
||
358 | |||
359 | return $this; |
||
360 | } |
||
361 | /** |
||
362 | * Get DeletedEvent value |
||
363 | * @return \StructType\EwsBaseObjectChangedEventType|null |
||
364 | */ |
||
365 | public function getDeletedEvent(): ?\StructType\EwsBaseObjectChangedEventType |
||
366 | { |
||
367 | return isset($this->DeletedEvent) ? $this->DeletedEvent : null; |
||
368 | } |
||
369 | /** |
||
370 | * This method is responsible for validating the value passed to the setDeletedEvent method |
||
371 | * This method is willingly generated in order to preserve the one-line inline validation within the setDeletedEvent method |
||
372 | * This has to validate that the property which is being set is the only one among the given choices |
||
373 | * @param mixed $value |
||
374 | * @return string A non-empty message if the values does not match the validation rules |
||
375 | */ |
||
376 | public function validateDeletedEventForChoiceConstraintsFromSetDeletedEvent($value): string |
||
377 | { |
||
378 | $message = ''; |
||
379 | if (is_null($value)) { |
||
380 | return $message; |
||
381 | } |
||
382 | $properties = [ |
||
383 | 'CopiedEvent', |
||
384 | 'CreatedEvent', |
||
385 | 'ModifiedEvent', |
||
386 | 'MovedEvent', |
||
387 | 'NewMailEvent', |
||
388 | 'StatusEvent', |
||
389 | 'FreeBusyChangedEvent', |
||
390 | ]; |
||
391 | try { |
||
392 | foreach ($properties as $property) { |
||
393 | if (isset($this->{$property})) { |
||
394 | throw new InvalidArgumentException(sprintf('The property DeletedEvent can\'t be set as the property %s is already set. Only one property must be set among these properties: DeletedEvent, %s.', $property, implode(', ', $properties)), __LINE__); |
||
395 | } |
||
396 | } |
||
397 | } catch (InvalidArgumentException $e) { |
||
398 | $message = $e->getMessage(); |
||
399 | } |
||
400 | |||
401 | return $message; |
||
402 | } |
||
403 | /** |
||
404 | * Set DeletedEvent value |
||
405 | * This property belongs to a choice that allows only one property to exist. It is |
||
406 | * therefore removable from the request, consequently if the value assigned to this |
||
407 | * property is null, the property is removed from this object |
||
408 | * @throws InvalidArgumentException |
||
409 | * @param \StructType\EwsBaseObjectChangedEventType $deletedEvent |
||
410 | * @return \StructType\EwsNotificationType |
||
411 | */ |
||
412 | public function setDeletedEvent(?\StructType\EwsBaseObjectChangedEventType $deletedEvent = null): self |
||
413 | { |
||
414 | // validation for constraint: choice(CopiedEvent, CreatedEvent, DeletedEvent, ModifiedEvent, MovedEvent, NewMailEvent, StatusEvent, FreeBusyChangedEvent) |
||
415 | if ('' !== ($deletedEventChoiceErrorMessage = self::validateDeletedEventForChoiceConstraintsFromSetDeletedEvent($deletedEvent))) { |
||
416 | throw new InvalidArgumentException($deletedEventChoiceErrorMessage, __LINE__); |
||
417 | } |
||
418 | if (is_null($deletedEvent) || (is_array($deletedEvent) && empty($deletedEvent))) { |
||
419 | unset($this->DeletedEvent); |
||
420 | } else { |
||
421 | $this->DeletedEvent = $deletedEvent; |
||
422 | } |
||
423 | |||
424 | return $this; |
||
425 | } |
||
426 | /** |
||
427 | * Get ModifiedEvent value |
||
428 | * @return \StructType\EwsModifiedEventType|null |
||
429 | */ |
||
430 | public function getModifiedEvent(): ?\StructType\EwsModifiedEventType |
||
431 | { |
||
432 | return isset($this->ModifiedEvent) ? $this->ModifiedEvent : null; |
||
433 | } |
||
434 | /** |
||
435 | * This method is responsible for validating the value passed to the setModifiedEvent method |
||
436 | * This method is willingly generated in order to preserve the one-line inline validation within the setModifiedEvent method |
||
437 | * This has to validate that the property which is being set is the only one among the given choices |
||
438 | * @param mixed $value |
||
439 | * @return string A non-empty message if the values does not match the validation rules |
||
440 | */ |
||
441 | public function validateModifiedEventForChoiceConstraintsFromSetModifiedEvent($value): string |
||
442 | { |
||
443 | $message = ''; |
||
444 | if (is_null($value)) { |
||
445 | return $message; |
||
446 | } |
||
447 | $properties = [ |
||
448 | 'CopiedEvent', |
||
449 | 'CreatedEvent', |
||
450 | 'DeletedEvent', |
||
451 | 'MovedEvent', |
||
452 | 'NewMailEvent', |
||
453 | 'StatusEvent', |
||
454 | 'FreeBusyChangedEvent', |
||
455 | ]; |
||
456 | try { |
||
457 | foreach ($properties as $property) { |
||
458 | if (isset($this->{$property})) { |
||
459 | throw new InvalidArgumentException(sprintf('The property ModifiedEvent can\'t be set as the property %s is already set. Only one property must be set among these properties: ModifiedEvent, %s.', $property, implode(', ', $properties)), __LINE__); |
||
460 | } |
||
461 | } |
||
462 | } catch (InvalidArgumentException $e) { |
||
463 | $message = $e->getMessage(); |
||
464 | } |
||
465 | |||
466 | return $message; |
||
467 | } |
||
468 | /** |
||
469 | * Set ModifiedEvent value |
||
470 | * This property belongs to a choice that allows only one property to exist. It is |
||
471 | * therefore removable from the request, consequently if the value assigned to this |
||
472 | * property is null, the property is removed from this object |
||
473 | * @throws InvalidArgumentException |
||
474 | * @param \StructType\EwsModifiedEventType $modifiedEvent |
||
475 | * @return \StructType\EwsNotificationType |
||
476 | */ |
||
477 | public function setModifiedEvent(?\StructType\EwsModifiedEventType $modifiedEvent = null): self |
||
478 | { |
||
479 | // validation for constraint: choice(CopiedEvent, CreatedEvent, DeletedEvent, ModifiedEvent, MovedEvent, NewMailEvent, StatusEvent, FreeBusyChangedEvent) |
||
480 | if ('' !== ($modifiedEventChoiceErrorMessage = self::validateModifiedEventForChoiceConstraintsFromSetModifiedEvent($modifiedEvent))) { |
||
481 | throw new InvalidArgumentException($modifiedEventChoiceErrorMessage, __LINE__); |
||
482 | } |
||
483 | if (is_null($modifiedEvent) || (is_array($modifiedEvent) && empty($modifiedEvent))) { |
||
484 | unset($this->ModifiedEvent); |
||
485 | } else { |
||
486 | $this->ModifiedEvent = $modifiedEvent; |
||
487 | } |
||
488 | |||
489 | return $this; |
||
490 | } |
||
491 | /** |
||
492 | * Get MovedEvent value |
||
493 | * @return \StructType\EwsMovedCopiedEventType|null |
||
494 | */ |
||
495 | public function getMovedEvent(): ?\StructType\EwsMovedCopiedEventType |
||
496 | { |
||
497 | return isset($this->MovedEvent) ? $this->MovedEvent : null; |
||
498 | } |
||
499 | /** |
||
500 | * This method is responsible for validating the value passed to the setMovedEvent method |
||
501 | * This method is willingly generated in order to preserve the one-line inline validation within the setMovedEvent method |
||
502 | * This has to validate that the property which is being set is the only one among the given choices |
||
503 | * @param mixed $value |
||
504 | * @return string A non-empty message if the values does not match the validation rules |
||
505 | */ |
||
506 | public function validateMovedEventForChoiceConstraintsFromSetMovedEvent($value): string |
||
507 | { |
||
508 | $message = ''; |
||
509 | if (is_null($value)) { |
||
510 | return $message; |
||
511 | } |
||
512 | $properties = [ |
||
513 | 'CopiedEvent', |
||
514 | 'CreatedEvent', |
||
515 | 'DeletedEvent', |
||
516 | 'ModifiedEvent', |
||
517 | 'NewMailEvent', |
||
518 | 'StatusEvent', |
||
519 | 'FreeBusyChangedEvent', |
||
520 | ]; |
||
521 | try { |
||
522 | foreach ($properties as $property) { |
||
523 | if (isset($this->{$property})) { |
||
524 | throw new InvalidArgumentException(sprintf('The property MovedEvent can\'t be set as the property %s is already set. Only one property must be set among these properties: MovedEvent, %s.', $property, implode(', ', $properties)), __LINE__); |
||
525 | } |
||
526 | } |
||
527 | } catch (InvalidArgumentException $e) { |
||
528 | $message = $e->getMessage(); |
||
529 | } |
||
530 | |||
531 | return $message; |
||
532 | } |
||
533 | /** |
||
534 | * Set MovedEvent value |
||
535 | * This property belongs to a choice that allows only one property to exist. It is |
||
536 | * therefore removable from the request, consequently if the value assigned to this |
||
537 | * property is null, the property is removed from this object |
||
538 | * @throws InvalidArgumentException |
||
539 | * @param \StructType\EwsMovedCopiedEventType $movedEvent |
||
540 | * @return \StructType\EwsNotificationType |
||
541 | */ |
||
542 | public function setMovedEvent(?\StructType\EwsMovedCopiedEventType $movedEvent = null): self |
||
543 | { |
||
544 | // validation for constraint: choice(CopiedEvent, CreatedEvent, DeletedEvent, ModifiedEvent, MovedEvent, NewMailEvent, StatusEvent, FreeBusyChangedEvent) |
||
545 | if ('' !== ($movedEventChoiceErrorMessage = self::validateMovedEventForChoiceConstraintsFromSetMovedEvent($movedEvent))) { |
||
546 | throw new InvalidArgumentException($movedEventChoiceErrorMessage, __LINE__); |
||
547 | } |
||
548 | if (is_null($movedEvent) || (is_array($movedEvent) && empty($movedEvent))) { |
||
549 | unset($this->MovedEvent); |
||
550 | } else { |
||
551 | $this->MovedEvent = $movedEvent; |
||
552 | } |
||
553 | |||
554 | return $this; |
||
555 | } |
||
556 | /** |
||
557 | * Get NewMailEvent value |
||
558 | * @return \StructType\EwsBaseObjectChangedEventType|null |
||
559 | */ |
||
560 | public function getNewMailEvent(): ?\StructType\EwsBaseObjectChangedEventType |
||
561 | { |
||
562 | return isset($this->NewMailEvent) ? $this->NewMailEvent : null; |
||
563 | } |
||
564 | /** |
||
565 | * This method is responsible for validating the value passed to the setNewMailEvent method |
||
566 | * This method is willingly generated in order to preserve the one-line inline validation within the setNewMailEvent method |
||
567 | * This has to validate that the property which is being set is the only one among the given choices |
||
568 | * @param mixed $value |
||
569 | * @return string A non-empty message if the values does not match the validation rules |
||
570 | */ |
||
571 | public function validateNewMailEventForChoiceConstraintsFromSetNewMailEvent($value): string |
||
572 | { |
||
573 | $message = ''; |
||
574 | if (is_null($value)) { |
||
575 | return $message; |
||
576 | } |
||
577 | $properties = [ |
||
578 | 'CopiedEvent', |
||
579 | 'CreatedEvent', |
||
580 | 'DeletedEvent', |
||
581 | 'ModifiedEvent', |
||
582 | 'MovedEvent', |
||
583 | 'StatusEvent', |
||
584 | 'FreeBusyChangedEvent', |
||
585 | ]; |
||
586 | try { |
||
587 | foreach ($properties as $property) { |
||
588 | if (isset($this->{$property})) { |
||
589 | throw new InvalidArgumentException(sprintf('The property NewMailEvent can\'t be set as the property %s is already set. Only one property must be set among these properties: NewMailEvent, %s.', $property, implode(', ', $properties)), __LINE__); |
||
590 | } |
||
591 | } |
||
592 | } catch (InvalidArgumentException $e) { |
||
593 | $message = $e->getMessage(); |
||
594 | } |
||
595 | |||
596 | return $message; |
||
597 | } |
||
598 | /** |
||
599 | * Set NewMailEvent value |
||
600 | * This property belongs to a choice that allows only one property to exist. It is |
||
601 | * therefore removable from the request, consequently if the value assigned to this |
||
602 | * property is null, the property is removed from this object |
||
603 | * @throws InvalidArgumentException |
||
604 | * @param \StructType\EwsBaseObjectChangedEventType $newMailEvent |
||
605 | * @return \StructType\EwsNotificationType |
||
606 | */ |
||
607 | public function setNewMailEvent(?\StructType\EwsBaseObjectChangedEventType $newMailEvent = null): self |
||
608 | { |
||
609 | // validation for constraint: choice(CopiedEvent, CreatedEvent, DeletedEvent, ModifiedEvent, MovedEvent, NewMailEvent, StatusEvent, FreeBusyChangedEvent) |
||
610 | if ('' !== ($newMailEventChoiceErrorMessage = self::validateNewMailEventForChoiceConstraintsFromSetNewMailEvent($newMailEvent))) { |
||
611 | throw new InvalidArgumentException($newMailEventChoiceErrorMessage, __LINE__); |
||
612 | } |
||
613 | if (is_null($newMailEvent) || (is_array($newMailEvent) && empty($newMailEvent))) { |
||
614 | unset($this->NewMailEvent); |
||
615 | } else { |
||
616 | $this->NewMailEvent = $newMailEvent; |
||
617 | } |
||
618 | |||
619 | return $this; |
||
620 | } |
||
621 | /** |
||
622 | * Get StatusEvent value |
||
623 | * @return \StructType\EwsBaseNotificationEventType|null |
||
624 | */ |
||
625 | public function getStatusEvent(): ?\StructType\EwsBaseNotificationEventType |
||
628 | } |
||
629 | /** |
||
630 | * This method is responsible for validating the value passed to the setStatusEvent method |
||
631 | * This method is willingly generated in order to preserve the one-line inline validation within the setStatusEvent method |
||
632 | * This has to validate that the property which is being set is the only one among the given choices |
||
633 | * @param mixed $value |
||
634 | * @return string A non-empty message if the values does not match the validation rules |
||
635 | */ |
||
636 | public function validateStatusEventForChoiceConstraintsFromSetStatusEvent($value): string |
||
637 | { |
||
638 | $message = ''; |
||
639 | if (is_null($value)) { |
||
640 | return $message; |
||
641 | } |
||
642 | $properties = [ |
||
643 | 'CopiedEvent', |
||
644 | 'CreatedEvent', |
||
645 | 'DeletedEvent', |
||
646 | 'ModifiedEvent', |
||
647 | 'MovedEvent', |
||
648 | 'NewMailEvent', |
||
649 | 'FreeBusyChangedEvent', |
||
650 | ]; |
||
651 | try { |
||
652 | foreach ($properties as $property) { |
||
653 | if (isset($this->{$property})) { |
||
654 | throw new InvalidArgumentException(sprintf('The property StatusEvent can\'t be set as the property %s is already set. Only one property must be set among these properties: StatusEvent, %s.', $property, implode(', ', $properties)), __LINE__); |
||
655 | } |
||
656 | } |
||
657 | } catch (InvalidArgumentException $e) { |
||
658 | $message = $e->getMessage(); |
||
659 | } |
||
660 | |||
661 | return $message; |
||
662 | } |
||
663 | /** |
||
664 | * Set StatusEvent value |
||
665 | * This property belongs to a choice that allows only one property to exist. It is |
||
666 | * therefore removable from the request, consequently if the value assigned to this |
||
667 | * property is null, the property is removed from this object |
||
668 | * @throws InvalidArgumentException |
||
669 | * @param \StructType\EwsBaseNotificationEventType $statusEvent |
||
670 | * @return \StructType\EwsNotificationType |
||
671 | */ |
||
672 | public function setStatusEvent(?\StructType\EwsBaseNotificationEventType $statusEvent = null): self |
||
673 | { |
||
674 | // validation for constraint: choice(CopiedEvent, CreatedEvent, DeletedEvent, ModifiedEvent, MovedEvent, NewMailEvent, StatusEvent, FreeBusyChangedEvent) |
||
675 | if ('' !== ($statusEventChoiceErrorMessage = self::validateStatusEventForChoiceConstraintsFromSetStatusEvent($statusEvent))) { |
||
676 | throw new InvalidArgumentException($statusEventChoiceErrorMessage, __LINE__); |
||
677 | } |
||
678 | if (is_null($statusEvent) || (is_array($statusEvent) && empty($statusEvent))) { |
||
679 | unset($this->StatusEvent); |
||
680 | } else { |
||
681 | $this->StatusEvent = $statusEvent; |
||
682 | } |
||
683 | |||
684 | return $this; |
||
685 | } |
||
686 | /** |
||
687 | * Get FreeBusyChangedEvent value |
||
688 | * @return \StructType\EwsBaseObjectChangedEventType|null |
||
689 | */ |
||
690 | public function getFreeBusyChangedEvent(): ?\StructType\EwsBaseObjectChangedEventType |
||
691 | { |
||
692 | return isset($this->FreeBusyChangedEvent) ? $this->FreeBusyChangedEvent : null; |
||
693 | } |
||
694 | /** |
||
695 | * This method is responsible for validating the value passed to the setFreeBusyChangedEvent method |
||
696 | * This method is willingly generated in order to preserve the one-line inline validation within the setFreeBusyChangedEvent method |
||
697 | * This has to validate that the property which is being set is the only one among the given choices |
||
698 | * @param mixed $value |
||
699 | * @return string A non-empty message if the values does not match the validation rules |
||
700 | */ |
||
701 | public function validateFreeBusyChangedEventForChoiceConstraintsFromSetFreeBusyChangedEvent($value): string |
||
727 | } |
||
728 | /** |
||
729 | * Set FreeBusyChangedEvent value |
||
730 | * This property belongs to a choice that allows only one property to exist. It is |
||
731 | * therefore removable from the request, consequently if the value assigned to this |
||
732 | * property is null, the property is removed from this object |
||
733 | * @throws InvalidArgumentException |
||
734 | * @param \StructType\EwsBaseObjectChangedEventType $freeBusyChangedEvent |
||
735 | * @return \StructType\EwsNotificationType |
||
736 | */ |
||
737 | public function setFreeBusyChangedEvent(?\StructType\EwsBaseObjectChangedEventType $freeBusyChangedEvent = null): self |
||
750 | } |
||
751 | } |
||
752 |