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 | class CreateMeetingParameters extends BaseParameters |
||
25 | { |
||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | private $meetingId; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | private $meetingName; |
||
35 | |||
36 | /** |
||
37 | * @var string |
||
38 | */ |
||
39 | private $attendeePassword; |
||
40 | |||
41 | /** |
||
42 | * @var string |
||
43 | */ |
||
44 | private $moderatorPassword; |
||
45 | |||
46 | /** |
||
47 | * @var string |
||
48 | */ |
||
49 | private $dialNumber; |
||
50 | |||
51 | /** |
||
52 | * @var int |
||
53 | */ |
||
54 | private $voiceBridge; |
||
55 | |||
56 | /** |
||
57 | * @var string |
||
58 | */ |
||
59 | private $webVoice; |
||
60 | |||
61 | /** |
||
62 | * @var string |
||
63 | */ |
||
64 | private $logoutUrl; |
||
65 | |||
66 | /** |
||
67 | * @var int |
||
68 | */ |
||
69 | private $maxParticipants; |
||
70 | |||
71 | /** |
||
72 | * @var bool |
||
73 | */ |
||
74 | private $record; |
||
75 | |||
76 | /** |
||
77 | * @var bool |
||
78 | */ |
||
79 | private $autoStartRecording; |
||
80 | |||
81 | /** |
||
82 | * @var bool |
||
83 | */ |
||
84 | private $allowStartStopRecording; |
||
85 | |||
86 | /** |
||
87 | * @var int |
||
88 | */ |
||
89 | private $duration; |
||
90 | |||
91 | /** |
||
92 | * @var string |
||
93 | */ |
||
94 | private $welcomeMessage; |
||
95 | |||
96 | /** |
||
97 | * @var string |
||
98 | */ |
||
99 | private $moderatorOnlyMessage; |
||
100 | |||
101 | /** |
||
102 | * @var array |
||
103 | */ |
||
104 | private $meta = []; |
||
105 | |||
106 | /** |
||
107 | * @var array |
||
108 | */ |
||
109 | private $presentations = []; |
||
110 | |||
111 | /** |
||
112 | * CreateMeetingParameters constructor. |
||
113 | * |
||
114 | * @param $meetingId |
||
115 | * @param $meetingName |
||
116 | */ |
||
117 | public function __construct($meetingId, $meetingName) |
||
122 | |||
123 | /** |
||
124 | * @return string |
||
125 | */ |
||
126 | public function getMeetingId() |
||
130 | |||
131 | /** |
||
132 | * @param string $meetingId |
||
133 | * |
||
134 | * @return CreateMeetingParameters |
||
135 | */ |
||
136 | public function setMeetingId($meetingId) |
||
142 | |||
143 | /** |
||
144 | * @return string |
||
145 | */ |
||
146 | public function getMeetingName() |
||
150 | |||
151 | /** |
||
152 | * @param string $meetingName |
||
153 | * |
||
154 | * @return CreateMeetingParameters |
||
155 | */ |
||
156 | public function setMeetingName($meetingName) |
||
162 | |||
163 | /** |
||
164 | * @return string |
||
165 | */ |
||
166 | public function getAttendeePassword() |
||
170 | |||
171 | /** |
||
172 | * @param string $attendeePassword |
||
173 | * |
||
174 | * @return CreateMeetingParameters |
||
175 | */ |
||
176 | public function setAttendeePassword($attendeePassword) |
||
182 | |||
183 | /** |
||
184 | * @return string |
||
185 | */ |
||
186 | public function getModeratorPassword() |
||
190 | |||
191 | /** |
||
192 | * @param string $moderatorPassword |
||
193 | * |
||
194 | * @return CreateMeetingParameters |
||
195 | */ |
||
196 | public function setModeratorPassword($moderatorPassword) |
||
202 | |||
203 | /** |
||
204 | * @return string |
||
205 | */ |
||
206 | public function getDialNumber() |
||
210 | |||
211 | /** |
||
212 | * @param string $dialNumber |
||
213 | * |
||
214 | * @return CreateMeetingParameters |
||
215 | */ |
||
216 | public function setDialNumber($dialNumber) |
||
222 | |||
223 | /** |
||
224 | * @return int |
||
225 | */ |
||
226 | public function getVoiceBridge() |
||
230 | |||
231 | /** |
||
232 | * @param int $voiceBridge |
||
233 | * |
||
234 | * @return CreateMeetingParameters |
||
235 | */ |
||
236 | public function setVoiceBridge($voiceBridge) |
||
242 | |||
243 | /** |
||
244 | * @return string |
||
245 | */ |
||
246 | public function getWebVoice() |
||
250 | |||
251 | /** |
||
252 | * @param string $webVoice |
||
253 | * |
||
254 | * @return CreateMeetingParameters |
||
255 | */ |
||
256 | public function setWebVoice($webVoice) |
||
262 | |||
263 | /** |
||
264 | * @return string |
||
265 | */ |
||
266 | public function getLogoutUrl() |
||
270 | |||
271 | /** |
||
272 | * @param string $logoutUrl |
||
273 | * |
||
274 | * @return CreateMeetingParameters |
||
275 | */ |
||
276 | public function setLogoutUrl($logoutUrl) |
||
282 | |||
283 | /** |
||
284 | * @return int |
||
285 | */ |
||
286 | public function getMaxParticipants() |
||
290 | |||
291 | /** |
||
292 | * @param int $maxParticipants |
||
293 | * |
||
294 | * @return CreateMeetingParameters |
||
295 | */ |
||
296 | public function setMaxParticipants($maxParticipants) |
||
302 | |||
303 | /** |
||
304 | * @return bool |
||
305 | */ |
||
306 | public function isRecorded() |
||
310 | |||
311 | /** |
||
312 | * @param bool $record |
||
313 | * |
||
314 | * @return CreateMeetingParameters |
||
315 | */ |
||
316 | public function setRecord($record) |
||
322 | |||
323 | /** |
||
324 | * @return bool |
||
325 | */ |
||
326 | public function isAutoStartRecording() |
||
330 | |||
331 | /** |
||
332 | * @param bool $autoStartRecording |
||
333 | * |
||
334 | * @return CreateMeetingParameters |
||
335 | */ |
||
336 | public function setAutoStartRecording($autoStartRecording) |
||
342 | |||
343 | /** |
||
344 | * @return bool |
||
345 | */ |
||
346 | public function isAllowStartStopRecording() |
||
350 | |||
351 | /** |
||
352 | * @param bool $autoStartRecording |
||
353 | * |
||
354 | * @return CreateMeetingParameters |
||
355 | */ |
||
356 | public function setAllowStartStopRecording($autoStartRecording) |
||
362 | |||
363 | /** |
||
364 | * @return int |
||
365 | */ |
||
366 | public function getDuration() |
||
370 | |||
371 | /** |
||
372 | * @param int $duration |
||
373 | * |
||
374 | * @return CreateMeetingParameters |
||
375 | */ |
||
376 | public function setDuration($duration) |
||
382 | |||
383 | /** |
||
384 | * @return string |
||
385 | */ |
||
386 | public function getWelcomeMessage() |
||
390 | |||
391 | /** |
||
392 | * @param string $welcomeMessage |
||
393 | * |
||
394 | * @return CreateMeetingParameters |
||
395 | */ |
||
396 | public function setWelcomeMessage($welcomeMessage) |
||
402 | |||
403 | /** |
||
404 | * @return string |
||
405 | */ |
||
406 | public function getModeratorOnlyMessage() |
||
410 | |||
411 | /** |
||
412 | * @param string $message |
||
413 | * |
||
414 | * @return CreateMeetingParameters |
||
415 | */ |
||
416 | public function setModeratorOnlyMessage($message) |
||
422 | |||
423 | /** |
||
424 | * @return string |
||
425 | */ |
||
426 | public function getMeta($key) |
||
430 | |||
431 | /** |
||
432 | * @param string $key |
||
433 | * @param string $value |
||
434 | * |
||
435 | * @return CreateMeetingParameters |
||
436 | */ |
||
437 | public function setMeta($key, $value) |
||
443 | |||
444 | /** |
||
445 | * @return array |
||
446 | */ |
||
447 | public function getPresentations() |
||
451 | |||
452 | /** |
||
453 | * @param $nameOrUrl |
||
454 | * @param null $content |
||
455 | * |
||
456 | * @return CreateMeetingParameters |
||
457 | */ |
||
458 | public function addPresentation($nameOrUrl, $content = null) |
||
464 | |||
465 | public function getPresentationsAsXML() |
||
486 | |||
487 | /** |
||
488 | * @return string |
||
489 | */ |
||
490 | public function getHTTPQuery() |
||
517 | } |
||
518 |