XoopsModules25x/xoopspoll

View on GitHub
class/Common/Blocksadmin.php

Summary

Maintainability
F
6 days
Test Coverage

listBlocks accesses the super-global variable $_SERVER.
Open

    public function listBlocks(): void
    {
        $pathIcon16 = Admin::iconUrl('', '16');

        require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
Severity: Minor
Found in class/Common/Blocksadmin.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

orderBlock accesses the super-global variable $_SERVER.
Open

    public function orderBlock(
        array $bid,
        array $oldtitle,
        array $oldside,
        array $oldweight,
Severity: Minor
Found in class/Common/Blocksadmin.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

File Blocksadmin.php has 554 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php declare(strict_types=1);

namespace XoopsModules\Xoopspoll\Common;

/**
Severity: Major
Found in class/Common/Blocksadmin.php - About 1 day to fix

    Method listBlocks has 156 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function listBlocks(): void
        {
            $pathIcon16 = Admin::iconUrl('', '16');
    
            require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
    Severity: Major
    Found in class/Common/Blocksadmin.php - About 6 hrs to fix

      Function listBlocks has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

          public function listBlocks(): void
          {
              $pathIcon16 = Admin::iconUrl('', '16');
      
              require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
      Severity: Minor
      Found in class/Common/Blocksadmin.php - About 4 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

      Method render has 95 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function render(?array $block = null): void
          {
              \xoops_load('XoopsFormLoader');
              \xoops_loadLanguage('common', $this->moduleDirNameUpper);
      
      
      Severity: Major
      Found in class/Common/Blocksadmin.php - About 3 hrs to fix

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

        class Blocksadmin
        {
            /**
             * @var \XoopsMySQLDatabase|null
             */
        Severity: Minor
        Found in class/Common/Blocksadmin.php by phpmd

        Function updateBlock has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            public function updateBlock(int $bid, string $btitle, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups)
            {
                $myblock = new \XoopsBlock($bid);
                $myblock->setVar('title', $btitle);
                $myblock->setVar('weight', $bweight);
        Severity: Minor
        Found in class/Common/Blocksadmin.php - About 2 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

        Function orderBlock has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            public function orderBlock(
                array $bid,
                array $oldtitle,
                array $oldside,
                array $oldweight,
        Severity: Minor
        Found in class/Common/Blocksadmin.php - About 2 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

        Method isBlockCloned has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function isBlockCloned(int $bid, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups, bool $redirect = true)
            {
                \xoops_loadLanguage('admin', 'system');
                \xoops_loadLanguage('admin/blocksadmin', 'system');
                \xoops_loadLanguage('admin/groups', 'system');
        Severity: Major
        Found in class/Common/Blocksadmin.php - About 2 hrs to fix

          Method orderBlock has 14 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  array $bid,
                  array $oldtitle,
                  array $oldside,
                  array $oldweight,
                  array $oldvisible,
          Severity: Major
          Found in class/Common/Blocksadmin.php - About 1 hr to fix

            Method updateBlock has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function updateBlock(int $bid, string $btitle, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups)
                {
                    $myblock = new \XoopsBlock($bid);
                    $myblock->setVar('title', $btitle);
                    $myblock->setVar('weight', $bweight);
            Severity: Minor
            Found in class/Common/Blocksadmin.php - About 1 hr to fix

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

                  public function isBlockCloned(int $bid, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups, bool $redirect = true)
                  {
                      \xoops_loadLanguage('admin', 'system');
                      \xoops_loadLanguage('admin/blocksadmin', 'system');
                      \xoops_loadLanguage('admin/groups', 'system');
              Severity: Minor
              Found in class/Common/Blocksadmin.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 cloneBlock has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function cloneBlock(int $bid)
                  {
                      //require __DIR__ . '/admin_header.php';
                      //        \xoops_cp_header();
              
              
              Severity: Minor
              Found in class/Common/Blocksadmin.php - About 1 hr to fix

                Method editBlock has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function editBlock(int $bid): void
                    {
                        //        require_once \dirname(__DIR__,2) . '/admin/admin_header.php';
                        //        \xoops_cp_header();
                        \xoops_loadLanguage('admin', 'system');
                Severity: Minor
                Found in class/Common/Blocksadmin.php - About 1 hr to fix

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

                      public function render(?array $block = null): void
                      {
                          \xoops_load('XoopsFormLoader');
                          \xoops_loadLanguage('common', $this->moduleDirNameUpper);
                  
                  
                  Severity: Minor
                  Found in class/Common/Blocksadmin.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 orderBlock has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function orderBlock(
                          array $bid,
                          array $oldtitle,
                          array $oldside,
                          array $oldweight,
                  Severity: Minor
                  Found in class/Common/Blocksadmin.php - About 1 hr to fix

                    Method updateBlock has 9 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public function updateBlock(int $bid, string $btitle, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups)
                    Severity: Major
                    Found in class/Common/Blocksadmin.php - About 1 hr to fix

                      Method isBlockCloned has 9 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public function isBlockCloned(int $bid, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups, bool $redirect = true)
                      Severity: Major
                      Found in class/Common/Blocksadmin.php - About 1 hr to fix

                        Method setOrder has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            public function setOrder(string $bid, string $title, string $weight, string $visible, string $side, string $bcachetime, ?array $bmodule = null): void
                        Severity: Major
                        Found in class/Common/Blocksadmin.php - About 50 mins to fix

                          Consider simplifying this complex logical expression.
                          Open

                                      if ($oldtitle[$i] !== $title[$i]
                                          || $oldweight[$i] !== $weight[$i]
                                          || $oldvisible[$i] !== $visible[$i]
                                          || $oldside[$i] !== $side[$i]
                                          || $oldbcachetime[$i] !== $bcachetime[$i]
                          Severity: Major
                          Found in class/Common/Blocksadmin.php - About 40 mins to fix

                            The method isBlockCloned() has an NPath complexity of 1152. The configured NPath complexity threshold is 200.
                            Open

                                public function isBlockCloned(int $bid, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups, bool $redirect = true)
                                {
                                    \xoops_loadLanguage('admin', 'system');
                                    \xoops_loadLanguage('admin/blocksadmin', 'system');
                                    \xoops_loadLanguage('admin/groups', 'system');
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 orderBlock() has an NPath complexity of 212. The configured NPath complexity threshold is 200.
                            Open

                                public function orderBlock(
                                    array $bid,
                                    array $oldtitle,
                                    array $oldside,
                                    array $oldweight,
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 orderBlock has 14 parameters. Consider reducing the number of parameters to less than 10.
                            Open

                                public function orderBlock(
                                    array $bid,
                                    array $oldtitle,
                                    array $oldside,
                                    array $oldweight,
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpmd

                            The method listBlocks() has an NPath complexity of 15553. The configured NPath complexity threshold is 200.
                            Open

                                public function listBlocks(): void
                                {
                                    $pathIcon16 = Admin::iconUrl('', '16');
                            
                                    require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 render() has 111 lines of code. Current threshold is set to 100. Avoid really long methods.
                            Open

                                public function render(?array $block = null): void
                                {
                                    \xoops_load('XoopsFormLoader');
                                    \xoops_loadLanguage('common', $this->moduleDirNameUpper);
                            
                            
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpmd

                            The method listBlocks() has 180 lines of code. Current threshold is set to 100. Avoid really long methods.
                            Open

                                public function listBlocks(): void
                                {
                                    $pathIcon16 = Admin::iconUrl('', '16');
                            
                                    require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpmd

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

                                public function listBlocks(): void
                                {
                                    $pathIcon16 = Admin::iconUrl('', '16');
                            
                                    require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 orderBlock() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10.
                            Open

                                public function orderBlock(
                                    array $bid,
                                    array $oldtitle,
                                    array $oldside,
                                    array $oldweight,
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 isBlockCloned() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
                            Open

                                public function isBlockCloned(int $bid, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups, bool $redirect = true)
                                {
                                    \xoops_loadLanguage('admin', 'system');
                                    \xoops_loadLanguage('admin/blocksadmin', 'system');
                                    \xoops_loadLanguage('admin/groups', 'system');
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 updateBlock() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                            Open

                                public function updateBlock(int $bid, string $btitle, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups)
                                {
                                    $myblock = new \XoopsBlock($bid);
                                    $myblock->setVar('title', $btitle);
                                    $myblock->setVar('weight', $bweight);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 class Blocksadmin has a coupling between objects value of 23. Consider to reduce the number of dependencies under 13.
                            Open

                            class Blocksadmin
                            {
                                /**
                                 * @var \XoopsMySQLDatabase|null
                                 */
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpmd

                            CouplingBetweenObjects

                            Since: 1.1.0

                            A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

                            Example

                            class Foo {
                                /**
                                 * @var \foo\bar\X
                                 */
                                private $x = null;
                            
                                /**
                                 * @var \foo\bar\Y
                                 */
                                private $y = null;
                            
                                /**
                                 * @var \foo\bar\Z
                                 */
                                private $z = null;
                            
                                public function setFoo(\Foo $foo) {}
                                public function setBar(\Bar $bar) {}
                                public function setBaz(\Baz $baz) {}
                            
                                /**
                                 * @return \SplObjectStorage
                                 * @throws \OutOfRangeException
                                 * @throws \InvalidArgumentException
                                 * @throws \ErrorException
                                 */
                                public function process(\Iterator $it) {}
                            
                                // ...
                            }

                            Source https://phpmd.org/rules/design.html#couplingbetweenobjects

                            Missing class import via use statement (line '746', column '31').
                            Open

                                    $form->addElement(new \XoopsFormHidden('op', $block['op']));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '758', column '29').
                            Open

                                    $cancelButton = new \XoopsFormButton('', '', \_CANCEL, 'button');
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '362', column '22').
                            Open

                                    $block = new \XoopsBlock($bid);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '741', column '31').
                            Open

                                    $form->addElement(new \XoopsFormSelectGroup(\_AM_SYSTEM_BLOCKS_GROUP, 'groups', true, $groups, 5, true));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '675', column '31').
                            Open

                                    $form->addElement(new \XoopsFormText(\constant('CO_' . $this->moduleDirNameUpper . '_' . 'WEIGHT'), 'bweight', 2, 5, $block['weight']));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '754', column '29').
                            Open

                                    $buttonTray   = new \XoopsFormElementTray('', '');
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '659', column '21').
                            Open

                                    $form = new \XoopsThemeForm($block['form_title'], 'blockform', 'blocksadmin.php', 'post', true);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '663', column '27').
                            Open

                                    $sideSelect = new \XoopsFormSelect(\_AM_SYSTEM_BLOCKS_TYPE, 'bside', $block['side']);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '676', column '31').
                            Open

                                    $form->addElement(new \XoopsFormRadioYN(\constant('CO_' . $this->moduleDirNameUpper . '_' . 'VISIBLE'), 'bvisible', $block['visible']));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '677', column '26').
                            Open

                                    $modSelect = new \XoopsFormSelect(\constant('CO_' . $this->moduleDirNameUpper . '_' . 'VISIBLEIN'), 'bmodule', $block['modules'], 5, true);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '95', column '28').
                            Open

                                    $criteria->add(new \Criteria('isactive', '1'));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '744', column '35').
                            Open

                                        $form->addElement(new \XoopsFormHidden('bid', $block['bid']));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '719', column '35').
                            Open

                                        $form->addElement(new \XoopsFormLabel(\_AM_SYSTEM_BLOCKS_OPTIONS, $block['edit_form']));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '680', column '49').
                            Open

                                    $criteria      = new \CriteriaCompo(new \Criteria('hasmain', '1'));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '528', column '24').
                            Open

                                    $myblock = new \XoopsBlock($bid);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '681', column '28').
                            Open

                                    $criteria->add(new \Criteria('isactive', '1'));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '714', column '43').
                            Open

                                                $form->addElement(new \XoopsFormLabel(\_AM_SYSTEM_BLOCKS_CONTENT, '<a href="' . XOOPS_URL . '/modules/system/admin.php?fct=tplsets&amp;op=edittpl&amp;id=' . $btemplate2[0]->getVar('tpl_id') . '" target="_blank">' . \_AM_SYSTEM_BLOCKS_EDITTPL . '</a>'));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '748', column '27').
                            Open

                                    $buttonTray = new \XoopsFormElementTray('', '&nbsp;');
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '373', column '23').
                            Open

                                        throw new \InvalidArgumentException(\sprintf(_AM_NOTSELNG, _AM_VISIBLEIN));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '404', column '23').
                            Open

                                        throw new \RuntimeException($clone->getHtmlErrors());
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '750', column '41').
                            Open

                                        $buttonTray->addElement(new \XoopsFormButton('', 'previewblock', \_PREVIEW, 'submit'));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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

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

                                public function isBlockCloned(int $bid, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups, bool $redirect = true)
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpmd

                            BooleanArgumentFlag

                            Since: 1.4.0

                            A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                            Example

                            class Foo {
                                public function bar($flag = true) {
                                }
                            }

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

                            Missing class import via use statement (line '451', column '24').
                            Open

                                    $myblock = new \XoopsBlock($bid);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '721', column '29').
                            Open

                                    $cache_select = new \XoopsFormSelect(\_AM_SYSTEM_BLOCKS_BCACHETIME, 'bcachetime', $block['bcachetime']);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '301', column '24').
                            Open

                                    $myblock = new \XoopsBlock($bid);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '475', column '24').
                            Open

                                    $myblock = new \XoopsBlock($bid);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '755', column '29').
                            Open

                                    $submitButton = new \XoopsFormButton('', 'submitblock', \_SUBMIT, 'submit');
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '94', column '52').
                            Open

                                    $criteria         = new \CriteriaCompo(new \Criteria('hasmain', '1'));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '690', column '29').
                            Open

                                        $textarea = new \XoopsFormDhtmlTextArea(\_AM_SYSTEM_BLOCKS_CONTENT, 'bcontent', $block['content'], 15, 70);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '693', column '32').
                            Open

                                        $ctypeSelect = new \XoopsFormSelect(\_AM_SYSTEM_BLOCKS_CTYPE, 'bctype', $block['ctype']);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '94', column '33').
                            Open

                                    $criteria         = new \CriteriaCompo(new \Criteria('hasmain', '1'));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '661', column '35').
                            Open

                                        $form->addElement(new \XoopsFormLabel(\_AM_SYSTEM_BLOCKS_NAME, $block['name']));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '680', column '30').
                            Open

                                    $criteria      = new \CriteriaCompo(new \Criteria('hasmain', '1'));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '688', column '31').
                            Open

                                    $form->addElement(new \XoopsFormText(\_AM_SYSTEM_BLOCKS_TITLE, 'btitle', 50, 255, $block['title']), false);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '710', column '39').
                            Open

                                            $form->addElement(new \XoopsFormLabel(\_AM_SYSTEM_BLOCKS_CONTENT, '<a href="' . XOOPS_URL . '/modules/system/admin.php?fct=tplsets&amp;op=edittpl&amp;id=' . $btemplate[0]->getVar('tpl_id') . '">' . \_AM_SYSTEM_BLOCKS_EDITTPL . '</a>'));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '747', column '31').
                            Open

                                    $form->addElement(new \XoopsFormHidden('fct', 'blocksadmin'));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '\XoopsDatabaseFactory' in method '__construct'.
                            Open

                                        $db = \XoopsDatabaseFactory::getDatabaseConnection();
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 isBlockCloned uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                            Open

                                    } else {
                                        $clone->setVar('block_type', 'D');
                                    }
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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\Module\Admin' in method 'listBlocks'.
                            Open

                                    $pathIcon16 = Admin::iconUrl('', '16');
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 listBlocks uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                            Open

                                            } else {
                                                $cachetimeOptions .= "<option value='$cachetime'>$cachetimeName</option>\n";
                                            }
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 updateBlock uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                            Open

                                        } else {
                                            foreach ($bmodule as $bmid) {
                                                $sql = \sprintf('INSERT INTO %s (block_id, module_id) VALUES (%u, %d)', $this->db->prefix('block_module_link'), $bid, (int)$bmid);
                                                $this->db->query($sql);
                                            }
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '\XoopsBlock' in method 'listBlocks'.
                            Open

                                    $blockArray = \XoopsBlock::getByModule($this->xoopsModule->mid());
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '\XoopsLogger' in method 'editBlock'.
                            Open

                                        $logger   = \XoopsLogger::getInstance();
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '\XoopsLogger' in method 'listBlocks'.
                            Open

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

                                        } else {
                                            $sel0 = ' checked';
                                        }
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 orderBlock uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                            Open

                                            } else {
                                                foreach ($bmodule[$i] as $bmid) {
                                                    $sql = \sprintf('INSERT INTO `%s` (block_id, module_id) VALUES (%u, %d)', $this->db->prefix('block_module_link'), $bid[$i], (int)$bmid);
                                                    $this->db->query($sql);
                                                }
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 render uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                            Open

                                        } else {
                                            $btemplate2 = $tplfileHandler->find('default', 'block', $block['bid']);
                                            if (\count($btemplate2) > 0) {
                                                $form->addElement(new \XoopsFormLabel(\_AM_SYSTEM_BLOCKS_CONTENT, '<a href="' . XOOPS_URL . '/modules/system/admin.php?fct=tplsets&amp;op=edittpl&amp;id=' . $btemplate2[0]->getVar('tpl_id') . '" target="_blank">' . \_AM_SYSTEM_BLOCKS_EDITTPL . '</a>'));
                                            }
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 listBlocks uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                            Open

                                        }else {
                                            $title = $i->getVar('title');
                                        }
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '\XoopsLogger' in method 'cloneBlock'.
                            Open

                                        $logger   = \XoopsLogger::getInstance();
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 'isBlockCloned'.
                            Open

                                    $clone->setVar('title', Request::getString('btitle', '', 'POST'));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 unused local variables such as '$newbid'.
                            Open

                                    $newbid = $myblock->store();
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '$blockCount'.
                            Open

                                    $blockCount = \count($blockArray);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 '$name'.
                            Open

                                        $name = $i->getVar('name');
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 parameters such as '$bmodule'.
                            Open

                                public function setOrder(string $bid, string $title, string $weight, string $visible, string $side, string $bcachetime, ?array $bmodule = null): void
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpmd

                            UnusedFormalParameter

                            Since: 0.2

                            Avoid passing parameters to methods or constructors and then not using those parameters.

                            Example

                            class Foo
                            {
                                private function bar($howdy)
                                {
                                    // $howdy is not used
                                }
                            }

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

                            Identical blocks of code found in 2 locations. Consider refactoring.
                            Open

                                    $cache_select->addOptionArray([
                                                                      0       => \_NOCACHE,
                                                                      30      => \sprintf(\_SECONDS, 30),
                                                                      60      => \_MINUTE,
                                                                      300     => \sprintf(\_MINUTES, 5),
                            Severity: Major
                            Found in class/Common/Blocksadmin.php and 1 other location - About 2 hrs to fix
                            class/Common/Blocksadmin.php on lines 114..126

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 140.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Identical blocks of code found in 2 locations. Consider refactoring.
                            Open

                                    $cachetimes = [
                                        0       => \_NOCACHE,
                                        30      => \sprintf(\_SECONDS, 30),
                                        60      => \_MINUTE,
                                        300     => \sprintf(\_MINUTES, 5),
                            Severity: Major
                            Found in class/Common/Blocksadmin.php and 1 other location - About 2 hrs to fix
                            class/Common/Blocksadmin.php on lines 722..734

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 140.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Identical blocks of code found in 3 locations. Consider refactoring.
                            Open

                                    if (!$this->db->isResultSet($result)) {
                                        //            \trigger_error("Query Failed! SQL: $sql Error: " . $this->db->error(), \E_USER_ERROR);
                                        $errorMsg = \sprintf(_DB_QUERY_ERROR, $sql) . $this->db->error();
                                        $logger   = \XoopsLogger::getInstance();
                                        $logger->handleError(E_USER_WARNING, $errorMsg, __FILE__, __LINE__);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php and 2 other locations - About 40 mins to fix
                            class/Common/Blocksadmin.php on lines 131..137
                            class/Common/Blocksadmin.php on lines 304..309

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 93.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Identical blocks of code found in 3 locations. Consider refactoring.
                            Open

                                    if (!$this->db->isResultSet($result)) {
                                        $errorMsg = \sprintf(_DB_QUERY_ERROR, $sql) . $this->db->error();
                                        $logger   = \XoopsLogger::getInstance();
                                        $logger->handleError(E_USER_WARNING, $errorMsg, __FILE__, __LINE__);
                                        $this->helper->redirect('admin/blocksadmin.php', 3, $errorMsg);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php and 2 other locations - About 40 mins to fix
                            class/Common/Blocksadmin.php on lines 131..137
                            class/Common/Blocksadmin.php on lines 478..484

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 93.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Identical blocks of code found in 3 locations. Consider refactoring.
                            Open

                                        if (!$this->db->isResultSet($result)) {
                            //                \trigger_error("Query Failed! SQL: $sql Error: " . $this->db->error(), \E_USER_ERROR);
                                            $errorMsg = \sprintf(_DB_QUERY_ERROR, $sql) . $this->db->error();
                                            $logger   = \XoopsLogger::getInstance();
                                            $logger->handleError(E_USER_WARNING, $errorMsg, __FILE__, __LINE__);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php and 2 other locations - About 40 mins to fix
                            class/Common/Blocksadmin.php on lines 304..309
                            class/Common/Blocksadmin.php on lines 478..484

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 93.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

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

                                public $db;
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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(?\XoopsMySQLDatabase $db, Helper $helper, \XoopsModule $xoopsModule, \XoopsSecurity $xoopsSecurity)
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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

                            A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 30 and the first side effect is on line 25.
                            Open

                            <?php declare(strict_types=1);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            There must be one USE keyword per declaration
                            Open

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

                            Multi-line function declaration not indented correctly; expected 8 spaces but found 0
                            Open

                            //        array $oldgroups,
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 175 characters
                            Open

                                        echo "<td class='$class' align='center'><select size='5' name='groups[" . $i->getVar('bid') . "][]' id='groups[" . $i->getVar('bid') . "][]' multiple='multiple'>";
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 160 characters
                            Open

                                                    $sql = \sprintf('INSERT INTO `%s` (block_id, module_id) VALUES (%u, %d)', $this->db->prefix('block_module_link'), $bid[$i], (int)$bmid);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 121 characters
                            Open

                                        $sql = \sprintf('DELETE FROM `%s` WHERE gperm_itemid = %u', $this->db->prefix('group_permission'), $bid[$i]);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 199 characters
                            Open

                                                $sql = \sprintf("INSERT INTO `%s` (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES (%u, %u, 1, 'block_read')", $this->db->prefix('group_permission'), $grp, $bid[$i]);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 137 characters
                            Open

                                            $sql = \sprintf('INSERT INTO %s (block_id, module_id) VALUES (%u, %d)', $this->db->prefix('block_module_link'), $bid, 0);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 175 characters
                            Open

                                            <td class='$class' align='center'><input type='text' name='weight[" . $i->getVar('bid') . "]' value='" . $i->getVar('weight') . "' size='5' maxlength='5'></td>
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 162 characters
                            Open

                                                    <span style='float:right;'><input type='radio' name='side[" . $i->getVar('bid') . "]' value='" . \XOOPS_SIDEBLOCK_RIGHT . "'$ssel1></span>
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 239 characters
                            Open

                                    <tr valign='middle'><th align='center'>" . \_AM_SYSTEM_BLOCKS_TITLE . "</th><th align='center' nowrap='nowrap'>" . \constant('CO_' . $this->moduleDirNameUpper . '_' . 'SIDE') . '<br>' . _LEFT . '-' . _CENTER . '-' . _RIGHT . "</th>
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 179 characters
                            Open

                                            <a href='blocksadmin.php?op=delete&amp;bid=" . $i->getVar('bid') . "'><img src=" . $pathIcon16 . '/delete.png' . " alt='" . \_DELETE . "' title='" . \_DELETE . "'>
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 225 characters
                            Open

                                    echo '<a href="blocksadmin.php">' . \constant('CO_' . $this->moduleDirNameUpper . '_' . 'BADMIN') . '</a>&nbsp;<span style="font-weight:bold;">&raquo;&raquo;</span>&nbsp;' . \_AM_SYSTEM_BLOCKS_CLONEBLOCK . '<br><br>';
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 192 characters
                            Open

                                        $sql = 'INSERT INTO ' . $this->db->prefix('group_permission') . ' (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES (' . $iValue . ', ' . $newid . ", 1, 'block_read')";
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 153 characters
                            Open

                                public function setOrder(string $bid, string $title, string $weight, string $visible, string $side, string $bcachetime, ?array $bmodule = null): void
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 122 characters
                            Open

                                            $sql = \sprintf('DELETE FROM `%s` WHERE block_id = %u', $this->db->prefix('block_module_link'), $bid[$i]);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 131 characters
                            Open

                                                    <input type='radio' name='side[" . $i->getVar('bid') . "]' value='" . \XOOPS_CENTERBLOCK_BOTTOM . "'$ssel7>
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 250 characters
                            Open

                                             <td class='$class' align='center' nowrap><input type='radio' name='visible[" . $i->getVar('bid') . "]' value='1'$sel1>" . \_YES . "&nbsp;<input type='radio' name='visible[" . $i->getVar('bid') . "]' value='0'$sel0>" . \_NO . '</td>';
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 176 characters
                            Open

                                            <a href='blocksadmin.php?op=edit&amp;bid=" . $i->getVar('bid') . "'><img src=" . $pathIcon16 . '/edit.png' . " alt='" . \_EDIT . "' title='" . \_EDIT . "'></a> 
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 177 characters
                            Open

                                public function updateBlock(int $bid, string $btitle, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups)
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 189 characters
                            Open

                                            $sql = \sprintf("INSERT INTO %s (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES (%u, %u, 1, 'block_read')", $this->db->prefix('group_permission'), $grp, $bid);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 123 characters
                            Open

                                            $this->setOrder($bid[$i], $title[$i], $weight[$i], $visible[$i], $side[$i], $bcachetime[$i], $bmodule[$i]);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 162 characters
                            Open

                                    <th align='center'>" . \constant('CO_' . $this->moduleDirNameUpper . '_' . 'VISIBLE') . "</th><th align='center'>" . \_AM_SYSTEM_BLOCKS_VISIBLEIN . "</th>
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 147 characters
                            Open

                                    $modSelect = new \XoopsFormSelect(\constant('CO_' . $this->moduleDirNameUpper . '_' . 'VISIBLEIN'), 'bmodule', $block['modules'], 5, true);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 147 characters
                            Open

                                                <div align='left'><input type='radio' name='side[" . $i->getVar('bid') . "]' value='" . \XOOPS_SIDEBLOCK_LEFT . "'$ssel0></div>
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 184 characters
                            Open

                                            <a href='blocksadmin.php?op=clone&amp;bid=" . $i->getVar('bid') . "'><img src=" . $pathIcon16 . '/editcopy.png' . " alt='" . \_CLONE . "' title='" . \_CLONE . "'></a>";
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 131 characters
                            Open

                                    $this->helper->redirect('admin/blocksadmin.php', 1, \constant('CO_' . $this->moduleDirNameUpper . '_' . 'UPDATE_SUCCESS'));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 126 characters
                            Open

                                                <input type='radio' name='side[" . $i->getVar('bid') . "]' value='" . \XOOPS_CENTERBLOCK_RIGHT . "'$ssel4>
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 177 characters
                            Open

                                        echo "<td class='$class' align='center'><select size='5' name='bmodule[" . $i->getVar('bid') . "][]' id='bmodule[" . $i->getVar('bid') . "][]' multiple='multiple'>";
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 144 characters
                            Open

                                    $form->addElement(new \XoopsFormText(\constant('CO_' . $this->moduleDirNameUpper . '_' . 'WEIGHT'), 'bweight', 2, 5, $block['weight']));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 144 characters
                            Open

                                    $form->addElement(new \XoopsFormRadioYN(\constant('CO_' . $this->moduleDirNameUpper . '_' . 'VISIBLE'), 'bvisible', $block['visible']));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 273 characters
                            Open

                                                $form->addElement(new \XoopsFormLabel(\_AM_SYSTEM_BLOCKS_CONTENT, '<a href="' . XOOPS_URL . '/modules/system/admin.php?fct=tplsets&amp;op=edittpl&amp;id=' . $btemplate2[0]->getVar('tpl_id') . '" target="_blank">' . \_AM_SYSTEM_BLOCKS_EDITTPL . '</a>'));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 122 characters
                            Open

                                        <input type='hidden' name='oldbcachetime[" . $i->getVar('bid') . "]' value='" . $i->getVar('bcachetime') . "'>
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 262 characters
                            Open

                                        $textarea->setDescription('<span style="font-size:x-small;font-weight:bold;">' . \_AM_SYSTEM_BLOCKS_USEFULTAGS . '</span><br><span style="font-size:x-small;font-weight:normal;">' . \sprintf(_AM_BLOCKTAG1, '{X_SITEURL}', XOOPS_URL . '/') . '</span>');
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 131 characters
                            Open

                                public function __construct(?\XoopsMySQLDatabase $db, Helper $helper, \XoopsModule $xoopsModule, \XoopsSecurity $xoopsSecurity)
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 157 characters
                            Open

                                        echo '<td class="' . $class . '" align="center"> <select name="bcachetime[' . $i->getVar('bid') . ']" size="1">' . $cachetimeOptions . '</select>
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 141 characters
                            Open

                                        $sql = 'INSERT INTO ' . $this->db->prefix('block_module_link') . ' (block_id, module_id) VALUES (' . $newid . ', ' . $bmid . ')';
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 224 characters
                            Open

                                    echo '<a href="blocksadmin.php">' . \constant('CO_' . $this->moduleDirNameUpper . '_' . 'BADMIN') . '</a>&nbsp;<span style="font-weight:bold;">&raquo;&raquo;</span>&nbsp;' . \_AM_SYSTEM_BLOCKS_EDITBLOCK . '<br><br>';
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 131 characters
                            Open

                                    $this->helper->redirect('admin/blocksadmin.php', 1, \constant('CO_' . $this->moduleDirNameUpper . '_' . 'UPDATE_SUCCESS'));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 131 characters
                            Open

                                                <input type='radio' name='side[" . $i->getVar('bid') . "]' value='" . \XOOPS_CENTERBLOCK_BOTTOMLEFT . "'$ssel5>
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 147 characters
                            Open

                                                $sql = \sprintf('INSERT INTO `%s` (block_id, module_id) VALUES (%u, %d)', $this->db->prefix('block_module_link'), $bid[$i], 0);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 140 characters
                            Open

                                        $sql               = 'SELECT module_id FROM ' . $this->db->prefix('block_module_link') . ' WHERE block_id=' . $i->getVar('bid');
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 125 characters
                            Open

                                                <input type='radio' name='side[" . $i->getVar('bid') . "]' value='" . \XOOPS_CENTERBLOCK_LEFT . "'$ssel2>
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 204 characters
                            Open

                                            echo "<option value='" . $grp->getVar('groupid') . "' " . (\in_array($grp->getVar('groupid'), $groupsPermissions) ? " selected='selected'" : '') . '>' . $grp->getVar('name') . '</option>';
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 186 characters
                            Open

                                public function isBlockCloned(int $bid, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups, bool $redirect = true)
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 156 characters
                            Open

                                        echo "<tr valign='top'><td class='$class' align='center'><input type='text' name='title[" . $i->getVar('bid') . "]' value='" . $title . "'></td>
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 132 characters
                            Open

                                                <input type='radio' name='side[" . $i->getVar('bid') . "]' value='" . \XOOPS_CENTERBLOCK_BOTTOMRIGHT . "'$ssel6>
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 250 characters
                            Open

                                        //                echo "&nbsp;<a href='" . XOOPS_URL . '/modules/system/admin.php?fct=blocksadmin&amp;op=delete&amp;bid=' . $i->getVar('bid') . "'><img src=" . $pathIcon16 . '/delete.png' . " alt='" . _DELETE . "' title='" . _DELETE . "'>
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 127 characters
                            Open

                                                <input type='radio' name='side[" . $i->getVar('bid') . "]' value='" . \XOOPS_CENTERBLOCK_CENTER . "'$ssel3>
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 150 characters
                            Open

                                                $sql = \sprintf('INSERT INTO %s (block_id, module_id) VALUES (%u, %d)', $this->db->prefix('block_module_link'), $bid, (int)$bmid);
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line exceeds 120 characters; contains 252 characters
                            Open

                                            $form->addElement(new \XoopsFormLabel(\_AM_SYSTEM_BLOCKS_CONTENT, '<a href="' . XOOPS_URL . '/modules/system/admin.php?fct=tplsets&amp;op=edittpl&amp;id=' . $btemplate[0]->getVar('tpl_id') . '">' . \_AM_SYSTEM_BLOCKS_EDITTPL . '</a>'));
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Whitespace found at end of line
                            Open

                                public function deleteBlock(int $bid): void 
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line indented incorrectly; expected 8 spaces, found 12
                            Open

                                        while (false !== ($row = $this->db->fetchArray($result))) {
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Expected 1 space after closing brace; 0 found
                            Open

                                        }else {
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpcodesniffer

                            Line indented incorrectly; expected 8 spaces, found 12
                            Open

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

                            The variable $cache_select is not named in camelCase.
                            Open

                                public function render(?array $block = null): void
                                {
                                    \xoops_load('XoopsFormLoader');
                                    \xoops_loadLanguage('common', $this->moduleDirNameUpper);
                            
                            
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 $cache_select is not named in camelCase.
                            Open

                                public function render(?array $block = null): void
                                {
                                    \xoops_load('XoopsFormLoader');
                                    \xoops_loadLanguage('common', $this->moduleDirNameUpper);
                            
                            
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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 $cache_select is not named in camelCase.
                            Open

                                public function render(?array $block = null): void
                                {
                                    \xoops_load('XoopsFormLoader');
                                    \xoops_loadLanguage('common', $this->moduleDirNameUpper);
                            
                            
                            Severity: Minor
                            Found in class/Common/Blocksadmin.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