| Conditions | 1 |
| Paths | 1 |
| Total Lines | 126 |
| 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 |
||
| 13 | function get_menu_fixture() { |
||
| 14 | return array( |
||
| 15 | 2 => array( |
||
| 16 | 'Dashboard', |
||
| 17 | 'read', |
||
| 18 | 'index.php', |
||
| 19 | '', |
||
| 20 | 'menu-top menu-top-first menu-icon-dashboard', |
||
| 21 | 'menu-dashboard', |
||
| 22 | 'dashicons-dashboard', |
||
| 23 | ), |
||
| 24 | 3 => array( |
||
| 25 | 'Jetpack', |
||
| 26 | 'jetpack_admin_page', |
||
| 27 | 'jetpack', |
||
| 28 | 'Jetpack', |
||
| 29 | 'menu-top toplevel_page_jetpack', |
||
| 30 | 'toplevel_page_jetpack', |
||
| 31 | 'div', |
||
| 32 | ), |
||
| 33 | 4 => array( |
||
| 34 | '', |
||
| 35 | 'read', |
||
| 36 | 'separator1', |
||
| 37 | '', |
||
| 38 | 'wp-menu-separator', |
||
| 39 | ), |
||
| 40 | 10 => array( |
||
| 41 | 'Media', |
||
| 42 | 'upload_files', |
||
| 43 | 'upload.php', |
||
| 44 | '', |
||
| 45 | 'menu-top menu-icon-media', |
||
| 46 | 'menu-media', |
||
| 47 | 'dashicons-admin-media', |
||
| 48 | ), |
||
| 49 | 15 => array( |
||
| 50 | 'Links', |
||
| 51 | 'manage_links', |
||
| 52 | 'edit-tags.php?taxonomy=link_category', |
||
| 53 | '', |
||
| 54 | 'menu-top menu-icon-links', |
||
| 55 | 'menu-links', |
||
| 56 | 'dashicons-admin-links', |
||
| 57 | ), |
||
| 58 | 25 => array( |
||
| 59 | 'Comments <span class="awaiting-mod count-3"><span class="pending-count" aria-hidden="true">3</span><span class="comments-in-moderation-text screen-reader-text">3 Comments in moderation</span></span>', |
||
| 60 | 'edit_posts', |
||
| 61 | 'edit-comments.php', |
||
| 62 | '', |
||
| 63 | 'menu-top menu-icon-comments', |
||
| 64 | 'menu-comments', |
||
| 65 | 'dashicons-admin-comments', |
||
| 66 | ), |
||
| 67 | 5 => array( |
||
| 68 | 'Posts', |
||
| 69 | 'edit_posts', |
||
| 70 | 'edit.php', |
||
| 71 | '', |
||
| 72 | 'menu-top menu-icon-post open-if-no-js', |
||
| 73 | 'menu-posts', |
||
| 74 | 'dashicons-admin-post', |
||
| 75 | ), |
||
| 76 | 20 => array( |
||
| 77 | 'Pages', |
||
| 78 | 'edit_pages', |
||
| 79 | 'edit.php?post_type=page', |
||
| 80 | '', |
||
| 81 | 'menu-top menu-icon-page', |
||
| 82 | 'menu-pages', |
||
| 83 | 'dashicons-admin-page', |
||
| 84 | ), |
||
| 85 | 59 => array( |
||
| 86 | '', |
||
| 87 | 'read', |
||
| 88 | 'separator2', |
||
| 89 | '', |
||
| 90 | 'wp-menu-separator', |
||
| 91 | ), |
||
| 92 | 60 => array( |
||
| 93 | 'Appearance', |
||
| 94 | 'switch_themes', |
||
| 95 | 'themes.php', |
||
| 96 | '', |
||
| 97 | 'menu-top menu-icon-appearance', |
||
| 98 | 'menu-appearance', |
||
| 99 | 'dashicons-admin-appearance', |
||
| 100 | ), |
||
| 101 | 65 => array( |
||
| 102 | 'Plugins <span class="update-plugins count-4"><span class="plugin-count">4</span></span>', |
||
| 103 | 'activate_plugins', |
||
| 104 | 'plugins.php', |
||
| 105 | '', |
||
| 106 | 'menu-top menu-icon-plugins', |
||
| 107 | 'menu-plugins', |
||
| 108 | 'dashicons-admin-plugins', |
||
| 109 | ), |
||
| 110 | 70 => array( |
||
| 111 | 'Users <span class="update-plugins count-0"><span class="plugin-count">0</span></span>', |
||
| 112 | 'list_users', |
||
| 113 | 'users.php', |
||
| 114 | '', |
||
| 115 | 'menu-top menu-icon-users', |
||
| 116 | 'menu-users', |
||
| 117 | 'dashicons-admin-users', |
||
| 118 | ), |
||
| 119 | 75 => array( |
||
| 120 | 'Tools', |
||
| 121 | 'edit_posts', |
||
| 122 | 'tools.php', |
||
| 123 | '', |
||
| 124 | 'menu-top menu-icon-tools', |
||
| 125 | 'menu-tools', |
||
| 126 | 'dashicons-admin-tools', |
||
| 127 | ), |
||
| 128 | 80 => array( |
||
| 129 | 'Settings', |
||
| 130 | 'manage_options', |
||
| 131 | 'options-general.php', |
||
| 132 | '', |
||
| 133 | 'menu-top menu-icon-settings', |
||
| 134 | 'menu-settings', |
||
| 135 | 'dashicons-admin-settings', |
||
| 136 | ), |
||
| 137 | ); |
||
| 138 | } |
||
| 139 | |||
| 416 |