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 acf_field_message extends acf_field { |
||
17 | |||
18 | |||
19 | /* |
||
20 | * __construct |
||
21 | * |
||
22 | * This function will setup the field type data |
||
23 | * |
||
24 | * @type function |
||
25 | * @date 5/03/2014 |
||
26 | * @since 5.0.0 |
||
27 | * |
||
28 | * @param n/a |
||
29 | * @return n/a |
||
30 | */ |
||
|
|||
31 | |||
32 | View Code Duplication | function __construct() { |
|
49 | |||
50 | |||
51 | /* |
||
52 | * render_field() |
||
53 | * |
||
54 | * Create the HTML interface for your field |
||
55 | * |
||
56 | * @param $field - an array holding all the field's data |
||
57 | * |
||
58 | * @type action |
||
59 | * @since 3.6 |
||
60 | * @date 23/01/13 |
||
61 | */ |
||
62 | |||
63 | function render_field( $field ) { |
||
97 | |||
98 | |||
99 | /* |
||
100 | * render_field_settings() |
||
101 | * |
||
102 | * Create extra options for your field. This is rendered when editing a field. |
||
103 | * The value of $field['name'] can be used (like bellow) to save extra data to the $field |
||
104 | * |
||
105 | * @param $field - an array holding all the field's data |
||
106 | * |
||
107 | * @type action |
||
108 | * @since 3.6 |
||
109 | * @date 23/01/13 |
||
110 | */ |
||
111 | |||
112 | function render_field_settings( $field ) { |
||
151 | |||
152 | } |
||
153 | |||
159 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.