XoopsModules25x/xoopstube

View on GitHub
include/notification.inc.php

Summary

Maintainability
A
3 hrs
Test Coverage

xtubeNotifyIteminfo accesses the super-global variable $GLOBALS.
Open

function xtubeNotifyIteminfo($category, $item_id)
{
    global $xoopsModule;

    $moduleDirName = \basename(\dirname(__DIR__));
Severity: Minor
Found in include/notification.inc.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

xtubeNotifyIteminfo accesses the super-global variable $GLOBALS.
Open

function xtubeNotifyIteminfo($category, $item_id)
{
    global $xoopsModule;

    $moduleDirName = \basename(\dirname(__DIR__));
Severity: Minor
Found in include/notification.inc.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

xtubeNotifyIteminfo accesses the super-global variable $GLOBALS.
Open

function xtubeNotifyIteminfo($category, $item_id)
{
    global $xoopsModule;

    $moduleDirName = \basename(\dirname(__DIR__));
Severity: Minor
Found in include/notification.inc.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

xtubeNotifyIteminfo accesses the super-global variable $GLOBALS.
Open

function xtubeNotifyIteminfo($category, $item_id)
{
    global $xoopsModule;

    $moduleDirName = \basename(\dirname(__DIR__));
Severity: Minor
Found in include/notification.inc.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

xtubeNotifyIteminfo accesses the super-global variable $GLOBALS.
Open

function xtubeNotifyIteminfo($category, $item_id)
{
    global $xoopsModule;

    $moduleDirName = \basename(\dirname(__DIR__));
Severity: Minor
Found in include/notification.inc.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

xtubeNotifyIteminfo accesses the super-global variable $GLOBALS.
Open

function xtubeNotifyIteminfo($category, $item_id)
{
    global $xoopsModule;

    $moduleDirName = \basename(\dirname(__DIR__));
Severity: Minor
Found in include/notification.inc.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

xtubeNotifyIteminfo accesses the super-global variable $GLOBALS.
Open

function xtubeNotifyIteminfo($category, $item_id)
{
    global $xoopsModule;

    $moduleDirName = \basename(\dirname(__DIR__));
Severity: Minor
Found in include/notification.inc.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 xtubeNotifyIteminfo has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function xtubeNotifyIteminfo($category, $item_id)
{
    global $xoopsModule;

    $moduleDirName = \basename(\dirname(__DIR__));
Severity: Minor
Found in include/notification.inc.php - About 1 hr to fix

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

    function xtubeNotifyIteminfo($category, $item_id)
    {
        global $xoopsModule;
    
        $moduleDirName = \basename(\dirname(__DIR__));
    Severity: Minor
    Found in include/notification.inc.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

    Avoid too many return statements within this method.
    Open

            return $item;
    Severity: Major
    Found in include/notification.inc.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

          return null;
      Severity: Major
      Found in include/notification.inc.php - About 30 mins to fix

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

                return $item;
        Severity: Minor
        Found in include/notification.inc.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 '$item' which will lead to PHP notices.
        Open

                return $item;
        Severity: Minor
        Found in include/notification.inc.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 '$item' which will lead to PHP notices.
        Open

                $item['name'] = $result_array['title'];
        Severity: Minor
        Found in include/notification.inc.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 '$item' which will lead to PHP notices.
        Open

                return $item;
        Severity: Minor
        Found in include/notification.inc.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 '$item' which will lead to PHP notices.
        Open

                $item['url']  = XOOPS_URL . '/modules/xoopstube/singlevideo.php?cid=' . $result_array['cid'] . '&lid=' . $item_id;
        Severity: Minor
        Found in include/notification.inc.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 '$item' which will lead to PHP notices.
        Open

                $item['url']  = XOOPS_URL . '/modules/xoopstube/viewcat.php?cid=' . $item_id;
        Severity: Minor
        Found in include/notification.inc.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 '$item' which will lead to PHP notices.
        Open

                $item['name'] = '';
        Severity: Minor
        Found in include/notification.inc.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 '$item' which will lead to PHP notices.
        Open

                $item['name'] = $result_array['title'];
        Severity: Minor
        Found in include/notification.inc.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 '$item' which will lead to PHP notices.
        Open

                $item['url']  = '';
        Severity: Minor
        Found in include/notification.inc.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 assigning values to variables in if clauses and the like (line '53', column '14').
        Open

        function xtubeNotifyIteminfo($category, $item_id)
        {
            global $xoopsModule;
        
            $moduleDirName = \basename(\dirname(__DIR__));
        Severity: Minor
        Found in include/notification.inc.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

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

        function xtubeNotifyIteminfo($category, $item_id)
        {
            global $xoopsModule;
        
            $moduleDirName = \basename(\dirname(__DIR__));
        Severity: Minor
        Found in include/notification.inc.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

        The method xtubeNotifyIteminfo 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 = $GLOBALS['xoopsModuleConfig'];
            }
        Severity: Minor
        Found in include/notification.inc.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 local variables such as '$config'.
        Open

                $config        = $configHandler->getConfigsByCat(0, $module->getVar('mid'));
        Severity: Minor
        Found in include/notification.inc.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 parameter $item_id is not named in camelCase.
        Open

        function xtubeNotifyIteminfo($category, $item_id)
        {
            global $xoopsModule;
        
            $moduleDirName = \basename(\dirname(__DIR__));
        Severity: Minor
        Found in include/notification.inc.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

        Line exceeds 120 characters; contains 126 characters
        Open

                $item['url']  = XOOPS_URL . '/modules/xoopstube/singlevideo.php?cid=' . $result_array['cid'] . '&lid=' . $item_id;
        Severity: Minor
        Found in include/notification.inc.php by phpcodesniffer

        The variable $result_array is not named in camelCase.
        Open

        function xtubeNotifyIteminfo($category, $item_id)
        {
            global $xoopsModule;
        
            $moduleDirName = \basename(\dirname(__DIR__));
        Severity: Minor
        Found in include/notification.inc.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 $item_id is not named in camelCase.
        Open

        function xtubeNotifyIteminfo($category, $item_id)
        {
            global $xoopsModule;
        
            $moduleDirName = \basename(\dirname(__DIR__));
        Severity: Minor
        Found in include/notification.inc.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 $item_id is not named in camelCase.
        Open

        function xtubeNotifyIteminfo($category, $item_id)
        {
            global $xoopsModule;
        
            $moduleDirName = \basename(\dirname(__DIR__));
        Severity: Minor
        Found in include/notification.inc.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 $item_id is not named in camelCase.
        Open

        function xtubeNotifyIteminfo($category, $item_id)
        {
            global $xoopsModule;
        
            $moduleDirName = \basename(\dirname(__DIR__));
        Severity: Minor
        Found in include/notification.inc.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 $result_array is not named in camelCase.
        Open

        function xtubeNotifyIteminfo($category, $item_id)
        {
            global $xoopsModule;
        
            $moduleDirName = \basename(\dirname(__DIR__));
        Severity: Minor
        Found in include/notification.inc.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 $result_array is not named in camelCase.
        Open

        function xtubeNotifyIteminfo($category, $item_id)
        {
            global $xoopsModule;
        
            $moduleDirName = \basename(\dirname(__DIR__));
        Severity: Minor
        Found in include/notification.inc.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 $result_array is not named in camelCase.
        Open

        function xtubeNotifyIteminfo($category, $item_id)
        {
            global $xoopsModule;
        
            $moduleDirName = \basename(\dirname(__DIR__));
        Severity: Minor
        Found in include/notification.inc.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 $item_id is not named in camelCase.
        Open

        function xtubeNotifyIteminfo($category, $item_id)
        {
            global $xoopsModule;
        
            $moduleDirName = \basename(\dirname(__DIR__));
        Severity: Minor
        Found in include/notification.inc.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 $result_array is not named in camelCase.
        Open

        function xtubeNotifyIteminfo($category, $item_id)
        {
            global $xoopsModule;
        
            $moduleDirName = \basename(\dirname(__DIR__));
        Severity: Minor
        Found in include/notification.inc.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