Complex classes like EmptyCondition 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 EmptyCondition, and based on these observations, apply Extract Interface, too.
| 1 | <?php declare(strict_types=1); |
||
| 7 | abstract class EmptyCondition implements ConditionInterface, EmptyResourceInterface |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @return Image |
||
| 11 | */ |
||
| 12 | 2 | public function image() : Image |
|
| 16 | |||
| 17 | /** |
||
| 18 | * @return Location |
||
| 19 | */ |
||
| 20 | 2 | public function displayLocation() : Location |
|
| 24 | |||
| 25 | /** |
||
| 26 | * @return Location |
||
| 27 | */ |
||
| 28 | 2 | public function observationLocation() : Location |
|
| 32 | |||
| 33 | /** |
||
| 34 | * @return array |
||
| 35 | */ |
||
| 36 | 2 | public function estimated() : array |
|
| 40 | |||
| 41 | /** |
||
| 42 | * @return string |
||
| 43 | */ |
||
| 44 | 2 | public function stationId() : string |
|
| 48 | |||
| 49 | /** |
||
| 50 | * @return string |
||
| 51 | */ |
||
| 52 | 2 | public function observationTime() : string |
|
| 56 | |||
| 57 | /** |
||
| 58 | * @return string |
||
| 59 | */ |
||
| 60 | 2 | public function observationTimeRfc822() : string |
|
| 64 | |||
| 65 | /** |
||
| 66 | * @return string |
||
| 67 | */ |
||
| 68 | 2 | public function observationEpoch() : string |
|
| 72 | |||
| 73 | /** |
||
| 74 | * @return string |
||
| 75 | */ |
||
| 76 | 2 | public function localTimeRfc822() : string |
|
| 80 | |||
| 81 | /** |
||
| 82 | * @return string |
||
| 83 | */ |
||
| 84 | 2 | public function localEpoch() : string |
|
| 88 | |||
| 89 | /** |
||
| 90 | * @return string |
||
| 91 | */ |
||
| 92 | 2 | public function localTzShort() : string |
|
| 96 | |||
| 97 | /** |
||
| 98 | * @return string |
||
| 99 | */ |
||
| 100 | 2 | public function localTzLong() : string |
|
| 104 | |||
| 105 | /** |
||
| 106 | * @return string |
||
| 107 | */ |
||
| 108 | 2 | public function localTzOffset() : string |
|
| 112 | |||
| 113 | /** |
||
| 114 | * @return string |
||
| 115 | */ |
||
| 116 | 2 | public function weather() : string |
|
| 120 | |||
| 121 | /** |
||
| 122 | * @return string |
||
| 123 | */ |
||
| 124 | 2 | public function temperatureString() : string |
|
| 128 | |||
| 129 | /** |
||
| 130 | * @return float |
||
| 131 | */ |
||
| 132 | 2 | public function tempF() : float |
|
| 136 | |||
| 137 | /** |
||
| 138 | * @return float |
||
| 139 | */ |
||
| 140 | 2 | public function tempC() : float |
|
| 144 | |||
| 145 | /** |
||
| 146 | * @return string |
||
| 147 | */ |
||
| 148 | 2 | public function relativeHumidity() : string |
|
| 152 | |||
| 153 | /** |
||
| 154 | * @return string |
||
| 155 | */ |
||
| 156 | 2 | public function windString() : string |
|
| 160 | |||
| 161 | /** |
||
| 162 | * @return string |
||
| 163 | */ |
||
| 164 | 2 | public function windDir() : string |
|
| 168 | |||
| 169 | /** |
||
| 170 | * @return string |
||
| 171 | */ |
||
| 172 | 2 | public function windDegrees() : string |
|
| 176 | |||
| 177 | /** |
||
| 178 | * @return string |
||
| 179 | */ |
||
| 180 | 2 | public function windMph() : string |
|
| 184 | |||
| 185 | /** |
||
| 186 | * @return string |
||
| 187 | */ |
||
| 188 | 2 | public function windGustMph() : string |
|
| 192 | |||
| 193 | /** |
||
| 194 | * @return string |
||
| 195 | */ |
||
| 196 | 2 | public function windKph() : string |
|
| 200 | |||
| 201 | /** |
||
| 202 | * @return string |
||
| 203 | */ |
||
| 204 | 2 | public function windGustKph() : string |
|
| 208 | |||
| 209 | /** |
||
| 210 | * @return string |
||
| 211 | */ |
||
| 212 | 2 | public function pressureMb() : string |
|
| 216 | |||
| 217 | /** |
||
| 218 | * @return string |
||
| 219 | */ |
||
| 220 | 2 | public function pressureIn() : string |
|
| 224 | |||
| 225 | /** |
||
| 226 | * @return string |
||
| 227 | */ |
||
| 228 | 2 | public function pressureTrend() : string |
|
| 232 | |||
| 233 | /** |
||
| 234 | * @return string |
||
| 235 | */ |
||
| 236 | 2 | public function dewpointString() : string |
|
| 240 | |||
| 241 | /** |
||
| 242 | * @return int |
||
| 243 | */ |
||
| 244 | 2 | public function dewpointF() : int |
|
| 248 | |||
| 249 | /** |
||
| 250 | * @return int |
||
| 251 | */ |
||
| 252 | 2 | public function dewpointC() : int |
|
| 256 | |||
| 257 | /** |
||
| 258 | * @return string |
||
| 259 | */ |
||
| 260 | 2 | public function heatIndexString() : string |
|
| 264 | |||
| 265 | /** |
||
| 266 | * @return string |
||
| 267 | */ |
||
| 268 | 2 | public function heatIndexF() : string |
|
| 272 | |||
| 273 | /** |
||
| 274 | * @return string |
||
| 275 | */ |
||
| 276 | 2 | public function heatIndexC() : string |
|
| 280 | |||
| 281 | /** |
||
| 282 | * @return string |
||
| 283 | */ |
||
| 284 | 2 | public function windchillString() : string |
|
| 288 | |||
| 289 | /** |
||
| 290 | * @return string |
||
| 291 | */ |
||
| 292 | 2 | public function windchillF() : string |
|
| 296 | |||
| 297 | /** |
||
| 298 | * @return string |
||
| 299 | */ |
||
| 300 | 2 | public function windchillC() : string |
|
| 304 | |||
| 305 | /** |
||
| 306 | * @return string |
||
| 307 | */ |
||
| 308 | 2 | public function feelslikeString() : string |
|
| 312 | |||
| 313 | /** |
||
| 314 | * @return string |
||
| 315 | */ |
||
| 316 | 2 | public function feelslikeF() : string |
|
| 320 | |||
| 321 | /** |
||
| 322 | * @return string |
||
| 323 | */ |
||
| 324 | 2 | public function feelslikeC() : string |
|
| 328 | |||
| 329 | /** |
||
| 330 | * @return string |
||
| 331 | */ |
||
| 332 | 2 | public function visibilityMi() : string |
|
| 336 | |||
| 337 | /** |
||
| 338 | * @return string |
||
| 339 | */ |
||
| 340 | 2 | public function visibilityKm() : string |
|
| 344 | |||
| 345 | /** |
||
| 346 | * @return string |
||
| 347 | */ |
||
| 348 | 2 | public function solarradiation() : string |
|
| 352 | |||
| 353 | /** |
||
| 354 | * @return string |
||
| 355 | */ |
||
| 356 | 2 | public function uV() : string |
|
| 360 | |||
| 361 | /** |
||
| 362 | * @return string |
||
| 363 | */ |
||
| 364 | 2 | public function precip1hrString() : string |
|
| 368 | |||
| 369 | /** |
||
| 370 | * @return string |
||
| 371 | */ |
||
| 372 | 2 | public function precip1hrIn() : string |
|
| 376 | |||
| 377 | /** |
||
| 378 | * @return string |
||
| 379 | */ |
||
| 380 | 2 | public function precip1hrMetric() : string |
|
| 384 | |||
| 385 | /** |
||
| 386 | * @return string |
||
| 387 | */ |
||
| 388 | 2 | public function precipTodayString() : string |
|
| 392 | |||
| 393 | /** |
||
| 394 | * @return string |
||
| 395 | */ |
||
| 396 | 2 | public function precipTodayIn() : string |
|
| 400 | |||
| 401 | /** |
||
| 402 | * @return string |
||
| 403 | */ |
||
| 404 | 2 | public function precipTodayMetric() : string |
|
| 408 | |||
| 409 | /** |
||
| 410 | * @return string |
||
| 411 | */ |
||
| 412 | 2 | public function icon() : string |
|
| 416 | |||
| 417 | /** |
||
| 418 | * @return string |
||
| 419 | */ |
||
| 420 | 2 | public function iconUrl() : string |
|
| 424 | |||
| 425 | /** |
||
| 426 | * @return string |
||
| 427 | */ |
||
| 428 | 2 | public function forecastUrl() : string |
|
| 432 | |||
| 433 | /** |
||
| 434 | * @return string |
||
| 435 | */ |
||
| 436 | 2 | public function historyUrl() : string |
|
| 440 | |||
| 441 | /** |
||
| 442 | * @return string |
||
| 443 | */ |
||
| 444 | 2 | public function obUrl() : string |
|
| 448 | |||
| 449 | /** |
||
| 450 | * @return string |
||
| 451 | */ |
||
| 452 | 2 | public function nowcast() : string |
|
| 456 | } |
||
| 457 |