Showing 3,246 of 4,217 total issues

Function object_get has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    function object_get($object, $key, $default = null)
    {
        if ($key === null || trim($key) == '') {
            return $object;
        }
Severity: Minor
Found in functions/yf_array_funcs.php - About 45 mins 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 _build_inherit_parents has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function _build_inherit_parents($parent = '')
{
    $next_parent = $GLOBALS['INHERIT_TREE'][$parent];

    $parents = [];
Severity: Minor
Found in .dev/useful/pack_zend.php - About 45 mins 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

Avoid deeply nested control flow statements.
Open

                    if (preg_last_error() !== PREG_NO_ERROR) {
                        $i = 999;
                        break;
                    }
Severity: Major
Found in functions/yf_strip_tags_smart.php - About 45 mins to fix

    Method _show_avatar has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        function _show_avatar($user_id = 0, $user_name = '', $as_link = 0, $is_middle = 0, $only_img_src = 0, $force_link = '')
    Severity: Minor
    Found in functions/yf_common_funcs.php - About 45 mins to fix

      Consider simplifying this complex logical expression.
      Open

              if( is_payout ) {
                  value = $scope.payment.payout_limit_min || value;
                  var _value = ( $scope.action.payout &&
                      $scope.action.payout.method &&
                      $scope.action.payout.method.amount &&
      Severity: Major
      Found in plugins/content/templates/user/js/ng/payment/balance-recharge.js - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

                if (is_string($_submit) || is_string($action)) {
                    $expanded = 'false';
                    ! @$_is_action && $expanded_in = '';
                    // form
                    $form = '';
        Severity: Major
        Found in plugins/payment/modules/yf_payment_test.class.php - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

                          if (in_array($_storage, ['app', 'project', 'framework'])) {
                              $_theme = $_storage == 'framework' ? MAIN_TYPE : $theme;
                              if (isset($paths[$_storage][$_theme])) {
                                  $file_path = $paths[$_storage][$_theme];
                              }
          Severity: Major
          Found in plugins/tpl/classes/yf_tpl.class.php - About 40 mins to fix

            Consider simplifying this complex logical expression.
            Open

                    if (($count === 3 || $count === 2) && is_string($where[0]) && (is_string($where[1]) || is_numeric($where[1]) || is_array($where[1]))) {
                        if ( ! preg_match(self::REGEX_INLINE_CONDS, $where[0]) && ! preg_match(self::REGEX_INLINE_CONDS, $where[1])) {
                            $sql = $this->_process_where_cond($where[0], $where[1], $where[2]);
                        }
                    }
            Severity: Major
            Found in plugins/db/classes/db/yf_db_query_builder_driver.class.php - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                          if ($url[0] == 'login' || $url[0] == 'logout') {
                              $s = 'task=' . $url[0];
                              if (isset($url[1])) {
                                  $s .= '&id=' . $url[1];
                                  unset($url[1]);
              Severity: Major
              Found in plugins/rewrite/classes/rewrite/yf_rewrite_pattern_yf.class.php - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                        if ((defined('FORCE_RESIZE_IMAGE_SIZE') && filesize($photo_path) > FORCE_RESIZE_IMAGE_SIZE)
                            || defined('FORCE_RESIZE_WIDTH') && $real_image_info[0] > FORCE_RESIZE_WIDTH
                            || defined('FORCE_RESIZE_HEIGHT') && $real_image_info[1] > FORCE_RESIZE_HEIGHT
                        ) {
                            return common()->make_thumb($photo_path, $photo_path, $LIMIT_X, $LIMIT_Y);
                Severity: Major
                Found in plugins/common/classes/common/yf_upload_image.class.php - About 40 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                          if ((defined('FORCE_RESIZE_IMAGE_SIZE') && filesize($photo_path) > FORCE_RESIZE_IMAGE_SIZE)
                              || defined('FORCE_RESIZE_WIDTH') && $real_image_info[0] > FORCE_RESIZE_WIDTH
                              || defined('FORCE_RESIZE_HEIGHT') && $real_image_info[1] > FORCE_RESIZE_HEIGHT
                          ) {
                              return common()->make_thumb($photo_path, $photo_path, $LIMIT_X, $LIMIT_Y);
                  Severity: Major
                  Found in plugins/common/classes/common/yf_multi_upload_image.class.php - About 40 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if ($_POST['year_birth'] >= 1915 && $_POST['year_birth'] <= (date('Y') - 17)
                                && $_POST['month_birth'] >= 1 && $_POST['month_birth'] <= 12
                                && $_POST['day_birth'] >= 1 && $_POST['day_birth'] <= 31
                            ) {
                                if ($_POST['month_birth'] < 10) {
                    Severity: Major
                    Found in classes/yf_validate.class.php - About 40 mins to fix

                      Method time_box2 has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public function time_box2($name, $selected = '', $add_str = '', $show_text = 1, $translate = 1)
                      Severity: Minor
                      Found in plugins/html/classes/html/yf_html_datetime.class.php - About 35 mins to fix

                        Method _combine_content has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            public function _combine_content(array $out, $out_type, array $to_combine, $combined_file, array $md5_inside_combined)
                        Severity: Minor
                        Found in plugins/assets/classes/yf_assets.class.php - About 35 mins to fix

                          Method set_content has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              public function set_content($asset_type, $md5, $content_type, $content, $params = [])
                          Severity: Minor
                          Found in plugins/assets/classes/yf_assets.class.php - About 35 mins to fix

                            Method check_box has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                public function check_box($name = '', $value = '', $selected = '', $add_str = '', $extra = [])
                            Severity: Minor
                            Found in plugins/html/classes/yf_html.class.php - About 35 mins to fix

                              Method time_box2 has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  public function time_box2($name, $selected = '', $add_str = '', $show_text = 1, $translate = 1)
                              Severity: Minor
                              Found in plugins/html/classes/yf_html.class.php - About 35 mins to fix

                                Method _css_urls_rewrite_and_save has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    public function _css_urls_rewrite_and_save($content, $content_url, $cache_path, $content_type = 'url', $orig_content = '')
                                Severity: Minor
                                Found in plugins/assets/classes/yf_assets.class.php - About 35 mins to fix

                                  Method time_box has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      public function time_box($selected = '', $name_postfix = '', $add_str = '', $show_text = 1, $translate = 1)
                                  Severity: Minor
                                  Found in plugins/html/classes/html/yf_html_datetime.class.php - About 35 mins to fix

                                    Method time_box has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                        public function time_box($selected = '', $name_postfix = '', $add_str = '', $show_text = 1, $translate = 1)
                                    Severity: Minor
                                    Found in plugins/html/classes/yf_html.class.php - About 35 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language