mambax7/tdmdownloads

View on GitHub

Showing 130 of 207 total issues

Method xoops_module_install_tdmdownloads has 99 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function xoops_module_install_tdmdownloads()
{
    global $xoopsModule, $xoopsConfig, $xoopsDB;
    $moduleDirName = basename(dirname(__DIR__));
    $namemodule    = $moduleDirName;
Severity: Major
Found in include/oninstall.php - About 3 hrs to fix

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

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

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

      <?php
      
      declare(strict_types=1);
      
      /**
      Severity: Minor
      Found in admin/import.php - About 3 hrs to fix

        Method importWfdownloads has 93 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function importWfdownloads($shots = '', $catimg = '')
        {
            $moduleDirName = basename(dirname(__DIR__));
            $ok            = \Xmf\Request::getInt('ok', 0, 'POST');
            global $xoopsDB;
        Severity: Major
        Found in admin/import.php - About 3 hrs to fix

          File viewcat.php has 321 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          declare(strict_types=1);
          
          /**
          Severity: Minor
          Found in viewcat.php - About 3 hrs to fix

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

                public function getForm($action = false)
                {
                    $helper = Helper::getInstance();
                    if (!$action) {
                        $action = $_SERVER['REQUEST_URI'];
            Severity: Major
            Found in class/Category.php - About 3 hrs to fix

              Function getPathTreeUrl has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function getPathTreeUrl($mytree, $key, $category_array, $title, $prefix = '', $link = false, $order = 'ASC', $lasturl = false)
                  {
                      global $xoopsModule;
                      $categoryParent = $mytree->getAllParent($key);
                      if ('ASC' === $order) {
              Severity: Minor
              Found in class/Utility.php - About 3 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($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $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 xoops_module_install_tdmdownloads has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

              function xoops_module_install_tdmdownloads()
              {
                  global $xoopsModule, $xoopsConfig, $xoopsDB;
                  $moduleDirName = basename(dirname(__DIR__));
                  $namemodule    = $moduleDirName;
              Severity: Minor
              Found in include/oninstall.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(
                      $bid,
                      $oldtitle,
                      $oldside,
                      $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 checkVerModule has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

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

                  public static function getPathTreeUrl(
                      $mytree,
                      $key,
                      $category_array,
                      $title,
              Severity: Minor
              Found in class/Utilities.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 getStatusImage has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function getStatusImage($time, $status)
                  {
                      $moduleDirName = \basename(\dirname(__DIR__));
                      $helper    = Helper::getInstance();
                      $count     = 7;
              Severity: Minor
              Found in class/Utilities.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 getStatusImage has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getStatusImage($time, $status)
                  {
                      global $xoopsModuleConfig;
                      $moduleDirName = \basename(\dirname(__DIR__));
                      $helper        = Helper::getInstance();
              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

              File Downloads.php has 279 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              declare(strict_types=1);
              
              namespace XoopsModules\Tdmdownloads;
              Severity: Minor
              Found in class/Downloads.php - About 2 hrs to fix

                Method storeUploadedFile has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function storeUploadedFile($target, $mimeType, $uid)
                    {
                        $moduleDirName      = \basename(\dirname(__DIR__, 2));
                        $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
                        require_once XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/header.php';
                Severity: Major
                Found in class/Common/FineimpuploadHandler.php - About 2 hrs to fix

                  Method b_tdmdownloads_top_edit has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function b_tdmdownloads_top_edit($options)
                  {
                      //appel de la class
                      $moduleDirName   = basename(dirname(__DIR__));
                      $categoryHandler = Helper::getInstance()->getHandler('Category');
                  Severity: Major
                  Found in blocks/tdmdownloads_top.php - About 2 hrs to fix

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

                        public function resizeImage($sourcefile, $endfile, $max_width, $max_height, $imageMimetype)
                        {
                            // check file extension
                            switch ($imageMimetype) {
                                case 'image/png':
                    Severity: Minor
                    Found in class/Common/ImageResizer.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 storeUploadedFile has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function storeUploadedFile($target, $mimeType, $uid)
                        {
                            $moduleDirName      = \basename(\dirname(__DIR__, 2));
                            $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
                            require_once XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/header.php';
                    Severity: Minor
                    Found in class/Common/FineimpuploadHandler.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 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();
                        $prefixedTable = $db->prefix($table);
                    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

                    Severity
                    Category
                    Status
                    Source
                    Language