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 |
||
| 38 | View Code Duplication | class SiteNotice extends Component { |
|
| 39 | |||
| 40 | /** |
||
| 41 | * Builds the HTML code for this component |
||
| 42 | * |
||
| 43 | * @return String the HTML code |
||
| 44 | */ |
||
| 45 | 7 | public function getHtml() { |
|
| 58 | |||
| 59 | } |
||
| 60 |