File NewsStory.php
has 1244 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php declare(strict_types=1);
namespace XoopsModules\News;
/*
NewsStory
has 46 functions (exceeds 20 allowed). Consider refactoring. Open
class NewsStory extends XoopsStory
{
public $newstopic; // XoopsTopic object
public $rating; // News rating
public $votes; // Number of votes
Function getAllPublished
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
public static function getAllPublished(
$limit = 0,
$start = 0,
$checkRight = false,
$topic = 0,
- 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 getRandomNews
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
public function getRandomNews(
$limit = 0,
$start = 0,
$checkRight = false,
$topic = 0,
- 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 prepare2show
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
public function prepare2show($filescount)
{
global $xoopsUser, $xoopsConfig, $xoopsModule;
/** @var News\Helper $helper */
$helper = Helper::getInstance();
- 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 prepare2show
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function prepare2show($filescount)
{
global $xoopsUser, $xoopsConfig, $xoopsModule;
/** @var News\Helper $helper */
$helper = Helper::getInstance();
Method store
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function store($approved = false)
{
$myts = \MyTextSanitizer::getInstance();
$counter = $this->counter ?? 0;
$title = $GLOBALS['xoopsDB']->escape($myts->censorString($this->title));
Method getStats
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getStats($limit)
{
$ret = [];
/** @var \XoopsMySQLDatabase $db */
$db = \XoopsDatabaseFactory::getDatabaseConnection();
Method getAllPublishedByAuthor
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAllPublishedByAuthor($uid, $checkRight = false, $asobject = true)
{
/** @var \XoopsMySQLDatabase $db */
$db = \XoopsDatabaseFactory::getDatabaseConnection();
$myts = \MyTextSanitizer::getInstance();
Function getBigStory
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function getBigStory(
$limit = 0,
$start = 0,
$checkRight = false,
$topic = 0,
- 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 getRandomNews
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getRandomNews(
$limit = 0,
$start = 0,
$checkRight = false,
$topic = 0,
Method getAllPublished
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getAllPublished(
$limit = 0,
$start = 0,
$checkRight = false,
$topic = 0,
Function getAllPublishedByAuthor
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function getAllPublishedByAuthor($uid, $checkRight = false, $asobject = true)
{
/** @var \XoopsMySQLDatabase $db */
$db = \XoopsDatabaseFactory::getDatabaseConnection();
$myts = \MyTextSanitizer::getInstance();
- 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 auto_summary
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function auto_summary($text, &$titles)
{
$auto_summary = '';
if (Utility::getModuleOption('enhanced_pagenav')) {
$expr_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
Method getBigStory
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getBigStory(
$limit = 0,
$start = 0,
$checkRight = false,
$topic = 0,
Method uname
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function uname($uid = 0)
{
global $xoopsConfig;
static $tblusers = [];
$option = -1;
Method getStoriesByIds
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getStoriesByIds(
$ids,
$checkRight = true,
$asobject = true,
$order = 'published',
Function getStats
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function getStats($limit)
{
$ret = [];
/** @var \XoopsMySQLDatabase $db */
$db = \XoopsDatabaseFactory::getDatabaseConnection();
- 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 getStoriesByIds
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function getStoriesByIds(
$ids,
$checkRight = true,
$asobject = true,
$order = 'published',
- 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 deleteBeforeDate
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function deleteBeforeDate($timestamp, $expired, $topicslist = '')
{
global $xoopsModule;
/** @var \XoopsMySQLDatabase $db */
$db = \XoopsDatabaseFactory::getDatabaseConnection();
Method getAllStoriesCount
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getAllStoriesCount($storytype = 1, $checkRight = false)
{
/** @var \XoopsMySQLDatabase $db */
$db = \XoopsDatabaseFactory::getDatabaseConnection();
$sql = 'SELECT count(*) AS cpt FROM ' . $db->prefix('news_stories') . ' WHERE ';
Method bodytext
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function bodytext($format = 'Show')
{
$myts = \MyTextSanitizer::getInstance();
$html = 1;
$smiley = 1;
Method adminlink
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function adminlink()
{
global $xoopsModule;
$dirname = \basename(\dirname(__DIR__));
/** @var \XoopsModuleHandler $moduleHandler */
Function exportNews
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function exportNews(
$fromdate,
$todate,
$topicslist,
$usetopicsdef,
- 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 auto_summary
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function auto_summary($text, &$titles)
{
$auto_summary = '';
if (Utility::getModuleOption('enhanced_pagenav')) {
$expr_matches = [];
Method getAllSubmitted
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getAllSubmitted($limit = 0, $asobject = true, $checkRight = false, $start = 0)
{
/** @var \XoopsMySQLDatabase $db */
$db = \XoopsDatabaseFactory::getDatabaseConnection();
$myts = \MyTextSanitizer::getInstance();
Method exportNews
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function exportNews(
$fromdate,
$todate,
$topicslist,
$usetopicsdef,
Method hometext
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function hometext($format = 'Show')
{
$hometext = '';
$myts = \MyTextSanitizer::getInstance();
$html = $smiley = $xcodes = 1;
Method _searchPreviousOrNextArticle
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _searchPreviousOrNextArticle($storyid, $next = true, $checkRight = false)
{
/** @var \XoopsMySQLDatabase $db */
$db = \XoopsDatabaseFactory::getDatabaseConnection();
$ret = [];
Method getAllPublished
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
$limit = 0,
$start = 0,
$checkRight = false,
$topic = 0,
$ihome = 0,
Function store
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function store($approved = false)
{
$myts = \MyTextSanitizer::getInstance();
$counter = $this->counter ?? 0;
$title = $GLOBALS['xoopsDB']->escape($myts->censorString($this->title));
- 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 uname
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function uname($uid = 0)
{
global $xoopsConfig;
static $tblusers = [];
$option = -1;
- 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 _searchPreviousOrNextArticle
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function _searchPreviousOrNextArticle($storyid, $next = true, $checkRight = false)
{
/** @var \XoopsMySQLDatabase $db */
$db = \XoopsDatabaseFactory::getDatabaseConnection();
$ret = [];
- 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 getAllStoriesCount
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function getAllStoriesCount($storytype = 1, $checkRight = false)
{
/** @var \XoopsMySQLDatabase $db */
$db = \XoopsDatabaseFactory::getDatabaseConnection();
$sql = 'SELECT count(*) AS cpt FROM ' . $db->prefix('news_stories') . ' WHERE ';
- 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 getAllSubmitted
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function getAllSubmitted($limit = 0, $asobject = true, $checkRight = false, $start = 0)
{
/** @var \XoopsMySQLDatabase $db */
$db = \XoopsDatabaseFactory::getDatabaseConnection();
$myts = \MyTextSanitizer::getInstance();
- 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 getRandomNews
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
$limit = 0,
$start = 0,
$checkRight = false,
$topic = 0,
$ihome = 0,
Method exportNews
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
$fromdate,
$todate,
$topicslist,
$usetopicsdef,
&$tbltopics,
Method getBigStory
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
$limit = 0,
$start = 0,
$checkRight = false,
$topic = 0,
$ihome = 0,
Function deleteBeforeDate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function deleteBeforeDate($timestamp, $expired, $topicslist = '')
{
global $xoopsModule;
/** @var \XoopsMySQLDatabase $db */
$db = \XoopsDatabaseFactory::getDatabaseConnection();
- 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 getArchive
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getArchive(
$publish_start,
$publish_end,
$checkRight = false,
$asobject = true,
- 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 countPublishedByTopic
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function countPublishedByTopic($topicid = 0, $checkRight = false)
{
/** @var \XoopsMySQLDatabase $db */
$db = \XoopsDatabaseFactory::getDatabaseConnection();
$sql = 'SELECT COUNT(*) FROM ' . $db->prefix('news_stories') . ' WHERE published > 0 AND published <= ' . \time() . ' AND (expired = 0 OR expired > ' . \time() . ')';
- 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 getStoriesByIds
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
$ids,
$checkRight = true,
$asobject = true,
$order = 'published',
$onlyOnline = true
Method getArchive
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
$publish_start,
$publish_end,
$checkRight = false,
$asobject = true,
$order = 'published'
Method getAllExpired
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function getAllExpired($limit = 0, $start = 0, $topic = 0, $ihome = 0, $asobject = true)
Function hometext
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function hometext($format = 'Show')
{
$hometext = '';
$myts = \MyTextSanitizer::getInstance();
$html = $smiley = $xcodes = 1;
- 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 bodytext
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function bodytext($format = 'Show')
{
$myts = \MyTextSanitizer::getInstance();
$html = 1;
$smiley = 1;
- 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;
Function topic_imgurl
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function topic_imgurl($format = 'S')
{
if ('' === \trim($this->topic_imgurl)) {
$this->topic_imgurl = 'blank.png';
}
- 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 getAllExpired
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function getAllExpired($limit = 0, $start = 0, $topic = 0, $ihome = 0, $asobject = true)
{
/** @var \XoopsMySQLDatabase $db */
$db = \XoopsDatabaseFactory::getDatabaseConnection();
$myts = \MyTextSanitizer::getInstance();
- 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
public function topic_imgurl($format = 'S')
{
if ('' === \trim($this->topic_imgurl)) {
$this->topic_imgurl = 'blank.png';
}
- 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 191.
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
public function description($format = 'S')
{
$myts = \MyTextSanitizer::getInstance();
switch (mb_strtoupper($format)) {
case 'S':
- 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 141.
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
public function keywords($format = 'S')
{
$myts = \MyTextSanitizer::getInstance();
switch (mb_strtoupper($format)) {
case 'S':
- 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 141.
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 3 locations. Consider refactoring. Open
if (0 != (int)$topic) {
if (!\is_array($topic)) {
$sql .= ' AND topicid=' . (int)$topic . ' AND (ihome=1 OR ihome=0)';
} elseif (\count($topic) > 0) {
$sql .= ' AND topicid IN (' . \implode(',', $topic) . ')';
- 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 97.
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 3 locations. Consider refactoring. Open
if (0 != $topic) {
if (!\is_array($topic)) {
if ($checkRight) {
$topics = Utility::getMyItemIds('news_view');
if (!\in_array($topic, $topics, 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 97.
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 3 locations. Consider refactoring. Open
if (0 != $topic) {
if (!\is_array($topic)) {
if ($checkRight) {
$topics = Utility::getMyItemIds('news_view');
if (!\in_array($topic, $topics, 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 97.
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