XoopsModules25x/myiframe

View on GitHub

Showing 49 of 447 total issues

Function xoops_module_update_myiframe has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

function xoops_module_update_myiframe(\XoopsModule $module, $previousVersion = null)
{
    $moduleDirName      = \basename(\dirname(__DIR__));
    $moduleDirNameUpper = \mb_strtoupper($moduleDirName);

Severity: Minor
Found in include/onupdate.php - About 1 day 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 truncateHtml has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
Open

    public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true): string
    {
        if ($considerHtml) {
            // if the plain text is shorter than the maximum length, return the whole text
            if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) {
Severity: Minor
Found in class/Common/SysUtility.php - About 1 day 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

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

<?php

declare(strict_types=1);

namespace XoopsModules\Myiframe\Common;
Severity: Major
Found in class/Common/Blocksadmin.php - About 1 day to fix

    Method listBlocks has 147 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 5 hrs 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): void
          {
              \xoops_load('XoopsFormLoader');
              \xoops_loadLanguage('common', $this->moduleDirNameUpper);
      
      
      Severity: Major
      Found in class/Common/Blocksadmin.php - About 3 hrs to fix

        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 checkVerModule has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function checkVerModule(\Xmf\Module\Helper $helper, ?string $source = 'github', ?string $default = 'master'): ?array
            {
                $moduleDirName      = \basename(\dirname(__DIR__, 2));
                $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
                $update             = '';
        Severity: Minor
        Found in class/Common/VersionChecks.php - About 2 hrs to fix

        Cognitive Complexity

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

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

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

        Further reading

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

            public function orderBlock(
                array $bid, array $oldtitle, array $oldside, array $oldweight, array $oldvisible, array $oldgroups, array $oldbcachetime, array $oldbmodule, array $title, array $weight, array $visible, array $side, array $bcachetime, array $groups, array $bmodule
            ): void {
                if (!$GLOBALS['xoopsSecurity']->check()) {
                    \redirect_header($_SERVER['SCRIPT_NAME'], 3, \implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()));
        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 xoops_module_update_myiframe has 67 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function xoops_module_update_myiframe(\XoopsModule $module, $previousVersion = null)
        {
            $moduleDirName      = \basename(\dirname(__DIR__));
            $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
        
        
        Severity: Major
        Found in include/onupdate.php - About 2 hrs to fix

          Method insert has 65 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function insert(\XoopsObject $object, $force = false)
              {
                  if (!$object instanceof MyiframeBase) {
                      return false;
                  }
          Severity: Major
          Found in class/MyiframeBaseHandler.php - About 2 hrs to fix

            Function loadTableFromArrayWithReplace has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

            function loadTableFromArrayWithReplace($table, $data, $search, $replace)
            {
                /** @var \XoopsMySQLDatabase $db */
                $db = \XoopsDatabaseFactory::getDatabaseConnection();
            
            
            Severity: Minor
            Found in testdata/index.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 truncateHtml has 63 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true): string
                {
                    if ($considerHtml) {
                        // if the plain text is shorter than the maximum length, return the whole text
                        if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) {
            Severity: Major
            Found in class/Common/SysUtility.php - About 2 hrs to fix

              Function deleteDirectory has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function deleteDirectory($src): bool
                  {
                      // Only continue if user is a 'global' Admin
                      if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                          return false;
              Severity: Minor
              Found in class/Common/FilesManagement.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): void
                  {
                      \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, array $oldgroups, array $oldbcachetime, array $oldbmodule, array $title, array $weight, array $visible, array $side, array $bcachetime, array $groups, array $bmodule
                Severity: Major
                Found in class/Common/Blocksadmin.php - About 1 hr to fix

                  Method checkVerModule has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function checkVerModule(\Xmf\Module\Helper $helper, ?string $source = 'github', ?string $default = 'master'): ?array
                      {
                          $moduleDirName      = \basename(\dirname(__DIR__, 2));
                          $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
                          $update             = '';
                  Severity: Minor
                  Found in class/Common/VersionChecks.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

                      Method addEditForm has 13 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      function addEditForm($frameid, $Action, $FormTitle, $longdesc, $width, $height, $align, $frameborder, $marginwidth, $marginheight, $scrolling, $url, $LabelSubmitButton): void
                      Severity: Major
                      Found in admin/manage.php - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language