Showing 236 of 310 total issues
Method news_CreateMetaDatas
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
function news_CreateMetaDatas($story = null): void
{
global $xoopsConfig, $xoTheme, $xoopsTpl;
$content = '';
$myts = \MyTextSanitizer::getInstance();
Method truncateHtml
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
{
if ($considerHtml) {
// if the plain text is shorter than the maximum length, return the whole text
if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) {
Method newSubmissions
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
function newSubmissions(): void
{
global $dateformat, $pathIcon16;
$start = Request::getInt('startnew', 0, 'GET');
$newsubcount = NewsStory::getAllStoriesCount(3, false);
Method b_news_archives_edit
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_news_archives_edit($options)
{
global $xoopsDB;
$syear = $smonth = $eyear = $emonth = $older = $recent = 0;
$selsyear = $selsmonth = $seleyear = $selemonth = 0;
Method createMetaDatas
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function createMetaDatas($story = null): void
{
global $xoopsConfig, $xoTheme, $xoopsTpl;
$content = '';
$myts = MyTextSanitizer::getInstance();
Function b_news_topicsnav_show
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function b_news_topicsnav_show($options)
{
/** @var Helper $helper */
if (!class_exists(Helper::class)) {
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 deleteDirectory
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public static function deleteDirectory($src)
{
// 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
Function getBigStory
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function getBigStory(
$limit = 0,
$start = 0,
$checkRight = false,
$topic = 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
XoopsTopic
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class XoopsTopic
{
public $db;
public $table;
public $topic_id;
Files
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class Files
{
public $db;
public $table;
public $fileid;
Method news_getWysiwygForm
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
function news_getWysiwygForm($caption, $name, $value = '', $width = '100%', $height = '400px', $supplemental = '')
{
$editor_option = \mb_strtolower(news_getmoduleoption('form_options'));
$editor = false;
$editor_configs = [];
Method getMetagen
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getMetagen(): void
{
require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
global $xoopsModule, $xoopsConfig, $cfg;
$helper = Helper::getInstance();
Method b_news_randomnews_show
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_news_randomnews_show($options)
{
/** @var Helper $helper */
if (!class_exists(Helper::class)) {
return false;
Method getWysiwygForm
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getWysiwygForm($caption, $name, $value = '', $width = '100%', $height = '400px', $supplemental = '')
{
$editor_option = \mb_strtolower(static::getModuleOption('form_options'));
$editor = false;
$editor_configs = [];
Method getRandomNews
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getRandomNews(
$limit = 0,
$start = 0,
$checkRight = false,
$topic = 0,
Method getAllPublished
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getAllPublished(
$limit = 0,
$start = 0,
$checkRight = false,
$topic = 0,
Function render
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function render(?array $block = null): void
{
\xoops_load('XoopsFormLoader');
\xoops_loadLanguage('common', $this->moduleDirNameUpper);
- 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 launchNewsletter
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function launchNewsletter(): void
{
global $xoopsConfig, $dateformat;
xoops_cp_header();
$adminObject = Admin::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_news
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
function xoops_module_update_news(\XoopsModule $module, $previousVersion = null)
{
$moduleDirName = \basename(\dirname(__DIR__));
$moduleDirNameUpper = \mb_strtoupper($moduleDirName);
Method expStories
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
function expStories(): void
{
global $dateformat, $pathIcon16;
$start = Request::getInt('startexp', 0, 'GET');
$expiredcount = NewsStory::getAllStoriesCount(1, false);