Complex classes like CreateMeetingParameters 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. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
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 CreateMeetingParameters, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
24 | */ |
||
25 | class CreateMeetingParameters extends MetaParameters |
||
26 | { |
||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | private $meetingId; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | private $meetingName; |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | private $attendeePassword; |
||
41 | |||
42 | /** |
||
43 | * @var string |
||
44 | */ |
||
45 | private $moderatorPassword; |
||
46 | |||
47 | /** |
||
48 | * @var string |
||
49 | */ |
||
50 | private $dialNumber; |
||
51 | |||
52 | /** |
||
53 | * @var int |
||
54 | */ |
||
55 | private $voiceBridge; |
||
56 | |||
57 | /** |
||
58 | * @var string |
||
59 | */ |
||
60 | private $webVoice; |
||
61 | |||
62 | /** |
||
63 | * @var string |
||
64 | */ |
||
65 | private $logoutUrl; |
||
66 | |||
67 | /** |
||
68 | * @var int |
||
69 | */ |
||
70 | private $maxParticipants; |
||
71 | |||
72 | /** |
||
73 | * @var bool |
||
74 | */ |
||
75 | private $record; |
||
76 | |||
77 | /** |
||
78 | * @var bool |
||
79 | */ |
||
80 | private $autoStartRecording; |
||
81 | |||
82 | /** |
||
83 | * @var bool |
||
84 | */ |
||
85 | private $allowStartStopRecording; |
||
86 | |||
87 | /** |
||
88 | * @var int |
||
89 | */ |
||
90 | private $duration; |
||
91 | |||
92 | /** |
||
93 | * @var string |
||
94 | */ |
||
95 | private $welcomeMessage; |
||
96 | |||
97 | /** |
||
98 | * @var string |
||
99 | */ |
||
100 | private $moderatorOnlyMessage; |
||
101 | |||
102 | /** |
||
103 | * @var bool |
||
104 | */ |
||
105 | private $webcamsOnlyForModerator; |
||
106 | |||
107 | /** |
||
108 | * @var string |
||
109 | */ |
||
110 | private $logo; |
||
111 | |||
112 | /** |
||
113 | * @var string |
||
114 | */ |
||
115 | private $copyright; |
||
116 | |||
117 | /** |
||
118 | * @var bool |
||
119 | */ |
||
120 | private $muteOnStart; |
||
121 | |||
122 | /** |
||
123 | * @var array |
||
124 | */ |
||
125 | private $presentations = []; |
||
126 | |||
127 | /** |
||
128 | * CreateMeetingParameters constructor. |
||
129 | * |
||
130 | * @param $meetingId |
||
131 | * @param $meetingName |
||
132 | */ |
||
133 | public function __construct($meetingId, $meetingName) |
||
134 | { |
||
135 | $this->meetingId = $meetingId; |
||
136 | $this->meetingName = $meetingName; |
||
137 | } |
||
138 | |||
139 | /** |
||
140 | * @return string |
||
141 | */ |
||
142 | public function getMeetingId() |
||
143 | { |
||
144 | return $this->meetingId; |
||
145 | } |
||
146 | |||
147 | /** |
||
148 | * @param string $meetingId |
||
149 | * |
||
150 | * @return CreateMeetingParameters |
||
151 | */ |
||
152 | public function setMeetingId($meetingId) |
||
153 | { |
||
154 | $this->meetingId = $meetingId; |
||
155 | |||
156 | return $this; |
||
157 | } |
||
158 | |||
159 | /** |
||
160 | * @return string |
||
161 | */ |
||
162 | public function getMeetingName() |
||
163 | { |
||
164 | return $this->meetingName; |
||
165 | } |
||
166 | |||
167 | /** |
||
168 | * @param string $meetingName |
||
169 | * |
||
170 | * @return CreateMeetingParameters |
||
171 | */ |
||
172 | public function setMeetingName($meetingName) |
||
173 | { |
||
174 | $this->meetingName = $meetingName; |
||
175 | |||
176 | return $this; |
||
177 | } |
||
178 | |||
179 | /** |
||
180 | * @return string |
||
181 | */ |
||
182 | public function getAttendeePassword() |
||
183 | { |
||
184 | return $this->attendeePassword; |
||
185 | } |
||
186 | |||
187 | /** |
||
188 | * @param string $attendeePassword |
||
189 | * |
||
190 | * @return CreateMeetingParameters |
||
191 | */ |
||
192 | public function setAttendeePassword($attendeePassword) |
||
193 | { |
||
194 | $this->attendeePassword = $attendeePassword; |
||
195 | |||
196 | return $this; |
||
197 | } |
||
198 | |||
199 | /** |
||
200 | * @return string |
||
201 | */ |
||
202 | public function getModeratorPassword() |
||
203 | { |
||
204 | return $this->moderatorPassword; |
||
205 | } |
||
206 | |||
207 | /** |
||
208 | * @param string $moderatorPassword |
||
209 | * |
||
210 | * @return CreateMeetingParameters |
||
211 | */ |
||
212 | public function setModeratorPassword($moderatorPassword) |
||
213 | { |
||
214 | $this->moderatorPassword = $moderatorPassword; |
||
215 | |||
216 | return $this; |
||
217 | } |
||
218 | |||
219 | /** |
||
220 | * @return string |
||
221 | */ |
||
222 | public function getDialNumber() |
||
223 | { |
||
224 | return $this->dialNumber; |
||
225 | } |
||
226 | |||
227 | /** |
||
228 | * @param string $dialNumber |
||
229 | * |
||
230 | * @return CreateMeetingParameters |
||
231 | */ |
||
232 | public function setDialNumber($dialNumber) |
||
233 | { |
||
234 | $this->dialNumber = $dialNumber; |
||
235 | |||
236 | return $this; |
||
237 | } |
||
238 | |||
239 | /** |
||
240 | * @return int |
||
241 | */ |
||
242 | public function getVoiceBridge() |
||
243 | { |
||
244 | return $this->voiceBridge; |
||
245 | } |
||
246 | |||
247 | /** |
||
248 | * @param int $voiceBridge |
||
249 | * |
||
250 | * @return CreateMeetingParameters |
||
251 | */ |
||
252 | public function setVoiceBridge($voiceBridge) |
||
253 | { |
||
254 | $this->voiceBridge = $voiceBridge; |
||
255 | |||
256 | return $this; |
||
257 | } |
||
258 | |||
259 | /** |
||
260 | * @return string |
||
261 | */ |
||
262 | public function getWebVoice() |
||
263 | { |
||
264 | return $this->webVoice; |
||
265 | } |
||
266 | |||
267 | /** |
||
268 | * @param string $webVoice |
||
269 | * |
||
270 | * @return CreateMeetingParameters |
||
271 | */ |
||
272 | public function setWebVoice($webVoice) |
||
273 | { |
||
274 | $this->webVoice = $webVoice; |
||
275 | |||
276 | return $this; |
||
277 | } |
||
278 | |||
279 | /** |
||
280 | * @return string |
||
281 | */ |
||
282 | public function getLogoutUrl() |
||
283 | { |
||
284 | return $this->logoutUrl; |
||
285 | } |
||
286 | |||
287 | /** |
||
288 | * @param string $logoutUrl |
||
289 | * |
||
290 | * @return CreateMeetingParameters |
||
291 | */ |
||
292 | public function setLogoutUrl($logoutUrl) |
||
293 | { |
||
294 | $this->logoutUrl = $logoutUrl; |
||
295 | |||
296 | return $this; |
||
297 | } |
||
298 | |||
299 | /** |
||
300 | * @return int |
||
301 | */ |
||
302 | public function getMaxParticipants() |
||
303 | { |
||
304 | return $this->maxParticipants; |
||
305 | } |
||
306 | |||
307 | /** |
||
308 | * @param int $maxParticipants |
||
309 | * |
||
310 | * @return CreateMeetingParameters |
||
311 | */ |
||
312 | public function setMaxParticipants($maxParticipants) |
||
313 | { |
||
314 | $this->maxParticipants = $maxParticipants; |
||
315 | |||
316 | return $this; |
||
317 | } |
||
318 | |||
319 | /** |
||
320 | * @return bool |
||
321 | */ |
||
322 | public function isRecorded() |
||
323 | { |
||
324 | return $this->record; |
||
325 | } |
||
326 | |||
327 | /** |
||
328 | * @param bool $record |
||
329 | * |
||
330 | * @return CreateMeetingParameters |
||
331 | */ |
||
332 | public function setRecord($record) |
||
333 | { |
||
334 | $this->record = $record; |
||
335 | |||
336 | return $this; |
||
337 | } |
||
338 | |||
339 | /** |
||
340 | * @return bool |
||
341 | */ |
||
342 | public function isAutoStartRecording() |
||
343 | { |
||
344 | return $this->autoStartRecording; |
||
345 | } |
||
346 | |||
347 | /** |
||
348 | * @param bool $autoStartRecording |
||
349 | * |
||
350 | * @return CreateMeetingParameters |
||
351 | */ |
||
352 | public function setAutoStartRecording($autoStartRecording) |
||
353 | { |
||
354 | $this->autoStartRecording = $autoStartRecording; |
||
355 | |||
356 | return $this; |
||
357 | } |
||
358 | |||
359 | /** |
||
360 | * @return bool |
||
361 | */ |
||
362 | public function isAllowStartStopRecording() |
||
363 | { |
||
364 | return $this->allowStartStopRecording; |
||
365 | } |
||
366 | |||
367 | /** |
||
368 | * @param bool $autoStartRecording |
||
369 | * |
||
370 | * @return CreateMeetingParameters |
||
371 | */ |
||
372 | public function setAllowStartStopRecording($autoStartRecording) |
||
373 | { |
||
374 | $this->allowStartStopRecording = $autoStartRecording; |
||
375 | |||
376 | return $this; |
||
377 | } |
||
378 | |||
379 | /** |
||
380 | * @return int |
||
381 | */ |
||
382 | public function getDuration() |
||
383 | { |
||
384 | return $this->duration; |
||
385 | } |
||
386 | |||
387 | /** |
||
388 | * @param int $duration |
||
389 | * |
||
390 | * @return CreateMeetingParameters |
||
391 | */ |
||
392 | public function setDuration($duration) |
||
393 | { |
||
394 | $this->duration = $duration; |
||
395 | |||
396 | return $this; |
||
397 | } |
||
398 | |||
399 | /** |
||
400 | * @return string |
||
401 | */ |
||
402 | public function getWelcomeMessage() |
||
403 | { |
||
404 | return $this->welcomeMessage; |
||
405 | } |
||
406 | |||
407 | /** |
||
408 | * @param string $welcomeMessage |
||
409 | * |
||
410 | * @return CreateMeetingParameters |
||
411 | */ |
||
412 | public function setWelcomeMessage($welcomeMessage) |
||
413 | { |
||
414 | $this->welcomeMessage = $welcomeMessage; |
||
415 | |||
416 | return $this; |
||
417 | } |
||
418 | |||
419 | /** |
||
420 | * @return string |
||
421 | */ |
||
422 | public function getModeratorOnlyMessage() |
||
423 | { |
||
424 | return $this->moderatorOnlyMessage; |
||
425 | } |
||
426 | |||
427 | /** |
||
428 | * @param string $message |
||
429 | * |
||
430 | * @return CreateMeetingParameters |
||
431 | */ |
||
432 | public function setModeratorOnlyMessage($message) |
||
433 | { |
||
434 | $this->moderatorOnlyMessage = $message; |
||
435 | |||
436 | return $this; |
||
437 | } |
||
438 | |||
439 | /** |
||
440 | * @return bool |
||
441 | */ |
||
442 | public function isWebcamsOnlyForModerator() |
||
443 | { |
||
444 | return $this->webcamsOnlyForModerator; |
||
445 | } |
||
446 | |||
447 | /** |
||
448 | * @param bool $webcamsOnlyForModerator |
||
449 | * @return CreateMeetingParameters |
||
450 | */ |
||
451 | public function setWebcamsOnlyForModerator($webcamsOnlyForModerator) |
||
452 | { |
||
453 | $this->webcamsOnlyForModerator = $webcamsOnlyForModerator; |
||
454 | return $this; |
||
455 | } |
||
456 | |||
457 | /** |
||
458 | * @return string |
||
459 | */ |
||
460 | public function getLogo() |
||
461 | { |
||
462 | return $this->logo; |
||
463 | } |
||
464 | |||
465 | /** |
||
466 | * @param string $logo |
||
467 | * @return CreateMeetingParameters |
||
468 | */ |
||
469 | public function setLogo($logo) |
||
470 | { |
||
471 | $this->logo = $logo; |
||
472 | return $this; |
||
473 | } |
||
474 | |||
475 | /** |
||
476 | * @return string |
||
477 | */ |
||
478 | public function getCopyright() |
||
479 | { |
||
480 | return $this->copyright; |
||
481 | } |
||
482 | |||
483 | /** |
||
484 | * @param string $copyright |
||
485 | * @return CreateMeetingParameters |
||
486 | */ |
||
487 | public function setCopyright($copyright) |
||
488 | { |
||
489 | $this->copyright = $copyright; |
||
490 | return $this; |
||
491 | } |
||
588 |