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 |
||
| 10 | class Checkbox extends AbstractField |
||
| 11 | { |
||
| 12 | use Orderable; |
||
| 13 | use Nullable; |
||
| 14 | use Inline; |
||
| 15 | |||
| 16 | 4 | View Code Duplication | public function value(Request $request) |
| 25 | |||
| 26 | 1 | public function getListView($model) |
|
| 33 | |||
| 34 | 1 | public function getEditFormView($model) |
|
| 43 | |||
| 44 | 1 | public function getCreateFormView() |
|
| 50 | |||
| 51 | 2 | public function oldOrAttribute($model, $locale = null) |
|
| 60 | } |
||
| 61 |