atayahmet/glad

View on GitHub
src/Glad/Author.php

Summary

Maintainability
D
2 days
Test Coverage

File Author.php has 467 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Glad;

use Glad\Interfaces\ConditionsInterface;
Severity: Minor
Found in src/Glad/Author.php - About 7 hrs to fix

    Author has 38 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Author
    {
        /**
         * Repository instance
         *
    Severity: Minor
    Found in src/Glad/Author.php - About 5 hrs to fix

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

          protected static function loginFromRemember()
          {
              $rememberConf = static::$constants->remember;
      
              if($rememberConf['enabled'] === true) {
      Severity: Minor
      Found in src/Glad/Author.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 setRemember has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected static function setRemember(array $userData)
          {
              $rememberConf = static::$constants->remember;
      
              if($rememberConf['enabled'] === true) {
      Severity: Minor
      Found in src/Glad/Author.php - About 1 hr to fix

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

            public static function logout()
            {
                static::resetCheckVariables();
        
                $expire = (static::currentTime()-static::$constants->remember['lifetime']);
        Severity: Minor
        Found in src/Glad/Author.php - About 1 hr to fix

          Function setRemember has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              protected static function setRemember(array $userData)
              {
                  $rememberConf = static::$constants->remember;
          
                  if($rememberConf['enabled'] === true) {
          Severity: Minor
          Found in src/Glad/Author.php - About 55 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 __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function __construct(Constants $constants, CookerInterface $cooker, Injector $injector, CryptInterface $crypt, DatabaseServiceInterface $databaseService, SessionHandlerInterface $repository, Dispatcher $eventDispatcher)
          Severity: Major
          Found in src/Glad/Author.php - About 50 mins to fix

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

                protected static function resolveDbResult($result)
                {
                    $exception = false;
            
                    if(!isset($result) || !$result) return [];
            Severity: Minor
            Found in src/Glad/Author.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 login has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function login(HashInterface $hash, array $user, $remember = false)
                {
                    static::resetCheckVariables();
                    $passField = static::$constants->authFields['password'];
            
            
            Severity: Minor
            Found in src/Glad/Author.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 register has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function register(HashInterface $hash, array $credentials)
                {
                    static::resetCheckVariables();
                    if(static::guest() === true) {
                        static::checkIdentityAsParameter($credentials);
            Severity: Minor
            Found in src/Glad/Author.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 loginByUserId has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function loginByUserId($userId, $remember = false)
                {
                    static::resetCheckVariables();
            
                    if(static::check() === true || $userId == null) return static::getInstance();
            Severity: Minor
            Found in src/Glad/Author.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 getIdField has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                protected static function getIdField(array $credentials)
                {
                    $identity = static::$constants->authFields['identity'];
                    $fields = [];
            
            
            Severity: Minor
            Found in src/Glad/Author.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