EwsItemAttachmentType::setMeetingRequest()   A
last analyzed

Complexity

Conditions 5
Paths 3

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 7
nc 3
nop 1
dl 0
loc 13
rs 9.6111
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace StructType;
6
7
use InvalidArgumentException;
8
use WsdlToPhp\PackageBase\AbstractStructBase;
9
10
/**
11
 * This class stands for ItemAttachmentType StructType
12
 * @package Ews
13
 * @subpackage Structs
14
 * @author WsdlToPhp <[email protected]>
15
 */
16
class EwsItemAttachmentType extends EwsAttachmentType
17
{
18
    /**
19
     * The Item
20
     * Meta information extracted from the WSDL
21
     * - choice: Item | Message | CalendarItem | Contact | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking
22
     * - choiceMaxOccurs: 1
23
     * - choiceMinOccurs: 0
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 | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking
31
     * - choiceMaxOccurs: 1
32
     * - choiceMinOccurs: 0
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 | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking
40
     * - choiceMaxOccurs: 1
41
     * - choiceMinOccurs: 0
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 | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking
49
     * - choiceMaxOccurs: 1
50
     * - choiceMinOccurs: 0
51
     * @var \StructType\EwsContactItemType|null
52
     */
53
    protected ?\StructType\EwsContactItemType $Contact = null;
54
    /**
55
     * The MeetingMessage
56
     * Meta information extracted from the WSDL
57
     * - choice: Item | Message | CalendarItem | Contact | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking
58
     * - choiceMaxOccurs: 1
59
     * - choiceMinOccurs: 0
60
     * @var \StructType\EwsMeetingMessageType|null
61
     */
62
    protected ?\StructType\EwsMeetingMessageType $MeetingMessage = null;
63
    /**
64
     * The MeetingRequest
65
     * Meta information extracted from the WSDL
66
     * - choice: Item | Message | CalendarItem | Contact | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking
67
     * - choiceMaxOccurs: 1
68
     * - choiceMinOccurs: 0
69
     * @var \StructType\EwsMeetingRequestMessageType|null
70
     */
71
    protected ?\StructType\EwsMeetingRequestMessageType $MeetingRequest = null;
72
    /**
73
     * The MeetingResponse
74
     * Meta information extracted from the WSDL
75
     * - choice: Item | Message | CalendarItem | Contact | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking
76
     * - choiceMaxOccurs: 1
77
     * - choiceMinOccurs: 0
78
     * @var \StructType\EwsMeetingResponseMessageType|null
79
     */
80
    protected ?\StructType\EwsMeetingResponseMessageType $MeetingResponse = null;
81
    /**
82
     * The MeetingCancellation
83
     * Meta information extracted from the WSDL
84
     * - choice: Item | Message | CalendarItem | Contact | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking
85
     * - choiceMaxOccurs: 1
86
     * - choiceMinOccurs: 0
87
     * @var \StructType\EwsMeetingCancellationMessageType|null
88
     */
89
    protected ?\StructType\EwsMeetingCancellationMessageType $MeetingCancellation = null;
90
    /**
91
     * The Task
92
     * Meta information extracted from the WSDL
93
     * - choice: Item | Message | CalendarItem | Contact | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking
94
     * - choiceMaxOccurs: 1
95
     * - choiceMinOccurs: 0
96
     * @var \StructType\EwsTaskType|null
97
     */
98
    protected ?\StructType\EwsTaskType $Task = null;
99
    /**
100
     * The PostItem
101
     * Meta information extracted from the WSDL
102
     * - choice: Item | Message | CalendarItem | Contact | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking
103
     * - choiceMaxOccurs: 1
104
     * - choiceMinOccurs: 0
105
     * @var \StructType\EwsPostItemType|null
106
     */
107
    protected ?\StructType\EwsPostItemType $PostItem = null;
108
    /**
109
     * The RoleMember
110
     * Meta information extracted from the WSDL
111
     * - choice: Item | Message | CalendarItem | Contact | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking
112
     * - choiceMaxOccurs: 1
113
     * - choiceMinOccurs: 0
114
     * @var \StructType\EwsRoleMemberItemType|null
115
     */
116
    protected ?\StructType\EwsRoleMemberItemType $RoleMember = null;
117
    /**
118
     * The Network
119
     * Meta information extracted from the WSDL
120
     * - choice: Item | Message | CalendarItem | Contact | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking
121
     * - choiceMaxOccurs: 1
122
     * - choiceMinOccurs: 0
123
     * @var \StructType\EwsNetworkItemType|null
124
     */
125
    protected ?\StructType\EwsNetworkItemType $Network = null;
126
    /**
127
     * The Person
128
     * Meta information extracted from the WSDL
129
     * - choice: Item | Message | CalendarItem | Contact | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking
130
     * - choiceMaxOccurs: 1
131
     * - choiceMinOccurs: 0
132
     * @var \StructType\EwsAbchPersonItemType|null
133
     */
134
    protected ?\StructType\EwsAbchPersonItemType $Person = null;
135
    /**
136
     * The Booking
137
     * Meta information extracted from the WSDL
138
     * - choice: Item | Message | CalendarItem | Contact | MeetingMessage | MeetingRequest | MeetingResponse | MeetingCancellation | Task | PostItem | RoleMember | Network | Person | Booking
139
     * - choiceMaxOccurs: 1
140
     * - choiceMinOccurs: 0
141
     * @var \StructType\EwsBookingItemType|null
142
     */
143
    protected ?\StructType\EwsBookingItemType $Booking = null;
144
    /**
145
     * Constructor method for ItemAttachmentType
146
     * @uses EwsItemAttachmentType::setItem()
147
     * @uses EwsItemAttachmentType::setMessage()
148
     * @uses EwsItemAttachmentType::setCalendarItem()
149
     * @uses EwsItemAttachmentType::setContact()
150
     * @uses EwsItemAttachmentType::setMeetingMessage()
151
     * @uses EwsItemAttachmentType::setMeetingRequest()
152
     * @uses EwsItemAttachmentType::setMeetingResponse()
153
     * @uses EwsItemAttachmentType::setMeetingCancellation()
154
     * @uses EwsItemAttachmentType::setTask()
155
     * @uses EwsItemAttachmentType::setPostItem()
156
     * @uses EwsItemAttachmentType::setRoleMember()
157
     * @uses EwsItemAttachmentType::setNetwork()
158
     * @uses EwsItemAttachmentType::setPerson()
159
     * @uses EwsItemAttachmentType::setBooking()
160
     * @param \StructType\EwsItemType $item
161
     * @param \StructType\EwsMessageType $message
162
     * @param \StructType\EwsCalendarItemType $calendarItem
163
     * @param \StructType\EwsContactItemType $contact
164
     * @param \StructType\EwsMeetingMessageType $meetingMessage
165
     * @param \StructType\EwsMeetingRequestMessageType $meetingRequest
166
     * @param \StructType\EwsMeetingResponseMessageType $meetingResponse
167
     * @param \StructType\EwsMeetingCancellationMessageType $meetingCancellation
168
     * @param \StructType\EwsTaskType $task
169
     * @param \StructType\EwsPostItemType $postItem
170
     * @param \StructType\EwsRoleMemberItemType $roleMember
171
     * @param \StructType\EwsNetworkItemType $network
172
     * @param \StructType\EwsAbchPersonItemType $person
173
     * @param \StructType\EwsBookingItemType $booking
174
     */
175
    public function __construct(?\StructType\EwsItemType $item = null, ?\StructType\EwsMessageType $message = null, ?\StructType\EwsCalendarItemType $calendarItem = null, ?\StructType\EwsContactItemType $contact = 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)
176
    {
177
        $this
178
            ->setItem($item)
179
            ->setMessage($message)
180
            ->setCalendarItem($calendarItem)
181
            ->setContact($contact)
182
            ->setMeetingMessage($meetingMessage)
183
            ->setMeetingRequest($meetingRequest)
184
            ->setMeetingResponse($meetingResponse)
185
            ->setMeetingCancellation($meetingCancellation)
186
            ->setTask($task)
187
            ->setPostItem($postItem)
188
            ->setRoleMember($roleMember)
189
            ->setNetwork($network)
190
            ->setPerson($person)
191
            ->setBooking($booking);
192
    }
193
    /**
194
     * Get Item value
195
     * @return \StructType\EwsItemType|null
196
     */
197
    public function getItem(): ?\StructType\EwsItemType
198
    {
199
        return isset($this->Item) ? $this->Item : null;
200
    }
201
    /**
202
     * This method is responsible for validating the value passed to the setItem method
203
     * This method is willingly generated in order to preserve the one-line inline validation within the setItem method
204
     * This has to validate that the property which is being set is the only one among the given choices
205
     * @param mixed $value
206
     * @return string A non-empty message if the values does not match the validation rules
207
     */
208
    public function validateItemForChoiceConstraintsFromSetItem($value): string
209
    {
210
        $message = '';
211
        if (is_null($value)) {
212
            return $message;
213
        }
214
        $properties = [
215
            'Message',
216
            'CalendarItem',
217
            'Contact',
218
            'MeetingMessage',
219
            'MeetingRequest',
220
            'MeetingResponse',
221
            'MeetingCancellation',
222
            'Task',
223
            'PostItem',
224
            'RoleMember',
225
            'Network',
226
            'Person',
227
            'Booking',
228
        ];
229
        try {
230
            foreach ($properties as $property) {
231
                if (isset($this->{$property})) {
232
                    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__);
233
                }
234
            }
235
        } catch (InvalidArgumentException $e) {
236
            $message = $e->getMessage();
237
        }
238
        
239
        return $message;
240
    }
241
    /**
242
     * Set Item value
243
     * This property belongs to a choice that allows only one property to exist. It is
244
     * therefore removable from the request, consequently if the value assigned to this
245
     * property is null, the property is removed from this object
246
     * @throws InvalidArgumentException
247
     * @param \StructType\EwsItemType $item
248
     * @return \StructType\EwsItemAttachmentType
249
     */
250
    public function setItem(?\StructType\EwsItemType $item = null): self
251
    {
252
        // validation for constraint: choice(Item, Message, CalendarItem, Contact, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking)
253
        if ('' !== ($itemChoiceErrorMessage = self::validateItemForChoiceConstraintsFromSetItem($item))) {
0 ignored issues
show
Bug Best Practice introduced by
The method StructType\EwsItemAttach...onstraintsFromSetItem() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

253
        if ('' !== ($itemChoiceErrorMessage = self::/** @scrutinizer ignore-call */ validateItemForChoiceConstraintsFromSetItem($item))) {
Loading history...
254
            throw new InvalidArgumentException($itemChoiceErrorMessage, __LINE__);
255
        }
256
        if (is_null($item) || (is_array($item) && empty($item))) {
257
            unset($this->Item);
258
        } else {
259
            $this->Item = $item;
260
        }
261
        
262
        return $this;
263
    }
264
    /**
265
     * Get Message value
266
     * @return \StructType\EwsMessageType|null
267
     */
268
    public function getMessage(): ?\StructType\EwsMessageType
269
    {
270
        return isset($this->Message) ? $this->Message : null;
271
    }
272
    /**
273
     * This method is responsible for validating the value passed to the setMessage method
274
     * This method is willingly generated in order to preserve the one-line inline validation within the setMessage method
275
     * This has to validate that the property which is being set is the only one among the given choices
276
     * @param mixed $value
277
     * @return string A non-empty message if the values does not match the validation rules
278
     */
279
    public function validateMessageForChoiceConstraintsFromSetMessage($value): string
280
    {
281
        $message = '';
282
        if (is_null($value)) {
283
            return $message;
284
        }
285
        $properties = [
286
            'Item',
287
            'CalendarItem',
288
            'Contact',
289
            'MeetingMessage',
290
            'MeetingRequest',
291
            'MeetingResponse',
292
            'MeetingCancellation',
293
            'Task',
294
            'PostItem',
295
            'RoleMember',
296
            'Network',
297
            'Person',
298
            'Booking',
299
        ];
300
        try {
301
            foreach ($properties as $property) {
302
                if (isset($this->{$property})) {
303
                    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__);
304
                }
305
            }
306
        } catch (InvalidArgumentException $e) {
307
            $message = $e->getMessage();
308
        }
309
        
310
        return $message;
311
    }
312
    /**
313
     * Set Message value
314
     * This property belongs to a choice that allows only one property to exist. It is
315
     * therefore removable from the request, consequently if the value assigned to this
316
     * property is null, the property is removed from this object
317
     * @throws InvalidArgumentException
318
     * @param \StructType\EwsMessageType $message
319
     * @return \StructType\EwsItemAttachmentType
320
     */
321
    public function setMessage(?\StructType\EwsMessageType $message = null): self
322
    {
323
        // validation for constraint: choice(Item, Message, CalendarItem, Contact, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking)
324
        if ('' !== ($messageChoiceErrorMessage = self::validateMessageForChoiceConstraintsFromSetMessage($message))) {
0 ignored issues
show
Bug Best Practice introduced by
The method StructType\EwsItemAttach...traintsFromSetMessage() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

324
        if ('' !== ($messageChoiceErrorMessage = self::/** @scrutinizer ignore-call */ validateMessageForChoiceConstraintsFromSetMessage($message))) {
Loading history...
325
            throw new InvalidArgumentException($messageChoiceErrorMessage, __LINE__);
326
        }
327
        if (is_null($message) || (is_array($message) && empty($message))) {
328
            unset($this->Message);
329
        } else {
330
            $this->Message = $message;
331
        }
332
        
333
        return $this;
334
    }
335
    /**
336
     * Get CalendarItem value
337
     * @return \StructType\EwsCalendarItemType|null
338
     */
339
    public function getCalendarItem(): ?\StructType\EwsCalendarItemType
340
    {
341
        return isset($this->CalendarItem) ? $this->CalendarItem : null;
342
    }
343
    /**
344
     * This method is responsible for validating the value passed to the setCalendarItem method
345
     * This method is willingly generated in order to preserve the one-line inline validation within the setCalendarItem method
346
     * This has to validate that the property which is being set is the only one among the given choices
347
     * @param mixed $value
348
     * @return string A non-empty message if the values does not match the validation rules
349
     */
350
    public function validateCalendarItemForChoiceConstraintsFromSetCalendarItem($value): string
351
    {
352
        $message = '';
353
        if (is_null($value)) {
354
            return $message;
355
        }
356
        $properties = [
357
            'Item',
358
            'Message',
359
            'Contact',
360
            'MeetingMessage',
361
            'MeetingRequest',
362
            'MeetingResponse',
363
            'MeetingCancellation',
364
            'Task',
365
            'PostItem',
366
            'RoleMember',
367
            'Network',
368
            'Person',
369
            'Booking',
370
        ];
371
        try {
372
            foreach ($properties as $property) {
373
                if (isset($this->{$property})) {
374
                    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__);
375
                }
376
            }
377
        } catch (InvalidArgumentException $e) {
378
            $message = $e->getMessage();
379
        }
380
        
381
        return $message;
382
    }
383
    /**
384
     * Set CalendarItem value
385
     * This property belongs to a choice that allows only one property to exist. It is
386
     * therefore removable from the request, consequently if the value assigned to this
387
     * property is null, the property is removed from this object
388
     * @throws InvalidArgumentException
389
     * @param \StructType\EwsCalendarItemType $calendarItem
390
     * @return \StructType\EwsItemAttachmentType
391
     */
392
    public function setCalendarItem(?\StructType\EwsCalendarItemType $calendarItem = null): self
393
    {
394
        // validation for constraint: choice(Item, Message, CalendarItem, Contact, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking)
395
        if ('' !== ($calendarItemChoiceErrorMessage = self::validateCalendarItemForChoiceConstraintsFromSetCalendarItem($calendarItem))) {
0 ignored issues
show
Bug Best Practice introduced by
The method StructType\EwsItemAttach...tsFromSetCalendarItem() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

395
        if ('' !== ($calendarItemChoiceErrorMessage = self::/** @scrutinizer ignore-call */ validateCalendarItemForChoiceConstraintsFromSetCalendarItem($calendarItem))) {
Loading history...
396
            throw new InvalidArgumentException($calendarItemChoiceErrorMessage, __LINE__);
397
        }
398
        if (is_null($calendarItem) || (is_array($calendarItem) && empty($calendarItem))) {
399
            unset($this->CalendarItem);
400
        } else {
401
            $this->CalendarItem = $calendarItem;
402
        }
403
        
404
        return $this;
405
    }
406
    /**
407
     * Get Contact value
408
     * @return \StructType\EwsContactItemType|null
409
     */
410
    public function getContact(): ?\StructType\EwsContactItemType
411
    {
412
        return isset($this->Contact) ? $this->Contact : null;
413
    }
414
    /**
415
     * This method is responsible for validating the value passed to the setContact method
416
     * This method is willingly generated in order to preserve the one-line inline validation within the setContact method
417
     * This has to validate that the property which is being set is the only one among the given choices
418
     * @param mixed $value
419
     * @return string A non-empty message if the values does not match the validation rules
420
     */
421
    public function validateContactForChoiceConstraintsFromSetContact($value): string
422
    {
423
        $message = '';
424
        if (is_null($value)) {
425
            return $message;
426
        }
427
        $properties = [
428
            'Item',
429
            'Message',
430
            'CalendarItem',
431
            'MeetingMessage',
432
            'MeetingRequest',
433
            'MeetingResponse',
434
            'MeetingCancellation',
435
            'Task',
436
            'PostItem',
437
            'RoleMember',
438
            'Network',
439
            'Person',
440
            'Booking',
441
        ];
442
        try {
443
            foreach ($properties as $property) {
444
                if (isset($this->{$property})) {
445
                    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__);
446
                }
447
            }
448
        } catch (InvalidArgumentException $e) {
449
            $message = $e->getMessage();
450
        }
451
        
452
        return $message;
453
    }
454
    /**
455
     * Set Contact value
456
     * This property belongs to a choice that allows only one property to exist. It is
457
     * therefore removable from the request, consequently if the value assigned to this
458
     * property is null, the property is removed from this object
459
     * @throws InvalidArgumentException
460
     * @param \StructType\EwsContactItemType $contact
461
     * @return \StructType\EwsItemAttachmentType
462
     */
463
    public function setContact(?\StructType\EwsContactItemType $contact = null): self
464
    {
465
        // validation for constraint: choice(Item, Message, CalendarItem, Contact, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking)
466
        if ('' !== ($contactChoiceErrorMessage = self::validateContactForChoiceConstraintsFromSetContact($contact))) {
0 ignored issues
show
Bug Best Practice introduced by
The method StructType\EwsItemAttach...traintsFromSetContact() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

466
        if ('' !== ($contactChoiceErrorMessage = self::/** @scrutinizer ignore-call */ validateContactForChoiceConstraintsFromSetContact($contact))) {
Loading history...
467
            throw new InvalidArgumentException($contactChoiceErrorMessage, __LINE__);
468
        }
469
        if (is_null($contact) || (is_array($contact) && empty($contact))) {
470
            unset($this->Contact);
471
        } else {
472
            $this->Contact = $contact;
473
        }
474
        
475
        return $this;
476
    }
477
    /**
478
     * Get MeetingMessage value
479
     * @return \StructType\EwsMeetingMessageType|null
480
     */
481
    public function getMeetingMessage(): ?\StructType\EwsMeetingMessageType
482
    {
483
        return isset($this->MeetingMessage) ? $this->MeetingMessage : null;
484
    }
485
    /**
486
     * This method is responsible for validating the value passed to the setMeetingMessage method
487
     * This method is willingly generated in order to preserve the one-line inline validation within the setMeetingMessage method
488
     * This has to validate that the property which is being set is the only one among the given choices
489
     * @param mixed $value
490
     * @return string A non-empty message if the values does not match the validation rules
491
     */
492
    public function validateMeetingMessageForChoiceConstraintsFromSetMeetingMessage($value): string
493
    {
494
        $message = '';
495
        if (is_null($value)) {
496
            return $message;
497
        }
498
        $properties = [
499
            'Item',
500
            'Message',
501
            'CalendarItem',
502
            'Contact',
503
            'MeetingRequest',
504
            'MeetingResponse',
505
            'MeetingCancellation',
506
            'Task',
507
            'PostItem',
508
            'RoleMember',
509
            'Network',
510
            'Person',
511
            'Booking',
512
        ];
513
        try {
514
            foreach ($properties as $property) {
515
                if (isset($this->{$property})) {
516
                    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__);
517
                }
518
            }
519
        } catch (InvalidArgumentException $e) {
520
            $message = $e->getMessage();
521
        }
522
        
523
        return $message;
524
    }
525
    /**
526
     * Set MeetingMessage value
527
     * This property belongs to a choice that allows only one property to exist. It is
528
     * therefore removable from the request, consequently if the value assigned to this
529
     * property is null, the property is removed from this object
530
     * @throws InvalidArgumentException
531
     * @param \StructType\EwsMeetingMessageType $meetingMessage
532
     * @return \StructType\EwsItemAttachmentType
533
     */
534
    public function setMeetingMessage(?\StructType\EwsMeetingMessageType $meetingMessage = null): self
535
    {
536
        // validation for constraint: choice(Item, Message, CalendarItem, Contact, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking)
537
        if ('' !== ($meetingMessageChoiceErrorMessage = self::validateMeetingMessageForChoiceConstraintsFromSetMeetingMessage($meetingMessage))) {
0 ignored issues
show
Bug Best Practice introduced by
The method StructType\EwsItemAttach...FromSetMeetingMessage() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

537
        if ('' !== ($meetingMessageChoiceErrorMessage = self::/** @scrutinizer ignore-call */ validateMeetingMessageForChoiceConstraintsFromSetMeetingMessage($meetingMessage))) {
Loading history...
538
            throw new InvalidArgumentException($meetingMessageChoiceErrorMessage, __LINE__);
539
        }
540
        if (is_null($meetingMessage) || (is_array($meetingMessage) && empty($meetingMessage))) {
541
            unset($this->MeetingMessage);
542
        } else {
543
            $this->MeetingMessage = $meetingMessage;
544
        }
545
        
546
        return $this;
547
    }
548
    /**
549
     * Get MeetingRequest value
550
     * @return \StructType\EwsMeetingRequestMessageType|null
551
     */
552
    public function getMeetingRequest(): ?\StructType\EwsMeetingRequestMessageType
553
    {
554
        return isset($this->MeetingRequest) ? $this->MeetingRequest : null;
555
    }
556
    /**
557
     * This method is responsible for validating the value passed to the setMeetingRequest method
558
     * This method is willingly generated in order to preserve the one-line inline validation within the setMeetingRequest method
559
     * This has to validate that the property which is being set is the only one among the given choices
560
     * @param mixed $value
561
     * @return string A non-empty message if the values does not match the validation rules
562
     */
563
    public function validateMeetingRequestForChoiceConstraintsFromSetMeetingRequest($value): string
564
    {
565
        $message = '';
566
        if (is_null($value)) {
567
            return $message;
568
        }
569
        $properties = [
570
            'Item',
571
            'Message',
572
            'CalendarItem',
573
            'Contact',
574
            'MeetingMessage',
575
            'MeetingResponse',
576
            'MeetingCancellation',
577
            'Task',
578
            'PostItem',
579
            'RoleMember',
580
            'Network',
581
            'Person',
582
            'Booking',
583
        ];
584
        try {
585
            foreach ($properties as $property) {
586
                if (isset($this->{$property})) {
587
                    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__);
588
                }
589
            }
590
        } catch (InvalidArgumentException $e) {
591
            $message = $e->getMessage();
592
        }
593
        
594
        return $message;
595
    }
596
    /**
597
     * Set MeetingRequest value
598
     * This property belongs to a choice that allows only one property to exist. It is
599
     * therefore removable from the request, consequently if the value assigned to this
600
     * property is null, the property is removed from this object
601
     * @throws InvalidArgumentException
602
     * @param \StructType\EwsMeetingRequestMessageType $meetingRequest
603
     * @return \StructType\EwsItemAttachmentType
604
     */
605
    public function setMeetingRequest(?\StructType\EwsMeetingRequestMessageType $meetingRequest = null): self
606
    {
607
        // validation for constraint: choice(Item, Message, CalendarItem, Contact, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking)
608
        if ('' !== ($meetingRequestChoiceErrorMessage = self::validateMeetingRequestForChoiceConstraintsFromSetMeetingRequest($meetingRequest))) {
0 ignored issues
show
Bug Best Practice introduced by
The method StructType\EwsItemAttach...FromSetMeetingRequest() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

608
        if ('' !== ($meetingRequestChoiceErrorMessage = self::/** @scrutinizer ignore-call */ validateMeetingRequestForChoiceConstraintsFromSetMeetingRequest($meetingRequest))) {
Loading history...
609
            throw new InvalidArgumentException($meetingRequestChoiceErrorMessage, __LINE__);
610
        }
611
        if (is_null($meetingRequest) || (is_array($meetingRequest) && empty($meetingRequest))) {
612
            unset($this->MeetingRequest);
613
        } else {
614
            $this->MeetingRequest = $meetingRequest;
615
        }
616
        
617
        return $this;
618
    }
619
    /**
620
     * Get MeetingResponse value
621
     * @return \StructType\EwsMeetingResponseMessageType|null
622
     */
623
    public function getMeetingResponse(): ?\StructType\EwsMeetingResponseMessageType
624
    {
625
        return isset($this->MeetingResponse) ? $this->MeetingResponse : null;
626
    }
627
    /**
628
     * This method is responsible for validating the value passed to the setMeetingResponse method
629
     * This method is willingly generated in order to preserve the one-line inline validation within the setMeetingResponse method
630
     * This has to validate that the property which is being set is the only one among the given choices
631
     * @param mixed $value
632
     * @return string A non-empty message if the values does not match the validation rules
633
     */
634
    public function validateMeetingResponseForChoiceConstraintsFromSetMeetingResponse($value): string
635
    {
636
        $message = '';
637
        if (is_null($value)) {
638
            return $message;
639
        }
640
        $properties = [
641
            'Item',
642
            'Message',
643
            'CalendarItem',
644
            'Contact',
645
            'MeetingMessage',
646
            'MeetingRequest',
647
            'MeetingCancellation',
648
            'Task',
649
            'PostItem',
650
            'RoleMember',
651
            'Network',
652
            'Person',
653
            'Booking',
654
        ];
655
        try {
656
            foreach ($properties as $property) {
657
                if (isset($this->{$property})) {
658
                    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__);
659
                }
660
            }
661
        } catch (InvalidArgumentException $e) {
662
            $message = $e->getMessage();
663
        }
664
        
665
        return $message;
666
    }
667
    /**
668
     * Set MeetingResponse value
669
     * This property belongs to a choice that allows only one property to exist. It is
670
     * therefore removable from the request, consequently if the value assigned to this
671
     * property is null, the property is removed from this object
672
     * @throws InvalidArgumentException
673
     * @param \StructType\EwsMeetingResponseMessageType $meetingResponse
674
     * @return \StructType\EwsItemAttachmentType
675
     */
676
    public function setMeetingResponse(?\StructType\EwsMeetingResponseMessageType $meetingResponse = null): self
677
    {
678
        // validation for constraint: choice(Item, Message, CalendarItem, Contact, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking)
679
        if ('' !== ($meetingResponseChoiceErrorMessage = self::validateMeetingResponseForChoiceConstraintsFromSetMeetingResponse($meetingResponse))) {
0 ignored issues
show
Bug Best Practice introduced by
The method StructType\EwsItemAttach...romSetMeetingResponse() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

679
        if ('' !== ($meetingResponseChoiceErrorMessage = self::/** @scrutinizer ignore-call */ validateMeetingResponseForChoiceConstraintsFromSetMeetingResponse($meetingResponse))) {
Loading history...
680
            throw new InvalidArgumentException($meetingResponseChoiceErrorMessage, __LINE__);
681
        }
682
        if (is_null($meetingResponse) || (is_array($meetingResponse) && empty($meetingResponse))) {
683
            unset($this->MeetingResponse);
684
        } else {
685
            $this->MeetingResponse = $meetingResponse;
686
        }
687
        
688
        return $this;
689
    }
690
    /**
691
     * Get MeetingCancellation value
692
     * @return \StructType\EwsMeetingCancellationMessageType|null
693
     */
694
    public function getMeetingCancellation(): ?\StructType\EwsMeetingCancellationMessageType
695
    {
696
        return isset($this->MeetingCancellation) ? $this->MeetingCancellation : null;
697
    }
698
    /**
699
     * This method is responsible for validating the value passed to the setMeetingCancellation method
700
     * This method is willingly generated in order to preserve the one-line inline validation within the setMeetingCancellation method
701
     * This has to validate that the property which is being set is the only one among the given choices
702
     * @param mixed $value
703
     * @return string A non-empty message if the values does not match the validation rules
704
     */
705
    public function validateMeetingCancellationForChoiceConstraintsFromSetMeetingCancellation($value): string
706
    {
707
        $message = '';
708
        if (is_null($value)) {
709
            return $message;
710
        }
711
        $properties = [
712
            'Item',
713
            'Message',
714
            'CalendarItem',
715
            'Contact',
716
            'MeetingMessage',
717
            'MeetingRequest',
718
            'MeetingResponse',
719
            'Task',
720
            'PostItem',
721
            'RoleMember',
722
            'Network',
723
            'Person',
724
            'Booking',
725
        ];
726
        try {
727
            foreach ($properties as $property) {
728
                if (isset($this->{$property})) {
729
                    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__);
730
                }
731
            }
732
        } catch (InvalidArgumentException $e) {
733
            $message = $e->getMessage();
734
        }
735
        
736
        return $message;
737
    }
738
    /**
739
     * Set MeetingCancellation value
740
     * This property belongs to a choice that allows only one property to exist. It is
741
     * therefore removable from the request, consequently if the value assigned to this
742
     * property is null, the property is removed from this object
743
     * @throws InvalidArgumentException
744
     * @param \StructType\EwsMeetingCancellationMessageType $meetingCancellation
745
     * @return \StructType\EwsItemAttachmentType
746
     */
747
    public function setMeetingCancellation(?\StructType\EwsMeetingCancellationMessageType $meetingCancellation = null): self
748
    {
749
        // validation for constraint: choice(Item, Message, CalendarItem, Contact, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking)
750
        if ('' !== ($meetingCancellationChoiceErrorMessage = self::validateMeetingCancellationForChoiceConstraintsFromSetMeetingCancellation($meetingCancellation))) {
0 ignored issues
show
Bug Best Practice introduced by
The method StructType\EwsItemAttach...etMeetingCancellation() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

750
        if ('' !== ($meetingCancellationChoiceErrorMessage = self::/** @scrutinizer ignore-call */ validateMeetingCancellationForChoiceConstraintsFromSetMeetingCancellation($meetingCancellation))) {
Loading history...
751
            throw new InvalidArgumentException($meetingCancellationChoiceErrorMessage, __LINE__);
752
        }
753
        if (is_null($meetingCancellation) || (is_array($meetingCancellation) && empty($meetingCancellation))) {
754
            unset($this->MeetingCancellation);
755
        } else {
756
            $this->MeetingCancellation = $meetingCancellation;
757
        }
758
        
759
        return $this;
760
    }
761
    /**
762
     * Get Task value
763
     * @return \StructType\EwsTaskType|null
764
     */
765
    public function getTask(): ?\StructType\EwsTaskType
766
    {
767
        return isset($this->Task) ? $this->Task : null;
768
    }
769
    /**
770
     * This method is responsible for validating the value passed to the setTask method
771
     * This method is willingly generated in order to preserve the one-line inline validation within the setTask method
772
     * This has to validate that the property which is being set is the only one among the given choices
773
     * @param mixed $value
774
     * @return string A non-empty message if the values does not match the validation rules
775
     */
776
    public function validateTaskForChoiceConstraintsFromSetTask($value): string
777
    {
778
        $message = '';
779
        if (is_null($value)) {
780
            return $message;
781
        }
782
        $properties = [
783
            'Item',
784
            'Message',
785
            'CalendarItem',
786
            'Contact',
787
            'MeetingMessage',
788
            'MeetingRequest',
789
            'MeetingResponse',
790
            'MeetingCancellation',
791
            'PostItem',
792
            'RoleMember',
793
            'Network',
794
            'Person',
795
            'Booking',
796
        ];
797
        try {
798
            foreach ($properties as $property) {
799
                if (isset($this->{$property})) {
800
                    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__);
801
                }
802
            }
803
        } catch (InvalidArgumentException $e) {
804
            $message = $e->getMessage();
805
        }
806
        
807
        return $message;
808
    }
809
    /**
810
     * Set Task value
811
     * This property belongs to a choice that allows only one property to exist. It is
812
     * therefore removable from the request, consequently if the value assigned to this
813
     * property is null, the property is removed from this object
814
     * @throws InvalidArgumentException
815
     * @param \StructType\EwsTaskType $task
816
     * @return \StructType\EwsItemAttachmentType
817
     */
818
    public function setTask(?\StructType\EwsTaskType $task = null): self
819
    {
820
        // validation for constraint: choice(Item, Message, CalendarItem, Contact, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking)
821
        if ('' !== ($taskChoiceErrorMessage = self::validateTaskForChoiceConstraintsFromSetTask($task))) {
0 ignored issues
show
Bug Best Practice introduced by
The method StructType\EwsItemAttach...onstraintsFromSetTask() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

821
        if ('' !== ($taskChoiceErrorMessage = self::/** @scrutinizer ignore-call */ validateTaskForChoiceConstraintsFromSetTask($task))) {
Loading history...
822
            throw new InvalidArgumentException($taskChoiceErrorMessage, __LINE__);
823
        }
824
        if (is_null($task) || (is_array($task) && empty($task))) {
825
            unset($this->Task);
826
        } else {
827
            $this->Task = $task;
828
        }
829
        
830
        return $this;
831
    }
832
    /**
833
     * Get PostItem value
834
     * @return \StructType\EwsPostItemType|null
835
     */
836
    public function getPostItem(): ?\StructType\EwsPostItemType
837
    {
838
        return isset($this->PostItem) ? $this->PostItem : null;
839
    }
840
    /**
841
     * This method is responsible for validating the value passed to the setPostItem method
842
     * This method is willingly generated in order to preserve the one-line inline validation within the setPostItem method
843
     * This has to validate that the property which is being set is the only one among the given choices
844
     * @param mixed $value
845
     * @return string A non-empty message if the values does not match the validation rules
846
     */
847
    public function validatePostItemForChoiceConstraintsFromSetPostItem($value): string
848
    {
849
        $message = '';
850
        if (is_null($value)) {
851
            return $message;
852
        }
853
        $properties = [
854
            'Item',
855
            'Message',
856
            'CalendarItem',
857
            'Contact',
858
            'MeetingMessage',
859
            'MeetingRequest',
860
            'MeetingResponse',
861
            'MeetingCancellation',
862
            'Task',
863
            'RoleMember',
864
            'Network',
865
            'Person',
866
            'Booking',
867
        ];
868
        try {
869
            foreach ($properties as $property) {
870
                if (isset($this->{$property})) {
871
                    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__);
872
                }
873
            }
874
        } catch (InvalidArgumentException $e) {
875
            $message = $e->getMessage();
876
        }
877
        
878
        return $message;
879
    }
880
    /**
881
     * Set PostItem value
882
     * This property belongs to a choice that allows only one property to exist. It is
883
     * therefore removable from the request, consequently if the value assigned to this
884
     * property is null, the property is removed from this object
885
     * @throws InvalidArgumentException
886
     * @param \StructType\EwsPostItemType $postItem
887
     * @return \StructType\EwsItemAttachmentType
888
     */
889
    public function setPostItem(?\StructType\EwsPostItemType $postItem = null): self
890
    {
891
        // validation for constraint: choice(Item, Message, CalendarItem, Contact, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking)
892
        if ('' !== ($postItemChoiceErrorMessage = self::validatePostItemForChoiceConstraintsFromSetPostItem($postItem))) {
0 ignored issues
show
Bug Best Practice introduced by
The method StructType\EwsItemAttach...raintsFromSetPostItem() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

892
        if ('' !== ($postItemChoiceErrorMessage = self::/** @scrutinizer ignore-call */ validatePostItemForChoiceConstraintsFromSetPostItem($postItem))) {
Loading history...
893
            throw new InvalidArgumentException($postItemChoiceErrorMessage, __LINE__);
894
        }
895
        if (is_null($postItem) || (is_array($postItem) && empty($postItem))) {
896
            unset($this->PostItem);
897
        } else {
898
            $this->PostItem = $postItem;
899
        }
900
        
901
        return $this;
902
    }
903
    /**
904
     * Get RoleMember value
905
     * @return \StructType\EwsRoleMemberItemType|null
906
     */
907
    public function getRoleMember(): ?\StructType\EwsRoleMemberItemType
908
    {
909
        return isset($this->RoleMember) ? $this->RoleMember : null;
910
    }
911
    /**
912
     * This method is responsible for validating the value passed to the setRoleMember method
913
     * This method is willingly generated in order to preserve the one-line inline validation within the setRoleMember method
914
     * This has to validate that the property which is being set is the only one among the given choices
915
     * @param mixed $value
916
     * @return string A non-empty message if the values does not match the validation rules
917
     */
918
    public function validateRoleMemberForChoiceConstraintsFromSetRoleMember($value): string
919
    {
920
        $message = '';
921
        if (is_null($value)) {
922
            return $message;
923
        }
924
        $properties = [
925
            'Item',
926
            'Message',
927
            'CalendarItem',
928
            'Contact',
929
            'MeetingMessage',
930
            'MeetingRequest',
931
            'MeetingResponse',
932
            'MeetingCancellation',
933
            'Task',
934
            'PostItem',
935
            'Network',
936
            'Person',
937
            'Booking',
938
        ];
939
        try {
940
            foreach ($properties as $property) {
941
                if (isset($this->{$property})) {
942
                    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__);
943
                }
944
            }
945
        } catch (InvalidArgumentException $e) {
946
            $message = $e->getMessage();
947
        }
948
        
949
        return $message;
950
    }
951
    /**
952
     * Set RoleMember value
953
     * This property belongs to a choice that allows only one property to exist. It is
954
     * therefore removable from the request, consequently if the value assigned to this
955
     * property is null, the property is removed from this object
956
     * @throws InvalidArgumentException
957
     * @param \StructType\EwsRoleMemberItemType $roleMember
958
     * @return \StructType\EwsItemAttachmentType
959
     */
960
    public function setRoleMember(?\StructType\EwsRoleMemberItemType $roleMember = null): self
961
    {
962
        // validation for constraint: choice(Item, Message, CalendarItem, Contact, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking)
963
        if ('' !== ($roleMemberChoiceErrorMessage = self::validateRoleMemberForChoiceConstraintsFromSetRoleMember($roleMember))) {
0 ignored issues
show
Bug Best Practice introduced by
The method StructType\EwsItemAttach...intsFromSetRoleMember() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

963
        if ('' !== ($roleMemberChoiceErrorMessage = self::/** @scrutinizer ignore-call */ validateRoleMemberForChoiceConstraintsFromSetRoleMember($roleMember))) {
Loading history...
964
            throw new InvalidArgumentException($roleMemberChoiceErrorMessage, __LINE__);
965
        }
966
        if (is_null($roleMember) || (is_array($roleMember) && empty($roleMember))) {
967
            unset($this->RoleMember);
968
        } else {
969
            $this->RoleMember = $roleMember;
970
        }
971
        
972
        return $this;
973
    }
974
    /**
975
     * Get Network value
976
     * @return \StructType\EwsNetworkItemType|null
977
     */
978
    public function getNetwork(): ?\StructType\EwsNetworkItemType
979
    {
980
        return isset($this->Network) ? $this->Network : null;
981
    }
982
    /**
983
     * This method is responsible for validating the value passed to the setNetwork method
984
     * This method is willingly generated in order to preserve the one-line inline validation within the setNetwork method
985
     * This has to validate that the property which is being set is the only one among the given choices
986
     * @param mixed $value
987
     * @return string A non-empty message if the values does not match the validation rules
988
     */
989
    public function validateNetworkForChoiceConstraintsFromSetNetwork($value): string
990
    {
991
        $message = '';
992
        if (is_null($value)) {
993
            return $message;
994
        }
995
        $properties = [
996
            'Item',
997
            'Message',
998
            'CalendarItem',
999
            'Contact',
1000
            'MeetingMessage',
1001
            'MeetingRequest',
1002
            'MeetingResponse',
1003
            'MeetingCancellation',
1004
            'Task',
1005
            'PostItem',
1006
            'RoleMember',
1007
            'Person',
1008
            'Booking',
1009
        ];
1010
        try {
1011
            foreach ($properties as $property) {
1012
                if (isset($this->{$property})) {
1013
                    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__);
1014
                }
1015
            }
1016
        } catch (InvalidArgumentException $e) {
1017
            $message = $e->getMessage();
1018
        }
1019
        
1020
        return $message;
1021
    }
1022
    /**
1023
     * Set Network value
1024
     * This property belongs to a choice that allows only one property to exist. It is
1025
     * therefore removable from the request, consequently if the value assigned to this
1026
     * property is null, the property is removed from this object
1027
     * @throws InvalidArgumentException
1028
     * @param \StructType\EwsNetworkItemType $network
1029
     * @return \StructType\EwsItemAttachmentType
1030
     */
1031
    public function setNetwork(?\StructType\EwsNetworkItemType $network = null): self
1032
    {
1033
        // validation for constraint: choice(Item, Message, CalendarItem, Contact, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking)
1034
        if ('' !== ($networkChoiceErrorMessage = self::validateNetworkForChoiceConstraintsFromSetNetwork($network))) {
0 ignored issues
show
Bug Best Practice introduced by
The method StructType\EwsItemAttach...traintsFromSetNetwork() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

1034
        if ('' !== ($networkChoiceErrorMessage = self::/** @scrutinizer ignore-call */ validateNetworkForChoiceConstraintsFromSetNetwork($network))) {
Loading history...
1035
            throw new InvalidArgumentException($networkChoiceErrorMessage, __LINE__);
1036
        }
1037
        if (is_null($network) || (is_array($network) && empty($network))) {
1038
            unset($this->Network);
1039
        } else {
1040
            $this->Network = $network;
1041
        }
1042
        
1043
        return $this;
1044
    }
1045
    /**
1046
     * Get Person value
1047
     * @return \StructType\EwsAbchPersonItemType|null
1048
     */
1049
    public function getPerson(): ?\StructType\EwsAbchPersonItemType
1050
    {
1051
        return isset($this->Person) ? $this->Person : null;
1052
    }
1053
    /**
1054
     * This method is responsible for validating the value passed to the setPerson method
1055
     * This method is willingly generated in order to preserve the one-line inline validation within the setPerson method
1056
     * This has to validate that the property which is being set is the only one among the given choices
1057
     * @param mixed $value
1058
     * @return string A non-empty message if the values does not match the validation rules
1059
     */
1060
    public function validatePersonForChoiceConstraintsFromSetPerson($value): string
1061
    {
1062
        $message = '';
1063
        if (is_null($value)) {
1064
            return $message;
1065
        }
1066
        $properties = [
1067
            'Item',
1068
            'Message',
1069
            'CalendarItem',
1070
            'Contact',
1071
            'MeetingMessage',
1072
            'MeetingRequest',
1073
            'MeetingResponse',
1074
            'MeetingCancellation',
1075
            'Task',
1076
            'PostItem',
1077
            'RoleMember',
1078
            'Network',
1079
            'Booking',
1080
        ];
1081
        try {
1082
            foreach ($properties as $property) {
1083
                if (isset($this->{$property})) {
1084
                    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__);
1085
                }
1086
            }
1087
        } catch (InvalidArgumentException $e) {
1088
            $message = $e->getMessage();
1089
        }
1090
        
1091
        return $message;
1092
    }
1093
    /**
1094
     * Set Person value
1095
     * This property belongs to a choice that allows only one property to exist. It is
1096
     * therefore removable from the request, consequently if the value assigned to this
1097
     * property is null, the property is removed from this object
1098
     * @throws InvalidArgumentException
1099
     * @param \StructType\EwsAbchPersonItemType $person
1100
     * @return \StructType\EwsItemAttachmentType
1101
     */
1102
    public function setPerson(?\StructType\EwsAbchPersonItemType $person = null): self
1103
    {
1104
        // validation for constraint: choice(Item, Message, CalendarItem, Contact, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking)
1105
        if ('' !== ($personChoiceErrorMessage = self::validatePersonForChoiceConstraintsFromSetPerson($person))) {
0 ignored issues
show
Bug Best Practice introduced by
The method StructType\EwsItemAttach...straintsFromSetPerson() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

1105
        if ('' !== ($personChoiceErrorMessage = self::/** @scrutinizer ignore-call */ validatePersonForChoiceConstraintsFromSetPerson($person))) {
Loading history...
1106
            throw new InvalidArgumentException($personChoiceErrorMessage, __LINE__);
1107
        }
1108
        if (is_null($person) || (is_array($person) && empty($person))) {
1109
            unset($this->Person);
1110
        } else {
1111
            $this->Person = $person;
1112
        }
1113
        
1114
        return $this;
1115
    }
1116
    /**
1117
     * Get Booking value
1118
     * @return \StructType\EwsBookingItemType|null
1119
     */
1120
    public function getBooking(): ?\StructType\EwsBookingItemType
1121
    {
1122
        return isset($this->Booking) ? $this->Booking : null;
1123
    }
1124
    /**
1125
     * This method is responsible for validating the value passed to the setBooking method
1126
     * This method is willingly generated in order to preserve the one-line inline validation within the setBooking method
1127
     * This has to validate that the property which is being set is the only one among the given choices
1128
     * @param mixed $value
1129
     * @return string A non-empty message if the values does not match the validation rules
1130
     */
1131
    public function validateBookingForChoiceConstraintsFromSetBooking($value): string
1132
    {
1133
        $message = '';
1134
        if (is_null($value)) {
1135
            return $message;
1136
        }
1137
        $properties = [
1138
            'Item',
1139
            'Message',
1140
            'CalendarItem',
1141
            'Contact',
1142
            'MeetingMessage',
1143
            'MeetingRequest',
1144
            'MeetingResponse',
1145
            'MeetingCancellation',
1146
            'Task',
1147
            'PostItem',
1148
            'RoleMember',
1149
            'Network',
1150
            'Person',
1151
        ];
1152
        try {
1153
            foreach ($properties as $property) {
1154
                if (isset($this->{$property})) {
1155
                    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__);
1156
                }
1157
            }
1158
        } catch (InvalidArgumentException $e) {
1159
            $message = $e->getMessage();
1160
        }
1161
        
1162
        return $message;
1163
    }
1164
    /**
1165
     * Set Booking value
1166
     * This property belongs to a choice that allows only one property to exist. It is
1167
     * therefore removable from the request, consequently if the value assigned to this
1168
     * property is null, the property is removed from this object
1169
     * @throws InvalidArgumentException
1170
     * @param \StructType\EwsBookingItemType $booking
1171
     * @return \StructType\EwsItemAttachmentType
1172
     */
1173
    public function setBooking(?\StructType\EwsBookingItemType $booking = null): self
1174
    {
1175
        // validation for constraint: choice(Item, Message, CalendarItem, Contact, MeetingMessage, MeetingRequest, MeetingResponse, MeetingCancellation, Task, PostItem, RoleMember, Network, Person, Booking)
1176
        if ('' !== ($bookingChoiceErrorMessage = self::validateBookingForChoiceConstraintsFromSetBooking($booking))) {
0 ignored issues
show
Bug Best Practice introduced by
The method StructType\EwsItemAttach...traintsFromSetBooking() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

1176
        if ('' !== ($bookingChoiceErrorMessage = self::/** @scrutinizer ignore-call */ validateBookingForChoiceConstraintsFromSetBooking($booking))) {
Loading history...
1177
            throw new InvalidArgumentException($bookingChoiceErrorMessage, __LINE__);
1178
        }
1179
        if (is_null($booking) || (is_array($booking) && empty($booking))) {
1180
            unset($this->Booking);
1181
        } else {
1182
            $this->Booking = $booking;
1183
        }
1184
        
1185
        return $this;
1186
    }
1187
}
1188