XoopsModules25x/xoopspoll

View on GitHub

Showing 300 of 2,846 total issues

Method xoopspollBlockMultiEdit has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function xoopspollBlockMultiEdit(mixed $options): string
{
    /**
     * Options[]
     *        [0]    0|1 = show as option|select
Severity: Major
Found in blocks/multipoll.php - About 2 hrs to fix

    Method approve has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function approve(&$post, $force = false)
        {
            if (empty($post)) {
                return false;
            }
    Severity: Minor
    Found in extras/newbb_5x/irmtfan/class/PostHandler.php - About 1 hr to fix

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

          public function mailResults(mixed $pollObj = null): array
          {
              $criteria = new \CriteriaCompo();
              $criteria->add(new \Criteria('end_time', \time(), '<'));  // expired polls
              $criteria->add(new \Criteria('mail_status', Constants::POLL_NOT_MAILED, '=')); // email not previously sent
      Severity: Minor
      Found in class/PollHandler.php - About 1 hr to fix

        Method getFormFeedback has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getFormFeedback($action = false): XoopsThemeForm
            {
                if (!$action) {
                    $action = $_SERVER['REQUEST_URI'];
                }
        Severity: Minor
        Found in class/Common/ModuleFeedback.php - About 1 hr to fix

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

              public function approve(&$post, $force = false)
              {
                  if (empty($post)) {
                      return false;
                  }
          Severity: Minor
          Found in extras/newbb_5x/trunk_5_00/class/Post.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

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

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

                public function displayPostEdit()
                {
                    global $myts;
            
                    if (empty($GLOBALS['xoopsModuleConfig']['recordedit_timelimit'])) {
            Severity: Minor
            Found in extras/newbb_5x/irmtfan/class/Post.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 updateBlock has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function updateBlock(int $bid, string $btitle, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups)
                {
                    $myblock = new \XoopsBlock($bid);
                    $myblock->setVar('title', $btitle);
                    $myblock->setVar('weight', $bweight);
            Severity: Minor
            Found in class/Common/Blocksadmin.php - About 1 hr to fix

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

                  public function renderOptionFormTray(int $pid = 0): \XoopsFormElementTray
                  {
                      \xoops_load('xoopsformloader');
                      $pid            = (int)$pid;
                      $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path('modules/xoopspoll/assets/images/colorbars/'));
              Severity: Minor
              Found in class/OptionHandler.php - About 1 hr to fix

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

                    public static function checkVerModule(\Xmf\Module\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

                  Function getPostBody has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function &getPostBody()
                      {
                          global $xoopsConfig, $xoopsUser, $myts;
                          /** @var Xoopspoll\Helper $helper */
                          $helper = Xoopspoll\Helper::getInstance();
                  Severity: Minor
                  Found in extras/newbb_5x/trunk_5_00/class/Post.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 approve has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function approve(&$post, $force = false)
                      {
                          if (empty($post)) {
                              return false;
                          }
                  Severity: Minor
                  Found in extras/newbb_5x/irmtfan/class/PostHandler.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 handleActions has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function handleActions(BlockData $blockData)
                      {
                          $moduleDirNameUpper = \mb_strtoupper(Helper::getInstance()->getDirname());
                          $bid = Request::getInt('bid', 0);
                  
                  
                  Severity: Minor
                  Found in class/Common/BlockActionsHandler.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 getPostBody has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function &getPostBody()
                      {
                          global $myts;
                          $GLOBALS['xoopsModuleConfig'] = newbb_load_config(); // irmtfan  load all newbb configs - newbb config in blocks activated in some modules like profile
                          //        mod_loadFunctions('user', 'newbb');
                  Severity: Minor
                  Found in extras/newbb_5x/irmtfan/class/Post.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 isBlockCloned has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function isBlockCloned(int $bid, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups, bool $redirect = true)
                      {
                          \xoops_loadLanguage('admin', 'system');
                          \xoops_loadLanguage('admin/blocksadmin', 'system');
                          \xoops_loadLanguage('admin/groups', 'system');
                  Severity: Minor
                  Found in class/Common/Blocksadmin.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 loadTableFromArrayWithReplace has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function loadTableFromArrayWithReplace(string $table, array $data, string $search, $replace): int
                  {
                      /** @var \XoopsMySQLDatabase $db */
                      $db = \XoopsDatabaseFactory::getDatabaseConnection();
                  
                  
                  Severity: Minor
                  Found in testdata/index.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 handleActions has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function handleActions(BlockData $blockData)
                      {
                          $moduleDirNameUpper = \mb_strtoupper(Helper::getInstance()->getDirname());
                          $bid = Request::getInt('bid', 0);
                  
                  
                  Severity: Minor
                  Found in class/Common/BlockActionsHandler.php - About 1 hr to fix

                    Method cloneBlock has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function cloneBlock(int $bid)
                        {
                            //require __DIR__ . '/admin_header.php';
                            //        \xoops_cp_header();
                    
                    
                    Severity: Minor
                    Found in class/Common/Blocksadmin.php - About 1 hr to fix

                      The class BlockData has 27 fields. Consider redesigning BlockData to keep the number of fields under 15.
                      Open

                      class BlockData
                      {
                          public $bid;
                          public $op;
                          public $ok;
                      Severity: Minor
                      Found in class/Common/BlockData.php by phpmd

                      TooManyFields

                      Since: 0.1

                      Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

                      Example

                      class Person {
                         protected $one;
                         private $two;
                         private $three;
                         [... many more fields ...]
                      }

                      Source https://phpmd.org/rules/codesize.html#toomanyfields

                      The class Post has 23 fields. Consider redesigning Post to keep the number of fields under 15.
                      Open

                      class Post extends \XoopsObject
                      {
                          private $post_id;
                          private $topic_id;
                          private $forum_id;

                      TooManyFields

                      Since: 0.1

                      Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

                      Example

                      class Person {
                         protected $one;
                         private $two;
                         private $three;
                         [... many more fields ...]
                      }

                      Source https://phpmd.org/rules/codesize.html#toomanyfields

                      Severity
                      Category
                      Status
                      Source
                      Language