XoopsModules25x/apcal

View on GitHub
include/sitemap.plugin.php

Summary

Maintainability
A
2 hrs
Test Coverage

b_sitemap_APCal_base accesses the super-global variable $GLOBALS.
Open

    function b_sitemap_APCal_base($moduleDirName)
    {
        global $xoopsConfig, $xoopsDB, $xoopsUser;
        $myts = MyTextSanitizer::getInstance();

Severity: Minor
Found in include/sitemap.plugin.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

Method b_sitemap_APCal_base has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function b_sitemap_APCal_base($moduleDirName)
    {
        global $xoopsConfig, $xoopsDB, $xoopsUser;
        $myts = MyTextSanitizer::getInstance();

Severity: Minor
Found in include/sitemap.plugin.php - About 1 hr to fix

    Function b_sitemap_APCal_base has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        function b_sitemap_APCal_base($moduleDirName)
        {
            global $xoopsConfig, $xoopsDB, $xoopsUser;
            $myts = MyTextSanitizer::getInstance();
    
    
    Severity: Minor
    Found in include/sitemap.plugin.php - About 1 hr 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

    Missing class import via use statement (line '60', column '35').
    Open

            $cal                = new APCal_xoops('', $xoopsConfig['language'], true);
    Severity: Minor
    Found in include/sitemap.plugin.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

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

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

            $myts = MyTextSanitizer::getInstance();
    Severity: Minor
    Found in include/sitemap.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 unused local variables such as '$xoopsDB'.
    Open

            global $xoopsConfig, $xoopsDB, $xoopsUser;
    Severity: Minor
    Found in include/sitemap.plugin.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 '$xoopsUser'.
    Open

            global $xoopsConfig, $xoopsDB, $xoopsUser;
    Severity: Minor
    Found in include/sitemap.plugin.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 '$mydirnumber'.
    Open

            $mydirnumber = $regs[2] === '' ? '' : (int)$regs[2];
    Severity: Minor
    Found in include/sitemap.plugin.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 '$mod_url'.
    Open

            $mod_url  = XOOPS_URL . "/modules/$moduleDirName";
    Severity: Minor
    Found in include/sitemap.plugin.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

    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 38 and the first side effect is on line 21.
    Open

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

    Blank line found at start of control structure
    Open

            foreach ($cal->categories as $cat) {
    Severity: Minor
    Found in include/sitemap.plugin.php by phpcodesniffer

    The variable $mod_url is not named in camelCase.
    Open

        function b_sitemap_APCal_base($moduleDirName)
        {
            global $xoopsConfig, $xoopsDB, $xoopsUser;
            $myts = MyTextSanitizer::getInstance();
    
    
    Severity: Minor
    Found in include/sitemap.plugin.php by phpmd

    CamelCaseVariableName

    Since: 0.2

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

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $mod_path is not named in camelCase.
    Open

        function b_sitemap_APCal_base($moduleDirName)
        {
            global $xoopsConfig, $xoopsDB, $xoopsUser;
            $myts = MyTextSanitizer::getInstance();
    
    
    Severity: Minor
    Found in include/sitemap.plugin.php by phpmd

    CamelCaseVariableName

    Since: 0.2

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

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $mod_path is not named in camelCase.
    Open

        function b_sitemap_APCal_base($moduleDirName)
        {
            global $xoopsConfig, $xoopsDB, $xoopsUser;
            $myts = MyTextSanitizer::getInstance();
    
    
    Severity: Minor
    Found in include/sitemap.plugin.php by phpmd

    CamelCaseVariableName

    Since: 0.2

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

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $mod_path is not named in camelCase.
    Open

        function b_sitemap_APCal_base($moduleDirName)
        {
            global $xoopsConfig, $xoopsDB, $xoopsUser;
            $myts = MyTextSanitizer::getInstance();
    
    
    Severity: Minor
    Found in include/sitemap.plugin.php by phpmd

    CamelCaseVariableName

    Since: 0.2

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

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $mod_path is not named in camelCase.
    Open

        function b_sitemap_APCal_base($moduleDirName)
        {
            global $xoopsConfig, $xoopsDB, $xoopsUser;
            $myts = MyTextSanitizer::getInstance();
    
    
    Severity: Minor
    Found in include/sitemap.plugin.php by phpmd

    CamelCaseVariableName

    Since: 0.2

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

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    There are no issues that match your filters.

    Category
    Status