Conditions | 3 |
Paths | 2 |
Total Lines | 53 |
Code Lines | 46 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
28 | public function render() { |
||
29 | ?> |
||
30 | <!-- Category Start--> |
||
31 | <h4><?php _e( 'Select the post type from which you want to delete posts by category', 'bulk-delete' ); ?></h4> |
||
32 | <fieldset class="options"> |
||
33 | <table class="optiontable"> |
||
34 | <?php bd_render_post_type_dropdown( 'cats' ); ?> |
||
35 | </table> |
||
36 | |||
37 | <h4><?php _e( 'Select the categories from which you wan to delete posts', 'bulk-delete' ); ?></h4> |
||
38 | <p><?php _e( 'Note: The post count below for each category is the total number of posts in that category, irrespective of post type', 'bulk-delete' ); ?>.</p> |
||
39 | <?php |
||
40 | $bd_select2_ajax_limit_categories = apply_filters( 'bd_select2_ajax_limit_categories', $this->cat_limit ); |
||
41 | |||
42 | $categories = get_categories( array( |
||
43 | 'hide_empty' => false, |
||
44 | 'number' => $bd_select2_ajax_limit_categories, |
||
45 | ) |
||
46 | ); |
||
47 | ?> |
||
48 | <table class="form-table"> |
||
49 | <tr> |
||
50 | <td scope="row"> |
||
51 | <?php if( count($categories) >= $bd_select2_ajax_limit_categories ){?> |
||
52 | <select class="select2Ajax" name="smbd_cats[]" data-taxonomy="category" multiple data-placeholder="<?php _e( 'Select Categories', 'bulk-delete' ); ?>"> |
||
53 | <option value="all" selected="selected"><?php _e( 'All Categories', 'bulk-delete' ); ?></option> |
||
54 | </select> |
||
55 | <?php }else{?> |
||
56 | <select class="select2" name="smbd_cats[]" multiple data-placeholder="<?php _e( 'Select Categories', 'bulk-delete' ); ?>"> |
||
57 | <option value="all" selected="selected"><?php _e( 'All Categories', 'bulk-delete' ); ?></option> |
||
58 | <?php foreach ( $categories as $category ) { ?> |
||
59 | <option value="<?php echo $category->cat_ID; ?>"><?php echo $category->cat_name, ' (', $category->count, ' ', __( 'Posts', 'bulk-delete' ), ')'; ?></option> |
||
60 | <?php } ?> |
||
61 | </select> |
||
62 | <?php }?> |
||
63 | </td> |
||
64 | </tr> |
||
65 | </table> |
||
66 | |||
67 | <table class="optiontable"> |
||
68 | <?php |
||
69 | $this->render_filtering_table_header(); |
||
70 | $this->render_restrict_settings(); |
||
71 | $this->render_delete_settings(); |
||
72 | $this->render_private_post_settings(); |
||
73 | $this->render_limit_settings(); |
||
74 | $this->render_cron_settings(); |
||
75 | ?> |
||
76 | </table> |
||
77 | |||
78 | </fieldset> |
||
79 | <?php |
||
80 | $this->render_submit_button( 'delete_posts_by_category' ); |
||
|
|||
81 | } |
||
132 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.