| Conditions | 14 | 
| Paths | 5 | 
| Total Lines | 228 | 
| Code Lines | 123 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 2 | ||
| 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 | ||
| 21 | static function general_about_server ( | ||
| 22 | /** @noinspection PhpUnusedParameterInspection */ | ||
| 23 | $route_ids, | ||
| 1 ignored issue–
                            show | |||
| 24 | $route_path | ||
| 25 | 	) { | ||
| 26 | $Core = Core::instance(); | ||
| 27 | $Index = Index::instance(); | ||
| 28 | $L = Language::instance(); | ||
| 29 | 		if (isset($route_path[2])) { | ||
| 30 | interface_off(); | ||
| 31 | $Index->form = false; | ||
| 32 | 			switch ($route_path[2]) { | ||
| 33 | case 'phpinfo': | ||
| 34 | $Index->Content = ob_wrapper( | ||
| 35 | 						function () { | ||
| 36 | phpinfo(); | ||
| 37 | } | ||
| 38 | ); | ||
| 39 | break; | ||
| 40 | case 'readme.html': | ||
| 41 | $Index->Content = file_get_contents(DIR.'/readme.html'); | ||
| 42 | } | ||
| 43 | return; | ||
| 44 | } | ||
| 45 | 		$hhvm_version = defined('HHVM_VERSION') ? HHVM_VERSION : false; | ||
| 46 | $Index->form = false; | ||
| 47 | $Index->content( | ||
| 48 | 			h::{'div.cs-text-right'}( | ||
| 49 | 				h::{'a[is=cs-link-button][target=_blank]'}( | ||
| 50 | 'phpinfo()', | ||
| 51 | [ | ||
| 52 | 'href' => "$Index->action/phpinfo" | ||
| 53 | ] | ||
| 54 | ). | ||
| 55 | 				h::{'a[is=cs-link-button][icon=info][target=_blank]'}( | ||
| 56 | $L->information_about_system, | ||
| 57 | [ | ||
| 58 | 'href' => "$Index->action/readme.html" | ||
| 59 | ] | ||
| 60 | ). | ||
| 61 | 				h::{'button[is=cs-button][icon=legal]'}( | ||
| 62 | $L->license | ||
| 63 | ). | ||
| 64 | 				h::{'section[is=cs-section-modal] pre'}( | ||
| 65 | file_get_contents(DIR.'/license.txt') | ||
| 66 | ) | ||
| 67 | ). | ||
| 68 | static::vertical_table( | ||
| 69 | [ | ||
| 70 | "$L->operation_system:", | ||
| 71 | 					php_uname('s').' '.php_uname('r').' '.php_uname('v') | ||
| 72 | ], | ||
| 73 | [ | ||
| 74 | "$L->server_type:", | ||
| 75 | self::server_api() | ||
| 76 | ], | ||
| 77 | stripos($_SERVER['SERVER_SOFTWARE'], 'apache') !== false ? [ | ||
| 78 | 					$L->version_of('Apache').':', | ||
| 79 | self::apache_version() | ||
| 80 | ] : false, | ||
| 81 | stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false ? [ | ||
| 82 | 					$L->version_of('Nginx').':', | ||
| 83 | 					explode('/', $_SERVER['SERVER_SOFTWARE'])[1] | ||
| 84 | ] : false, | ||
| 85 | $hhvm_version ? [ | ||
| 86 | 					$L->version_of('HHVM').':', | ||
| 87 | $hhvm_version | ||
| 88 | ] : false, | ||
| 89 | $hhvm_version ? false : [ | ||
| 90 | "$L->available_ram:", | ||
| 91 | str_replace( | ||
| 92 | ['K', 'M', 'G'], | ||
| 93 | [" $L->KB", " $L->MB", " $L->GB"], | ||
| 94 | 						ini_get('memory_limit') | ||
| 95 | ) | ||
| 96 | ], | ||
| 97 | [ | ||
| 98 | 					$L->version_of('PHP').':', | ||
| 99 | PHP_VERSION | ||
| 100 | ], | ||
| 101 | [ | ||
| 102 | "$L->php_components:", | ||
| 103 | 					h::{'table.cs-table tr| td'}( | ||
| 104 | [ | ||
| 105 | "$L->openssl:", | ||
| 106 | [ | ||
| 107 | 								extension_loaded('openssl') ? $L->on : $L->off.' '.h::icon('info-circle', ['tooltip' => $L->openssl_warning]), | ||
| 108 | [ | ||
| 109 | 									'class' => self::state(extension_loaded('openssl')) | ||
| 110 | ] | ||
| 111 | ] | ||
| 112 | ], | ||
| 113 | [ | ||
| 114 | "$L->curl_lib:", | ||
| 115 | [ | ||
| 116 | 								$L->get(extension_loaded('curl')), | ||
| 117 | [ | ||
| 118 | 									'class' => self::state(extension_loaded('curl')) | ||
| 119 | ] | ||
| 120 | ] | ||
| 121 | ], | ||
| 122 | [ | ||
| 123 | "$L->apcu_module:", | ||
| 124 | [ | ||
| 125 | 								$L->get(extension_loaded('apcu')), | ||
| 126 | [ | ||
| 127 | 									'class' => self::state(extension_loaded('apcu')) | ||
| 128 | ] | ||
| 129 | ] | ||
| 130 | ], | ||
| 131 | [ | ||
| 132 | "$L->memcached_module:", | ||
| 133 | [ | ||
| 134 | 								$L->get(extension_loaded('memcached')) | ||
| 135 | ] | ||
| 136 | ] | ||
| 137 | ) | ||
| 138 | ], | ||
| 139 | [ | ||
| 140 | "$L->main_db:", | ||
| 141 | $Core->db_type | ||
| 142 | ], | ||
| 143 | [ | ||
| 144 | "$L->properties $Core->db_type:", | ||
| 145 | 					h::{'table.cs-table tr| td'}( | ||
| 146 | [ | ||
| 147 | "$L->host:", | ||
| 148 | $Core->db_host | ||
| 149 | ], | ||
| 150 | [ | ||
| 151 | $L->version_of($Core->db_type).':', | ||
| 152 | [ | ||
| 153 | DB::instance()->server() | ||
| 154 | ] | ||
| 155 | ], | ||
| 156 | [ | ||
| 157 | "$L->name_of_db:", | ||
| 158 | $Core->db_name | ||
| 159 | ], | ||
| 160 | [ | ||
| 161 | "$L->prefix_for_db_tables:", | ||
| 162 | $Core->db_prefix | ||
| 163 | ] | ||
| 164 | ) | ||
| 165 | ], | ||
| 166 | [ | ||
| 167 | "$L->main_storage:", | ||
| 168 | $Core->storage_type | ||
| 169 | ], | ||
| 170 | [ | ||
| 171 | "$L->cache_engine:", | ||
| 172 | $Core->cache_engine | ||
| 173 | ], | ||
| 174 | [ | ||
| 175 | "$L->free_disk_space:", | ||
| 176 | 					format_filesize(disk_free_space('./'), 2) | ||
| 177 | ], | ||
| 178 | [ | ||
| 179 | "$L->php_ini_settings:", | ||
| 180 | 					h::{'table.cs-table tr| td'}( | ||
| 181 | [ | ||
| 182 | "$L->allow_file_upload:", | ||
| 183 | [ | ||
| 184 | 								$L->get(ini_get('file_uploads')), | ||
| 185 | [ | ||
| 186 | 									'class' => self::state(ini_get('file_uploads')) | ||
| 187 | ] | ||
| 188 | ] | ||
| 189 | ], | ||
| 190 | $hhvm_version ? false : [ | ||
| 191 | "$L->max_file_uploads:", | ||
| 192 | 							ini_get('max_file_uploads') | ||
| 193 | ], | ||
| 194 | [ | ||
| 195 | "$L->upload_limit:", | ||
| 196 | format_filesize( | ||
| 197 | str_replace( | ||
| 198 | ['K', 'M', 'G'], | ||
| 199 | [" $L->KB", " $L->MB", " $L->GB"], | ||
| 200 | 									ini_get('upload_max_filesize') | ||
| 201 | ) | ||
| 202 | ) | ||
| 203 | ], | ||
| 204 | [ | ||
| 205 | "$L->post_max_size:", | ||
| 206 | format_filesize( | ||
| 207 | str_replace( | ||
| 208 | ['K', 'M', 'G'], | ||
| 209 | [" $L->KB", " $L->MB", " $L->GB"], | ||
| 210 | 									ini_get('post_max_size') | ||
| 211 | ) | ||
| 212 | ) | ||
| 213 | ], | ||
| 214 | $hhvm_version ? false : [ | ||
| 215 | "$L->max_execution_time:", | ||
| 216 | 							format_time(ini_get('max_execution_time')) | ||
| 217 | ], | ||
| 218 | $hhvm_version ? false : [ | ||
| 219 | "$L->max_input_time:", | ||
| 220 | 							format_time(ini_get('max_input_time')) | ||
| 221 | ], | ||
| 222 | $hhvm_version ? false : [ | ||
| 223 | "$L->default_socket_timeout:", | ||
| 224 | 							format_time(ini_get('default_socket_timeout')) | ||
| 225 | ], | ||
| 226 | [ | ||
| 227 | "$L->allow_url_fopen:", | ||
| 228 | [ | ||
| 229 | 								$L->get(ini_get('allow_url_fopen')), | ||
| 230 | [ | ||
| 231 | 									'class' => self::state(ini_get('allow_url_fopen')) | ||
| 232 | ] | ||
| 233 | ] | ||
| 234 | ], | ||
| 235 | [ | ||
| 236 | "$L->display_errors:", | ||
| 237 | [ | ||
| 238 | 								$L->get((bool)ini_get('display_errors')), | ||
| 239 | [ | ||
| 240 | 									'class' => self::state(!ini_get('display_errors')) | ||
| 241 | ] | ||
| 242 | ] | ||
| 243 | ] | ||
| 244 | ) | ||
| 245 | ] | ||
| 246 | ) | ||
| 247 | ); | ||
| 248 | } | ||
| 249 | 	static private function state ($state) { | ||
| 360 | 
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.