bcit-ci/CodeIgniter

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

Summary

Maintainability
F
4 days
Test Coverage

File Session.php has 584 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * CodeIgniter
 *
 * An open source application development framework for PHP
Severity: Major
Found in system/libraries/Session/Session.php - About 1 day to fix

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

        public function __construct(array $params = array())
        {
            // No sessions under CLI
            if (is_cli())
            {
    Severity: Major
    Found in system/libraries/Session/Session.php - About 4 hrs to fix

      CI_Session has 28 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class CI_Session {
      
          /**
           * Userdata array
           *
      Severity: Minor
      Found in system/libraries/Session/Session.php - About 3 hrs to fix

        Method _configure has 74 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function _configure(&$params)
            {
                $expiration = config_item('sess_expiration');
        
                if (isset($params['cookie_lifetime']))
        Severity: Major
        Found in system/libraries/Session/Session.php - About 2 hrs to fix

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

              public function __construct(array $params = array())
              {
                  // No sessions under CLI
                  if (is_cli())
                  {
          Severity: Minor
          Found in system/libraries/Session/Session.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 _configure_sid_length has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function _configure_sid_length()
              {
                  if (PHP_VERSION_ID < 70100)
                  {
                      $hash_function = ini_get('session.hash_function');
          Severity: Minor
          Found in system/libraries/Session/Session.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 _ci_load_classes has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function _ci_load_classes($driver)
              {
                  // PHP 7 compatibility
                  interface_exists('SessionUpdateTimestampHandlerInterface', FALSE) OR require_once(BASEPATH.'libraries/Session/SessionUpdateTimestampHandlerInterface.php');
          
          
          Severity: Minor
          Found in system/libraries/Session/Session.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 _configure_sid_length has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function _configure_sid_length()
              {
                  if (PHP_VERSION_ID < 70100)
                  {
                      $hash_function = ini_get('session.hash_function');
          Severity: Minor
          Found in system/libraries/Session/Session.php - About 1 hr to fix

            Method _ci_load_classes has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function _ci_load_classes($driver)
                {
                    // PHP 7 compatibility
                    interface_exists('SessionUpdateTimestampHandlerInterface', FALSE) OR require_once(BASEPATH.'libraries/Session/SessionUpdateTimestampHandlerInterface.php');
            
            
            Severity: Minor
            Found in system/libraries/Session/Session.php - About 1 hr to fix

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

                  protected function _configure(&$params)
                  {
                      $expiration = config_item('sess_expiration');
              
                      if (isset($params['cookie_lifetime']))
              Severity: Minor
              Found in system/libraries/Session/Session.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 mark_as_temp has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function mark_as_temp($key, $ttl = 300)
                  {
                      $ttl += time();
              
                      if (is_array($key))
              Severity: Minor
              Found in system/libraries/Session/Session.php - About 1 hr to fix

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

                    public function mark_as_temp($key, $ttl = 300)
                    {
                        $ttl += time();
                
                        if (is_array($key))
                Severity: Minor
                Found in system/libraries/Session/Session.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 _ci_init_vars has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function _ci_init_vars()
                    {
                        if ( ! empty($_SESSION['__ci_vars']))
                        {
                            $current_time = time();
                Severity: Minor
                Found in system/libraries/Session/Session.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 mark_as_flash has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function mark_as_flash($key)
                    {
                        if (is_array($key))
                        {
                            for ($i = 0, $c = count($key); $i < $c; $i++)
                Severity: Minor
                Found in system/libraries/Session/Session.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 unmark_flash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function unmark_flash($key)
                    {
                        if (empty($_SESSION['__ci_vars']))
                        {
                            return;
                Severity: Minor
                Found in system/libraries/Session/Session.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 unmark_temp has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function unmark_temp($key)
                    {
                        if (empty($_SESSION['__ci_vars']))
                        {
                            return;
                Severity: Minor
                Found in system/libraries/Session/Session.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