Showing 4,217 of 4,217 total issues
Method get_user_info
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_user_info()
{
if (DEBUG_MODE && $_GET['oauth_clean']) {
$this->_storage_clean();
}
Method btn_active
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function btn_active($name = '', $link = '', $extra = [])
{
if (is_array($name)) {
$extra = $name;
$name = '';
Method show_rss_page
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function show_rss_page($data = [], $params = [])
{
require_php_lib('yf_feedcreator');
$rss = new UniversalFeedCreator();
if ( ! isset($params['use_cached']) || ! empty($params['use_cached'])) {
Method _check
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _check($target_user_id = 0, $source_user_id = 0)
{
if (empty($source_user_id) && ! empty(main()->USER_ID)) {
$source_user_id = main()->USER_ID;
}
Method join_url
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function join_url($parts, $encode = null)
{
if ($encode === null) {
$encode = $this->AUTO_ENCODE_DECODE;
}
Method _init_sftp_phpseclib
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _init_sftp_phpseclib($server_info = [])
{
if ( ! $this->DRIVER == 'phpseclib') {
return false;
}
Method test_order_by
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function test_order_by()
{
if ($this->_need_skip_test(__FUNCTION__)) {
return;
}
Method test_num2str_uah_ru
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function test_num2str_uah_ru()
{
// $this->assertEquals( 'пятьсот пятьдесят пять триллионов четыреста сорок четыре милиарда триста тридцать три миллиона двести двадцать две тысячи сто одиннадцать гривен 99 копеек', common()->num2str( '555 444 333 222 111.999', 'uah', 'ru' ) );
// $this->assertEquals( 'п`ятьсот п`ятьдесят п`ять трильйонів чотиреста сорок чотири мільярда триста тридцять три мільйона двісті двадцять дві тисячі сто одиннадцять гривень 99 копійок', common()->num2str( '555 444 333 222 111.999', 'uah', 'ua' ) );
// $this->assertEquals( 'five hundred fifty five trillions four hundred forty four milliards three hundred thirty three millions two hundred twenty two thousands one hundred eleven grivnas 99 kopecks', common()->num2str( '555 444 333 222 111.999', 'uah', 'en' ) );
Similar blocks of code found in 2 locations. Consider refactoring. Open
function twoDigits(d) {
if(0 <= d && d < 10) return "0" + d.toString();
if(-10 < d && d < 0) return "-0" + (-1*d).toString();
return d.toString();
}
- 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 87.
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 yf_placeholder_img
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
function yf_placeholder_img($w = 100, $h = 100, $params = [])
{
$w = abs((int) $w ?: 100);
$h = abs((int) $h ?: 100);
$text = $params['text'] ?: $w . ' x ' . $h;
Similar blocks of code found in 2 locations. Consider refactoring. Open
function twoDigits(d) {
if(0 <= d && d < 10) return "0" + d.toString();
if(-10 < d && d < 0) return "-0" + (-1*d).toString();
return d.toString();
}
- 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 87.
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 radio_box
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function radio_box($name, $values = [], $selected = '', $horizontal = true, $type = 2, $add_str = '', $translate = 0)
{
if (is_array($name)) {
$extra = (array) $extra + $name;
$name = $extra['name'];
- 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 _get_admin_daily_info
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function _get_admin_daily_info($sql, $days = 60, $admin_ids = [])
{
if ( ! $admin_ids) {
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 _rss_general
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function _rss_general()
{
foreach ((array) module('comments')->COMMENT_LINKS as $key => $value) {
$where .= 'object_name="' . $key . '"';
if ($value !== end(module('comments')->COMMENT_LINKS)) {
- 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 _process_where_cond
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function _process_where_cond($left, $op, $right)
{
! $op && $op = '=';
$left = trim(strtolower($left));
if (is_string($op)) {
- 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 go
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function go($sql = '', $url_path = '', $render_type = '', $records_on_page = 0, $num_records = 0, $tpls_path = '', $add_get_vars = 1, $extra = [])
{
if (is_array($url_path)) {
$extra = $url_path;
$url_path = '';
- 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 rotate
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function rotate($source_file_path, $dest_file_path, $ANGLE)
{
// Check source file
if ( ! file_exists($source_file_path) || ! filesize($source_file_path) || ! is_readable($source_file_path)) {
trigger_error('ROTATE_IMG: Source file is empty', E_USER_WARNING);
- 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 _get_available_widgets_hooks
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function _get_available_widgets_hooks()
{
if (isset($this->_avail_widgets)) {
return $this->_avail_widgets;
}
- 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 product_image_search
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function product_image_search()
{
$_GET['id'] = (int) ($_GET['id']);
if ($_GET['id']) {
$product = module('manage_shop')->_product_get_info($_GET['id']);
- 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 _recursive_sort_items
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function _recursive_sort_items($items = [], $skip_item_id = 0, $parent_id = 0)
{
$children = [];
$cur_group = MAIN_TYPE_USER ? $_SESSION['user_group'] : $_SESSION['admin_group'];
foreach ((array) $items as $id => $info) {
- 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"