Conditions | 5 |
Paths | 12 |
Total Lines | 54 |
Code Lines | 31 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | 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); |
||
27 | public static function getServerStats() |
||
28 | { |
||
29 | //mb $wfdownloads = WfdownloadsWfdownloads::getInstance(); |
||
30 | $moduleDirName = \basename(\dirname(__DIR__, 2)); |
||
31 | $moduleDirNameUpper = \mb_strtoupper($moduleDirName); |
||
32 | \xoops_loadLanguage('common', $moduleDirName); |
||
33 | $html = ''; |
||
34 | // $sql = 'SELECT metavalue'; |
||
35 | // $sql .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta'); |
||
36 | // $sql .= " WHERE metakey='version' LIMIT 1"; |
||
37 | // $query = $GLOBALS['xoopsDB']->query($sql); |
||
38 | // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); |
||
39 | $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>" . \constant('CO_' . $moduleDirNameUpper . '_' . 'IMAGEINFO') . "</legend>\n"; |
||
40 | $html .= "<div style='padding: 8px;'>\n"; |
||
41 | // $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_' . 'METAVERSION') . $meta . "</div>\n"; |
||
42 | // $html .= "<br>\n"; |
||
43 | // $html .= "<br>\n"; |
||
44 | $html .= '<div>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'SPHPINI') . "</div>\n"; |
||
45 | $html .= "<ul>\n"; |
||
46 | |||
47 | $gdlib = \function_exists('gd_info') ? '<span style="color: green;">' . \constant('CO_' . $moduleDirNameUpper . '_' . 'GDON') . '</span>' : '<span style="color: red;">' . \constant('CO_' . $moduleDirNameUpper . '_' . 'GDOFF') . '</span>'; |
||
48 | $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'GDLIBSTATUS') . $gdlib; |
||
49 | if (\function_exists('gd_info')) { |
||
50 | $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'GDLIBSTATUS') . '<span style="color: #008000;">' . \constant('CO_' . $moduleDirNameUpper . '_' . 'GDON') . '</span>'; |
||
51 | $gdlib = \gd_info(); |
||
52 | if (!empty(($gdlib))) { |
||
53 | $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>'; |
||
54 | } |
||
55 | } else { |
||
56 | $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'GDLIBSTATUS') . '<span style="color: #ff0000;">' . \constant('CO_' . $moduleDirNameUpper . '_' . 'GDOFF') . '</span>'; |
||
57 | } |
||
58 | // |
||
59 | // $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_' . 'ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_' . 'OFF'); |
||
60 | // $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode; |
||
61 | // |
||
62 | // $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: green;\">" . constant('CO_' . $moduleDirNameUpper . '_' . 'OFF') . '</span>' : "<span style=\"color: red;\">" . constant('CO_' . $moduleDirNameUpper . '_' . 'ON') . '</span>'; |
||
63 | // $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; |
||
64 | // |
||
65 | $downloads = \ini_get('file_uploads') ? '<span style="color: green;">' . \constant('CO_' . $moduleDirNameUpper . '_' . 'ON') . '</span>' : '<span style="color: red;">' . \constant('CO_' . $moduleDirNameUpper . '_' . 'OFF') . '</span>'; |
||
66 | $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'SERVERUPLOADSTATUS') . $downloads; |
||
67 | |||
68 | $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . \ini_get('upload_max_filesize') . "</span></b>\n"; |
||
69 | $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'MAXPOSTSIZE') . ' <b><span style="color: blue;">' . \ini_get('post_max_size') . "</span></b>\n"; |
||
70 | $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'MEMORYLIMIT') . ' <b><span style="color: blue;">' . \ini_get('memory_limit') . "</span></b>\n"; |
||
71 | $html .= "</ul>\n"; |
||
72 | $html .= "<ul>\n"; |
||
73 | $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . "</b>\n"; |
||
74 | $html .= "</ul>\n"; |
||
75 | $html .= "<br>\n"; |
||
76 | $html .= \constant('CO_' . $moduleDirNameUpper . '_' . 'UPLOADPATHDSC') . "\n"; |
||
77 | $html .= '</div>'; |
||
78 | $html .= '</fieldset><br>'; |
||
79 | |||
80 | return $html; |
||
81 | } |
||
83 |