mambax7/extgallery

View on GitHub
assets/js/ml-slider/inc/metaslider.systemcheck.class.php

Summary

Maintainability
A
2 hrs
Test Coverage

dismissMessages accesses the super-global variable $_REQUEST.
Open

    private function dismissMessages()
    {
        if (\Xmf\Request::hasVar('dismissMessage', 'REQUEST') && isset($_REQUEST['_wpnonce'])) {
            $nonce = $_REQUEST['_wpnonce'];
            $key   = $_REQUEST['dismissMessage'];

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

dismissMessages accesses the super-global variable $_REQUEST.
Open

    private function dismissMessages()
    {
        if (\Xmf\Request::hasVar('dismissMessage', 'REQUEST') && isset($_REQUEST['_wpnonce'])) {
            $nonce = $_REQUEST['_wpnonce'];
            $key   = $_REQUEST['dismissMessage'];

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

dismissMessages accesses the super-global variable $_REQUEST.
Open

    private function dismissMessages()
    {
        if (\Xmf\Request::hasVar('dismissMessage', 'REQUEST') && isset($_REQUEST['_wpnonce'])) {
            $nonce = $_REQUEST['_wpnonce'];
            $key   = $_REQUEST['dismissMessage'];

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

Method checkWpFooter has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function checkWpFooter()
    {
        $current_theme = wp_get_theme();
        $theme_name    = $current_theme->Template;

Severity: Minor
Found in assets/js/ml-slider/inc/metaslider.systemcheck.class.php - About 1 hr to fix

    Function checkWpFooter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    
    Severity: Minor
    Found in assets/js/ml-slider/inc/metaslider.systemcheck.class.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

    Function checkImageLibrary has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        private function checkImageLibrary()
        {
            if (isset($this->options['imageLibrary']) && false === $this->options['imageLibrary']) {
                return;
            }
    Severity: Minor
    Found in assets/js/ml-slider/inc/metaslider.systemcheck.class.php - About 35 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

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

            if (\Xmf\Request::hasVar('dismissMessage', 'REQUEST') && isset($_REQUEST['_wpnonce'])) {

    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 checkImageLibrary uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $this->options['imageLibrary'] = false;
            }

    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 checkWordPressVersion uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $this->options['wordPressVersion'] = false;
            }

    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 checkWpFooter uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $file_path = $child_footer;
            }

    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 private methods such as 'checkWpFooter'.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    

    UnusedPrivateMethod

    Since: 0.2

    Unused Private Method detects when a private method is declared but is unused.

    Example

    class Something
    {
        private function foo() {} // unused
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

    Each class must be in a namespace of at least one level (a top-level vendor name)
    Open

    class MetaSliderSystemCheck

    Line exceeds 120 characters; contains 189 characters
    Open

            echo "<div id='message' class='updated'><p><b>Warning:</b> {$message}<br ><br ><a class='button' href='?page=metaslider&dismissMessage={$key}&_wpnonce={$nonce}'>Hide</a></p></div>";

    Line exceeds 120 characters; contains 297 characters
    Open

            $error = "Required call to wp_footer() not found in file <b>{$file_path}</b>. <br ><br >Please check the <a href='http://codex.wordpress.org/Function_Reference/wp_footer'>wp_footer()</a> documentation and make sure your theme has a call to wp_footer() just above the closing </body> tag.";

    Line exceeds 120 characters; contains 166 characters
    Open

            if ((!extension_loaded('gd') || !function_exists('gd_info')) && (!extension_loaded('imagick') || !class_exists('Imagick') || !class_exists('ImagickPixel'))) {

    Line exceeds 120 characters; contains 192 characters
    Open

                    $error = 'Role Scoper Plugin Detected. Please go to Roles > Options. Click the Realm Tab, scroll down to "Access Types" and uncheck the "Viewing content (front-end)" setting.';

    The variable $current_theme is not named in camelCase.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    

    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 $footer_file is not named in camelCase.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    

    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 $access_types is not named in camelCase.
    Open

        private function checkRoleScoper()
        {
            if (isset($this->options['roleScoper']) && false === $this->options['roleScoper']) {
                return;
            }

    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 $theme_name is not named in camelCase.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    

    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 $child_footer is not named in camelCase.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    

    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 $theme_type is not named in camelCase.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    

    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 $footer_file is not named in camelCase.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    

    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 $theme_name is not named in camelCase.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    

    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 $child_footer is not named in camelCase.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    

    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 $theme_type is not named in camelCase.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    

    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 $file_path is not named in camelCase.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    

    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 $child_footer is not named in camelCase.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    

    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 $footer_file is not named in camelCase.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    

    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 $access_types is not named in camelCase.
    Open

        private function checkRoleScoper()
        {
            if (isset($this->options['roleScoper']) && false === $this->options['roleScoper']) {
                return;
            }

    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 $parent_footer is not named in camelCase.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    

    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 $current_theme is not named in camelCase.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    

    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 $parent_footer is not named in camelCase.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    

    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 $theme_type is not named in camelCase.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    

    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 $file_path is not named in camelCase.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    

    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 $theme_type is not named in camelCase.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    

    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 $parent_footer is not named in camelCase.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    

    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 $access_types is not named in camelCase.
    Open

        private function checkRoleScoper()
        {
            if (isset($this->options['roleScoper']) && false === $this->options['roleScoper']) {
                return;
            }

    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 $parent_footer is not named in camelCase.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    

    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 $file_path is not named in camelCase.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    

    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 $footer_file is not named in camelCase.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    

    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 $child_footer is not named in camelCase.
    Open

        private function checkWpFooter()
        {
            $current_theme = wp_get_theme();
            $theme_name    = $current_theme->Template;
    
    

    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