Showing 3,032 of 3,032 total issues
Method tryBrowserCache
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function tryBrowserCache()
{
if (BROWSER_CACHE_DISABLE) {
$this->debug(3, 'Browser caching is disabled');
Method rtsp
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function rtsp(&$patterns, &$replacements): void
{
$patterns[] = "/\[rtsp=(['\"]?)([^\"']*),([^\"']*)\\1]([^\"]*)\[\/rtsp\]/sU";
$rp = "<object classid=\"clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA\" HEIGHT='\\3' ID=Player WIDTH='\\2' VIEWASTEXT>";
$rp .= '<param NAME="_ExtentX" VALUE="12726">';
Function handleErrors
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function handleErrors()
{
if ($this->haveErrors()) {
if (NOT_FOUND_IMAGE && $this->is404()) {
if ($this->serveImg(NOT_FOUND_IMAGE)) {
- 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 getCategoryPath
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getCategoryPath($withAllLink = true)
{
if (empty($this->categoryPath)) {
if ($withAllLink) {
$ret = $this->getCategoryLink();
- 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 isBlockCloned
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function isBlockCloned(int $bid, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups): void
{
\xoops_loadLanguage('admin', 'system');
\xoops_loadLanguage('admin/blocksadmin', 'system');
\xoops_loadLanguage('admin/groups', 'system');
- 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 copyr
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function copyr($source, $dest)
{
// Simple copy for a file
if (\is_file($source)) {
return \copy($source, $dest);
- 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 xcopy
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function xcopy($source, $dest)
{
// Check for symlinks
if (\is_link($source)) {
return \symlink(\readlink($source), $dest);
- 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 getCategoriesCount
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getCategoriesCount($parentid = 0)
{
if (-1 == $parentid) {
return $this->getCount();
}
- 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 render
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function render()
{
$ret = '<table border="0" width="100%">' . NWLINE;
foreach ($this->getElements() as $ele) {
if (!$ele->isHidden()) {
- 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 orderBlock
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function orderBlock(
array $bid,
array $oldtitle,
array $oldside,
array $oldweight,
Method getBody
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getBody($maxLength = 0, $format = 'S', $stripTags = '')
{
$ret = $this->getVar('body', $format);
$wrapPos = \mb_strpos($ret, self::PAGEWRAP);
if (!(false === $wrapPos)) {
Method publisher_date_to_date_show
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function publisher_date_to_date_show($options)
{
$myts = \MyTextSanitizer::getInstance();
$helper = Helper::getInstance();
Method publisher_items_recent_edit
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function publisher_items_recent_edit($options)
{
// require_once PUBLISHER_ROOT_PATH . '/class/blockform.php';
xoops_load('XoopsFormLoader');
Method getCategoriesForSearch
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getCategoriesForSearch()
{
global $theresult;
$ret = [];
Method getCategoriesForSubmit
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function &getCategoriesForSubmit()
{
global $theresult;
$ret = [];
$criteria = new \CriteriaCompo();
Method cloneBlock
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function cloneBlock(int $bid): void
{
//require __DIR__ . '/admin_header.php';
// \xoops_cp_header();
Method createLogo
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function createLogo($dirname)
{
if (!\extension_loaded('gd')) {
return false;
}
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (MenuDom != null) {
for (var i = 0; i < MenuDom.options.length; i++) {
MenuDom.options[i].selected = true;
}
}
- 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 61.
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
if (MenuDom != null) {
for (var i = 0; i < MenuDom.options.length; i++) {
MenuDom.options[i].selected = true;
}
}
- 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 61.
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 serveCacheFile
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function serveCacheFile()
{
$this->debug(3, "Serving {$this->cachefile}");
if (!is_file($this->cachefile)) {
$this->error("serveCacheFile called in timthumb but we couldn't find the cached file.");