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);}
- Read upRead up
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');
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');
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');
- Read upRead up
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 */
ThemeTabForm
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
class ThemeTabForm extends \XoopsForm
{
public $formTabs = [];
/**
* "action" attribute for the html form
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 = '';
- Read upRead up
- Exclude checks
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 = '';
- Exclude checks
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
- Read upRead up
- Exclude checks
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
- Exclude checks
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',
- Exclude checks
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
*/
- Exclude checks
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';
- Exclude checks
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>';
/**
- Exclude checks
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';
- Exclude checks
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();
- Exclude checks
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
- Exclude checks
The class Metagen has 12 public methods. Consider refactoring Metagen to keep number of public methods under 10. Open
class Metagen
{
/**
* @var Helper
*/
- Read upRead up
- Exclude checks
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
- Read upRead up
- Exclude checks
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>';
/**
- Read upRead up
- Exclude checks
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