XoopsModules25x/wfdownloads

View on GitHub

Showing 182 of 279 total issues

File Utility.php has 1363 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace XoopsModules\Wfdownloads;

/*
Severity: Major
Found in class/Utility.php - About 3 days to fix

    File xoops_version.php has 965 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*
     You may not change or alter any portion of this comment or credits
     of supporting developers from this source code or any supporting source code
     which is considered copyrighted (c) material of the original comment or credit authors.
    Severity: Major
    Found in xoops_version.php - About 2 days to fix

      File downloads.php has 811 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /*
       You may not change or alter any portion of this comment or credits
       of supporting developers from this source code or any supporting source code
       which is considered copyrighted (c) material of the original comment or credit authors.
      Severity: Major
      Found in admin/downloads.php - About 1 day to fix

        File Download.php has 758 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        namespace XoopsModules\Wfdownloads;
        
        /*
        Severity: Major
        Found in class/Download.php - About 1 day to fix

          Function wfdownloads_search has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
          Open

          function wfdownloads_search($queryArray, $andor, $limit, $offset, $userId = 0, $categories = [], $sortBy = 0, $searchIn = '', $extra = '')
          {
              $helper = Helper::getInstance();
          
              $userGroups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : [0 => XOOPS_GROUP_ANONYMOUS];
          Severity: Minor
          Found in include/search.inc.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

          Method getAdminForm has 285 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getAdminForm($title, $customArray = []) // $custom array added April 22, 2006 by jwe
              {
                  require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
          
                  $use_mirrors = $this->helper->getConfig('enable_mirrors');
          Severity: Major
          Found in class/Download.php - About 1 day to fix

            File admin.php has 636 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /*
             You may not change or alter any portion of this comment or credits
             of supporting developers from this source code or any supporting source code
             which is considered copyrighted (c) material of the original comment or credit authors.
            Severity: Major
            Found in language/english/admin.php - About 1 day to fix

              File import.php has 613 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /*
               You may not change or alter any portion of this comment or credits
               of supporting developers from this source code or any supporting source code
               which is considered copyrighted (c) material of the original comment or credit authors.
              Severity: Major
              Found in admin/import.php - About 1 day to fix

                File onupdate.php has 541 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /*
                 You may not change or alter any portion of this comment or credits
                 of supporting developers from this source code or any supporting source code
                 which is considered copyrighted (c) material of the original comment or credit authors.
                Severity: Major
                Found in include/onupdate.php - About 1 day to fix

                  Method update_tables_to_322 has 213 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function update_tables_to_322($module)
                  {
                      $dbupdater = new Wfdownloads\Dbupdater();
                  
                      // create wfdownloads_meta table
                  Severity: Major
                  Found in include/onupdate.php - About 1 day to fix

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

                        function listBlocks()
                        {
                            global $xoopsModule, $pathIcon16;
                            require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
                            $moduleDirName = basename(dirname(__DIR__));
                    Severity: Major
                    Found in admin/blocksadmin.php - About 1 day to fix

                      Function xoops_module_update_wfdownloads has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function xoops_module_update_wfdownloads(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)
                          {
                              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/Utility.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)
                          {
                              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

                      Utility has 56 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class Utility extends Common\SysUtility
                      {
                          //--------------- Custom module methods -----------------------------
                          /**
                           * @param     $categoryObj
                      Severity: Major
                      Found in class/Utility.php - About 1 day to fix

                        File blocksadmin.php has 499 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        /**
                         * You may not change or alter any portion of this comment or credits
                         * of supporting developers from this source code or any supporting source code
                         * which is considered copyrighted (c) material of the original comment or credit authors.
                        Severity: Minor
                        Found in admin/blocksadmin.php - About 1 day to fix

                          Function getDownloadInfo has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function getDownloadInfo()
                              {
                                  \xoops_load('XoopsUserUtility');
                          
                                  $download['id']  = $this->getVar('lid');
                          Severity: Minor
                          Found in class/Download.php - About 7 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 getForm has 184 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function getForm($customArray = []) // $custom array added April 22, 2006 by jwe)
                              {
                                  require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
                                  require_once XOOPS_ROOT_PATH . '/class/tree.php';
                          
                          
                          Severity: Major
                          Found in class/Download.php - About 7 hrs to fix

                            Method getDownloadInfo has 169 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function getDownloadInfo()
                                {
                                    \xoops_load('XoopsUserUtility');
                            
                                    $download['id']  = $this->getVar('lid');
                            Severity: Major
                            Found in class/Download.php - About 6 hrs to fix

                              Method import_wfd_to_wfdownloads has 165 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function import_wfd_to_wfdownloads()
                              {
                                  /** @var \XoopsModuleHandler $moduleHandler */
                                  $moduleHandler = xoops_getHandler('module');
                                  // Get destination module/handlers/configs
                              Severity: Major
                              Found in admin/import.php - About 6 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language