Showing 4,217 of 4,217 total issues

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

<?php

load('yf_model_result', '', 'classes/model/');
load('yf_model_relation', '', 'classes/model/');

Severity: Minor
Found in plugins/sys/classes/yf_model.class.php - About 7 hrs to fix

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

    <?php
    
    /**
     * Core content-related methods stored here.
     *
    Severity: Minor
    Found in classes/yf_graphics.class.php - About 7 hrs to fix

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

          public function test_61()
          {
              // Do this test only if mcrypt is available
              if ( ! function_exists('mcrypt_module_open')) {
                  return false;
      Severity: Major
      Found in .dev/tests/unit/class_encryption_test.php and 1 other location - About 7 hrs to fix
      .dev/tests/unit/class_encryption_test.php on lines 212..235

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

      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 _product_revisions_similar()
          {
              $rev = db()->get('SELECT * FROM ' . db('shop_product_revisions') . ' WHERE id=' . (int) ($_GET['id']));
              $product_id = (int) ($rev['item_id']);
              $product_info = module('manage_shop')->_product_get_info($product_id);
      plugins/shop/admin_modules/manage_shop/yf_manage_shop_hook_side_column.class.php on lines 100..121

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

      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 test_62()
          {
              // Do this test only if mcrypt is available
              if ( ! function_exists('mcrypt_module_open')) {
                  return false;
      Severity: Major
      Found in .dev/tests/unit/class_encryption_test.php and 1 other location - About 7 hrs to fix
      .dev/tests/unit/class_encryption_test.php on lines 186..209

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

      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 _product_images_revisions_similar()
          {
              $rev = db()->get('SELECT * FROM ' . db('shop_product_images_revisions') . ' WHERE id=' . (int) ($_GET['id']));
              $product_id = (int) ($rev['product_id']);
              $product_info = module('manage_shop')->_product_get_info($product_id);
      plugins/shop/admin_modules/manage_shop/yf_manage_shop_hook_side_column.class.php on lines 76..97

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

      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

      yf_manage_shop_import_products2 has 54 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class yf_manage_shop_import_products2
      {
          public $import_field = [
              0 => 'не использовать (0)',
              'id' => 'идентификатор (id)',

        class_db_real_utils_pgsql_test has 54 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class class_db_real_utils_pgsql_test extends db_real_abstract
        {
            public static function _need_skip_test($name)
            {
                return false;
        Severity: Major
        Found in .dev/tests/functional/db/class_db_real_utils_pgsql.TODO.php - About 7 hrs to fix

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

          <?php
          
          /**
           * Dashboards management.
           *
          Severity: Minor
          Found in plugins/dashboards/admin_modules/yf_manage_dashboards.class.php - About 7 hrs to fix

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

                public function api_payout($options = null)
                {
                    if ( ! $this->ENABLE) {
                        return  null;
                    }

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

                      foreach ((array) $item_prod_id as $k => $product_info) {
                          $thumb_path = $product_info['url'] . '_' . $product_info['id'] . '_1' . module('shop')->THUMB_SUFFIX . '.jpg';
                          $URL_PRODUCT_ID = module('shop')->_product_id_url($product_info);
                          $items[$product_info['id']] = [
                              'name' => _prepare_html($product_info['name']),
              plugins/shop/modules/shop/yf_shop_products_similar_by_basket.class.php on lines 24..35
              plugins/shop/modules/shop/yf_shop_products_similar_by_price.class.php on lines 23..34

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

              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 3 locations. Consider refactoring.
              Open

                      foreach ((array) $product as $k => $product_info) {
                          $thumb_path = $product_info['url'] . '_' . $product_info['id'] . '_1' . module('shop')->THUMB_SUFFIX . '.jpg';
                          $URL_PRODUCT_ID = module('shop')->_product_id_url($product_info);
                          $items[$product_info['id']] = [
                              'name' => _prepare_html($product_info['name']),
              plugins/shop/modules/shop/yf_shop__products_last_viewed.class.php on lines 10..21
              plugins/shop/modules/shop/yf_shop_products_similar_by_basket.class.php on lines 24..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 237.

              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 3 locations. Consider refactoring.
              Open

                          foreach ((array) $product as $k => $product_info) {
                              $thumb_path = $product_info['url'] . '_' . $product_info['id'] . '_1' . module('shop')->THUMB_SUFFIX . '.jpg';
                              $URL_PRODUCT_ID = module('shop')->_product_id_url($product_info);
                              $items[$product_info['id']] = [
                                  'name' => _prepare_html($product_info['name']),
              plugins/shop/modules/shop/yf_shop__products_last_viewed.class.php on lines 10..21
              plugins/shop/modules/shop/yf_shop_products_similar_by_price.class.php on lines 23..34

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

              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

              Function _external_response has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function _external_response($options)
                  {
                      $pos_data = json_decode($options['posData'], true);
                      $operation_id = (int) ($pos_data['orderId']);
                      $ip = common()->get_ip();
              Severity: Minor
              Found in plugins/payment/classes/yf_payment_api__provider_bitpay.class.php - About 7 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 copy_item2 has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function copy_item2()
                  {
                      if ($_POST['items_to_copy']) {
                          $items = unserialize(urldecode($_POST['items_to_copy']));
                          foreach ((array) $items as $k => $v) {
              Severity: Minor
              Found in plugins/sys/admin_modules/yf_file_manager.class.php - About 7 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 _get_methods has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function _get_methods($params = [])
                  {
                      $ONLY_PRIVATE_METHODS = [];
                      if (isset($params['private'])) {
                          $ONLY_PRIVATE_METHODS = $params['private'];
              Severity: Minor
              Found in plugins/sys/classes/core_api/yf_core_api_user_modules.class.php - About 7 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 generate_down has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function generate_down($report = null, $params = [])
                  {
                      if ( ! isset($report)) {
                          $report = $this->compare($params);
                      }
              Severity: Minor
              Found in plugins/db/classes/db/yf_db_migrator.class.php - About 7 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

                      return table($items, [
                              'condensed' => 1,
                              'pager_records_on_page' => 10000,
                              'filter' => true,
                              'filter_params' => [
              Severity: Major
              Found in plugins/user/admin_modules/yf_user_modules.class.php and 1 other location - About 7 hrs to fix
              plugins/admin/admin_modules/yf_admin_modules.class.php on lines 85..106

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

              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

                      return table($items, [
                              'condensed' => 1,
                              'pager_records_on_page' => 10000,
                              'filter' => true,
                              'filter_params' => [
              Severity: Major
              Found in plugins/admin/admin_modules/yf_admin_modules.class.php and 1 other location - About 7 hrs to fix
              plugins/user/admin_modules/yf_user_modules.class.php on lines 86..107

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

              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 class_html_test.Test.php has 480 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              
              require_once __DIR__ . '/yf_unit_tests_setup.php';
              
              
              Severity: Minor
              Found in .dev/tests/unit/class_html_test.Test.php - About 7 hrs to fix
                Severity
                Category
                Status
                Source
                Language