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 |
||
20 | class Field_Spacer extends Field |
||
|
|||
21 | { |
||
22 | /** |
||
23 | * The form field type. |
||
24 | * |
||
25 | * @var string |
||
26 | * @since 1.0 |
||
27 | */ |
||
28 | protected $type = 'Spacer'; |
||
29 | |||
30 | /** |
||
31 | * Method to get the field input markup for a spacer. |
||
32 | * The spacer does not have accept input. |
||
33 | * |
||
34 | * @return string The field input markup. |
||
35 | * |
||
36 | * @since 1.0 |
||
37 | */ |
||
38 | protected function getInput() |
||
42 | |||
43 | /** |
||
44 | * Method to get the field label markup for a spacer. |
||
45 | * Use the label text or name from the XML element as the spacer or |
||
46 | * Use a hr="true" to automatically generate plain hr markup |
||
47 | * |
||
48 | * @return string The field label markup. |
||
49 | * |
||
50 | * @since 1.0 |
||
51 | */ |
||
52 | protected function getLabel() |
||
101 | |||
102 | /** |
||
103 | * Method to get the field title. |
||
104 | * |
||
105 | * @return string The field title. |
||
106 | * |
||
107 | * @since 1.0 |
||
108 | */ |
||
109 | protected function getTitle() |
||
113 | } |
||
114 |
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.