mambax7/songlist

View on GitHub

Showing 264 of 3,642 total issues

Function toArray has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function toArray($extra = false): array
    {
        $ret  = parent::toArray();
        $form = $this->getForm(true);
        foreach ($form as $key => $element) {
Severity: Minor
Found in class/Artists.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

File SongsHandler.php has 307 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php declare(strict_types=1);

namespace XoopsModules\Songlist;

require_once \dirname(__DIR__) . '/include/songlist.object.php';
Severity: Minor
Found in class/SongsHandler.php - About 3 hrs to fix

    Consider simplifying this complex logical expression.
    Open

                            if (($c == $strlen_chrs) || ((',' === $chrs[$c]) && (SERVICES_JSON_SLICE == $top['what']))) {
                                // found a comma that is not inside a string, array, etc.,
                                // OR we've reached the end of the character list
                                $slice = mb_substr($chrs, $top['where'], $c - $top['where']);
                                array_push($stk, ['what' => SERVICES_JSON_SLICE, 'where' => $c + 1, 'delim' => false]);
    Severity: Critical
    Found in class/JSON.php - About 3 hrs to fix

      File field.php has 289 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php declare(strict_types=1);
      
      use Xmf\Module\Admin;
      use Xmf\Request;
      use XoopsModules\Songlist\Helper;
      Severity: Minor
      Found in admin/field.php - About 2 hrs to fix

        Method getFormCategory has 73 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function  getFormCategory($object, $as_array = false)
            {
                if (!\is_object($object)) {
                    $handler = Helper::getInstance()
                                     ->getHandler('Category');
        Severity: Major
        Found in class/Form/FormController.php - About 2 hrs to fix

          Function updateBlock has a Cognitive Complexity of 21 (exceeds 5 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): 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 checkVerModule has a Cognitive Complexity of 21 (exceeds 5 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 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(
                  array $bid,
                  array $oldtitle,
                  array $oldside,
                  array $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(\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/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 insert has 71 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function insert(XoopsObject $obj, $force = true, $object = null)
              {
                  if ($obj->isNew()) {
                      $new = true;
                      $old = $this->create();
          Severity: Major
          Found in class/AlbumsHandler.php - About 2 hrs to fix

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

                public function getOutputValue($user, $profile)
                {
                    \xoops_loadLanguage('modinfo', 'objects');
            
                    $value = \in_array($this->getVar('field_name'), $this->getPostVars(), true) ? $user->getVar($this->getVar('field_name')) : $profile->getVar($this->getVar('field_name'));
            Severity: Major
            Found in class/Field.php - About 2 hrs to fix

              Method getFormRequests has 70 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function  getFormRequests($object, $as_array = false)
                  {
                      if (!\is_object($object)) {
                          $handler = Helper::getInstance()
                                           ->getHandler('Requests');
              Severity: Major
              Found in class/Form/FormController.php - About 2 hrs to fix

                File export.php has 283 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php declare(strict_types=1);
                
                use Xmf\Module\Admin;
                use Xmf\Request;
                use XoopsModules\Songlist\Helper;
                Severity: Minor
                Found in admin/export.php - About 2 hrs to fix

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

                      public function toArray($extra = true): array
                      {
                          $ret  = parent::toArray();
                          $form = $this->getForm(true);
                          foreach ($form as $key => $element) {
                  Severity: Minor
                  Found in class/Albums.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 getFormImportb has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function  getFormImportb($file, $as_array = false): string
                      {
                          \xoops_loadLanguage('forms', 'songlist');
                  
                          $sform = new \XoopsThemeForm(\_FRM_SONGLIST_FORM_ISNEW_ELEMENTS, 'elements', $_SERVER['SCRIPT_NAME'], 'post', true);
                  Severity: Major
                  Found in class/Form/FormController.php - About 2 hrs to fix

                    Method getUserSearchForm has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function getUserSearchForm($action = false)
                        {
                            \xoops_loadLanguage('forms', 'songlist');
                    
                            if (!$action) {
                    Severity: Major
                    Found in class/Form/FormController.php - About 2 hrs to fix

                      Method getFormAlbums has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function  getFormAlbums($object, $as_array = false)
                          {
                              if (!\is_object($object)) {
                                  $handler = Helper::getInstance()
                                                   ->getHandler('Albums');
                      Severity: Major
                      Found in class/Form/FormController.php - About 2 hrs to fix

                        Method insert has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function insert(\XoopsObject $obj, $force = true, $object = null)
                            {
                                if ($obj->isNew()) {
                                    $new = true;
                                    $old = $this->create();
                        Severity: Major
                        Found in class/ArtistsHandler.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): string
                              {
                                  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 getFormVotes has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public static function  getFormVotes($object, $as_array = false)
                                {
                                    if (!\is_object($object)) {
                                        $handler = Helper::getInstance()
                                                         ->getHandler('Votes');
                            Severity: Major
                            Found in class/Form/FormController.php - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language