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 |
||
| 3 | class acf_settings_addons { |
||
| 4 | |||
| 5 | var $view; |
||
| 6 | |||
| 7 | |||
| 8 | /* |
||
| 9 | * __construct |
||
| 10 | * |
||
| 11 | * Initialize filters, action, variables and includes |
||
| 12 | * |
||
| 13 | * @type function |
||
| 14 | * @date 23/06/12 |
||
| 15 | * @since 5.0.0 |
||
| 16 | * |
||
| 17 | * @param n/a |
||
| 18 | * @return n/a |
||
| 19 | */ |
||
|
|
|||
| 20 | |||
| 21 | function __construct() { |
||
| 26 | |||
| 27 | |||
| 28 | /* |
||
| 29 | * admin_menu |
||
| 30 | * |
||
| 31 | * This function will add the ACF menu item to the WP admin |
||
| 32 | * |
||
| 33 | * @type action (admin_menu) |
||
| 34 | * @date 28/09/13 |
||
| 35 | * @since 5.0.0 |
||
| 36 | * |
||
| 37 | * @param n/a |
||
| 38 | * @return n/a |
||
| 39 | */ |
||
| 40 | |||
| 41 | View Code Duplication | function admin_menu() { |
|
| 58 | |||
| 59 | |||
| 60 | /* |
||
| 61 | * load |
||
| 62 | * |
||
| 63 | * description |
||
| 64 | * |
||
| 65 | * @type function |
||
| 66 | * @date 7/01/2014 |
||
| 67 | * @since 5.0.0 |
||
| 68 | * |
||
| 69 | * @param $post_id (int) |
||
| 70 | * @return $post_id (int) |
||
| 71 | */ |
||
| 72 | |||
| 73 | function load() { |
||
| 95 | |||
| 96 | |||
| 97 | /* |
||
| 98 | * html |
||
| 99 | * |
||
| 100 | * description |
||
| 101 | * |
||
| 102 | * @type function |
||
| 103 | * @date 7/01/2014 |
||
| 104 | * @since 5.0.0 |
||
| 105 | * |
||
| 106 | * @param $post_id (int) |
||
| 107 | * @return $post_id (int) |
||
| 108 | */ |
||
| 109 | |||
| 110 | function html() { |
||
| 116 | |||
| 117 | } |
||
| 118 | |||
| 124 |
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.