Showing 4,217 of 4,217 total issues

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

        return table('SELECT * FROM ' . db('shop_order_revisions'), [
                'filter' => $_SESSION[$_GET['object'] . '__order_revisions'],
                'filter_params' => [
                    'action' => ['eq', 'action'],
                    'user_id' => ['eq', 'user_id'],
plugins/shop/admin_modules/manage_shop/yf_manage_shop__product_revisions.class.php on lines 405..425

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

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;
plugins/sys/classes/core_api/yf_core_api_admin_modules.class.php on lines 21..37

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

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_currency.class.php has 320 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

class yf_manage_currency
{
    public $load_provider = [
Severity: Minor
Found in plugins/payment/admin_modules/yf_manage_currency.class.php - About 3 hrs to fix

    Method _data has 92 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function _data($id)
        {
            if (strpos($id, ':')) {
                $id = array_map([$this, 'id'], explode(':', $id));
                return [
    Severity: Major
    Found in plugins/ckeditor/admin_modules/yf_ck_file_browser.class.php - About 3 hrs to fix

      File sys_log_user_errors.sql_php.php has 320 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      return [
          'fields' => [
              'id' => [
      Severity: Minor
      Found in plugins/logs/share/db/sql_php/sys_log_user_errors.sql_php.php - About 3 hrs to fix

        yf_db_utils_mysql has 30 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class yf_db_utils_mysql extends yf_db_utils_driver
        {
            public function _get_supported_field_types()
            {
                return [
        Severity: Minor
        Found in plugins/db/classes/db/yf_db_utils_mysql.class.php - About 3 hrs to fix

          yf_db_driver_mysqli has 30 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class yf_db_driver_mysqli extends yf_db_driver
          {
              /** @var @conf_skip */
              public $db_connect_id = null;
              /** @var string */
          Severity: Minor
          Found in plugins/db/classes/db/yf_db_driver_mysqli.class.php - About 3 hrs to fix

            yf_dir has 30 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class yf_dir
            {
                /** @var bool */
                public $CHECK_IF_READABLE = true;
                /** @var bool */
            Severity: Minor
            Found in classes/yf_dir.class.php - About 3 hrs to fix

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

              <?php
              
              class yf_manage_faq
              {
                  const table = 'faq';
              Severity: Minor
              Found in plugins/content/admin_modules/yf_manage_faq.class.php - About 3 hrs to fix

                Method _api_response has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Method _get_modules_from_files has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function _get_modules_from_files($include_framework = true, $with_sub_modules = false)
                      {
                          $user_modules_array = [];
                          $pattern_include = '-f ~/' . preg_quote(USER_MODULES_DIR, '~') . '.*' . preg_quote(YF_CLS_EXT, '~') . '$~';
                          $pattern_no_submodules = '~/' . preg_quote(USER_MODULES_DIR, '~') . '[^/]+' . preg_quote(YF_CLS_EXT, '~') . '$~ims';
                  Severity: Major
                  Found in plugins/sys/classes/core_api/yf_core_api_user_modules.class.php - About 3 hrs to fix

                    Method edit has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function edit($params = [])
                        {
                            if (is_string($params)) {
                                $params = ['table' => $params];
                            }
                    Severity: Major
                    Found in plugins/sys/classes/yf_admin_methods.class.php - About 3 hrs to fix

                      File class_db_real_installer_mysql_test.Test.php has 318 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      require_once __DIR__ . '/db_real_abstract.php';
                      
                      /**
                      Severity: Minor
                      Found in .dev/tests/functional/db/class_db_real_installer_mysql_test.Test.php - About 3 hrs to fix

                        Method go has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function go($new_file_path, $k, $name_in_form = 'image', $max_image_size = 0, $is_local = false)
                            {
                        
                                // We do not want to user break our operation
                                ignore_user_abort(true);
                        Severity: Major
                        Found in plugins/common/classes/common/yf_multi_upload_image.class.php - About 3 hrs to fix

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

                                  foreach ($operation_id as $id => $selected) {
                                      $id = (int) $id;
                                      if ($id < 1) {
                                          continue;
                                      }
                          Severity: Major
                          Found in plugins/payment/admin_modules/yf_manage_payout.class.php and 1 other location - About 3 hrs to fix
                          plugins/payment/admin_modules/yf_manage_payout.class.php on lines 2082..2101

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

                          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

                                  foreach ($operation_id as $id => $selected) {
                                      $id = (int) $id;
                                      if ($id < 1) {
                                          continue;
                                      }
                          Severity: Major
                          Found in plugins/payment/admin_modules/yf_manage_payout.class.php and 1 other location - About 3 hrs to fix
                          plugins/payment/admin_modules/yf_manage_payout.class.php on lines 2128..2147

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

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

                              public function _operation($options = null)
                              {
                                  // var
                                  $is_valid = true;
                                  $is_options = true;
                          Severity: Minor
                          Found in plugins/payment/admin_modules/yf_manage_payout.class.php - About 3 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 load has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function load($options = null)
                              {
                                  // import options
                                  is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
                                  // var
                          Severity: Minor
                          Found in plugins/payment/classes/yf_payment_api__currency.class.php - About 3 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 _compile_if_funcs has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function _compile_if_funcs(array $m)
                              {
                                  $cond = trim($m['cond']);
                                  $multiple_cond = 'AND';
                                  if (in_array($cond, ['if_or', 'elseif_or'])) {
                          Severity: Minor
                          Found in plugins/tpl/classes/tpl/yf_tpl_driver_yf_compile.class.php - About 3 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_modules_from_files has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function _get_modules_from_files($include_framework = true, $with_sub_modules = false)
                              {
                                  $modules = [];
                          
                                  $yf_prefix_len = strlen(YF_PREFIX);
                          Severity: Minor
                          Found in plugins/admin/admin_modules/yf_admin_modules.class.php - About 3 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