Showing 4,217 of 4,217 total issues

Function _server_info has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public function _server_info($server_id)
    {
        $cached_server_info = &main()->_cached_server_info;
        if (is_numeric($server_id)) {
            $server_id = (int) $server_id;
Severity: Minor
Found in classes/yf_utils.class.php - About 2 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 _check_words_length has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public function _check_words_length($text, $length = 0, $do_encode_email = false)
    {
        if (empty($length)) {
            $length = 60;
            if (SITE_MAX_WORD_LENGTH != 'SITE_MAX_WORD_LENGTH' && SITE_MAX_WORD_LENGTH != '') {
Severity: Minor
Found in classes/yf_utils.class.php - About 2 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

Method _update_user_geo_location has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function _update_user_geo_location($user_id = 0, $FORCE_IP = '')
    {
        if ( ! main()->USE_GEO_IP) {
            return false;
        }
Severity: Major
Found in plugins/geo/classes/yf_geo_ip.class.php - About 2 hrs to fix

    Method _add_asset has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function _add_asset($_content, $asset_type, $_params = [])
        {
            if ( ! $_content) {
                return false;
            }
    Severity: Major
    Found in plugins/assets/classes/yf_assets.class.php - About 2 hrs to fix

      Method prepare has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function prepare($options = null)
          {
              // import options
              is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
              if (empty($_currency_rate)) {
      Severity: Major
      Found in plugins/payment/classes/yf_payment_api__currency.class.php - About 2 hrs to fix

        Method confirmation_code_check has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function confirmation_code_check($options = null)
            {
                // import options
                is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
                // operation
        Severity: Major
        Found in plugins/payment/classes/yf_payment_api.class.php - About 2 hrs to fix

          Method api_request has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Method _user_message has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function _user_message($options = null)
                {
                    $url = &$this->url;
                    // import operation
                    is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
            Severity: Major
            Found in plugins/payment/admin_modules/yf_manage_payout.class.php - About 2 hrs to fix

              Method edit_item has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function edit_item()
                  {
                      // TODO: save file revision to db on each save
                      if ( ! empty($_GET['id'])) {
                          $file_name = urldecode($_GET['id']);
              Severity: Major
              Found in plugins/sys/admin_modules/yf_file_manager.class.php - About 2 hrs to fix

                Method info has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function info($name, $desc = '', $extra = [], $replace = [])
                    {
                        if (is_array($desc)) {
                            $extra = (array) $extra + $desc;
                            $desc = '';
                Severity: Major
                Found in plugins/form2/classes/yf_form2.class.php - About 2 hrs to fix

                  Method _correct_protocol has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function _correct_protocol($url)
                      {
                          if ( ! strlen($url)) {
                              return false;
                          }
                  Severity: Major
                  Found in plugins/rewrite/classes/yf_rewrite.class.php - About 2 hrs to fix

                    Method _send_email_safe has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function _send_email_safe($email_to, $name_to, $template_name, $data = [], $old_param1 = null, $override = [])
                        {
                            $is_test = (defined('TEST_MODE') && TEST_MODE)
                                && empty($override['force_send'])
                                && empty($this->FORCE_SEND);
                    Severity: Major
                    Found in plugins/email/classes/yf_email.class.php - About 2 hrs to fix

                      Method order_by has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function order_by()
                          {
                              $sql = '';
                              $items = func_get_args();
                              $count = count((array) $items);
                      Severity: Major
                      Found in plugins/db/classes/db/yf_db_query_builder_driver.class.php - About 2 hrs to fix

                        Method delete has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function delete()
                            {
                                $i = preg_replace('~[^a-z0-9_]+~ims', '', trim($_GET['i']));
                                if ( ! $i || ! isset($this->instances[$i])) {
                                    return js_redirect('/@object');
                        Severity: Major
                        Found in plugins/redis/admin_modules/yf_manage_redis.class.php - About 2 hrs to fix

                          Method test_selects_basic has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

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

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

                              6 => [
                                'id' => '6',
                                'id2' => '1',
                                'user_name' => 'odlman',
                                'user_id' => '5',
                            .dev/install/installer_data/db_tables_en/blog_posts.data.php on lines 4..41
                            .dev/install/installer_data/db_tables_en/blog_posts.data.php on lines 42..97
                            .dev/install/installer_data/db_tables_en/blog_posts.data.php on lines 98..141
                            .dev/install/installer_data/db_tables_en/blog_posts.data.php on lines 142..179
                            .dev/install/installer_data/db_tables_en/blog_posts.data.php on lines 180..213
                            .dev/install/installer_data/db_tables_ru/blog_posts.data.php on lines 36..87
                            .dev/install/installer_data/db_tables_uk/blog_posts.data.php on lines 4..34
                            .dev/install/installer_data/db_tables_uk/blog_posts.data.php on lines 35..60
                            .dev/install/installer_data/db_tables_uk/blog_posts.data.php on lines 61..89
                            .dev/install/installer_data/db_tables_uk/blog_posts.data.php on lines 90..124

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

                            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 11 locations. Consider refactoring.
                            Open

                              7 => [
                                'id' => '7',
                                'id2' => '1',
                                'user_name' => 'kingargyle',
                                'user_id' => '6',
                            .dev/install/installer_data/db_tables_en/blog_posts.data.php on lines 4..41
                            .dev/install/installer_data/db_tables_en/blog_posts.data.php on lines 42..97
                            .dev/install/installer_data/db_tables_en/blog_posts.data.php on lines 98..141
                            .dev/install/installer_data/db_tables_en/blog_posts.data.php on lines 142..179
                            .dev/install/installer_data/db_tables_en/blog_posts.data.php on lines 180..213
                            .dev/install/installer_data/db_tables_ru/blog_posts.data.php on lines 4..35
                            .dev/install/installer_data/db_tables_uk/blog_posts.data.php on lines 4..34
                            .dev/install/installer_data/db_tables_uk/blog_posts.data.php on lines 35..60
                            .dev/install/installer_data/db_tables_uk/blog_posts.data.php on lines 61..89
                            .dev/install/installer_data/db_tables_uk/blog_posts.data.php on lines 90..124

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

                            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 11 locations. Consider refactoring.
                            Open

                              1 => [
                                'id' => '1',
                                'id2' => '1',
                                'user_name' => 'test',
                                'user_id' => '1',
                            .dev/install/installer_data/db_tables_en/blog_posts.data.php on lines 42..97
                            .dev/install/installer_data/db_tables_en/blog_posts.data.php on lines 98..141
                            .dev/install/installer_data/db_tables_en/blog_posts.data.php on lines 142..179
                            .dev/install/installer_data/db_tables_en/blog_posts.data.php on lines 180..213
                            .dev/install/installer_data/db_tables_ru/blog_posts.data.php on lines 4..35
                            .dev/install/installer_data/db_tables_ru/blog_posts.data.php on lines 36..87
                            .dev/install/installer_data/db_tables_uk/blog_posts.data.php on lines 4..34
                            .dev/install/installer_data/db_tables_uk/blog_posts.data.php on lines 35..60
                            .dev/install/installer_data/db_tables_uk/blog_posts.data.php on lines 61..89
                            .dev/install/installer_data/db_tables_uk/blog_posts.data.php on lines 90..124

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

                            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 11 locations. Consider refactoring.
                            Open

                              2 => [
                                'id' => '2',
                                'id2' => '1',
                                'user_name' => 'kingargyle',
                                'user_id' => '6',
                            .dev/install/installer_data/db_tables_en/blog_posts.data.php on lines 4..41
                            .dev/install/installer_data/db_tables_en/blog_posts.data.php on lines 98..141
                            .dev/install/installer_data/db_tables_en/blog_posts.data.php on lines 142..179
                            .dev/install/installer_data/db_tables_en/blog_posts.data.php on lines 180..213
                            .dev/install/installer_data/db_tables_ru/blog_posts.data.php on lines 4..35
                            .dev/install/installer_data/db_tables_ru/blog_posts.data.php on lines 36..87
                            .dev/install/installer_data/db_tables_uk/blog_posts.data.php on lines 4..34
                            .dev/install/installer_data/db_tables_uk/blog_posts.data.php on lines 35..60
                            .dev/install/installer_data/db_tables_uk/blog_posts.data.php on lines 61..89
                            .dev/install/installer_data/db_tables_uk/blog_posts.data.php on lines 90..124

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

                            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 11 locations. Consider refactoring.
                            Open

                              5 => [
                                'id' => '5',
                                'id2' => '1',
                                'user_name' => 'kingargyle',
                                'user_id' => '6',
                            .dev/install/installer_data/db_tables_en/blog_posts.data.php on lines 4..41
                            .dev/install/installer_data/db_tables_en/blog_posts.data.php on lines 42..97
                            .dev/install/installer_data/db_tables_en/blog_posts.data.php on lines 98..141
                            .dev/install/installer_data/db_tables_en/blog_posts.data.php on lines 142..179
                            .dev/install/installer_data/db_tables_ru/blog_posts.data.php on lines 4..35
                            .dev/install/installer_data/db_tables_ru/blog_posts.data.php on lines 36..87
                            .dev/install/installer_data/db_tables_uk/blog_posts.data.php on lines 4..34
                            .dev/install/installer_data/db_tables_uk/blog_posts.data.php on lines 35..60
                            .dev/install/installer_data/db_tables_uk/blog_posts.data.php on lines 61..89
                            .dev/install/installer_data/db_tables_uk/blog_posts.data.php on lines 90..124

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

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language