mambax7/publisher

View on GitHub

Showing 3,032 of 3,032 total issues

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

    public function setVarsFromRequest(): void
    {
        //Required fields
        //        if (!empty($categoryid = Request::getInt('categoryid', 0, 'POST'))) {
        //            $this->setVar('categoryid', $categoryid);}
Severity: Minor
Found in class/Item.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

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

    public function __construct()
    {
        global $allowedSites;
        $this->startTime = microtime(true);
        date_default_timezone_set('UTC');
Severity: Major
Found in thumb.php - About 3 hrs to fix

    Method publisher_items_recent_show has 86 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function publisher_items_recent_show($options)
    {
        $helper = Helper::getInstance();
        /** @var ItemHandler $itemHandler */
        $itemHandler = $helper->getHandler('Item');
    Severity: Major
    Found in blocks/items_recent.php - About 3 hrs to fix

      Function edit has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function edit(): void
          {
              $helper = Helper::getInstance();
              /** @var MimetypeHandler $mimetypeHandler */
              $mimetypeHandler = $helper->getHandler('Mimetype');
      Severity: Minor
      Found in class/MimetypesUtility.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

      Method publisher_items_columns_show has 85 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        ThemeTabForm has 28 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class ThemeTabForm extends \XoopsForm
        {
            public $formTabs = [];
            /**
             * "action" attribute for the html form
        Severity: Minor
        Found in class/Form/ThemeTabForm.php - About 3 hrs to fix

          The class Timthumb has 28 non-getter- and setter-methods. Consider refactoring Timthumb to keep number of methods under 25.
          Open

          class Timthumb
          {
              protected        $src                      = '';
              protected        $is404                    = false;
              protected        $docRoot                  = '';
          Severity: Minor
          Found in thumb.php by phpmd

          TooManyMethods

          Since: 0.1

          A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

          By default it ignores methods starting with 'get' or 'set'.

          The default was changed from 10 to 25 in PHPMD 2.3.

          Example

          Source https://phpmd.org/rules/codesize.html#toomanymethods

          The class Timthumb has an overall complexity of 243 which is very high. The configured complexity threshold is 50.
          Open

          class Timthumb
          {
              protected        $src                      = '';
              protected        $is404                    = false;
              protected        $docRoot                  = '';
          Severity: Minor
          Found in thumb.php by phpmd

          The class SysUtility has 13 public methods. Consider refactoring SysUtility to keep number of public methods under 10.
          Open

          class SysUtility
          {
              //traits
              use VersionChecks; //checkVerXoops, checkVerPhp Traits
              use ServerStats; // getServerStats Trait
          Severity: Minor
          Found in class/Common/SysUtility.php by phpmd

          TooManyPublicMethods

          Since: 0.1

          A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

          By default it ignores methods starting with 'get' or 'set'.

          Example

          Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

          The class SysUtility has an overall complexity of 55 which is very high. The configured complexity threshold is 50.
          Open

          class SysUtility
          {
              //traits
              use VersionChecks; //checkVerXoops, checkVerPhp Traits
              use ServerStats; // getServerStats Trait
          Severity: Minor
          Found in class/Common/SysUtility.php by phpmd

          The class ItemForm has an overall complexity of 76 which is very high. The configured complexity threshold is 50.
          Open

          class ItemForm extends ThemeTabForm
          {
              public $checkperm = true;
              public $tabs      = [
                  \_CO_PUBLISHER_TAB_MAIN   => 'mainTab',
          Severity: Minor
          Found in class/Form/ItemForm.php by phpmd

          The class Blocksadmin has an overall complexity of 80 which is very high. The configured complexity threshold is 50.
          Open

          class Blocksadmin
          {
              /**
               * @var \XoopsMySQLDatabase|null
               */
          Severity: Minor
          Found in class/Common/Blocksadmin.php by phpmd

          The class CategoryHandler has an overall complexity of 58 which is very high. The configured complexity threshold is 50.
          Open

          class CategoryHandler extends \XoopsPersistableObjectHandler
          {
              private const TABLE      = 'publisher_categories';
              private const ENTITY     = Category::class;
              private const ENTITYNAME = 'Category';
          Severity: Minor
          Found in class/CategoryHandler.php by phpmd

          The class Item has an overall complexity of 171 which is very high. The configured complexity threshold is 50.
          Open

          class Item extends \XoopsObject
          {
              public const PAGEWRAP = '[pagewrap=';
              public const BODYTAG  = '<body>';
              /**
          Severity: Minor
          Found in class/Item.php by phpmd

          The class ItemHandler has an overall complexity of 132 which is very high. The configured complexity threshold is 50.
          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 by phpmd

          The class MimetypesUtility has an overall complexity of 80 which is very high. The configured complexity threshold is 50.
          Open

          class MimetypesUtility
          {
              public static function add(): void
              {
                  $helper = Helper::getInstance();
          Severity: Minor
          Found in class/MimetypesUtility.php by phpmd

          The class ThemeTabForm has an overall complexity of 73 which is very high. The configured complexity threshold is 50.
          Open

          class ThemeTabForm extends \XoopsForm
          {
              public $formTabs = [];
              /**
               * "action" attribute for the html form
          Severity: Minor
          Found in class/Form/ThemeTabForm.php by phpmd

          The class Metagen has 12 public methods. Consider refactoring Metagen to keep number of public methods under 10.
          Open

          class Metagen
          {
              /**
               * @var Helper
               */
          Severity: Minor
          Found in class/Metagen.php by phpmd

          TooManyPublicMethods

          Since: 0.1

          A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

          By default it ignores methods starting with 'get' or 'set'.

          Example

          Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

          The class ThemeTabForm has 11 public methods. Consider refactoring ThemeTabForm to keep number of public methods under 10.
          Open

          class ThemeTabForm extends \XoopsForm
          {
              public $formTabs = [];
              /**
               * "action" attribute for the html form
          Severity: Minor
          Found in class/Form/ThemeTabForm.php by phpmd

          TooManyPublicMethods

          Since: 0.1

          A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

          By default it ignores methods starting with 'get' or 'set'.

          Example

          Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

          The class Item has 18 public methods. Consider refactoring Item to keep number of public methods under 10.
          Open

          class Item extends \XoopsObject
          {
              public const PAGEWRAP = '[pagewrap=';
              public const BODYTAG  = '<body>';
              /**
          Severity: Minor
          Found in class/Item.php by phpmd

          TooManyPublicMethods

          Since: 0.1

          A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

          By default it ignores methods starting with 'get' or 'set'.

          Example

          Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

          Severity
          Category
          Status
          Source
          Language