| Conditions | 17 | 
| Paths | 240 | 
| Total Lines | 55 | 
| Code Lines | 34 | 
| 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  | 
            ||
| 90 | function ShowAdminHelp()  | 
            ||
| 91 | { | 
            ||
| 92 | global $txt, $helptxt, $context, $scripturl, $boarddir, $boardurl;  | 
            ||
| 93 | |||
| 94 | if (!isset($_GET['help']) || !is_string($_GET['help']))  | 
            ||
| 95 | 		fatal_lang_error('no_access', false); | 
            ||
| 96 | |||
| 97 | if (!isset($helptxt))  | 
            ||
| 98 | $helptxt = array();  | 
            ||
| 99 | |||
| 100 | // Load the admin help language file and template.  | 
            ||
| 101 | 	loadLanguage('Help'); | 
            ||
| 102 | |||
| 103 | // Permission specific help?  | 
            ||
| 104 | if (isset($_GET['help']) && substr($_GET['help'], 0, 14) == 'permissionhelp')  | 
            ||
| 105 | 		loadLanguage('ManagePermissions'); | 
            ||
| 106 | |||
| 107 | 	loadTemplate('Help'); | 
            ||
| 108 | |||
| 109 | // Allow mods to load their own language file here  | 
            ||
| 110 | 	call_integration_hook('integrate_helpadmin'); | 
            ||
| 111 | |||
| 112 | // Set the page title to something relevant.  | 
            ||
| 113 | $context['page_title'] = $context['forum_name'] . ' - ' . $txt['help'];  | 
            ||
| 114 | |||
| 115 | // Don't show any template layers, just the popup sub template.  | 
            ||
| 116 | $context['template_layers'] = array();  | 
            ||
| 117 | $context['sub_template'] = 'popup';  | 
            ||
| 118 | |||
| 119 | // What help string should be used?  | 
            ||
| 120 | if (isset($helptxt[$_GET['help']]))  | 
            ||
| 121 | $context['help_text'] = $helptxt[$_GET['help']];  | 
            ||
| 122 | elseif (isset($txt[$_GET['help']]))  | 
            ||
| 123 | $context['help_text'] = $txt[$_GET['help']];  | 
            ||
| 124 | else  | 
            ||
| 125 | $context['help_text'] = $_GET['help'];  | 
            ||
| 126 | |||
| 127 | 	switch ($_GET['help']) { | 
            ||
| 128 | case 'cal_short_months':  | 
            ||
| 129 | $context['help_text'] = sprintf($context['help_text'], $txt['months_short'][1], $txt['months_titles'][1]);  | 
            ||
| 130 | break;  | 
            ||
| 131 | case 'cal_short_days':  | 
            ||
| 132 | $context['help_text'] = sprintf($context['help_text'], $txt['days_short'][1], $txt['days'][1]);  | 
            ||
| 133 | break;  | 
            ||
| 134 | case 'cron_is_real_cron':  | 
            ||
| 135 | 			$context['help_text'] = sprintf($context['help_text'], allowedTo('admin_forum') ? $boarddir : '[' . $txt['hidden'] . ']', $boardurl); | 
            ||
| 136 | break;  | 
            ||
| 137 | case 'queryless_urls':  | 
            ||
| 138 | $context['help_text'] = sprintf($context['help_text'], (isset($_SERVER['SERVER_SOFTWARE']) && (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'lighttpd') !== false) ? $helptxt['queryless_urls_supported'] : $helptxt['queryless_urls_unsupported']));  | 
            ||
| 139 | break;  | 
            ||
| 140 | }  | 
            ||
| 141 | |||
| 142 | // Does this text contain a link that we should fill in?  | 
            ||
| 143 | 	if (preg_match('~%([0-9]+\$)?s\?~', $context['help_text'], $match)) | 
            ||
| 144 | $context['help_text'] = sprintf($context['help_text'], $scripturl, $context['session_id'], $context['session_var']);  | 
            ||
| 145 | }  | 
            ||
| 147 | ?>  |