XoopsModules25x/about

View on GitHub
class/Common/ServerStats.php

Summary

Maintainability
A
1 hr
Test Coverage

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

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

    Avoid assigning values to variables in if clauses and the like (line '49', column '27').
    Open

        public static function getServerStats()
        {
            $moduleDirName      = \basename(dirname(__DIR__, 2));
            $moduleDirNameUpper = mb_strtoupper($moduleDirName);
            \xoops_loadLanguage('common', $moduleDirName);
    Severity: Minor
    Found in class/Common/ServerStats.php by phpmd

    IfStatementAssignment

    Since: 2.7.0

    Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($foo = 'bar') { // possible typo
                // ...
            }
            if ($baz = 0) { // always false
                // ...
            }
        }
    }

    Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

    Line exceeds 120 characters; contains 150 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 242 characters
    Open

            $gdlib = \function_exists('gd_info') ? '<span style="color: #008000;">' . \constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: #ff0000;">' . \constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>';
    Severity: Minor
    Found in class/Common/ServerStats.php by phpcodesniffer

    Line exceeds 120 characters; contains 166 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 131 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 167 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

    Line exceeds 120 characters; contains 239 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 204 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 253 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 175 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

    There are no issues that match your filters.

    Category
    Status