XoopsModules25x/wfdownloads

View on GitHub

Showing 182 of 279 total issues

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

    public function render($alphaCount = null, $howmanyother = null)
    {
        $moduleDirName      = \basename(dirname(__DIR__, 2));
        $moduleDirNameUpper = mb_strtoupper($moduleDirName);
        \xoops_loadLanguage('common', $moduleDirName);
Severity: Major
Found in class/Common/LetterChoice.php - About 2 hrs to fix

    Function searchSwishe has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function searchSwishe($swisheQueryWords)
        {
            /**
             * @param $str
             * @param $num_chars
    Severity: Minor
    Found in class/Utility.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 __construct has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function __construct($id = null)
        {
            parent::__construct();
            $this->initVar('requestid', \XOBJ_DTYPE_INT);
    
    
    Severity: Major
    Found in class/Modification.php - About 2 hrs to fix

      Method __construct has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function __construct($id = null)
          {
              /** @var \XoopsModules\Wfdownloads\Helper $this ->helper */
              $this->helper = Helper::getInstance();
              $this->db     = \XoopsDatabaseFactory::getDatabaseConnection();
      Severity: Major
      Found in class/Download.php - About 2 hrs to fix

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

            public function render()
            {
                $ele_name = $this->getName();
                $ret      = '';
                $ret      .= "<form name='{$ele_name}' id='{$ele_name}' action='{$this->getAction()}' method='{$this->getMethod()}' onsubmit='return xoopsFormValidate_{$ele_name}();' {$this->getExtra()} >" . NWLINE;
        Severity: Major
        Found in class/MulticolumnsThemeForm.php - About 2 hrs to fix

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

              function isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options = null)
              {
                  xoops_loadLanguage('admin', 'system');
                  xoops_loadLanguage('admin/blocksadmin', 'system');
                  xoops_loadLanguage('admin/groups', 'system');
          Severity: Major
          Found in admin/blocksadmin.php - About 2 hrs to fix

            Method xoops_module_update_wfdownloads has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function xoops_module_update_wfdownloads(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 getForm has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getForm()
                  {
                      require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
                      $uid = !empty($GLOBALS['xoopsUser']) ? (int)$GLOBALS['xoopsUser']->getVar('uid') : 0;
              
              
              Severity: Major
              Found in class/Review.php - About 2 hrs to fix

                Method getForm has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getForm()
                    {
                        require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
                        $uid = !empty($GLOBALS['xoopsUser']) ? (int)$GLOBALS['xoopsUser']->getVar('uid') : 0;
                
                
                Severity: Major
                Found in class/Mirror.php - About 2 hrs to fix

                  Consider simplifying this complex logical expression.
                  Open

                  if (!is_object($GLOBALS['xoopsUser']) && true === $use_mirrors
                      && (_WFDOWNLOADS_ANONPOST_MIRROR == $helper->getConfig('anonpost')
                          || _WFDOWNLOADS_ANONPOST_BOTH == $helper->getConfig('anonpost'))
                      && (_WFDOWNLOADS_SUBMISSIONS_MIRROR == $helper->getConfig('submissions')
                          || _WFDOWNLOADS_SUBMISSIONS_BOTH == $helper->getConfig('submissions'))) {
                  Severity: Critical
                  Found in singlefile.php - About 2 hrs to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if (!\is_object($GLOBALS['xoopsUser'])
                                && (\_WFDOWNLOADS_ANONPOST_MIRROR == $this->helper->getConfig('anonpost')
                                    || \_WFDOWNLOADS_ANONPOST_BOTH == $this->helper->getConfig('anonpost'))
                                && (\_WFDOWNLOADS_SUBMISSIONS_MIRROR == $this->helper->getConfig('submissions')
                                    || \_WFDOWNLOADS_SUBMISSIONS_BOTH == $this->helper->getConfig('submissions'))
                    Severity: Critical
                    Found in class/Download.php - About 2 hrs to fix

                      Method uploading has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function uploading(
                              $filename,
                              $uploadDirectory = 'uploads',
                              $allowedMimetypes = [],
                              $redirectURL = 'index.php',
                      Severity: Minor
                      Found in class/Utility.php - About 1 hr to fix

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

                            function updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups)
                            {
                                $myblock = new XoopsBlock($bid);
                                $myblock->setVar('title', $btitle);
                                $myblock->setVar('weight', $bweight);
                        Severity: Minor
                        Found in admin/blocksadmin.php - About 1 hr to fix

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

                              public static function getDownloadTime($size = 0, $gmodem = 1, $gisdn = 1, $gdsl = 1, $gslan = 0, $gflan = 0)
                              {
                                  $aflag  = [];
                                  $amtime = [];
                                  $artime = [];
                          Severity: Minor
                          Found in class/Utility.php - About 1 hr to fix

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

                                public static function getDirectoryStatus($path, $mode = 0777, $redirectFile = null)
                                {
                                    global $pathIcon16;
                            
                                    if (empty($path)) {
                            Severity: Minor
                            Found in class/Common/DirectoryChecker.php - About 1 hr to fix

                              Function xcopy has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public static function xcopy($source, $dest)
                                  {
                                      // Check for symlinks
                                      if (\is_link($source)) {
                                          return \symlink(\readlink($source), $dest);
                              Severity: Minor
                              Found in class/Common/FilesManagement.php - About 1 hr to fix

                              Cognitive Complexity

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

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

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

                              Further reading

                              Function delDir has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public static function delDir($dir, $if_not_empty = true)
                                  {
                                      if (!\file_exists($dir)) {
                                          return true;
                                      }
                              Severity: Minor
                              Found in class/Utility.php - About 1 hr to fix

                              Cognitive Complexity

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

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

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

                              Further reading

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

                              function wfdownloads_top_by_cat_show($options)
                              {
                                  if (!class_exists(Helper::class)) {
                                      return false;
                                  }
                              Severity: Minor
                              Found in blocks/top_by_cat.php - About 1 hr to fix

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

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

                                  Method getForm has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function getForm($action = false)
                                      {
                                          require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
                                  
                                          if (!$action) {
                                  Severity: Minor
                                  Found in class/Mimetype.php - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language