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 |
||
| 5 | class acf_pro { |
||
| 6 | |||
| 7 | /* |
||
| 8 | * __construct |
||
| 9 | * |
||
| 10 | * |
||
| 11 | * |
||
| 12 | * @type function |
||
| 13 | * @date 23/06/12 |
||
| 14 | * @since 5.0.0 |
||
| 15 | * |
||
| 16 | * @param N/A |
||
| 17 | * @return N/A |
||
| 18 | */ |
||
|
|
|||
| 19 | |||
| 20 | function __construct() { |
||
| 62 | |||
| 63 | |||
| 64 | /* |
||
| 65 | * include_field_types |
||
| 66 | * |
||
| 67 | * description |
||
| 68 | * |
||
| 69 | * @type function |
||
| 70 | * @date 21/10/2015 |
||
| 71 | * @since 5.2.3 |
||
| 72 | * |
||
| 73 | * @param $post_id (int) |
||
| 74 | * @return $post_id (int) |
||
| 75 | */ |
||
| 76 | |||
| 77 | function include_field_types() { |
||
| 84 | |||
| 85 | |||
| 86 | /* |
||
| 87 | * get_valid_field |
||
| 88 | * |
||
| 89 | * This function will provide compatibility with ACF4 fields |
||
| 90 | * |
||
| 91 | * @type function |
||
| 92 | * @date 23/04/2014 |
||
| 93 | * @since 5.0.0 |
||
| 94 | * |
||
| 95 | * @param $field (array) |
||
| 96 | * @return $field |
||
| 97 | */ |
||
| 98 | |||
| 99 | function get_valid_field( $field ) { |
||
| 116 | |||
| 117 | |||
| 118 | /* |
||
| 119 | * register_assets |
||
| 120 | * |
||
| 121 | * description |
||
| 122 | * |
||
| 123 | * @type function |
||
| 124 | * @date 4/11/2013 |
||
| 125 | * @since 5.0.0 |
||
| 126 | * |
||
| 127 | * @param $post_id (int) |
||
| 128 | * @return $post_id (int) |
||
| 129 | */ |
||
| 130 | |||
| 131 | function register_assets() { |
||
| 147 | |||
| 148 | |||
| 149 | /* |
||
| 150 | * input_admin_enqueue_scripts |
||
| 151 | * |
||
| 152 | * description |
||
| 153 | * |
||
| 154 | * @type function |
||
| 155 | * @date 4/11/2013 |
||
| 156 | * @since 5.0.0 |
||
| 157 | * |
||
| 158 | * @param $post_id (int) |
||
| 159 | * @return $post_id (int) |
||
| 160 | */ |
||
| 161 | |||
| 162 | function input_admin_enqueue_scripts() { |
||
| 172 | |||
| 173 | |||
| 174 | /* |
||
| 175 | * field_group_admin_l10n |
||
| 176 | * |
||
| 177 | * description |
||
| 178 | * |
||
| 179 | * @type function |
||
| 180 | * @date 1/05/2014 |
||
| 181 | * @since 5.0.0 |
||
| 182 | * |
||
| 183 | * @param $post_id (int) |
||
| 184 | * @return $post_id (int) |
||
| 185 | */ |
||
| 186 | |||
| 187 | function field_group_admin_l10n( $l10n ) { |
||
| 198 | |||
| 199 | |||
| 200 | /* |
||
| 201 | * field_group_admin_enqueue_scripts |
||
| 202 | * |
||
| 203 | * description |
||
| 204 | * |
||
| 205 | * @type function |
||
| 206 | * @date 4/11/2013 |
||
| 207 | * @since 5.0.0 |
||
| 208 | * |
||
| 209 | * @param $post_id (int) |
||
| 210 | * @return $post_id (int) |
||
| 211 | */ |
||
| 212 | |||
| 213 | function field_group_admin_enqueue_scripts() { |
||
| 223 | |||
| 224 | |||
| 225 | |||
| 226 | /* |
||
| 227 | * prepare_field_for_export |
||
| 228 | * |
||
| 229 | * description |
||
| 230 | * |
||
| 231 | * @type function |
||
| 232 | * @date 11/03/2014 |
||
| 233 | * @since 5.0.0 |
||
| 234 | * |
||
| 235 | * @param $post_id (int) |
||
| 236 | * @return $post_id (int) |
||
| 237 | */ |
||
| 238 | |||
| 239 | function prepare_field_for_export( $field ) { |
||
| 266 | |||
| 267 | |||
| 268 | /* |
||
| 269 | * prepare_field_for_import |
||
| 270 | * |
||
| 271 | * description |
||
| 272 | * |
||
| 273 | * @type function |
||
| 274 | * @date 11/03/2014 |
||
| 275 | * @since 5.0.0 |
||
| 276 | * |
||
| 277 | * @param $post_id (int) |
||
| 278 | * @return $post_id (int) |
||
| 279 | */ |
||
| 280 | |||
| 281 | function prepare_field_for_import( $field ) { |
||
| 396 | |||
| 397 | } |
||
| 398 | |||
| 408 |
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.