Showing 3,246 of 4,217 total issues

Function _connect has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function _connect()
    {
        if (isset($this->sphinx_connection)) {
            return $this->sphinx_connection;
        }
Severity: Minor
Found in plugins/search/classes/yf_sphinxsearch.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 _attrs_string2array has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    function _attrs_string2array($string = '', $strip_quotes = true)
    {
        $output_array = [];
        if ( ! is_string($string)) {
            return [];
Severity: Minor
Found in functions/yf_common_funcs.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

Method _load_lang_get_vars_from_files has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function _load_lang_get_vars_from_files($lang)
    {
        $files = [];
        // Auto-find shared language vars. They will be connected in order of file system
        // Names can be any, but better to include lang name into file name. Examples:
Severity: Minor
Found in plugins/locale/classes/yf_i18n.class.php - About 1 hr to fix

    Method _filter_form_balance has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function _filter_form_balance($filter, $replace)
        {
            $order_fields = [];
            foreach (explode('|', 'operation_id|datetime_update|datetime_start|datetime_finish|title|amount|balance') as $f) {
                $order_fields[$f] = $f;
    Severity: Minor
    Found in plugins/payment/admin_modules/yf_manage_payment.class.php - About 1 hr to fix

      Method csv has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function csv()
          {
              // class
              $payment_api = &$this->payment_api;
              $provider_class = $payment_api->provider_class([
      Severity: Minor
      Found in plugins/payment/admin_modules/yf_manage_payout.class.php - About 1 hr to fix

        Method currency_conversion_payout has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function currency_conversion_payout($options)
            {
                // import options
                is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
                // var
        Severity: Minor
        Found in plugins/payment/classes/yf_payment_api__provider_remote.class.php - About 1 hr to fix

          Method _operation_form has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function _operation_form()
              {
                  // import options
                  is_array($_GET) && extract($_GET, EXTR_PREFIX_ALL | EXTR_REFS, '');
                  is_array($_POST) && extract($_POST, EXTR_PREFIX_ALL | EXTR_REFS, '_');
          Severity: Minor
          Found in plugins/payment/modules/yf_payment.class.php - About 1 hr to fix

            Method _operation_balance_update has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

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

                  public function edit()
                  {
                      $_GET['id'] = (int) ($_GET['id']);
                      // Do save data
                      if ( ! empty($_POST)) {
              Severity: Minor
              Found in plugins/sys/admin_modules/yf_manage_advertising.class.php - About 1 hr to fix

                Method table_info has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function table_info($table, $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 _get_admin_daily_info has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function _get_admin_daily_info($sql, $days = 60, $admin_ids = [])
                      {
                          if ( ! $admin_ids) {
                              return false;
                          }
                  Severity: Minor
                  Found in plugins/admin/admin_modules/yf_admin.class.php - About 1 hr to fix

                    Method multi_del has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function multi_del($names = [])
                        {
                            $do_real_work = true;
                            if ( ! $this->_driver_ok) {
                                $do_real_work = false;
                    Severity: Minor
                    Found in plugins/cache/classes/yf_cache.class.php - About 1 hr to fix

                      Method del_by_prefix has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function del_by_prefix($prefix = '')
                          {
                              $do_real_work = true;
                              if ( ! $this->_driver_ok) {
                                  $do_real_work = false;
                      Severity: Minor
                      Found in plugins/cache/classes/yf_cache.class.php - About 1 hr to fix

                        Method _render_table_td has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function _render_table_td($info, $row, $params, $row_id)
                            {
                                $name = $info['name'];
                                if ( ! array_key_exists($name, $row)) {
                                    return false;
                        Severity: Minor
                        Found in plugins/table2/classes/yf_table2.class.php - About 1 hr to fix

                          Method view has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function view($params = [])
                              {
                                  if ( ! is_array($params)) {
                                      $params = [];
                                  }
                          Severity: Minor
                          Found in plugins/dashboards/admin_modules/yf_manage_dashboards.class.php - About 1 hr to fix

                            Method test_yf_db_installer_create_missing_table has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function test_yf_db_installer_create_missing_table()
                                {
                                    $bak['ERROR_AUTO_REPAIR'] = self::db()->ERROR_AUTO_REPAIR;
                                    self::db()->ERROR_AUTO_REPAIR = true;
                            
                            

                              Method execute has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function execute(InputInterface $input, OutputInterface $output)
                                  {
                                      global $yf_paths;
                                      require_once $yf_paths['db_setup_path'];
                                      init_yf();
                              Severity: Minor
                              Found in .dev/console/commands/yf_console_db_migrate.class.php - About 1 hr to fix

                                Method test_sakila_basic has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

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

                                  Method test_order7 has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function test_order7()
                                      {
                                          $jquery_url = _class('assets')->get_asset('jquery', 'js');
                                          $url = $jquery_url;
                                          $url1 = $url . '?v=1';
                                  Severity: Minor
                                  Found in .dev/tests/unit/class_assets_test.Test.php - About 1 hr to fix

                                    Method test_update_batch has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public function test_update_batch()
                                        {
                                            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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language