bcit-ci/CodeIgniter

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

Summary

Maintainability
C
1 day
Test Coverage

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

    public function write($session_id, $session_data)
    {
        // Prevent previous QB calls from messing with our queries
        $this->_db->reset_query();

Severity: Minor
Found in system/libraries/Session/drivers/Session_database_driver.php - About 1 hr to fix

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

        public function write($session_id, $session_data)
        {
            // Prevent previous QB calls from messing with our queries
            $this->_db->reset_query();
    
    
    Severity: Minor
    Found in system/libraries/Session/drivers/Session_database_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 __construct has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function __construct(&$params)
        {
            parent::__construct($params);
    
            $CI =& get_instance();
    Severity: Minor
    Found in system/libraries/Session/drivers/Session_database_driver.php - About 1 hr to fix

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

          public function read($session_id)
          {
              if ($this->_get_lock($session_id) === FALSE)
              {
                  return $this->_failure;
      Severity: Minor
      Found in system/libraries/Session/drivers/Session_database_driver.php - About 1 hr to fix

        Function _release_lock has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function _release_lock()
            {
                if ( ! $this->_lock)
                {
                    return TRUE;
        Severity: Minor
        Found in system/libraries/Session/drivers/Session_database_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

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

            public function __construct(&$params)
            {
                parent::__construct($params);
        
                $CI =& get_instance();
        Severity: Minor
        Found in system/libraries/Session/drivers/Session_database_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->_success;
        Severity: Major
        Found in system/libraries/Session/drivers/Session_database_driver.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return $this->_failure;
          Severity: Major
          Found in system/libraries/Session/drivers/Session_database_driver.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return parent::_get_lock($session_id);
            Severity: Major
            Found in system/libraries/Session/drivers/Session_database_driver.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return FALSE;
              Severity: Major
              Found in system/libraries/Session/drivers/Session_database_driver.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return parent::_release_lock();
                Severity: Major
                Found in system/libraries/Session/drivers/Session_database_driver.php - About 30 mins to fix

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

                      protected function _get_lock($session_id)
                      {
                          if ($this->_platform === 'mysql')
                          {
                              $arg = md5($session_id.($this->_config['match_ip'] ? '_'.$_SERVER['REMOTE_ADDR'] : ''));
                  Severity: Minor
                  Found in system/libraries/Session/drivers/Session_database_driver.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 destroy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function destroy($session_id)
                      {
                          if ($this->_lock)
                          {
                              // Prevent previous QB calls from messing with our queries
                  Severity: Minor
                  Found in system/libraries/Session/drivers/Session_database_driver.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