mambax7/publisher

View on GitHub

Showing 355 of 3,032 total issues

Method publisher_latest_news_show has 195 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function publisher_latest_news_show($options)
{
    $block = [];

    $configurator = new Configurator();
Severity: Major
Found in blocks/latest_news.php - About 7 hrs to fix

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

        public function getItemRating($itemId = 0, $source = 0)
        {
            $helper = \XoopsModules\Publisher\Helper::getInstance();
    
            $itemRating               = [];
    Severity: Minor
    Found in class/RatingsHandler.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

    File ItemHandler.php has 479 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php declare(strict_types=1);
    
    namespace XoopsModules\Publisher;
    
    /*
    Severity: Minor
    Found in class/ItemHandler.php - About 7 hrs to fix

      File modinfo.php has 477 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php declare(strict_types=1);
      
      define('_MI_PUBLISHER_ADMENU1', 'Summary');
      define('_MI_PUBLISHER_ADMENU2', 'Categories');
      define('_MI_PUBLISHER_ADMENU3', 'Articles');
      Severity: Minor
      Found in language/english/modinfo.php - About 7 hrs to fix

        Function getItemRating has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getItemRating($itemId = null, $source = null): array
            {
                $itemId    = $itemId ?? 0;
                $source    = $source ?? 0;
                $xoopsUser = $GLOBALS['xoopsUser'];
        Severity: Minor
        Found in class/VoteHandler.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

        Item has 49 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Item extends \XoopsObject
        {
            public const PAGEWRAP = '[pagewrap=';
            public const BODYTAG  = '<body>';
            /**
        Severity: Minor
        Found in class/Item.php - About 6 hrs to fix

          Method search has 162 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function search($icons): void
              {
                  $helper = Helper::getInstance();
                  /** @var MimetypeHandler $mimetypeHandler */
                  $mimetypeHandler = $helper->getHandler('Mimetype');
          Severity: Major
          Found in class/MimetypesUtility.php - About 6 hrs to fix

            Method createElements has 162 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function createElements(): void
                {
                    // require_once  \dirname(__DIR__, 2) . '/include/common.php';
                    // Category
                    $criteria = new \Criteria(null);
            Severity: Major
            Found in class/Form/CategoryForm.php - About 6 hrs to fix

              File item.php has 432 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php declare(strict_types=1);
              /*
               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 admin/item.php - About 6 hrs to fix

                Utility has 46 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class Utility extends Common\SysUtility
                {
                    //--------------- Custom module methods -----------------------------
                    /**
                     * Function responsible for checking if a directory exists, we can also write in and create an index.html file
                Severity: Minor
                Found in class/Utility.php - About 6 hrs to fix

                  Method getItemRating5 has 152 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getItemRating5($itemObj = null, $source = null): array
                      {
                          $itemId    = $itemObj->itemid();
                          $source    = $source ?? 0;
                          $xoopsUser = $GLOBALS['xoopsUser'];
                  Severity: Major
                  Found in class/VoteHandler.php - About 6 hrs to fix

                    File jquery.popeye-2.1.js has 409 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    /*
                     * jQuery Popeye 2.1 - http://dev.herr-schuessler.de/jquery/popeye/
                     *
                     * converts a HTML image list in image gallery with inline enlargement
                     *
                    Severity: Minor
                    Found in assets/js/jquery.popeye-2.1.js - About 5 hrs to fix

                      Function __construct has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function __construct()
                          {
                              global $allowedSites;
                              $this->startTime = microtime(true);
                              date_default_timezone_set('UTC');
                      Severity: Minor
                      Found in thumb.php - About 5 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 getItemRating has 138 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function getItemRating($itemId = null, $source = null): array
                          {
                              $itemId    = $itemId ?? 0;
                              $source    = $source ?? 0;
                              $xoopsUser = $GLOBALS['xoopsUser'];
                      Severity: Major
                      Found in class/VoteHandler.php - About 5 hrs to fix

                        Method publisher_items_spot_show has 137 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function publisher_items_spot_show($options)
                        {
                            //    global $xoTheme;
                            $helper = Helper::getInstance();
                            /** @var CategoryHandler $categoryHandler */
                        Severity: Major
                        Found in blocks/items_spot.php - About 5 hrs to fix

                          Method publisher_latest_news_edit has 133 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function publisher_latest_news_edit($options)
                          {
                              $tabletag1 = '<tr><td style="padding:3px;" width="37%">';
                              $tabletag2 = '</td><td style="padding:3px;">';
                              $tabletag3 = '<tr><td style="padding-top:20px;border-bottom:1px solid #000;" colspan="2">';
                          Severity: Major
                          Found in blocks/latest_news.php - About 5 hrs to fix

                            Function getElementsBySelector has 131 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            document.getElementsBySelector = function (selector) {
                                // Attempt to fail gracefully in lesser browsers
                                if (!document.getElementsByTagName) {
                                    return new Array();
                                }
                            Severity: Major
                            Found in assets/js/behavior.js - About 5 hrs to fix

                              Method getItemRating has 128 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function getItemRating($itemId = 0, $source = 0)
                                  {
                                      $helper = \XoopsModules\Publisher\Helper::getInstance();
                              
                                      $itemRating               = [];
                              Severity: Major
                              Found in class/RatingsHandler.php - About 5 hrs to fix

                                File latest_news.php has 375 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                <?php declare(strict_types=1);
                                /*
                                 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 blocks/latest_news.php - About 5 hrs to fix

                                  Method manage has 124 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public static function manage($icons): void
                                      {
                                          $helper  = Helper::getInstance();
                                          $utility = new Utility();
                                          /** @var MimetypeHandler $mimetypeHandler */
                                  Severity: Major
                                  Found in class/MimetypesUtility.php - About 4 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language