EwsNonEmptyArrayOfFoldersType::getCalendarFolder()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 1
nc 2
nop 0
dl 0
loc 3
rs 10
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 NonEmptyArrayOfFoldersType StructType
12
 * @package Ews
13
 * @subpackage Structs
14
 * @author WsdlToPhp <[email protected]>
15
 */
16
class EwsNonEmptyArrayOfFoldersType extends AbstractStructBase
17
{
18
    /**
19
     * The Folder
20
     * Meta information extracted from the WSDL
21
     * - choice: Folder | CalendarFolder | ContactsFolder | SearchFolder | TasksFolder
22
     * - choiceMaxOccurs: unbounded
23
     * - choiceMinOccurs: 1
24
     * @var \StructType\EwsFolderType|null
25
     */
26
    protected ?\StructType\EwsFolderType $Folder = null;
27
    /**
28
     * The CalendarFolder
29
     * Meta information extracted from the WSDL
30
     * - choice: Folder | CalendarFolder | ContactsFolder | SearchFolder | TasksFolder
31
     * - choiceMaxOccurs: unbounded
32
     * - choiceMinOccurs: 1
33
     * @var \StructType\EwsCalendarFolderType|null
34
     */
35
    protected ?\StructType\EwsCalendarFolderType $CalendarFolder = null;
36
    /**
37
     * The ContactsFolder
38
     * Meta information extracted from the WSDL
39
     * - choice: Folder | CalendarFolder | ContactsFolder | SearchFolder | TasksFolder
40
     * - choiceMaxOccurs: unbounded
41
     * - choiceMinOccurs: 1
42
     * @var \StructType\EwsContactsFolderType|null
43
     */
44
    protected ?\StructType\EwsContactsFolderType $ContactsFolder = null;
45
    /**
46
     * The SearchFolder
47
     * Meta information extracted from the WSDL
48
     * - choice: Folder | CalendarFolder | ContactsFolder | SearchFolder | TasksFolder
49
     * - choiceMaxOccurs: unbounded
50
     * - choiceMinOccurs: 1
51
     * @var \StructType\EwsSearchFolderType|null
52
     */
53
    protected ?\StructType\EwsSearchFolderType $SearchFolder = null;
54
    /**
55
     * The TasksFolder
56
     * Meta information extracted from the WSDL
57
     * - choice: Folder | CalendarFolder | ContactsFolder | SearchFolder | TasksFolder
58
     * - choiceMaxOccurs: unbounded
59
     * - choiceMinOccurs: 1
60
     * @var \StructType\EwsTasksFolderType|null
61
     */
62
    protected ?\StructType\EwsTasksFolderType $TasksFolder = null;
63
    /**
64
     * Constructor method for NonEmptyArrayOfFoldersType
65
     * @uses EwsNonEmptyArrayOfFoldersType::setFolder()
66
     * @uses EwsNonEmptyArrayOfFoldersType::setCalendarFolder()
67
     * @uses EwsNonEmptyArrayOfFoldersType::setContactsFolder()
68
     * @uses EwsNonEmptyArrayOfFoldersType::setSearchFolder()
69
     * @uses EwsNonEmptyArrayOfFoldersType::setTasksFolder()
70
     * @param \StructType\EwsFolderType $folder
71
     * @param \StructType\EwsCalendarFolderType $calendarFolder
72
     * @param \StructType\EwsContactsFolderType $contactsFolder
73
     * @param \StructType\EwsSearchFolderType $searchFolder
74
     * @param \StructType\EwsTasksFolderType $tasksFolder
75
     */
76
    public function __construct(?\StructType\EwsFolderType $folder = null, ?\StructType\EwsCalendarFolderType $calendarFolder = null, ?\StructType\EwsContactsFolderType $contactsFolder = null, ?\StructType\EwsSearchFolderType $searchFolder = null, ?\StructType\EwsTasksFolderType $tasksFolder = null)
77
    {
78
        $this
79
            ->setFolder($folder)
80
            ->setCalendarFolder($calendarFolder)
81
            ->setContactsFolder($contactsFolder)
82
            ->setSearchFolder($searchFolder)
83
            ->setTasksFolder($tasksFolder);
84
    }
85
    /**
86
     * Get Folder value
87
     * @return \StructType\EwsFolderType|null
88
     */
89
    public function getFolder(): ?\StructType\EwsFolderType
90
    {
91
        return isset($this->Folder) ? $this->Folder : null;
92
    }
93
    /**
94
     * This method is responsible for validating the value passed to the setFolder method
95
     * This method is willingly generated in order to preserve the one-line inline validation within the setFolder method
96
     * This has to validate that the property which is being set is the only one among the given choices
97
     * @param mixed $value
98
     * @return string A non-empty message if the values does not match the validation rules
99
     */
100
    public function validateFolderForChoiceConstraintsFromSetFolder($value): string
101
    {
102
        $message = '';
103
        if (is_null($value)) {
104
            return $message;
105
        }
106
        $properties = [
107
            'CalendarFolder',
108
            'ContactsFolder',
109
            'SearchFolder',
110
            'TasksFolder',
111
        ];
112
        try {
113
            foreach ($properties as $property) {
114
                if (isset($this->{$property})) {
115
                    throw new InvalidArgumentException(sprintf('The property Folder can\'t be set as the property %s is already set. Only one property must be set among these properties: Folder, %s.', $property, implode(', ', $properties)), __LINE__);
116
                }
117
            }
118
        } catch (InvalidArgumentException $e) {
119
            $message = $e->getMessage();
120
        }
121
        
122
        return $message;
123
    }
124
    /**
125
     * Set Folder value
126
     * This property belongs to a choice that allows only one property to exist. It is
127
     * therefore removable from the request, consequently if the value assigned to this
128
     * property is null, the property is removed from this object
129
     * @throws InvalidArgumentException
130
     * @param \StructType\EwsFolderType $folder
131
     * @return \StructType\EwsNonEmptyArrayOfFoldersType
132
     */
133
    public function setFolder(?\StructType\EwsFolderType $folder = null): self
134
    {
135
        // validation for constraint: choice(Folder, CalendarFolder, ContactsFolder, SearchFolder, TasksFolder)
136
        if ('' !== ($folderChoiceErrorMessage = self::validateFolderForChoiceConstraintsFromSetFolder($folder))) {
0 ignored issues
show
Bug Best Practice introduced by
The method StructType\EwsNonEmptyAr...straintsFromSetFolder() 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

136
        if ('' !== ($folderChoiceErrorMessage = self::/** @scrutinizer ignore-call */ validateFolderForChoiceConstraintsFromSetFolder($folder))) {
Loading history...
137
            throw new InvalidArgumentException($folderChoiceErrorMessage, __LINE__);
138
        }
139
        if (is_null($folder) || (is_array($folder) && empty($folder))) {
140
            unset($this->Folder);
141
        } else {
142
            $this->Folder = $folder;
143
        }
144
        
145
        return $this;
146
    }
147
    /**
148
     * Get CalendarFolder value
149
     * @return \StructType\EwsCalendarFolderType|null
150
     */
151
    public function getCalendarFolder(): ?\StructType\EwsCalendarFolderType
152
    {
153
        return isset($this->CalendarFolder) ? $this->CalendarFolder : null;
154
    }
155
    /**
156
     * This method is responsible for validating the value passed to the setCalendarFolder method
157
     * This method is willingly generated in order to preserve the one-line inline validation within the setCalendarFolder method
158
     * This has to validate that the property which is being set is the only one among the given choices
159
     * @param mixed $value
160
     * @return string A non-empty message if the values does not match the validation rules
161
     */
162
    public function validateCalendarFolderForChoiceConstraintsFromSetCalendarFolder($value): string
163
    {
164
        $message = '';
165
        if (is_null($value)) {
166
            return $message;
167
        }
168
        $properties = [
169
            'Folder',
170
            'ContactsFolder',
171
            'SearchFolder',
172
            'TasksFolder',
173
        ];
174
        try {
175
            foreach ($properties as $property) {
176
                if (isset($this->{$property})) {
177
                    throw new InvalidArgumentException(sprintf('The property CalendarFolder can\'t be set as the property %s is already set. Only one property must be set among these properties: CalendarFolder, %s.', $property, implode(', ', $properties)), __LINE__);
178
                }
179
            }
180
        } catch (InvalidArgumentException $e) {
181
            $message = $e->getMessage();
182
        }
183
        
184
        return $message;
185
    }
186
    /**
187
     * Set CalendarFolder value
188
     * This property belongs to a choice that allows only one property to exist. It is
189
     * therefore removable from the request, consequently if the value assigned to this
190
     * property is null, the property is removed from this object
191
     * @throws InvalidArgumentException
192
     * @param \StructType\EwsCalendarFolderType $calendarFolder
193
     * @return \StructType\EwsNonEmptyArrayOfFoldersType
194
     */
195
    public function setCalendarFolder(?\StructType\EwsCalendarFolderType $calendarFolder = null): self
196
    {
197
        // validation for constraint: choice(Folder, CalendarFolder, ContactsFolder, SearchFolder, TasksFolder)
198
        if ('' !== ($calendarFolderChoiceErrorMessage = self::validateCalendarFolderForChoiceConstraintsFromSetCalendarFolder($calendarFolder))) {
0 ignored issues
show
Bug Best Practice introduced by
The method StructType\EwsNonEmptyAr...FromSetCalendarFolder() 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

198
        if ('' !== ($calendarFolderChoiceErrorMessage = self::/** @scrutinizer ignore-call */ validateCalendarFolderForChoiceConstraintsFromSetCalendarFolder($calendarFolder))) {
Loading history...
199
            throw new InvalidArgumentException($calendarFolderChoiceErrorMessage, __LINE__);
200
        }
201
        if (is_null($calendarFolder) || (is_array($calendarFolder) && empty($calendarFolder))) {
202
            unset($this->CalendarFolder);
203
        } else {
204
            $this->CalendarFolder = $calendarFolder;
205
        }
206
        
207
        return $this;
208
    }
209
    /**
210
     * Get ContactsFolder value
211
     * @return \StructType\EwsContactsFolderType|null
212
     */
213
    public function getContactsFolder(): ?\StructType\EwsContactsFolderType
214
    {
215
        return isset($this->ContactsFolder) ? $this->ContactsFolder : null;
216
    }
217
    /**
218
     * This method is responsible for validating the value passed to the setContactsFolder method
219
     * This method is willingly generated in order to preserve the one-line inline validation within the setContactsFolder method
220
     * This has to validate that the property which is being set is the only one among the given choices
221
     * @param mixed $value
222
     * @return string A non-empty message if the values does not match the validation rules
223
     */
224
    public function validateContactsFolderForChoiceConstraintsFromSetContactsFolder($value): string
225
    {
226
        $message = '';
227
        if (is_null($value)) {
228
            return $message;
229
        }
230
        $properties = [
231
            'Folder',
232
            'CalendarFolder',
233
            'SearchFolder',
234
            'TasksFolder',
235
        ];
236
        try {
237
            foreach ($properties as $property) {
238
                if (isset($this->{$property})) {
239
                    throw new InvalidArgumentException(sprintf('The property ContactsFolder can\'t be set as the property %s is already set. Only one property must be set among these properties: ContactsFolder, %s.', $property, implode(', ', $properties)), __LINE__);
240
                }
241
            }
242
        } catch (InvalidArgumentException $e) {
243
            $message = $e->getMessage();
244
        }
245
        
246
        return $message;
247
    }
248
    /**
249
     * Set ContactsFolder value
250
     * This property belongs to a choice that allows only one property to exist. It is
251
     * therefore removable from the request, consequently if the value assigned to this
252
     * property is null, the property is removed from this object
253
     * @throws InvalidArgumentException
254
     * @param \StructType\EwsContactsFolderType $contactsFolder
255
     * @return \StructType\EwsNonEmptyArrayOfFoldersType
256
     */
257
    public function setContactsFolder(?\StructType\EwsContactsFolderType $contactsFolder = null): self
258
    {
259
        // validation for constraint: choice(Folder, CalendarFolder, ContactsFolder, SearchFolder, TasksFolder)
260
        if ('' !== ($contactsFolderChoiceErrorMessage = self::validateContactsFolderForChoiceConstraintsFromSetContactsFolder($contactsFolder))) {
0 ignored issues
show
Bug Best Practice introduced by
The method StructType\EwsNonEmptyAr...FromSetContactsFolder() 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

260
        if ('' !== ($contactsFolderChoiceErrorMessage = self::/** @scrutinizer ignore-call */ validateContactsFolderForChoiceConstraintsFromSetContactsFolder($contactsFolder))) {
Loading history...
261
            throw new InvalidArgumentException($contactsFolderChoiceErrorMessage, __LINE__);
262
        }
263
        if (is_null($contactsFolder) || (is_array($contactsFolder) && empty($contactsFolder))) {
264
            unset($this->ContactsFolder);
265
        } else {
266
            $this->ContactsFolder = $contactsFolder;
267
        }
268
        
269
        return $this;
270
    }
271
    /**
272
     * Get SearchFolder value
273
     * @return \StructType\EwsSearchFolderType|null
274
     */
275
    public function getSearchFolder(): ?\StructType\EwsSearchFolderType
276
    {
277
        return isset($this->SearchFolder) ? $this->SearchFolder : null;
278
    }
279
    /**
280
     * This method is responsible for validating the value passed to the setSearchFolder method
281
     * This method is willingly generated in order to preserve the one-line inline validation within the setSearchFolder method
282
     * This has to validate that the property which is being set is the only one among the given choices
283
     * @param mixed $value
284
     * @return string A non-empty message if the values does not match the validation rules
285
     */
286
    public function validateSearchFolderForChoiceConstraintsFromSetSearchFolder($value): string
287
    {
288
        $message = '';
289
        if (is_null($value)) {
290
            return $message;
291
        }
292
        $properties = [
293
            'Folder',
294
            'CalendarFolder',
295
            'ContactsFolder',
296
            'TasksFolder',
297
        ];
298
        try {
299
            foreach ($properties as $property) {
300
                if (isset($this->{$property})) {
301
                    throw new InvalidArgumentException(sprintf('The property SearchFolder can\'t be set as the property %s is already set. Only one property must be set among these properties: SearchFolder, %s.', $property, implode(', ', $properties)), __LINE__);
302
                }
303
            }
304
        } catch (InvalidArgumentException $e) {
305
            $message = $e->getMessage();
306
        }
307
        
308
        return $message;
309
    }
310
    /**
311
     * Set SearchFolder value
312
     * This property belongs to a choice that allows only one property to exist. It is
313
     * therefore removable from the request, consequently if the value assigned to this
314
     * property is null, the property is removed from this object
315
     * @throws InvalidArgumentException
316
     * @param \StructType\EwsSearchFolderType $searchFolder
317
     * @return \StructType\EwsNonEmptyArrayOfFoldersType
318
     */
319
    public function setSearchFolder(?\StructType\EwsSearchFolderType $searchFolder = null): self
320
    {
321
        // validation for constraint: choice(Folder, CalendarFolder, ContactsFolder, SearchFolder, TasksFolder)
322
        if ('' !== ($searchFolderChoiceErrorMessage = self::validateSearchFolderForChoiceConstraintsFromSetSearchFolder($searchFolder))) {
0 ignored issues
show
Bug Best Practice introduced by
The method StructType\EwsNonEmptyAr...tsFromSetSearchFolder() 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

322
        if ('' !== ($searchFolderChoiceErrorMessage = self::/** @scrutinizer ignore-call */ validateSearchFolderForChoiceConstraintsFromSetSearchFolder($searchFolder))) {
Loading history...
323
            throw new InvalidArgumentException($searchFolderChoiceErrorMessage, __LINE__);
324
        }
325
        if (is_null($searchFolder) || (is_array($searchFolder) && empty($searchFolder))) {
326
            unset($this->SearchFolder);
327
        } else {
328
            $this->SearchFolder = $searchFolder;
329
        }
330
        
331
        return $this;
332
    }
333
    /**
334
     * Get TasksFolder value
335
     * @return \StructType\EwsTasksFolderType|null
336
     */
337
    public function getTasksFolder(): ?\StructType\EwsTasksFolderType
338
    {
339
        return isset($this->TasksFolder) ? $this->TasksFolder : null;
340
    }
341
    /**
342
     * This method is responsible for validating the value passed to the setTasksFolder method
343
     * This method is willingly generated in order to preserve the one-line inline validation within the setTasksFolder method
344
     * This has to validate that the property which is being set is the only one among the given choices
345
     * @param mixed $value
346
     * @return string A non-empty message if the values does not match the validation rules
347
     */
348
    public function validateTasksFolderForChoiceConstraintsFromSetTasksFolder($value): string
349
    {
350
        $message = '';
351
        if (is_null($value)) {
352
            return $message;
353
        }
354
        $properties = [
355
            'Folder',
356
            'CalendarFolder',
357
            'ContactsFolder',
358
            'SearchFolder',
359
        ];
360
        try {
361
            foreach ($properties as $property) {
362
                if (isset($this->{$property})) {
363
                    throw new InvalidArgumentException(sprintf('The property TasksFolder can\'t be set as the property %s is already set. Only one property must be set among these properties: TasksFolder, %s.', $property, implode(', ', $properties)), __LINE__);
364
                }
365
            }
366
        } catch (InvalidArgumentException $e) {
367
            $message = $e->getMessage();
368
        }
369
        
370
        return $message;
371
    }
372
    /**
373
     * Set TasksFolder value
374
     * This property belongs to a choice that allows only one property to exist. It is
375
     * therefore removable from the request, consequently if the value assigned to this
376
     * property is null, the property is removed from this object
377
     * @throws InvalidArgumentException
378
     * @param \StructType\EwsTasksFolderType $tasksFolder
379
     * @return \StructType\EwsNonEmptyArrayOfFoldersType
380
     */
381
    public function setTasksFolder(?\StructType\EwsTasksFolderType $tasksFolder = null): self
382
    {
383
        // validation for constraint: choice(Folder, CalendarFolder, ContactsFolder, SearchFolder, TasksFolder)
384
        if ('' !== ($tasksFolderChoiceErrorMessage = self::validateTasksFolderForChoiceConstraintsFromSetTasksFolder($tasksFolder))) {
0 ignored issues
show
Bug Best Practice introduced by
The method StructType\EwsNonEmptyAr...ntsFromSetTasksFolder() 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

384
        if ('' !== ($tasksFolderChoiceErrorMessage = self::/** @scrutinizer ignore-call */ validateTasksFolderForChoiceConstraintsFromSetTasksFolder($tasksFolder))) {
Loading history...
385
            throw new InvalidArgumentException($tasksFolderChoiceErrorMessage, __LINE__);
386
        }
387
        if (is_null($tasksFolder) || (is_array($tasksFolder) && empty($tasksFolder))) {
388
            unset($this->TasksFolder);
389
        } else {
390
            $this->TasksFolder = $tasksFolder;
391
        }
392
        
393
        return $this;
394
    }
395
}
396