Showing 316 of 316 total issues
Method isUtf8
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function isUtf8($Str)
{ # by bmorel at ssi dot fr
for ($i = 0, $iMax = mb_strlen($Str); $i < $iMax; ++$i) {
if (\ord($Str[$i]) < 0x80) {
continue;
Method getSummary
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getSummary()
{
global $xoopsDB;
$summary = [];
Method getServiceLinksNew
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getServiceLinksNew($variable)
{
global $xoopsUser, $xoopsDB, $xoopsModule, $xoopsConfig, $myts;
$helper = Helper::getInstance();
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ($xoopsUser) {
if ($xoopsUser->isAdmin()) {
$srvlinks .= '<a TITLE="'
. _EDIT
. '" href="admin/entry.php?op=mod&entryID='
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 104.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ($xoopsUser) {
if ($xoopsUser->isAdmin()) {
$srvlinks .= '<a title="'
. _EDIT
. '" href="admin/entry.php?op=mod&entryID='
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 104.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method lx_serviceLinksnew
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function lx_serviceLinksnew($variable)
{
global $xoopsUser, $xoopsDB, $xoopsModule, $xoopsModuleConfig, $xoopsConfig, $myts;
$srvlinks2 = '<a title="'
. _MD_LEXIKON_PRINTTERM
Method getServerStats
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getServerStats()
{
//mb $wfdownloads = WfdownloadsWfdownloads::getInstance();
$moduleDirName = \basename(\dirname(__DIR__, 2));
$moduleDirNameUpper = mb_strtoupper($moduleDirName);
Method updateBlock
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
function updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups)
Method FormImport
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function FormImport()
{
global $xoopsConfig, $xoopsDB, $xoopsModule;
//lx_importMenu(9);
echo "<strong style='color: #2F5376; margin-top:6px; font-size:medium'>" . _AM_LEXIKON_IMPORT_GLOSSAIRE . '</strong><br><br>';
Method FormImport
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function FormImport()
{
global $xoopsConfig, $xoopsDB, $xoopsModule;
//lx_importMenu(9);
echo "<strong style='color: #2F5376; margin-top:6px; font-size:medium'>" . _AM_LEXIKON_IMPORT_WIWIMOD . '</strong><br><br>';
Method lx_AuthorProfile
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function lx_AuthorProfile($uid)
{
require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
global $authortermstotal, $xoopsTpl, $xoopsDB, $xoopsUser, $xoopsModuleConfig;
$myts = \MyTextSanitizer::getInstance();
Method FormImport
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function FormImport()
{
global $xoopsConfig, $xoopsDB, $xoopsModule;
//lx_importMenu(9);
echo "<strong style='color: #2F5376; margin-top:6px; font-size:medium'>" . _AM_LEXIKON_IMPORT_WORDBOOK . '</strong><br><br>';
Method FormImport
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function FormImport()
{
global $xoopsConfig, $xoopsDB, $xoopsModule;
//lx_importMenu(9);
echo "<strong style='color: #2F5376; margin-top:6px; font-size:medium'>" . _AM_LEXIKON_IMPORT_DICTIONARY . '</strong><br><br>';
Method lx_showSearchForm
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function lx_showSearchForm()
{
global $xoopsUser, $xoopsDB, $xoopsModule, $xoopsModuleConfig, $xoopsConfig;
/** @var \XoopsGroupPermHandler $grouppermHandler */
$grouppermHandler = xoops_getHandler('groupperm');
Method FormImport
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function FormImport()
{
global $xoopsConfig, $xoopsDB, $xoopsModule;
//lx_importMenu(9);
echo "<strong style='color: #2F5376; margin-top:6px; font-size:medium'>" . _AM_LEXIKON_IMPORT_XWORDS . '</strong><br><br>';
Method getFormFilter
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFormFilter()
{
global $xoopsUser, $xoopsDB, $xoopsModule, $xoopsConfig;
$helper = Helper::getInstance();
Method getFormSearch
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getFormSearch($type = '3', $categoryID = '0', $term = '')
{
global $xoopsUser, $xoopsDB, $xoopsModule, $xoopsConfig;
$helper = Helper::getInstance();
Function check_browser_can_use_spaw
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function check_browser_can_use_spaw()
{
$browser = $_SERVER['HTTP_USER_AGENT'];
// check if msie
if (preg_match('/MSIE[^;]*/i', $browser, $msie)) {
- 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 _loadAllChildItemIds
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function _loadAllChildItemIds($itemId, &$childIds)
{
if (!empty($this->_itemTree[$itemId]['children'])) {
$first_child = $this->_itemTree[$itemId]['children'];
foreach ($first_child as $fcid) {
- 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 b_lxentries_new_edit
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_lxentries_new_edit($options)
{
$form = "<table style='width:100%;' class='bg2'>";
$form .= "<tr><th style='width:50%'>" . _OPTIONS . "</th><th style='width:50%'>" . _MB_LEXIKON_SETTINGS . '</th></tr>';
$form .= "<tr><td class='even'>" . _MB_LEXIKON_ORDER . "</td><td class='odd'>";