| Conditions | 1 |
| Paths | 1 |
| Total Lines | 76 |
| 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 |
||
| 39 | public function add_debug_info( $debug_info ) { |
||
| 40 | $debug_info['auto-load-next-post'] = array( |
||
| 41 | 'label' => esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), |
||
| 42 | 'fields' => array( |
||
| 43 | // Theme Selectors |
||
| 44 | 'content_container' => array( |
||
| 45 | 'label' => esc_html__( 'Content Container', 'auto-load-next-post' ), |
||
| 46 | 'value' => get_option( 'auto_load_next_post_content_container', 'main.site-main' ), |
||
| 47 | 'private' => false, |
||
| 48 | ), |
||
| 49 | 'post_title_selector' => array( |
||
| 50 | 'label' => esc_html__( 'Post Title', 'auto-load-next-post' ), |
||
| 51 | 'value' => get_option( 'auto_load_next_post_title_selector', 'h1.entry-title' ), |
||
| 52 | 'private' => false, |
||
| 53 | ), |
||
| 54 | 'navigation_container' => array( |
||
| 55 | 'label' => esc_html__( 'Post Navigation', 'auto-load-next-post' ), |
||
| 56 | 'value' => get_option( 'auto_load_next_post_navigation_container', 'nav.post-navigation' ), |
||
| 57 | 'private' => false, |
||
| 58 | ), |
||
| 59 | 'comments_container' => array( |
||
| 60 | 'label' => esc_html__( 'Comments Container', 'auto-load-next-post' ), |
||
| 61 | 'value' => get_option( 'auto_load_next_post_comments_container', 'div#comments' ), |
||
| 62 | 'private' => false, |
||
| 63 | ), |
||
| 64 | |||
| 65 | // Templates |
||
| 66 | 'use_fallback' => array( |
||
| 67 | 'label' => esc_html__( 'Use Fallback?', 'auto-load-next-post' ), |
||
| 68 | 'value' => get_option( 'auto_load_next_post_use_fallback', 'no' ), |
||
| 69 | 'private' => false, |
||
| 70 | ), |
||
| 71 | |||
| 72 | // Misc |
||
| 73 | 'remove_comments' => array( |
||
| 74 | 'label' => esc_html__( 'Remove Comments', 'auto-load-next-post' ), |
||
| 75 | 'value' => get_option( 'auto_load_next_post_remove_comments', 'yes' ), |
||
| 76 | 'private' => false, |
||
| 77 | ), |
||
| 78 | 'google_analytics' => array( |
||
| 79 | 'label' => esc_html__( 'Update Google Analytics', 'auto-load-next-post' ), |
||
| 80 | 'value' => get_option( 'auto_load_next_post_google_analytics', 'no' ), |
||
| 81 | 'private' => false, |
||
| 82 | ), |
||
| 83 | 'load_js_in_footer' => array( |
||
| 84 | 'label' => esc_html__( 'JavaScript in Footer?', 'auto-load-next-post' ), |
||
| 85 | 'value' => get_option( 'auto_load_next_post_load_js_in_footer', 'no' ), |
||
| 86 | 'private' => false, |
||
| 87 | ), |
||
| 88 | 'disable_on_mobile' => array( |
||
| 89 | 'label' => esc_html__( 'Disable for Mobile?', 'auto-load-next-post' ), |
||
| 90 | 'value' => get_option( 'auto_load_next_post_disable_on_mobile', 'no' ), |
||
| 91 | 'private' => false, |
||
| 92 | ), |
||
| 93 | 'uninstall' => array( |
||
| 94 | 'label' => esc_html__( 'Remove all data on uninstall?', 'auto-load-next-post' ), |
||
| 95 | 'value' => get_option( 'auto_load_next_post_uninstall_data', 'no' ), |
||
| 96 | 'private' => false, |
||
| 97 | ), |
||
| 98 | |||
| 99 | // Events |
||
| 100 | 'on_load_event' => array( |
||
| 101 | 'label' => esc_html__( 'Post loaded', 'auto-load-next-post' ), |
||
| 102 | 'value' => get_option( 'auto_load_next_post_on_load_event', '' ), |
||
| 103 | 'private' => false, |
||
| 104 | ), |
||
| 105 | 'on_entering_event' => array( |
||
| 106 | 'label' => esc_html__( 'Entering a Post', 'auto-load-next-post' ), |
||
| 107 | 'value' => get_option( 'auto_load_next_post_on_entering_event', '' ), |
||
| 108 | 'private' => false, |
||
| 109 | ), |
||
| 110 | ), |
||
| 111 | ); |
||
| 112 | |||
| 113 | return $debug_info; |
||
| 114 | } // END add_debug_info() |
||
| 115 | |||
| 121 |