Showing 4,217 of 4,217 total issues

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

        if ($params['include_app']) {
            $params['find_php'] && $files['app']['php'] = $this->_scan_files('app', 'php', $params);
            $params['find_stpl'] && $files['app']['stpl'] = $this->_scan_files('app', 'stpl', $params);
            $params['find_angular'] && $files['app']['ng'] = $this->_scan_files('app', 'ng', $params);
        }
plugins/locale/admin_modules/locale_editor/yf_locale_editor_collect.class.php on lines 108..112

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

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

        if ($params['include_framework']) {
            $params['find_php'] && $files['framework']['php'] = $this->_scan_files('framework', 'php', $params);
            $params['find_stpl'] && $files['framework']['stpl'] = $this->_scan_files('framework', 'stpl', $params);
            $params['find_angular'] && $files['framework']['ng'] = $this->_scan_files('framework', 'ng', $params);
        }
plugins/locale/admin_modules/locale_editor/yf_locale_editor_collect.class.php on lines 113..117

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

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

    public function check_box($name = '', $value = '', $selected = '', $add_str = '', $extra = [])
    {
        if (is_array($name)) {
            $extra = (array) $extra + $name;
            $name = $extra['name'];
Severity: Minor
Found in plugins/html/classes/yf_html.class.php - About 1 hr to fix

    Method time_box2 has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function time_box2($name, $selected = '', $add_str = '', $show_text = 1, $translate = 1)
        {
            if (is_array($selected)) {
                $extra = (array) $extra + $name;
                $name = $extra['name'];
    Severity: Minor
    Found in plugins/html/classes/html/yf_html_datetime.class.php - About 1 hr to fix

      Method time_box has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function time_box($selected = '', $name_postfix = '', $add_str = '', $show_text = 1, $translate = 1)
          {
              if (is_array($selected)) {
                  $extra = (array) $extra + $name;
                  $selected = $extra['selected'];
      Severity: Minor
      Found in plugins/html/classes/html/yf_html_datetime.class.php - About 1 hr to fix

        Method _on_validate_ok has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function _on_validate_ok($params = [], $form)
            {
                $vars_db = $this->_parent->_get_all_vars_from_db();
                $found_vars = $this->_parse_sources($params);
        
        

          Method _currency_rates_load has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function _currency_rates_load($options = null)
              {
                  // import options
                  is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
                  // var
          Severity: Minor
          Found in plugins/payment/modules/yf_payment_test.class.php - About 1 hr to fix

            Method payment has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function payment($options = null)
                {
                    $_ = &$options;
                    $is_transaction = isset( $_['is_transaction'] ) ? $_['is_transaction'] : true;
                    $_['type_name'] = __FUNCTION__;
            Severity: Minor
            Found in plugins/payment/classes/yf_payment_api.class.php - About 1 hr to fix

              Method view_item has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function view_item()
                  {
                      if ( ! empty($_GET['id'])) {
                          $file_name = urldecode($_GET['id']);
                          $file_path = $file_name;
              Severity: Minor
              Found in plugins/sys/admin_modules/yf_file_manager.class.php - About 1 hr to fix

                Method _form_options has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Method clone_item has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function clone_item($params = [])
                      {
                          if (is_string($params)) {
                              $params = [
                                  'table' => $params,
                  Severity: Minor
                  Found in plugins/sys/classes/yf_admin_methods.class.php - About 1 hr to fix

                    Method _payout_status_handler has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function _payout_status_handler($xml)
                        {
                            if ( ! $this->ENABLE) {
                                return  null;
                            }
                    Severity: Minor
                    Found in plugins/payment/classes/yf_payment_api__provider_webmoney.class.php - About 1 hr to fix

                      Method __api_response__success has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function __api_response__success($operation_id, $response)
                          {
                              if ( ! $this->ENABLE) {
                                  return  null;
                              }
                      Severity: Minor
                      Found in plugins/payment/classes/yf_payment_api__provider_webmoney.class.php - About 1 hr to fix

                        Method stars_select has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function stars_select($name = '', $desc = '', $extra = [], $replace = [], $form)
                            {
                                if (is_array($desc)) {
                                    $extra += $desc;
                                    $desc = '';
                        Severity: Minor
                        Found in plugins/form2/classes/form2/yf_form2_stars.class.php - About 1 hr to fix

                          Method truncate_database has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function truncate_database($db_name, $extra = [], &$error = false)
                              {
                                  if ( ! strlen($db_name)) {
                                      $error = 'db_name is empty';
                                      return false;
                          Severity: Minor
                          Found in plugins/db/classes/db/yf_db_utils_mysql.class.php - About 1 hr to fix

                            Method add_foreign_key has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function add_foreign_key($table, $index_name = '', $fields = [], $ref_table = '', $ref_fields = [], $extra = [], &$error = false)
                                {
                                    if (is_array($table)) {
                                        $extra = (array) $extra + $table;
                                        $table = '';
                            Severity: Minor
                            Found in plugins/db/classes/db/yf_db_utils_driver.class.php - About 1 hr to fix

                              Method add_index has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function add_index($table, $index_name = '', $fields = [], $extra = [], &$error = false)
                                  {
                                      if (is_array($table)) {
                                          $extra = (array) $extra + $table;
                                          $table = '';
                              Severity: Minor
                              Found in plugins/db/classes/db/yf_db_utils_driver.class.php - About 1 hr to fix

                                Method _check_if_need_to_cache has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function _check_if_need_to_cache()
                                    {
                                        // Fast implementation of disabling output caching for the current page
                                        if (conf('no_output_cache')) {
                                            $this->NO_NEED_TO_CACHE = true;
                                Severity: Minor
                                Found in plugins/cache/classes/yf_output_cache.class.php - About 1 hr to fix

                                  Method _get_available_widgets_hooks has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function _get_available_widgets_hooks()
                                      {
                                          if (isset($this->_avail_widgets)) {
                                              return $this->_avail_widgets;
                                          }
                                  Severity: Minor
                                  Found in plugins/common/classes/common/yf_dashboards.class.php - About 1 hr to fix

                                    Method _unaccent_test2 has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public function _unaccent_test2($string = '')
                                        {
                                            $transliteration = [
                                                'À' => 'A', 'Á' => 'A', 'Â' => 'A', 'Ã' => 'A', 'Ä' => 'A',
                                                'Å' => 'A', 'Æ' => 'A', 'Ā' => 'A', 'Ą' => 'A', 'Ă' => 'A',
                                    Severity: Minor
                                    Found in plugins/common/classes/common/yf_utf8_clean.class.php - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language