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 |
||
| 8 | class QuestionDeleteController extends AdminController |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Delete question. |
||
| 12 | * |
||
| 13 | * GET /admin/exam/edit/[i:id]/question/del/[i:qid] |
||
| 14 | * |
||
| 15 | * @param int $examID |
||
| 16 | * @param int $questionID |
||
| 17 | * |
||
| 18 | * @return string |
||
| 19 | */ |
||
| 20 | View Code Duplication | public function deleteAction(int $examID, int $questionID): string |
|
| 29 | |||
| 30 | /** |
||
| 31 | * Delete question post action. |
||
| 32 | * |
||
| 33 | * POST /admin/exam/edit/[i:id]/question/del/[i:qid] |
||
| 34 | * |
||
| 35 | * @param int $examID |
||
| 36 | * @param int $questionID |
||
| 37 | * |
||
| 38 | * @return void |
||
| 39 | */ |
||
| 40 | View Code Duplication | public function postDeleteAction(int $examID, int $questionID) |
|
| 54 | } |
||
| 55 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.