Showing 181 of 2,846 total issues
Method insert
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function insert(\XoopsObject $post, $force = true)
{
global $xoopsUser;
// Set the post time
File topicmanager.php
has 309 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.
Function _optionDatepicker
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.datepicker._optionDatepicker = function (target, name, value) {
var inst = this._getInst(target),
name_clone;
if (!inst) {
return null;
File polls.php
has 305 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php declare(strict_types=1);
/*
* Newbb module
*
* You may not change or alter any portion of this comment or credits
Method _delete
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _delete($post, $force = false)
{
global $xoopsModule;
if (!is_object($post) || 0 == $post->getVar('post_id')) {
Function setVoteCookie
has a Cognitive Complexity of 23 (exceeds 5 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
- 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 setVoteCookie
has a Cognitive Complexity of 23 (exceeds 5 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
- 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 renderForm
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function renderForm(string $rtnPage, string $rtnMethod = 'post', array $addHidden = [])
{
\xoops_load('xoopsformloader');
$myts = \MyTextSanitizer::getInstance();
Function Timepicker
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Timepicker = function () {
this.regional = []; // Available regional settings, indexed by language code
this.regional[''] = { // Default regional settings
currentText: 'Now',
closeText: 'Done',
Function xoopspoll_search
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
function xoopspoll_search($queryArray, mixed $andor, mixed $limit, mixed $offset, $uid): array
{
$ret = [];
if (0 === (int)$uid) {
$pollHandler = Helper::getInstance()->getHandler('Poll');
- 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 orderBlock
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function orderBlock(
array $bid,
array $oldtitle,
array $oldside,
array $oldweight,
- 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 updateBlock
has a Cognitive Complexity of 21 (exceeds 5 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);
- 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 checkVerModule
has a Cognitive Complexity of 21 (exceeds 5 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 = '';
- 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 handleRange
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.timepicker.handleRange = function (method, startTime, endTime, options) {
options = $.extend({}, {
minInterval: 0, // min allowed interval in milliseconds
maxInterval: 0, // max allowed interval in milliseconds
start: {}, // options for start picker
Function delete
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function delete($post, $isDeleteOne = true, $force = false)
{
$retVal = false;
if (($post instanceof Post) && ($post->getVar('post_id') > 0)) {
if ($isDeleteOne) {
- 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 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,
Function vote
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function vote(int $optionId, string $ip, int $time): bool
{
if (!empty($optionId) && $this->isAllowedToVote()) {
$voteTime = empty($time) ? \time() : (int)$time;
$uid = ($GLOBALS['xoopsUser'] instanceof \XoopsUser) ? $GLOBALS['xoopsUser']->uid() : 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 displayAttachment
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function displayAttachment($asSource = false)
{
$post_attachment = '';
$attachments = $this->getAttachment();
if ($attachments && \is_array($attachments)) {
- 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 deleteDirectory
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public static function deleteDirectory(string $src): bool
{
// Only continue if user is a 'global' Admin
if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
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 assignResults
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function assignResults(\XoopsTpl $tpl): void
{
$myts = \MyTextSanitizer::getInstance();
$xuEndTimestamp = \xoops_getUserTimestamp($this->pollObj->getVar('end_time'));
$xuEndFormatted = \ucfirst(\date(_MEDIUMDATESTRING, (int)$xuEndTimestamp));