Showing 3,642 of 3,642 total issues
Similar blocks of code found in 6 locations. Consider refactoring. Open
case 'abid':
if ('albums' !== $op) {
$ele = new SelectAlbumForm('', 'filter_' . $field . '', $components['value'], 1, false);
$ele->setExtra(
'onchange="window.open(\''
- 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 156.
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 6 locations. Consider refactoring. Open
case 'vcid':
if ('voice' !== $op) {
$ele = new SelectVoiceForm('', 'filter_' . $field . '', $components['value'], 1, false);
$ele->setExtra(
'onchange="window.open(\''
- 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 156.
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
File permissions.php
has 319 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php declare(strict_types=1);
/*
* You may not change or alter any portion of this comment or credits
* of supporting developers from this source code or any supporting source code
* which is considered copyrighted (c) material of the original comment or credit authors.
Function xoops_module_update_songlist
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
function xoops_module_update_songlist(\XoopsModule $module, $previousVersion = null): bool
{
$moduleDirName = \basename(\dirname(__DIR__));
$moduleDirNameUpper = \mb_strtoupper($moduleDirName);
- 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 toArray
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public function toArray($extra = false): array
{
$ret = parent::toArray();
$form = $this->getForm(true);
foreach ($form as $key => $element) {
- 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 SongsHandler.php
has 307 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php declare(strict_types=1);
namespace XoopsModules\Songlist;
require_once \dirname(__DIR__) . '/include/songlist.object.php';
The class AlbumsHandler has an overall complexity of 56 which is very high. The configured complexity threshold is 50. Open
class AlbumsHandler extends XoopsPersistableObjectHandler
{
/**
* AlbumsHandler constructor.
* @param \XoopsDatabase $db
- Exclude checks
The class ArtistsHandler has an overall complexity of 55 which is very high. The configured complexity threshold is 50. Open
class ArtistsHandler extends \XoopsPersistableObjectHandler
{
/**
* ArtistsHandler constructor.
* @param \XoopsDatabase $db
- Exclude checks
The class Blocksadmin has an overall complexity of 81 which is very high. The configured complexity threshold is 50. Open
class Blocksadmin
{
/**
* @var \XoopsMySQLDatabase|null
*/
- Exclude checks
The class FormController has an overall complexity of 376 which is very high. The configured complexity threshold is 50. Open
class FormController
{
/**
* Get {@link XoopsThemeForm} for adding/editing fields
*
- Exclude checks
The class Field has an overall complexity of 141 which is very high. The configured complexity threshold is 50. Open
class Field extends \XoopsObject
{
public $field_id;
public $cids;
public $field_type;
- Exclude checks
The class FieldHandler has an overall complexity of 58 which is very high. The configured complexity threshold is 50. Open
class FieldHandler extends \XoopsPersistableObjectHandler
{
/**
* FieldHandler constructor.
* @param \XoopsDatabase $db
- Exclude checks
The class ServicesJSON has an overall complexity of 129 which is very high. The configured complexity threshold is 50. Open
class ServicesJSON
{
/**
* constructs a new JSON instance
*
- Exclude checks
The class SongsHandler has an overall complexity of 97 which is very high. The configured complexity threshold is 50. Open
class SongsHandler extends \XoopsPersistableObjectHandler
{
/**
* SongsHandler constructor.
* @param \XoopsDatabase $db
- Exclude checks
The class Uploader has an overall complexity of 65 which is very high. The configured complexity threshold is 50. Open
class Uploader
{
public $mediaName;
public $mediaType;
public $mediaSize;
- Exclude checks
The class Utility has an overall complexity of 149 which is very high. The configured complexity threshold is 50. Open
class Utility extends Common\SysUtility
{
//--------------- Custom module methods -----------------------------
/**
* Function responsible for checking if a directory exists, we can also write in and create an index.html file
- Exclude checks
Identical blocks of code found in 2 locations. Consider refactoring. Open
case 'actiona':
if (Request::hasVar('xmlfile', 'SESSION')) {
redirect_header($_SERVER['SCRIPT_NAME'] . '?file=' . $_SESSION['xmlfile'] . '&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED);
}
$adminObject = Admin::getInstance();
- 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 145.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
case 'actiona':
if (Request::hasVar('xmlfile', 'SESSION')) {
redirect_header($_SERVER['SCRIPT_NAME'] . '?file=' . $_SESSION['xmlfile'] . '&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED);
}
$adminObject = Admin::getInstance();
- 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 145.
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
Consider simplifying this complex logical expression. Open
if (($c == $strlen_chrs) || ((',' === $chrs[$c]) && (SERVICES_JSON_SLICE == $top['what']))) {
// found a comma that is not inside a string, array, etc.,
// OR we've reached the end of the character list
$slice = mb_substr($chrs, $top['where'], $c - $top['where']);
array_push($stk, ['what' => SERVICES_JSON_SLICE, 'where' => $c + 1, 'delim' => false]);
File field.php
has 289 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php declare(strict_types=1);
use Xmf\Module\Admin;
use Xmf\Request;
use XoopsModules\Songlist\Helper;