File functions.php
has 1026 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.
Method smallworld_includeScripts
has 140 lines of code (exceeds 25 allowed). Consider refactoring. Open
function smallworld_includeScripts()
{
/** @var \XoopsModules\Smallworld\Helper $helper */
$helper = Helper::getInstance();
$page = basename($_SERVER['PHP_SELF'], '.php');
Function smallworld_time_stamp
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
function smallworld_time_stamp($session_time)
{
$time_difference = time() - $session_time;
$seconds = $time_difference;
$minutes = round($time_difference / 60);
- 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 smallworld_time_stamp
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function smallworld_time_stamp($session_time)
{
$time_difference = time() - $session_time;
$seconds = $time_difference;
$minutes = round($time_difference / 60);
Method smallworld_SetCoreScript
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function smallworld_SetCoreScript()
{
/** @var \XoopsModules\Smallworld\Helper $helper */
$helper = Helper::getInstance();
Method smallworld_sociallinks
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function smallworld_sociallinks($num, $name)
{
/** @var \XoopsModules\Smallworld\Helper $helper */
$helper = Helper::getInstance();
switch ($num) {
Function smallworld_GetModuleOption
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function smallworld_GetModuleOption($option = null, $repmodule = 'smallworld', $flushFirst = false)
{
static $modOptions = [];
if ($flushFirst) { // clears the 'cache', forces reload of configs
$modOptions = [];
- 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 smallworld_getAvatarLink
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function smallworld_getAvatarLink($userid, $image)
{
$depMsg = __FUNCTION__ . " is deprecated use SwUserHandler::getAvatarLink() instead.";
if (isset($GLOBALS['xoopsLogger'])) {
$GLOBALS['xoopsLogger']->addDeprecated($depMsg);
Method smallworld_tolink
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function smallworld_tolink($text, $uid)
{
$helper = Helper::getInstance();
$ext = mb_substr($text, -4, 4);
$ext2 = mb_substr($text, -5, 5);
Function smallworld_includeScripts
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function smallworld_includeScripts()
{
/** @var \XoopsModules\Smallworld\Helper $helper */
$helper = Helper::getInstance();
$page = basename($_SERVER['PHP_SELF'], '.php');
- 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 smallworld_sociallinks
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function smallworld_sociallinks($num, $name)
{
/** @var \XoopsModules\Smallworld\Helper $helper */
$helper = Helper::getInstance();
switch ($num) {
- 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 smallworld_getAvatarLink
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function smallworld_getAvatarLink($userid, $image)
{
$depMsg = __FUNCTION__ . " is deprecated use SwUserHandler::getAvatarLink() instead.";
if (isset($GLOBALS['xoopsLogger'])) {
$GLOBALS['xoopsLogger']->addDeprecated($depMsg);
- 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 smallworld_mostactiveusers_allround
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function smallworld_mostactiveusers_allround()
{
$msg = [];
$sql = 'SELECT uid_fk, COUNT( * ) as cnt ';
$sql .= 'FROM ( ';
Method smallworld_nextBirthdays
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function smallworld_nextBirthdays()
{
$swUserHandler = Helper::getInstance()->getHandler('SwUser');
$now = date('d-m');
$res = [];
Method smallworld_getImageSize
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function smallworld_getImageSize($w, $h, $url)
{
$bn = basename($url);
$w = (int)$w;
$h = (int)$h;
Method smallworld_GetModuleOption
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function smallworld_GetModuleOption($option = null, $repmodule = 'smallworld', $flushFirst = false)
{
static $modOptions = [];
if ($flushFirst) { // clears the 'cache', forces reload of configs
$modOptions = [];
Function smallworld_getImageSize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function smallworld_getImageSize($w, $h, $url)
{
$bn = basename($url);
$w = (int)$w;
$h = (int)$h;
- 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
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return $modOptions[$repmodule][$option];
Avoid too many return
statements within this method. Open
return $modOptions[$repmodule];
Function smallworld_Gravatar
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function smallworld_Gravatar($uid)
{
$depMsg = __FUNCTION__ . " is deprecated use SwUserHandler::gravatar() instead.";
if (isset($GLOBALS['xoopsLogger'])) {
$GLOBALS['xoopsLogger']->addDeprecated($depMsg);
- 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 smallworld_array_flatten
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function smallworld_array_flatten($array, $preserve_keys = 1, &$newArray = [])
{
foreach ($array as $key => $child) {
if (is_array($child)) {
$newArray = smallworld_array_flatten($child, $preserve_keys, $newArray);
- 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 smallworld_tolink
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function smallworld_tolink($text, $uid)
{
$helper = Helper::getInstance();
$ext = mb_substr($text, -4, 4);
$ext2 = mb_substr($text, -5, 5);
- 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 smallworld_getTagUsers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function smallworld_getTagUsers($txt, $sender, $permalink = '')
{
$dBase = new Smallworld\SwDatabase();
$mail = new Smallworld\Mail();
preg_match_all('/@([a-zA-Z0-9]+|\\[[a-zA-Z0-9]+\\])/', $txt, $matches);
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
function smallworld_topratedusers()
{
$swUserHandler = Helper::getInstance()->getHandler('SwUser');
$array = [];
$counter = 1;
- 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 328.
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
function smallworld_worstratedusers()
{
$swUserHandler = Helper::getInstance()->getHandler('SwUser');
$array = [];
$counter = 1;
- 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 328.
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 4 locations. Consider refactoring. Open
case 'register':
$GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.colorbox.js'));
$GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.validate.js'));
$GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.validation.functions.js'));
$GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.stepy.js'));
- 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 214.
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 4 locations. Consider refactoring. Open
case 'permalink':
$GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.oembed.js'));
$GLOBALS['xoTheme']->addScript($helper->url('assets/js/wall.js'));
$GLOBALS['xoTheme']->addStylesheet($helper->url('assets/css/oembed.css'));
$GLOBALS['xoTheme']->addStylesheet($helper->url('assets/css/smallworld.css'));
- 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 214.
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 4 locations. Consider refactoring. Open
case 'publicindex':
$GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.oembed.js'));
$GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.elastic.source.js'));
$GLOBALS['xoTheme']->addScript($helper->url('assets/js/wall.js'));
$GLOBALS['xoTheme']->addScript($helper->url('assets/js/ajaxupload.3.5.js'));
- 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 214.
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 4 locations. Consider refactoring. Open
case 'editprofile':
$GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.colorbox.js'));
$GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.validate.js'));
$GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.validation.functions.js'));
$GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.stepy.js'));
- 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 214.
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
case 'smallworldshare':
$GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.oembed.js'));
$GLOBALS['xoTheme']->addScript($helper->url('assets/js/wall.js'));
$GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.innerfade.js'));
$GLOBALS['xoTheme']->addScript($helper->url('assets/js/jssocials.min.js'));
- 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 176.
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
case 'friends':
$GLOBALS['xoTheme']->addScript($helper->url('assets/js/apprise-1.5.full.js'));
$GLOBALS['xoTheme']->addStylesheet($helper->url('assets/css/jquery.fileupload-ui.css'));
$GLOBALS['xoTheme']->addStylesheet($helper->url('assets/css/oembed.css'));
$GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.oembed.js'));
- 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 176.
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
function smallworldCheckPriv($id)
{
$public = 'SELECT priv FROM ' . $GLOBALS['xoopsDB']->prefix('smallworld_messages') . ' WHERE msg_id = ' . $id . '';
$result = $GLOBALS['xoopsDB']->queryF($public);
while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) {
- 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 90.
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
function smallworld_UsToEuroDate($stringDate)
{
if (0 != $stringDate || '' != $stringDate) {
$theData = explode('-', trim($stringDate));
$ret = $theData[2] . '-' . $theData[1] . '-' . $theData[0];
- 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 90.
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
function smallworld_euroToUsDate($stringDate)
{
if (0 != $stringDate || '' != $stringDate) {
$theData = explode('-', trim($stringDate));
$ret = $theData[2] . '-' . $theData[1] . '-' . $theData[0];
- 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 90.
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