| Conditions | 3 | 
| Paths | 3 | 
| Total Lines | 55 | 
| Code Lines | 33 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 1 | 
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  | 
            ||
| 41 | 		public function scripts() { | 
            ||
| 42 | global $pagenow;  | 
            ||
| 43 | |||
| 44 | // Bail if we are not on the plugins page  | 
            ||
| 45 | 			if ( $pagenow != "plugins.php" ) { | 
            ||
| 46 | return;  | 
            ||
| 47 | }  | 
            ||
| 48 | |||
| 49 | // Enqueue scripts  | 
            ||
| 50 | add_thickbox();  | 
            ||
| 51 | 			wp_enqueue_script('ayecode-deactivation-survey', plugin_dir_url(__FILE__) . 'ayecode-ds.js'); | 
            ||
| 52 | |||
| 53 | /*  | 
            ||
| 54 | * Localized strings. Strings can be localised by plugins using this class.  | 
            ||
| 55 | * We deliberately don't add textdomains here so that double textdomain warning is not given in theme review.  | 
            ||
| 56 | */  | 
            ||
| 57 | 			wp_localize_script('ayecode-deactivation-survey', 'ayecodeds_deactivate_feedback_form_strings', array( | 
            ||
| 58 | 'quick_feedback' => 'Quick Feedback',  | 
            ||
| 59 | 'foreword' => 'If you would be kind enough, please tell us why you\'re deactivating?',  | 
            ||
| 60 | 'better_plugins_name' => 'Please tell us which plugin?',  | 
            ||
| 61 | 'please_tell_us' => 'Please tell us the reason so we can improve the plugin',  | 
            ||
| 62 | 'do_not_attach_email' => 'Do not send my e-mail address with this feedback',  | 
            ||
| 63 | 'brief_description' => 'Please give us any feedback that could help us improve',  | 
            ||
| 64 | 'cancel' => 'Cancel',  | 
            ||
| 65 | 'skip_and_deactivate' => 'Skip & Deactivate',  | 
            ||
| 66 | 'submit_and_deactivate' => 'Submit & Deactivate',  | 
            ||
| 67 | 'please_wait' => 'Please wait',  | 
            ||
| 68 | 'get_support' => 'Get Support',  | 
            ||
| 69 | 'documentation' => 'Documentation',  | 
            ||
| 70 | 'thank_you' => 'Thank you!',  | 
            ||
| 71 | ));  | 
            ||
| 72 | |||
| 73 | // Plugins  | 
            ||
| 74 | 			$plugins = apply_filters('ayecode_deactivation_survey_plugins', self::$plugins); | 
            ||
| 75 | |||
| 76 | // Reasons  | 
            ||
| 77 | $defaultReasons = array(  | 
            ||
| 78 | 'suddenly-stopped-working' => 'The plugin suddenly stopped working',  | 
            ||
| 79 | 'plugin-broke-site' => 'The plugin broke my site',  | 
            ||
| 80 | 'plugin-setup-difficult' => 'Too difficult to setup',  | 
            ||
| 81 | 'no-longer-needed' => 'I don\'t need this plugin any more',  | 
            ||
| 82 | 'found-better-plugin' => 'I found a better plugin',  | 
            ||
| 83 | 'temporary-deactivation' => 'It\'s a temporary deactivation, I\'m troubleshooting',  | 
            ||
| 84 | 'other' => 'Other',  | 
            ||
| 85 | );  | 
            ||
| 86 | |||
| 87 | foreach($plugins as $plugin)  | 
            ||
| 88 | 			{ | 
            ||
| 89 | 				$plugin->reasons = apply_filters('ayecode_deactivation_survey_reasons', $defaultReasons, $plugin); | 
            ||
| 90 | $plugin->url = home_url();  | 
            ||
| 91 | $plugin->activated = 0;  | 
            ||
| 92 | }  | 
            ||
| 93 | |||
| 94 | // Send plugin data  | 
            ||
| 95 | 			wp_localize_script('ayecode-deactivation-survey', 'ayecodeds_deactivate_feedback_form_plugins', $plugins); | 
            ||
| 96 | |||
| 102 | }  |