biurad/php-security

View on GitHub

Showing 27 of 27 total issues

Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        UserProviderInterface $provider,
        PasswordHasherFactoryInterface $hasherFactory,
        RememberMeHandler $rememberMeHandler = null,
        string $userParameter = '_identifier',
        string $passwordParameter = '_password'
Severity: Minor
Found in src/Authenticator/FormLoginAuthenticator.php - About 35 mins to fix

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

        protected function execute(InputInterface $input, OutputInterface $output)
        {
            $errorIo = new SymfonyStyle($input, $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output);
            $input->isInteractive() ? $errorIo->title('Biurad User Utility') : $errorIo->newLine();
    
    
    Severity: Minor
    Found in src/Commands/UserStatusCommand.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 getPatterns has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getPatterns(ServerRequestInterface $request): array
        {
            if (!$request instanceof ServerRequest) {
                throw new \InvalidArgumentException(\sprintf('The request must be an instance of %s.', ServerRequest::class));
            }
    Severity: Minor
    Found in src/AccessMap.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 clearRememberMeCookies has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function clearRememberMeCookies(ServerRequestInterface $request): array
        {
            $cookies = [];
    
            foreach ($request->getCookieParams() as $cookieName => $rawCookie) {
    Severity: Minor
    Found in src/Handler/RememberMeHandler.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 failure has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function failure(ServerRequestInterface $request, AuthenticationException $exception): ?ResponseInterface
        {
            $token =$this->tokenStorage->getToken();
    
            if ($token instanceof PreAuthenticatedToken) {
    Severity: Minor
    Found in src/Authenticator/RemoteUserAuthenticator.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 null;
    Severity: Major
    Found in src/Helper.php - About 30 mins to fix

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

          public function authenticate(ServerRequestInterface $request): bool
          {
              [$attributes, $channel] = $this->accessMap->getPatterns($request);
      
              if ($channel && $channel !== $request->getUri()->getScheme()) {
      Severity: Minor
      Found in src/Handler/FirewallAccessHandler.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

      Severity
      Category
      Status
      Source
      Language