| Total Complexity | 99 |
| Total Lines | 698 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
Complex classes like EwsFindItemType 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 EwsFindItemType, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 16 | class EwsFindItemType extends EwsBaseRequestType |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * The Traversal |
||
| 20 | * Meta information extracted from the WSDL |
||
| 21 | * - use: required |
||
| 22 | * @var string |
||
| 23 | */ |
||
| 24 | protected string $Traversal; |
||
| 25 | /** |
||
| 26 | * The ItemShape |
||
| 27 | * @var \StructType\EwsItemResponseShapeType|null |
||
| 28 | */ |
||
| 29 | protected ?\StructType\EwsItemResponseShapeType $ItemShape = null; |
||
| 30 | /** |
||
| 31 | * The IndexedPageItemView |
||
| 32 | * Meta information extracted from the WSDL |
||
| 33 | * - choice: IndexedPageItemView | FractionalPageItemView | SeekToConditionPageItemView | CalendarView | ContactsView |
||
| 34 | * - choiceMaxOccurs: 1 |
||
| 35 | * - choiceMinOccurs: 0 |
||
| 36 | * @var \StructType\EwsIndexedPageViewType|null |
||
| 37 | */ |
||
| 38 | protected ?\StructType\EwsIndexedPageViewType $IndexedPageItemView = null; |
||
| 39 | /** |
||
| 40 | * The FractionalPageItemView |
||
| 41 | * Meta information extracted from the WSDL |
||
| 42 | * - choice: IndexedPageItemView | FractionalPageItemView | SeekToConditionPageItemView | CalendarView | ContactsView |
||
| 43 | * - choiceMaxOccurs: 1 |
||
| 44 | * - choiceMinOccurs: 0 |
||
| 45 | * @var \StructType\EwsFractionalPageViewType|null |
||
| 46 | */ |
||
| 47 | protected ?\StructType\EwsFractionalPageViewType $FractionalPageItemView = null; |
||
| 48 | /** |
||
| 49 | * The SeekToConditionPageItemView |
||
| 50 | * Meta information extracted from the WSDL |
||
| 51 | * - choice: IndexedPageItemView | FractionalPageItemView | SeekToConditionPageItemView | CalendarView | ContactsView |
||
| 52 | * - choiceMaxOccurs: 1 |
||
| 53 | * - choiceMinOccurs: 0 |
||
| 54 | * @var \StructType\EwsSeekToConditionPageViewType|null |
||
| 55 | */ |
||
| 56 | protected ?\StructType\EwsSeekToConditionPageViewType $SeekToConditionPageItemView = null; |
||
| 57 | /** |
||
| 58 | * The CalendarView |
||
| 59 | * Meta information extracted from the WSDL |
||
| 60 | * - choice: IndexedPageItemView | FractionalPageItemView | SeekToConditionPageItemView | CalendarView | ContactsView |
||
| 61 | * - choiceMaxOccurs: 1 |
||
| 62 | * - choiceMinOccurs: 0 |
||
| 63 | * @var \StructType\EwsCalendarViewType|null |
||
| 64 | */ |
||
| 65 | protected ?\StructType\EwsCalendarViewType $CalendarView = null; |
||
| 66 | /** |
||
| 67 | * The ContactsView |
||
| 68 | * Meta information extracted from the WSDL |
||
| 69 | * - choice: IndexedPageItemView | FractionalPageItemView | SeekToConditionPageItemView | CalendarView | ContactsView |
||
| 70 | * - choiceMaxOccurs: 1 |
||
| 71 | * - choiceMinOccurs: 0 |
||
| 72 | * @var \StructType\EwsContactsViewType|null |
||
| 73 | */ |
||
| 74 | protected ?\StructType\EwsContactsViewType $ContactsView = null; |
||
| 75 | /** |
||
| 76 | * The GroupBy |
||
| 77 | * Meta information extracted from the WSDL |
||
| 78 | * - choice: GroupBy | DistinguishedGroupBy |
||
| 79 | * - choiceMaxOccurs: 1 |
||
| 80 | * - choiceMinOccurs: 0 |
||
| 81 | * @var \StructType\EwsGroupByType|null |
||
| 82 | */ |
||
| 83 | protected ?\StructType\EwsGroupByType $GroupBy = null; |
||
| 84 | /** |
||
| 85 | * The DistinguishedGroupBy |
||
| 86 | * Meta information extracted from the WSDL |
||
| 87 | * - choice: GroupBy | DistinguishedGroupBy |
||
| 88 | * - choiceMaxOccurs: 1 |
||
| 89 | * - choiceMinOccurs: 0 |
||
| 90 | * @var \StructType\EwsDistinguishedGroupByType|null |
||
| 91 | */ |
||
| 92 | protected ?\StructType\EwsDistinguishedGroupByType $DistinguishedGroupBy = null; |
||
| 93 | /** |
||
| 94 | * The Restriction |
||
| 95 | * Meta information extracted from the WSDL |
||
| 96 | * - minOccurs: 0 |
||
| 97 | * @var \StructType\EwsRestrictionType|null |
||
| 98 | */ |
||
| 99 | protected ?\StructType\EwsRestrictionType $Restriction = null; |
||
| 100 | /** |
||
| 101 | * The SortOrder |
||
| 102 | * Meta information extracted from the WSDL |
||
| 103 | * - minOccurs: 0 |
||
| 104 | * @var \ArrayType\EwsNonEmptyArrayOfFieldOrdersType|null |
||
| 105 | */ |
||
| 106 | protected ?\ArrayType\EwsNonEmptyArrayOfFieldOrdersType $SortOrder = null; |
||
| 107 | /** |
||
| 108 | * The ParentFolderIds |
||
| 109 | * @var \StructType\EwsNonEmptyArrayOfBaseFolderIdsType|null |
||
| 110 | */ |
||
| 111 | protected ?\StructType\EwsNonEmptyArrayOfBaseFolderIdsType $ParentFolderIds = null; |
||
| 112 | /** |
||
| 113 | * The QueryString |
||
| 114 | * Meta information extracted from the WSDL |
||
| 115 | * - maxOccurs: 1 |
||
| 116 | * - minOccurs: 0 |
||
| 117 | * @var \StructType\EwsQueryStringType|null |
||
| 118 | */ |
||
| 119 | protected ?\StructType\EwsQueryStringType $QueryString = null; |
||
| 120 | /** |
||
| 121 | * Constructor method for FindItemType |
||
| 122 | * @uses EwsFindItemType::setTraversal() |
||
| 123 | * @uses EwsFindItemType::setItemShape() |
||
| 124 | * @uses EwsFindItemType::setIndexedPageItemView() |
||
| 125 | * @uses EwsFindItemType::setFractionalPageItemView() |
||
| 126 | * @uses EwsFindItemType::setSeekToConditionPageItemView() |
||
| 127 | * @uses EwsFindItemType::setCalendarView() |
||
| 128 | * @uses EwsFindItemType::setContactsView() |
||
| 129 | * @uses EwsFindItemType::setGroupBy() |
||
| 130 | * @uses EwsFindItemType::setDistinguishedGroupBy() |
||
| 131 | * @uses EwsFindItemType::setRestriction() |
||
| 132 | * @uses EwsFindItemType::setSortOrder() |
||
| 133 | * @uses EwsFindItemType::setParentFolderIds() |
||
| 134 | * @uses EwsFindItemType::setQueryString() |
||
| 135 | * @param string $traversal |
||
| 136 | * @param \StructType\EwsItemResponseShapeType $itemShape |
||
| 137 | * @param \StructType\EwsIndexedPageViewType $indexedPageItemView |
||
| 138 | * @param \StructType\EwsFractionalPageViewType $fractionalPageItemView |
||
| 139 | * @param \StructType\EwsSeekToConditionPageViewType $seekToConditionPageItemView |
||
| 140 | * @param \StructType\EwsCalendarViewType $calendarView |
||
| 141 | * @param \StructType\EwsContactsViewType $contactsView |
||
| 142 | * @param \StructType\EwsGroupByType $groupBy |
||
| 143 | * @param \StructType\EwsDistinguishedGroupByType $distinguishedGroupBy |
||
| 144 | * @param \StructType\EwsRestrictionType $restriction |
||
| 145 | * @param \ArrayType\EwsNonEmptyArrayOfFieldOrdersType $sortOrder |
||
| 146 | * @param \StructType\EwsNonEmptyArrayOfBaseFolderIdsType $parentFolderIds |
||
| 147 | * @param \StructType\EwsQueryStringType $queryString |
||
| 148 | */ |
||
| 149 | public function __construct(string $traversal, ?\StructType\EwsItemResponseShapeType $itemShape = null, ?\StructType\EwsIndexedPageViewType $indexedPageItemView = null, ?\StructType\EwsFractionalPageViewType $fractionalPageItemView = null, ?\StructType\EwsSeekToConditionPageViewType $seekToConditionPageItemView = null, ?\StructType\EwsCalendarViewType $calendarView = null, ?\StructType\EwsContactsViewType $contactsView = null, ?\StructType\EwsGroupByType $groupBy = null, ?\StructType\EwsDistinguishedGroupByType $distinguishedGroupBy = null, ?\StructType\EwsRestrictionType $restriction = null, ?\ArrayType\EwsNonEmptyArrayOfFieldOrdersType $sortOrder = null, ?\StructType\EwsNonEmptyArrayOfBaseFolderIdsType $parentFolderIds = null, ?\StructType\EwsQueryStringType $queryString = null) |
||
| 150 | { |
||
| 151 | $this |
||
| 152 | ->setTraversal($traversal) |
||
| 153 | ->setItemShape($itemShape) |
||
| 154 | ->setIndexedPageItemView($indexedPageItemView) |
||
| 155 | ->setFractionalPageItemView($fractionalPageItemView) |
||
| 156 | ->setSeekToConditionPageItemView($seekToConditionPageItemView) |
||
| 157 | ->setCalendarView($calendarView) |
||
| 158 | ->setContactsView($contactsView) |
||
| 159 | ->setGroupBy($groupBy) |
||
| 160 | ->setDistinguishedGroupBy($distinguishedGroupBy) |
||
| 161 | ->setRestriction($restriction) |
||
| 162 | ->setSortOrder($sortOrder) |
||
| 163 | ->setParentFolderIds($parentFolderIds) |
||
| 164 | ->setQueryString($queryString); |
||
| 165 | } |
||
| 166 | /** |
||
| 167 | * Get Traversal value |
||
| 168 | * @return string |
||
| 169 | */ |
||
| 170 | public function getTraversal(): string |
||
| 171 | { |
||
| 172 | return $this->Traversal; |
||
| 173 | } |
||
| 174 | /** |
||
| 175 | * Set Traversal value |
||
| 176 | * @uses \EnumType\EwsItemQueryTraversalType::valueIsValid() |
||
| 177 | * @uses \EnumType\EwsItemQueryTraversalType::getValidValues() |
||
| 178 | * @throws InvalidArgumentException |
||
| 179 | * @param string $traversal |
||
| 180 | * @return \StructType\EwsFindItemType |
||
| 181 | */ |
||
| 182 | public function setTraversal(string $traversal): self |
||
| 183 | { |
||
| 184 | // validation for constraint: enumeration |
||
| 185 | if (!\EnumType\EwsItemQueryTraversalType::valueIsValid($traversal)) { |
||
| 186 | throw new InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \EnumType\EwsItemQueryTraversalType', is_array($traversal) ? implode(', ', $traversal) : var_export($traversal, true), implode(', ', \EnumType\EwsItemQueryTraversalType::getValidValues())), __LINE__); |
||
|
|
|||
| 187 | } |
||
| 188 | $this->Traversal = $traversal; |
||
| 189 | |||
| 190 | return $this; |
||
| 191 | } |
||
| 192 | /** |
||
| 193 | * Get ItemShape value |
||
| 194 | * @return \StructType\EwsItemResponseShapeType|null |
||
| 195 | */ |
||
| 196 | public function getItemShape(): ?\StructType\EwsItemResponseShapeType |
||
| 197 | { |
||
| 198 | return $this->ItemShape; |
||
| 199 | } |
||
| 200 | /** |
||
| 201 | * Set ItemShape value |
||
| 202 | * @param \StructType\EwsItemResponseShapeType $itemShape |
||
| 203 | * @return \StructType\EwsFindItemType |
||
| 204 | */ |
||
| 205 | public function setItemShape(?\StructType\EwsItemResponseShapeType $itemShape = null): self |
||
| 206 | { |
||
| 207 | $this->ItemShape = $itemShape; |
||
| 208 | |||
| 209 | return $this; |
||
| 210 | } |
||
| 211 | /** |
||
| 212 | * Get IndexedPageItemView value |
||
| 213 | * @return \StructType\EwsIndexedPageViewType|null |
||
| 214 | */ |
||
| 215 | public function getIndexedPageItemView(): ?\StructType\EwsIndexedPageViewType |
||
| 216 | { |
||
| 217 | return isset($this->IndexedPageItemView) ? $this->IndexedPageItemView : null; |
||
| 218 | } |
||
| 219 | /** |
||
| 220 | * This method is responsible for validating the value passed to the setIndexedPageItemView method |
||
| 221 | * This method is willingly generated in order to preserve the one-line inline validation within the setIndexedPageItemView method |
||
| 222 | * This has to validate that the property which is being set is the only one among the given choices |
||
| 223 | * @param mixed $value |
||
| 224 | * @return string A non-empty message if the values does not match the validation rules |
||
| 225 | */ |
||
| 226 | public function validateIndexedPageItemViewForChoiceConstraintsFromSetIndexedPageItemView($value): string |
||
| 249 | } |
||
| 250 | /** |
||
| 251 | * Set IndexedPageItemView value |
||
| 252 | * This property belongs to a choice that allows only one property to exist. It is |
||
| 253 | * therefore removable from the request, consequently if the value assigned to this |
||
| 254 | * property is null, the property is removed from this object |
||
| 255 | * @throws InvalidArgumentException |
||
| 256 | * @param \StructType\EwsIndexedPageViewType $indexedPageItemView |
||
| 257 | * @return \StructType\EwsFindItemType |
||
| 258 | */ |
||
| 259 | public function setIndexedPageItemView(?\StructType\EwsIndexedPageViewType $indexedPageItemView = null): self |
||
| 260 | { |
||
| 261 | // validation for constraint: choice(IndexedPageItemView, FractionalPageItemView, SeekToConditionPageItemView, CalendarView, ContactsView) |
||
| 262 | if ('' !== ($indexedPageItemViewChoiceErrorMessage = self::validateIndexedPageItemViewForChoiceConstraintsFromSetIndexedPageItemView($indexedPageItemView))) { |
||
| 263 | throw new InvalidArgumentException($indexedPageItemViewChoiceErrorMessage, __LINE__); |
||
| 264 | } |
||
| 265 | if (is_null($indexedPageItemView) || (is_array($indexedPageItemView) && empty($indexedPageItemView))) { |
||
| 266 | unset($this->IndexedPageItemView); |
||
| 267 | } else { |
||
| 268 | $this->IndexedPageItemView = $indexedPageItemView; |
||
| 269 | } |
||
| 270 | |||
| 271 | return $this; |
||
| 272 | } |
||
| 273 | /** |
||
| 274 | * Get FractionalPageItemView value |
||
| 275 | * @return \StructType\EwsFractionalPageViewType|null |
||
| 276 | */ |
||
| 277 | public function getFractionalPageItemView(): ?\StructType\EwsFractionalPageViewType |
||
| 278 | { |
||
| 279 | return isset($this->FractionalPageItemView) ? $this->FractionalPageItemView : null; |
||
| 280 | } |
||
| 281 | /** |
||
| 282 | * This method is responsible for validating the value passed to the setFractionalPageItemView method |
||
| 283 | * This method is willingly generated in order to preserve the one-line inline validation within the setFractionalPageItemView method |
||
| 284 | * This has to validate that the property which is being set is the only one among the given choices |
||
| 285 | * @param mixed $value |
||
| 286 | * @return string A non-empty message if the values does not match the validation rules |
||
| 287 | */ |
||
| 288 | public function validateFractionalPageItemViewForChoiceConstraintsFromSetFractionalPageItemView($value): string |
||
| 311 | } |
||
| 312 | /** |
||
| 313 | * Set FractionalPageItemView 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\EwsFractionalPageViewType $fractionalPageItemView |
||
| 319 | * @return \StructType\EwsFindItemType |
||
| 320 | */ |
||
| 321 | public function setFractionalPageItemView(?\StructType\EwsFractionalPageViewType $fractionalPageItemView = null): self |
||
| 322 | { |
||
| 323 | // validation for constraint: choice(IndexedPageItemView, FractionalPageItemView, SeekToConditionPageItemView, CalendarView, ContactsView) |
||
| 324 | if ('' !== ($fractionalPageItemViewChoiceErrorMessage = self::validateFractionalPageItemViewForChoiceConstraintsFromSetFractionalPageItemView($fractionalPageItemView))) { |
||
| 325 | throw new InvalidArgumentException($fractionalPageItemViewChoiceErrorMessage, __LINE__); |
||
| 326 | } |
||
| 327 | if (is_null($fractionalPageItemView) || (is_array($fractionalPageItemView) && empty($fractionalPageItemView))) { |
||
| 328 | unset($this->FractionalPageItemView); |
||
| 329 | } else { |
||
| 330 | $this->FractionalPageItemView = $fractionalPageItemView; |
||
| 331 | } |
||
| 332 | |||
| 333 | return $this; |
||
| 334 | } |
||
| 335 | /** |
||
| 336 | * Get SeekToConditionPageItemView value |
||
| 337 | * @return \StructType\EwsSeekToConditionPageViewType|null |
||
| 338 | */ |
||
| 339 | public function getSeekToConditionPageItemView(): ?\StructType\EwsSeekToConditionPageViewType |
||
| 340 | { |
||
| 341 | return isset($this->SeekToConditionPageItemView) ? $this->SeekToConditionPageItemView : null; |
||
| 342 | } |
||
| 343 | /** |
||
| 344 | * This method is responsible for validating the value passed to the setSeekToConditionPageItemView method |
||
| 345 | * This method is willingly generated in order to preserve the one-line inline validation within the setSeekToConditionPageItemView 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 validateSeekToConditionPageItemViewForChoiceConstraintsFromSetSeekToConditionPageItemView($value): string |
||
| 351 | { |
||
| 352 | $message = ''; |
||
| 353 | if (is_null($value)) { |
||
| 354 | return $message; |
||
| 355 | } |
||
| 356 | $properties = [ |
||
| 357 | 'IndexedPageItemView', |
||
| 358 | 'FractionalPageItemView', |
||
| 359 | 'CalendarView', |
||
| 360 | 'ContactsView', |
||
| 361 | ]; |
||
| 362 | try { |
||
| 363 | foreach ($properties as $property) { |
||
| 364 | if (isset($this->{$property})) { |
||
| 365 | throw new InvalidArgumentException(sprintf('The property SeekToConditionPageItemView can\'t be set as the property %s is already set. Only one property must be set among these properties: SeekToConditionPageItemView, %s.', $property, implode(', ', $properties)), __LINE__); |
||
| 366 | } |
||
| 367 | } |
||
| 368 | } catch (InvalidArgumentException $e) { |
||
| 369 | $message = $e->getMessage(); |
||
| 370 | } |
||
| 371 | |||
| 372 | return $message; |
||
| 373 | } |
||
| 374 | /** |
||
| 375 | * Set SeekToConditionPageItemView value |
||
| 376 | * This property belongs to a choice that allows only one property to exist. It is |
||
| 377 | * therefore removable from the request, consequently if the value assigned to this |
||
| 378 | * property is null, the property is removed from this object |
||
| 379 | * @throws InvalidArgumentException |
||
| 380 | * @param \StructType\EwsSeekToConditionPageViewType $seekToConditionPageItemView |
||
| 381 | * @return \StructType\EwsFindItemType |
||
| 382 | */ |
||
| 383 | public function setSeekToConditionPageItemView(?\StructType\EwsSeekToConditionPageViewType $seekToConditionPageItemView = null): self |
||
| 384 | { |
||
| 385 | // validation for constraint: choice(IndexedPageItemView, FractionalPageItemView, SeekToConditionPageItemView, CalendarView, ContactsView) |
||
| 386 | if ('' !== ($seekToConditionPageItemViewChoiceErrorMessage = self::validateSeekToConditionPageItemViewForChoiceConstraintsFromSetSeekToConditionPageItemView($seekToConditionPageItemView))) { |
||
| 387 | throw new InvalidArgumentException($seekToConditionPageItemViewChoiceErrorMessage, __LINE__); |
||
| 388 | } |
||
| 389 | if (is_null($seekToConditionPageItemView) || (is_array($seekToConditionPageItemView) && empty($seekToConditionPageItemView))) { |
||
| 390 | unset($this->SeekToConditionPageItemView); |
||
| 391 | } else { |
||
| 392 | $this->SeekToConditionPageItemView = $seekToConditionPageItemView; |
||
| 393 | } |
||
| 394 | |||
| 395 | return $this; |
||
| 396 | } |
||
| 397 | /** |
||
| 398 | * Get CalendarView value |
||
| 399 | * @return \StructType\EwsCalendarViewType|null |
||
| 400 | */ |
||
| 401 | public function getCalendarView(): ?\StructType\EwsCalendarViewType |
||
| 402 | { |
||
| 403 | return isset($this->CalendarView) ? $this->CalendarView : null; |
||
| 404 | } |
||
| 405 | /** |
||
| 406 | * This method is responsible for validating the value passed to the setCalendarView method |
||
| 407 | * This method is willingly generated in order to preserve the one-line inline validation within the setCalendarView method |
||
| 408 | * This has to validate that the property which is being set is the only one among the given choices |
||
| 409 | * @param mixed $value |
||
| 410 | * @return string A non-empty message if the values does not match the validation rules |
||
| 411 | */ |
||
| 412 | public function validateCalendarViewForChoiceConstraintsFromSetCalendarView($value): string |
||
| 413 | { |
||
| 414 | $message = ''; |
||
| 415 | if (is_null($value)) { |
||
| 416 | return $message; |
||
| 417 | } |
||
| 418 | $properties = [ |
||
| 419 | 'IndexedPageItemView', |
||
| 420 | 'FractionalPageItemView', |
||
| 421 | 'SeekToConditionPageItemView', |
||
| 422 | 'ContactsView', |
||
| 423 | ]; |
||
| 424 | try { |
||
| 425 | foreach ($properties as $property) { |
||
| 426 | if (isset($this->{$property})) { |
||
| 427 | throw new InvalidArgumentException(sprintf('The property CalendarView can\'t be set as the property %s is already set. Only one property must be set among these properties: CalendarView, %s.', $property, implode(', ', $properties)), __LINE__); |
||
| 428 | } |
||
| 429 | } |
||
| 430 | } catch (InvalidArgumentException $e) { |
||
| 431 | $message = $e->getMessage(); |
||
| 432 | } |
||
| 433 | |||
| 434 | return $message; |
||
| 435 | } |
||
| 436 | /** |
||
| 437 | * Set CalendarView value |
||
| 438 | * This property belongs to a choice that allows only one property to exist. It is |
||
| 439 | * therefore removable from the request, consequently if the value assigned to this |
||
| 440 | * property is null, the property is removed from this object |
||
| 441 | * @throws InvalidArgumentException |
||
| 442 | * @param \StructType\EwsCalendarViewType $calendarView |
||
| 443 | * @return \StructType\EwsFindItemType |
||
| 444 | */ |
||
| 445 | public function setCalendarView(?\StructType\EwsCalendarViewType $calendarView = null): self |
||
| 446 | { |
||
| 447 | // validation for constraint: choice(IndexedPageItemView, FractionalPageItemView, SeekToConditionPageItemView, CalendarView, ContactsView) |
||
| 448 | if ('' !== ($calendarViewChoiceErrorMessage = self::validateCalendarViewForChoiceConstraintsFromSetCalendarView($calendarView))) { |
||
| 449 | throw new InvalidArgumentException($calendarViewChoiceErrorMessage, __LINE__); |
||
| 450 | } |
||
| 451 | if (is_null($calendarView) || (is_array($calendarView) && empty($calendarView))) { |
||
| 452 | unset($this->CalendarView); |
||
| 453 | } else { |
||
| 454 | $this->CalendarView = $calendarView; |
||
| 455 | } |
||
| 456 | |||
| 457 | return $this; |
||
| 458 | } |
||
| 459 | /** |
||
| 460 | * Get ContactsView value |
||
| 461 | * @return \StructType\EwsContactsViewType|null |
||
| 462 | */ |
||
| 463 | public function getContactsView(): ?\StructType\EwsContactsViewType |
||
| 464 | { |
||
| 465 | return isset($this->ContactsView) ? $this->ContactsView : null; |
||
| 466 | } |
||
| 467 | /** |
||
| 468 | * This method is responsible for validating the value passed to the setContactsView method |
||
| 469 | * This method is willingly generated in order to preserve the one-line inline validation within the setContactsView method |
||
| 470 | * This has to validate that the property which is being set is the only one among the given choices |
||
| 471 | * @param mixed $value |
||
| 472 | * @return string A non-empty message if the values does not match the validation rules |
||
| 473 | */ |
||
| 474 | public function validateContactsViewForChoiceConstraintsFromSetContactsView($value): string |
||
| 475 | { |
||
| 476 | $message = ''; |
||
| 477 | if (is_null($value)) { |
||
| 478 | return $message; |
||
| 479 | } |
||
| 480 | $properties = [ |
||
| 481 | 'IndexedPageItemView', |
||
| 482 | 'FractionalPageItemView', |
||
| 483 | 'SeekToConditionPageItemView', |
||
| 484 | 'CalendarView', |
||
| 485 | ]; |
||
| 486 | try { |
||
| 487 | foreach ($properties as $property) { |
||
| 488 | if (isset($this->{$property})) { |
||
| 489 | throw new InvalidArgumentException(sprintf('The property ContactsView can\'t be set as the property %s is already set. Only one property must be set among these properties: ContactsView, %s.', $property, implode(', ', $properties)), __LINE__); |
||
| 490 | } |
||
| 491 | } |
||
| 492 | } catch (InvalidArgumentException $e) { |
||
| 493 | $message = $e->getMessage(); |
||
| 494 | } |
||
| 495 | |||
| 496 | return $message; |
||
| 497 | } |
||
| 498 | /** |
||
| 499 | * Set ContactsView value |
||
| 500 | * This property belongs to a choice that allows only one property to exist. It is |
||
| 501 | * therefore removable from the request, consequently if the value assigned to this |
||
| 502 | * property is null, the property is removed from this object |
||
| 503 | * @throws InvalidArgumentException |
||
| 504 | * @param \StructType\EwsContactsViewType $contactsView |
||
| 505 | * @return \StructType\EwsFindItemType |
||
| 506 | */ |
||
| 507 | public function setContactsView(?\StructType\EwsContactsViewType $contactsView = null): self |
||
| 508 | { |
||
| 509 | // validation for constraint: choice(IndexedPageItemView, FractionalPageItemView, SeekToConditionPageItemView, CalendarView, ContactsView) |
||
| 510 | if ('' !== ($contactsViewChoiceErrorMessage = self::validateContactsViewForChoiceConstraintsFromSetContactsView($contactsView))) { |
||
| 511 | throw new InvalidArgumentException($contactsViewChoiceErrorMessage, __LINE__); |
||
| 512 | } |
||
| 513 | if (is_null($contactsView) || (is_array($contactsView) && empty($contactsView))) { |
||
| 514 | unset($this->ContactsView); |
||
| 515 | } else { |
||
| 516 | $this->ContactsView = $contactsView; |
||
| 517 | } |
||
| 518 | |||
| 519 | return $this; |
||
| 520 | } |
||
| 521 | /** |
||
| 522 | * Get GroupBy value |
||
| 523 | * @return \StructType\EwsGroupByType|null |
||
| 524 | */ |
||
| 525 | public function getGroupBy(): ?\StructType\EwsGroupByType |
||
| 526 | { |
||
| 527 | return isset($this->GroupBy) ? $this->GroupBy : null; |
||
| 528 | } |
||
| 529 | /** |
||
| 530 | * This method is responsible for validating the value passed to the setGroupBy method |
||
| 531 | * This method is willingly generated in order to preserve the one-line inline validation within the setGroupBy method |
||
| 532 | * This has to validate that the property which is being set is the only one among the given choices |
||
| 533 | * @param mixed $value |
||
| 534 | * @return string A non-empty message if the values does not match the validation rules |
||
| 535 | */ |
||
| 536 | public function validateGroupByForChoiceConstraintsFromSetGroupBy($value): string |
||
| 537 | { |
||
| 538 | $message = ''; |
||
| 539 | if (is_null($value)) { |
||
| 540 | return $message; |
||
| 541 | } |
||
| 542 | $properties = [ |
||
| 543 | 'DistinguishedGroupBy', |
||
| 544 | ]; |
||
| 545 | try { |
||
| 546 | foreach ($properties as $property) { |
||
| 547 | if (isset($this->{$property})) { |
||
| 548 | throw new InvalidArgumentException(sprintf('The property GroupBy can\'t be set as the property %s is already set. Only one property must be set among these properties: GroupBy, %s.', $property, implode(', ', $properties)), __LINE__); |
||
| 549 | } |
||
| 550 | } |
||
| 551 | } catch (InvalidArgumentException $e) { |
||
| 552 | $message = $e->getMessage(); |
||
| 553 | } |
||
| 554 | |||
| 555 | return $message; |
||
| 556 | } |
||
| 557 | /** |
||
| 558 | * Set GroupBy value |
||
| 559 | * This property belongs to a choice that allows only one property to exist. It is |
||
| 560 | * therefore removable from the request, consequently if the value assigned to this |
||
| 561 | * property is null, the property is removed from this object |
||
| 562 | * @throws InvalidArgumentException |
||
| 563 | * @param \StructType\EwsGroupByType $groupBy |
||
| 564 | * @return \StructType\EwsFindItemType |
||
| 565 | */ |
||
| 566 | public function setGroupBy(?\StructType\EwsGroupByType $groupBy = null): self |
||
| 567 | { |
||
| 568 | // validation for constraint: choice(GroupBy, DistinguishedGroupBy) |
||
| 569 | if ('' !== ($groupByChoiceErrorMessage = self::validateGroupByForChoiceConstraintsFromSetGroupBy($groupBy))) { |
||
| 570 | throw new InvalidArgumentException($groupByChoiceErrorMessage, __LINE__); |
||
| 571 | } |
||
| 572 | if (is_null($groupBy) || (is_array($groupBy) && empty($groupBy))) { |
||
| 573 | unset($this->GroupBy); |
||
| 574 | } else { |
||
| 575 | $this->GroupBy = $groupBy; |
||
| 576 | } |
||
| 577 | |||
| 578 | return $this; |
||
| 579 | } |
||
| 580 | /** |
||
| 581 | * Get DistinguishedGroupBy value |
||
| 582 | * @return \StructType\EwsDistinguishedGroupByType|null |
||
| 583 | */ |
||
| 584 | public function getDistinguishedGroupBy(): ?\StructType\EwsDistinguishedGroupByType |
||
| 585 | { |
||
| 586 | return isset($this->DistinguishedGroupBy) ? $this->DistinguishedGroupBy : null; |
||
| 587 | } |
||
| 588 | /** |
||
| 589 | * This method is responsible for validating the value passed to the setDistinguishedGroupBy method |
||
| 590 | * This method is willingly generated in order to preserve the one-line inline validation within the setDistinguishedGroupBy method |
||
| 591 | * This has to validate that the property which is being set is the only one among the given choices |
||
| 592 | * @param mixed $value |
||
| 593 | * @return string A non-empty message if the values does not match the validation rules |
||
| 594 | */ |
||
| 595 | public function validateDistinguishedGroupByForChoiceConstraintsFromSetDistinguishedGroupBy($value): string |
||
| 596 | { |
||
| 597 | $message = ''; |
||
| 598 | if (is_null($value)) { |
||
| 599 | return $message; |
||
| 600 | } |
||
| 601 | $properties = [ |
||
| 602 | 'GroupBy', |
||
| 603 | ]; |
||
| 604 | try { |
||
| 605 | foreach ($properties as $property) { |
||
| 606 | if (isset($this->{$property})) { |
||
| 607 | throw new InvalidArgumentException(sprintf('The property DistinguishedGroupBy can\'t be set as the property %s is already set. Only one property must be set among these properties: DistinguishedGroupBy, %s.', $property, implode(', ', $properties)), __LINE__); |
||
| 608 | } |
||
| 609 | } |
||
| 610 | } catch (InvalidArgumentException $e) { |
||
| 611 | $message = $e->getMessage(); |
||
| 612 | } |
||
| 613 | |||
| 614 | return $message; |
||
| 615 | } |
||
| 616 | /** |
||
| 617 | * Set DistinguishedGroupBy value |
||
| 618 | * This property belongs to a choice that allows only one property to exist. It is |
||
| 619 | * therefore removable from the request, consequently if the value assigned to this |
||
| 620 | * property is null, the property is removed from this object |
||
| 621 | * @throws InvalidArgumentException |
||
| 622 | * @param \StructType\EwsDistinguishedGroupByType $distinguishedGroupBy |
||
| 623 | * @return \StructType\EwsFindItemType |
||
| 624 | */ |
||
| 625 | public function setDistinguishedGroupBy(?\StructType\EwsDistinguishedGroupByType $distinguishedGroupBy = null): self |
||
| 626 | { |
||
| 627 | // validation for constraint: choice(GroupBy, DistinguishedGroupBy) |
||
| 628 | if ('' !== ($distinguishedGroupByChoiceErrorMessage = self::validateDistinguishedGroupByForChoiceConstraintsFromSetDistinguishedGroupBy($distinguishedGroupBy))) { |
||
| 629 | throw new InvalidArgumentException($distinguishedGroupByChoiceErrorMessage, __LINE__); |
||
| 630 | } |
||
| 631 | if (is_null($distinguishedGroupBy) || (is_array($distinguishedGroupBy) && empty($distinguishedGroupBy))) { |
||
| 632 | unset($this->DistinguishedGroupBy); |
||
| 633 | } else { |
||
| 634 | $this->DistinguishedGroupBy = $distinguishedGroupBy; |
||
| 635 | } |
||
| 636 | |||
| 637 | return $this; |
||
| 638 | } |
||
| 639 | /** |
||
| 640 | * Get Restriction value |
||
| 641 | * @return \StructType\EwsRestrictionType|null |
||
| 642 | */ |
||
| 643 | public function getRestriction(): ?\StructType\EwsRestrictionType |
||
| 644 | { |
||
| 645 | return $this->Restriction; |
||
| 646 | } |
||
| 647 | /** |
||
| 648 | * Set Restriction value |
||
| 649 | * @param \StructType\EwsRestrictionType $restriction |
||
| 650 | * @return \StructType\EwsFindItemType |
||
| 651 | */ |
||
| 652 | public function setRestriction(?\StructType\EwsRestrictionType $restriction = null): self |
||
| 653 | { |
||
| 654 | $this->Restriction = $restriction; |
||
| 655 | |||
| 656 | return $this; |
||
| 657 | } |
||
| 658 | /** |
||
| 659 | * Get SortOrder value |
||
| 660 | * @return \ArrayType\EwsNonEmptyArrayOfFieldOrdersType|null |
||
| 661 | */ |
||
| 662 | public function getSortOrder(): ?\ArrayType\EwsNonEmptyArrayOfFieldOrdersType |
||
| 663 | { |
||
| 664 | return $this->SortOrder; |
||
| 665 | } |
||
| 666 | /** |
||
| 667 | * Set SortOrder value |
||
| 668 | * @param \ArrayType\EwsNonEmptyArrayOfFieldOrdersType $sortOrder |
||
| 669 | * @return \StructType\EwsFindItemType |
||
| 670 | */ |
||
| 671 | public function setSortOrder(?\ArrayType\EwsNonEmptyArrayOfFieldOrdersType $sortOrder = null): self |
||
| 672 | { |
||
| 673 | $this->SortOrder = $sortOrder; |
||
| 674 | |||
| 675 | return $this; |
||
| 676 | } |
||
| 677 | /** |
||
| 678 | * Get ParentFolderIds value |
||
| 679 | * @return \StructType\EwsNonEmptyArrayOfBaseFolderIdsType|null |
||
| 680 | */ |
||
| 681 | public function getParentFolderIds(): ?\StructType\EwsNonEmptyArrayOfBaseFolderIdsType |
||
| 682 | { |
||
| 683 | return $this->ParentFolderIds; |
||
| 684 | } |
||
| 685 | /** |
||
| 686 | * Set ParentFolderIds value |
||
| 687 | * @param \StructType\EwsNonEmptyArrayOfBaseFolderIdsType $parentFolderIds |
||
| 688 | * @return \StructType\EwsFindItemType |
||
| 689 | */ |
||
| 690 | public function setParentFolderIds(?\StructType\EwsNonEmptyArrayOfBaseFolderIdsType $parentFolderIds = null): self |
||
| 691 | { |
||
| 692 | $this->ParentFolderIds = $parentFolderIds; |
||
| 693 | |||
| 694 | return $this; |
||
| 695 | } |
||
| 696 | /** |
||
| 697 | * Get QueryString value |
||
| 698 | * @return \StructType\EwsQueryStringType|null |
||
| 699 | */ |
||
| 700 | public function getQueryString(): ?\StructType\EwsQueryStringType |
||
| 701 | { |
||
| 702 | return $this->QueryString; |
||
| 703 | } |
||
| 704 | /** |
||
| 705 | * Set QueryString value |
||
| 706 | * @param \StructType\EwsQueryStringType $queryString |
||
| 707 | * @return \StructType\EwsFindItemType |
||
| 708 | */ |
||
| 709 | public function setQueryString(?\StructType\EwsQueryStringType $queryString = null): self |
||
| 714 | } |
||
| 715 | } |
||
| 716 |