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 MetaParameters |
||
| 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 bool |
||
| 103 | */ |
||
| 104 | private $webcamsOnlyForModerator; |
||
| 105 | |||
| 106 | /** |
||
| 107 | * @var string |
||
| 108 | */ |
||
| 109 | private $logo; |
||
| 110 | |||
| 111 | /** |
||
| 112 | * @var string |
||
| 113 | */ |
||
| 114 | private $copyright; |
||
| 115 | |||
| 116 | /** |
||
| 117 | * @var bool |
||
| 118 | */ |
||
| 119 | private $muteOnStart; |
||
| 120 | |||
| 121 | /** |
||
| 122 | * @var array |
||
| 123 | */ |
||
| 124 | private $presentations = []; |
||
| 125 | |||
| 126 | /** |
||
| 127 | * CreateMeetingParameters constructor. |
||
| 128 | * |
||
| 129 | * @param $meetingId |
||
| 130 | * @param $meetingName |
||
| 131 | */ |
||
| 132 | public function __construct($meetingId, $meetingName) |
||
| 137 | |||
| 138 | /** |
||
| 139 | * @return string |
||
| 140 | */ |
||
| 141 | public function getMeetingId() |
||
| 145 | |||
| 146 | /** |
||
| 147 | * @param string $meetingId |
||
| 148 | * |
||
| 149 | * @return CreateMeetingParameters |
||
| 150 | */ |
||
| 151 | public function setMeetingId($meetingId) |
||
| 157 | |||
| 158 | /** |
||
| 159 | * @return string |
||
| 160 | */ |
||
| 161 | public function getMeetingName() |
||
| 165 | |||
| 166 | /** |
||
| 167 | * @param string $meetingName |
||
| 168 | * |
||
| 169 | * @return CreateMeetingParameters |
||
| 170 | */ |
||
| 171 | public function setMeetingName($meetingName) |
||
| 177 | |||
| 178 | /** |
||
| 179 | * @return string |
||
| 180 | */ |
||
| 181 | public function getAttendeePassword() |
||
| 185 | |||
| 186 | /** |
||
| 187 | * @param string $attendeePassword |
||
| 188 | * |
||
| 189 | * @return CreateMeetingParameters |
||
| 190 | */ |
||
| 191 | public function setAttendeePassword($attendeePassword) |
||
| 197 | |||
| 198 | /** |
||
| 199 | * @return string |
||
| 200 | */ |
||
| 201 | public function getModeratorPassword() |
||
| 205 | |||
| 206 | /** |
||
| 207 | * @param string $moderatorPassword |
||
| 208 | * |
||
| 209 | * @return CreateMeetingParameters |
||
| 210 | */ |
||
| 211 | public function setModeratorPassword($moderatorPassword) |
||
| 217 | |||
| 218 | /** |
||
| 219 | * @return string |
||
| 220 | */ |
||
| 221 | public function getDialNumber() |
||
| 225 | |||
| 226 | /** |
||
| 227 | * @param string $dialNumber |
||
| 228 | * |
||
| 229 | * @return CreateMeetingParameters |
||
| 230 | */ |
||
| 231 | public function setDialNumber($dialNumber) |
||
| 237 | |||
| 238 | /** |
||
| 239 | * @return int |
||
| 240 | */ |
||
| 241 | public function getVoiceBridge() |
||
| 245 | |||
| 246 | /** |
||
| 247 | * @param int $voiceBridge |
||
| 248 | * |
||
| 249 | * @return CreateMeetingParameters |
||
| 250 | */ |
||
| 251 | public function setVoiceBridge($voiceBridge) |
||
| 257 | |||
| 258 | /** |
||
| 259 | * @return string |
||
| 260 | */ |
||
| 261 | public function getWebVoice() |
||
| 265 | |||
| 266 | /** |
||
| 267 | * @param string $webVoice |
||
| 268 | * |
||
| 269 | * @return CreateMeetingParameters |
||
| 270 | */ |
||
| 271 | public function setWebVoice($webVoice) |
||
| 277 | |||
| 278 | /** |
||
| 279 | * @return string |
||
| 280 | */ |
||
| 281 | public function getLogoutUrl() |
||
| 285 | |||
| 286 | /** |
||
| 287 | * @param string $logoutUrl |
||
| 288 | * |
||
| 289 | * @return CreateMeetingParameters |
||
| 290 | */ |
||
| 291 | public function setLogoutUrl($logoutUrl) |
||
| 297 | |||
| 298 | /** |
||
| 299 | * @return int |
||
| 300 | */ |
||
| 301 | public function getMaxParticipants() |
||
| 305 | |||
| 306 | /** |
||
| 307 | * @param int $maxParticipants |
||
| 308 | * |
||
| 309 | * @return CreateMeetingParameters |
||
| 310 | */ |
||
| 311 | public function setMaxParticipants($maxParticipants) |
||
| 317 | |||
| 318 | /** |
||
| 319 | * @return bool |
||
| 320 | */ |
||
| 321 | public function isRecorded() |
||
| 325 | |||
| 326 | /** |
||
| 327 | * @param bool $record |
||
| 328 | * |
||
| 329 | * @return CreateMeetingParameters |
||
| 330 | */ |
||
| 331 | public function setRecord($record) |
||
| 337 | |||
| 338 | /** |
||
| 339 | * @return bool |
||
| 340 | */ |
||
| 341 | public function isAutoStartRecording() |
||
| 345 | |||
| 346 | /** |
||
| 347 | * @param bool $autoStartRecording |
||
| 348 | * |
||
| 349 | * @return CreateMeetingParameters |
||
| 350 | */ |
||
| 351 | public function setAutoStartRecording($autoStartRecording) |
||
| 357 | |||
| 358 | /** |
||
| 359 | * @return bool |
||
| 360 | */ |
||
| 361 | public function isAllowStartStopRecording() |
||
| 365 | |||
| 366 | /** |
||
| 367 | * @param bool $autoStartRecording |
||
| 368 | * |
||
| 369 | * @return CreateMeetingParameters |
||
| 370 | */ |
||
| 371 | public function setAllowStartStopRecording($autoStartRecording) |
||
| 377 | |||
| 378 | /** |
||
| 379 | * @return int |
||
| 380 | */ |
||
| 381 | public function getDuration() |
||
| 385 | |||
| 386 | /** |
||
| 387 | * @param int $duration |
||
| 388 | * |
||
| 389 | * @return CreateMeetingParameters |
||
| 390 | */ |
||
| 391 | public function setDuration($duration) |
||
| 397 | |||
| 398 | /** |
||
| 399 | * @return string |
||
| 400 | */ |
||
| 401 | public function getWelcomeMessage() |
||
| 405 | |||
| 406 | /** |
||
| 407 | * @param string $welcomeMessage |
||
| 408 | * |
||
| 409 | * @return CreateMeetingParameters |
||
| 410 | */ |
||
| 411 | public function setWelcomeMessage($welcomeMessage) |
||
| 417 | |||
| 418 | /** |
||
| 419 | * @return string |
||
| 420 | */ |
||
| 421 | public function getModeratorOnlyMessage() |
||
| 425 | |||
| 426 | /** |
||
| 427 | * @param string $message |
||
| 428 | * |
||
| 429 | * @return CreateMeetingParameters |
||
| 430 | */ |
||
| 431 | public function setModeratorOnlyMessage($message) |
||
| 437 | |||
| 438 | /** |
||
| 439 | * @return bool |
||
| 440 | */ |
||
| 441 | public function isWebcamsOnlyForModerator() |
||
| 445 | |||
| 446 | /** |
||
| 447 | * @param bool $webcamsOnlyForModerator |
||
| 448 | * @return CreateMeetingParameters |
||
| 449 | */ |
||
| 450 | public function setWebcamsOnlyForModerator($webcamsOnlyForModerator) |
||
| 456 | |||
| 457 | /** |
||
| 458 | * @return string |
||
| 459 | */ |
||
| 460 | public function getLogo() |
||
| 464 | |||
| 465 | /** |
||
| 466 | * @param string $logo |
||
| 467 | * @return CreateMeetingParameters |
||
| 468 | */ |
||
| 469 | public function setLogo($logo) |
||
| 475 | |||
| 476 | /** |
||
| 477 | * @return string |
||
| 478 | */ |
||
| 479 | public function getCopyright() |
||
| 483 | |||
| 484 | /** |
||
| 485 | * @param string $copyright |
||
| 486 | * @return CreateMeetingParameters |
||
| 487 | */ |
||
| 488 | public function setCopyright($copyright) |
||
| 494 | |||
| 495 | /** |
||
| 496 | * @return bool |
||
| 497 | */ |
||
| 498 | public function isMuteOnStart() |
||
| 502 | |||
| 503 | /** |
||
| 504 | * @param bool $muteOnStart |
||
| 505 | * @return CreateMeetingParameters |
||
| 506 | */ |
||
| 507 | public function setMuteOnStart($muteOnStart) |
||
| 513 | |||
| 514 | /** |
||
| 515 | * @return array |
||
| 516 | */ |
||
| 517 | public function getPresentations() |
||
| 521 | |||
| 522 | /** |
||
| 523 | * @param $nameOrUrl |
||
| 524 | * @param null $content |
||
| 525 | * |
||
| 526 | * @return CreateMeetingParameters |
||
| 527 | */ |
||
| 528 | public function addPresentation($nameOrUrl, $content = null) |
||
| 534 | |||
| 535 | public function getPresentationsAsXML() |
||
| 558 | |||
| 559 | /** |
||
| 560 | * @return string |
||
| 561 | */ |
||
| 562 | public function getHTTPQuery() |
||
| 590 | } |
||
| 591 |