Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
1 | <?php |
||
14 | class RevisionRollbacker extends Service { |
||
15 | |||
16 | /** |
||
17 | * @since 0.3 |
||
18 | * |
||
19 | * @param Revision $revision |
||
20 | * @param Title|null $title if using MW 1.24 of lower (https://gerrit.wikimedia.org/r/#/c/133063/) |
||
21 | * |
||
22 | * @return bool |
||
23 | */ |
||
24 | public function rollback( Revision $revision, Title $title = null ) { |
||
31 | |||
32 | /** |
||
33 | * @param Revision $revision |
||
34 | * @param Title|null $title |
||
35 | * |
||
36 | * @return array |
||
37 | */ |
||
38 | private function getRollbackParams( Revision $revision, $title ) { |
||
52 | |||
53 | /** |
||
54 | * @param Revision $revision |
||
55 | * |
||
56 | * @return string |
||
57 | */ |
||
58 | View Code Duplication | private function getTokenForRevision( Revision $revision ) { |
|
72 | |||
73 | } |
||
74 |
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.