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