Showing 4,217 of 4,217 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (preg_match('/(?P<text>.+?)["\']{1},[\s\t]*%(?P<args>[a-z]+.+)$/ims', $input, $m)) {
foreach (explode(';%', $m['args']) as $arg) {
$attr_name = $attr_val = '';
if (false !== strpos($arg, '=')) {
list($attr_name, $attr_val) = explode('=', trim($arg));
- 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 206.
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 allow_deny_box($name = '', $desc = '', $extra = [], $replace = [])
{
if (is_array($desc)) {
$extra = (array) $extra + $desc;
$desc = '';
- 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 206.
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
if (preg_match('~(?P<text>.+?)["\']{1},[\s\t]*%(?P<args>[a-z]+.+)$~ims', $in, $m)) {
foreach (explode(';%', $m['args']) as $arg) {
$attr_name = $attr_val = '';
if (false !== strpos($arg, '=')) {
list($attr_name, $attr_val) = explode('=', trim($arg));
- 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 206.
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 _check_block_rights
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
public function _check_block_rights($block_id = 0, $OBJECT = '', $ACTION = '')
{
if (empty($block_id) || empty($OBJECT)) {
return false;
}
- 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 select
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
public function select()
{
$sql = '';
$fields = func_get_args();
if ( ! count((array) $fields) || $fields === []) {
- 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 join
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
public function join($table, $on, $join_type = '', $is_select = false)
{
$join_types = [
'left',
'right',
- 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 _add_revision
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
public function _add_revision($type, $action, $ids = false)
{
if (empty($ids) || empty($action) || empty($type)) {
return false;
}
- 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 _skip_by_pattern
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
public function _skip_by_pattern($path = '', $_is_dir = false, $pattern_include = '', $pattern_exclude = '')
{
if ( ! $path) {
return false;
}
- 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 _debug_DEBUG_YF
has 151 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _debug_DEBUG_YF(&$params = [])
{
if ( ! $this->SHOW_SETTINGS) {
return '';
}
Method product_set_edit
has 150 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function product_set_edit()
{
$product_set_id = (int) $_GET['id'];
$a = db()->from('shop_product_sets')->whereid($product_set_id)->get();
File yf_manage_payment_operation.class.php
has 415 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
class yf_manage_payment_operation
{
public $payment_api = null;
Method test_select_box
has 149 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function test_select_box()
{
$html = html();
$def_class = $html->CLASS_SELECT_BOX;
$def_opt_class = $html->CLASS_SELECT_OPTION_DEFAULT;
File yf_admin_modules.class.php
has 414 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Admin modules list handler.
*
Method api_payout
has 148 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function api_payout($method, $options)
{
if ( ! $this->ENABLE) {
return null;
}
Function _on_validate_ok
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
public function _on_validate_ok($params = [], $form = null)
{
$p = $params ?: $_POST;
$lang = $p['lang_to'];
$lang_from = $p['lang_from'] ?: 'en';
- 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 edit
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
public function edit($params = [])
{
if (is_string($params)) {
$params = ['table' => $params];
}
- 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 _rewrite_replace_links
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
public function _rewrite_replace_links($body = '', $standalone = false, $force_rewrite = false, $for_site_id = false)
{
if (MAIN_TYPE_ADMIN && ! $force_rewrite) {
return $body;
}
- 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 add
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
public function add($object_name, $ids = [], $action = null, $extra = [])
{
if ( ! $this->ENABLED) {
return false;
}
- 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 text
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
public function text($name, $desc = '', $extra = [])
{
// Shortcut: use second param as $extra
if (is_array($desc)) {
$extra = (array) $extra + $desc;
- 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 _view_widget_items
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
public function _view_widget_items($name_ids = [], $items_configs = [])
{
$list_of_hooks = $this->_get_available_widgets_hooks();
$_orig_object = $_GET['object'];
- 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"