Showing 80 of 101 total issues
Function xoops_module_update_rssfit
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
function xoops_module_update_rssfit(\XoopsModule $module, int $previousVersion): bool
{
$moduleDirName = \basename(\dirname(__DIR__));
/** @var Rssfit\Helper $helper */
- 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 truncateHtml
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
public static function truncateHtml(
string $text,
?int $length = 100,
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 getRssFeedAsHtml
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
public static function getRssFeedAsHtml(string $feed_url, int $maxItemCount = 10, bool $show_date = true, bool $show_description = true, int $max_words = 0, int $cache_timeout = 7200, string $cache_prefix = XOOPS_VAR_PATH . '/caches/xoops_cache/rss2html-'): string
{
$result = '';
// get feeds and parse items
$rss = new \DOMDocument();
- 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 getItems
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
public function getItems(array &$feed): void
{
$entries = [];
$db = \XoopsDatabaseFactory::getDatabaseConnection();
if (!empty($feed['plugin'])) {
- 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
File FeedHandler.php
has 352 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace XoopsModules\Rssfit;
Function getChannel
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function getChannel(array &$feed): void
{
$channel = [];
$elements = $this->miscHandler->getObjects2(new \Criteria('misc_category', 'channel'));
if (\is_array($elements) && !empty($elements)) {
- 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 grabEntries
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array
{
$ret = null;
$i = -1;
- 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 checkPlugin
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function checkPlugin(\XoopsObject $object)
{
$ret = null;
$file = \RSSFIT_ROOT_PATH . 'class/Plugins/' . $object->getVar('rssf_filename');
if (\is_file($file)) {
- 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 getRssFeedAsHtml
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getRssFeedAsHtml(string $feed_url, int $maxItemCount = 10, bool $show_date = true, bool $show_description = true, int $max_words = 0, int $cache_timeout = 7200, string $cache_prefix = XOOPS_VAR_PATH . '/caches/xoops_cache/rss2html-'): string
{
$result = '';
// get feeds and parse items
$rss = new \DOMDocument();
Function checkVerModule
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public static function checkVerModule(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
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 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
Function insert
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function insert(\XoopsObject $object, $force = true)
{
if (mb_strtolower(\get_class($object)) != mb_strtolower($this->objClass)) {
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 insert
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function insert(\XoopsObject $object, $force = false)
{
// $force = false;
if (mb_strtolower(\get_class($object)) != mb_strtolower($this->objClass)) {
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 xoops_module_update_rssfit
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
function xoops_module_update_rssfit(\XoopsModule $module, int $previousVersion): bool
{
$moduleDirName = \basename(\dirname(__DIR__));
/** @var Rssfit\Helper $helper */
Function doSubstr
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function doSubstr(string $text): string
{
$ret = $text;
$len = \function_exists('mb_strlen') ? mb_strlen($ret, $this->charset) : mb_strlen($ret);
$maxChars = $this->helper->getConfig('max_char');
- 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
File PluginHandler.php
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace XoopsModules\Rssfit;
Method getChannel
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getChannel(array &$feed): void
{
$channel = [];
$elements = $this->miscHandler->getObjects2(new \Criteria('misc_category', 'channel'));
if (\is_array($elements) && !empty($elements)) {
Function getObjects2
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function getObjects2($criteria = null, string $fields = '*', string $key = ''): ?array
{
$ret = null;
$limit = $start = 0;
switch ($fields) {
- 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 getItems
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getItems(array &$feed): void
{
$entries = [];
$db = \XoopsDatabaseFactory::getDatabaseConnection();
if (!empty($feed['plugin'])) {