XoopsModules25x/xlanguage

View on GitHub
class/Utility.php

Summary

Maintainability
D
2 days
Test Coverage

detectLang accesses the super-global variable $_SERVER.
Open

    public static function detectLang()
    {
        global  $_SERVER;
        //      if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
        if (Request::hasVar('HTTP_ACCEPT_LANGUAGE', 'SERVER')) {
Severity: Minor
Found in class/Utility.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

Function showSelectedLanguage has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    public static function showSelectedLanguage($options = null)
    {
        require_once XOOPS_ROOT_PATH . '/modules/xlanguage/blocks/xlanguage_blocks.php';
        if (empty($options)) {
            $options[0] = 'images'; // display style: image, text, select
Severity: Minor
Found in class/Utility.php - About 5 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

class Utility extends Common\SysUtility
{
    //--------------- Custom module methods -----------------------------
    /**
     * @param $value
Severity: Minor
Found in class/Utility.php by phpmd

Function cleanMultiLang has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public static function cleanMultiLang($text)
    {
        global $xoopsConfig;
        global $xlanguage_langs;
        $patterns = [];
Severity: Minor
Found in class/Utility.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

    public static function cleanMultiLang($text)
    {
        global $xoopsConfig;
        global $xlanguage_langs;
        $patterns = [];
Severity: Minor
Found in class/Utility.php - About 1 hr to fix

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

        public static function showSelectedLanguage($options = null)
        {
            require_once XOOPS_ROOT_PATH . '/modules/xlanguage/blocks/xlanguage_blocks.php';
            if (empty($options)) {
                $options[0] = 'images'; // display style: image, text, select
    Severity: Minor
    Found in class/Utility.php - About 1 hr to fix

      Function getPreferredLanguage has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function getPreferredLanguage()
          {
              $langs = [];
              $lang  = '';
              //        if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
      Severity: Minor
      Found in class/Utility.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 langDetect has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function langDetect($str = '', $envType = '')
          {
              require dirname(__DIR__) . '/include/vars.php';
              $lang = '';
      
      
      Severity: Minor
      Found in class/Utility.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 detectLang has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function detectLang()
          {
              global  $_SERVER;
              //      if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
              if (Request::hasVar('HTTP_ACCEPT_LANGUAGE', 'SERVER')) {
      Severity: Minor
      Found in class/Utility.php - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method detectLang has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function detectLang()
          {
              global  $_SERVER;
              //      if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
              if (Request::hasVar('HTTP_ACCEPT_LANGUAGE', 'SERVER')) {
      Severity: Minor
      Found in class/Utility.php - About 1 hr to fix

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

            public static function convertItem($value, $out_charset, $in_charset)
            {
                if (mb_strtolower($in_charset) == mb_strtolower($out_charset)) {
                    return $value;
                }
        Severity: Minor
        Found in class/Utility.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 cleanMultiLang() has an NPath complexity of 288. The configured NPath complexity threshold is 200.
        Open

            public static function cleanMultiLang($text)
            {
                global $xoopsConfig;
                global $xlanguage_langs;
                $patterns = [];
        Severity: Minor
        Found in class/Utility.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 detectLang() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
        Open

            public static function detectLang()
            {
                global  $_SERVER;
                //      if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
                if (Request::hasVar('HTTP_ACCEPT_LANGUAGE', 'SERVER')) {
        Severity: Minor
        Found in class/Utility.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 showSelectedLanguage() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
        Open

            public static function showSelectedLanguage($options = null)
            {
                require_once XOOPS_ROOT_PATH . '/modules/xlanguage/blocks/xlanguage_blocks.php';
                if (empty($options)) {
                    $options[0] = 'images'; // display style: image, text, select
        Severity: Minor
        Found in class/Utility.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 cleanMultiLang() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
        Open

            public static function cleanMultiLang($text)
            {
                global $xoopsConfig;
                global $xlanguage_langs;
                $patterns = [];
        Severity: Minor
        Found in class/Utility.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 '$available_languages' which will lead to PHP notices.
        Open

                    $xoops_lang = isset($available_languages[$lang][1])?:'';
        Severity: Minor
        Found in class/Utility.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

        Remove error control operator '@' on line 49.
        Open

            public static function convertItem($value, $out_charset, $in_charset)
            {
                if (mb_strtolower($in_charset) == mb_strtolower($out_charset)) {
                    return $value;
                }
        Severity: Minor
        Found in class/Utility.php by phpmd

        ErrorControlOperator

        Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

        Example

        function foo($filePath) {
            $file = @fopen($filPath); // hides exceptions
            $key = @$array[$notExistingKey]; // assigns null to $key
        }

        Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

        Remove error control operator '@' on line 50.
        Open

            public static function convertItem($value, $out_charset, $in_charset)
            {
                if (mb_strtolower($in_charset) == mb_strtolower($out_charset)) {
                    return $value;
                }
        Severity: Minor
        Found in class/Utility.php by phpmd

        ErrorControlOperator

        Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

        Example

        function foo($filePath) {
            $file = @fopen($filPath); // hides exceptions
            $key = @$array[$notExistingKey]; // assigns null to $key
        }

        Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

        Remove error control operator '@' on line 54.
        Open

            public static function convertItem($value, $out_charset, $in_charset)
            {
                if (mb_strtolower($in_charset) == mb_strtolower($out_charset)) {
                    return $value;
                }
        Severity: Minor
        Found in class/Utility.php by phpmd

        ErrorControlOperator

        Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

        Example

        function foo($filePath) {
            $file = @fopen($filPath); // hides exceptions
            $key = @$array[$notExistingKey]; // assigns null to $key
        }

        Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

        Remove error control operator '@' on line 243.
        Open

            public static function cleanMultiLang($text)
            {
                global $xoopsConfig;
                global $xlanguage_langs;
                $patterns = [];
        Severity: Minor
        Found in class/Utility.php by phpmd

        ErrorControlOperator

        Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

        Example

        function foo($filePath) {
            $file = @fopen($filPath); // hides exceptions
            $key = @$array[$notExistingKey]; // assigns null to $key
        }

        Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

        Remove error control operator '@' on line 56.
        Open

            public static function convertItem($value, $out_charset, $in_charset)
            {
                if (mb_strtolower($in_charset) == mb_strtolower($out_charset)) {
                    return $value;
                }
        Severity: Minor
        Found in class/Utility.php by phpmd

        ErrorControlOperator

        Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

        Example

        function foo($filePath) {
            $file = @fopen($filPath); // hides exceptions
            $key = @$array[$notExistingKey]; // assigns null to $key
        }

        Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

        Avoid using static access to class 'XoopsModules\Xlanguage\Helper' in method 'createConfig'.
        Open

                $helper          = Helper::getInstance();
        Severity: Minor
        Found in class/Utility.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 'detectLang'.
        Open

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

                    } else {
                        $content .= '<select name="' . $block['tag'] . '"
                        onChange="if (this.options[this.selectedIndex].value.length >0) { window.document.location=this.options[this.selectedIndex].value;}"
                        >';
                        if (!empty($block['languages'])) { //mb
        Severity: Minor
        Found in class/Utility.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 'detectLang'.
        Open

                if (Request::hasVar('HTTP_ACCEPT_LANGUAGE', 'SERVER')) {
        Severity: Minor
        Found in class/Utility.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 'XoopsModules\Xlanguage\Helper' in method 'cleanMultiLang'.
        Open

                    $helper          = Helper::getInstance();
        Severity: Minor
        Found in class/Utility.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 'getPreferredLanguage'.
        Open

                    $temp = Request::getString('HTTP_ACCEPT_LANGUAGE', '', 'SERVER');
        Severity: Minor
        Found in class/Utility.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 'detectLang'.
        Open

                if (Request::hasVar('HTTP_USER_AGENT', 'SERVER')) {
        Severity: Minor
        Found in class/Utility.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 'getPreferredLanguage'.
        Open

                if (Request::hasVar('HTTP_ACCEPT_LANGUAGE', 'SERVER')) {
        Severity: Minor
        Found in class/Utility.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 assigning values to variables in if clauses and the like (line '50', column '42').
        Open

            public static function convertItem($value, $out_charset, $in_charset)
            {
                if (mb_strtolower($in_charset) == mb_strtolower($out_charset)) {
                    return $value;
                }
        Severity: Minor
        Found in class/Utility.php by phpmd

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

        Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

        The method showSelectedLanguage uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                            } else {
                                $content .= $lang['desc'];
                            }
        Severity: Minor
        Found in class/Utility.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 'detectLang'.
        Open

                    $HTTP_USER_AGENT = Request::getString('HTTP_USER_AGENT', '', 'SERVER');
        Severity: Minor
        Found in class/Utility.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 'XoopsModules\Xlanguage\Helper' in method 'loadConfig'.
        Open

                $helper          = Helper::getInstance();
        Severity: Minor
        Found in class/Utility.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 convertEncoding uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                } else {
                    $value = static::convertItem($value, $out_charset, $in_charset);
                }
        Severity: Minor
        Found in class/Utility.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 unused local variables such as '$available_languages'.
        Open

                    $xoops_lang = isset($available_languages[$lang][1])?:'';
        Severity: Minor
        Found in class/Utility.php by phpmd

        UnusedLocalVariable

        Since: 0.2

        Detects when a local variable is declared and/or assigned, but not used.

        Example

        class Foo {
            public function doSomething()
            {
                $i = 5; // Unused
            }
        }

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

        Avoid unused local variables such as '$pqhtmltags'.
        Open

                $pqhtmltags  = \explode(',', preg_quote(\XLANGUAGE_TAGS_RESERVED, '/'));
        Severity: Minor
        Found in class/Utility.php by phpmd

        UnusedLocalVariable

        Since: 0.2

        Detects when a local variable is declared and/or assigned, but not used.

        Example

        class Foo {
            public function doSomething()
            {
                $i = 5; // Unused
            }
        }

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

        The parameter $in_charset is not named in camelCase.
        Open

            public static function convertEncoding($value, $out_charset, $in_charset)
            {
                if (\is_array($value)) {
                    foreach ($value as $key => $val) {
                        $value[$key] = static::convertEncoding($val, $out_charset, $in_charset);
        Severity: Minor
        Found in class/Utility.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 $out_charset is not named in camelCase.
        Open

            public static function convertItem($value, $out_charset, $in_charset)
            {
                if (mb_strtolower($in_charset) == mb_strtolower($out_charset)) {
                    return $value;
                }
        Severity: Minor
        Found in class/Utility.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 $out_charset is not named in camelCase.
        Open

            public static function convertEncoding($value, $out_charset, $in_charset)
            {
                if (\is_array($value)) {
                    foreach ($value as $key => $val) {
                        $value[$key] = static::convertEncoding($val, $out_charset, $in_charset);
        Severity: Minor
        Found in class/Utility.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 $i. Configured minimum length is 3.
        Open

                $i       = 1;
        Severity: Minor
        Found in class/Utility.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 $in_charset is not named in camelCase.
        Open

            public static function convertItem($value, $out_charset, $in_charset)
            {
                if (mb_strtolower($in_charset) == mb_strtolower($out_charset)) {
                    return $value;
                }
        Severity: Minor
        Found in class/Utility.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

        There must be one USE keyword per declaration
        Open

        use XoopsModules\Xlanguage\{Common
        Severity: Minor
        Found in class/Utility.php by phpcodesniffer

        Line exceeds 120 characters; contains 132 characters
        Open

                    $text = \preg_replace('/\[[\/]?[\|]?' . preg_quote($xoopsConfig['language'], '~') . '[\|]?\](\<br \/\>)?/i', '', $text);
        Severity: Minor
        Found in class/Utility.php by phpcodesniffer

        Line exceeds 120 characters; contains 174 characters
        Open

                    $patterns[] = '/(\[([^\]]*\|)?' . preg_quote($lang, '~') . '(\|[^\]]*)?\])(' . $mid_pattern . ')(\[\/([^\]]*\|)?' . preg_quote($lang, '~') . '(\|[^\]]*)?\])/isU';
        Severity: Minor
        Found in class/Utility.php by phpcodesniffer

        Line exceeds 120 characters; contains 148 characters
        Open

                        onChange="if (this.options[this.selectedIndex].value.length >0) { window.document.location=this.options[this.selectedIndex].value;}"
        Severity: Minor
        Found in class/Utility.php by phpcodesniffer

        Line exceeds 120 characters; contains 133 characters
        Open

                    $pattern = '/(\[([\/])?(' . \implode('|', \array_map('\preg_quote', \array_values($xlanguage_langs))) . ')([\|\]]))/isU';
        Severity: Minor
        Found in class/Utility.php by phpcodesniffer

        Line exceeds 120 characters; contains 129 characters
        Open

                if (\is_object($xconvHandler) && $convertedValue = @$xconvHandler->convert_encoding($value, $out_charset, $in_charset)) {
        Severity: Minor
        Found in class/Utility.php by phpcodesniffer

        Line exceeds 120 characters; contains 193 characters
        Open

                        if ((1 == $envType && \preg_match('#^(' . $expr . ')(;q=[0-9]\\.[0-9])?$#i', $str)) || (2 == $envType && \preg_match('#(\(|\[|;[[:space:]])(' . $expr . ')(;|\]|\))#i', $str))) {
        Severity: Minor
        Found in class/Utility.php by phpcodesniffer

        Line exceeds 120 characters; contains 123 characters
        Open

                if (\preg_match("/^\<\?[\s]?xml[\s]+version=([\"'])[^\>]+\\1[\s]+encoding=([\"'])[^\>]+\\2[\s]?\?\>/i", $output)) {
        Severity: Minor
        Found in class/Utility.php by phpcodesniffer

        Line exceeds 120 characters; contains 195 characters
        Open

                    $patterns[] = '/(\[([^\]]*\|)?' . preg_quote($name, '~') . '(\|[^\]]*)?\])(' . $mid_pattern . ')(\[\/([^\]]*\|)?' . preg_quote($name, '~') . '(\|[^\]]*)?(\]\<br[\s]?[\/]?\>|\]))/isU';
        Severity: Minor
        Found in class/Utility.php by phpcodesniffer

        Line indented incorrectly; expected 8 spaces, found 12
        Open

                    }
        Severity: Minor
        Found in class/Utility.php by phpcodesniffer

        Line indented incorrectly; expected 12 spaces, found 16
        Open

                        foreach ($accepted as $iValue) {
        Severity: Minor
        Found in class/Utility.php by phpcodesniffer

        Line indented incorrectly; expected 12 spaces, found 16
        Open

                        }
        Severity: Minor
        Found in class/Utility.php by phpcodesniffer

        Line indented incorrectly; expected 16 spaces, found 20
        Open

                            }
        Severity: Minor
        Found in class/Utility.php by phpcodesniffer

        Line indented incorrectly; expected 8 spaces, found 12
        Open

                    if (empty($lang) && !empty($HTTP_ACCEPT_LANGUAGE)) {
        Severity: Minor
        Found in class/Utility.php by phpcodesniffer

        Closing brace indented incorrectly; expected 10 spaces, found 8
        Open

                }
        Severity: Minor
        Found in class/Utility.php by phpcodesniffer

        Line indented incorrectly; expected 8 spaces, found 10
        Open

                  if (!empty($lang)) {
        Severity: Minor
        Found in class/Utility.php by phpcodesniffer

        Line indented incorrectly; expected 16 spaces, found 20
        Open

                            if (strncasecmp($lang, 'en', 2)) {
        Severity: Minor
        Found in class/Utility.php by phpcodesniffer

        The variable $HTTP_USER_AGENT is not named in camelCase.
        Open

            public static function detectLang()
            {
                global  $_SERVER;
                //      if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
                if (Request::hasVar('HTTP_ACCEPT_LANGUAGE', 'SERVER')) {
        Severity: Minor
        Found in class/Utility.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 $xoops_lang is not named in camelCase.
        Open

            public static function detectLang()
            {
                global  $_SERVER;
                //      if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
                if (Request::hasVar('HTTP_ACCEPT_LANGUAGE', 'SERVER')) {
        Severity: Minor
        Found in class/Utility.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 $xlanguage_langs is not named in camelCase.
        Open

            public static function cleanMultiLang($text)
            {
                global $xoopsConfig;
                global $xlanguage_langs;
                $patterns = [];
        Severity: Minor
        Found in class/Utility.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 $out_charset is not named in camelCase.
        Open

            public static function convertItem($value, $out_charset, $in_charset)
            {
                if (mb_strtolower($in_charset) == mb_strtolower($out_charset)) {
                    return $value;
                }
        Severity: Minor
        Found in class/Utility.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 $in_charset is not named in camelCase.
        Open

            public static function convertItem($value, $out_charset, $in_charset)
            {
                if (mb_strtolower($in_charset) == mb_strtolower($out_charset)) {
                    return $value;
                }
        Severity: Minor
        Found in class/Utility.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 $xlanguage_langs is not named in camelCase.
        Open

            public static function cleanMultiLang($text)
            {
                global $xoopsConfig;
                global $xlanguage_langs;
                $patterns = [];
        Severity: Minor
        Found in class/Utility.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 $xlanguage_langs is not named in camelCase.
        Open

            public static function cleanMultiLang($text)
            {
                global $xoopsConfig;
                global $xlanguage_langs;
                $patterns = [];
        Severity: Minor
        Found in class/Utility.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 $xlanguage_langs is not named in camelCase.
        Open

            public static function escapeBracketMultiLang($matches)
            {
                global $xlanguage_langs;
                $ret = $matches[1];
                if (!empty($xlanguage_langs)) {
        Severity: Minor
        Found in class/Utility.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 $in_charset is not named in camelCase.
        Open

            public static function convertItem($value, $out_charset, $in_charset)
            {
                if (mb_strtolower($in_charset) == mb_strtolower($out_charset)) {
                    return $value;
                }
        Severity: Minor
        Found in class/Utility.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 $HTTP_ACCEPT_LANGUAGE is not named in camelCase.
        Open

            public static function detectLang()
            {
                global  $_SERVER;
                //      if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
                if (Request::hasVar('HTTP_ACCEPT_LANGUAGE', 'SERVER')) {
        Severity: Minor
        Found in class/Utility.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 $xoops_lang is not named in camelCase.
        Open

            public static function detectLang()
            {
                global  $_SERVER;
                //      if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
                if (Request::hasVar('HTTP_ACCEPT_LANGUAGE', 'SERVER')) {
        Severity: Minor
        Found in class/Utility.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 $in_charset is not named in camelCase.
        Open

            public static function encodeCharSet($output)
            {
                global $xlanguage;
                $output = static::cleanMultiLang($output);
                // escape XML doc
        Severity: Minor
        Found in class/Utility.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 $xlanguage_langs is not named in camelCase.
        Open

            public static function escapeBracketMultiLang($matches)
            {
                global $xlanguage_langs;
                $ret = $matches[1];
                if (!empty($xlanguage_langs)) {
        Severity: Minor
        Found in class/Utility.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 $in_charset is not named in camelCase.
        Open

            public static function convertEncoding($value, $out_charset, $in_charset)
            {
                if (\is_array($value)) {
                    foreach ($value as $key => $val) {
                        $value[$key] = static::convertEncoding($val, $out_charset, $in_charset);
        Severity: Minor
        Found in class/Utility.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 $HTTP_ACCEPT_LANGUAGE is not named in camelCase.
        Open

            public static function detectLang()
            {
                global  $_SERVER;
                //      if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
                if (Request::hasVar('HTTP_ACCEPT_LANGUAGE', 'SERVER')) {
        Severity: Minor
        Found in class/Utility.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 $xlanguage_langs is not named in camelCase.
        Open

            public static function cleanMultiLang($text)
            {
                global $xoopsConfig;
                global $xlanguage_langs;
                $patterns = [];
        Severity: Minor
        Found in class/Utility.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 $_lang is not named in camelCase.
        Open

            public static function cleanMultiLang($text)
            {
                global $xoopsConfig;
                global $xlanguage_langs;
                $patterns = [];
        Severity: Minor
        Found in class/Utility.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 $xlanguage_langs is not named in camelCase.
        Open

            public static function cleanMultiLang($text)
            {
                global $xoopsConfig;
                global $xlanguage_langs;
                $patterns = [];
        Severity: Minor
        Found in class/Utility.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 $lang_parse is not named in camelCase.
        Open

            public static function getPreferredLanguage()
            {
                $langs = [];
                $lang  = '';
                //        if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
        Severity: Minor
        Found in class/Utility.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 $out_charset is not named in camelCase.
        Open

            public static function convertEncoding($value, $out_charset, $in_charset)
            {
                if (\is_array($value)) {
                    foreach ($value as $key => $val) {
                        $value[$key] = static::convertEncoding($val, $out_charset, $in_charset);
        Severity: Minor
        Found in class/Utility.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 $out_charset is not named in camelCase.
        Open

            public static function convertItem($value, $out_charset, $in_charset)
            {
                if (mb_strtolower($in_charset) == mb_strtolower($out_charset)) {
                    return $value;
                }
        Severity: Minor
        Found in class/Utility.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 $out_charset is not named in camelCase.
        Open

            public static function encodeCharSet($output)
            {
                global $xlanguage;
                $output = static::cleanMultiLang($output);
                // escape XML doc
        Severity: Minor
        Found in class/Utility.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 $_lang is not named in camelCase.
        Open

            public static function cleanMultiLang($text)
            {
                global $xoopsConfig;
                global $xlanguage_langs;
                $patterns = [];
        Severity: Minor
        Found in class/Utility.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 $xlanguage_langs is not named in camelCase.
        Open

            public static function cleanMultiLang($text)
            {
                global $xoopsConfig;
                global $xlanguage_langs;
                $patterns = [];
        Severity: Minor
        Found in class/Utility.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 $xoops_lang is not named in camelCase.
        Open

            public static function detectLang()
            {
                global  $_SERVER;
                //      if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
                if (Request::hasVar('HTTP_ACCEPT_LANGUAGE', 'SERVER')) {
        Severity: Minor
        Found in class/Utility.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 $available_languages is not named in camelCase.
        Open

            public static function detectLang()
            {
                global  $_SERVER;
                //      if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
                if (Request::hasVar('HTTP_ACCEPT_LANGUAGE', 'SERVER')) {
        Severity: Minor
        Found in class/Utility.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 $out_charset is not named in camelCase.
        Open

            public static function encodeCharSet($output)
            {
                global $xlanguage;
                $output = static::cleanMultiLang($output);
                // escape XML doc
        Severity: Minor
        Found in class/Utility.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 $HTTP_ACCEPT_LANGUAGE is not named in camelCase.
        Open

            public static function detectLang()
            {
                global  $_SERVER;
                //      if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
                if (Request::hasVar('HTTP_ACCEPT_LANGUAGE', 'SERVER')) {
        Severity: Minor
        Found in class/Utility.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 $available_languages is not named in camelCase.
        Open

            public static function langDetect($str = '', $envType = '')
            {
                require dirname(__DIR__) . '/include/vars.php';
                $lang = '';
        
        
        Severity: Minor
        Found in class/Utility.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 $HTTP_USER_AGENT is not named in camelCase.
        Open

            public static function detectLang()
            {
                global  $_SERVER;
                //      if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
                if (Request::hasVar('HTTP_ACCEPT_LANGUAGE', 'SERVER')) {
        Severity: Minor
        Found in class/Utility.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 $in_charset is not named in camelCase.
        Open

            public static function convertEncoding($value, $out_charset, $in_charset)
            {
                if (\is_array($value)) {
                    foreach ($value as $key => $val) {
                        $value[$key] = static::convertEncoding($val, $out_charset, $in_charset);
        Severity: Minor
        Found in class/Utility.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 $xlanguage_langs is not named in camelCase.
        Open

            public static function escapeBracketMultiLang($matches)
            {
                global $xlanguage_langs;
                $ret = $matches[1];
                if (!empty($xlanguage_langs)) {
        Severity: Minor
        Found in class/Utility.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 $lang_parse is not named in camelCase.
        Open

            public static function getPreferredLanguage()
            {
                $langs = [];
                $lang  = '';
                //        if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
        Severity: Minor
        Found in class/Utility.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 $out_charset is not named in camelCase.
        Open

            public static function convertItem($value, $out_charset, $in_charset)
            {
                if (mb_strtolower($in_charset) == mb_strtolower($out_charset)) {
                    return $value;
                }
        Severity: Minor
        Found in class/Utility.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 $available_languages is not named in camelCase.
        Open

            public static function langDetect($str = '', $envType = '')
            {
                require dirname(__DIR__) . '/include/vars.php';
                $lang = '';
        
        
        Severity: Minor
        Found in class/Utility.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 $lang_parse is not named in camelCase.
        Open

            public static function getPreferredLanguage()
            {
                $langs = [];
                $lang  = '';
                //        if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
        Severity: Minor
        Found in class/Utility.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 $out_charset is not named in camelCase.
        Open

            public static function convertEncoding($value, $out_charset, $in_charset)
            {
                if (\is_array($value)) {
                    foreach ($value as $key => $val) {
                        $value[$key] = static::convertEncoding($val, $out_charset, $in_charset);
        Severity: Minor
        Found in class/Utility.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 $out_charset is not named in camelCase.
        Open

            public static function convertItem($value, $out_charset, $in_charset)
            {
                if (mb_strtolower($in_charset) == mb_strtolower($out_charset)) {
                    return $value;
                }
        Severity: Minor
        Found in class/Utility.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 $xlanguage_langs is not named in camelCase.
        Open

            public static function cleanMultiLang($text)
            {
                global $xoopsConfig;
                global $xlanguage_langs;
                $patterns = [];
        Severity: Minor
        Found in class/Utility.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 $in_charset is not named in camelCase.
        Open

            public static function convertItem($value, $out_charset, $in_charset)
            {
                if (mb_strtolower($in_charset) == mb_strtolower($out_charset)) {
                    return $value;
                }
        Severity: Minor
        Found in class/Utility.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 $HTTP_USER_AGENT is not named in camelCase.
        Open

            public static function detectLang()
            {
                global  $_SERVER;
                //      if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
                if (Request::hasVar('HTTP_ACCEPT_LANGUAGE', 'SERVER')) {
        Severity: Minor
        Found in class/Utility.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 $xlanguage_langs is not named in camelCase.
        Open

            public static function cleanMultiLang($text)
            {
                global $xoopsConfig;
                global $xlanguage_langs;
                $patterns = [];
        Severity: Minor
        Found in class/Utility.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 $_lang is not named in camelCase.
        Open

            public static function cleanMultiLang($text)
            {
                global $xoopsConfig;
                global $xlanguage_langs;
                $patterns = [];
        Severity: Minor
        Found in class/Utility.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 $_lang is not named in camelCase.
        Open

            public static function cleanMultiLang($text)
            {
                global $xoopsConfig;
                global $xlanguage_langs;
                $patterns = [];
        Severity: Minor
        Found in class/Utility.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 $mid_pattern is not named in camelCase.
        Open

            public static function cleanMultiLang($text)
            {
                global $xoopsConfig;
                global $xlanguage_langs;
                $patterns = [];
        Severity: Minor
        Found in class/Utility.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 $in_charset is not named in camelCase.
        Open

            public static function encodeCharSet($output)
            {
                global $xlanguage;
                $output = static::cleanMultiLang($output);
                // escape XML doc
        Severity: Minor
        Found in class/Utility.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 $mid_pattern is not named in camelCase.
        Open

            public static function cleanMultiLang($text)
            {
                global $xoopsConfig;
                global $xlanguage_langs;
                $patterns = [];
        Severity: Minor
        Found in class/Utility.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 $_lang is not named in camelCase.
        Open

            public static function cleanMultiLang($text)
            {
                global $xoopsConfig;
                global $xlanguage_langs;
                $patterns = [];
        Severity: Minor
        Found in class/Utility.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 $xlanguage_langs is not named in camelCase.
        Open

            public static function cleanMultiLang($text)
            {
                global $xoopsConfig;
                global $xlanguage_langs;
                $patterns = [];
        Severity: Minor
        Found in class/Utility.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 $in_charset is not named in camelCase.
        Open

            public static function convertItem($value, $out_charset, $in_charset)
            {
                if (mb_strtolower($in_charset) == mb_strtolower($out_charset)) {
                    return $value;
                }
        Severity: Minor
        Found in class/Utility.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 $xlanguage_langs is not named in camelCase.
        Open

            public static function cleanMultiLang($text)
            {
                global $xoopsConfig;
                global $xlanguage_langs;
                $patterns = [];
        Severity: Minor
        Found in class/Utility.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 $_lang is not named in camelCase.
        Open

            public static function cleanMultiLang($text)
            {
                global $xoopsConfig;
                global $xlanguage_langs;
                $patterns = [];
        Severity: Minor
        Found in class/Utility.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 $mid_pattern is not named in camelCase.
        Open

            public static function cleanMultiLang($text)
            {
                global $xoopsConfig;
                global $xlanguage_langs;
                $patterns = [];
        Severity: Minor
        Found in class/Utility.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 $lang_parse is not named in camelCase.
        Open

            public static function getPreferredLanguage()
            {
                $langs = [];
                $lang  = '';
                //        if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
        Severity: Minor
        Found in class/Utility.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