XoopsModules25x/xoopspoll

View on GitHub
class/Common/ServerStats.php

Summary

Maintainability
A
1 hr
Test Coverage

Method getServerStats has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getServerStats(): string
    {
        //mb    $wfdownloads = WfdownloadsWfdownloads::getInstance();
        $moduleDirName      = \basename(\dirname(__DIR__, 2));
        $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
Severity: Minor
Found in class/Common/ServerStats.php - About 1 hr to fix

    The method getServerStats uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'GDLIBSTATUS') . '<span style="color: #ff0000;">' . \constant('CO_' . $moduleDirNameUpper . '_' . 'GDOFF') . '</span>';
            }
    Severity: Minor
    Found in class/Common/ServerStats.php by phpmd

    ElseExpression

    Since: 1.4.0

    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($flag) {
                // one branch
            } else {
                // another branch
            }
        }
    }

    Source https://phpmd.org/rules/cleancode.html#elseexpression

    Line exceeds 120 characters; contains 180 characters
    Open

            $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'MAXUPLOADSIZE') . ' <b><span style="color: #0000ff;">' . \ini_get('upload_max_filesize') . "</span></b>\n";
    Severity: Minor
    Found in class/Common/ServerStats.php by phpcodesniffer

    Line exceeds 120 characters; contains 195 characters
    Open

                $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'GDLIBSTATUS') . '<span style="color: #ff0000;">' . \constant('CO_' . $moduleDirNameUpper . '_' . 'GDOFF') . '</span>';
    Severity: Minor
    Found in class/Common/ServerStats.php by phpcodesniffer

    Line exceeds 120 characters; contains 249 characters
    Open

            $downloads = \ini_get('file_uploads') ? '<span style="color: #008000;">' . \constant('CO_' . $moduleDirNameUpper . '_' . 'ON') . '</span>' : '<span style="color: #ff0000;">' . \constant('CO_' . $moduleDirNameUpper . '_' . 'OFF') . '</span>';
    Severity: Minor
    Found in class/Common/ServerStats.php by phpcodesniffer

    Line exceeds 120 characters; contains 171 characters
    Open

            $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'MEMORYLIMIT') . ' <b><span style="color: #0000ff;">' . \ini_get('memory_limit') . "</span></b>\n";
    Severity: Minor
    Found in class/Common/ServerStats.php by phpcodesniffer

    Line exceeds 120 characters; contains 155 characters
    Open

            $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>" . \constant('CO_' . $moduleDirNameUpper . '_' . 'IMAGEINFO') . "</legend>\n";
    Severity: Minor
    Found in class/Common/ServerStats.php by phpcodesniffer

    Line exceeds 120 characters; contains 124 characters
    Open

            $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . "</b>\n";
    Severity: Minor
    Found in class/Common/ServerStats.php by phpcodesniffer

    Line exceeds 120 characters; contains 219 characters
    Open

            //    $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_' . 'ON') . constant('CO_' . $moduleDirNameUpper . '_' . 'SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_' . 'OFF');
    Severity: Minor
    Found in class/Common/ServerStats.php by phpcodesniffer

    Line exceeds 120 characters; contains 136 characters
    Open

                    $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>';
    Severity: Minor
    Found in class/Common/ServerStats.php by phpcodesniffer

    Line exceeds 120 characters; contains 195 characters
    Open

                $html  .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'GDLIBSTATUS') . '<span style="color: #008000;">' . \constant('CO_' . $moduleDirNameUpper . '_' . 'GDON') . '</span>';
    Severity: Minor
    Found in class/Common/ServerStats.php by phpcodesniffer

    Line exceeds 120 characters; contains 263 characters
    Open

            //    $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: green;\">" . constant('CO_' . $moduleDirNameUpper . '_' . 'OFF') . '</span>' : "<span style=\"color: red;\">" . constant('CO_' . $moduleDirNameUpper . '_' . 'ON') . '</span>';
    Severity: Minor
    Found in class/Common/ServerStats.php by phpcodesniffer

    Line exceeds 120 characters; contains 172 characters
    Open

            $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_' . 'MAXPOSTSIZE') . ' <b><span style="color: #0000ff;">' . \ini_get('post_max_size') . "</span></b>\n";
    Severity: Minor
    Found in class/Common/ServerStats.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status