Showing 3,246 of 4,217 total issues

Method _init has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function _init()
    {
        $shop = module('shop');
        $shop->_shop_cats = _class('cats')->_get_items_names('shop_cats');
        $shop->_shop_cats_all = _class('cats')->_get_items_array('shop_cats');
Severity: Minor
Found in plugins/shop/modules/yf_shop.class.php - About 1 hr to fix

    Method store_admin_auth has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function store_admin_auth($A = [])
        {
            // Check if looging needed
            if ( ! is_array($A) || ! $this->_LOGGING) {
                return false;
    Severity: Minor
    Found in plugins/logs/classes/yf_logs.class.php - About 1 hr to fix

      Method show_visits_stats has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function show_visits_stats()
          {
              if (empty(main()->USER_ID)) {
                  return _error_need_login();
              }
      Severity: Minor
      Found in plugins/user/modules/yf_user_profile.class.php - About 1 hr to fix

        Method _find_site_path_best_match has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function _find_site_path_best_match($sites, $server_ip, $server_port, $server_host)
            {
                $sip = explode('.', $server_ip);
                $sh = array_reverse(explode('.', $server_host));
                $sh2 = explode('.', $server_host);
        Severity: Minor
        Found in classes/yf_main.class.php - About 1 hr to fix

          Method _force_close_bb_codes has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function _force_close_bb_codes($text = '')
              {
                  $this->_preload_data();
                  $add_text = '';
                  $opened_codes = $closed_codes = [];
          Severity: Minor
          Found in plugins/content/classes/yf_bb_codes.class.php - About 1 hr to fix

            Method _view has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function _view()
                {
                    $a = $this->_get_info();
                    if ( ! $a || ! $a['active']) {
                        return _404('Not found');
            Severity: Minor
            Found in plugins/content/modules/yf_news.class.php - About 1 hr to fix

              Method _account_info has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function _account_info($account_id)
                  {
                      $cached_account_info = &main()->_cached_account_info;
                      if (is_numeric($account_id)) {
                          $account_id = (int) $account_id;
              Severity: Minor
              Found in classes/yf_utils.class.php - About 1 hr to fix

                Method get_all_methods has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function get_all_methods($section = 'all', $privacy = '')
                    {
                        $data = [];
                        $func = 'get_methods';
                        if ($privacy == 'public') {
                Severity: Minor
                Found in .dev/samples/classes/sample_core_api.class.php - About 1 hr to fix

                  Method _server_info has 28 lines of code (exceeds 25 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 1 hr to fix

                    Method show has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function show()
                        {
                            $docs = _class('docs');
                            $dir = $docs->docs_dir;
                            $dir_len = strlen($dir);
                    Severity: Minor
                    Found in .dev/samples/classes/sample_misc.class.php - About 1 hr to fix

                      Method test_limit has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function test_limit()
                          {
                              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_cleanup_31 has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function test_cleanup_31()
                            {
                                $closure = function ($in) {
                                    return module('register')->_login_not_exists($in);
                                };
                        Severity: Minor
                        Found in .dev/tests/unit/class_validate_test.Test.php - About 1 hr to fix

                          Method test_valid_hostname has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function test_valid_hostname()
                              {
                                  $this->assertTrue(_class('validate')->valid_hostname('yahoo.com'));
                                  $this->assertTrue(_class('validate')->valid_hostname('facebook.com'));
                                  $this->assertTrue(_class('validate')->valid_hostname('google.to.cc'));
                          Severity: Minor
                          Found in .dev/tests/unit/class_validate_test.Test.php - About 1 hr to fix

                            Method test_update has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function test_update()
                                {
                                    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_1 has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function test_1()
                                  {
                                      $test_array = [
                                          '172.19.177.198, 170.51.255.218' => '170.51.255.218',
                                          '172.19.177.198, 10.21.0.218' => '',
                              Severity: Minor
                              Found in .dev/tests/unit/functions/function_check_ip_test.Test.php - About 1 hr to fix

                                Method write_admin_index_php has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function write_admin_index_php($rewrite_enabled = true)
                                    {
                                        $admin_index_file_content = '<?php
                                $dev_settings = dirname(dirname(__DIR__)).\'/.dev/override.php\';
                                if (file_exists($dev_settings)) {
                                Severity: Minor
                                Found in .dev/install/install.php - About 1 hr to fix

                                  Function li has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public function li($data = [], $extra = [])
                                      {
                                          $extra['id'] = $extra['id'] ?: __FUNCTION__ . '_' . ++$this->_ids[__FUNCTION__];
                                          $items = [];
                                          foreach ((array) $data as $v) {
                                  Severity: Minor
                                  Found in plugins/html/classes/yf_html.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 set has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public function set($name, $data, $ttl = 0)
                                      {
                                          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

                                  Function media_objects has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public function media_objects($data = [], $extra = [])
                                      {
                                          $extra['id'] = $extra['id'] ?: __FUNCTION__ . '_' . ++$this->_ids[__FUNCTION__];
                                          if ($data) {
                                              $data = $this->_recursive_sort_items($data);
                                  Severity: Minor
                                  Found in plugins/html/classes/yf_html.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 _get_var_info has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public function _get_var_info($id)
                                      {
                                          $id = trim($id);
                                          if ( ! strlen($id)) {
                                              return [];
                                  Severity: Minor
                                  Found in plugins/locale/admin_modules/yf_locale_editor.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