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 EditableRadioField extends EditableMultipleOptionField |
||
17 | { |
||
18 | private static $singular_name = 'Radio Group'; |
||
19 | |||
20 | private static $plural_name = 'Radio Groups'; |
||
21 | |||
22 | private static $table_name = 'EditableRadioField'; |
||
23 | |||
24 | /** |
||
25 | * @return FieldList |
||
26 | */ |
||
27 | public function getCMSFields() |
||
35 | |||
36 | View Code Duplication | public function getFormField() |
|
49 | |||
50 | public function getSelectorField(EditableCustomRule $rule, $forOnLoad = false) |
||
56 | |||
57 | public function isRadioField() |
||
61 | } |
||
62 |