Showing 4,217 of 4,217 total issues
Identical blocks of code found in 2 locations. Consider refactoring. Open
$rules_cleaned = [
'name' => [
['trim', null],
['required', null],
['min_length', '2'],
- 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 160.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method _api_response
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _api_response()
{
if ( ! $this->ENABLE) {
return null;
}
Method get_remote_page
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_remote_page($url = '', $cache_ttl = -1, $url_options = [], &$requests_info = [])
{
if (empty($url)) {
return false;
}
Method go
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function go($source_file_path = '', $dest_file_path = '', $LIMIT_X = -1, $LIMIT_Y = -1, $watermark_path = '', $ext = '')
{
$_prev_num_errors = count((array) main()->_all_core_error_msgs);
$LIMIT_X = (int) ($LIMIT_X != -1 ? $LIMIT_X : THUMB_WIDTH);
$LIMIT_Y = (int) ($LIMIT_Y != -1 ? $LIMIT_Y : THUMB_HEIGHT);
Method _data
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _data()
{
$_sub_action = [
'0' => '- не выбрано -',
'add' => 'добавить',
Method test_xss_clean
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function test_xss_clean()
{
$this->assertEquals(_class('security')->xss_clean('script'), 'script');
$this->assertEquals(_class('security')->xss_clean('<script'), '<script');
$this->assertEquals(_class('security')->xss_clean('<img src="javascript:alert(document.cookie)" />'), '<img />');
File states.data.php
has 327 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
return [
1 => [
'id' => '1',
Method _prepare_invoice_body
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _prepare_invoice_body($order_id = false)
{
$_class_price = $this->_class_price;
$_class_units = $this->_class_units;
$_class_region = $this->_class_region;
File yf_email.class.php
has 325 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* High level html emails wrapper.
*/
Method _set_curl_options
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _set_curl_options($url_options = [], $is_ftp_url = false)
{
$curl_opts = [];
$user_agent = isset($url_options['user_agent']) ? $url_options['user_agent'] : $this->DEF_USER_AGENT;
Method _show
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _show($params = [])
{
// Set cookie
if (empty($_COOKIE['advertise']) && $_GET['ads_places'] == 1) {
Method products_show
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function products_show($search = '', $str_search = '')
{
foreach ((array) module('shop')->_shop_cats as $_cat_id => $_cat_name) {
if ($_GET['id'] == module('shop')->_shop_cats_all[$_cat_id]['url'] && $_GET['id'] != '') {
$_GET['id'] = $_cat_id;
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function add()
{
$a = $_POST;
return form($a)
->validate(['name' => 'trim|required'])
- 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 158.
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 add()
{
$a = $_POST;
return form($a)
->validate(['name' => 'trim|required'])
- 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 158.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method _external_response
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _external_response($options)
{
$operation_id = $options['operation_id'];
$payment_code = $options['code'] ?: '';
$address = $options['address'] ?: '';
Function user_vars
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function user_vars()
{
if (isset($_GET['id']) && ! isset($_GET['page'])) {
$_GET['page'] = $_GET['id'];
$_GET['id'] = null;
- 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 combine
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function combine()
{
$assets = clone _class('assets');
$assets->clean_all();
$assets->ADD_IS_DIRECT_OUT = 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 form_row
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function form_row($content, $extra = [], $replace = [], $form)
{
$name = $extra['name'];
$is_html_array = (false !== strpos($name, '['));
if ($is_html_array) {
- 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_bundle
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function _add_bundle($_content, $_params = [])
{
if ( ! $_content) {
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 api_payout
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function api_payout($method, $options)
{
if ( ! $this->ENABLE) {
return null;
}
- 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"