mambax7/publisher

View on GitHub

Showing 3,032 of 3,032 total issues

Avoid using static access to class '\Xmf\Request' in method 'publisher_items_menu_show'.
Open

        $categoryid = Request::getInt('categoryid', 0, 'GET');
Severity: Minor
Found in blocks/items_menu.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 getLocalImagePath uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $subDirectories = explode('/', str_replace($this->docRoot, '', $_SERVER['SCRIPT_FILENAME']));
        }
Severity: Minor
Found in thumb.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

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

        } else {
            $item['comment'] = ' ' . _MB_PUBLISHER_NO_COMMENTS . ' ';
        }
Severity: Minor
Found in blocks/items_random_item.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

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

                } else {
                    $category['image_path'] = '';
                }
Severity: Minor
Found in blocks/items_spot.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

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

        } else {
            $command = "$xv --server-args=\"-screen 0, {$screenX}x{$screenY}x{$colDepth}\" $cuty $proxy --max-wait=$timeout --user-agent=\"$ua\" --javascript=$jsOn --java=$javaOn --plugins=$pluginsOn --js-can-open-windows=off --url=\"$url\" --out-format=$format --out=$tempfile";
        }
Severity: Minor
Found in thumb.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

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

            } else {
                $block['category']['categoryurl'] = XOOPS_URL . '/modules/' . PUBLISHER_DIRNAME;
            }
Severity: Minor
Found in blocks/items_spot.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 '$breadcrumbAction1'.
Open

                $breadcrumbAction1 = _CO_PUBLISHER_SUBMITTED;
Severity: Minor
Found in admin/item.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 '\Xmf\Request' in method 'publisher_editItem'.
Open

        $categoryObj->setVar('categoryid', Request::getInt('categoryid', 0, 'GET'));
Severity: Minor
Found in admin/item.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\Publisher\Helper' in method 'publisher_category_items_sel_show'.
Open

    $helper = Helper::getInstance();
Severity: Minor
Found in blocks/category_items_sel.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\Publisher\Helper' in method 'publisher_items_random_item_show'.
Open

    $helper = Helper::getInstance();
Severity: Minor
Found in blocks/items_random_item.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 processImageAndWriteToCache() has 311 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    protected function processImageAndWriteToCache($localImage)
    {
        $sData    = getimagesize($localImage);
        $origType = $sData[2];
        $mimeType = $sData['mime'];
Severity: Minor
Found in thumb.php by phpmd

Avoid using static access to class '\XoopsModules\Publisher\Utility' in method 'publisher_editItem'.
Open

    $pWrapSelect = new \XoopsFormSelect(Utility::getUploadDir(true, 'content'), 'address');
Severity: Minor
Found in admin/item.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\Publisher\Helper' in method 'publisher_latest_files_show'.
Open

    $helper = Helper::getInstance();
Severity: Minor
Found in blocks/latest_files.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\Publisher\Utility' in method 'publisher_latest_files_edit'.
Open

    $catEle   = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, Utility::createCategorySelect($options[0], 0, true, 'options[0]'));
Severity: Minor
Found in blocks/latest_files.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 'publisher_search_show'.
Open

    $username = Request::getString('uname', Request::getString('uname', null, 'GET'), 'POST');
Severity: Minor
Found in blocks/search.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 parameters such as '$force'.
Open

    public function deleteAll(\CriteriaElement $criteria = null, $force = true, $asObject = false) //deleteAll($criteria = null)
Severity: Minor
Found in class/BaseObjectHandler.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

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

                } else {
                    $cachetimeOptions .= "<option value='$cachetime'>$cachetimeName</option>\n";
                }
Severity: Minor
Found in class/Common/Blocksadmin.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

The method createSchemaFromSqlfile() has an NPath complexity of 16740. The configured NPath complexity threshold is 200.
Open

    public function createSchemaFromSqlfile(): bool
    {
        if (!\is_file($this->fileSql)) {
            \xoops_error('Error: Sql file not found!');
            return false;
Severity: Minor
Found in class/Common/MigrateHelper.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

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

        $myts    = \MyTextSanitizer::getInstance();
Severity: Minor
Found in class/Common/SysUtility.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\Publisher\Helper' in method 'loadButtonConfig'.
Open

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