XoopsModules25x/contact

View on GitHub
class/ContactHandler.php

Summary

Maintainability
C
1 day
Test Coverage

contactSendMail accesses the super-global variable $GLOBALS.
Open

    public function contactSendMail($contact)
    {
        $xoopsMailer = \xoops_getMailer();
        $xoopsMailer->useMail();
        $xoopsMailer->setToEmails($this->contactToEmails($contact['contact_department']));
Severity: Minor
Found in class/ContactHandler.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

contactSendMailConfirm accesses the super-global variable $GLOBALS.
Open

    public function contactSendMailConfirm($contact)
    {
        $xoopsMailer = \xoops_getMailer();
        $xoopsMailer->useMail();
        $xoopsMailer->setToEmails($contact['contact_mail']);
Severity: Minor
Found in class/ContactHandler.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

contactSendMail accesses the super-global variable $GLOBALS.
Open

    public function contactSendMail($contact)
    {
        $xoopsMailer = \xoops_getMailer();
        $xoopsMailer->useMail();
        $xoopsMailer->setToEmails($this->contactToEmails($contact['contact_department']));
Severity: Minor
Found in class/ContactHandler.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

contactSendMail accesses the super-global variable $GLOBALS.
Open

    public function contactSendMail($contact)
    {
        $xoopsMailer = \xoops_getMailer();
        $xoopsMailer->useMail();
        $xoopsMailer->setToEmails($this->contactToEmails($contact['contact_department']));
Severity: Minor
Found in class/ContactHandler.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

contactSendMail accesses the super-global variable $GLOBALS.
Open

    public function contactSendMail($contact)
    {
        $xoopsMailer = \xoops_getMailer();
        $xoopsMailer->useMail();
        $xoopsMailer->setToEmails($this->contactToEmails($contact['contact_department']));
Severity: Minor
Found in class/ContactHandler.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

The class ContactHandler has 15 public methods. Consider refactoring ContactHandler to keep number of public methods under 10.
Open

class ContactHandler extends \XoopsPersistableObjectHandler
{
    /**
     * ContactHandler constructor.
     * @param null|\XoopsDatabase $db
Severity: Minor
Found in class/ContactHandler.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class ContactHandler has an overall complexity of 59 which is very high. The configured complexity threshold is 50.
Open

class ContactHandler extends \XoopsPersistableObjectHandler
{
    /**
     * ContactHandler constructor.
     * @param null|\XoopsDatabase $db
Severity: Minor
Found in class/ContactHandler.php by phpmd

File ContactHandler.php has 299 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace XoopsModules\Contact;

/*
Severity: Minor
Found in class/ContactHandler.php - About 3 hrs to fix

    Method contactSendMail has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function contactSendMail($contact)
        {
            $xoopsMailer = \xoops_getMailer();
            $xoopsMailer->useMail();
            $xoopsMailer->setToEmails($this->contactToEmails($contact['contact_department']));
    Severity: Minor
    Found in class/ContactHandler.php - About 1 hr to fix

      Method contactSendMailConfirm has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function contactSendMailConfirm($contact)
          {
              $xoopsMailer = \xoops_getMailer();
              $xoopsMailer->useMail();
              $xoopsMailer->setToEmails($contact['contact_mail']);
      Severity: Minor
      Found in class/ContactHandler.php - About 1 hr to fix

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

            public function contactSendMail($contact)
            {
                $xoopsMailer = \xoops_getMailer();
                $xoopsMailer->useMail();
                $xoopsMailer->setToEmails($this->contactToEmails($contact['contact_department']));
        Severity: Minor
        Found in class/ContactHandler.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 contactSendMailConfirm has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function contactSendMailConfirm($contact)
            {
                $xoopsMailer = \xoops_getMailer();
                $xoopsMailer->useMail();
                $xoopsMailer->setToEmails($contact['contact_mail']);
        Severity: Minor
        Found in class/ContactHandler.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 contactLogs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function contactLogs($column, $timestamp = null)
            {
                $ret = [];
                if (!\in_array($column, ['contact_mail', 'contact_url', 'contact_phone'])) {
                    return $ret;
        Severity: Minor
        Found in class/ContactHandler.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

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

            public function contactToEmails($department = null)
            {
                //        global $xoopsConfig;
                $department_mail[] = \xoops_getModuleOption('contact_recipient_std', 'contact');
                if (!empty($department)) {
        Severity: Minor
        Found in class/ContactHandler.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 contactSendMailConfirm() has an NPath complexity of 512. The configured NPath complexity threshold is 200.
        Open

            public function contactSendMailConfirm($contact)
            {
                $xoopsMailer = \xoops_getMailer();
                $xoopsMailer->useMail();
                $xoopsMailer->setToEmails($contact['contact_mail']);
        Severity: Minor
        Found in class/ContactHandler.php by phpmd

        NPathComplexity

        Since: 0.1

        The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

        Example

        class Foo {
            function bar() {
                // lots of complicated code
            }
        }

        Source https://phpmd.org/rules/codesize.html#npathcomplexity

        The method contactSendMail() has an NPath complexity of 2048. The configured NPath complexity threshold is 200.
        Open

            public function contactSendMail($contact)
            {
                $xoopsMailer = \xoops_getMailer();
                $xoopsMailer->useMail();
                $xoopsMailer->setToEmails($this->contactToEmails($contact['contact_department']));
        Severity: Minor
        Found in class/ContactHandler.php by phpmd

        NPathComplexity

        Since: 0.1

        The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

        Example

        class Foo {
            function bar() {
                // lots of complicated code
            }
        }

        Source https://phpmd.org/rules/codesize.html#npathcomplexity

        The method contactSendMail() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
        Open

            public function contactSendMail($contact)
            {
                $xoopsMailer = \xoops_getMailer();
                $xoopsMailer->useMail();
                $xoopsMailer->setToEmails($this->contactToEmails($contact['contact_department']));
        Severity: Minor
        Found in class/ContactHandler.php by phpmd

        CyclomaticComplexity

        Since: 0.1

        Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

        Example

        // Cyclomatic Complexity = 11
        class Foo {
        1   public function example() {
        2       if ($a == $b) {
        3           if ($a1 == $b1) {
                        fiddle();
        4           } elseif ($a2 == $b2) {
                        fiddle();
                    } else {
                        fiddle();
                    }
        5       } elseif ($c == $d) {
        6           while ($c == $d) {
                        fiddle();
                    }
        7        } elseif ($e == $f) {
        8           for ($n = 0; $n < $h; $n++) {
                        fiddle();
                    }
                } else {
                    switch ($z) {
        9               case 1:
                            fiddle();
                            break;
        10              case 2:
                            fiddle();
                            break;
        11              case 3:
                            fiddle();
                            break;
                        default:
                            fiddle();
                            break;
                    }
                }
            }
        }

        Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

        The method contactSendMailConfirm() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
        Open

            public function contactSendMailConfirm($contact)
            {
                $xoopsMailer = \xoops_getMailer();
                $xoopsMailer->useMail();
                $xoopsMailer->setToEmails($contact['contact_mail']);
        Severity: Minor
        Found in class/ContactHandler.php by phpmd

        CyclomaticComplexity

        Since: 0.1

        Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

        Example

        // Cyclomatic Complexity = 11
        class Foo {
        1   public function example() {
        2       if ($a == $b) {
        3           if ($a1 == $b1) {
                        fiddle();
        4           } elseif ($a2 == $b2) {
                        fiddle();
                    } else {
                        fiddle();
                    }
        5       } elseif ($c == $d) {
        6           while ($c == $d) {
                        fiddle();
                    }
        7        } elseif ($e == $f) {
        8           for ($n = 0; $n < $h; $n++) {
                        fiddle();
                    }
                } else {
                    switch ($z) {
        9               case 1:
                            fiddle();
                            break;
        10              case 2:
                            fiddle();
                            break;
        11              case 3:
                            fiddle();
                            break;
                        default:
                            fiddle();
                            break;
                    }
                }
            }
        }

        Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

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

                return $department_mail;
        Severity: Minor
        Found in class/ContactHandler.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 '$department_mail' which will lead to PHP notices.
        Open

                $department_mail[] = \xoops_getModuleOption('contact_recipient_std', 'contact');
        Severity: Minor
        Found in class/ContactHandler.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 '$department_mail' which will lead to PHP notices.
        Open

                            $department_mail[] = $vale[1];
        Severity: Minor
        Found in class/ContactHandler.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

        Missing class import via use statement (line '339', column '25').
        Open

                $criteria = new \CriteriaCompo();
        Severity: Minor
        Found in class/ContactHandler.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 '313', column '28').
        Open

                $criteria->add(new \Criteria('contact_cid', $contact_id));
        Severity: Minor
        Found in class/ContactHandler.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 '314', column '28').
        Open

                $criteria->add(new \Criteria('contact_type', 'Contact'));
        Severity: Minor
        Found in class/ContactHandler.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 '312', column '25').
        Open

                $criteria = new \CriteriaCompo();
        Severity: Minor
        Found in class/ContactHandler.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 '340', column '28').
        Open

                $criteria->add(new \Criteria($id, '0'));
        Severity: Minor
        Found in class/ContactHandler.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 '394', column '32').
        Open

                    $criteria->add(new \Criteria('contact_reply', 1));
        Severity: Minor
        Found in class/ContactHandler.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 '480', column '28').
        Open

                $criteria->add(new \Criteria('contact_cid', '0'));
        Severity: Minor
        Found in class/ContactHandler.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 '479', column '25').
        Open

                $criteria = new \CriteriaCompo();
        Severity: Minor
        Found in class/ContactHandler.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 '408', column '28').
        Open

                $criteria->add(new \Criteria('contact_create', $timestamp, '<='));
        Severity: Minor
        Found in class/ContactHandler.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 '410', column '32').
        Open

                    $criteria->add(new \Criteria('contact_reply', 1));
        Severity: Minor
        Found in class/ContactHandler.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 '341', column '28').
        Open

                $criteria->add(new \Criteria('contact_type', 'Contact'));
        Severity: Minor
        Found in class/ContactHandler.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 '368', column '25').
        Open

                $criteria = new \CriteriaCompo();
        Severity: Minor
        Found in class/ContactHandler.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 '407', column '25').
        Open

                $criteria = new \CriteriaCompo();
        Severity: Minor
        Found in class/ContactHandler.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 '392', column '28').
        Open

                $criteria->add(new \Criteria('contact_create', $timestamp, '<='));
        Severity: Minor
        Found in class/ContactHandler.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 '370', column '28').
        Open

                $criteria->add(new \Criteria('contact_type', 'Contact'));
        Severity: Minor
        Found in class/ContactHandler.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 '369', column '28').
        Open

                $criteria->add(new \Criteria($id, '0'));
        Severity: Minor
        Found in class/ContactHandler.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 '391', column '25').
        Open

                $criteria = new \CriteriaCompo();
        Severity: Minor
        Found in class/ContactHandler.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 '482', column '32').
        Open

                    $criteria->add(new \Criteria('contact_create', $timestamp, '<='));
        Severity: Minor
        Found in class/ContactHandler.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

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

                $contact['contact_platform']   = Request::getString('contact_platform', 'Web', 'POST');
        Severity: Minor
        Found in class/ContactHandler.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 'contactInfoProcessing'.
        Open

                $contact['contact_type']       = Request::getString('contact_type', 'Contact', 'POST');
        Severity: Minor
        Found in class/ContactHandler.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 'contactInfoProcessing'.
        Open

                $contact['contact_nameto']     = Request::getString('contact_nameto', '', 'POST');
        Severity: Minor
        Found in class/ContactHandler.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 'contactInfoProcessing'.
        Open

                $contact['contact_location']   = Request::getString('contact_location', '', 'POST');
        Severity: Minor
        Found in class/ContactHandler.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 'contactInfoProcessing'.
        Open

                $contact['contact_mail']       = Request::getString('contact_mail', '', 'POST');
        Severity: Minor
        Found in class/ContactHandler.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 'contactInfoProcessing'.
        Open

                $contact['contact_icq']        = Request::getString('contact_icq', '', 'POST');
        Severity: Minor
        Found in class/ContactHandler.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 'contactInfoProcessing'.
        Open

                $contact['contact_phone']      = Request::getString('contact_phone', '', 'int');
        Severity: Minor
        Found in class/ContactHandler.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 'contactInfoProcessing'.
        Open

                $contact['contact_department'] = Request::getString('contact_department', \xoops_getModuleOption('contact_recipient_std', 'contact'), 'POST');
        Severity: Minor
        Found in class/ContactHandler.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 'contactInfoProcessing'.
        Open

                $contact['contact_cid']        = Request::getInt('contact_id', 0, 'POST');
        Severity: Minor
        Found in class/ContactHandler.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 'contactInfoProcessing'.
        Open

                $contact['contact_message']    = Request::getText('contact_message', '', 'POST');
        Severity: Minor
        Found in class/ContactHandler.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 'contactInfoProcessing'.
        Open

                $contact['contact_reply']      = Request::getInt('contact_reply', 0, 'POST');
        Severity: Minor
        Found in class/ContactHandler.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 contactSendMailConfirm uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                } else {
                    $message = $xoopsMailer->getErrors();
                }
        Severity: Minor
        Found in class/ContactHandler.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 '\Xmf\Request' in method 'contactInfoProcessing'.
        Open

                $contact['contact_name']       = Request::getString('contact_name', '', 'POST');
        Severity: Minor
        Found in class/ContactHandler.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 'contactInfoProcessing'.
        Open

                $contact['contact_url']        = Request::getUrl('contact_url', '', 'POST');
        Severity: Minor
        Found in class/ContactHandler.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 'contactInfoProcessing'.
        Open

                $contact['contact_address']    = Request::getString('contact_address', '', 'POST');
        Severity: Minor
        Found in class/ContactHandler.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 contactReplyMail uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                } else {
                    $message = $xoopsMailer->getErrors();
                }
        Severity: Minor
        Found in class/ContactHandler.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 contactSendMail uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                } else {
                    $message = $xoopsMailer->getErrors();
                }
        Severity: Minor
        Found in class/ContactHandler.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 '\XoopsUser' in method 'contactGetReply'.
        Open

                        $tab['contact_owner']  = \XoopsUser::getUnameFromId($root->getVar('contact_uid'));
        Severity: Minor
        Found in class/ContactHandler.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 'contactInfoProcessing'.
        Open

                $contact['contact_uid']        = Request::getInt('contact_uid', 0, 'POST');
        Severity: Minor
        Found in class/ContactHandler.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 'contactInfoProcessing'.
        Open

                $contact['contact_subject']    = Request::getString('contact_subject', '', 'POST');
        Severity: Minor
        Found in class/ContactHandler.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 'contactInfoProcessing'.
        Open

                $contact['contact_skype']      = Request::getString('contact_skype', '', 'POST');
        Severity: Minor
        Found in class/ContactHandler.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 'contactInfoProcessing'.
        Open

                $contact['contact_company']    = Request::getString('contact_company', '', 'POST');
        Severity: Minor
        Found in class/ContactHandler.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 'contactInfoProcessing'.
        Open

                $contact['contact_mailto']     = Request::getEmail('contact_mailto', '', 'POST');
        Severity: Minor
        Found in class/ContactHandler.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 '\XoopsUser' in method 'contactGetAdminList'.
        Open

                        $tab['contact_owner']  = \XoopsUser::getUnameFromId($root->getVar('contact_uid'));
        Severity: Minor
        Found in class/ContactHandler.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 variables with short names like $id. Configured minimum length is 3.
        Open

            public function contactGetAdminList($contact, $id)
        Severity: Minor
        Found in class/ContactHandler.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $db. Configured minimum length is 3.
        Open

            public function __construct(\XoopsDatabase $db = null)
        Severity: Minor
        Found in class/ContactHandler.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        The parameter $contact_id is not named in camelCase.
        Open

            public function contactAddReply($contact_id)
            {
                $obj = $this->get($contact_id);
                $obj->setVar('contact_reply', 1);
                if (!$this->insert($obj)) {
        Severity: Minor
        Found in class/ContactHandler.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 $contact_id is not named in camelCase.
        Open

            public function contactGetReply($contact_id)
            {
                $ret = false;
                $tab = [];
        
        
        Severity: Minor
        Found in class/ContactHandler.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

        Avoid variables with short names like $id. Configured minimum length is 3.
        Open

            public function contactGetCount($id)
        Severity: Minor
        Found in class/ContactHandler.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Line exceeds 120 characters; contains 150 characters
        Open

                $contact['contact_department'] = Request::getString('contact_department', \xoops_getModuleOption('contact_recipient_std', 'contact'), 'POST');
        Severity: Minor
        Found in class/ContactHandler.php by phpcodesniffer

        Line exceeds 120 characters; contains 133 characters
        Open

                        $ret = isset($global[$key]) ? filter_var($global[$key], FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED) : $default;
        Severity: Minor
        Found in class/ContactHandler.php by phpcodesniffer

        Line exceeds 120 characters; contains 127 characters
        Open

                    $subjectPrefix = '[' . $GLOBALS['xoopsModuleConfig']['prefix_text'] . ' ' . $contact['contact_department'] . ']: ';
        Severity: Minor
        Found in class/ContactHandler.php by phpcodesniffer

        Line exceeds 120 characters; contains 135 characters
        Open

                $body = \str_replace('{BODY}', \html_entity_decode($contact['contact_message'], \ENT_QUOTES, 'UTF-8'), \_MD_CONTACT_MAIL_BODY);
        Severity: Minor
        Found in class/ContactHandler.php by phpcodesniffer

        Line exceeds 120 characters; contains 121 characters
        Open

                $body = \str_replace('{SUBJECT}', \html_entity_decode($contact['contact_subject'], \ENT_QUOTES, 'UTF-8'), $body);
        Severity: Minor
        Found in class/ContactHandler.php by phpcodesniffer

        Line exceeds 120 characters; contains 122 characters
        Open

                $xoopsMailer->setSubject($subjectPrefix . \html_entity_decode($contact['contact_subject'], \ENT_QUOTES, 'UTF-8'));
        Severity: Minor
        Found in class/ContactHandler.php by phpcodesniffer

        Line exceeds 120 characters; contains 138 characters
        Open

                $body = \str_replace('{NAME}', \html_entity_decode($contact['contact_name'], \ENT_QUOTES, 'UTF-8'), _MD_CONTACT_MAILCONFIRM_BODY);
        Severity: Minor
        Found in class/ContactHandler.php by phpcodesniffer

        Line exceeds 120 characters; contains 157 characters
        Open

                if ($GLOBALS['xoopsModuleConfig']['form_dept'] && $GLOBALS['xoopsModuleConfig']['subject_prefix'] && $GLOBALS['xoopsModuleConfig']['contact_dept']) {
        Severity: Minor
        Found in class/ContactHandler.php by phpcodesniffer

        The variable $department_mail is not named in camelCase.
        Open

            public function contactToEmails($department = null)
            {
                //        global $xoopsConfig;
                $department_mail[] = \xoops_getModuleOption('contact_recipient_std', 'contact');
                if (!empty($department)) {
        Severity: Minor
        Found in class/ContactHandler.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 $department_mail is not named in camelCase.
        Open

            public function contactToEmails($department = null)
            {
                //        global $xoopsConfig;
                $department_mail[] = \xoops_getModuleOption('contact_recipient_std', 'contact');
                if (!empty($department)) {
        Severity: Minor
        Found in class/ContactHandler.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 $contact_id is not named in camelCase.
        Open

            public function contactGetReply($contact_id)
            {
                $ret = false;
                $tab = [];
        
        
        Severity: Minor
        Found in class/ContactHandler.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 $department_mail is not named in camelCase.
        Open

            public function contactToEmails($department = null)
            {
                //        global $xoopsConfig;
                $department_mail[] = \xoops_getModuleOption('contact_recipient_std', 'contact');
                if (!empty($department)) {
        Severity: Minor
        Found in class/ContactHandler.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 $contact_id is not named in camelCase.
        Open

            public function contactAddReply($contact_id)
            {
                $obj = $this->get($contact_id);
                $obj->setVar('contact_reply', 1);
                if (!$this->insert($obj)) {
        Severity: Minor
        Found in class/ContactHandler.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