Showing 48 of 589 total issues
Function xoops_module_update_xlanguage
has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring. Open
function xoops_module_update_xlanguage(\XoopsModule $module, $previousVersion = null)
{
$moduleDirName = \basename(\dirname(__DIR__));
$utility = new 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
Function truncateHtml
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
{
$open_tags = [];
if ($considerHtml) {
// if the plain text is shorter than the maximum length, return the whole text
- 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 showSelectedLanguage
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
public static function showSelectedLanguage($options = null)
{
require_once XOOPS_ROOT_PATH . '/modules/xlanguage/blocks/xlanguage_blocks.php';
if (empty($options)) {
$options[0] = 'images'; // display style: image, text, select
- 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 languageList
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
function languageList(LanguageHandler $languageHandler)
{
// global $languageHandler, $xoopsModule;
global $pathIcon16;
Function b_xlanguage_select_show
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
function b_xlanguage_select_show($options)
{
global $xlanguage;
$block = [];
- 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 23 (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 languageList
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
function languageList(LanguageHandler $languageHandler)
{
// global $languageHandler, $xoopsModule;
global $pathIcon16;
- 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 LanguageHandler.php
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace XoopsModules\Xlanguage;
/**
Function checkVerModule
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public static function checkVerModule($helper, $source = 'github', $default = 'master')
{
$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 insert
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function insert($lang)
{
$val_array = [];
if (!$lang->isDirty()) {
return true;
Function insert
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function insert($lang)
{
$val_array = [];
if (!$lang->isDirty()) {
return true;
- 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($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
{
$open_tags = [];
if ($considerHtml) {
// if the plain text is shorter than the maximum length, return the whole text
Method b_xlanguage_select_show
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_xlanguage_select_show($options)
{
global $xlanguage;
$block = [];
Method xoops_module_update_xlanguage
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
function xoops_module_update_xlanguage(\XoopsModule $module, $previousVersion = null)
{
$moduleDirName = \basename(\dirname(__DIR__));
$utility = new Utility();
Function cleanMultiLang
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public static function cleanMultiLang($text)
{
global $xoopsConfig;
global $xlanguage_langs;
$patterns = [];
- 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 createConfig
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createConfig()
{
$file_config = \XLANGUAGE_CONFIG_FILE;
if (\is_file($file_config)) {
\unlink($file_config);
Method showSelectedLanguage
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function showSelectedLanguage($options = null)
{
require_once XOOPS_ROOT_PATH . '/modules/xlanguage/blocks/xlanguage_blocks.php';
if (empty($options)) {
$options[0] = 'images'; // display style: image, text, select
Method cleanMultiLang
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function cleanMultiLang($text)
{
global $xoopsConfig;
global $xlanguage_langs;
$patterns = [];
Method checkVerModule
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function checkVerModule($helper, $source = 'github', $default = 'master')
{
$moduleDirName = \basename(\dirname(__DIR__, 2));
$moduleDirNameUpper = mb_strtoupper($moduleDirName);
$update = '';
Function loadTableFromArrayWithReplace
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function loadTableFromArrayWithReplace($table, $data, $search, $replace)
{
/** @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"