Showing 40 of 48 total issues
Function truncateHtml
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
public static function truncateHtml(
string $text,
?int $length = null,
string $ending = '...',
bool $exact = 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 xoops_module_update_xoopsfaq
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
function xoops_module_update_xoopsfaq(XoopsModule $module, string $prev_version)
{
$moduleDirName = $module->getVar('dirname');
$helper = Helper::getInstance();
// if (!class_exists('Xoopsfaq\Utility')) {
- 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 renderAdminListing
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function renderAdminListing($sort = null): string
{
$sort ??= 'id';
// if (!\class_exists('Xoopsfaq\Utility')) {
// \xoops_load('utility', \basename(\dirname(__DIR__)));
Method renderForm
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function renderForm()
{
/** @var CategoryHandler $categoryHandler */
/** @var Helper $helper */
$helper = Helper::getHelper($this->dirname);
Function checkVerModule
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public static function checkVerModule(Helper $helper, ?string $source = null, ?string $default = null): ?array
{
$source ??= 'github';
$default ??= 'master';
$moduleDirName = \basename(\dirname(__DIR__, 2));
- 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 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function truncateHtml(
string $text,
?int $length = null,
string $ending = '...',
bool $exact = false,
File SysUtility.php
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php declare(strict_types=1);
namespace XoopsModules\Xoopsfaq\Common;
/*
Function deleteDirectory
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
final 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 xoopsfaq_search
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
function xoopsfaq_search($queryarray, $andor, $limit, $offset, $userid)
{
$ret = [];
if (0 != $userid) {
return $ret;
Method xoopsfaq_search
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
function xoopsfaq_search($queryarray, $andor, $limit, $offset, $userid)
{
$ret = [];
if (0 != $userid) {
return $ret;
Method b_xoopsfaq_recent_show
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_xoopsfaq_recent_show(array $options)
{
$moduleDirName = \basename(\dirname(__DIR__));
$myts = \MyTextSanitizer::getInstance();
Method b_xoopsfaq_random_show
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_xoopsfaq_random_show(array $options)
{
$moduleDirName = \basename(\dirname(__DIR__));
$myts = \MyTextSanitizer::getInstance();
Function b_xoopsfaq_recent_show
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function b_xoopsfaq_recent_show(array $options)
{
$moduleDirName = \basename(\dirname(__DIR__));
$myts = \MyTextSanitizer::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
Method xoops_module_update_xoopsfaq
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function xoops_module_update_xoopsfaq(XoopsModule $module, string $prev_version)
{
$moduleDirName = $module->getVar('dirname');
$helper = Helper::getInstance();
// if (!class_exists('Xoopsfaq\Utility')) {
Method b_xoopsfaq_recent_edit
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_xoopsfaq_recent_edit(array $options)
{
$moduleDirName = \basename(\dirname(__DIR__));
xoops_load('XoopsFormSelect');
Method checkVerModule
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function checkVerModule(Helper $helper, ?string $source = null, ?string $default = null): ?array
{
$source ??= 'github';
$default ??= 'master';
$moduleDirName = \basename(\dirname(__DIR__, 2));
Method b_xoopsfaq_category_show
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_xoopsfaq_category_show(array $options)
{
$moduleDirName = \basename(\dirname(__DIR__));
$myts = \MyTextSanitizer::getInstance();
Method renderAdminListing
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function renderAdminListing(?string $sort = null): string
{
$sort ??= 'id';
// if (!\class_exists('Xoopsfaq\Utility')) {
// \xoops_load('utility', \basename(\dirname(__DIR__)));
Function b_xoopsfaq_category_show
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function b_xoopsfaq_category_show(array $options)
{
$moduleDirName = \basename(\dirname(__DIR__));
$myts = \MyTextSanitizer::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 loadTableFromArrayWithReplace
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function loadTableFromArrayWithReplace(string $table, array $data, string $search, int $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"