XoopsModules25x/xfguestbook

View on GitHub

Showing 1,027 of 1,027 total issues

Avoid unused private methods such as 'convertIPAddresses'.
Open

    private function convertIPAddresses($tableName, $columnName)
    {
        if ($this->tableHandler->useTable($tableName)) {
            $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName);
            if (false !== mb_strpos($attributes, ' int(')) {
Severity: Minor
Found in class/Common/Migrate.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

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

Avoid using static access to class '\XoopsModule' in method 'checkVerXoops'.
Open

            $module = \XoopsModule::getByDirname($moduleDirName);
Severity: Minor
Found in class/Common/VersionChecks.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 delete uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

    } else {
        $messagesent = AM_XFGUESTBOOK_NOMSG;
    }
Severity: Minor
Found in admin/main.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\Request' in method 'show'.
Open

    $pick              = Request::getInt('pick', 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 using static access to class '\XoopsModules\Xfguestbook\Helper' in method 'xfguestbook_admin_menu'.
Open

    $helper = Helper::getInstance();
Severity: Minor
Found in include/cp_functions.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 'b_xfguestbook_show'.
Open

        $ts  = \MyTextSanitizer::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 '$k'.
Open

            foreach ($fileList as $k => $v) {
Severity: Minor
Found in class/Common/FilesManagement.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 deleteDirectory uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            // input is not a valid directory
            $success = false;
        }
Severity: Minor
Found in class/Common/FilesManagement.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 unused private methods such as 'moveDoColumns'.
Open

    private function moveDoColumns()
    {
        $tableName    = 'newbb_posts_text';
        $srcTableName = 'newbb_posts';
        if ($this->tableHandler->useTable($tableName)
Severity: Minor
Found in class/Common/Migrate.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

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

Avoid using static access to class '\XoopsModule' in method 'checkVerPhp'.
Open

            $module = \XoopsModule::getByDirname($moduleDirName);
Severity: Minor
Found in class/Common/VersionChecks.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 'show'.
Open

    $sel_status        = Request::getInt('sel_status', 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 using static access to class '\Xmf\Database\TableLoad' in method 'saveSampleData'.
Open

        TableLoad::saveTableToYamlFile($table, $exportFolder . $table . '.yml');
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 function xoops_module_update_xfguestbook() has an NPath complexity of 865. The configured NPath complexity threshold is 200.
Open

function xoops_module_update_xfguestbook(\XoopsModule $module, $previousVersion = null)
{
    global $xoopsDB;
    $moduleDirName      = basename(dirname(__DIR__));
    $moduleDirNameUpper = mb_strtoupper($moduleDirName);
Severity: Minor
Found in include/onupdate.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

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

    } else {
        $module = $xoopsModule;
        $config = $xoopsModuleConfig;
    }
Severity: Minor
Found in blocks/xfguestbook_new.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 unused private methods such as 'changePrefix'.
Open

    private function changePrefix()
    {
        foreach ($this->renameTables as $oldName => $newName) {
            if ($this->tableHandler->useTable($oldName) && !$this->tableHandler->useTable($newName)) {
                $this->tableHandler->renameTable($oldName, $newName);
Severity: Minor
Found in class/Common/Migrate.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

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

Avoid unused parameters such as '$isNew'.
Open

    public function create($isNew = true)
Severity: Minor
Found in class/MessageHandler.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

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

Avoid unused parameters such as '$fields'.
Open

    public function get($id = null, $fields = null)
Severity: Minor
Found in class/MessageHandler.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

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

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

    global $xoopsModule;
Severity: Minor
Found in include/cp_functions.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 '$xoopsModule'.
Open

    global $xoopsModule;
Severity: Minor
Found in include/oninstall.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 '\XoopsModules\Xfguestbook\Helper' in method 'xoops_module_update_xfguestbook'.
Open

    $helper       = Helper::getInstance();
Severity: Minor
Found in include/onupdate.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

Severity
Category
Status
Source
Language