Showing 4,217 of 4,217 total issues

Function _attrs has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

    function _attrs($extra, $names)
    {
        $body = [];
        $a = [];
        foreach ((array) $names as $name) {
Severity: Minor
Found in functions/yf_common_funcs.php - About 5 hrs to fix

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 _get_modules($params = [])
    {
        // Need to prevent multiple calls
        if (isset($this->_admin_modules_array)) {
            return $this->_admin_modules_array;
Severity: Major
Found in plugins/admin/admin_modules/yf_admin_modules.class.php and 1 other location - About 5 hrs to fix
plugins/user/admin_modules/yf_user_modules.class.php on lines 179..200

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 202.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function _get_modules($params = [])
    {
        // Need to prevent multiple calls
        if (isset($this->_user_modules_array)) {
            return $this->_user_modules_array;
Severity: Major
Found in plugins/user/admin_modules/yf_user_modules.class.php and 1 other location - About 5 hrs to fix
plugins/admin/admin_modules/yf_admin_modules.class.php on lines 177..198

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 202.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function _balance_recharge($request, $options)
    {
        $api = _class('api');
        $payment_api = _class('payment_api');
        $balance = $payment_api->deposition_user($request);
Severity: Major
Found in plugins/payment/modules/yf_payment.class.php and 1 other location - About 5 hrs to fix
plugins/payment/modules/yf_payment.class.php on lines 219..249

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 202.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function _cancel($request, $options)
    {
        $api = _class('api');
        $payment_api = _class('payment_api');
        $object = $payment_api->cancel_user($request);
Severity: Major
Found in plugins/payment/modules/yf_payment.class.php and 1 other location - About 5 hrs to fix
plugins/payment/modules/yf_payment.class.php on lines 102..132

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 202.

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

Further Reading

File yf_core_blocks.class.php has 413 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Core blocks methods.
 *
Severity: Minor
Found in plugins/sys/classes/yf_core_blocks.class.php - About 5 hrs to fix

    File yf_blocks.class.php has 412 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * Blocks editor.
     *
    Severity: Minor
    Found in plugins/sys/admin_modules/yf_blocks.class.php - About 5 hrs to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          public function _hook_side_column()
          {
              $items = [];
              $url = url('/@object');
              $methods = $this->_get_console_commands();
      Severity: Major
      Found in .dev/samples/classes/sample_console_tool.class.php and 1 other location - About 5 hrs to fix
      .dev/samples/classes/sample_aliases.class.php on lines 27..50

      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 201.

      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

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          public function _hook_side_column()
          {
              $items = [];
              $url = url('/@object');
              $methods = $this->_get_aliases();
      Severity: Major
      Found in .dev/samples/classes/sample_aliases.class.php and 1 other location - About 5 hrs to fix
      .dev/samples/classes/sample_console_tool.class.php on lines 12..35

      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 201.

      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

      Further Reading

      File yf_db_utils_mysql.class.php has 410 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      
      load('db_utils_driver', '', 'classes/db/');
      class yf_db_utils_mysql extends yf_db_utils_driver
      Severity: Minor
      Found in plugins/db/classes/db/yf_db_utils_mysql.class.php - About 5 hrs to fix

        File sys_block_rules.data.php has 410 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        return [
          1 => [
            'id' => '1',
        Severity: Minor
        Found in .dev/install/installer_data/db_tables/sys_block_rules.data.php - About 5 hrs to fix

          yf_manage_payout has 43 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class yf_manage_payout
          {
              public $IS_PAYOUT_INTERKASSA = null;
          
              public $payment_api = null;
          Severity: Minor
          Found in plugins/payment/admin_modules/yf_manage_payout.class.php - About 5 hrs to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                        if ( ! common()->_error_exists() && module('comments')->ANTI_FLOOD_TIME && MAIN_TYPE_USER) {
                            $FLOOD_DETECTED = db()->query_fetch(
                                'SELECT id,add_date FROM ' . db('comments') . ' WHERE '
                                    . (main()->USER_ID ? 'user_id=' . (int) (main()->USER_ID) : 'ip="' . _es(common()->get_ip()) . '"')
                                    . ' AND add_date > ' . (time() - module('comments')->ANTI_FLOOD_TIME) . ' 
            plugins/comments/modules/comments/yf_comments_manage.class.php on lines 78..88

            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 200.

            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

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                        if ( ! common()->_error_exists() && module('comments')->ANTI_FLOOD_TIME && MAIN_TYPE_USER) {
                            $FLOOD_DETECTED = db()->query_fetch(
                                'SELECT id,add_date FROM ' . db('comments') . ' 
                                WHERE ' . (main()->USER_ID ? 'user_id=' . (int) (main()->USER_ID) : 'ip="' . _es(common()->get_ip()) . '"')
                                    . ' AND add_date > ' . (time() - module('comments')->ANTI_FLOOD_TIME) . ' 
            plugins/comments/modules/comments/yf_comments_manage.class.php on lines 240..251

            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 200.

            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

            Further Reading

            File yf_manage_shop_products.class.php has 409 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            
            class yf_manage_shop_products
            {

              Method api_payout has 144 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function api_payout($options = null)
                  {
                      if ( ! $this->ENABLE) {
                          return  null;
                      }
              Severity: Major
              Found in plugins/payment/classes/yf_payment_api__provider_webmoney.class.php - About 5 hrs to fix

                Function ajax_city has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function ajax_city()
                    {
                        main()->NO_GRAPHICS = true;
                        // Check input
                        if (isset($_REQUEST['country'])) {
                Severity: Minor
                Found in plugins/geo/modules/yf_geo_content.class.php - About 5 hrs to fix

                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 _external_response has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function _external_response()
                    {
                        $operation_id = $_GET['operation_id'];
                        $secret = $_GET['secret'];
                        $payment_api = $this->payment_api;
                Severity: Minor
                Found in plugins/payment/classes/yf_payment_api__provider_bitcoin.class.php - About 5 hrs to fix

                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 _fix_data_safe has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function _fix_data_safe($table, $data = [], $extra = [])
                    {
                        if ( ! $this->FIX_DATA_SAFE) {
                            return $data;
                        }
                Severity: Minor
                Found in plugins/db/classes/yf_db.class.php - About 5 hrs to fix

                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 _render_as_html has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function _render_as_html(&$params, &$a, &$to_hide)
                    {
                        $body = '';
                        $header_links = [];
                        if (MAIN_TYPE_ADMIN && ! $params['no_pages'] && ! $params['no_total'] && $a['total']) {
                Severity: Minor
                Found in plugins/table2/classes/yf_table2.class.php - About 5 hrs to fix

                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

                Severity
                Category
                Status
                Source
                Language