cjpgdk/php-http-auth

View on GitHub

Showing 8 of 10 total issues

File HttpAuth.php has 287 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace CJPGDK\PhpHttpAuth;

use CJPGDK\PhpHttpAuth\Hash\Apr1Md5;
Severity: Minor
Found in src/CJPGDK/PhpHttpAuth/HttpAuth.php - About 2 hrs to fix

    HttpAuth has 24 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class HttpAuth
    {
    
        use Bcrypt;
        use Sha;
    Severity: Minor
    Found in src/CJPGDK/PhpHttpAuth/HttpAuth.php - About 2 hrs to fix

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

          public function getApr1Md5Hash($plainpasswd, $salt = null)
          {
              if (is_null($salt)) {
                  $salt = $this->getApr1Salt(8);
              }
      Severity: Minor
      Found in src/CJPGDK/PhpHttpAuth/Hash/Apr1Md5.php - About 1 hr to fix

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

            public function getApr1Md5Hash($plainpasswd, $salt = null)
            {
                if (is_null($salt)) {
                    $salt = $this->getApr1Salt(8);
                }
        Severity: Minor
        Found in src/CJPGDK/PhpHttpAuth/Hash/Apr1Md5.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 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function __construct($host, $username, $passwd, $dbname = "", $port = 3306, $socket = null)
        Severity: Minor
        Found in src/CJPGDK/PhpHttpAuth/Database/MySQL.php - About 45 mins to fix

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

              public function savePasswdFile($htpasswd = null)
              {
                  if (is_null($htpasswd)) {
                      $htpasswd = $this->htpasswdFile;
                  }
          Severity: Minor
          Found in src/CJPGDK/PhpHttpAuth/HttpAuth.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

          Method setConnectionSettings has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function setConnectionSettings($host, $username, $passwd, $dbname = "", $port = 3306, $socket = null)
          Severity: Minor
          Found in src/CJPGDK/PhpHttpAuth/Database/MySQL.php - About 45 mins to fix

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

                public function setUsersFile($htpasswd)
                {
                    $this->htpasswdFile = $htpasswd;
                    if (!file_exists($this->htpasswdFile)) {
                        return;
            Severity: Minor
            Found in src/CJPGDK/PhpHttpAuth/HttpAuth.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

            Severity
            Category
            Status
            Source
            Language