Complex classes like DummyLinker 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 DummyLinker, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 6 | class DummyLinker { |
||
| 7 | |||
| 8 | /** |
||
| 9 | * @deprecated since 1.27 |
||
| 10 | */ |
||
| 11 | public function getInterwikiLinkAttributes( $title, $unused = null, $class = 'external' ) { |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @deprecated since 1.27 |
||
| 22 | */ |
||
| 23 | public function getInternalLinkAttributes( $title, $unused = null, $class = '' ) { |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @deprecated since 1.27 |
||
| 34 | */ |
||
| 35 | public function getInternalLinkAttributesObj( |
||
| 49 | |||
| 50 | public function getLinkColour( $t, $threshold ) { |
||
| 53 | |||
| 54 | public function link( |
||
| 69 | |||
| 70 | public function linkKnown( |
||
| 85 | |||
| 86 | public function makeSelfLinkObj( |
||
| 101 | |||
| 102 | public function getInvalidTitleDescription( |
||
| 113 | |||
| 114 | public function normaliseSpecialPage( Title $title ) { |
||
| 117 | |||
| 118 | public function makeExternalImage( $url, $alt = '' ) { |
||
| 121 | |||
| 122 | public function makeImageLink( |
||
| 143 | |||
| 144 | public function makeThumbLinkObj( |
||
| 165 | |||
| 166 | public function makeThumbLink2( |
||
| 183 | |||
| 184 | public function processResponsiveImages( $file, $thumb, $hp ) { |
||
| 191 | |||
| 192 | public function makeBrokenImageLinkObj( |
||
| 209 | |||
| 210 | public function makeMediaLinkObj( $title, $html = '', $time = false ) { |
||
| 217 | |||
| 218 | public function makeMediaLinkFile( Title $title, $file, $html = '' ) { |
||
| 225 | |||
| 226 | public function specialLink( $name, $key = '' ) { |
||
| 229 | |||
| 230 | public function makeExternalLink( |
||
| 247 | |||
| 248 | public function userLink( $userId, $userName, $altUserName = false ) { |
||
| 255 | |||
| 256 | public function userToolLinks( |
||
| 271 | |||
| 272 | public function userToolLinksRedContribs( $userId, $userText, $edits = null ) { |
||
| 279 | |||
| 280 | public function userTalkLink( $userId, $userText ) { |
||
| 283 | |||
| 284 | public function blockLink( $userId, $userText ) { |
||
| 287 | |||
| 288 | public function emailLink( $userId, $userText ) { |
||
| 291 | |||
| 292 | public function revUserLink( $rev, $isPublic = false ) { |
||
| 295 | |||
| 296 | public function revUserTools( $rev, $isPublic = false ) { |
||
| 299 | |||
| 300 | public function formatComment( |
||
| 313 | |||
| 314 | public function formatLinksInComment( |
||
| 327 | |||
| 328 | public function makeCommentLink( |
||
| 341 | |||
| 342 | public function normalizeSubpageLink( $contextTitle, $target, &$text ) { |
||
| 349 | |||
| 350 | public function commentBlock( |
||
| 363 | |||
| 364 | public function revComment( Revision $rev, $local = false, $isPublic = false ) { |
||
| 367 | |||
| 368 | public function formatRevisionSize( $size ) { |
||
| 371 | |||
| 372 | public function tocIndent() { |
||
| 375 | |||
| 376 | public function tocUnindent( $level ) { |
||
| 379 | |||
| 380 | public function tocLine( $anchor, $tocline, $tocnumber, $level, $sectionIndex = false ) { |
||
| 389 | |||
| 390 | public function tocLineEnd() { |
||
| 393 | |||
| 394 | public function tocList( $toc, $lang = false ) { |
||
| 397 | |||
| 398 | public function generateTOC( $tree, $lang = false ) { |
||
| 401 | |||
| 402 | public function makeHeadline( |
||
| 419 | |||
| 420 | public function splitTrail( $trail ) { |
||
| 423 | |||
| 424 | public function generateRollback( |
||
| 435 | |||
| 436 | public function getRollbackEditCount( $rev, $verify ) { |
||
| 439 | |||
| 440 | public function buildRollbackLink( |
||
| 451 | |||
| 452 | public function formatTemplates( |
||
| 465 | |||
| 466 | public function formatHiddenCategories( $hiddencats ) { |
||
| 469 | |||
| 470 | public function formatSize( $size ) { |
||
| 473 | |||
| 474 | public function titleAttrib( $name, $options = null, array $msgParams = [ ] ) { |
||
| 481 | |||
| 482 | public function accesskey( $name ) { |
||
| 485 | |||
| 486 | public function getRevDeleteLink( User $user, Revision $rev, Title $title ) { |
||
| 493 | |||
| 494 | public function revDeleteLink( $query = [ ], $restricted = false, $delete = true ) { |
||
| 501 | |||
| 502 | public function revDeleteLinkDisabled( $delete = true ) { |
||
| 505 | |||
| 506 | public function tooltipAndAccesskeyAttribs( $name, array $msgParams = [ ] ) { |
||
| 512 | |||
| 513 | public function tooltip( $name, $options = null ) { |
||
| 516 | |||
| 517 | } |
||
| 518 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.