mambax7/gbook

View on GitHub
class/Entries.php

Summary

Maintainability
A
1 hr
Test Coverage

getForm accesses the super-global variable $GLOBALS.
Open

    public function getForm($action = false): XoopsThemeForm
    {
        if (false === $action) {
            $action = Request::getString('REQUEST_URI', '', 'SERVER');
        }
Severity: Minor
Found in class/Entries.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 getForm has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getForm($action = false): XoopsThemeForm
    {
        if (false === $action) {
            $action = Request::getString('REQUEST_URI', '', 'SERVER');
        }
Severity: Minor
Found in class/Entries.php - About 1 hr to fix

    Avoid using undefined variables such as '$options' which will lead to PHP notices.
    Open

            $noteEditor = $utility::getEditor($helper, $options);
    Severity: Minor
    Found in class/Entries.php by phpmd

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

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

    Avoid using undefined variables such as '$options' which will lead to PHP notices.
    Open

            $options['rows']   = 25;
    Severity: Minor
    Found in class/Entries.php by phpmd

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

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

    Avoid using undefined variables such as '$options' which will lead to PHP notices.
    Open

            $messageEditor = $utility::getEditor($helper, $options);
    Severity: Minor
    Found in class/Entries.php by phpmd

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

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

    Avoid using undefined variables such as '$options' which will lead to PHP notices.
    Open

            $options['height'] = '400px';
    Severity: Minor
    Found in class/Entries.php by phpmd

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

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

    Avoid using undefined variables such as '$options' which will lead to PHP notices.
    Open

            $options['value'] = $this->getVar('note', 'e');
    Severity: Minor
    Found in class/Entries.php by phpmd

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

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

    Avoid using undefined variables such as '$options' which will lead to PHP notices.
    Open

            $options['value']  = $this->getVar('message', 'e');
    Severity: Minor
    Found in class/Entries.php by phpmd

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

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

    Avoid using undefined variables such as '$options' which will lead to PHP notices.
    Open

            $options['width']  = '100%';
    Severity: Minor
    Found in class/Entries.php by phpmd

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

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

    Avoid using undefined variables such as '$options' which will lead to PHP notices.
    Open

            $options['cols']   = '100%';
    Severity: Minor
    Found in class/Entries.php by phpmd

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

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

    Avoid using undefined variables such as '$options' which will lead to PHP notices.
    Open

            $options['name']   = 'message';
    Severity: Minor
    Found in class/Entries.php by phpmd

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

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

    Avoid using undefined variables such as '$options' which will lead to PHP notices.
    Open

            $options['name']  = 'note';
    Severity: Minor
    Found in class/Entries.php by phpmd

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

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

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

        public function getForm($action = false): XoopsThemeForm
    Severity: Minor
    Found in class/Entries.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 '\XoopsModules\Gbook\Helper' in method 'getForm'.
    Open

            $helper  = Gbook\Helper::getInstance();
    Severity: Minor
    Found in class/Entries.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 '\Xmf\Request' in method 'getForm'.
    Open

                $action = Request::getString('REQUEST_URI', '', 'SERVER');
    Severity: Minor
    Found in class/Entries.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

    There must be one blank line after the last USE statement; 5 found;
    Open

    use XoopsThemeForm;
    Severity: Minor
    Found in class/Entries.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status