kai-jacobsen/kontentblocks

View on GitHub
includes/kb-api.php

Summary

Maintainability
C
1 day
Test Coverage

File kb-api.php has 267 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Kontentblocks;

use function foo\func;
Severity: Minor
Found in includes/kb-api.php - About 2 hrs to fix

    Function areasForContext has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    function areasForContext($postId = null, $context)
    {
        global $post;
        $postId = (null === $postId) ? $post->ID : $postId;
        $environment = Utilities::getPostEnvironment($postId);
    Severity: Minor
    Found in includes/kb-api.php - About 2 hrs 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

    Function renderContext has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    function renderContext($context, $postId, $areaSettings = array(), $moduleSettings = array())
    {
        global $post;
        $postId = (null === $postId) ? $post->ID : $postId;
        $Environment = Utilities::getPostEnvironment($postId);
    Severity: Minor
    Found in includes/kb-api.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

    Method renderSingleArea has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function renderSingleArea($areaId, $post_id = null, $areaSettings = array(), $moduleSettings = array(), $echo = true)
    {
        global $post;
        $postId = (is_null($post_id) && !is_null($post)) ? $post->ID : $post_id;
    
    
    Severity: Minor
    Found in includes/kb-api.php - About 1 hr to fix

      Function renderSingleArea has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      function renderSingleArea($areaId, $post_id = null, $areaSettings = array(), $moduleSettings = array(), $echo = true)
      {
          global $post;
          $postId = (is_null($post_id) && !is_null($post)) ? $post->ID : $post_id;
      
      
      Severity: Minor
      Found in includes/kb-api.php - About 45 mins 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

      Method renderSingleArea has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function renderSingleArea($areaId, $post_id = null, $areaSettings = array(), $moduleSettings = array(), $echo = true)
      Severity: Minor
      Found in includes/kb-api.php - About 35 mins to fix

        Function isActiveArea has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        function isActiveArea($areaId, $postId = null)
        {
        
            global $post;
            $postId = (is_null($postId) && !is_null($post)) ? $post->ID : $postId;
        Severity: Minor
        Found in includes/kb-api.php - About 25 mins 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

        The method renderSingleArea has a boolean flag argument $echo, which is a certain sign of a Single Responsibility Principle violation.
        Open

        function renderSingleArea($areaId, $post_id = null, $areaSettings = array(), $moduleSettings = array(), $echo = true)
        Severity: Minor
        Found in includes/kb-api.php by phpmd

        BooleanArgumentFlag

        Since: 1.4.0

        A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

        Example

        class Foo {
            public function bar($flag = true) {
            }
        }

        Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

        Missing class import via use statement (line '277', column '20').
        Open

                return new \WP_Error('Kontentblocks', 'Panel does not exist', array('request' => $panelId));
        Severity: Minor
        Found in includes/kb-api.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 '256', column '20').
        Open

                return new \WP_Error(
        Severity: Minor
        Found in includes/kb-api.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

        The method getPostPanelModel has a boolean flag argument $setup, which is a certain sign of a Single Responsibility Principle violation.
        Open

        function getPostPanelModel($panelId = null, $postId = null, $setup = true)
        Severity: Minor
        Found in includes/kb-api.php by phpmd

        BooleanArgumentFlag

        Since: 1.4.0

        A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

        Example

        class Foo {
            public function bar($flag = true) {
            }
        }

        Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

        The method getPostPanelData has a boolean flag argument $raw, which is a certain sign of a Single Responsibility Principle violation.
        Open

        function getPostPanelData($panelId = null, $postId = null, $raw = false)
        Severity: Minor
        Found in includes/kb-api.php by phpmd

        BooleanArgumentFlag

        Since: 1.4.0

        A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

        Example

        class Foo {
            public function bar($flag = true) {
            }
        }

        Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

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

                $environment = Utilities::getPostEnvironment($parentObjectId, $postId);
        Severity: Minor
        Found in includes/kb-api.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 '\Kontentblocks\Utils\Utilities' in method 'getPostPanel'.
        Open

            $Environment = Utilities::getPostEnvironment($postId);
        Severity: Minor
        Found in includes/kb-api.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 '\Kontentblocks\Utils\Utilities' in method 'renderSingleArea'.
        Open

                $environment = Utilities::getPostEnvironment($parentObjectId, $postId);
        Severity: Minor
        Found in includes/kb-api.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 '\Kontentblocks\Utils\Utilities' in method 'getTermPanel'.
        Open

            $environment = Utilities::getTermEnvironment($termId, $taxonomy);
        Severity: Minor
        Found in includes/kb-api.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 renderContext uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                    } else {
                        $margs = $areaSettings;
                    }
        Severity: Minor
        Found in includes/kb-api.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 '\Kontentblocks\Utils\RuntimeCache' in method 'getPostPanelData'.
        Open

            $cached = RuntimeCache::get(func_get_args());
        Severity: Minor
        Found in includes/kb-api.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 'Kontentblocks\Kontentblocks' in method 'isActiveArea'.
        Open

            $registry = Kontentblocks::getService('registry.areas');
        Severity: Minor
        Found in includes/kb-api.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 '\Kontentblocks\Utils\Utilities' in method 'renderContext'.
        Open

            $Environment = Utilities::getPostEnvironment($postId);
        Severity: Minor
        Found in includes/kb-api.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 '\Kontentblocks\Utils\Utilities' in method 'renderContext'.
        Open

                        $margs = Utilities::arrayMergeRecursive($moduleSettings[$area], $moduleSettings);
        Severity: Minor
        Found in includes/kb-api.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 '\Kontentblocks\Utils\RuntimeCache' in method 'getPostPanelData'.
        Open

            return RuntimeCache::add(func_get_args(), new ValueObject($data));
        Severity: Minor
        Found in includes/kb-api.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 '\Kontentblocks\Utils\Utilities' in method 'renderSingleArea'.
        Open

                $environment = Utilities::getPostEnvironment($postId);
        Severity: Minor
        Found in includes/kb-api.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 '\Kontentblocks\Utils\Utilities' in method 'areasForContext'.
        Open

            $environment = Utilities::getPostEnvironment($postId);
        Severity: Minor
        Found in includes/kb-api.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 getPostPanel uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

            } else {
                return new \WP_Error(
                    'Kontentblocks',
                    'Panel with requested id does not exist.',
                    array('request' => $panelId, 'line' => __LINE__, 'file' => __FILE__)
        Severity: Minor
        Found in includes/kb-api.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 '\Kontentblocks\Utils\Utilities' in method 'renderContext'.
        Open

                        $args = Utilities::arrayMergeRecursive($areaSettings[$area], $areaSettings);
        Severity: Minor
        Found in includes/kb-api.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 renderSingleArea uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

            } else {
                $environment = Utilities::getPostEnvironment($postId);
            }
        Severity: Minor
        Found in includes/kb-api.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 '\Kontentblocks\Utils\Utilities' in method 'hasModules'.
        Open

            $environment = Utilities::getPostEnvironment($postId);
        Severity: Minor
        Found in includes/kb-api.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 'Kontentblocks\Kontentblocks' in method 'registerArea'.
        Open

            $AreaRegistry = Kontentblocks::getService('registry.areas');
        Severity: Minor
        Found in includes/kb-api.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 'Kontentblocks\Kontentblocks' in method 'renderSingleArea'.
        Open

            $registry = Kontentblocks::getService('registry.areas');
        Severity: Minor
        Found in includes/kb-api.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 '\Kontentblocks\Utils\Utilities' in method 'isActiveArea'.
        Open

                $environment = Utilities::getPostEnvironment($postId);
        Severity: Minor
        Found in includes/kb-api.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 renderSingleArea uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

            } else {
                $renderer = new AreaRenderer($environment, $areaRenderSettings, $moduleRenderSettings);
            }
        Severity: Minor
        Found in includes/kb-api.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 isActiveArea uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

            } else {
                $environment = Utilities::getPostEnvironment($postId);
            }
        Severity: Minor
        Found in includes/kb-api.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 getPostPanelData uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                } else {
                    $data = $panel->setupRawData()->export();
                }
        Severity: Minor
        Found in includes/kb-api.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 renderContext uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                    } else {
                        $args = $areaSettings;
                    }
        Severity: Minor
        Found in includes/kb-api.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 getTermPanel uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

            } else {
                return new \WP_Error('Kontentblocks', 'Panel does not exist', array('request' => $panelId));
            }
        Severity: Minor
        Found in includes/kb-api.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 parameter $post_id is not named in camelCase.
        Open

        function renderSingleArea($areaId, $post_id = null, $areaSettings = array(), $moduleSettings = array(), $echo = true)
        {
            global $post;
            $postId = (is_null($post_id) && !is_null($post)) ? $post->ID : $post_id;
        
        
        Severity: Minor
        Found in includes/kb-api.php by phpmd

        CamelCaseParameterName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name parameters.

        Example

        class ClassName {
            public function doSomething($user_name) {
            }
        }

        Source

        The parameter $post_id is not named in camelCase.
        Open

        function getPanel($panelId = null, $post_id = null)
        {
            return getPostPanel($panelId, $post_id);
        }
        Severity: Minor
        Found in includes/kb-api.php by phpmd

        CamelCaseParameterName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name parameters.

        Example

        class ClassName {
            public function doSomething($user_name) {
            }
        }

        Source

        The variable $post_id is not named in camelCase.
        Open

        function renderSideAreas($postId, $areaSettings = array(), $moduleSettings = array())
        {
            global $post;
            $post_id = (null === $postId) ? $post->ID : $postId;
            $areas = get_post_meta($post_id, 'active_sidebar_areas', true);
        Severity: Minor
        Found in includes/kb-api.php by phpmd

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $Environment is not named in camelCase.
        Open

        function getPostPanel($panelId = null, $postId = null)
        {
            if (is_null($postId)) {
                $postId = get_the_ID();
            }
        Severity: Minor
        Found in includes/kb-api.php by phpmd

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $Panel is not named in camelCase.
        Open

        function getPostPanel($panelId = null, $postId = null)
        {
            if (is_null($postId)) {
                $postId = get_the_ID();
            }
        Severity: Minor
        Found in includes/kb-api.php by phpmd

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $post_id is not named in camelCase.
        Open

        function renderSingleArea($areaId, $post_id = null, $areaSettings = array(), $moduleSettings = array(), $echo = true)
        {
            global $post;
            $postId = (is_null($post_id) && !is_null($post)) ? $post->ID : $post_id;
        
        
        Severity: Minor
        Found in includes/kb-api.php by phpmd

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $Environment is not named in camelCase.
        Open

        function renderContext($context, $postId, $areaSettings = array(), $moduleSettings = array())
        {
            global $post;
            $postId = (null === $postId) ? $post->ID : $postId;
            $Environment = Utilities::getPostEnvironment($postId);
        Severity: Minor
        Found in includes/kb-api.php by phpmd

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $Panel is not named in camelCase.
        Open

        function getPostPanel($panelId = null, $postId = null)
        {
            if (is_null($postId)) {
                $postId = get_the_ID();
            }
        Severity: Minor
        Found in includes/kb-api.php by phpmd

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $Environment is not named in camelCase.
        Open

        function renderContext($context, $postId, $areaSettings = array(), $moduleSettings = array())
        {
            global $post;
            $postId = (null === $postId) ? $post->ID : $postId;
            $Environment = Utilities::getPostEnvironment($postId);
        Severity: Minor
        Found in includes/kb-api.php by phpmd

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $AreaRegistry is not named in camelCase.
        Open

        function registerArea($args)
        {
            /** @var \Kontentblocks\Areas\AreaRegistry $AreaRegistry */
            $AreaRegistry = Kontentblocks::getService('registry.areas');
            return $AreaRegistry->addArea($args, true);
        Severity: Minor
        Found in includes/kb-api.php by phpmd

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $post_id is not named in camelCase.
        Open

        function getPanel($panelId = null, $post_id = null)
        {
            return getPostPanel($panelId, $post_id);
        }
        Severity: Minor
        Found in includes/kb-api.php by phpmd

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $Environment is not named in camelCase.
        Open

        function getPostPanel($panelId = null, $postId = null)
        {
            if (is_null($postId)) {
                $postId = get_the_ID();
            }
        Severity: Minor
        Found in includes/kb-api.php by phpmd

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $AreaRegistry is not named in camelCase.
        Open

        function registerArea($args)
        {
            /** @var \Kontentblocks\Areas\AreaRegistry $AreaRegistry */
            $AreaRegistry = Kontentblocks::getService('registry.areas');
            return $AreaRegistry->addArea($args, true);
        Severity: Minor
        Found in includes/kb-api.php by phpmd

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $post_id is not named in camelCase.
        Open

        function renderSideAreas($postId, $areaSettings = array(), $moduleSettings = array())
        {
            global $post;
            $post_id = (null === $postId) ? $post->ID : $postId;
            $areas = get_post_meta($post_id, 'active_sidebar_areas', true);
        Severity: Minor
        Found in includes/kb-api.php by phpmd

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $Panel is not named in camelCase.
        Open

        function getPostPanel($panelId = null, $postId = null)
        {
            if (is_null($postId)) {
                $postId = get_the_ID();
            }
        Severity: Minor
        Found in includes/kb-api.php by phpmd

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $post_id is not named in camelCase.
        Open

        function renderSingleArea($areaId, $post_id = null, $areaSettings = array(), $moduleSettings = array(), $echo = true)
        {
            global $post;
            $postId = (is_null($post_id) && !is_null($post)) ? $post->ID : $post_id;
        
        
        Severity: Minor
        Found in includes/kb-api.php by phpmd

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $Environment is not named in camelCase.
        Open

        function getPostPanel($panelId = null, $postId = null)
        {
            if (is_null($postId)) {
                $postId = get_the_ID();
            }
        Severity: Minor
        Found in includes/kb-api.php by phpmd

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $post_id is not named in camelCase.
        Open

        function renderSideAreas($postId, $areaSettings = array(), $moduleSettings = array())
        {
            global $post;
            $post_id = (null === $postId) ? $post->ID : $postId;
            $areas = get_post_meta($post_id, 'active_sidebar_areas', true);
        Severity: Minor
        Found in includes/kb-api.php by phpmd

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        There are no issues that match your filters.

        Category
        Status