Complex classes like ExcessivePublicCountSuppressionWorksForPublicStaticMethods 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 ExcessivePublicCountSuppressionWorksForPublicStaticMethods, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 23 | class ExcessivePublicCountSuppressionWorksForPublicStaticMethods |
||
| 24 | { |
||
| 25 | public static function aMethod() |
||
| 28 | |||
| 29 | public static function bMethod() |
||
| 32 | |||
| 33 | public static function cMethod() |
||
| 36 | |||
| 37 | public static function dMethod() |
||
| 40 | |||
| 41 | public static function eMethod() |
||
| 44 | |||
| 45 | public static function fMethod() |
||
| 48 | |||
| 49 | public static function gMethod() |
||
| 52 | |||
| 53 | public static function hMethod() |
||
| 56 | |||
| 57 | public static function iMethod() |
||
| 60 | |||
| 61 | public static function jMethod() |
||
| 64 | |||
| 65 | public static function kMethod() |
||
| 68 | |||
| 69 | public static function lMethod() |
||
| 72 | |||
| 73 | public static function mMethod() |
||
| 76 | |||
| 77 | public static function nMethod() |
||
| 80 | |||
| 81 | public static function oMethod() |
||
| 84 | |||
| 85 | public static function pMethod() |
||
| 88 | |||
| 89 | public static function rMethod() |
||
| 92 | |||
| 93 | public static function sMethod() |
||
| 96 | |||
| 97 | public static function tMethod() |
||
| 100 | |||
| 101 | public static function uMethod() |
||
| 104 | |||
| 105 | public static function wMethod() |
||
| 108 | |||
| 109 | public static function xMethod() |
||
| 112 | |||
| 113 | public static function yMethod() |
||
| 116 | |||
| 117 | public static function zMethod() |
||
| 120 | |||
| 121 | public static function aaMethod() |
||
| 124 | |||
| 125 | public static function abMethod() |
||
| 128 | |||
| 129 | public static function acMethod() |
||
| 132 | |||
| 133 | public static function adMethod() |
||
| 136 | |||
| 137 | public static function aeMethod() |
||
| 140 | |||
| 141 | public static function afMethod() |
||
| 144 | |||
| 145 | public static function agMethod() |
||
| 148 | |||
| 149 | public static function ahMethod() |
||
| 152 | |||
| 153 | public static function ajMethod() |
||
| 156 | |||
| 157 | public static function akMethod() |
||
| 160 | |||
| 161 | public static function alMethod() |
||
| 164 | |||
| 165 | public static function amMethod() |
||
| 168 | |||
| 169 | public static function anMethod() |
||
| 172 | |||
| 173 | public static function aoMethod() |
||
| 176 | |||
| 177 | public static function apMethod() |
||
| 180 | |||
| 181 | public static function arMethod() |
||
| 184 | |||
| 185 | public static function asMethod() |
||
| 188 | |||
| 189 | public static function atMethod() |
||
| 192 | |||
| 193 | public static function auMethod() |
||
| 196 | |||
| 197 | public static function awMethod() |
||
| 200 | |||
| 201 | public static function axMethod() |
||
| 204 | |||
| 205 | public static function ayMethod() |
||
| 208 | |||
| 209 | public static function azMethod() |
||
| 212 | |||
| 213 | public static function baMethod() |
||
| 216 | |||
| 217 | public static function bbMethod() |
||
| 220 | |||
| 221 | public static function bcMethod() |
||
| 224 | |||
| 225 | public static function bdMethod() |
||
| 228 | |||
| 229 | public static function beMethod() |
||
| 232 | |||
| 233 | public static function bfMethod() |
||
| 236 | |||
| 237 | public static function bgMethod() |
||
| 240 | |||
| 241 | public static function bhMethod() |
||
| 244 | |||
| 245 | public static function biMethod() |
||
| 248 | |||
| 249 | public static function bjMethod() |
||
| 252 | |||
| 253 | public static function bkMethod() |
||
| 256 | |||
| 257 | public static function blmethod() |
||
| 260 | |||
| 261 | public static function bmmethod() |
||
| 264 | |||
| 265 | public static function bnMethod() |
||
| 268 | |||
| 269 | public static function boMethod() |
||
| 272 | |||
| 273 | public static function bpMethod() |
||
| 276 | |||
| 277 | public static function brMethod() |
||
| 280 | |||
| 281 | public static function bsMethod() |
||
| 284 | |||
| 285 | public static function btMethod() |
||
| 288 | |||
| 289 | public static function buMethod() |
||
| 292 | |||
| 293 | public static function bwMethod() |
||
| 296 | |||
| 297 | public static function bxMethod() |
||
| 300 | |||
| 301 | public static function byMethod() |
||
| 304 | |||
| 305 | public static function bzMethod() |
||
| 308 | } |
||
| 309 |