Showing 300 of 2,846 total issues
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));
Function sliderAccess
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
sliderAccess: function(options){
options = options || {};
options.touchonly = options.touchonly !== undefined? options.touchonly : true; // by default only show it if touch device
if(options.touchonly === true && !("ontouchend" in document)){
Function notifyVoter
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function notifyVoter(\XoopsUser $user = null): bool
{
if (($user instanceof \XoopsUser) && (Constants::MAIL_POLL_TO_VOTER === $this->getVar('mail_voter'))) {
\xoops_loadLanguage('main', 'xoopspoll');
$xoopsMailer = \xoops_getMailer();
- 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 notifyVoter
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function notifyVoter(\XoopsUser $user = null): bool
{
if (($user instanceof \XoopsUser) && (Constants::MAIL_POLL_TO_VOTER === $this->getVar('mail_voter'))) {
\xoops_loadLanguage('main', 'xoopspoll');
$xoopsMailer = \xoops_getMailer();
Method xoops_module_update_xoopspoll
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
function xoops_module_update_xoopspoll(\XoopsModule $module, $prev_version): bool
{
// referer check
$success = false;
$ref = xoops_getenv('HTTP_REFERER');
Function formatTime
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.datepicker.formatTime = function (format, time, options) {
options = options || {};
options = $.extend({}, $.timepicker._defaults, options);
time = $.extend({
hour: 0,
Method isBlockCloned
has 54 lines of code (exceeds 25 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');
Method getUserbar
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getUserbar()
{
global $xoopsModuleConfig, $xoopsUser, $isadmin;
if (empty($GLOBALS['xoopsModuleConfig']['userbar_enabled'])) {
return null;
Function _updateDateTime
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
_updateDateTime: function (dp_inst) {
dp_inst = this.inst || dp_inst;
var dtTmp = (dp_inst.currentYear > 0?
new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay) :
new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
Method displayAttachment
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function displayAttachment($asSource = false)
{
global $xoopsModule;
/** @var Xoopspoll\Helper $helper */
$helper = Xoopspoll\Helper::getInstance();
Method xoopspoll_search
has 52 lines of code (exceeds 25 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');
Method displayAttachment
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function displayAttachment($asSource = false)
{
$post_attachment = '';
$attachments = $this->getAttachment();
if ($attachments && \is_array($attachments)) {
Method approve
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function approve(&$post, $force = false)
{
if (empty($post)) {
return false;
}