Aerendir/stripe-bundle

View on GitHub

Showing 52 of 52 total issues

StripeLocalCharge has 54 functions (exceeds 20 allowed). Consider refactoring.
Open

class StripeLocalCharge implements StripeLocalResourceInterface
{
    /** @var array<array-key, string> Properties of the Model that may not be present in the SDK model: these must be ignored when populating the local model */
    public const IGNORE = [
        // This is an optional parameter required when creating a charge and not returned by the SDK
Severity: Major
Found in src/Model/StripeLocalCharge.php - About 7 hrs to fix

    StripeLocalCard has 42 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class StripeLocalCard implements StripeLocalResourceInterface
    {
        /** @var array<array-key, string> Properties of the Model that may not be present in the SDK model: these must be ignored when populating the local model */
        public const IGNORE = [
            // This is used internally to save the error returned by the API when calling it
    Severity: Minor
    Found in src/Model/StripeLocalCard.php - About 5 hrs to fix

      Method guess has 116 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function guess(Event $stripeEvent, StripeLocalWebhookEvent $localEventEntity): array
          {
              $pieces = $this->guessEventPieces($stripeEvent->type);
      
              switch ($pieces['kind']) {
      Severity: Major
      Found in src/Util/EventGuesser.php - About 4 hrs to fix

        Function syncLocalFromStripe has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

            public function syncLocalFromStripe(StripeLocalResourceInterface $localResource, ApiResource $stripeResource): void
            {
                /** @var StripeLocalCharge $localResource */
                if ( ! $localResource instanceof StripeLocalCharge) {
                    throw new \InvalidArgumentException('ChargeSyncer::syncLocalFromStripe() accepts only StripeLocalCharge objects as first parameter.');
        Severity: Minor
        Found in src/Syncer/ChargeSyncer.php - About 4 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

        StripeLocalCustomer has 33 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class StripeLocalCustomer implements StripeLocalResourceInterface
        {
            /** @var array<array-key, string> Properties of the Model that may not be present in the SDK model: these must be ignored when populating the local model */
            public const IGNORE = [
                // This is required by Doctrine to create the relation between Card and Charges
        Severity: Minor
        Found in src/Model/StripeLocalCustomer.php - About 4 hrs to fix

          Function syncLocalFromStripe has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              public function syncLocalFromStripe(StripeLocalResourceInterface $localResource, ApiResource $stripeResource): void
              {
                  /** @var StripeLocalCard $localResource */
                  if ( ! $localResource instanceof StripeLocalCard) {
                      throw new \InvalidArgumentException('CardSyncer::hydrateLocal() accepts only StripeLocalCard objects as first parameter');
          Severity: Minor
          Found in src/Syncer/CardSyncer.php - About 4 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

          Method syncLocalFromStripe has 95 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function syncLocalFromStripe(StripeLocalResourceInterface $localResource, ApiResource $stripeResource): void
              {
                  /** @var StripeLocalCharge $localResource */
                  if ( ! $localResource instanceof StripeLocalCharge) {
                      throw new \InvalidArgumentException('ChargeSyncer::syncLocalFromStripe() accepts only StripeLocalCharge objects as first parameter.');
          Severity: Major
          Found in src/Syncer/ChargeSyncer.php - About 3 hrs to fix

            File StripeLocalCharge.php has 316 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            declare(strict_types=1);
            
            /*
            Severity: Minor
            Found in src/Model/StripeLocalCharge.php - About 3 hrs to fix

              Method syncLocalFromStripe has 81 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function syncLocalFromStripe(StripeLocalResourceInterface $localResource, ApiResource $stripeResource): void
                  {
                      /** @var StripeLocalCard $localResource */
                      if ( ! $localResource instanceof StripeLocalCard) {
                          throw new \InvalidArgumentException('CardSyncer::hydrateLocal() accepts only StripeLocalCard objects as first parameter');
              Severity: Major
              Found in src/Syncer/CardSyncer.php - About 3 hrs to fix

                File CheckCommand.php has 290 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                declare(strict_types=1);
                
                /*
                Severity: Minor
                Found in dev/Command/CheckCommand.php - About 2 hrs to fix

                  Function syncLocalFromStripe has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function syncLocalFromStripe(StripeLocalResourceInterface $localResource, ApiResource $stripeResource): void
                      {
                          /** @var StripeLocalCustomer $localResource */
                          if ( ! $localResource instanceof StripeLocalWebhookEvent) {
                              throw new \InvalidArgumentException('WebhookEventSyncer::syncLocalFromStripe() accepts only StripeLocalWebhookEvent objects as first parameter.');
                  Severity: Minor
                  Found in src/Syncer/WebhookEventSyncer.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 compareLocalPropertiesWithMappedOnes has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function compareLocalPropertiesWithMappedOnes(string $localModelClass, array $propertiesToCompare): array
                      {
                          $failures = [];
                          foreach ($propertiesToCompare as $propertyToCompare) {
                              $localPropertyDocBlock = ReflectionHelper::getLocalModelPropertyDocComment($localModelClass, $propertyToCompare);
                  Severity: Minor
                  Found in dev/Command/CheckCommand.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

                  Method syncLocalFromStripe has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function syncLocalFromStripe(StripeLocalResourceInterface $localResource, ApiResource $stripeResource): void
                      {
                          /** @var StripeLocalCustomer $localResource */
                          if ( ! $localResource instanceof StripeLocalWebhookEvent) {
                              throw new \InvalidArgumentException('WebhookEventSyncer::syncLocalFromStripe() accepts only StripeLocalWebhookEvent objects as first parameter.');
                  Severity: Major
                  Found in src/Syncer/WebhookEventSyncer.php - About 2 hrs to fix

                    Method syncLocalFromStripe has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function syncLocalFromStripe(StripeLocalResourceInterface $localResource, ApiResource $stripeResource): void
                        {
                            /** @var StripeLocalCustomer $localResource */
                            if ( ! $localResource instanceof StripeLocalCustomer) {
                                throw new \InvalidArgumentException('CustomerSyncer::syncLocalFromStripe() accepts only StripeLocalCustoer objects as first parameter.');
                    Severity: Major
                    Found in src/Syncer/CustomerSyncer.php - About 2 hrs to fix

                      Function syncLocalFromStripe has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function syncLocalFromStripe(StripeLocalResourceInterface $localResource, ApiResource $stripeResource): void
                          {
                              /** @var StripeLocalCustomer $localResource */
                              if ( ! $localResource instanceof StripeLocalCustomer) {
                                  throw new \InvalidArgumentException('CustomerSyncer::syncLocalFromStripe() accepts only StripeLocalCustoer objects as first parameter.');
                      Severity: Minor
                      Found in src/Syncer/CustomerSyncer.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

                      File StripeManager.php has 258 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      declare(strict_types=1);
                      
                      /*
                      Severity: Minor
                      Found in src/Manager/StripeManager.php - About 2 hrs to fix

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

                            public function notifyAction(
                                Request $request,
                                EntityManagerInterface $entityManager,
                                EventDispatcherInterface $eventDispatcher,
                                StripeManager $stripeManager,
                        Severity: Minor
                        Found in src/Controller/WebhookController.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

                        Method compareLocalPropertiesWithMappedOnes has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function compareLocalPropertiesWithMappedOnes(string $localModelClass, array $propertiesToCompare): array
                            {
                                $failures = [];
                                foreach ($propertiesToCompare as $propertyToCompare) {
                                    $localPropertyDocBlock = ReflectionHelper::getLocalModelPropertyDocComment($localModelClass, $propertyToCompare);
                        Severity: Major
                        Found in dev/Command/CheckCommand.php - About 2 hrs to fix

                          Method handleException has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function handleException(ExceptionInterface $e): bool
                              {
                                  switch (\get_class($e)) {
                                      case RateLimitException::class:
                                          // We have to retry with an exponential backoff if is not reached the maximum number of retries
                          Severity: Minor
                          Found in src/Manager/StripeManager.php - About 1 hr to fix

                            Function toStripe has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function toStripe(string $action): array
                                {
                                    $return = [];
                            
                                    // Prepare the array for creation
                            Severity: Minor
                            Found in src/Model/StripeLocalCharge.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

                            Severity
                            Category
                            Status
                            Source
                            Language