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 |
||
5 | class CapturesResponse extends CapturesBase |
||
6 | { |
||
7 | /** |
||
8 | * Gets the 'status' parameter. |
||
9 | * |
||
10 | * @return Error[]|null The errors, if there were any |
||
11 | */ |
||
12 | View Code Duplication | public function getErrors() |
|
25 | |||
26 | /** |
||
27 | * Gets the 'matched_segments' parameter. |
||
28 | * |
||
29 | * @return Segment[] |
||
30 | */ |
||
31 | public function getMatchedSegments() |
||
41 | } |
||
42 |