mambax7/publisher

View on GitHub

Showing 3,032 of 3,032 total issues

Avoid using static access to class '\XoopsFile' in method 'xoops_module_update_publisher'.
Open

                $folderHandler = \XoopsFile::getHandler('folder', $tempFolder);
Severity: Minor
Found in include/onupdate.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 publisher_search uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $item['title'] = $obj->getTitle();
            }
Severity: Minor
Found in include/search.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

The method start() contains an exit expression.
Open

        exit(0);
Severity: Minor
Found in thumb.php by phpmd

ExitExpression

Since: 0.2

An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

Example

class Foo {
    public function bar($param)  {
        if ($param === 42) {
            exit(23);
        }
    }
}

Source https://phpmd.org/rules/design.html#exitexpression

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

            } else {
                $newHeight = $final_height;
            }
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

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

    $mid = Request::getInt('mid');
Severity: Minor
Found in include/plugin.tag.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() has an NPath complexity of 864. The configured NPath complexity threshold is 200.
Open

    protected function getLocalImagePath($src)
    {
        $src = ltrim($src, '/'); //strip off the leading '/'
        if (!$this->docRoot) {
            $this->debug(3, 'We have no document root set, so as a last resort, lets check if the image is in the current dir and serve that.');
Severity: Minor
Found in thumb.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

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

            } else {
                $this->debug(3, "Trying to serve cachefile {$this->cachefile}");
            }
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 processImageAndWriteToCache() has an NPath complexity of 302778777600. The configured NPath complexity threshold is 200.
Open

    protected function processImageAndWriteToCache($localImage)
    {
        $sData    = getimagesize($localImage);
        $origType = $sData[2];
        $mimeType = $sData['mime'];
Severity: Minor
Found in thumb.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 '\Xmf\Request' in method 'param'.
Open

            return Request::getString($property, '', 'GET');
Severity: Minor
Found in thumb.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 function publisher_editItem() has an NPath complexity of 456. The configured NPath complexity threshold is 200.
Open

function publisher_editItem($showmenu = false, $itemId = 0, $clone = false): void
{
    $helper = Helper::getInstance();
    global $publisherCurrentPage;

Severity: Minor
Found in admin/item.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

The method getURL() has an NPath complexity of 238. The configured NPath complexity threshold is 200.
Open

    protected function getURL($url, $tempfile)
    {
        $this->lastURLError = false;
        $url                = preg_replace('/ /', '%20', $url);
        if (function_exists('curl_init')) {
Severity: Minor
Found in thumb.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 '\XoopsModules\Publisher\Utility' in method 'publisher_editItem'.
Open

    $dir = Utility::getUploadDir(true, 'content');
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\Utility' in method 'publisher_editItem'.
Open

    Utility::closeCollapsableBar('edititemtable', 'edititemicon');
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\Utility' in method 'publisher_category_items_sel_edit'.
Open

    $catEle   = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, Utility::createCategorySelect($options[0], 0, true, 'options[0]'), 'options[0]');
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

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

    } else {
        foreach ($categoriesObj as $key => $value) {
            if (in_array($key, $selCategories, true)) {
                $selCategoriesObj[$key] = $value;
            }
Severity: Minor
Found in blocks/items_columns.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 using static access to class '\XoopsModules\Publisher\Helper' in method 'publisher_items_columns_show'.
Open

    $helper = Helper::getInstance();
Severity: Minor
Found in blocks/items_columns.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 publisher_items_recent_show uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $newItems['item_image'] = $mainImage['image_path'];
            }
Severity: Minor
Found in blocks/items_recent.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 using static access to class '\XoopsModules\Publisher\Utility' in method 'publisher_items_columns_edit'.
Open

    $catEle = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, Utility::createCategorySelect($options[1], 0, true, 'options[1]'));
Severity: Minor
Found in blocks/items_columns.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 uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $origin_y  = $newHeight / 2;
                $newHeight = $final_height;
                $origin_y  = round($origin_y - ($newHeight / 2));
            }
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

Avoid unused parameters such as '$options'.
Open

function publisher_items_menu_show($options)
Severity: Minor
Found in blocks/items_menu.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

Severity
Category
Status
Source
Language