phpmyadmin/phpmyadmin

View on GitHub
src/Plugins/Auth/AuthenticationCookie.php

Summary

Maintainability
F
4 days
Test Coverage

Function readCredentials has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
Open

    public function readCredentials(): bool
    {
        $GLOBALS['conn_error'] ??= null;

        // Initialization
Severity: Minor
Found in src/Plugins/Auth/AuthenticationCookie.php - About 1 day 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

File AuthenticationCookie.php has 437 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Cookie Authentication plugin for phpMyAdmin
 */

Severity: Minor
Found in src/Plugins/Auth/AuthenticationCookie.php - About 6 hrs to fix

    Method readCredentials has 130 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function readCredentials(): bool
        {
            $GLOBALS['conn_error'] ??= null;
    
            // Initialization
    Severity: Major
    Found in src/Plugins/Auth/AuthenticationCookie.php - About 5 hrs to fix

      Method showLoginForm has 91 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function showLoginForm(): Response
          {
              $GLOBALS['conn_error'] ??= null;
      
              $responseRenderer = ResponseRenderer::getInstance();
      Severity: Major
      Found in src/Plugins/Auth/AuthenticationCookie.php - About 3 hrs to fix

        Function showLoginForm has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            public function showLoginForm(): Response
            {
                $GLOBALS['conn_error'] ??= null;
        
                $responseRenderer = ResponseRenderer::getInstance();
        Severity: Minor
        Found in src/Plugins/Auth/AuthenticationCookie.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 storeCredentials has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function storeCredentials(): bool
            {
                $config = Config::getInstance();
                if ($config->settings['AllowArbitraryServer'] && ! empty($GLOBALS['pma_auth_server'])) {
                    /* Allow to specify 'host port' */
        Severity: Minor
        Found in src/Plugins/Auth/AuthenticationCookie.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 logOut has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function logOut(): void
            {
                $config = Config::getInstance();
                // -> delete password cookie(s)
                if ($config->settings['LoginCookieDeleteAll']) {
        Severity: Minor
        Found in src/Plugins/Auth/AuthenticationCookie.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 rememberCredentials has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function rememberCredentials(): Response|null
            {
                // Name and password cookies need to be refreshed each time
                // Duration = one month for username
                $this->storeUsernameCookie($this->user);
        Severity: Minor
        Found in src/Plugins/Auth/AuthenticationCookie.php - About 1 hr to fix

          Avoid too many return statements within this method.
          Open

                      return false;
          Severity: Major
          Found in src/Plugins/Auth/AuthenticationCookie.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return false;
            Severity: Major
            Found in src/Plugins/Auth/AuthenticationCookie.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return false;
              Severity: Major
              Found in src/Plugins/Auth/AuthenticationCookie.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return true;
                Severity: Major
                Found in src/Plugins/Auth/AuthenticationCookie.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return false;
                  Severity: Major
                  Found in src/Plugins/Auth/AuthenticationCookie.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            return true;
                    Severity: Major
                    Found in src/Plugins/Auth/AuthenticationCookie.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return false;
                      Severity: Major
                      Found in src/Plugins/Auth/AuthenticationCookie.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return false;
                        Severity: Major
                        Found in src/Plugins/Auth/AuthenticationCookie.php - About 30 mins to fix

                          There are no issues that match your filters.

                          Category
                          Status