mambax7/publisher

View on GitHub
class/Common/Blocksadmin.php

Summary

Maintainability
F
1 wk
Test Coverage

orderBlock accesses the super-global variable $GLOBALS.
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

listBlocks accesses the super-global variable $GLOBALS.
Open

    public function listBlocks(): void
    {
        global $xoopsModule, $pathIcon16;
        require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
        //        xoops_loadLanguage('admin', 'system');
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 $GLOBALS.
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

listBlocks accesses the super-global variable $_SERVER.
Open

    public function listBlocks(): void
    {
        global $xoopsModule, $pathIcon16;
        require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
        //        xoops_loadLanguage('admin', 'system');
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

deleteBlock accesses the super-global variable $GLOBALS.
Open

    public function deleteBlock(int $bid): void
    {
        //        \xoops_cp_header();

        \xoops_loadLanguage('admin', 'system');
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

isBlockCloned accesses the super-global variable $GLOBALS.
Open

    public function isBlockCloned(int $bid, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups): void
    {
        \xoops_loadLanguage('admin', 'system');
        \xoops_loadLanguage('admin/blocksadmin', 'system');
        \xoops_loadLanguage('admin/groups', 'system');
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

deleteBlock accesses the super-global variable $GLOBALS.
Open

    public function deleteBlock(int $bid): void
    {
        //        \xoops_cp_header();

        \xoops_loadLanguage('admin', 'system');
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

render accesses the super-global variable $GLOBALS.
Open

    public function render(?array $block = null)
    {
        \xoops_load('XoopsFormLoader');
        \xoops_loadLanguage('common', $this->moduleDirNameUpper);

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

listBlocks accesses the super-global variable $GLOBALS.
Open

    public function listBlocks(): void
    {
        global $xoopsModule, $pathIcon16;
        require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
        //        xoops_loadLanguage('admin', 'system');
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 590 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php declare(strict_types=1);

namespace XoopsModules\Publisher\Common;

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

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

        public function listBlocks(): void
        {
            global $xoopsModule, $pathIcon16;
            require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
            //        xoops_loadLanguage('admin', 'system');
    Severity: Major
    Found in class/Common/Blocksadmin.php - About 1 day to fix

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

          public function listBlocks(): void
          {
              global $xoopsModule, $pathIcon16;
              require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
              //        xoops_loadLanguage('admin', 'system');
      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)
          {
              \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 80 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 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

        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): void
            {
                $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 render has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            public function render(?array $block = null)
            {
                \xoops_load('XoopsFormLoader');
                \xoops_loadLanguage('common', $this->moduleDirNameUpper);
        
        
        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 52 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): void
            {
                \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 15 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 41 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): void
                {
                    $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 12 (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): void
                  {
                      \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 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 cloneBlock has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Method editBlock has 32 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

                    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): void
                    Severity: Major
                    Found in class/Common/Blocksadmin.php - About 1 hr to fix

                      Method isBlockCloned has 8 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): void
                      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 listBlocks() has 246 lines of code. Current threshold is set to 100. Avoid really long methods.
                            Open

                                public function listBlocks(): void
                                {
                                    global $xoopsModule, $pathIcon16;
                                    require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
                                    //        xoops_loadLanguage('admin', 'system');
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpmd

                            The method isBlockCloned() has an NPath complexity of 576. 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): void
                                {
                                    \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 render() has 109 lines of code. Current threshold is set to 100. Avoid really long methods.
                            Open

                                public function render(?array $block = null)
                                {
                                    \xoops_load('XoopsFormLoader');
                                    \xoops_loadLanguage('common', $this->moduleDirNameUpper);
                            
                            
                            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
                                {
                                    global $xoopsModule, $pathIcon16;
                                    require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
                                    //        xoops_loadLanguage('admin', '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 15 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 a Cyclomatic Complexity of 22. The configured cyclomatic complexity threshold is 10.
                            Open

                                public function listBlocks(): void
                                {
                                    global $xoopsModule, $pathIcon16;
                                    require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
                                    //        xoops_loadLanguage('admin', '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 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 11. 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): void
                                {
                                    \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): void
                                {
                                    $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 20. 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 '446', 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 '703', 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 '670', 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 '697', 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 '84', 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 '632', 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 '639', 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 '704', 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 '342', 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 '386', 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 '631', 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 '658', 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=' . $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 '322', 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 '631', 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 '628', 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 '690', 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 '707', 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 '84', 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 '466', 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 '626', 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 '612', 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 '627', 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 '85', 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 '501', 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 '610', 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 '693', 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 '695', 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 '614', 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 '662', column '47').
                            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 '696', 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

                            Missing class import via use statement (line '641', 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 '644', 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 '667', column '39').
                            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 '699', 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 render uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                            Open

                                    } else {
                                        if ('' !== $block['template']) {
                                            /** @var \XoopsTplfileHandler $tplfileHandler */
                                            $tplfileHandler = \xoops_getHandler('tplfile');
                                            $btemplate      = $tplfileHandler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $block['bid']);
                            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

                            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 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 '\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 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

                            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

                            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($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

                            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

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

                                    $myblock = new \XoopsBlock($bid);
                            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

                            The method isBlockCloned() contains an exit expression.
                            Open

                                        exit();
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpmd

                            ExitExpression

                            Since: 0.2

                            An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                            Example

                            class Foo {
                                public function bar($param)  {
                                    if ($param === 42) {
                                        exit(23);
                                    }
                                }
                            }

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

                            Avoid unused parameters such as '$oldgroups'.
                            Open

                                    array $oldgroups,
                            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

                            The method isBlockCloned() contains an exit expression.
                            Open

                                        exit();
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php by phpmd

                            ExitExpression

                            Since: 0.2

                            An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                            Example

                            class Foo {
                                public function bar($param)  {
                                    if ($param === 42) {
                                        exit(23);
                                    }
                                }
                            }

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

                            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 124..136

                            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 671..683

                            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

                            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(?\XoopsDatabase $db, \Xmf\Module\Helper $helper)
                            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

                            The variable $cache_select is not named in camelCase.
                            Open

                                public function render(?array $block = null)
                                {
                                    \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)
                                {
                                    \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)
                                {
                                    \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