XoopsModules25x/xoopspoll

View on GitHub

Showing 181 of 2,846 total issues

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

          Method editBlock has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function editBlock(int $bid): void
              {
                  //        require_once \dirname(__DIR__,2) . '/admin/admin_header.php';
                  //        \xoops_cp_header();
                  \xoops_loadLanguage('admin', 'system');
          Severity: Minor
          Found in class/Common/Blocksadmin.php - About 1 hr to fix

            Method assignForm has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function assignForm(\XoopsTpl $tpl): void
                {
                    $myts       = \MyTextSanitizer::getInstance();
                    $optionObjs = $this->optionHandler->getAllByPollId($this->pollObj->getVar('poll_id'));
            
            
            Severity: Minor
            Found in class/Renderer.php - About 1 hr to fix

              Method vote has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function vote(int $optionId, string $ip, int $time): bool
                  {
                      if (!empty($optionId) && $this->isAllowedToVote()) {
                          $voteTime      = empty($time) ? \time() : (int)$time;
                          $uid           = ($GLOBALS['xoopsUser'] instanceof \XoopsUser) ? $GLOBALS['xoopsUser']->uid() : 0;
              Severity: Minor
              Found in class/Poll.php - About 1 hr to fix

                Method getPostBody has 36 lines of code (exceeds 25 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

                  Function render has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function render(?array $block = null): void
                      {
                          \xoops_load('XoopsFormLoader');
                          \xoops_loadLanguage('common', $this->moduleDirNameUpper);
                  
                  
                  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 displayAttachment has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function displayAttachment($asSource = false)
                      {
                          global $xoopsModule;
                          /** @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

                  Method getPostBody has 35 lines of code (exceeds 25 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

                    Method orderBlock has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function orderBlock(
                            array $bid,
                            array $oldtitle,
                            array $oldside,
                            array $oldweight,
                    Severity: Minor
                    Found in class/Common/Blocksadmin.php - About 1 hr to fix

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

                          public function __construct($id = null)
                          {
                              parent::__construct();
                              //        $timestamp = xoops_getUserTimestamp(time());
                              $currentTimestamp = \time();
                      Severity: Minor
                      Found in class/Poll.php - About 1 hr to fix

                        Method hasVoted has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function hasVoted(?int $pid, string $ip, int $uid = 0): bool
                            {
                                $uid        = (int)$uid;
                                $pid        = (int)$pid;
                                $voted      = true;
                        Severity: Minor
                        Found in class/LogHandler.php - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language