| Conditions | 5 |
| Paths | 12 |
| Total Lines | 51 |
| 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 |
||
| 27 | public static function getServerStats() |
||
| 28 | { |
||
| 29 | $moduleDirName = basename(dirname(dirname(__DIR__))); |
||
| 30 | $moduleDirNameUpper = mb_strtoupper($moduleDirName); |
||
| 31 | xoops_loadLanguage('common', $moduleDirName); |
||
| 32 | $html = ''; |
||
| 33 | // $sql = 'SELECT metavalue'; |
||
| 34 | // $sql .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta'); |
||
| 35 | // $sql .= " WHERE metakey='version' LIMIT 1"; |
||
| 36 | // $query = $GLOBALS['xoopsDB']->query($sql); |
||
| 37 | // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); |
||
| 38 | $html .= '<fieldset>'; |
||
| 39 | $html .= "<legend style='font-weight: bold; color: #900;'>" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . '</legend>'; |
||
| 40 | $html .= "<div style='padding: 8px;'>"; |
||
| 41 | // $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>"; |
||
| 42 | // $html .= "<br>"; |
||
| 43 | // $html .= "<br>"; |
||
| 44 | $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . '</div>'; |
||
| 45 | $html .= '<ul>'; |
||
| 46 | |||
| 47 | $gdlib = function_exists('gd_info') ? '<span style="color: #008000;">' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: #ff0000;">' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>'; |
||
| 48 | $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; |
||
| 49 | if (function_exists('gd_info')) { |
||
| 50 | if (true === ($gdlib = gd_info())) { |
||
| 51 | $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>'; |
||
| 52 | } |
||
| 53 | } |
||
| 54 | |||
| 55 | // $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF'); |
||
| 56 | // $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode; |
||
| 57 | |||
| 58 | // $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: #008000;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: #ff0000;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>'; |
||
| 59 | // $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; |
||
| 60 | |||
| 61 | $downloads = ini_get('file_uploads') ? '<span style="color: #008000;">' . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: #ff0000;">' . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>'; |
||
| 62 | $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; |
||
| 63 | |||
| 64 | $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: #0000ff;">' . ini_get('upload_max_filesize') . '</span></b>'; |
||
| 65 | $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: #0000ff;">' . ini_get('post_max_size') . '</span></b>'; |
||
| 66 | $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: #0000ff;">' . ini_get('memory_limit') . '</span></b>'; |
||
| 67 | $html .= '</ul>'; |
||
| 68 | $html .= '<ul>'; |
||
| 69 | $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . '</b>'; |
||
| 70 | $html .= '</ul>'; |
||
| 71 | $html .= '<br>'; |
||
| 72 | $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . ''; |
||
| 73 | $html .= '</div>'; |
||
| 74 | $html .= '</fieldset><br>'; |
||
| 75 | |||
| 76 | return $html; |
||
| 77 | } |
||
| 78 | } |
||
| 79 |