Aerendir/aws-ses-monitor-bundle

View on GitHub
src/Command/ConfigureCommand.php

Summary

Maintainability
D
1 day
Test Coverage

File ConfigureCommand.php has 367 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

/*
Severity: Minor
Found in src/Command/ConfigureCommand.php - About 4 hrs to fix

    ConfigureCommand has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    final class ConfigureCommand extends Command
    {
        /** @var string */
        private const FORCE = 'force';
    
    
    Severity: Minor
    Found in src/Command/ConfigureCommand.php - About 2 hrs to fix

      Method subscribeIdentityToTopic has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function subscribeIdentityToTopic(string $identity, string $messageType): void
          {
              static $lastCall = 0;
              switch ($messageType) {
                  case SnsTypes::MESSAGE_TYPE_BOUNCE:
      Severity: Minor
      Found in src/Command/ConfigureCommand.php - About 1 hr to fix

        Function checkIdentityDkimConfiguration has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            private function checkIdentityDkimConfiguration(string $identity): void
            {
                // (Requires a verified identity) If the remote configuration is different than the local configuration...
                $this->console->overwrite('Checking DKIM configuration...', $this->sectionBody);
                $log = sprintf('Identity <comment>%s</comment> is not still verified: cannot synch dkim enabling', $identity);
        Severity: Minor
        Found in src/Command/ConfigureCommand.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 checkIdentityDkimConfiguration has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function checkIdentityDkimConfiguration(string $identity): void
            {
                // (Requires a verified identity) If the remote configuration is different than the local configuration...
                $this->console->overwrite('Checking DKIM configuration...', $this->sectionBody);
                $log = sprintf('Identity <comment>%s</comment> is not still verified: cannot synch dkim enabling', $identity);
        Severity: Minor
        Found in src/Command/ConfigureCommand.php - About 1 hr to fix

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

              private function checkIdentityVerificationStatus(string $identity): void
              {
                  // If the identity is not still verified (or doesn't exist at all)...
                  $this->console->overwrite('Checking Identity verification status:', $this->sectionBody);
                  $log = sprintf('Identity <comment>%s</comment> is already verified: skipping...', $identity);
          Severity: Minor
          Found in src/Command/ConfigureCommand.php - About 1 hr to fix

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

                    string $env,
                    EntityManagerInterface $entityManager,
                    Monitor $monitor,
                    SesManager $sesManager,
                    SnsManager $snsManager,
            Severity: Minor
            Found in src/Command/ConfigureCommand.php - About 45 mins to fix

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

                  private function subscribeIdentityToTopic(string $identity, string $messageType): void
                  {
                      static $lastCall = 0;
                      switch ($messageType) {
                          case SnsTypes::MESSAGE_TYPE_BOUNCE:
              Severity: Minor
              Found in src/Command/ConfigureCommand.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 logActionsToTake has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function logActionsToTake(): void
                  {
                      if (false === empty($this->actionsToTakeNow)) {
                          $this->ioWriter->warning('There are pending actions.');
                          $this->ioWriter->writeln('You have to take the actions listed below, then run again the command <comment>bin/console aws:ses:configure</comment> to complete the configuration.');
              Severity: Minor
              Found in src/Command/ConfigureCommand.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