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'],
Severity: Major
Found in .dev/tests/unit/class_validate_test.Test.php and 1 other location - About 3 hrs to fix
.dev/tests/unit/class_validate_test.Test.php on lines 1095..1113

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

Further Reading

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;
            }
    Severity: Major
    Found in plugins/common/classes/common/yf_remote_files.class.php - About 3 hrs to fix

      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);
      Severity: Major
      Found in plugins/common/classes/common/yf_make_thumb.class.php - About 3 hrs to fix

        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'), '&lt;script');
                  $this->assertEquals(_class('security')->xss_clean('<img src="javascript:alert(document.cookie)" />'), '<img  />');
          Severity: Major
          Found in .dev/tests/unit/class_security_test.Test.php - About 3 hrs to fix

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

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

              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.
                 */
                Severity: Minor
                Found in plugins/email/classes/yf_email.class.php - About 3 hrs to fix

                  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;
                  Severity: Major
                  Found in plugins/common/classes/common/yf_remote_files.class.php - About 3 hrs to fix

                    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) {
                    Severity: Major
                    Found in plugins/common/modules/yf_advertising.class.php - About 3 hrs to fix

                      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;
                      Severity: Major
                      Found in plugins/shop/modules/shop/yf_shop_products_show.class.php - About 3 hrs to fix

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

                            public function add()
                            {
                                $a = $_POST;
                                return form($a)
                                    ->validate(['name' => 'trim|required'])
                        Severity: Major
                        Found in plugins/geo/admin_modules/yf_manage_cities.class.php and 1 other location - About 3 hrs to fix
                        plugins/geo/admin_modules/yf_manage_regions.class.php on lines 59..77

                        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

                        Further Reading

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

                            public function add()
                            {
                                $a = $_POST;
                                return form($a)
                                    ->validate(['name' => 'trim|required'])
                        Severity: Major
                        Found in plugins/geo/admin_modules/yf_manage_regions.class.php and 1 other location - About 3 hrs to fix
                        plugins/geo/admin_modules/yf_manage_cities.class.php on lines 55..73

                        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

                        Further Reading

                        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'] ?: '';
                        Severity: Major
                        Found in plugins/payment/classes/yf_payment_api__provider_bitaps.class.php - About 3 hrs to fix

                          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;

                          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;
                          Severity: Minor
                          Found in plugins/assets/admin_modules/yf_manage_assets.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 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) {
                          Severity: Minor
                          Found in plugins/html/classes/html5fw/yf_html5fw_bs3.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 _add_bundle has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function _add_bundle($_content, $_params = [])
                              {
                                  if ( ! $_content) {
                                      return false;
                                  }
                          Severity: Minor
                          Found in plugins/assets/classes/yf_assets.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 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;
                                  }
                          Severity: Minor
                          Found in plugins/payment/classes/yf_payment_api__provider_privat24.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