Showing 4,217 of 4,217 total issues
Function _show_category_contents
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function _show_category_contents($params = [])
{
$ICONS_PATH = 'uploads/icons/';
$MEDIA_PATH = WEB_PATH;
$force_stpl_name = isset($params['force_stpl_name']) ? $params['force_stpl_name'] : 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 copy_dir
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function copy_dir($path1, $path2, $pattern_include = '', $pattern_exclude = '', $level = null)
{
if ( ! $path1 || ! file_exists($path1)) {
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 my_array_merge
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function my_array_merge($a1, $a2)
{
foreach ((array) $a2 as $k => $v) {
if (isset($a1[$k]) && is_array($a1[$k])) {
if (is_array($a2[$k])) {
- 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 check
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function check($field_in_form = 'image_numbers', $input = null)
{
if ( ! $this->ENABLED) {
return 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 _helper_add_config
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function _helper_add_config($libs = [], $types = ['js', 'css'])
{
_class('assets')->clean_all();
foreach ($libs as $name => $config) {
foreach ($types as $type) {
- 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 import_base_db_structure
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function import_base_db_structure()
{
$import_tables = [
'dashboards',
'static_pages',
- 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
public function test_25()
{
debug([
'key1' => 'val1',
'key2::sub1' => 'val21',
- 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 133.
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 test_15()
{
conf([
'key1' => 'val1',
'key2::sub1' => 'val21',
- 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 133.
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
File yf_core_api_admin_modules.class.php
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
class yf_core_api_admin_modules
{
File yf_pcntl_signal.class.php
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* pcntl_signal handler
* static class.
File yf_common_num2string.class.php
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
class yf_common_num2string
{
Method select_box
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function select_box($name, $values = [], $selected = '', $show_text = false, $type = 2, $add_str = '', $translate = 0, $level = 0)
{
// Passing params as array
if (is_array($name)) {
$extra = (array) $extra + $name;
Method balance
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function balance($options)
{
if (empty(main()->USER_ID)) {
js_redirect('/login_form', false, 'User id empty');
}
Method authorize_request
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function authorize_request($options = null)
{
if ( ! $this->ENABLE) {
return null;
}
Method _api_authorize
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _api_authorize()
{
if ( ! $this->ENABLE) {
return null;
}
Method _update_status
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _update_status($options = null)
{
if ( ! $this->ENABLE) {
return null;
}
Method _replace_std_patterns
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _replace_std_patterns($string, $name = '', array &$replace, $params = [])
{
$_this = $this;
$tpl = tpl();
Method table_get_columns
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function table_get_columns($table, $extra = [], &$error = false)
{
if (is_array($table)) {
$extra = (array) $extra + $table;
$table = '';
Method allow
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function allow()
{
if ( ! $this->LOGGING || MAIN_TYPE_ADMIN) {
return false;
}
Method _data
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _data()
{
$_class_price = $this->_class_price;
// init sql
$sql_table = db('shop_products');