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 |
||
19 | class Name extends Property { |
||
20 | /** |
||
21 | * @inheritdocs |
||
22 | */ |
||
23 | 39 | public function name() { |
|
26 | |||
27 | /** |
||
28 | * @inheritdocs |
||
29 | */ |
||
30 | 4 | public function fetch_arguments(ArgumentParser $parser) { |
|
34 | |||
35 | /** |
||
36 | * @inheritdocs |
||
37 | */ |
||
38 | 27 | View Code Duplication | public function arguments_are_valid(array &$arguments) { |
48 | |||
49 | /** |
||
50 | * @inheritdocs |
||
51 | */ |
||
52 | 23 | public function compile(array &$arguments) { |
|
60 | } |
||
61 |