Showing 2,792 of 2,792 total issues
File Utility.php
has 2304 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace XoopsModules\Xoopstube;
/*
Method getSocialBookmarks
has 672 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getSocialBookmarks($lid)
{
global $xoopsModule;
// $myts = new Xoopstube\TextSanitizer();
Utility
has 95 functions (exceeds 20 allowed). Consider refactoring. Open
class Utility extends Common\SysUtility
{
//--------------- Custom module methods -----------------------------
public const MODULE_NAME = 'xoopstube';
File xoops_version.php
has 761 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Module: XoopsTube
*
File sbookmarks.php
has 677 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Module: XoopsTube
*
Method unhtml
has 258 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function unhtml($chaine)
{
$search = $replace = [];
$chaine = \html_entity_decode($chaine);
Method listBlocks
has 212 lines of code (exceeds 25 allowed). Consider refactoring. Open
function listBlocks()
{
global $xoopsModule, $pathIcon16;
require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
$moduleDirName = basename(dirname(__DIR__));
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)
{
if ($considerHtml) {
// if the plain text is shorter than the maximum length, return the whole text
if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) {
- 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 blocksadmin.php
has 500 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* 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.
File admin.php
has 488 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Module: XoopsTube
*
Method edit
has 192 lines of code (exceeds 25 allowed). Consider refactoring. Open
function edit($lid = 0)
{
global $myts, $mytree, $xtubeImageArray;
$sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE lid=' . $lid;
File main.php
has 474 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Module: XoopsTube
*
* You may not change or alter any portion of this comment or credits
Method renderAdminMenu
has 175 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function renderAdminMenu($header = '', $menu = '', $extra = '', $scount = 4)
{
global $xoopsModule;
$_named_vidid = \xoops_getenv('SCRIPT_NAME');
Function renderAdminMenu
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
public static function renderAdminMenu($header = '', $menu = '', $extra = '', $scount = 4)
{
global $xoopsModule;
$_named_vidid = \xoops_getenv('SCRIPT_NAME');
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
$icons = [
'edit' => "<img src='" . $pathIcon16 . "/edit.png' alt=" . _EDIT . "' align='middle'>",
'delete' => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _DELETE . "' align='middle'>",
'clone' => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _CLONE . "' align='middle'>",
'preview' => "<img src='" . $pathIcon16 . "/view.png' alt='" . _PREVIEW . "' align='middle'>",
- 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 212.
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
'icons' => [
'edit' => "<img src='" . $pathIcon16 . "/edit.png' alt=" . _EDIT . "' align='middle'>",
'delete' => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _DELETE . "' align='middle'>",
'clone' => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _CLONE . "' align='middle'>",
'preview' => "<img src='" . $pathIcon16 . "/view.png' alt='" . _PREVIEW . "' align='middle'>",
- 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 212.
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
Function listBlocks
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
function listBlocks()
{
global $xoopsModule, $pathIcon16;
require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
$moduleDirName = basename(dirname(__DIR__));
- 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 createCategory
has 154 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createCategory($cid = 0)
{
// require_once dirname(__DIR__) . '/class/xoopstube_lists.php';
// require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
Similar blocks of code found in 2 locations. Consider refactoring. Open
foreach ($mod_array as $key => $content) {
if (in_array($key, $not_allowed)) {
continue;
}
$lang_def = constant('_AM_XOOPSTUBE_MOD_' . mb_strtoupper($key));
- 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 193.
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
foreach ($orig_array as $key => $content) {
if (in_array($key, $not_allowed)) {
continue;
}
$lang_def = constant('_AM_XOOPSTUBE_MOD_' . mb_strtoupper($key));
- 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 193.
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