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 |
||
| 11 | View Code Duplication | class SearchUsers extends BaseUser |
|
| 12 | { |
||
| 13 | /** |
||
| 14 | * Search users by name. |
||
| 15 | * |
||
| 16 | * @param Request $request |
||
| 17 | * @param Response $response |
||
| 18 | * @param array $args |
||
| 19 | * @return array |
||
| 20 | */ |
||
| 21 | public function __invoke($request, $response, $args) |
||
| 32 | } |
||
| 33 |