mambax7/publisher

View on GitHub
blocks/date_to_date.php

Summary

Maintainability
A
1 hr
Test Coverage

Method publisher_date_to_date_show has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function publisher_date_to_date_show($options)
{
    $myts   = \MyTextSanitizer::getInstance();
    $helper = Helper::getInstance();

Severity: Minor
Found in blocks/date_to_date.php - About 1 hr to fix

    Missing class import via use statement (line '40', column '24').
    Open

        $criteria->add(new \Criteria('datesub', isset($options[1]) ? strtotime($options[1]) : '', '<'));
    Severity: Minor
    Found in blocks/date_to_date.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 '96', column '21').
    Open

        $untilEle = new \XoopsFormTextDateSelect(_MB_PUBLISHER_UNTIL, 'options[1]', 15, isset($options[1]) ? strtotime($options[1]) : '');
    Severity: Minor
    Found in blocks/date_to_date.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 '39', column '24').
    Open

        $criteria->add(new \Criteria('datesub', strtotime($options[0]), '>'));
    Severity: Minor
    Found in blocks/date_to_date.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 '38', column '21').
    Open

        $criteria = new \CriteriaCompo();
    Severity: Minor
    Found in blocks/date_to_date.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 '94', column '20').
    Open

        $fromEle = new \XoopsFormTextDateSelect(_MB_PUBLISHER_FROM, 'options[0]', 15, strtotime($options[0]));
    Severity: Minor
    Found in blocks/date_to_date.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\Helper' in method 'publisher_date_to_date_show'.
    Open

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

        $myts   = \MyTextSanitizer::getInstance();
    Severity: Minor
    Found in blocks/date_to_date.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 31 and the first side effect is on line 24.
    Open

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

    There are no issues that match your filters.

    Category
    Status