| Total Complexity | 41 |
| Total Lines | 470 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Complex classes like DescribeLayoutButton 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 DescribeLayoutButton, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 5 | class DescribeLayoutButton |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * @var WebLinkWindowType |
||
| 9 | */ |
||
| 10 | protected $behavior = null; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @var DescribeColor[] |
||
| 14 | */ |
||
| 15 | protected $colors = null; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var string |
||
| 19 | */ |
||
| 20 | protected $content = null; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var WebLinkType |
||
| 24 | */ |
||
| 25 | protected $contentSource = null; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @var boolean |
||
| 29 | */ |
||
| 30 | protected $custom = null; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @var string |
||
| 34 | */ |
||
| 35 | protected $encoding = null; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @var int |
||
| 39 | */ |
||
| 40 | protected $height = null; |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @var DescribeIcon[] |
||
| 44 | */ |
||
| 45 | protected $icons = null; |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @var string |
||
| 49 | */ |
||
| 50 | protected $label = null; |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @var boolean |
||
| 54 | */ |
||
| 55 | protected $menubar = null; |
||
| 56 | |||
| 57 | /** |
||
| 58 | * @var string |
||
| 59 | */ |
||
| 60 | protected $name = null; |
||
| 61 | |||
| 62 | /** |
||
| 63 | * @var boolean |
||
| 64 | */ |
||
| 65 | protected $overridden = null; |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @var boolean |
||
| 69 | */ |
||
| 70 | protected $resizeable = null; |
||
| 71 | |||
| 72 | /** |
||
| 73 | * @var boolean |
||
| 74 | */ |
||
| 75 | protected $scrollbars = null; |
||
| 76 | |||
| 77 | /** |
||
| 78 | * @var boolean |
||
| 79 | */ |
||
| 80 | protected $showsLocation = null; |
||
| 81 | |||
| 82 | /** |
||
| 83 | * @var boolean |
||
| 84 | */ |
||
| 85 | protected $showsStatus = null; |
||
| 86 | |||
| 87 | /** |
||
| 88 | * @var boolean |
||
| 89 | */ |
||
| 90 | protected $toolbar = null; |
||
| 91 | |||
| 92 | /** |
||
| 93 | * @var string |
||
| 94 | */ |
||
| 95 | protected $url = null; |
||
| 96 | |||
| 97 | /** |
||
| 98 | * @var int |
||
| 99 | */ |
||
| 100 | protected $width = null; |
||
| 101 | |||
| 102 | /** |
||
| 103 | * @var WebLinkPosition |
||
| 104 | */ |
||
| 105 | protected $windowPosition = null; |
||
| 106 | |||
| 107 | /** |
||
| 108 | * @param boolean $custom |
||
| 109 | * @param boolean $overridden |
||
| 110 | */ |
||
| 111 | public function __construct($custom = null, $overridden = null) |
||
| 112 | { |
||
| 113 | $this->custom = $custom; |
||
| 114 | $this->overridden = $overridden; |
||
| 115 | } |
||
| 116 | |||
| 117 | /** |
||
| 118 | * @return WebLinkWindowType |
||
| 119 | */ |
||
| 120 | public function getBehavior() |
||
| 121 | { |
||
| 122 | return $this->behavior; |
||
| 123 | } |
||
| 124 | |||
| 125 | /** |
||
| 126 | * @param WebLinkWindowType $behavior |
||
| 127 | * @return \SForce\Wsdl\DescribeLayoutButton |
||
| 128 | */ |
||
| 129 | public function setBehavior($behavior) |
||
| 130 | { |
||
| 131 | $this->behavior = $behavior; |
||
| 132 | return $this; |
||
| 133 | } |
||
| 134 | |||
| 135 | /** |
||
| 136 | * @return DescribeColor[] |
||
| 137 | */ |
||
| 138 | public function getColors() |
||
| 139 | { |
||
| 140 | return $this->colors; |
||
| 141 | } |
||
| 142 | |||
| 143 | /** |
||
| 144 | * @param DescribeColor[] $colors |
||
| 145 | * @return \SForce\Wsdl\DescribeLayoutButton |
||
| 146 | */ |
||
| 147 | public function setColors(array $colors = null) |
||
| 148 | { |
||
| 149 | $this->colors = $colors; |
||
| 150 | return $this; |
||
| 151 | } |
||
| 152 | |||
| 153 | /** |
||
| 154 | * @return string |
||
| 155 | */ |
||
| 156 | public function getContent() |
||
| 157 | { |
||
| 158 | return $this->content; |
||
| 159 | } |
||
| 160 | |||
| 161 | /** |
||
| 162 | * @param string $content |
||
| 163 | * @return \SForce\Wsdl\DescribeLayoutButton |
||
| 164 | */ |
||
| 165 | public function setContent($content) |
||
| 166 | { |
||
| 167 | $this->content = $content; |
||
| 168 | return $this; |
||
| 169 | } |
||
| 170 | |||
| 171 | /** |
||
| 172 | * @return WebLinkType |
||
| 173 | */ |
||
| 174 | public function getContentSource() |
||
| 175 | { |
||
| 176 | return $this->contentSource; |
||
| 177 | } |
||
| 178 | |||
| 179 | /** |
||
| 180 | * @param WebLinkType $contentSource |
||
| 181 | * @return \SForce\Wsdl\DescribeLayoutButton |
||
| 182 | */ |
||
| 183 | public function setContentSource($contentSource) |
||
| 184 | { |
||
| 185 | $this->contentSource = $contentSource; |
||
| 186 | return $this; |
||
| 187 | } |
||
| 188 | |||
| 189 | /** |
||
| 190 | * @return boolean |
||
| 191 | */ |
||
| 192 | public function getCustom() |
||
| 193 | { |
||
| 194 | return $this->custom; |
||
| 195 | } |
||
| 196 | |||
| 197 | /** |
||
| 198 | * @param boolean $custom |
||
| 199 | * @return \SForce\Wsdl\DescribeLayoutButton |
||
| 200 | */ |
||
| 201 | public function setCustom($custom) |
||
| 202 | { |
||
| 203 | $this->custom = $custom; |
||
| 204 | return $this; |
||
| 205 | } |
||
| 206 | |||
| 207 | /** |
||
| 208 | * @return string |
||
| 209 | */ |
||
| 210 | public function getEncoding() |
||
| 211 | { |
||
| 212 | return $this->encoding; |
||
| 213 | } |
||
| 214 | |||
| 215 | /** |
||
| 216 | * @param string $encoding |
||
| 217 | * @return \SForce\Wsdl\DescribeLayoutButton |
||
| 218 | */ |
||
| 219 | public function setEncoding($encoding) |
||
| 220 | { |
||
| 221 | $this->encoding = $encoding; |
||
| 222 | return $this; |
||
| 223 | } |
||
| 224 | |||
| 225 | /** |
||
| 226 | * @return int |
||
| 227 | */ |
||
| 228 | public function getHeight() |
||
| 229 | { |
||
| 230 | return $this->height; |
||
| 231 | } |
||
| 232 | |||
| 233 | /** |
||
| 234 | * @param int $height |
||
| 235 | * @return \SForce\Wsdl\DescribeLayoutButton |
||
| 236 | */ |
||
| 237 | public function setHeight($height) |
||
| 238 | { |
||
| 239 | $this->height = $height; |
||
| 240 | return $this; |
||
| 241 | } |
||
| 242 | |||
| 243 | /** |
||
| 244 | * @return DescribeIcon[] |
||
| 245 | */ |
||
| 246 | public function getIcons() |
||
| 247 | { |
||
| 248 | return $this->icons; |
||
| 249 | } |
||
| 250 | |||
| 251 | /** |
||
| 252 | * @param DescribeIcon[] $icons |
||
| 253 | * @return \SForce\Wsdl\DescribeLayoutButton |
||
| 254 | */ |
||
| 255 | public function setIcons(array $icons = null) |
||
| 256 | { |
||
| 257 | $this->icons = $icons; |
||
| 258 | return $this; |
||
| 259 | } |
||
| 260 | |||
| 261 | /** |
||
| 262 | * @return string |
||
| 263 | */ |
||
| 264 | public function getLabel() |
||
| 265 | { |
||
| 266 | return $this->label; |
||
| 267 | } |
||
| 268 | |||
| 269 | /** |
||
| 270 | * @param string $label |
||
| 271 | * @return \SForce\Wsdl\DescribeLayoutButton |
||
| 272 | */ |
||
| 273 | public function setLabel($label) |
||
| 274 | { |
||
| 275 | $this->label = $label; |
||
| 276 | return $this; |
||
| 277 | } |
||
| 278 | |||
| 279 | /** |
||
| 280 | * @return boolean |
||
| 281 | */ |
||
| 282 | public function getMenubar() |
||
| 283 | { |
||
| 284 | return $this->menubar; |
||
| 285 | } |
||
| 286 | |||
| 287 | /** |
||
| 288 | * @param boolean $menubar |
||
| 289 | * @return \SForce\Wsdl\DescribeLayoutButton |
||
| 290 | */ |
||
| 291 | public function setMenubar($menubar) |
||
| 292 | { |
||
| 293 | $this->menubar = $menubar; |
||
| 294 | return $this; |
||
| 295 | } |
||
| 296 | |||
| 297 | /** |
||
| 298 | * @return string |
||
| 299 | */ |
||
| 300 | public function getName() |
||
| 301 | { |
||
| 302 | return $this->name; |
||
| 303 | } |
||
| 304 | |||
| 305 | /** |
||
| 306 | * @param string $name |
||
| 307 | * @return \SForce\Wsdl\DescribeLayoutButton |
||
| 308 | */ |
||
| 309 | public function setName($name) |
||
| 310 | { |
||
| 311 | $this->name = $name; |
||
| 312 | return $this; |
||
| 313 | } |
||
| 314 | |||
| 315 | /** |
||
| 316 | * @return boolean |
||
| 317 | */ |
||
| 318 | public function getOverridden() |
||
| 319 | { |
||
| 320 | return $this->overridden; |
||
| 321 | } |
||
| 322 | |||
| 323 | /** |
||
| 324 | * @param boolean $overridden |
||
| 325 | * @return \SForce\Wsdl\DescribeLayoutButton |
||
| 326 | */ |
||
| 327 | public function setOverridden($overridden) |
||
| 328 | { |
||
| 329 | $this->overridden = $overridden; |
||
| 330 | return $this; |
||
| 331 | } |
||
| 332 | |||
| 333 | /** |
||
| 334 | * @return boolean |
||
| 335 | */ |
||
| 336 | public function getResizeable() |
||
| 337 | { |
||
| 338 | return $this->resizeable; |
||
| 339 | } |
||
| 340 | |||
| 341 | /** |
||
| 342 | * @param boolean $resizeable |
||
| 343 | * @return \SForce\Wsdl\DescribeLayoutButton |
||
| 344 | */ |
||
| 345 | public function setResizeable($resizeable) |
||
| 346 | { |
||
| 347 | $this->resizeable = $resizeable; |
||
| 348 | return $this; |
||
| 349 | } |
||
| 350 | |||
| 351 | /** |
||
| 352 | * @return boolean |
||
| 353 | */ |
||
| 354 | public function getScrollbars() |
||
| 355 | { |
||
| 356 | return $this->scrollbars; |
||
| 357 | } |
||
| 358 | |||
| 359 | /** |
||
| 360 | * @param boolean $scrollbars |
||
| 361 | * @return \SForce\Wsdl\DescribeLayoutButton |
||
| 362 | */ |
||
| 363 | public function setScrollbars($scrollbars) |
||
| 364 | { |
||
| 365 | $this->scrollbars = $scrollbars; |
||
| 366 | return $this; |
||
| 367 | } |
||
| 368 | |||
| 369 | /** |
||
| 370 | * @return boolean |
||
| 371 | */ |
||
| 372 | public function getShowsLocation() |
||
| 373 | { |
||
| 374 | return $this->showsLocation; |
||
| 375 | } |
||
| 376 | |||
| 377 | /** |
||
| 378 | * @param boolean $showsLocation |
||
| 379 | * @return \SForce\Wsdl\DescribeLayoutButton |
||
| 380 | */ |
||
| 381 | public function setShowsLocation($showsLocation) |
||
| 382 | { |
||
| 383 | $this->showsLocation = $showsLocation; |
||
| 384 | return $this; |
||
| 385 | } |
||
| 386 | |||
| 387 | /** |
||
| 388 | * @return boolean |
||
| 389 | */ |
||
| 390 | public function getShowsStatus() |
||
| 393 | } |
||
| 394 | |||
| 395 | /** |
||
| 396 | * @param boolean $showsStatus |
||
| 397 | * @return \SForce\Wsdl\DescribeLayoutButton |
||
| 398 | */ |
||
| 399 | public function setShowsStatus($showsStatus) |
||
| 403 | } |
||
| 404 | |||
| 405 | /** |
||
| 406 | * @return boolean |
||
| 407 | */ |
||
| 408 | public function getToolbar() |
||
| 409 | { |
||
| 410 | return $this->toolbar; |
||
| 411 | } |
||
| 412 | |||
| 413 | /** |
||
| 414 | * @param boolean $toolbar |
||
| 415 | * @return \SForce\Wsdl\DescribeLayoutButton |
||
| 416 | */ |
||
| 417 | public function setToolbar($toolbar) |
||
| 418 | { |
||
| 419 | $this->toolbar = $toolbar; |
||
| 420 | return $this; |
||
| 421 | } |
||
| 422 | |||
| 423 | /** |
||
| 424 | * @return string |
||
| 425 | */ |
||
| 426 | public function getUrl() |
||
| 427 | { |
||
| 428 | return $this->url; |
||
| 429 | } |
||
| 430 | |||
| 431 | /** |
||
| 432 | * @param string $url |
||
| 433 | * @return \SForce\Wsdl\DescribeLayoutButton |
||
| 434 | */ |
||
| 435 | public function setUrl($url) |
||
| 439 | } |
||
| 440 | |||
| 441 | /** |
||
| 442 | * @return int |
||
| 443 | */ |
||
| 444 | public function getWidth() |
||
| 445 | { |
||
| 446 | return $this->width; |
||
| 447 | } |
||
| 448 | |||
| 449 | /** |
||
| 450 | * @param int $width |
||
| 451 | * @return \SForce\Wsdl\DescribeLayoutButton |
||
| 452 | */ |
||
| 453 | public function setWidth($width) |
||
| 457 | } |
||
| 458 | |||
| 459 | /** |
||
| 460 | * @return WebLinkPosition |
||
| 461 | */ |
||
| 462 | public function getWindowPosition() |
||
| 463 | { |
||
| 464 | return $this->windowPosition; |
||
| 465 | } |
||
| 466 | |||
| 467 | /** |
||
| 468 | * @param WebLinkPosition $windowPosition |
||
| 469 | * @return \SForce\Wsdl\DescribeLayoutButton |
||
| 470 | */ |
||
| 471 | public function setWindowPosition($windowPosition) |
||
| 475 | } |
||
| 476 | } |
||
| 477 |