Conditions | 4 |
Paths | 4 |
Total Lines | 60 |
Code Lines | 53 |
Lines | 0 |
Ratio | 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 |
||
10 | public static function get_option_names( $type = 'compact' ) { |
||
11 | switch ( $type ) { |
||
12 | case 'non-compact' : |
||
13 | case 'non_compact' : |
||
14 | return array( |
||
15 | 'activated', |
||
16 | 'active_modules', |
||
17 | 'available_modules', |
||
18 | 'do_activate', |
||
19 | 'log', |
||
20 | 'publicize', |
||
21 | 'slideshow_background_color', |
||
22 | 'widget_twitter', |
||
23 | 'wpcc_options', |
||
24 | 'relatedposts', |
||
25 | 'file_data', |
||
26 | 'security_report', |
||
27 | 'autoupdate_plugins', // (array) An array of plugin ids ( eg. jetpack/jetpack ) that should be autoupdated |
||
28 | 'autoupdate_themes', // (array) An array of theme ids ( eg. twentyfourteen ) that should be autoupdated |
||
29 | 'autoupdate_core', // (bool) Whether or not to autoupdate core |
||
30 | 'json_api_full_management', // (bool) Allow full management (eg. Activate, Upgrade plugins) of the site via the JSON API. |
||
31 | 'sync_non_public_post_stati', // (bool) Allow synchronisation of posts and pages with non-public status. |
||
32 | 'site_icon_url', // (string) url to the full site icon |
||
33 | 'site_icon_id', // (int) Attachment id of the site icon file |
||
34 | 'dismissed_manage_banner', // (bool) Dismiss Jetpack manage banner allows the user to dismiss the banner permanently |
||
35 | 'restapi_stats_cache', // (array) Stats Cache data. |
||
36 | 'unique_connection', // (array) A flag to determine a unique connection to wordpress.com two values "connected" and "disconnected" with values for how many times each has occured |
||
37 | 'protect_whitelist' // (array) IP Address for the Protect module to ignore |
||
38 | ); |
||
39 | |||
40 | case 'private' : |
||
41 | return array( |
||
42 | 'register', |
||
43 | 'blog_token', // (string) The Client Secret/Blog Token of this site. |
||
44 | 'user_token', // (string) The User Token of this site. (deprecated) |
||
45 | 'user_tokens' // (array) User Tokens for each user of this site who has connected to jetpack.wordpress.com. |
||
46 | ); |
||
47 | } |
||
48 | |||
49 | return array( |
||
50 | 'id', // (int) The Client ID/WP.com Blog ID of this site. |
||
51 | 'publicize_connections', // (array) An array of Publicize connections from WordPress.com |
||
52 | 'master_user', // (int) The local User ID of the user who connected this site to jetpack.wordpress.com. |
||
53 | 'version', // (string) Used during upgrade procedure to auto-activate new modules. version:time |
||
54 | 'old_version', // (string) Used to determine which modules are the most recently added. previous_version:time |
||
55 | 'fallback_no_verify_ssl_certs', // (int) Flag for determining if this host must skip SSL Certificate verification due to misconfigured SSL. |
||
56 | 'time_diff', // (int) Offset between Jetpack server's clocks and this server's clocks. Jetpack Server Time = time() + (int) Jetpack_Options::get_option( 'time_diff' ) |
||
57 | 'public', // (int|bool) If we think this site is public or not (1, 0), false if we haven't yet tried to figure it out. |
||
58 | 'videopress', // (array) VideoPress options array. |
||
59 | 'is_network_site', // (int|bool) If we think this site is a network or a single blog (1, 0), false if we haven't yet tried to figue it out. |
||
60 | 'social_links', // (array) The specified links for each social networking site. |
||
61 | 'identity_crisis_whitelist', // (array) An array of options, each having an array of the values whitelisted for it. |
||
62 | 'gplus_authors', // (array) The Google+ authorship information for connected users. |
||
63 | 'last_heartbeat', // (int) The timestamp of the last heartbeat that fired. |
||
64 | 'last_security_report', // (int) The timestamp of the last security report that was run. |
||
65 | 'sync_bulk_reindexing', // (bool) If a bulk reindex is currently underway. |
||
66 | 'jumpstart', // (string) A flag for whether or not to show the Jump Start. Accepts: new_connection, jumpstart_activated, jetpack_action_taken, jumpstart_dismissed. |
||
67 | 'hide_jitm' // (array) A list of just in time messages that we should not show because they have been dismissed by the user |
||
68 | ); |
||
69 | } |
||
70 | |||
245 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.