XoopsModules25x/tag

View on GitHub
plugin/myalbum0.php

Summary

Maintainability
A
1 hr
Test Coverage

myalbum0_tag_iteminfo accesses the super-global variable $GLOBALS.
Open

function myalbum0_tag_iteminfo(array &$items): bool
{
    if (empty($items)) {
        return false;
    }
Severity: Minor
Found in plugin/myalbum0.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 myalbum0_tag_iteminfo has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function myalbum0_tag_iteminfo(array &$items): bool
{
    if (empty($items)) {
        return false;
    }
Severity: Minor
Found in plugin/myalbum0.php - About 1 hr to fix

    Function myalbum0_tag_iteminfo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    function myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.php - About 35 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

    Missing class import via use statement (line '65', column '47').
    Open

        $items_obj = $itemHandler->getObjects(new \Criteria('lid', '(' . implode(', ', $items_id) . ')', 'IN'), true);
    Severity: Minor
    Found in plugin/myalbum0.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 '\XoopsModules\Tag\Utility' in method 'myalbum0_tag_iteminfo'.
    Open

                    'tags'    => Utility::tag_parse_tag($item_obj->getVar('tags', 'n')),
    Severity: Minor
    Found in plugin/myalbum0.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 assigning values to variables in if clauses and the like (line '120', column '10').
    Open

    function myalbum0_tag_synchronization($mid): void
    {
        /** @var \Myalbum0PhotosHandler $itemHandler */
        $itemHandler = \XoopsModules\Myalbum\Helper::getInstance()->getHandler('Photos');
        /** @var \XoopsModules\Tag\LinkHandler $linkHandler */
    Severity: Minor
    Found in plugin/myalbum0.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 using static access to class '\Xmf\Request' in method 'myalbum0_tag_synchronization'.
    Open

        $mid = Request::getInt('mid');
    Severity: Minor
    Found in plugin/myalbum0.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\Myalbum\Helper' in method 'myalbum0_tag_iteminfo'.
    Open

        $helper = \XoopsModules\Myalbum\Helper::getInstance();
    Severity: Minor
    Found in plugin/myalbum0.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 '$result'.
    Open

        if (!$result = $linkHandler->db->queryF($sql)) {
    Severity: Minor
    Found in plugin/myalbum0.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 40 and the first side effect is on line 25.
    Open

    <?php declare(strict_types=1);
    Severity: Minor
    Found in plugin/myalbum0.php by phpcodesniffer

    Line exceeds 120 characters; contains 127 characters
    Open

                    "    LEFT JOIN {$itemHandler->table} AS aa ON {$linkHandler->table}.tag_itemid = aa.{$itemHandler->keyName} " .
    Severity: Minor
    Found in plugin/myalbum0.php by phpcodesniffer

    Line exceeds 120 characters; contains 289 characters
    Open

        $sql = "DELETE FROM {$linkHandler->table}" . " WHERE tag_modid = {$mid}" . '   AND (tag_itemid NOT IN ' . "         (SELECT DISTINCT {$itemHandler->keyName}" . "           FROM {$itemHandler->table} " . "           WHERE {$itemHandler->table}.approved > 0" . '         )' . '       )';
    Severity: Minor
    Found in plugin/myalbum0.php by phpcodesniffer

    The variable $item_id is not named in camelCase.
    Open

    function myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.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_obj is not named in camelCase.
    Open

    function myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.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 myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.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 $cat_id is not named in camelCase.
    Open

    function myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.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 $items_obj is not named in camelCase.
    Open

    function myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.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 myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.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_obj is not named in camelCase.
    Open

    function myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.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 myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.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 $items_obj is not named in camelCase.
    Open

    function myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.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 $cat_id is not named in camelCase.
    Open

    function myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.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 $cat_id is not named in camelCase.
    Open

    function myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.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 $cat_id is not named in camelCase.
    Open

    function myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.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_obj is not named in camelCase.
    Open

    function myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.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 $cat_id is not named in camelCase.
    Open

    function myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.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_obj is not named in camelCase.
    Open

    function myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.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 $items_obj is not named in camelCase.
    Open

    function myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.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 $items_id is not named in camelCase.
    Open

    function myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.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 myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.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_obj is not named in camelCase.
    Open

    function myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.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_obj is not named in camelCase.
    Open

    function myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.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 myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.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 myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.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 $items_id is not named in camelCase.
    Open

    function myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.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 $items_id is not named in camelCase.
    Open

    function myalbum0_tag_iteminfo(array &$items): bool
    {
        if (empty($items)) {
            return false;
        }
    Severity: Minor
    Found in plugin/myalbum0.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