mambax7/songlist

View on GitHub

Showing 264 of 3,642 total issues

Function insert has a Cognitive Complexity of 170 (exceeds 5 allowed). Consider refactoring.
Open

    public function insert(\XoopsObject $obj, $force = true, $object = null)
    {
        if ($obj->isNew()) {
            $new = true;
            $old = $this->create();
Severity: Minor
Found in class/SongsHandler.php - About 3 days 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 FormController.php has 1053 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php declare(strict_types=1);

namespace XoopsModules\Songlist\Form;


Severity: Major
Found in class/Form/FormController.php - About 2 days to fix

    Function decode has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
    Open

        public function decode($str)
        {
            $str = $this->reduce_string($str);
    
            switch (mb_strtolower($str)) {
    Severity: Minor
    Found in class/JSON.php - About 1 day 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 xml2array has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function xml2array($contents, $get_attributes = 1, $priority = 'tag')
        {
            if (!$contents) {
                return [];
            }
    Severity: Minor
    Found in class/Utility.php - About 1 day 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 Utility.php has 609 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php declare(strict_types=1);
    
    namespace XoopsModules\Songlist;
    
    use Xmf\Request;
    Severity: Major
    Found in class/Utility.php - About 1 day to fix

      Function insert has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
      Open

          public function insert(XoopsObject $obj, $force = true, $object = null)
          {
              if ($obj->isNew()) {
                  $new = true;
                  $old = $this->create();
      Severity: Minor
      Found in class/AlbumsHandler.php - About 1 day 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 Blocksadmin.php has 591 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php declare(strict_types=1);
      
      namespace XoopsModules\Songlist\Common;
      
      /**
      Severity: Major
      Found in class/Common/Blocksadmin.php - About 1 day to fix

        File import.php has 563 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: Major
        Found in admin/import.php - About 1 day to fix

          Function getFormSongs has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function  getFormSongs($object, $as_array = false)
              {
                  if (!\is_object($object)) {
                      $handler = Helper::getInstance()
                                       ->getHandler('Songs');
          Severity: Minor
          Found in class/Form/FormController.php - About 1 day 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 listBlocks has 219 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function listBlocks(): void
              {
                  global $xoopsModule, $pathIcon16;
                  require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
                  //        xoops_loadLanguage('admin', 'system');
          Severity: Major
          Found in class/Common/Blocksadmin.php - About 1 day to fix

            Function truncateHtml has a Cognitive Complexity of 53 (exceeds 5 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: Minor
            Found in class/Common/SysUtility.php - About 1 day 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 insert has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
            Open

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

                public static function getFieldForm($field, $action = false)
                {
                    if (false === $action) {
                        $action = $_SERVER['SCRIPT_NAME'];
                    }
            Severity: Major
            Found in class/Form/FormController.php - About 7 hrs to fix

              Function getFieldForm has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function getFieldForm($field, $action = false)
                  {
                      if (false === $action) {
                          $action = $_SERVER['SCRIPT_NAME'];
                      }
              Severity: Minor
              Found in class/Form/FormController.php - About 7 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 getFilterElement has 178 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function getFilterElement($filter, $field, $sort = 'created', $op = '', $fct = '')
                  {
                      $components = static::getFilterURLComponents($filter, $field, $sort);
                      $ele        = false;
                      require_once \dirname(__DIR__) . '/include/songlist.object.php';
              Severity: Major
              Found in class/Utility.php - About 7 hrs to fix

                Function insert has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function insert(\XoopsObject $obj, $force = true)
                    {
                        if ($obj->isNew()) {
                            $obj->setVar('created', \time());
                            $new      = true;
                Severity: Minor
                Found in class/RequestsHandler.php - About 7 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 177 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/SongsHandler.php - About 7 hrs to fix

                  Method decode has 174 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function decode($str)
                      {
                          $str = $this->reduce_string($str);
                  
                          switch (mb_strtolower($str)) {
                  Severity: Major
                  Found in class/JSON.php - About 6 hrs to fix

                    File xoops_version.php has 451 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php declare(strict_types=1);
                    
                    require_once __DIR__ . '/preloads/autoloader.php';
                    
                    error_reporting(E_ALL);
                    Severity: Minor
                    Found in xoops_version.php - About 6 hrs to fix

                      Function _encode has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function _encode($var)
                          {
                              switch (gettype($var)) {
                                  case 'boolean':
                                      return $var ? 'true' : 'false';
                      Severity: Minor
                      Found in class/JSON.php - About 6 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

                      Severity
                      Category
                      Status
                      Source
                      Language