inklabs/kommerce-core

View on GitHub

Showing 84 of 254 total issues

Function import has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function import(Iterator $iterator): ImportResult
    {
        $importResult = new ImportResult;
        foreach ($iterator as $key => $row) {
            if ($key < 2 && $row[0] === 'order_ref') {
Severity: Minor
Found in src/Service/Import/ImportPaymentService.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 createOrderFromCart has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

        UuidInterface $orderId,
        User $user,
        Cart $cart,
        CartCalculatorInterface $cartCalculator,
        string $ip4,
Severity: Major
Found in src/Service/OrderServiceInterface.php - About 1 hr to fix

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

            string $name,
            string $promotionTypeSlug,
            int $value,
            bool $reducesTaxSubtotal,
            ?int $maxRedemptions,
    Severity: Major
    Found in src/Action/CatalogPromotion/CreateCatalogPromotionCommand.php - About 1 hr to fix

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

              EventDispatcherInterface $eventDispatcher,
              InventoryServiceInterface $inventoryService,
              OrderRepositoryInterface $orderRepository,
              OrderItemRepositoryInterface $orderItemRepository,
              PaymentGatewayInterface $paymentGateway,
      Severity: Major
      Found in src/Service/OrderService.php - About 1 hr to fix

        Method createOrderFromCart has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                UuidInterface $orderId,
                User $user,
                Cart $cart,
                CartCalculatorInterface $cartCalculator,
                string $ip4,
        Severity: Major
        Found in src/Service/OrderService.php - About 1 hr to fix

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

              public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
              {
                  $classMetadata = $eventArgs->getClassMetadata();
          
                  if ($classMetadata->isInheritanceTypeSingleTable() && !$classMetadata->isRootEntity()) {
          Severity: Minor
          Found in src/Doctrine/Extensions/TablePrefix.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

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

              public function import(Iterator $iterator): ImportResult
              {
                  $importResult = new ImportResult;
                  foreach ($iterator as $key => $row) {
                      if ($key < 2 && $row[0] === 'id') {
          Severity: Minor
          Found in src/Service/Import/ImportUserService.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

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

              protected function getZip5OrRateOrStateTaxRate(array $taxRates): ?TaxRate
              {
                  $stateTaxRates = $zip5TaxRates = $rangeTaxRates = [];
          
                  foreach ($taxRates as $taxRate) {
          Severity: Minor
          Found in src/EntityRepository/TaxRateRepository.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

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

              private function calculateCouponDiscounts(): void
              {
                  foreach ($this->cart->getCoupons() as $key => $coupon) {
                      if ($coupon->isValid($this->pricing->getDate(), $this->cartTotal->subtotal)) {
                          $newSubtotal = $coupon->getUnitPrice($this->cartTotal->subtotal);
          Severity: Minor
          Found in src/Lib/CartCalculator.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

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

              private function getFullSku(): string
              {
                  $fullSku = [];
          
                  if ($this->product !== null) {
          Severity: Minor
          Found in src/Entity/OrderItem.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

                  string $fileExtension,
                  string $basePath,
                  int $imageType,
                  string $mimeType,
                  int $width,
          Severity: Major
          Found in src/Entity/LocalManagedFile.php - About 50 mins to fix

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

                    CreateOrderFromCartCommand $command,
                    CartRepositoryInterface $cartRepository,
                    CartCalculatorInterface $cartCalculator,
                    OrderServiceInterface $orderService,
                    UserRepositoryInterface $userRepository,
            Severity: Minor
            Found in src/ActionHandler/Order/CreateOrderFromCartHandler.php - About 45 mins to fix

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

                      string $cartId,
                      string $productId,
                      int $quantity,
                      array $optionProductIds = null,
                      array $optionValuesIds = null,
              Severity: Minor
              Found in src/Action/Cart/AddCartItemCommand.php - About 45 mins to fix

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

                        Product $product,
                        int $quantity,
                        string $memo,
                        InventoryLocation $sourceLocation,
                        InventoryLocation $destinationLocation,
                Severity: Minor
                Found in src/Service/InventoryService.php - About 45 mins to fix

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

                          RepositoryFactory $repositoryFactory,
                          CartCalculatorInterface $cartCalculator,
                          EventDispatcherInterface $eventDispatcher,
                          PaymentGatewayInterface $paymentGateway,
                          ShipmentGatewayInterface $shipmentGateway,
                  Severity: Minor
                  Found in src/Service/ServiceFactory.php - About 45 mins to fix

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

                            string $name,
                            ?int $maxRedemptions,
                            bool $reducesTaxSubtotal,
                            ?int $startAt,
                            ?int $endAt,
                    Severity: Minor
                    Found in src/Action/CartPriceRule/AbstractCartPriceRuleCommand.php - About 45 mins to fix

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

                              User $user,
                              UserTokenType $type,
                              string $token,
                              string $userAgent,
                              string $ip4,
                      Severity: Minor
                      Found in src/Entity/UserToken.php - About 45 mins to fix

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

                                string $cartId,
                                string $userId,
                                string $ip4,
                                CreditCardDTO $creditCardDTO,
                                OrderAddressDTO $shippingAddressDTO,
                        Severity: Minor
                        Found in src/Action/Order/CreateOrderFromCartCommand.php - About 45 mins to fix

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

                                  string $email,
                                  string $ip4,
                                  UserLoginResultType $result,
                                  User $user = null,
                                  UserToken $userToken = null
                          Severity: Minor
                          Found in src/Service/UserService.php - About 35 mins to fix

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

                                    AttachmentRepositoryInterface $attachmentRepository,
                                    FileManagerInterface $fileManager,
                                    OrderItemRepositoryInterface $orderItemRepository,
                                    ProductRepositoryInterface $productRepository,
                                    UserRepositoryInterface $userRepository
                            Severity: Minor
                            Found in src/Service/AttachmentService.php - About 35 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language