XoopsModules25x/xfguestbook

View on GitHub

Showing 1,027 of 1,027 total issues

Avoid unused local variables such as '$arr'.
Open

    $arr    = [];
Severity: Minor
Found in admin/upgrade.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid using static access to class '\Xmf\Database\TableLoad' in method 'loadSampleData'.
Open

        TableLoad::loadTableFromArray($table, $tabledata);
Severity: Minor
Found in testdata/index.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

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

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

    } else {
        echo "SQL file found at <b>$sql_file_path</b>.<br > Creating tables...<br>";
        //      $msg = "SQL file found at <b>$sql_file_path</b>.<br > Creating tables...<br>";
        require_once XOOPS_ROOT_PATH . '/class/database/sqlutility.php';
        $sql_query = fread(fopen($sql_file_path, 'rb'), filesize($sql_file_path));
Severity: Minor
Found in include/cp_functions.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

Avoid using static access to class '\Xmf\Yaml' in method 'showButtons'.
Open

    Yaml::save($app, $yamlFile);
Severity: Minor
Found in admin/index.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

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

Avoid using static access to class '\Xmf\Request' in method 'countryDel'.
Open

    $ok = Request::getInt('ok', 0, 'POST');
Severity: Minor
Found in admin/country_manager.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

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

Avoid unused local variables such as '$xoopsModule'.
Open

    global $action, $start, $xoopsModule, $xoopsModuleConfig;
Severity: Minor
Found in admin/ip_manager.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid unused local variables such as '$pick'.
Open

    $pick              = Request::getInt('pick', 0, 'GET');
Severity: Minor
Found in admin/main.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid using static access to class '\Xmf\Request' in method 'show'.
Open

    $start             = Request::getInt('start', 0, 'GET');
Severity: Minor
Found in admin/main.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

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

Avoid unused local variables such as '$myts'.
Open

    $myts      = \MyTextSanitizer::getInstance();
Severity: Minor
Found in admin/ip_manager.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid using static access to class '\XoopsDatabaseFactory' in method 'b_waiting_xfguestbook'.
Open

    $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
Severity: Minor
Found in include/waiting.plugin.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

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

Avoid using static access to class '\XoopsModules\Xfguestbook\Helper' in method 'b_xfguestbook_show'.
Open

    $helper = Helper::getInstance();
Severity: Minor
Found in blocks/xfguestbook_new.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

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

Avoid unused local variables such as '$config'.
Open

        $config        = $configHandler->getConfigsByCat(0, $module->getVar('mid'));
Severity: Minor
Found in blocks/xfguestbook_new.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid unused local variables such as '$ts'.
Open

        $ts  = \MyTextSanitizer::getInstance();
Severity: Minor
Found in blocks/xfguestbook_new.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

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

    } else {
        $sform        = new \XoopsThemeForm(AM_XFGUESTBOOK_ADDCOUNTRY, 'op', xoops_getenv('SCRIPT_NAME'), 'post', true);
        $country_code = '';
        $country_name = '';
    }
Severity: Minor
Found in admin/country_manager.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

Avoid using static access to class '\XoopsModules\Xfguestbook\Helper' in method 'countryDel'.
Open

    $helper = Helper::getInstance();
Severity: Minor
Found in admin/country_manager.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

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

Avoid using static access to class '\MyTextSanitizer' in method 'countrySave'.
Open

    $myts = \MyTextSanitizer::getInstance();
Severity: Minor
Found in admin/country_manager.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

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

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

        } else {
            $country_id = $xoopsDB->genId('country_id_seq');
            $sql        = sprintf("INSERT INTO `%s` (country_id, country_code, country_name) VALUES (%s, '%s', '%s')", $xoopsDB->prefix('xfguestbook_country'), $country_id, $country_code, $country_name);
            $xoopsDB->query($sql);
            $messagesent = AM_XFGUESTBOOK_COUNTRY_ADDED;
Severity: Minor
Found in admin/country_manager.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

Avoid using static access to class '\XoopsModules\Xfguestbook\Helper' in method 'countryShow'.
Open

    $helper = Helper::getInstance();
Severity: Minor
Found in admin/country_manager.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

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

Avoid unused local variables such as '$xoopsModuleConfig'.
Open

    global $action, $start, $xoopsModule, $xoopsModuleConfig;
Severity: Minor
Found in admin/ip_manager.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

The function show() has 154 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

function show()
{
    global $msgHandler, $xoopsModule, $pathIcon16;
    $pick              = Request::getInt('pick', 0, 'GET');
    $start             = Request::getInt('start', 0, 'GET');
Severity: Minor
Found in admin/main.php by phpmd
Severity
Category
Status
Source
Language