plugins/cache/classes/yf_output_cache.class.php

Summary

Maintainability
C
1 day
Test Coverage

Function _check_if_need_to_cache has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public function _check_if_need_to_cache()
    {
        // Fast implementation of disabling output caching for the current page
        if (conf('no_output_cache')) {
            $this->NO_NEED_TO_CACHE = true;
Severity: Minor
Found in plugins/cache/classes/yf_output_cache.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 _check_if_need_to_cache has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function _check_if_need_to_cache()
    {
        // Fast implementation of disabling output caching for the current page
        if (conf('no_output_cache')) {
            $this->NO_NEED_TO_CACHE = true;
Severity: Minor
Found in plugins/cache/classes/yf_output_cache.class.php - About 1 hr to fix

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

        public function _init($params = [])
        {
            // Assign group_id = 1 for guests
            if (empty($_SESSION['user_group'])) {
                $_SESSION['user_group'] = 1;
    Severity: Minor
    Found in plugins/cache/classes/yf_output_cache.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

    Avoid too many return statements within this method.
    Open

            return false; // Default return value
    Severity: Major
    Found in plugins/cache/classes/yf_output_cache.class.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

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

        Avoid too many return statements within this method.
        Open

                        return $this->NO_NEED_TO_CACHE;
        Severity: Major
        Found in plugins/cache/classes/yf_output_cache.class.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                              return $this->NO_NEED_TO_CACHE;
          Severity: Major
          Found in plugins/cache/classes/yf_output_cache.class.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                                return $this->NO_NEED_TO_CACHE;
            Severity: Major
            Found in plugins/cache/classes/yf_output_cache.class.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                                  return $this->NO_NEED_TO_CACHE;
              Severity: Major
              Found in plugins/cache/classes/yf_output_cache.class.php - About 30 mins to fix

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

                    public function _send_http_headers($cache_last_modified_time = 0)
                    {
                        // Send correct headers
                        header('Content-Type: text/html; charset=' . conf('charset'), 1);
                        header('Content-language: ' . conf('language'), 1);
                Severity: Minor
                Found in plugins/cache/classes/yf_output_cache.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