plugins/redis/classes/yf_wrapper_redis.class.php

Summary

Maintainability
D
2 days
Test Coverage

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

<?php

/**
 * Redis API wrapper.
 */
Severity: Minor
Found in plugins/redis/classes/yf_wrapper_redis.class.php - About 4 hrs to fix

    Function diff_config has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public function diff_config($options = [])
        {
            if ( ! $options || ! is_array($options)) {
                return  null;
            }
    Severity: Minor
    Found in plugins/redis/classes/yf_wrapper_redis.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

    yf_wrapper_redis has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class yf_wrapper_redis
    {
        public $name = 'REDIS';    // instance name
        public $driver = 'phpredis'; // predis|phpredis
    
    
    Severity: Minor
    Found in plugins/redis/classes/yf_wrapper_redis.class.php - About 2 hrs to fix

      Method diff_config has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function diff_config($options = [])
          {
              if ( ! $options || ! is_array($options)) {
                  return  null;
              }
      Severity: Minor
      Found in plugins/redis/classes/yf_wrapper_redis.class.php - About 1 hr to fix

        Function call_try has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public function call_try($name, $args)
            {
                $result = null;
                $call_try = $this->call_try;
                while ($call_try > 0) {
        Severity: Minor
        Found in plugins/redis/classes/yf_wrapper_redis.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_conf has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function _get_conf($key = null, array $options = [])
            {
                // lower
                $k = strtolower($key);
                if ( ! isset($this->config_default[$k])) {
        Severity: Minor
        Found in plugins/redis/classes/yf_wrapper_redis.class.php - About 1 hr to fix

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

              public function _get_conf($key = null, array $options = [])
              {
                  // lower
                  $k = strtolower($key);
                  if ( ! isset($this->config_default[$k])) {
          Severity: Minor
          Found in plugins/redis/classes/yf_wrapper_redis.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

          Avoid too many return statements within this method.
          Open

                      return $val;
          Severity: Major
          Found in plugins/redis/classes/yf_wrapper_redis.class.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return $from_conf;
            Severity: Major
            Found in plugins/redis/classes/yf_wrapper_redis.class.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return $default;
              Severity: Major
              Found in plugins/redis/classes/yf_wrapper_redis.class.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return $from_env;
                Severity: Major
                Found in plugins/redis/classes/yf_wrapper_redis.class.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

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

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

                        public function __call($name, $args)
                        {
                            if (DEBUG_MODE) {
                                $time_start = microtime(true);
                            }
                    Severity: Minor
                    Found in plugins/redis/classes/yf_wrapper_redis.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 conf has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function conf($opt = [])
                        {
                            ! $this->is_connection() && $this->reconnect();
                            foreach ((array) $opt as $k => $v) {
                                if ($this->driver == 'phpredis') {
                    Severity: Minor
                    Found in plugins/redis/classes/yf_wrapper_redis.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 factory has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function factory($options = [])
                        {
                            if ( ! $options || ! is_array($options)) {
                                return  $this;
                            }
                    Severity: Minor
                    Found in plugins/redis/classes/yf_wrapper_redis.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