Showing 3,246 of 4,217 total issues

Method product_revisions has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function product_revisions()
    {
        $filter_params = [
            'name' => ['like', 'p.name'],
            'action' => ['eq', 'r.action'],

    Method order_revisions_view has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function order_revisions_view()
        {
            $sql = 'SELECT * FROM ' . db('shop_order_revisions') . ' WHERE id=' . (int) ($_GET['id']);
            $a = db()->get($sql);
            $order_info = db()->get('SELECT * FROM ' . db('shop_orders') . ' WHERE id=' . $a['item_id']);

      Method product_revisions_view has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function product_revisions_view()
          {
              $sql = 'SELECT * FROM ' . db('shop_product_revisions') . ' WHERE id=' . (int) ($_GET['id']);
              $a = db()->get($sql);
              $product_info = module('manage_shop')->_product_get_info($a['item_id']);

        Method chart has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function chart($data, $params)
            {
                if ($params['flash'] == true) {
                    return $this->chart_flash($data, $params);
                }
        Severity: Minor
        Found in plugins/charts/classes/yf_charts.class.php - About 1 hr to fix

          Method init_server_id has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function init_server_id()
              {
                  $this->PROFILING && $this->_timing[] = [microtime(true), __CLASS__, __FUNCTION__, $this->trace_string(), func_get_args()];
                  $servers = $this->get_data('servers');
                  $this->SERVER_ID = 0;
          Severity: Minor
          Found in classes/yf_main.class.php - About 1 hr to fix

            Method create_image_versions has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function create_image_versions($uploads_result = null, $options = null)
                {
                    if ( ! is_array($uploads_result) || ! is_array($options['image_versions'])) {
                        return  false;
                    }
            Severity: Minor
            Found in plugins/content/classes/yf_upload_handler.class.php - About 1 hr to fix

              Method scan_dir has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function scan_dir($start_dir, $_tmp = 1, $pattern_include = '', $pattern_exclude = '')
                  {
                      $func = __FUNCTION__;
                      // Here we accept several start folders, result will be merged
                      if (is_array($start_dir)) {
              Severity: Minor
              Found in classes/yf_dir.class.php - About 1 hr to fix

                Method test_replace_safe has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function test_replace_safe()
                    {
                        if ($this->_need_skip_test(__FUNCTION__)) {
                            return;
                        }
                Severity: Minor
                Found in .dev/tests/functional/db/class_db_real_mysql_test.Test.php - About 1 hr to fix

                  Method grid has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function grid()
                      {
                          return _class('html')->grid([
                              [
                                  ['s1'],
                  Severity: Minor
                  Found in .dev/samples/classes/sample_html.class.php - About 1 hr to fix

                    Method _check_location has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function _check_location($cur_country = '', $cur_region = '', $cur_city = '')
                        {
                            // TODO: rewrite me
                            if (FEATURED_COUNTRY_SELECT && ! empty($_POST['country']) && substr($_POST['country'], 0, 2) == 'f_') {
                                $_POST['country'] = substr($_POST['country'], 2);
                    Severity: Minor
                    Found in classes/yf_validate.class.php - About 1 hr to fix

                      Method test_add_foreign_key has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function test_add_foreign_key()
                          {
                              if ($this->_need_skip_test(__FUNCTION__)) {
                                  return;
                              }
                      Severity: Minor
                      Found in .dev/tests/functional/db/class_db_real_utils_mysql_test.Test.php - About 1 hr to fix

                        Method test_min has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function test_min()
                            {
                                if ($this->_need_skip_test(__FUNCTION__)) {
                                    return;
                                }
                        Severity: Minor
                        Found in .dev/tests/unit/db/class_db_offline_query_builder_test.Test.php - About 1 hr to fix

                          Method test_chunk has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function test_chunk()
                              {
                                  if ($this->_need_skip_test(__FUNCTION__)) {
                                      return;
                                  }

                            Method test_max has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function test_max()
                                {
                                    if ($this->_need_skip_test(__FUNCTION__)) {
                                        return;
                                    }
                            Severity: Minor
                            Found in .dev/tests/unit/db/class_db_offline_query_builder_test.Test.php - About 1 hr to fix

                              Method test_sum has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function test_sum()
                                  {
                                      if ($this->_need_skip_test(__FUNCTION__)) {
                                          return;
                                      }
                              Severity: Minor
                              Found in .dev/tests/unit/db/class_db_offline_query_builder_test.Test.php - About 1 hr to fix

                                Method test_group_by has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function test_group_by()
                                    {
                                        if ($this->_need_skip_test(__FUNCTION__)) {
                                            return;
                                        }

                                  Method test_avg has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function test_avg()
                                      {
                                          if ($this->_need_skip_test(__FUNCTION__)) {
                                              return;
                                          }
                                  Severity: Minor
                                  Found in .dev/tests/unit/db/class_db_offline_query_builder_test.Test.php - About 1 hr to fix

                                    Method test_execute has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public function test_execute()
                                        {
                                            $class = get_called_class();
                                            $method = 'return_true';
                                            $this->assertEquals('true', self::_tpl('{execute(' . $class . ',' . $method . ')}'));
                                    Severity: Minor
                                    Found in .dev/tests/unit/tpl/tpl_driver_yf_core_test.Test.php - About 1 hr to fix

                                      Function cache_fill has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          public function cache_fill()
                                          {
                                              $this->cache_purge();
                                              // TODO: use temp dir while caching
                                              // TODO: verify that all files are available
                                      Severity: Minor
                                      Found in plugins/assets/admin_modules/yf_manage_assets.class.php - About 1 hr 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 multi_get has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          public function multi_get(array $names, $ttl = 0, $params = [])
                                          {
                                              if ( ! $this->is_ready()) {
                                                  return null;
                                              }
                                      Severity: Minor
                                      Found in plugins/memcached/classes/yf_wrapper_memcached.class.php - About 1 hr 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