kai-jacobsen/kontentblocks

View on GitHub
core/Ajax/Actions/UpdateModuleData.php

Summary

Maintainability
A
1 hr
Test Coverage

Method action has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected static function action(Request $request)
    {
        global $post;

        $moduleArgs = Utilities::validateBoolRecursive($request->get('module'));
Severity: Minor
Found in core/Ajax/Actions/UpdateModuleData.php - About 1 hr to fix

    Avoid using static access to class '\Kontentblocks\Utils\Utilities' in method 'action'.
    Open

            $mergedData = Utilities::arrayMergeRecursive($new, $old);

    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 '\Kontentblocks\Utils\Utilities' in method 'action'.
    Open

            $environment = Utilities::getPostEnvironment($postId);

    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 '\Kontentblocks\Utils\Utilities' in method 'action'.
    Open

                $targetEnv = Utilities::getPostEnvironment($revid);

    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 '\Kontentblocks\Utils\Utilities' in method 'action'.
    Open

            Utilities::remoteConcatGet($postId);

    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 '\Kontentblocks\Utils\Utilities' in method 'action'.
    Open

            $moduleArgs = Utilities::validateBoolRecursive($request->get('module'));

    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

    There are no issues that match your filters.

    Category
    Status