Showing 4,217 of 4,217 total issues

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

    public function payment($options)
    {
        if ( ! $this->ENABLE) {
            return  null;
        }
plugins/payment/classes/yf_payment_api__provider_bitpay.class.php on lines 549..570
plugins/payment/classes/yf_payment_api__provider_remote_test.class.php on lines 117..138

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

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

    public function _get_conf($name, $default = null, array $params = [])
    {
        if (isset($params[$name])) {
            return $params[$name];
        }
Severity: Major
Found in plugins/queue/classes/queue/yf_queue_driver_redis.class.php and 2 other locations - About 2 hrs to fix
plugins/pubsub/classes/pubsub/yf_pubsub_driver_redis.class.php on lines 14..32
plugins/redis/classes/yf_wrapper_redlock.class.php on lines 149..167

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

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 _payout_EcommPay has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function _payout_EcommPay($title)
    {
        $payment_api = _class('payment_api');
        $provider_class = $payment_api->provider_class([
            'provider_name' => 'ecommpay',
Severity: Major
Found in plugins/payment/modules/yf_payment_test.class.php - About 2 hrs to fix

    Method repair has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function repair($sql, $db_error, $db)
        {
            $sql = trim($sql);
            // #1191 Can't find FULLTEXT index matching the column list
            if (in_array($db_error['code'], [1191]) && $this->RESTORE_FULLTEXT_INDEX) {
    Severity: Major
    Found in plugins/db/classes/db/yf_db_installer_mysql.class.php - About 2 hrs to fix

      Method product_image_search has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function product_image_search()
          {
              $_GET['id'] = (int) ($_GET['id']);
              if ($_GET['id']) {
                  $product = module('manage_shop')->_product_get_info($_GET['id']);

        Method _compile_if_funcs has 67 lines of code (exceeds 25 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: Major
        Found in plugins/tpl/classes/tpl/yf_tpl_driver_yf_compile.class.php - About 2 hrs to fix

          Method load_data has 67 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function load_data()
              {
                  // Preload db installer SQL CREATE TABLE DDL statements
                  $ext = '.sql.php';
                  $pattern = '{,plugins/*/}{,share/}db/sql/*' . $ext;
          Severity: Major
          Found in plugins/db/classes/db/yf_db_installer.class.php - About 2 hrs to fix

            Method _get_rss_feed_array has 67 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function _get_rss_feed_array($rss_url = '', $feed_ttl = 3600, $num_items = 15)
                {
                    require_php_lib('yf_domit');
            
                    // Prepare cache params
            Severity: Major
            Found in plugins/common/classes/common/yf_rss_data.class.php - About 2 hrs to fix

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

                  public function edit()
                  {
                      if (is_post() && isset($_POST['mass_delete']) && $_POST['id']) {
                          $_GET['action'] = 'delete';
                          return $this->delete();
              Severity: Major
              Found in plugins/redis/admin_modules/yf_manage_redis.class.php - About 2 hrs to fix

                Method _order_view has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function _order_view()
                    {
                        if ($_POST['order_id']) {
                            $_GET['id'] = (int) ($_POST['order_id']);
                        } else {
                Severity: Major
                Found in plugins/shop/modules/shop/yf_shop_order_view.class.php - About 2 hrs to fix

                  Method _show_category_contents has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function _show_category_contents($params = [])
                      {
                          $ICONS_PATH = 'uploads/icons/';
                          $MEDIA_PATH = WEB_PATH;
                          $force_stpl_name = isset($params['force_stpl_name']) ? $params['force_stpl_name'] : false;
                  Severity: Major
                  Found in plugins/categories/admin_modules/yf_category_editor.class.php - About 2 hrs to fix

                    Method _skip_by_pattern has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function _skip_by_pattern($path = '', $_is_dir = false, $pattern_include = '', $pattern_exclude = '')
                        {
                            if ( ! $path) {
                                return false;
                            }
                    Severity: Major
                    Found in classes/yf_dir.class.php - About 2 hrs to fix

                      Method test_load_fixtures has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function test_load_fixtures()
                          {
                              if ($this->_need_skip_test(__FUNCTION__)) {
                                  return;
                              }
                      Severity: Major
                      Found in .dev/tests/functional/model/class_model_sakila_test.Test.php - About 2 hrs to fix

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

                            public function test_31()
                            {
                                _class('encryption')->set_cipher('cast256');
                        
                                $encrypted = _class('encryption')->_safe_encrypt_with_base64(self::$to_encode, self::$secret);
                        Severity: Major
                        Found in .dev/tests/unit/class_encryption_test.php and 1 other location - About 2 hrs to fix
                        .dev/tests/unit/class_encryption_test.php on lines 103..115

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

                        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_21()
                            {
                                _class('encryption')->set_cipher('cast128');
                        
                                $encrypted = _class('encryption')->_safe_encrypt_with_base64(self::$to_encode, self::$secret);
                        Severity: Major
                        Found in .dev/tests/unit/class_encryption_test.php and 1 other location - About 2 hrs to fix
                        .dev/tests/unit/class_encryption_test.php on lines 117..129

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

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

                        <?php
                        
                        load('db_driver', '', 'classes/db/');
                        class yf_db_driver_mysqli extends yf_db_driver
                        {
                        Severity: Minor
                        Found in plugins/db/classes/db/yf_db_driver_mysqli.class.php - About 2 hrs to fix

                          yf_blocks has 24 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class yf_blocks
                          {
                              /***/
                              private $_preload_complete = false;
                          
                          
                          Severity: Minor
                          Found in plugins/sys/admin_modules/yf_blocks.class.php - About 2 hrs to fix

                            class_assets_test has 24 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            class class_assets_test extends PHPUnit\Framework\TestCase
                            // class class_assets_test extends yf\tests\wrapper
                            {
                                public static function setUpBeforeClass() : void
                                {
                            Severity: Minor
                            Found in .dev/tests/unit/class_assets_test.Test.php - About 2 hrs to fix

                              yf_core_install has 24 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              class yf_core_install
                              {
                                  /**
                                   * @param mixed $body
                                   */
                              Severity: Minor
                              Found in .dev/install/install.php - About 2 hrs to fix

                                Method tabs has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function tabs($tabs = [], $extra = [])
                                    {
                                        $extra['id'] = $extra['id'] ?: __FUNCTION__ . '_' . ++$this->_ids[__FUNCTION__];
                                
                                        $extra_by_id = [];
                                Severity: Major
                                Found in plugins/html/classes/yf_html.class.php - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language