bcit-ci/CodeIgniter

View on GitHub
system/libraries/Session/drivers/Session_redis_driver.php

Summary

Maintainability
C
1 day
Test Coverage

Method __construct has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __construct(&$params)
    {
        parent::__construct($params);

        // Detect the names of some methods in phpRedis instance
Severity: Minor
Found in system/libraries/Session/drivers/Session_redis_driver.php - About 1 hr to fix

    Method _get_lock has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function _get_lock($session_id)
        {
            // PHP 7 reuses the SessionHandler object on regeneration,
            // so we need to check here if the lock key is for the
            // correct session ID.
    Severity: Minor
    Found in system/libraries/Session/drivers/Session_redis_driver.php - About 1 hr to fix

      Method open has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function open($save_path, $name)
          {
              if (empty($this->_config['save_path']))
              {
                  return $this->_failure;
      Severity: Minor
      Found in system/libraries/Session/drivers/Session_redis_driver.php - About 1 hr to fix

        Function __construct has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public function __construct(&$params)
            {
                parent::__construct($params);
        
                // Detect the names of some methods in phpRedis instance
        Severity: Minor
        Found in system/libraries/Session/drivers/Session_redis_driver.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_lock has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function _get_lock($session_id)
            {
                // PHP 7 reuses the SessionHandler object on regeneration,
                // so we need to check here if the lock key is for the
                // correct session ID.
        Severity: Minor
        Found in system/libraries/Session/drivers/Session_redis_driver.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 write has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function write($session_id, $session_data)
            {
                if ( ! isset($this->_redis, $this->_lock_key))
                {
                    return $this->_failure;
        Severity: Minor
        Found in system/libraries/Session/drivers/Session_redis_driver.php - About 1 hr to fix

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

              public function close()
              {
                  if (isset($this->_redis))
                  {
                      try {
          Severity: Minor
          Found in system/libraries/Session/drivers/Session_redis_driver.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 open has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function open($save_path, $name)
              {
                  if (empty($this->_config['save_path']))
                  {
                      return $this->_failure;
          Severity: Minor
          Found in system/libraries/Session/drivers/Session_redis_driver.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 write has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function write($session_id, $session_data)
              {
                  if ( ! isset($this->_redis, $this->_lock_key))
                  {
                      return $this->_failure;
          Severity: Minor
          Found in system/libraries/Session/drivers/Session_redis_driver.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

          Avoid too many return statements within this method.
          Open

                  return ($this->_redis->{$this->_setTimeout_name}($this->_key_prefix.$session_id, $this->_config['expiration']))
                      ? $this->_success
                      : $this->_failure;
          Severity: Major
          Found in system/libraries/Session/drivers/Session_redis_driver.php - About 30 mins to fix

            There are no issues that match your filters.

            Category
            Status