XoopsModules25x/xoopspartners

View on GitHub

Showing 346 of 346 total issues

Avoid using undefined variables such as '$app' which will lead to PHP notices.
Open

    $app['displaySampleButton'] = 1;
Severity: Minor
Found in admin/index.php by phpmd

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

Avoid using undefined variables such as '$app' which will lead to PHP notices.
Open

    $app['displaySampleButton'] = 0;
Severity: Minor
Found in admin/index.php by phpmd

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

Avoid using undefined variables such as '$app' which will lead to PHP notices.
Open

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

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

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

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

    Each class must be in a namespace of at least one level (a top-level vendor name)
    Open

    class XoopspartnersCorePreload extends \XoopsPreloadItem
    Severity: Minor
    Found in preloads/core.php by phpcodesniffer

    Function recurseCopy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function recurseCopy($src, $dst)
        {
            $dir = \opendir($src);
            //        @mkdir($dst);
            if (!@\mkdir($dst) && !\is_dir($dst)) {
    Severity: Minor
    Found in class/Common/FilesManagement.php - About 55 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function rmove has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function rmove($src, $dest)
        {
            // Only continue if user is a 'global' Admin
            if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                return false;
    Severity: Minor
    Found in class/Common/FilesManagement.php - About 55 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function rcopy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function rcopy($src, $dest)
        {
            // Only continue if user is a 'global' Admin
            if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                return false;
    Severity: Minor
    Found in class/Common/FilesManagement.php - About 55 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    The parameter $curr_version is not named in camelCase.
    Open

    function xoops_module_update_xoopspartners(\XoopsModule $module, $curr_version = null)
    {
        return true;
    }
    Severity: Minor
    Found in include/action.module.php by phpmd

    CamelCaseParameterName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name parameters.

    Example

    class ClassName {
        public function doSomething($user_name) {
        }
    }

    Source

    Avoid variables with short names like $db. Configured minimum length is 3.
    Open

        public function __construct(\XoopsDatabase $db = null)
    Severity: Minor
    Found in class/PartnersHandler.php by phpmd

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#shortvariable

    A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 76 and the first side effect is on line 29.
    Open

    <?php
    Severity: Minor
    Found in admin/index.php by phpcodesniffer

    A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 35 and the first side effect is on line 27.
    Open

    <?php
    Severity: Minor
    Found in include/onupdate.php by phpcodesniffer

    Avoid variables with short names like $db. Configured minimum length is 3.
    Open

            $db     = \XoopsDatabaseFactory::getDatabaseConnection();
    Severity: Minor
    Found in class/Helper.php by phpmd

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#shortvariable

    A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 41 and the first side effect is on line 22.
    Open

    <?php
    Severity: Minor
    Found in include/issues.php by phpcodesniffer

    Avoid variables with short names like $id. Configured minimum length is 3.
    Open

        public function __construct($id = null)
    Severity: Minor
    Found in class/Partners.php by phpmd

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#shortvariable

    A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 44 and the first side effect is on line 35.
    Open

    <?php
    Severity: Minor
    Found in include/action.module.php by phpcodesniffer

    A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 24 and the first side effect is on line 21.
    Open

    <?php
    Severity: Minor
    Found in language/english/common.php by phpcodesniffer

    A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 53 and the first side effect is on line 21.
    Open

    <?php
    Severity: Minor
    Found in testdata/index.php by phpcodesniffer

    A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 45 and the first side effect is on line 25.
    Open

    <?php
    Severity: Minor
    Found in include/common.php by phpcodesniffer

    A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 5 and the first side effect is on line 3.
    Open

    <?php // Xoops Spanish Support (http://www.esxoops.com)
    Severity: Minor
    Found in language/spanish/admin.php by phpcodesniffer
    Severity
    Category
    Status
    Source
    Language