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 |
||
| 13 | class ImageController extends Controller |
||
| 14 | { |
||
| 15 | use ModelForm; |
||
|
|
|||
| 16 | |||
| 17 | /** |
||
| 18 | * Index interface. |
||
| 19 | * |
||
| 20 | * @return Content |
||
| 21 | */ |
||
| 22 | public function index() |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Edit interface. |
||
| 34 | * |
||
| 35 | * @param $id |
||
| 36 | * |
||
| 37 | * @return Content |
||
| 38 | */ |
||
| 39 | View Code Duplication | public function edit($id) |
|
| 48 | |||
| 49 | /** |
||
| 50 | * Create interface. |
||
| 51 | * |
||
| 52 | * @return Content |
||
| 53 | */ |
||
| 54 | public function create() |
||
| 62 | |||
| 63 | /** |
||
| 64 | * Make a grid builder. |
||
| 65 | * |
||
| 66 | * @return Grid |
||
| 67 | */ |
||
| 68 | View Code Duplication | protected function grid() |
|
| 79 | |||
| 80 | /** |
||
| 81 | * Make a form builder. |
||
| 82 | * |
||
| 83 | * @return Form |
||
| 84 | */ |
||
| 85 | protected function form() |
||
| 103 | } |
||
| 104 |
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.