mambax7/publisher

View on GitHub
blocks/category_items_sel.php

Summary

Maintainability
A
3 hrs
Test Coverage

Method publisher_category_items_sel_show has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function publisher_category_items_sel_show($options)
{
    $helper = Helper::getInstance();

    $block = $item = [];
Severity: Minor
Found in blocks/category_items_sel.php - About 1 hr to fix

    Function publisher_category_items_sel_show has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    function publisher_category_items_sel_show($options)
    {
        $helper = Helper::getInstance();
    
        $block = $item = [];
    Severity: Minor
    Found in blocks/category_items_sel.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 '63', column '28').
    Open

            $criteria->add(new \Criteria('categoryid', $catId));
    Severity: Minor
    Found in blocks/category_items_sel.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

    Missing class import via use statement (line '70', column '36').
    Open

                $criteriaDateSub = new \Criteria('datesub', time(), '<=');
    Severity: Minor
    Found in blocks/category_items_sel.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

    Missing class import via use statement (line '120', column '21').
    Open

        $charsEle = new \XoopsFormText(_MB_PUBLISHER_CHARS, 'options[3]', 10, 255, $options[3]);
    Severity: Minor
    Found in blocks/category_items_sel.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

    Missing class import via use statement (line '111', column '21').
    Open

        $orderEle = new \XoopsFormSelect(_MB_PUBLISHER_ORDER, 'options[1]', $options[1]);
    Severity: Minor
    Found in blocks/category_items_sel.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

    Missing class import via use statement (line '119', column '21').
    Open

        $dispEle  = new \XoopsFormText(_MB_PUBLISHER_DISP, 'options[2]', 10, 255, $options[2]);
    Severity: Minor
    Found in blocks/category_items_sel.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

    Missing class import via use statement (line '62', column '25').
    Open

            $criteria = new \CriteriaCompo();
    Severity: Minor
    Found in blocks/category_items_sel.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

    Missing class import via use statement (line '110', column '21').
    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

    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\Publisher\Utility' in method 'publisher_category_items_sel_show'.
    Open

        $order          = Utility::getOrderBy($sort);
    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\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

    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

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

    <?php declare(strict_types=1);

    There are no issues that match your filters.

    Category
    Status