XoopsModules25x/wfdownloads

View on GitHub

Showing 182 of 279 total issues

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

    public function addElement($formElement, $required = false, $row = null, $column = null)
    {
        if (null === $row) {
            $row = $this->_rows;
        }
Severity: Minor
Found in class/MulticolumnsThemeForm.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 import_wmpdownloads_to_wfdownloads has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function import_wmpdownloads_to_wfdownloads()
{
    echo '<br>';
    echo _AM_WFDOWNLOADS_IMPORT_IMPORTINGDATA;
    echo '<br>';
Severity: Major
Found in admin/import.php - About 2 hrs to fix

    Method createThumb has 72 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function createThumb($imgName, $imgPath, $imgSavePath, $width = 100, $height = 100, $quality = 100, $update = false, $aspect = 1)
        {
            $helper = Helper::getInstance();
    
            // Paths
    Severity: Major
    Found in class/Utility.php - About 2 hrs to fix

      Method import_mydownloads_to_wfdownloads has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function import_mydownloads_to_wfdownloads()
      {
          echo '<br>';
          echo _AM_WFDOWNLOADS_IMPORT_IMPORTINGDATA;
          echo '<br>';
      Severity: Major
      Found in admin/import.php - About 2 hrs to fix

        DbupdaterTable has 25 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class DbupdaterTable
        {
            /**
             * @var string $_name name of the table
             */
        Severity: Minor
        Found in class/DbupdaterTable.php - About 2 hrs to fix

          Method import_pddownloads_to_wfdownloads has 69 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function import_pddownloads_to_wfdownloads()
          {
              echo '<br>';
              echo _AM_WFDOWNLOADS_IMPORT_IMPORTINGDATA;
              echo '<br>';
          Severity: Major
          Found in admin/import.php - About 2 hrs to fix

            Function getListTypeAsArray has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function getListTypeAsArray($dirname, $type = '', $prefix = '', $noselection = 1)
                {
                    $filelist = [];
                    switch (\trim($type)) {
                        case 'images':
            Severity: Minor
            Found in class/WfsLists.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 isBlockCloned has a Cognitive Complexity of 20 (exceeds 5 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: Minor
            Found in admin/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 uploading has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function uploading(
                    $filename,
                    $uploadDirectory = 'uploads',
                    $allowedMimetypes = [],
                    $redirectURL = 'index.php',
            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

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

                public static function copyDir($source, $destination)
                {
                    if (!$dirHandler = \opendir($source)) {
                        return false;
                    }
            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 searchSwishe has 64 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function searchSwishe($swisheQueryWords)
                {
                    /**
                     * @param $str
                     * @param $num_chars
            Severity: Major
            Found in class/Utility.php - About 2 hrs to fix

              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)
                  {
                      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

                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)
                    {
                        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/Utility.php - About 2 hrs to fix

                  File singlefile.php has 270 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 singlefile.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)
                        {
                            // 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 wfdownloads_cloneFileDir has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function wfdownloads_cloneFileDir($path)
                    {
                        global $patKeys;
                        global $patValues;
                    
                    
                    Severity: Minor
                    Found in admin/clone.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 import_wfd_to_wfdownloads has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function import_wfd_to_wfdownloads()
                    {
                        /** @var \XoopsModuleHandler $moduleHandler */
                        $moduleHandler = xoops_getHandler('module');
                        // Get destination module/handlers/configs
                    Severity: Minor
                    Found in admin/import.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 import_tdmdownloads_to_wfdownloads has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function import_tdmdownloads_to_wfdownloads()
                    {
                        echo "<br><span style='font-weight: bold;'>Importing Data</span><br>";
                        $destination = [
                            'cat'       => $GLOBALS['xoopsDB']->prefix('wfdownloads_cat'),
                    Severity: Major
                    Found in admin/import.php - About 2 hrs to fix

                      Method largeDownload has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function largeDownload($filePath, $fileMimetype)
                          {
                              /* You may need these ini settings too */
                              \set_time_limit(0);
                              \ini_set('memory_limit', '512M');
                      Severity: Major
                      Found in class/Utility.php - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language