plugins/sys/classes/yf_core_blocks.class.php

Summary

Maintainability
F
6 days
Test Coverage

Function tasks has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
Open

    public function tasks($allowed_check = false)
    {
        $main = main();
        if ($main->is_console() || $main->is_ajax()) {
            $main->no_graphics(true);
Severity: Minor
Found in plugins/sys/classes/yf_core_blocks.class.php - About 1 day 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_block_rights has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

    public function _check_block_rights($block_id = 0, $OBJECT = '', $ACTION = '')
    {
        if (empty($block_id) || empty($OBJECT)) {
            return false;
        }
Severity: Minor
Found in plugins/sys/classes/yf_core_blocks.class.php - About 6 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

File yf_core_blocks.class.php has 413 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Core blocks methods.
 *
Severity: Minor
Found in plugins/sys/classes/yf_core_blocks.class.php - About 5 hrs to fix

    Consider simplifying this complex logical expression.
    Open

                if (( ! is_array($rule_info['methods']) || $matched_method)
                    && ( ! is_array($rule_info['user_groups']) || $matched_user_group)
                    && ( ! is_array($rule_info['themes']) || $matched_theme || ! $CUR_USER_THEME)
                    && ( ! is_array($rule_info['locales']) || $matched_locale || ! $CUR_LOCALE)
                    && ( ! is_array($rule_info['site_ids']) || $matched_site || ! $CUR_SITE)
    Severity: Critical
    Found in plugins/sys/classes/yf_core_blocks.class.php - About 5 hrs to fix

      Function _show_block has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

          public function _show_block($input = [])
          {
              if ( ! isset($this->_blocks_infos)) {
                  $this->_blocks_infos = main()->get_data('blocks_all');
              }
      Severity: Minor
      Found in plugins/sys/classes/yf_core_blocks.class.php - About 4 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 tasks has 105 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function tasks($allowed_check = false)
          {
              $main = main();
              if ($main->is_console() || $main->is_ajax()) {
                  $main->no_graphics(true);
      Severity: Major
      Found in plugins/sys/classes/yf_core_blocks.class.php - About 4 hrs to fix

        Method _show_block has 73 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function _show_block($input = [])
            {
                if ( ! isset($this->_blocks_infos)) {
                    $this->_blocks_infos = main()->get_data('blocks_all');
                }
        Severity: Major
        Found in plugins/sys/classes/yf_core_blocks.class.php - About 2 hrs to fix

          Method _check_block_rights has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function _check_block_rights($block_id = 0, $OBJECT = '', $ACTION = '')
              {
                  if (empty($block_id) || empty($OBJECT)) {
                      return false;
                  }
          Severity: Major
          Found in plugins/sys/classes/yf_core_blocks.class.php - About 2 hrs to fix

            Function _action_on_block_denied has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                public function _action_on_block_denied($block_name = '')
                {
                    if ($block_name == 'center_area') {
                        if ($this->TASK_DENIED_403_HEADER) {
                            header(($_SERVER['SERVER_PROTOCOL'] ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1') . ' 403 Forbidden');
            Severity: Minor
            Found in plugins/sys/classes/yf_core_blocks.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_denied_tasks_names has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                public function _get_denied_tasks_names()
                {
                    $cache = 'cache_' . __FUNCTION__;
                    if (isset($this->$cache)) {
                        return $this->$cache;
            Severity: Minor
            Found in plugins/sys/classes/yf_core_blocks.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 prefetch_center has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                public function prefetch_center()
                {
                    $block_name = 'center_area';
                    if ( ! isset($this->_blocks_infos)) {
                        $this->_blocks_infos = main()->get_data('blocks_all');
            Severity: Minor
            Found in plugins/sys/classes/yf_core_blocks.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

            Method _get_denied_tasks_names has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function _get_denied_tasks_names()
                {
                    $cache = 'cache_' . __FUNCTION__;
                    if (isset($this->$cache)) {
                        return $this->$cache;
            Severity: Minor
            Found in plugins/sys/classes/yf_core_blocks.class.php - About 1 hr to fix

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

                  public function prefetch_center()
                  {
                      $block_name = 'center_area';
                      if ( ! isset($this->_blocks_infos)) {
                          $this->_blocks_infos = main()->get_data('blocks_all');
              Severity: Minor
              Found in plugins/sys/classes/yf_core_blocks.class.php - About 1 hr to fix

                Function _load_blocks_rules has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function _load_blocks_rules()
                    {
                        if ( ! empty($this->_blocks_rules)) {
                            return false;
                        }
                Severity: Minor
                Found in plugins/sys/classes/yf_core_blocks.class.php - About 55 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 too many return statements within this method.
                Open

                        return $this->tasks($allowed_check = true);
                Severity: Major
                Found in plugins/sys/classes/yf_core_blocks.class.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return false;
                  Severity: Major
                  Found in plugins/sys/classes/yf_core_blocks.class.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return $this->_action_on_block_denied($block_name);
                    Severity: Major
                    Found in plugins/sys/classes/yf_core_blocks.class.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                          return $obj->$special_method_name($special_params);
                      Severity: Major
                      Found in plugins/sys/classes/yf_core_blocks.class.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                return ($prepend ? implode(PHP_EOL, $prepend) : '') . $body . ($append ? implode(PHP_EOL, $append) : '');
                        Severity: Major
                        Found in plugins/sys/classes/yf_core_blocks.class.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                          return false;
                          Severity: Major
                          Found in plugins/sys/classes/yf_core_blocks.class.php - About 30 mins to fix

                            Function _get_center_block_id has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function _get_center_block_id()
                                {
                                    if ( ! isset($this->_blocks_infos)) {
                                        $this->_blocks_infos = main()->get_data('blocks_all');
                                    }
                            Severity: Minor
                            Found in plugins/sys/classes/yf_core_blocks.class.php - About 25 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

                            There are no issues that match your filters.

                            Category
                            Status