Total Complexity | 97 |
Total Lines | 624 |
Duplicated Lines | 0 % |
Changes | 0 |
Complex classes like EwsNonEmptyArrayOfChannelEventsType 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 EwsNonEmptyArrayOfChannelEventsType, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
16 | class EwsNonEmptyArrayOfChannelEventsType extends AbstractStructBase |
||
17 | { |
||
18 | /** |
||
19 | * The ChannelStatusEvent |
||
20 | * Meta information extracted from the WSDL |
||
21 | * - choice: ChannelStatusEvent | ChannelEventDroppedEvent | SubscriptionEventDroppedEvent | SubscriptionRenewFailedEvent | UnifiedGroupUnseenChangedEvent | UnifiedGroupContentChangedEvent | UserMembershipChangedEvent | NewSocialActivityAddedEvent |
||
22 | * - choiceMaxOccurs: unbounded |
||
23 | * - choiceMinOccurs: 1 |
||
24 | * @var \StructType\EwsChannelStatusEventType|null |
||
25 | */ |
||
26 | protected ?\StructType\EwsChannelStatusEventType $ChannelStatusEvent = null; |
||
27 | /** |
||
28 | * The ChannelEventDroppedEvent |
||
29 | * Meta information extracted from the WSDL |
||
30 | * - choice: ChannelStatusEvent | ChannelEventDroppedEvent | SubscriptionEventDroppedEvent | SubscriptionRenewFailedEvent | UnifiedGroupUnseenChangedEvent | UnifiedGroupContentChangedEvent | UserMembershipChangedEvent | NewSocialActivityAddedEvent |
||
31 | * - choiceMaxOccurs: unbounded |
||
32 | * - choiceMinOccurs: 1 |
||
33 | * @var \StructType\EwsChannelEventDroppedChannelEventType|null |
||
34 | */ |
||
35 | protected ?\StructType\EwsChannelEventDroppedChannelEventType $ChannelEventDroppedEvent = null; |
||
36 | /** |
||
37 | * The SubscriptionEventDroppedEvent |
||
38 | * Meta information extracted from the WSDL |
||
39 | * - choice: ChannelStatusEvent | ChannelEventDroppedEvent | SubscriptionEventDroppedEvent | SubscriptionRenewFailedEvent | UnifiedGroupUnseenChangedEvent | UnifiedGroupContentChangedEvent | UserMembershipChangedEvent | NewSocialActivityAddedEvent |
||
40 | * - choiceMaxOccurs: unbounded |
||
41 | * - choiceMinOccurs: 1 |
||
42 | * @var \StructType\EwsSubscriptionEventDroppedChannelEventType|null |
||
43 | */ |
||
44 | protected ?\StructType\EwsSubscriptionEventDroppedChannelEventType $SubscriptionEventDroppedEvent = null; |
||
45 | /** |
||
46 | * The SubscriptionRenewFailedEvent |
||
47 | * Meta information extracted from the WSDL |
||
48 | * - choice: ChannelStatusEvent | ChannelEventDroppedEvent | SubscriptionEventDroppedEvent | SubscriptionRenewFailedEvent | UnifiedGroupUnseenChangedEvent | UnifiedGroupContentChangedEvent | UserMembershipChangedEvent | NewSocialActivityAddedEvent |
||
49 | * - choiceMaxOccurs: unbounded |
||
50 | * - choiceMinOccurs: 1 |
||
51 | * @var \StructType\EwsSubscriptionRenewFailedChannelEventType|null |
||
52 | */ |
||
53 | protected ?\StructType\EwsSubscriptionRenewFailedChannelEventType $SubscriptionRenewFailedEvent = null; |
||
54 | /** |
||
55 | * The UnifiedGroupUnseenChangedEvent |
||
56 | * Meta information extracted from the WSDL |
||
57 | * - choice: ChannelStatusEvent | ChannelEventDroppedEvent | SubscriptionEventDroppedEvent | SubscriptionRenewFailedEvent | UnifiedGroupUnseenChangedEvent | UnifiedGroupContentChangedEvent | UserMembershipChangedEvent | NewSocialActivityAddedEvent |
||
58 | * - choiceMaxOccurs: unbounded |
||
59 | * - choiceMinOccurs: 1 |
||
60 | * @var \StructType\EwsUnifiedGroupUnseenChangedChannelEventType|null |
||
61 | */ |
||
62 | protected ?\StructType\EwsUnifiedGroupUnseenChangedChannelEventType $UnifiedGroupUnseenChangedEvent = null; |
||
63 | /** |
||
64 | * The UnifiedGroupContentChangedEvent |
||
65 | * Meta information extracted from the WSDL |
||
66 | * - choice: ChannelStatusEvent | ChannelEventDroppedEvent | SubscriptionEventDroppedEvent | SubscriptionRenewFailedEvent | UnifiedGroupUnseenChangedEvent | UnifiedGroupContentChangedEvent | UserMembershipChangedEvent | NewSocialActivityAddedEvent |
||
67 | * - choiceMaxOccurs: unbounded |
||
68 | * - choiceMinOccurs: 1 |
||
69 | * @var \StructType\EwsUnifiedGroupContentChangedChannelEventType|null |
||
70 | */ |
||
71 | protected ?\StructType\EwsUnifiedGroupContentChangedChannelEventType $UnifiedGroupContentChangedEvent = null; |
||
72 | /** |
||
73 | * The UserMembershipChangedEvent |
||
74 | * Meta information extracted from the WSDL |
||
75 | * - choice: ChannelStatusEvent | ChannelEventDroppedEvent | SubscriptionEventDroppedEvent | SubscriptionRenewFailedEvent | UnifiedGroupUnseenChangedEvent | UnifiedGroupContentChangedEvent | UserMembershipChangedEvent | NewSocialActivityAddedEvent |
||
76 | * - choiceMaxOccurs: unbounded |
||
77 | * - choiceMinOccurs: 1 |
||
78 | * @var \StructType\EwsUserMembershipChangedChannelEventType|null |
||
79 | */ |
||
80 | protected ?\StructType\EwsUserMembershipChangedChannelEventType $UserMembershipChangedEvent = null; |
||
81 | /** |
||
82 | * The NewSocialActivityAddedEvent |
||
83 | * Meta information extracted from the WSDL |
||
84 | * - choice: ChannelStatusEvent | ChannelEventDroppedEvent | SubscriptionEventDroppedEvent | SubscriptionRenewFailedEvent | UnifiedGroupUnseenChangedEvent | UnifiedGroupContentChangedEvent | UserMembershipChangedEvent | NewSocialActivityAddedEvent |
||
85 | * - choiceMaxOccurs: unbounded |
||
86 | * - choiceMinOccurs: 1 |
||
87 | * @var \StructType\EwsNewSocialActivityAddedEventType|null |
||
88 | */ |
||
89 | protected ?\StructType\EwsNewSocialActivityAddedEventType $NewSocialActivityAddedEvent = null; |
||
90 | /** |
||
91 | * Constructor method for NonEmptyArrayOfChannelEventsType |
||
92 | * @uses EwsNonEmptyArrayOfChannelEventsType::setChannelStatusEvent() |
||
93 | * @uses EwsNonEmptyArrayOfChannelEventsType::setChannelEventDroppedEvent() |
||
94 | * @uses EwsNonEmptyArrayOfChannelEventsType::setSubscriptionEventDroppedEvent() |
||
95 | * @uses EwsNonEmptyArrayOfChannelEventsType::setSubscriptionRenewFailedEvent() |
||
96 | * @uses EwsNonEmptyArrayOfChannelEventsType::setUnifiedGroupUnseenChangedEvent() |
||
97 | * @uses EwsNonEmptyArrayOfChannelEventsType::setUnifiedGroupContentChangedEvent() |
||
98 | * @uses EwsNonEmptyArrayOfChannelEventsType::setUserMembershipChangedEvent() |
||
99 | * @uses EwsNonEmptyArrayOfChannelEventsType::setNewSocialActivityAddedEvent() |
||
100 | * @param \StructType\EwsChannelStatusEventType $channelStatusEvent |
||
101 | * @param \StructType\EwsChannelEventDroppedChannelEventType $channelEventDroppedEvent |
||
102 | * @param \StructType\EwsSubscriptionEventDroppedChannelEventType $subscriptionEventDroppedEvent |
||
103 | * @param \StructType\EwsSubscriptionRenewFailedChannelEventType $subscriptionRenewFailedEvent |
||
104 | * @param \StructType\EwsUnifiedGroupUnseenChangedChannelEventType $unifiedGroupUnseenChangedEvent |
||
105 | * @param \StructType\EwsUnifiedGroupContentChangedChannelEventType $unifiedGroupContentChangedEvent |
||
106 | * @param \StructType\EwsUserMembershipChangedChannelEventType $userMembershipChangedEvent |
||
107 | * @param \StructType\EwsNewSocialActivityAddedEventType $newSocialActivityAddedEvent |
||
108 | */ |
||
109 | public function __construct(?\StructType\EwsChannelStatusEventType $channelStatusEvent = null, ?\StructType\EwsChannelEventDroppedChannelEventType $channelEventDroppedEvent = null, ?\StructType\EwsSubscriptionEventDroppedChannelEventType $subscriptionEventDroppedEvent = null, ?\StructType\EwsSubscriptionRenewFailedChannelEventType $subscriptionRenewFailedEvent = null, ?\StructType\EwsUnifiedGroupUnseenChangedChannelEventType $unifiedGroupUnseenChangedEvent = null, ?\StructType\EwsUnifiedGroupContentChangedChannelEventType $unifiedGroupContentChangedEvent = null, ?\StructType\EwsUserMembershipChangedChannelEventType $userMembershipChangedEvent = null, ?\StructType\EwsNewSocialActivityAddedEventType $newSocialActivityAddedEvent = null) |
||
110 | { |
||
111 | $this |
||
112 | ->setChannelStatusEvent($channelStatusEvent) |
||
113 | ->setChannelEventDroppedEvent($channelEventDroppedEvent) |
||
114 | ->setSubscriptionEventDroppedEvent($subscriptionEventDroppedEvent) |
||
115 | ->setSubscriptionRenewFailedEvent($subscriptionRenewFailedEvent) |
||
116 | ->setUnifiedGroupUnseenChangedEvent($unifiedGroupUnseenChangedEvent) |
||
117 | ->setUnifiedGroupContentChangedEvent($unifiedGroupContentChangedEvent) |
||
118 | ->setUserMembershipChangedEvent($userMembershipChangedEvent) |
||
119 | ->setNewSocialActivityAddedEvent($newSocialActivityAddedEvent); |
||
120 | } |
||
121 | /** |
||
122 | * Get ChannelStatusEvent value |
||
123 | * @return \StructType\EwsChannelStatusEventType|null |
||
124 | */ |
||
125 | public function getChannelStatusEvent(): ?\StructType\EwsChannelStatusEventType |
||
126 | { |
||
127 | return isset($this->ChannelStatusEvent) ? $this->ChannelStatusEvent : null; |
||
128 | } |
||
129 | /** |
||
130 | * This method is responsible for validating the value passed to the setChannelStatusEvent method |
||
131 | * This method is willingly generated in order to preserve the one-line inline validation within the setChannelStatusEvent method |
||
132 | * This has to validate that the property which is being set is the only one among the given choices |
||
133 | * @param mixed $value |
||
134 | * @return string A non-empty message if the values does not match the validation rules |
||
135 | */ |
||
136 | public function validateChannelStatusEventForChoiceConstraintsFromSetChannelStatusEvent($value): string |
||
137 | { |
||
138 | $message = ''; |
||
139 | if (is_null($value)) { |
||
140 | return $message; |
||
141 | } |
||
142 | $properties = [ |
||
143 | 'ChannelEventDroppedEvent', |
||
144 | 'SubscriptionEventDroppedEvent', |
||
145 | 'SubscriptionRenewFailedEvent', |
||
146 | 'UnifiedGroupUnseenChangedEvent', |
||
147 | 'UnifiedGroupContentChangedEvent', |
||
148 | 'UserMembershipChangedEvent', |
||
149 | 'NewSocialActivityAddedEvent', |
||
150 | ]; |
||
151 | try { |
||
152 | foreach ($properties as $property) { |
||
153 | if (isset($this->{$property})) { |
||
154 | throw new InvalidArgumentException(sprintf('The property ChannelStatusEvent can\'t be set as the property %s is already set. Only one property must be set among these properties: ChannelStatusEvent, %s.', $property, implode(', ', $properties)), __LINE__); |
||
155 | } |
||
156 | } |
||
157 | } catch (InvalidArgumentException $e) { |
||
158 | $message = $e->getMessage(); |
||
159 | } |
||
160 | |||
161 | return $message; |
||
162 | } |
||
163 | /** |
||
164 | * Set ChannelStatusEvent value |
||
165 | * This property belongs to a choice that allows only one property to exist. It is |
||
166 | * therefore removable from the request, consequently if the value assigned to this |
||
167 | * property is null, the property is removed from this object |
||
168 | * @throws InvalidArgumentException |
||
169 | * @param \StructType\EwsChannelStatusEventType $channelStatusEvent |
||
170 | * @return \StructType\EwsNonEmptyArrayOfChannelEventsType |
||
171 | */ |
||
172 | public function setChannelStatusEvent(?\StructType\EwsChannelStatusEventType $channelStatusEvent = null): self |
||
173 | { |
||
174 | // validation for constraint: choice(ChannelStatusEvent, ChannelEventDroppedEvent, SubscriptionEventDroppedEvent, SubscriptionRenewFailedEvent, UnifiedGroupUnseenChangedEvent, UnifiedGroupContentChangedEvent, UserMembershipChangedEvent, NewSocialActivityAddedEvent) |
||
175 | if ('' !== ($channelStatusEventChoiceErrorMessage = self::validateChannelStatusEventForChoiceConstraintsFromSetChannelStatusEvent($channelStatusEvent))) { |
||
|
|||
176 | throw new InvalidArgumentException($channelStatusEventChoiceErrorMessage, __LINE__); |
||
177 | } |
||
178 | if (is_null($channelStatusEvent) || (is_array($channelStatusEvent) && empty($channelStatusEvent))) { |
||
179 | unset($this->ChannelStatusEvent); |
||
180 | } else { |
||
181 | $this->ChannelStatusEvent = $channelStatusEvent; |
||
182 | } |
||
183 | |||
184 | return $this; |
||
185 | } |
||
186 | /** |
||
187 | * Get ChannelEventDroppedEvent value |
||
188 | * @return \StructType\EwsChannelEventDroppedChannelEventType|null |
||
189 | */ |
||
190 | public function getChannelEventDroppedEvent(): ?\StructType\EwsChannelEventDroppedChannelEventType |
||
191 | { |
||
192 | return isset($this->ChannelEventDroppedEvent) ? $this->ChannelEventDroppedEvent : null; |
||
193 | } |
||
194 | /** |
||
195 | * This method is responsible for validating the value passed to the setChannelEventDroppedEvent method |
||
196 | * This method is willingly generated in order to preserve the one-line inline validation within the setChannelEventDroppedEvent method |
||
197 | * This has to validate that the property which is being set is the only one among the given choices |
||
198 | * @param mixed $value |
||
199 | * @return string A non-empty message if the values does not match the validation rules |
||
200 | */ |
||
201 | public function validateChannelEventDroppedEventForChoiceConstraintsFromSetChannelEventDroppedEvent($value): string |
||
202 | { |
||
203 | $message = ''; |
||
204 | if (is_null($value)) { |
||
205 | return $message; |
||
206 | } |
||
207 | $properties = [ |
||
208 | 'ChannelStatusEvent', |
||
209 | 'SubscriptionEventDroppedEvent', |
||
210 | 'SubscriptionRenewFailedEvent', |
||
211 | 'UnifiedGroupUnseenChangedEvent', |
||
212 | 'UnifiedGroupContentChangedEvent', |
||
213 | 'UserMembershipChangedEvent', |
||
214 | 'NewSocialActivityAddedEvent', |
||
215 | ]; |
||
216 | try { |
||
217 | foreach ($properties as $property) { |
||
218 | if (isset($this->{$property})) { |
||
219 | throw new InvalidArgumentException(sprintf('The property ChannelEventDroppedEvent can\'t be set as the property %s is already set. Only one property must be set among these properties: ChannelEventDroppedEvent, %s.', $property, implode(', ', $properties)), __LINE__); |
||
220 | } |
||
221 | } |
||
222 | } catch (InvalidArgumentException $e) { |
||
223 | $message = $e->getMessage(); |
||
224 | } |
||
225 | |||
226 | return $message; |
||
227 | } |
||
228 | /** |
||
229 | * Set ChannelEventDroppedEvent value |
||
230 | * This property belongs to a choice that allows only one property to exist. It is |
||
231 | * therefore removable from the request, consequently if the value assigned to this |
||
232 | * property is null, the property is removed from this object |
||
233 | * @throws InvalidArgumentException |
||
234 | * @param \StructType\EwsChannelEventDroppedChannelEventType $channelEventDroppedEvent |
||
235 | * @return \StructType\EwsNonEmptyArrayOfChannelEventsType |
||
236 | */ |
||
237 | public function setChannelEventDroppedEvent(?\StructType\EwsChannelEventDroppedChannelEventType $channelEventDroppedEvent = null): self |
||
238 | { |
||
239 | // validation for constraint: choice(ChannelStatusEvent, ChannelEventDroppedEvent, SubscriptionEventDroppedEvent, SubscriptionRenewFailedEvent, UnifiedGroupUnseenChangedEvent, UnifiedGroupContentChangedEvent, UserMembershipChangedEvent, NewSocialActivityAddedEvent) |
||
240 | if ('' !== ($channelEventDroppedEventChoiceErrorMessage = self::validateChannelEventDroppedEventForChoiceConstraintsFromSetChannelEventDroppedEvent($channelEventDroppedEvent))) { |
||
241 | throw new InvalidArgumentException($channelEventDroppedEventChoiceErrorMessage, __LINE__); |
||
242 | } |
||
243 | if (is_null($channelEventDroppedEvent) || (is_array($channelEventDroppedEvent) && empty($channelEventDroppedEvent))) { |
||
244 | unset($this->ChannelEventDroppedEvent); |
||
245 | } else { |
||
246 | $this->ChannelEventDroppedEvent = $channelEventDroppedEvent; |
||
247 | } |
||
248 | |||
249 | return $this; |
||
250 | } |
||
251 | /** |
||
252 | * Get SubscriptionEventDroppedEvent value |
||
253 | * @return \StructType\EwsSubscriptionEventDroppedChannelEventType|null |
||
254 | */ |
||
255 | public function getSubscriptionEventDroppedEvent(): ?\StructType\EwsSubscriptionEventDroppedChannelEventType |
||
256 | { |
||
257 | return isset($this->SubscriptionEventDroppedEvent) ? $this->SubscriptionEventDroppedEvent : null; |
||
258 | } |
||
259 | /** |
||
260 | * This method is responsible for validating the value passed to the setSubscriptionEventDroppedEvent method |
||
261 | * This method is willingly generated in order to preserve the one-line inline validation within the setSubscriptionEventDroppedEvent method |
||
262 | * This has to validate that the property which is being set is the only one among the given choices |
||
263 | * @param mixed $value |
||
264 | * @return string A non-empty message if the values does not match the validation rules |
||
265 | */ |
||
266 | public function validateSubscriptionEventDroppedEventForChoiceConstraintsFromSetSubscriptionEventDroppedEvent($value): string |
||
267 | { |
||
268 | $message = ''; |
||
269 | if (is_null($value)) { |
||
270 | return $message; |
||
271 | } |
||
272 | $properties = [ |
||
273 | 'ChannelStatusEvent', |
||
274 | 'ChannelEventDroppedEvent', |
||
275 | 'SubscriptionRenewFailedEvent', |
||
276 | 'UnifiedGroupUnseenChangedEvent', |
||
277 | 'UnifiedGroupContentChangedEvent', |
||
278 | 'UserMembershipChangedEvent', |
||
279 | 'NewSocialActivityAddedEvent', |
||
280 | ]; |
||
281 | try { |
||
282 | foreach ($properties as $property) { |
||
283 | if (isset($this->{$property})) { |
||
284 | throw new InvalidArgumentException(sprintf('The property SubscriptionEventDroppedEvent can\'t be set as the property %s is already set. Only one property must be set among these properties: SubscriptionEventDroppedEvent, %s.', $property, implode(', ', $properties)), __LINE__); |
||
285 | } |
||
286 | } |
||
287 | } catch (InvalidArgumentException $e) { |
||
288 | $message = $e->getMessage(); |
||
289 | } |
||
290 | |||
291 | return $message; |
||
292 | } |
||
293 | /** |
||
294 | * Set SubscriptionEventDroppedEvent value |
||
295 | * This property belongs to a choice that allows only one property to exist. It is |
||
296 | * therefore removable from the request, consequently if the value assigned to this |
||
297 | * property is null, the property is removed from this object |
||
298 | * @throws InvalidArgumentException |
||
299 | * @param \StructType\EwsSubscriptionEventDroppedChannelEventType $subscriptionEventDroppedEvent |
||
300 | * @return \StructType\EwsNonEmptyArrayOfChannelEventsType |
||
301 | */ |
||
302 | public function setSubscriptionEventDroppedEvent(?\StructType\EwsSubscriptionEventDroppedChannelEventType $subscriptionEventDroppedEvent = null): self |
||
303 | { |
||
304 | // validation for constraint: choice(ChannelStatusEvent, ChannelEventDroppedEvent, SubscriptionEventDroppedEvent, SubscriptionRenewFailedEvent, UnifiedGroupUnseenChangedEvent, UnifiedGroupContentChangedEvent, UserMembershipChangedEvent, NewSocialActivityAddedEvent) |
||
305 | if ('' !== ($subscriptionEventDroppedEventChoiceErrorMessage = self::validateSubscriptionEventDroppedEventForChoiceConstraintsFromSetSubscriptionEventDroppedEvent($subscriptionEventDroppedEvent))) { |
||
306 | throw new InvalidArgumentException($subscriptionEventDroppedEventChoiceErrorMessage, __LINE__); |
||
307 | } |
||
308 | if (is_null($subscriptionEventDroppedEvent) || (is_array($subscriptionEventDroppedEvent) && empty($subscriptionEventDroppedEvent))) { |
||
309 | unset($this->SubscriptionEventDroppedEvent); |
||
310 | } else { |
||
311 | $this->SubscriptionEventDroppedEvent = $subscriptionEventDroppedEvent; |
||
312 | } |
||
313 | |||
314 | return $this; |
||
315 | } |
||
316 | /** |
||
317 | * Get SubscriptionRenewFailedEvent value |
||
318 | * @return \StructType\EwsSubscriptionRenewFailedChannelEventType|null |
||
319 | */ |
||
320 | public function getSubscriptionRenewFailedEvent(): ?\StructType\EwsSubscriptionRenewFailedChannelEventType |
||
323 | } |
||
324 | /** |
||
325 | * This method is responsible for validating the value passed to the setSubscriptionRenewFailedEvent method |
||
326 | * This method is willingly generated in order to preserve the one-line inline validation within the setSubscriptionRenewFailedEvent method |
||
327 | * This has to validate that the property which is being set is the only one among the given choices |
||
328 | * @param mixed $value |
||
329 | * @return string A non-empty message if the values does not match the validation rules |
||
330 | */ |
||
331 | public function validateSubscriptionRenewFailedEventForChoiceConstraintsFromSetSubscriptionRenewFailedEvent($value): string |
||
332 | { |
||
333 | $message = ''; |
||
334 | if (is_null($value)) { |
||
335 | return $message; |
||
336 | } |
||
337 | $properties = [ |
||
338 | 'ChannelStatusEvent', |
||
339 | 'ChannelEventDroppedEvent', |
||
340 | 'SubscriptionEventDroppedEvent', |
||
341 | 'UnifiedGroupUnseenChangedEvent', |
||
342 | 'UnifiedGroupContentChangedEvent', |
||
343 | 'UserMembershipChangedEvent', |
||
344 | 'NewSocialActivityAddedEvent', |
||
345 | ]; |
||
346 | try { |
||
347 | foreach ($properties as $property) { |
||
348 | if (isset($this->{$property})) { |
||
349 | throw new InvalidArgumentException(sprintf('The property SubscriptionRenewFailedEvent can\'t be set as the property %s is already set. Only one property must be set among these properties: SubscriptionRenewFailedEvent, %s.', $property, implode(', ', $properties)), __LINE__); |
||
350 | } |
||
351 | } |
||
352 | } catch (InvalidArgumentException $e) { |
||
353 | $message = $e->getMessage(); |
||
354 | } |
||
355 | |||
356 | return $message; |
||
357 | } |
||
358 | /** |
||
359 | * Set SubscriptionRenewFailedEvent value |
||
360 | * This property belongs to a choice that allows only one property to exist. It is |
||
361 | * therefore removable from the request, consequently if the value assigned to this |
||
362 | * property is null, the property is removed from this object |
||
363 | * @throws InvalidArgumentException |
||
364 | * @param \StructType\EwsSubscriptionRenewFailedChannelEventType $subscriptionRenewFailedEvent |
||
365 | * @return \StructType\EwsNonEmptyArrayOfChannelEventsType |
||
366 | */ |
||
367 | public function setSubscriptionRenewFailedEvent(?\StructType\EwsSubscriptionRenewFailedChannelEventType $subscriptionRenewFailedEvent = null): self |
||
368 | { |
||
369 | // validation for constraint: choice(ChannelStatusEvent, ChannelEventDroppedEvent, SubscriptionEventDroppedEvent, SubscriptionRenewFailedEvent, UnifiedGroupUnseenChangedEvent, UnifiedGroupContentChangedEvent, UserMembershipChangedEvent, NewSocialActivityAddedEvent) |
||
370 | if ('' !== ($subscriptionRenewFailedEventChoiceErrorMessage = self::validateSubscriptionRenewFailedEventForChoiceConstraintsFromSetSubscriptionRenewFailedEvent($subscriptionRenewFailedEvent))) { |
||
371 | throw new InvalidArgumentException($subscriptionRenewFailedEventChoiceErrorMessage, __LINE__); |
||
372 | } |
||
373 | if (is_null($subscriptionRenewFailedEvent) || (is_array($subscriptionRenewFailedEvent) && empty($subscriptionRenewFailedEvent))) { |
||
374 | unset($this->SubscriptionRenewFailedEvent); |
||
375 | } else { |
||
376 | $this->SubscriptionRenewFailedEvent = $subscriptionRenewFailedEvent; |
||
377 | } |
||
378 | |||
379 | return $this; |
||
380 | } |
||
381 | /** |
||
382 | * Get UnifiedGroupUnseenChangedEvent value |
||
383 | * @return \StructType\EwsUnifiedGroupUnseenChangedChannelEventType|null |
||
384 | */ |
||
385 | public function getUnifiedGroupUnseenChangedEvent(): ?\StructType\EwsUnifiedGroupUnseenChangedChannelEventType |
||
386 | { |
||
387 | return isset($this->UnifiedGroupUnseenChangedEvent) ? $this->UnifiedGroupUnseenChangedEvent : null; |
||
388 | } |
||
389 | /** |
||
390 | * This method is responsible for validating the value passed to the setUnifiedGroupUnseenChangedEvent method |
||
391 | * This method is willingly generated in order to preserve the one-line inline validation within the setUnifiedGroupUnseenChangedEvent method |
||
392 | * This has to validate that the property which is being set is the only one among the given choices |
||
393 | * @param mixed $value |
||
394 | * @return string A non-empty message if the values does not match the validation rules |
||
395 | */ |
||
396 | public function validateUnifiedGroupUnseenChangedEventForChoiceConstraintsFromSetUnifiedGroupUnseenChangedEvent($value): string |
||
397 | { |
||
398 | $message = ''; |
||
399 | if (is_null($value)) { |
||
400 | return $message; |
||
401 | } |
||
402 | $properties = [ |
||
403 | 'ChannelStatusEvent', |
||
404 | 'ChannelEventDroppedEvent', |
||
405 | 'SubscriptionEventDroppedEvent', |
||
406 | 'SubscriptionRenewFailedEvent', |
||
407 | 'UnifiedGroupContentChangedEvent', |
||
408 | 'UserMembershipChangedEvent', |
||
409 | 'NewSocialActivityAddedEvent', |
||
410 | ]; |
||
411 | try { |
||
412 | foreach ($properties as $property) { |
||
413 | if (isset($this->{$property})) { |
||
414 | throw new InvalidArgumentException(sprintf('The property UnifiedGroupUnseenChangedEvent can\'t be set as the property %s is already set. Only one property must be set among these properties: UnifiedGroupUnseenChangedEvent, %s.', $property, implode(', ', $properties)), __LINE__); |
||
415 | } |
||
416 | } |
||
417 | } catch (InvalidArgumentException $e) { |
||
418 | $message = $e->getMessage(); |
||
419 | } |
||
420 | |||
421 | return $message; |
||
422 | } |
||
423 | /** |
||
424 | * Set UnifiedGroupUnseenChangedEvent value |
||
425 | * This property belongs to a choice that allows only one property to exist. It is |
||
426 | * therefore removable from the request, consequently if the value assigned to this |
||
427 | * property is null, the property is removed from this object |
||
428 | * @throws InvalidArgumentException |
||
429 | * @param \StructType\EwsUnifiedGroupUnseenChangedChannelEventType $unifiedGroupUnseenChangedEvent |
||
430 | * @return \StructType\EwsNonEmptyArrayOfChannelEventsType |
||
431 | */ |
||
432 | public function setUnifiedGroupUnseenChangedEvent(?\StructType\EwsUnifiedGroupUnseenChangedChannelEventType $unifiedGroupUnseenChangedEvent = null): self |
||
433 | { |
||
434 | // validation for constraint: choice(ChannelStatusEvent, ChannelEventDroppedEvent, SubscriptionEventDroppedEvent, SubscriptionRenewFailedEvent, UnifiedGroupUnseenChangedEvent, UnifiedGroupContentChangedEvent, UserMembershipChangedEvent, NewSocialActivityAddedEvent) |
||
435 | if ('' !== ($unifiedGroupUnseenChangedEventChoiceErrorMessage = self::validateUnifiedGroupUnseenChangedEventForChoiceConstraintsFromSetUnifiedGroupUnseenChangedEvent($unifiedGroupUnseenChangedEvent))) { |
||
436 | throw new InvalidArgumentException($unifiedGroupUnseenChangedEventChoiceErrorMessage, __LINE__); |
||
437 | } |
||
438 | if (is_null($unifiedGroupUnseenChangedEvent) || (is_array($unifiedGroupUnseenChangedEvent) && empty($unifiedGroupUnseenChangedEvent))) { |
||
439 | unset($this->UnifiedGroupUnseenChangedEvent); |
||
440 | } else { |
||
441 | $this->UnifiedGroupUnseenChangedEvent = $unifiedGroupUnseenChangedEvent; |
||
442 | } |
||
443 | |||
444 | return $this; |
||
445 | } |
||
446 | /** |
||
447 | * Get UnifiedGroupContentChangedEvent value |
||
448 | * @return \StructType\EwsUnifiedGroupContentChangedChannelEventType|null |
||
449 | */ |
||
450 | public function getUnifiedGroupContentChangedEvent(): ?\StructType\EwsUnifiedGroupContentChangedChannelEventType |
||
451 | { |
||
452 | return isset($this->UnifiedGroupContentChangedEvent) ? $this->UnifiedGroupContentChangedEvent : null; |
||
453 | } |
||
454 | /** |
||
455 | * This method is responsible for validating the value passed to the setUnifiedGroupContentChangedEvent method |
||
456 | * This method is willingly generated in order to preserve the one-line inline validation within the setUnifiedGroupContentChangedEvent method |
||
457 | * This has to validate that the property which is being set is the only one among the given choices |
||
458 | * @param mixed $value |
||
459 | * @return string A non-empty message if the values does not match the validation rules |
||
460 | */ |
||
461 | public function validateUnifiedGroupContentChangedEventForChoiceConstraintsFromSetUnifiedGroupContentChangedEvent($value): string |
||
462 | { |
||
463 | $message = ''; |
||
464 | if (is_null($value)) { |
||
465 | return $message; |
||
466 | } |
||
467 | $properties = [ |
||
468 | 'ChannelStatusEvent', |
||
469 | 'ChannelEventDroppedEvent', |
||
470 | 'SubscriptionEventDroppedEvent', |
||
471 | 'SubscriptionRenewFailedEvent', |
||
472 | 'UnifiedGroupUnseenChangedEvent', |
||
473 | 'UserMembershipChangedEvent', |
||
474 | 'NewSocialActivityAddedEvent', |
||
475 | ]; |
||
476 | try { |
||
477 | foreach ($properties as $property) { |
||
478 | if (isset($this->{$property})) { |
||
479 | throw new InvalidArgumentException(sprintf('The property UnifiedGroupContentChangedEvent can\'t be set as the property %s is already set. Only one property must be set among these properties: UnifiedGroupContentChangedEvent, %s.', $property, implode(', ', $properties)), __LINE__); |
||
480 | } |
||
481 | } |
||
482 | } catch (InvalidArgumentException $e) { |
||
483 | $message = $e->getMessage(); |
||
484 | } |
||
485 | |||
486 | return $message; |
||
487 | } |
||
488 | /** |
||
489 | * Set UnifiedGroupContentChangedEvent value |
||
490 | * This property belongs to a choice that allows only one property to exist. It is |
||
491 | * therefore removable from the request, consequently if the value assigned to this |
||
492 | * property is null, the property is removed from this object |
||
493 | * @throws InvalidArgumentException |
||
494 | * @param \StructType\EwsUnifiedGroupContentChangedChannelEventType $unifiedGroupContentChangedEvent |
||
495 | * @return \StructType\EwsNonEmptyArrayOfChannelEventsType |
||
496 | */ |
||
497 | public function setUnifiedGroupContentChangedEvent(?\StructType\EwsUnifiedGroupContentChangedChannelEventType $unifiedGroupContentChangedEvent = null): self |
||
498 | { |
||
499 | // validation for constraint: choice(ChannelStatusEvent, ChannelEventDroppedEvent, SubscriptionEventDroppedEvent, SubscriptionRenewFailedEvent, UnifiedGroupUnseenChangedEvent, UnifiedGroupContentChangedEvent, UserMembershipChangedEvent, NewSocialActivityAddedEvent) |
||
500 | if ('' !== ($unifiedGroupContentChangedEventChoiceErrorMessage = self::validateUnifiedGroupContentChangedEventForChoiceConstraintsFromSetUnifiedGroupContentChangedEvent($unifiedGroupContentChangedEvent))) { |
||
501 | throw new InvalidArgumentException($unifiedGroupContentChangedEventChoiceErrorMessage, __LINE__); |
||
502 | } |
||
503 | if (is_null($unifiedGroupContentChangedEvent) || (is_array($unifiedGroupContentChangedEvent) && empty($unifiedGroupContentChangedEvent))) { |
||
504 | unset($this->UnifiedGroupContentChangedEvent); |
||
505 | } else { |
||
506 | $this->UnifiedGroupContentChangedEvent = $unifiedGroupContentChangedEvent; |
||
507 | } |
||
508 | |||
509 | return $this; |
||
510 | } |
||
511 | /** |
||
512 | * Get UserMembershipChangedEvent value |
||
513 | * @return \StructType\EwsUserMembershipChangedChannelEventType|null |
||
514 | */ |
||
515 | public function getUserMembershipChangedEvent(): ?\StructType\EwsUserMembershipChangedChannelEventType |
||
516 | { |
||
517 | return isset($this->UserMembershipChangedEvent) ? $this->UserMembershipChangedEvent : null; |
||
518 | } |
||
519 | /** |
||
520 | * This method is responsible for validating the value passed to the setUserMembershipChangedEvent method |
||
521 | * This method is willingly generated in order to preserve the one-line inline validation within the setUserMembershipChangedEvent method |
||
522 | * This has to validate that the property which is being set is the only one among the given choices |
||
523 | * @param mixed $value |
||
524 | * @return string A non-empty message if the values does not match the validation rules |
||
525 | */ |
||
526 | public function validateUserMembershipChangedEventForChoiceConstraintsFromSetUserMembershipChangedEvent($value): string |
||
527 | { |
||
528 | $message = ''; |
||
529 | if (is_null($value)) { |
||
530 | return $message; |
||
531 | } |
||
532 | $properties = [ |
||
533 | 'ChannelStatusEvent', |
||
534 | 'ChannelEventDroppedEvent', |
||
535 | 'SubscriptionEventDroppedEvent', |
||
536 | 'SubscriptionRenewFailedEvent', |
||
537 | 'UnifiedGroupUnseenChangedEvent', |
||
538 | 'UnifiedGroupContentChangedEvent', |
||
539 | 'NewSocialActivityAddedEvent', |
||
540 | ]; |
||
541 | try { |
||
542 | foreach ($properties as $property) { |
||
543 | if (isset($this->{$property})) { |
||
544 | throw new InvalidArgumentException(sprintf('The property UserMembershipChangedEvent can\'t be set as the property %s is already set. Only one property must be set among these properties: UserMembershipChangedEvent, %s.', $property, implode(', ', $properties)), __LINE__); |
||
545 | } |
||
546 | } |
||
547 | } catch (InvalidArgumentException $e) { |
||
548 | $message = $e->getMessage(); |
||
549 | } |
||
550 | |||
551 | return $message; |
||
552 | } |
||
553 | /** |
||
554 | * Set UserMembershipChangedEvent value |
||
555 | * This property belongs to a choice that allows only one property to exist. It is |
||
556 | * therefore removable from the request, consequently if the value assigned to this |
||
557 | * property is null, the property is removed from this object |
||
558 | * @throws InvalidArgumentException |
||
559 | * @param \StructType\EwsUserMembershipChangedChannelEventType $userMembershipChangedEvent |
||
560 | * @return \StructType\EwsNonEmptyArrayOfChannelEventsType |
||
561 | */ |
||
562 | public function setUserMembershipChangedEvent(?\StructType\EwsUserMembershipChangedChannelEventType $userMembershipChangedEvent = null): self |
||
575 | } |
||
576 | /** |
||
577 | * Get NewSocialActivityAddedEvent value |
||
578 | * @return \StructType\EwsNewSocialActivityAddedEventType|null |
||
579 | */ |
||
580 | public function getNewSocialActivityAddedEvent(): ?\StructType\EwsNewSocialActivityAddedEventType |
||
581 | { |
||
582 | return isset($this->NewSocialActivityAddedEvent) ? $this->NewSocialActivityAddedEvent : null; |
||
583 | } |
||
584 | /** |
||
585 | * This method is responsible for validating the value passed to the setNewSocialActivityAddedEvent method |
||
586 | * This method is willingly generated in order to preserve the one-line inline validation within the setNewSocialActivityAddedEvent method |
||
587 | * This has to validate that the property which is being set is the only one among the given choices |
||
588 | * @param mixed $value |
||
589 | * @return string A non-empty message if the values does not match the validation rules |
||
590 | */ |
||
591 | public function validateNewSocialActivityAddedEventForChoiceConstraintsFromSetNewSocialActivityAddedEvent($value): string |
||
617 | } |
||
618 | /** |
||
619 | * Set NewSocialActivityAddedEvent value |
||
620 | * This property belongs to a choice that allows only one property to exist. It is |
||
621 | * therefore removable from the request, consequently if the value assigned to this |
||
622 | * property is null, the property is removed from this object |
||
623 | * @throws InvalidArgumentException |
||
624 | * @param \StructType\EwsNewSocialActivityAddedEventType $newSocialActivityAddedEvent |
||
625 | * @return \StructType\EwsNonEmptyArrayOfChannelEventsType |
||
626 | */ |
||
627 | public function setNewSocialActivityAddedEvent(?\StructType\EwsNewSocialActivityAddedEventType $newSocialActivityAddedEvent = null): self |
||
640 | } |
||
641 | } |
||
642 |