Showing 300 of 2,846 total issues
Method getServerStats
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getServerStats(): string
{
//mb $wfdownloads = WfdownloadsWfdownloads::getInstance();
$moduleDirName = \basename(\dirname(__DIR__, 2));
$moduleDirNameUpper = \mb_strtoupper($moduleDirName);
Function _setDateDatepicker
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.datepicker._setDateDatepicker = function (target, _date) {
var inst = this._getInst(target);
var date = _date;
if (!inst) {
return;
Method loadTableFromArrayWithReplace
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function loadTableFromArrayWithReplace(string $table, array $data, string $search, $replace): int
{
/** @var \XoopsMySQLDatabase $db */
$db = \XoopsDatabaseFactory::getDatabaseConnection();
Method setPostEdit
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setPostEdit($poster_name = '')
{
global $xoopsUser;
/** @var Xoopspoll\Helper $helper */
$helper = Xoopspoll\Helper::getInstance();
Method b_marquee_xoopspoll
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_marquee_xoopspoll($limit, $dateformat, $itemssize)
{
require_once $GLOBALS['xoops']->path('modules/marquee/include/functions.php');
$block = [];
$myts = \MyTextSanitizer::getInstance();
Function looseParse
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
var looseParse = function (f, s, o) {
try {
var d = new Date('2012-01-01 ' + s);
if (isNaN(d.getTime())) {
d = new Date('2012-01-01T' + s);
Method isBlockCloned
has 9 arguments (exceeds 4 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)
Method updateBlock
has 9 arguments (exceeds 4 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)
Method setPostEdit
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setPostEdit($poster_name = '', $post_editmsg = '')
{
if ($this->getVar('approved') < 1
|| empty($GLOBALS['xoopsModuleConfig']['recordedit_timelimit'])
|| (\time() - $this->getVar('post_time')) < $GLOBALS['xoopsModuleConfig']['recordedit_timelimit'] * 60) {
Method setVoteCookie
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function setVoteCookie($index, string $value, int $expires = 0, string $cookieBaseName = 'voted_polls'): bool
{
$pollDir = \basename(\dirname(__DIR__));
$success = false;
// do a little sanity check on $index and $cookieBaseName
Method setVoteCookie
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function setVoteCookie($index, string $value, int $expires = 0, string $cookieBaseName = 'voted_polls'): bool
{
$pollDir = \basename(\dirname(__DIR__));
$success = false;
// do a little sanity check on $index and $cookieBaseName
Function deleteAttachment
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function deleteAttachment($attach_array = null)
{
$attach_old = $this->getAttachment();
if (!\is_array($attach_old) || \count($attach_old) < 1) {
return true;
- 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 deleteAttachment
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function deleteAttachment($attach_array = null)
{
/** @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 isResultVisible
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function isResultVisible()
{
$visibleMsg = '';
\xoops_loadLanguage('main', 'xoopspoll');
switch ($this->getVar('visibility')) {
- 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 _parseTime
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
_parseTime: function (timeString, withDate) {
if (!this.inst) {
this.inst = $.datepicker._getInst(this.$input[0]);
}
Method loadSampleData
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function loadSampleData(): void
{
global $xoopsConfig;
$moduleDirName = \basename(\dirname(__DIR__));
$moduleDirNameUpper = \mb_strtoupper($moduleDirName);
Method displayPostEdit
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function displayPostEdit()
{
global $myts;
if (empty($GLOBALS['xoopsModuleConfig']['recordedit_timelimit'])) {
Method deleteAttachment
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function deleteAttachment($attach_array = null)
{
/** @var Xoopspoll\Helper $helper */
$helper = Xoopspoll\Helper::getInstance();
Function _updateAlternate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.datepicker._updateAlternate = function (inst) {
var tp_inst = this._get(inst, 'timepicker');
if (tp_inst) {
var altField = tp_inst._defaults.altField;
if (altField) { // update alternate field too
Consider simplifying this complex logical expression. Open
if (('add' === $op || 'save' === $op || 'update' === $op)
&& !$topic_obj->getVar('topic_haspoll')
&& ($GLOBALS['xoopsUser'] instanceof \XoopsUser)
&& ($GLOBALS['xoopsUser']->getVar('uid') === $topic_obj->getVar('topic_poster'))) {
$perm = true;