mambax7/publisher

View on GitHub

Showing 355 of 3,032 total issues

ItemHandler has 25 functions (exceeds 20 allowed). Consider refactoring.
Open

class ItemHandler extends \XoopsPersistableObjectHandler
{
    private const TABLE      = 'publisher_items';
    private const ENTITY     = Item::class;
    private const ENTITYNAME = 'Item';
Severity: Minor
Found in class/ItemHandler.php - About 2 hrs to fix

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

    function publisher_editItem($showmenu = false, $itemId = 0, $clone = false): void
    {
        $helper = Helper::getInstance();
        global $publisherCurrentPage;
    
    
    Severity: Minor
    Found in admin/item.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 publisher_items_spot_edit has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function publisher_items_spot_edit($options)
    {
        // require_once PUBLISHER_ROOT_PATH . '/class/blockform.php';
        xoops_load('XoopsFormLoader');
        $form     = new BlockForm();
    Severity: Major
    Found in blocks/items_spot.php - About 2 hrs to fix

      File Metagen.php has 280 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

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

        File xnews.php has 279 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/import/xnews.php - About 2 hrs to fix

          File script.easing.js has 279 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // JavaScript Document
          /*! Copyright (c) 2009 Brandon Aaron (http://brandonaaron.net)
           * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
           * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
           * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
          Severity: Minor
          Found in assets/js/script.easing.js - About 2 hrs to fix

            File SysUtility.php has 279 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

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

              File ams.php has 275 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/import/ams.php - About 2 hrs to fix

                Function addSrcToDestList has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                function addSrcToDestList() {
                    destList = window.document.forms[0].destList;
                    srcList = window.document.forms[0].srcList;
                    var len = destList.length;
                    for (var i = 0; i < srcList.length; i++) {
                Severity: Minor
                Found in assets/js/funcs.js - 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 getAllFiles has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getAllFiles($itemId = 0, $status = -1, $limit = 0, $start = 0, $sort = 'datesub', $order = 'DESC', $category = [])
                    {
                        $files = [];
                
                        $this->table_link = $this->db->prefix($this->helper->getDirname() . '_items');
                Severity: Minor
                Found in class/FileHandler.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 resizeImage has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function resizeImage()
                    {
                        // check file extension
                        switch ($this->imageMimetype) {
                            case 'image/png':
                Severity: Minor
                Found in class/Resizer.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 getObjects has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function &getObjects(\CriteriaElement $criteria = null, $idKey = 'none', $as_object = true, $notNullFields = null)
                    {
                        $limit         = $start = 0;
                        $ret           = [];
                        $notNullFields = (null !== $notNullFields) ?: '';
                Severity: Minor
                Found in class/ItemHandler.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

                File fmcontent.php has 274 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/import/fmcontent.php - About 2 hrs to fix

                  File CategoryHandler.php has 272 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

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

                    Function showThumb has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                function showThumb(i, transition) {
                    
                                    // optional parameters
                                    transition = transition || false;
                                    i = i || cur;
                    Severity: Major
                    Found in assets/js/jquery.popeye-2.1.js - About 2 hrs to fix

                      Method truncateHtml has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function truncateHtml(
                              string $text,
                              ?int $length = 100,
                              string $ending = '...',
                              bool $exact = false,
                      Severity: Major
                      Found in class/Common/SysUtility.php - About 2 hrs to fix

                        Method generateSeoTitle has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function generateSeoTitle($title = '', $withExt = true)
                            {
                                // Transformation de la chaine en minuscule
                                // Codage de la chaine afin d'éviter les erreurs 500 en cas de caractères imprévus
                                $title = \rawurlencode(\mb_strtolower($title));
                        Severity: Major
                        Found in class/Metagen.php - About 2 hrs to fix

                          Method ratingBar has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public static function ratingBar($itemId)
                              {
                                  $helper          = Helper::getInstance();
                                  $ratingUnitWidth = 30;
                                  $units           = 5;
                          Severity: Major
                          Found in class/Utility.php - About 2 hrs to fix

                            Function add has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public static function add(): void
                                {
                                    $helper = Helper::getInstance();
                                    /** @var MimetypeHandler $mimetypeHandler */
                                    $mimetypeHandler = $helper->getHandler('Mimetype');
                            Severity: Minor
                            Found in class/MimetypesUtility.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 deleteDirectory has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public static function deleteDirectory($src)
                                {
                                    // Only continue if user is a 'global' Admin
                                    if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                                        return false;
                            Severity: Minor
                            Found in class/Common/FilesManagement.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

                            Severity
                            Category
                            Status
                            Source
                            Language