plugins/cache/classes/yf_cache.class.php

Summary

Maintainability
F
6 days
Test Coverage

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

<?php

/**
 * Caching layer.
 *
Severity: Major
Found in plugins/cache/classes/yf_cache.class.php - About 1 day to fix

    Function multi_get has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        public function multi_get($names = [], $force_ttl = 0, $params = [])
        {
            $do_real_work = true;
            if ( ! $this->_driver_ok || $this->NO_CACHE) {
                $do_real_work = false;
    Severity: Minor
    Found in plugins/cache/classes/yf_cache.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

    Function multi_set has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        public function multi_set($data = [], $ttl = 0)
        {
            $do_real_work = true;
            if ( ! $this->_driver_ok || $this->NO_CACHE) {
                $do_real_work = false;
    Severity: Minor
    Found in plugins/cache/classes/yf_cache.class.php - About 3 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

    Function del_by_prefix has a Cognitive Complexity of 26 (exceeds 5 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 3 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

    Function multi_del has a Cognitive Complexity of 22 (exceeds 5 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 3 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

    yf_cache has 26 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class yf_cache
    {
        /** @var int Cache entries time-to-live (in seconds) */
        public $TTL = 3600;
        /** @var string Cache driver to use */
    Severity: Minor
    Found in plugins/cache/classes/yf_cache.class.php - About 3 hrs to fix

      Function list_keys has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          public function list_keys()
          {
              $do_real_work = true;
              if ( ! $this->_driver_ok) {
                  $do_real_work = false;
      Severity: Minor
      Found in plugins/cache/classes/yf_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

      Function _init_settings has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public function _init_settings($params = [])
          {
              // backwards compatibility
              if ($this->FILES_TTL) {
                  $this->TTL = $this->FILES_TTL;
      Severity: Minor
      Found in plugins/cache/classes/yf_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 multi_get has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Method multi_set has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function multi_set($data = [], $ttl = 0)
            {
                $do_real_work = true;
                if ( ! $this->_driver_ok || $this->NO_CACHE) {
                    $do_real_work = false;
        Severity: Minor
        Found in plugins/cache/classes/yf_cache.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 list_keys has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function list_keys()
                  {
                      $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 _init_settings has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function _init_settings($params = [])
                    {
                        // backwards compatibility
                        if ($this->FILES_TTL) {
                            $this->TTL = $this->FILES_TTL;
                Severity: Minor
                Found in plugins/cache/classes/yf_cache.class.php - About 1 hr to fix

                  Method get has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function get($name, $force_ttl = 0, array $params = [])
                      {
                          if ($name === false || $name === null || ! is_string($name)) {
                              return null;
                          }
                  Severity: Minor
                  Found in plugins/cache/classes/yf_cache.class.php - About 1 hr to fix

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

                        public function set($name, $data, $ttl = 0)
                        {
                            if ($name === false || $name === null) {
                                return null;
                            }
                    Severity: Minor
                    Found in plugins/cache/classes/yf_cache.class.php - About 1 hr to fix

                      Method del has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function del($name)
                          {
                              if ($name === false || $name === null) {
                                  return null;
                              }
                      Severity: Minor
                      Found in plugins/cache/classes/yf_cache.class.php - About 1 hr to fix

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

                            public function _connect($params = [])
                            {
                                if ( ! $this->DRIVER) {
                                    return null;
                                }
                        Severity: Minor
                        Found in plugins/cache/classes/yf_cache.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

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

                            public function get($name, $force_ttl = 0, array $params = [])
                            {
                                if ($name === false || $name === null || ! is_string($name)) {
                                    return null;
                                }
                        Severity: Minor
                        Found in plugins/cache/classes/yf_cache.class.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 set has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function set($name, $data, $ttl = 0)
                            {
                                if ($name === false || $name === null) {
                                    return null;
                                }
                        Severity: Minor
                        Found in plugins/cache/classes/yf_cache.class.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 del has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function del($name)
                            {
                                if ($name === false || $name === null) {
                                    return null;
                                }
                        Severity: Minor
                        Found in plugins/cache/classes/yf_cache.class.php - About 35 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 _get_avail_drivers_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function _get_avail_drivers_list()
                            {
                                $prefix = 'cache_driver_';
                                $suffix = '.class.php';
                                $plen = strlen($prefix);
                        Severity: Minor
                        Found in plugins/cache/classes/yf_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

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

                            public function getset($name, callable $func, $ttl = 0, array $params = [])
                            {
                                if ($name === false || $name === null || ! is_string($name)) {
                                    return null;
                                }
                        Severity: Minor
                        Found in plugins/cache/classes/yf_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