XoopsModules25x/xoopspoll

View on GitHub
class/Common/ModuleFeedback.php

Summary

Maintainability
A
1 hr
Test Coverage

getFormFeedback accesses the super-global variable $GLOBALS.
Open

    public function getFormFeedback($action = false): XoopsThemeForm
    {
        if (!$action) {
            $action = $_SERVER['REQUEST_URI'];
        }
Severity: Minor
Found in class/Common/ModuleFeedback.php by phpmd

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

getFormFeedback accesses the super-global variable $_SERVER.
Open

    public function getFormFeedback($action = false): XoopsThemeForm
    {
        if (!$action) {
            $action = $_SERVER['REQUEST_URI'];
        }
Severity: Minor
Found in class/Common/ModuleFeedback.php by phpmd

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 getFormFeedback has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getFormFeedback($action = false): XoopsThemeForm
    {
        if (!$action) {
            $action = $_SERVER['REQUEST_URI'];
        }
Severity: Minor
Found in class/Common/ModuleFeedback.php - About 1 hr to fix

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

        public function getFormFeedback($action = false): XoopsThemeForm
    Severity: Minor
    Found in class/Common/ModuleFeedback.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

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

    <?php declare(strict_types=1);

    Line exceeds 120 characters; contains 173 characters
    Open

            $recipient = new XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_RECIPIENT'), 'recipient', 50, 255, $GLOBALS['xoopsModule']->getInfo('author_mail'));

    Line exceeds 120 characters; contains 132 characters
    Open

            $your_site = new XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE'), 'your_site', 50, 255, $this->site);

    Line exceeds 120 characters; contains 122 characters
    Open

            $your_mail->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER') . '"');

    Line exceeds 120 characters; contains 151 characters
    Open

            $editor                  = new XoopsFormEditor(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_CONTENT'), 'fb_content', $editorConfigs);

    Line exceeds 120 characters; contains 133 characters
    Open

            $your_mail = new XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL'), 'your_mail', 50, 255, $this->email);

    Line exceeds 120 characters; contains 163 characters
    Open

            $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_OTHERS'));

    Line exceeds 120 characters; contains 126 characters
    Open

            $fbtypeSelect = new XoopsFormSelect(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE'), 'fb_type', $this->type);

    Line exceeds 120 characters; contains 171 characters
    Open

            $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_SUGGESTION'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_SUGGESTION'));

    Line exceeds 120 characters; contains 159 characters
    Open

            $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_BUGS'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_BUGS'));

    Line exceeds 120 characters; contains 167 characters
    Open

            $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_FEATURES'));

    Line exceeds 120 characters; contains 122 characters
    Open

            $your_name->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME_PLACEHOLER') . '"');

    Line exceeds 120 characters; contains 132 characters
    Open

            $your_name = new XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME'), 'your_name', 50, 255, $this->name);

    Line exceeds 120 characters; contains 173 characters
    Open

            $fbtypeSelect->addOption(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_TESTIMONIAL'), \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_TESTIMONIAL'));

    Line exceeds 120 characters; contains 145 characters
    Open

            $form = new XoopsThemeForm(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_FORM_TITLE'), 'formfeedback', 'feedback.php', 'post', true);

    Line exceeds 120 characters; contains 122 characters
    Open

            $your_site->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE_PLACEHOLER') . '"');

    The variable $your_site is not named in camelCase.
    Open

        public function getFormFeedback($action = false): XoopsThemeForm
        {
            if (!$action) {
                $action = $_SERVER['REQUEST_URI'];
            }
    Severity: Minor
    Found in class/Common/ModuleFeedback.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 $your_site is not named in camelCase.
    Open

        public function getFormFeedback($action = false): XoopsThemeForm
        {
            if (!$action) {
                $action = $_SERVER['REQUEST_URI'];
            }
    Severity: Minor
    Found in class/Common/ModuleFeedback.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 $your_site is not named in camelCase.
    Open

        public function getFormFeedback($action = false): XoopsThemeForm
        {
            if (!$action) {
                $action = $_SERVER['REQUEST_URI'];
            }
    Severity: Minor
    Found in class/Common/ModuleFeedback.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 $your_mail is not named in camelCase.
    Open

        public function getFormFeedback($action = false): XoopsThemeForm
        {
            if (!$action) {
                $action = $_SERVER['REQUEST_URI'];
            }
    Severity: Minor
    Found in class/Common/ModuleFeedback.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 $your_name is not named in camelCase.
    Open

        public function getFormFeedback($action = false): XoopsThemeForm
        {
            if (!$action) {
                $action = $_SERVER['REQUEST_URI'];
            }
    Severity: Minor
    Found in class/Common/ModuleFeedback.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 $your_name is not named in camelCase.
    Open

        public function getFormFeedback($action = false): XoopsThemeForm
        {
            if (!$action) {
                $action = $_SERVER['REQUEST_URI'];
            }
    Severity: Minor
    Found in class/Common/ModuleFeedback.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 $your_mail is not named in camelCase.
    Open

        public function getFormFeedback($action = false): XoopsThemeForm
        {
            if (!$action) {
                $action = $_SERVER['REQUEST_URI'];
            }
    Severity: Minor
    Found in class/Common/ModuleFeedback.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 $your_mail is not named in camelCase.
    Open

        public function getFormFeedback($action = false): XoopsThemeForm
        {
            if (!$action) {
                $action = $_SERVER['REQUEST_URI'];
            }
    Severity: Minor
    Found in class/Common/ModuleFeedback.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 $your_name is not named in camelCase.
    Open

        public function getFormFeedback($action = false): XoopsThemeForm
        {
            if (!$action) {
                $action = $_SERVER['REQUEST_URI'];
            }
    Severity: Minor
    Found in class/Common/ModuleFeedback.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