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 |
||
| 15 | class Text extends AbstractField |
||
| 16 | { |
||
| 17 | use Orderable; |
||
| 18 | use Nullable; |
||
| 19 | use Tooltip; |
||
| 20 | use Clipboard; |
||
| 21 | use Inline; |
||
| 22 | use Translatable; |
||
| 23 | use Maskable; |
||
| 24 | use Placeholder; |
||
| 25 | |||
| 26 | View Code Duplication | public function value(Request $request) |
|
| 35 | |||
| 36 | 1 | public function getListValue($model) |
|
| 48 | |||
| 49 | 1 | View Code Duplication | public function getEditFormValue($model) |
| 58 | |||
| 59 | 1 | public function getCreateFormValue() |
|
| 67 | } |
||
| 68 |