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 |
||
| 16 | class Textarea extends AbstractField |
||
| 17 | { |
||
| 18 | use Orderable; |
||
| 19 | use Nullable; |
||
| 20 | use Tooltip; |
||
| 21 | use Clipboard; |
||
| 22 | use Inline; |
||
| 23 | use Translatable; |
||
| 24 | use Placeholder; |
||
| 25 | use Maxlength; |
||
| 26 | use Rows; |
||
| 27 | |||
| 28 | protected $expandable = false; |
||
| 29 | protected $resizable = false; |
||
| 30 | |||
| 31 | 1 | public function expandable(bool $expandable = true) |
|
| 37 | |||
| 38 | 2 | public function isExpandable() |
|
| 42 | |||
| 43 | 1 | public function resizable(bool $resizable = true) |
|
| 49 | |||
| 50 | 2 | public function isResizable() |
|
| 54 | |||
| 55 | 3 | View Code Duplication | public function value(Request $request) |
| 64 | |||
| 65 | 2 | View Code Duplication | public function getListView($model) |
| 77 | |||
| 78 | 1 | View Code Duplication | public function getEditFormView($model) |
| 87 | |||
| 88 | 1 | public function getCreateFormView() |
|
| 94 | } |
||
| 95 |