mambax7/tdmdownloads

View on GitHub

Showing 130 of 207 total issues

Method truncateHtml has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function truncateHtml(
        string $text,
        ?int $length = 100,
        string $ending = '...',
        bool $exact = false,
Severity: Major
Found in class/Common/SysUtility.php - About 2 hrs to fix

    Method update_tdmdownloads_v201 has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function update_tdmdownloads_v201($module)
    {
        $moduleDirName      = \basename(\dirname(__DIR__));
        $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
        $helper             = Helper::getInstance();
    Severity: Major
    Found in include/onupdate.php - About 2 hrs to fix

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

          public static function deleteDirectory(string $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($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

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

          public static function cloneFileFolder($path)
          {
              global $patKeys;
              global $patValues;
      
      
      Severity: Minor
      Found in class/Cloner.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 getFormImages has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getFormImages($action = false)
          {
              $moduleDirName      = \basename(\dirname(__DIR__, 2));
              $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
              $helper             = Helper::getInstance();
      Severity: Major
      Found in class/Common/Images.php - About 2 hrs to fix

        File submit.php has 257 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        use XoopsModules\Tag\{
            Helper as TagHelper,
            Tag,
        Severity: Minor
        Found in submit.php - About 2 hrs to fix

          File modified.php has 255 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

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

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

                public function resizeImage($sourcefile, $endfile, $max_width, $max_height, $imageMimetype)
                {
                    // check file extension
                    switch ($imageMimetype) {
                        case 'image/png':
            Severity: Major
            Found in class/Common/ImageResizer.php - About 2 hrs to fix

              Consider simplifying this complex logical expression.
              Open

                      if (\Xmf\Request::hasVar('ok', 'REQUEST') && 1 == \Xmf\Request::getInt('ok', 0, 'REQUEST')) {
                          if (!$GLOBALS['xoopsSecurity']->check()) {
                              redirect_header('category.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
                          }
                          // supression des téléchargements de la catégorie
              Severity: Critical
              Found in admin/category.php - About 2 hrs to fix

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

                    public function isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $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 2 hrs to fix

                  Method resizeAndCrop has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function resizeAndCrop($src_url, $src_mimetype, $dest_url, $dest_w, $dest_h, $quality = 90)
                      {
                          // check file extension
                          switch ($src_mimetype) {
                              case 'image/png':
                  Severity: Minor
                  Found in class/Common/ImageResizer.php - About 2 hrs to fix

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

                        public function getForm($action = false)
                        {
                            $helper        = Helper::getInstance();
                            $moduleDirName = \basename(\dirname(__DIR__));
                            if (!$action) {
                    Severity: Minor
                    Found in class/Field.php - About 1 hr to fix

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

                          public static function cloneFolder($pathSource, $pathTarget)
                          {
                              if (\is_dir($pathSource)) {
                                  // Create new dir
                                  if (!\mkdir($pathTarget) && !\is_dir($pathTarget)) {
                      Severity: Minor
                      Found in class/Utilities.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 14 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              $bid,
                              $oldtitle,
                              $oldside,
                              $oldweight,
                              $oldvisible,
                      Severity: Major
                      Found in class/Common/Blocksadmin.php - About 1 hr to fix

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

                            public function mergeImage($src_url, $dest_url, $pos, $of)
                            {
                                $dest = \imagecreatefromjpeg($dest_url);
                                $src  = \imagecreatefromjpeg($src_url);
                                // ImageCopy ( resource $dst_im , resource $src_im , int $dst_x , int $dst_y , int $src_x , int $src_y , int $src_w , int $src_h )
                        Severity: Minor
                        Found in class/Common/ImageResizer.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 mergeImage has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function mergeImage($src_url, $dest_url, $pos, $of)
                            {
                                $dest = \imagecreatefromjpeg($dest_url);
                                $src  = \imagecreatefromjpeg($src_url);
                                // ImageCopy ( resource $dst_im , resource $src_im , int $dst_x , int $dst_y , int $src_x , int $src_y , int $src_w , int $src_h )
                        Severity: Minor
                        Found in class/Common/ImageResizer.php - About 1 hr to fix

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

                          function update_tdmdownloads_v200(&$module)
                          {
                              // Update size
                              $moduleDirName = basename(dirname(__DIR__));
                              $db            = \XoopsDatabaseFactory::getDatabaseConnection();
                          Severity: Minor
                          Found in include/onupdate.php - About 1 hr to fix

                            Method checkVerModule has 42 lines of code (exceeds 25 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 1 hr to fix

                              Method getPathTreeUrl has 41 lines of code (exceeds 25 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 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language