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 namespace Bedard\Shop\Controllers; |
||
| 12 | class Options extends BackendController |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * Create a new option. |
||
| 16 | * |
||
| 17 | * @return Response |
||
| 18 | */ |
||
| 19 | public function create() |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Validate an option. |
||
| 42 | * |
||
| 43 | * @return Response |
||
| 44 | */ |
||
| 45 | View Code Duplication | public function validate() |
|
| 58 | } |
||
| 59 |