| Total Complexity | 56 |
| Total Lines | 365 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Complex classes like LayoutParameters 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 LayoutParameters, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 9 | final class LayoutParameters extends AssetBundle |
||
| 10 | { |
||
| 11 | private string $brandUrl; |
||
| 12 | private string $charset; |
||
| 13 | private array $heroOptions = []; |
||
| 14 | private array $heroHeadOptions = []; |
||
| 15 | private array $heroBodyOptions = []; |
||
| 16 | private array $heroContainerOptions = []; |
||
| 17 | private array $heroFooterOptions = []; |
||
| 18 | private array $heroFooterColumnOptions = []; |
||
| 19 | private string $heroFooterColumnCenter; |
||
| 20 | private array $heroFooterColumnCenterOptions = []; |
||
| 21 | private string $heroFooterColumnLeft; |
||
| 22 | private array $heroFooterColumnLeftOptions = []; |
||
| 23 | private string $heroFooterColumnRigth; |
||
| 24 | private array $heroFooterColumnRigthOptions = []; |
||
| 25 | private string $language; |
||
| 26 | private string $logo; |
||
| 27 | private array $menu = []; |
||
| 28 | private string $name; |
||
| 29 | private array $navBarOptions = []; |
||
| 30 | private array $navBarBrandOptions = []; |
||
| 31 | private array $navBarBrandLogoOptions = []; |
||
| 32 | private array $navBarBrandTitleOptions = []; |
||
| 33 | private array $loggerLevels = []; |
||
| 34 | private string $loggerFile; |
||
| 35 | private int $maxFileSize; |
||
| 36 | private int $maxFiles; |
||
| 37 | private ?int $fileMode; |
||
| 38 | private ?bool $rotateByCopy; |
||
| 39 | |||
| 40 | public function getBrandUrl(): string |
||
| 41 | { |
||
| 42 | return $this->brandUrl; |
||
| 43 | } |
||
| 44 | |||
| 45 | public function getCharset(): string |
||
| 46 | { |
||
| 47 | return $this->charset; |
||
| 48 | } |
||
| 49 | |||
| 50 | public function getHeroOptions(): array |
||
| 51 | { |
||
| 52 | return $this->heroOptions; |
||
| 53 | } |
||
| 54 | |||
| 55 | public function getHeroHeadOptions(): array |
||
| 56 | { |
||
| 57 | return $this->heroHeadOptions; |
||
| 58 | } |
||
| 59 | |||
| 60 | public function getHeroContainerOptions(): array |
||
| 61 | { |
||
| 62 | return $this->heroContainerOptions; |
||
| 63 | } |
||
| 64 | |||
| 65 | public function getHeroBodyOptions(): array |
||
| 66 | { |
||
| 67 | return $this->heroBodyOptions; |
||
| 68 | } |
||
| 69 | |||
| 70 | public function getHeroFooterOptions(): array |
||
| 71 | { |
||
| 72 | return $this->heroFooterOptions; |
||
| 73 | } |
||
| 74 | |||
| 75 | public function getHeroFooterColumnOptions(): array |
||
| 76 | { |
||
| 77 | return $this->heroFooterColumnOptions; |
||
| 78 | } |
||
| 79 | |||
| 80 | public function getHeroFooterColumnCenter(): string |
||
| 81 | { |
||
| 82 | return $this->heroFooterColumnCenter; |
||
| 83 | } |
||
| 84 | |||
| 85 | public function getHeroFooterColumnCenterOptions(): array |
||
| 86 | { |
||
| 87 | return $this->heroFooterColumnCenterOptions; |
||
| 88 | } |
||
| 89 | |||
| 90 | public function getHeroFooterColumnLeft(): string |
||
| 91 | { |
||
| 92 | return $this->heroFooterColumnLeft; |
||
| 93 | } |
||
| 94 | |||
| 95 | public function getHeroFooterColumnLeftOptions(): array |
||
| 96 | { |
||
| 97 | return $this->heroFooterColumnLeftOptions; |
||
| 98 | } |
||
| 99 | |||
| 100 | public function getHeroFooterColumnRigth(): string |
||
| 101 | { |
||
| 102 | return $this->heroFooterColumnRigth; |
||
| 103 | } |
||
| 104 | |||
| 105 | public function getHeroFooterColumnRigthOptions(): array |
||
| 106 | { |
||
| 107 | return $this->heroFooterColumnRigthOptions; |
||
| 108 | } |
||
| 109 | |||
| 110 | public function getLanguage(): string |
||
| 111 | { |
||
| 112 | return $this->language; |
||
| 113 | } |
||
| 114 | |||
| 115 | public function getLogo(): string |
||
| 116 | { |
||
| 117 | return $this->logo; |
||
| 118 | } |
||
| 119 | |||
| 120 | public function getMenu(): array |
||
| 121 | { |
||
| 122 | return $this->menu; |
||
| 123 | } |
||
| 124 | |||
| 125 | public function getNavBarOptions(): array |
||
| 126 | { |
||
| 127 | return $this->navBarOptions; |
||
| 128 | } |
||
| 129 | |||
| 130 | public function getNavBarBrandOptions(): array |
||
| 131 | { |
||
| 132 | return $this->navBarBrandOptions; |
||
| 133 | } |
||
| 134 | |||
| 135 | public function getNavBarBrandLogoOptions(): array |
||
| 136 | { |
||
| 137 | return $this->navBarBrandLogoOptions; |
||
| 138 | } |
||
| 139 | |||
| 140 | public function getNavBarBrandTitleOptions(): array |
||
| 141 | { |
||
| 142 | return $this->navBarBrandTitleOptions; |
||
| 143 | } |
||
| 144 | |||
| 145 | public function getName(): string |
||
| 146 | { |
||
| 147 | return $this->name; |
||
| 148 | } |
||
| 149 | |||
| 150 | public function getLoggerLevels(): array |
||
| 151 | { |
||
| 152 | return $this->loggerLevels; |
||
| 153 | } |
||
| 154 | |||
| 155 | public function getLoggerFile(): string |
||
| 156 | { |
||
| 157 | return $this->loggerFile; |
||
| 158 | } |
||
| 159 | |||
| 160 | public function getMaxFileSize(): int |
||
| 161 | { |
||
| 162 | return $this->maxFileSize; |
||
| 163 | } |
||
| 164 | |||
| 165 | public function getMaxFiles(): int |
||
| 166 | { |
||
| 167 | return $this->maxFiles; |
||
| 168 | } |
||
| 169 | |||
| 170 | public function getFileMode(): ?int |
||
| 171 | { |
||
| 172 | return $this->fileMode; |
||
| 173 | } |
||
| 174 | |||
| 175 | public function getRotateByCopy(): ?bool |
||
| 176 | { |
||
| 177 | return $this->rotateByCopy; |
||
| 178 | } |
||
| 179 | |||
| 180 | public function brandUrl(string $value): self |
||
| 181 | { |
||
| 182 | $new = clone $this; |
||
| 183 | $new->brandUrl = $value; |
||
| 184 | return $new; |
||
| 185 | } |
||
| 186 | |||
| 187 | public function charset(string $value): self |
||
| 192 | } |
||
| 193 | |||
| 194 | public function heroOptions(array $value): self |
||
| 195 | { |
||
| 196 | $new = clone $this; |
||
| 197 | $new->heroOptions = $value; |
||
| 198 | return $new; |
||
| 199 | } |
||
| 200 | |||
| 201 | public function heroHeadOptions(array $value): self |
||
| 202 | { |
||
| 203 | $new = clone $this; |
||
| 204 | $new->heroHeadOptions = $value; |
||
| 205 | return $new; |
||
| 206 | } |
||
| 207 | |||
| 208 | public function heroContainerOptions(array $value): self |
||
| 209 | { |
||
| 210 | $new = clone $this; |
||
| 211 | $new->heroContainerOptions = $value; |
||
| 212 | return $new; |
||
| 213 | } |
||
| 214 | |||
| 215 | public function heroBodyOptions(array $value): self |
||
| 216 | { |
||
| 217 | $new = clone $this; |
||
| 218 | $new->heroBodyOptions = $value; |
||
| 219 | return $new; |
||
| 220 | } |
||
| 221 | |||
| 222 | public function heroFooterColumnOptions(array $value): self |
||
| 223 | { |
||
| 224 | $new = clone $this; |
||
| 225 | $new->heroFooterColumnOptions = $value; |
||
| 226 | return $new; |
||
| 227 | } |
||
| 228 | |||
| 229 | public function heroFooterColumnCenter(string $value): self |
||
| 230 | { |
||
| 231 | $new = clone $this; |
||
| 232 | $new->heroFooterColumnCenter = $value; |
||
| 233 | return $new; |
||
| 234 | } |
||
| 235 | |||
| 236 | public function heroFooterColumnCenterOptions(array $value): self |
||
| 237 | { |
||
| 238 | $new = clone $this; |
||
| 239 | $new->heroFooterColumnCenterOptions = $value; |
||
| 240 | return $new; |
||
| 241 | } |
||
| 242 | |||
| 243 | public function heroFooterColumnLeft(string $value): self |
||
| 244 | { |
||
| 245 | $new = clone $this; |
||
| 246 | $new->heroFooterColumnLeft = $value; |
||
| 247 | return $new; |
||
| 248 | } |
||
| 249 | |||
| 250 | public function heroFooterColumnLeftOptions(array $value): self |
||
| 251 | { |
||
| 252 | $new = clone $this; |
||
| 253 | $new->heroFooterColumnLeftOptions = $value; |
||
| 254 | return $new; |
||
| 255 | } |
||
| 256 | |||
| 257 | public function heroFooterColumnRigth(string $value): self |
||
| 258 | { |
||
| 259 | $new = clone $this; |
||
| 260 | $new->heroFooterColumnRigth = $value; |
||
| 261 | return $new; |
||
| 262 | } |
||
| 263 | |||
| 264 | public function heroFooterColumnRigthOptions(array $value): self |
||
| 265 | { |
||
| 266 | $new = clone $this; |
||
| 267 | $new->heroFooterColumnRigthOptions = $value; |
||
| 268 | return $new; |
||
| 269 | } |
||
| 270 | |||
| 271 | public function heroFooterOptions(array $value): self |
||
| 272 | { |
||
| 273 | $new = clone $this; |
||
| 274 | $new->heroFooterOptions = $value; |
||
| 275 | return $new; |
||
| 276 | } |
||
| 277 | |||
| 278 | public function language(string $value): self |
||
| 283 | } |
||
| 284 | |||
| 285 | public function logo(string $value): self |
||
| 286 | { |
||
| 287 | $new = clone $this; |
||
| 288 | $new->logo = $value; |
||
| 289 | return $new; |
||
| 290 | } |
||
| 291 | |||
| 292 | public function menu(array $value): self |
||
| 293 | { |
||
| 294 | $new = clone $this; |
||
| 295 | $new->menu = $value; |
||
| 296 | return $new; |
||
| 297 | } |
||
| 298 | |||
| 299 | public function navBarOptions(array $value): self |
||
| 304 | } |
||
| 305 | |||
| 306 | public function navBarBrandOptions(array $value): self |
||
| 307 | { |
||
| 308 | $new = clone $this; |
||
| 309 | $new->navBarBrandOptions = $value; |
||
| 310 | return $new; |
||
| 311 | } |
||
| 312 | |||
| 313 | public function navBarBrandLogoOptions(array $value): self |
||
| 314 | { |
||
| 315 | $new = clone $this; |
||
| 316 | $new->navBarBrandLogoOptions = $value; |
||
| 317 | return $new; |
||
| 318 | } |
||
| 319 | |||
| 320 | public function navBarBrandTitleOptions(array $value): self |
||
| 321 | { |
||
| 322 | $new = clone $this; |
||
| 323 | $new->navBarBrandTitleOptions = $value; |
||
| 324 | return $new; |
||
| 325 | } |
||
| 326 | |||
| 327 | public function name(string $value): self |
||
| 332 | } |
||
| 333 | |||
| 334 | public function loggerLevels(array $value): self |
||
| 335 | { |
||
| 336 | $new = clone $this; |
||
| 337 | $new->loggerLevels = $value; |
||
| 338 | return $new; |
||
| 339 | } |
||
| 340 | |||
| 341 | public function loggerFile(string $value): self |
||
| 342 | { |
||
| 343 | $new = clone $this; |
||
| 344 | $new->loggerFile = $value; |
||
| 345 | return $new; |
||
| 346 | } |
||
| 347 | |||
| 348 | public function maxFileSize(int $value): self |
||
| 349 | { |
||
| 350 | $new = clone $this; |
||
| 351 | $new->maxFileSize = $value; |
||
| 352 | return $new; |
||
| 353 | } |
||
| 354 | |||
| 355 | public function maxFiles(int $value): self |
||
| 356 | { |
||
| 357 | $new = clone $this; |
||
| 358 | $new->maxFiles = $value; |
||
| 359 | return $new; |
||
| 360 | } |
||
| 361 | |||
| 362 | public function fileMode(?int $value): self |
||
| 363 | { |
||
| 364 | $new = clone $this; |
||
| 365 | $new->fileMode = $value; |
||
| 367 | } |
||
| 368 | |||
| 369 | public function rotateByCopy(?bool $value): self |
||
| 370 | { |
||
| 374 | } |
||
| 375 | } |
||
| 376 |