Showing 300 of 2,846 total issues
Method xoopspollBlockMultiEdit
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function xoopspollBlockMultiEdit(mixed $options): string
{
/**
* Options[]
* [0] 0|1 = show as option|select
Method approve
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function approve(&$post, $force = false)
{
if (empty($post)) {
return false;
}
Method mailResults
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function mailResults(mixed $pollObj = null): array
{
$criteria = new \CriteriaCompo();
$criteria->add(new \Criteria('end_time', \time(), '<')); // expired polls
$criteria->add(new \Criteria('mail_status', Constants::POLL_NOT_MAILED, '=')); // email not previously sent
Method getFormFeedback
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFormFeedback($action = false): XoopsThemeForm
{
if (!$action) {
$action = $_SERVER['REQUEST_URI'];
}
Function approve
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function approve(&$post, $force = false)
{
if (empty($post)) {
return false;
}
- 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 orderBlock
has 14 arguments (exceeds 4 allowed). Consider refactoring. Open
array $bid,
array $oldtitle,
array $oldside,
array $oldweight,
array $oldvisible,
Function displayPostEdit
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function displayPostEdit()
{
global $myts;
if (empty($GLOBALS['xoopsModuleConfig']['recordedit_timelimit'])) {
- 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 updateBlock
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateBlock(int $bid, string $btitle, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups)
{
$myblock = new \XoopsBlock($bid);
$myblock->setVar('title', $btitle);
$myblock->setVar('weight', $bweight);
Method renderOptionFormTray
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function renderOptionFormTray(int $pid = 0): \XoopsFormElementTray
{
\xoops_load('xoopsformloader');
$pid = (int)$pid;
$barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path('modules/xoopspoll/assets/images/colorbars/'));
Method checkVerModule
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function checkVerModule(\Xmf\Module\Helper $helper, ?string $source = 'github', ?string $default = 'master'): ?array
{
$moduleDirName = \basename(\dirname(__DIR__, 2));
$moduleDirNameUpper = \mb_strtoupper($moduleDirName);
$update = '';
Function getPostBody
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function &getPostBody()
{
global $xoopsConfig, $xoopsUser, $myts;
/** @var Xoopspoll\Helper $helper */
$helper = Xoopspoll\Helper::getInstance();
- 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
Function approve
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function approve(&$post, $force = false)
{
if (empty($post)) {
return false;
}
- 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
Function handleActions
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function handleActions(BlockData $blockData)
{
$moduleDirNameUpper = \mb_strtoupper(Helper::getInstance()->getDirname());
$bid = Request::getInt('bid', 0);
- 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
Function getPostBody
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function &getPostBody()
{
global $myts;
$GLOBALS['xoopsModuleConfig'] = newbb_load_config(); // irmtfan load all newbb configs - newbb config in blocks activated in some modules like profile
// mod_loadFunctions('user', 'newbb');
- 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
Function isBlockCloned
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function isBlockCloned(int $bid, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups, bool $redirect = true)
{
\xoops_loadLanguage('admin', 'system');
\xoops_loadLanguage('admin/blocksadmin', 'system');
\xoops_loadLanguage('admin/groups', 'system');
- 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
Function loadTableFromArrayWithReplace
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function loadTableFromArrayWithReplace(string $table, array $data, string $search, $replace): int
{
/** @var \XoopsMySQLDatabase $db */
$db = \XoopsDatabaseFactory::getDatabaseConnection();
- 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 handleActions
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handleActions(BlockData $blockData)
{
$moduleDirNameUpper = \mb_strtoupper(Helper::getInstance()->getDirname());
$bid = Request::getInt('bid', 0);
Method cloneBlock
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function cloneBlock(int $bid)
{
//require __DIR__ . '/admin_header.php';
// \xoops_cp_header();
The class BlockData has 27 fields. Consider redesigning BlockData to keep the number of fields under 15. Open
class BlockData
{
public $bid;
public $op;
public $ok;
- Read upRead up
- Exclude checks
TooManyFields
Since: 0.1
Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.
Example
class Person {
protected $one;
private $two;
private $three;
[... many more fields ...]
}
Source https://phpmd.org/rules/codesize.html#toomanyfields
The class Post has 23 fields. Consider redesigning Post to keep the number of fields under 15. Open
class Post extends \XoopsObject
{
private $post_id;
private $topic_id;
private $forum_id;
- Read upRead up
- Exclude checks
TooManyFields
Since: 0.1
Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.
Example
class Person {
protected $one;
private $two;
private $three;
[... many more fields ...]
}