inklabs/kommerce-core

View on GitHub

Showing 254 of 254 total issues

Similar blocks of code found in 16 locations. Consider refactoring.
Open

<?php
namespace inklabs\kommerce\ActionHandler\CatalogPromotion;

use inklabs\kommerce\Action\CatalogPromotion\DeleteCatalogPromotionCommand;
use inklabs\kommerce\EntityRepository\CartPriceRuleRepositoryInterface;
src/ActionHandler/Attachment/DeleteAttachmentHandler.php on lines 1..37
src/ActionHandler/Attribute/DeleteAttributeHandler.php on lines 1..37
src/ActionHandler/Attribute/DeleteAttributeValueHandler.php on lines 1..38
src/ActionHandler/Attribute/DeleteProductAttributeHandler.php on lines 1..38
src/ActionHandler/CartPriceRule/DeleteCartPriceRuleDiscountHandler.php on lines 1..39
src/ActionHandler/CartPriceRule/DeleteCartPriceRuleHandler.php on lines 1..37
src/ActionHandler/CartPriceRule/DeleteCartPriceRuleItemHandler.php on lines 1..39
src/ActionHandler/Coupon/DeleteCouponHandler.php on lines 1..33
src/ActionHandler/Option/DeleteOptionHandler.php on lines 1..35
src/ActionHandler/Option/DeleteOptionValueHandler.php on lines 1..37
src/ActionHandler/Product/DeleteProductHandler.php on lines 1..33
src/ActionHandler/Tag/DeleteTagHandler.php on lines 1..33
src/ActionHandler/TaxRate/DeleteTaxRateHandler.php on lines 1..35
src/ActionHandler/Warehouse/DeleteInventoryLocationHandler.php on lines 1..37
src/ActionHandler/Warehouse/DeleteWarehouseHandler.php on lines 1..33

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 108.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 16 locations. Consider refactoring.
Open

<?php
namespace inklabs\kommerce\ActionHandler\Option;

use inklabs\kommerce\Action\Option\DeleteOptionCommand;
use inklabs\kommerce\EntityRepository\OptionRepositoryInterface;
Severity: Major
Found in src/ActionHandler/Option/DeleteOptionHandler.php and 15 other locations - About 1 hr to fix
src/ActionHandler/Attachment/DeleteAttachmentHandler.php on lines 1..37
src/ActionHandler/Attribute/DeleteAttributeHandler.php on lines 1..37
src/ActionHandler/Attribute/DeleteAttributeValueHandler.php on lines 1..38
src/ActionHandler/Attribute/DeleteProductAttributeHandler.php on lines 1..38
src/ActionHandler/CartPriceRule/DeleteCartPriceRuleDiscountHandler.php on lines 1..39
src/ActionHandler/CartPriceRule/DeleteCartPriceRuleHandler.php on lines 1..37
src/ActionHandler/CartPriceRule/DeleteCartPriceRuleItemHandler.php on lines 1..39
src/ActionHandler/CatalogPromotion/DeleteCatalogPromotionHandler.php on lines 1..39
src/ActionHandler/Coupon/DeleteCouponHandler.php on lines 1..33
src/ActionHandler/Option/DeleteOptionValueHandler.php on lines 1..37
src/ActionHandler/Product/DeleteProductHandler.php on lines 1..33
src/ActionHandler/Tag/DeleteTagHandler.php on lines 1..33
src/ActionHandler/TaxRate/DeleteTaxRateHandler.php on lines 1..35
src/ActionHandler/Warehouse/DeleteInventoryLocationHandler.php on lines 1..37
src/ActionHandler/Warehouse/DeleteWarehouseHandler.php on lines 1..33

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 108.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 16 locations. Consider refactoring.
Open

<?php
namespace inklabs\kommerce\ActionHandler\Attribute;

use inklabs\kommerce\Action\Attribute\DeleteProductAttributeCommand;
use inklabs\kommerce\EntityRepository\ProductAttributeRepositoryInterface;
src/ActionHandler/Attachment/DeleteAttachmentHandler.php on lines 1..37
src/ActionHandler/Attribute/DeleteAttributeHandler.php on lines 1..37
src/ActionHandler/Attribute/DeleteAttributeValueHandler.php on lines 1..38
src/ActionHandler/CartPriceRule/DeleteCartPriceRuleDiscountHandler.php on lines 1..39
src/ActionHandler/CartPriceRule/DeleteCartPriceRuleHandler.php on lines 1..37
src/ActionHandler/CartPriceRule/DeleteCartPriceRuleItemHandler.php on lines 1..39
src/ActionHandler/CatalogPromotion/DeleteCatalogPromotionHandler.php on lines 1..39
src/ActionHandler/Coupon/DeleteCouponHandler.php on lines 1..33
src/ActionHandler/Option/DeleteOptionHandler.php on lines 1..35
src/ActionHandler/Option/DeleteOptionValueHandler.php on lines 1..37
src/ActionHandler/Product/DeleteProductHandler.php on lines 1..33
src/ActionHandler/Tag/DeleteTagHandler.php on lines 1..33
src/ActionHandler/TaxRate/DeleteTaxRateHandler.php on lines 1..35
src/ActionHandler/Warehouse/DeleteInventoryLocationHandler.php on lines 1..37
src/ActionHandler/Warehouse/DeleteWarehouseHandler.php on lines 1..33

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 108.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 16 locations. Consider refactoring.
Open

<?php
namespace inklabs\kommerce\ActionHandler\Product;

use inklabs\kommerce\Action\Product\DeleteProductCommand;
use inklabs\kommerce\EntityRepository\ProductRepositoryInterface;
Severity: Major
Found in src/ActionHandler/Product/DeleteProductHandler.php and 15 other locations - About 1 hr to fix
src/ActionHandler/Attachment/DeleteAttachmentHandler.php on lines 1..37
src/ActionHandler/Attribute/DeleteAttributeHandler.php on lines 1..37
src/ActionHandler/Attribute/DeleteAttributeValueHandler.php on lines 1..38
src/ActionHandler/Attribute/DeleteProductAttributeHandler.php on lines 1..38
src/ActionHandler/CartPriceRule/DeleteCartPriceRuleDiscountHandler.php on lines 1..39
src/ActionHandler/CartPriceRule/DeleteCartPriceRuleHandler.php on lines 1..37
src/ActionHandler/CartPriceRule/DeleteCartPriceRuleItemHandler.php on lines 1..39
src/ActionHandler/CatalogPromotion/DeleteCatalogPromotionHandler.php on lines 1..39
src/ActionHandler/Coupon/DeleteCouponHandler.php on lines 1..33
src/ActionHandler/Option/DeleteOptionHandler.php on lines 1..35
src/ActionHandler/Option/DeleteOptionValueHandler.php on lines 1..37
src/ActionHandler/Tag/DeleteTagHandler.php on lines 1..33
src/ActionHandler/TaxRate/DeleteTaxRateHandler.php on lines 1..35
src/ActionHandler/Warehouse/DeleteInventoryLocationHandler.php on lines 1..37
src/ActionHandler/Warehouse/DeleteWarehouseHandler.php on lines 1..33

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 108.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 16 locations. Consider refactoring.
Open

<?php
namespace inklabs\kommerce\ActionHandler\TaxRate;

use inklabs\kommerce\Action\TaxRate\DeleteTaxRateCommand;
use inklabs\kommerce\EntityRepository\TaxRateRepositoryInterface;
Severity: Major
Found in src/ActionHandler/TaxRate/DeleteTaxRateHandler.php and 15 other locations - About 1 hr to fix
src/ActionHandler/Attachment/DeleteAttachmentHandler.php on lines 1..37
src/ActionHandler/Attribute/DeleteAttributeHandler.php on lines 1..37
src/ActionHandler/Attribute/DeleteAttributeValueHandler.php on lines 1..38
src/ActionHandler/Attribute/DeleteProductAttributeHandler.php on lines 1..38
src/ActionHandler/CartPriceRule/DeleteCartPriceRuleDiscountHandler.php on lines 1..39
src/ActionHandler/CartPriceRule/DeleteCartPriceRuleHandler.php on lines 1..37
src/ActionHandler/CartPriceRule/DeleteCartPriceRuleItemHandler.php on lines 1..39
src/ActionHandler/CatalogPromotion/DeleteCatalogPromotionHandler.php on lines 1..39
src/ActionHandler/Coupon/DeleteCouponHandler.php on lines 1..33
src/ActionHandler/Option/DeleteOptionHandler.php on lines 1..35
src/ActionHandler/Option/DeleteOptionValueHandler.php on lines 1..37
src/ActionHandler/Product/DeleteProductHandler.php on lines 1..33
src/ActionHandler/Tag/DeleteTagHandler.php on lines 1..33
src/ActionHandler/Warehouse/DeleteInventoryLocationHandler.php on lines 1..37
src/ActionHandler/Warehouse/DeleteWarehouseHandler.php on lines 1..33

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 108.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 16 locations. Consider refactoring.
Open

<?php
namespace inklabs\kommerce\ActionHandler\Attachment;

use inklabs\kommerce\Action\Attachment\DeleteAttachmentCommand;
use inklabs\kommerce\EntityRepository\AttachmentRepositoryInterface;
Severity: Major
Found in src/ActionHandler/Attachment/DeleteAttachmentHandler.php and 15 other locations - About 1 hr to fix
src/ActionHandler/Attribute/DeleteAttributeHandler.php on lines 1..37
src/ActionHandler/Attribute/DeleteAttributeValueHandler.php on lines 1..38
src/ActionHandler/Attribute/DeleteProductAttributeHandler.php on lines 1..38
src/ActionHandler/CartPriceRule/DeleteCartPriceRuleDiscountHandler.php on lines 1..39
src/ActionHandler/CartPriceRule/DeleteCartPriceRuleHandler.php on lines 1..37
src/ActionHandler/CartPriceRule/DeleteCartPriceRuleItemHandler.php on lines 1..39
src/ActionHandler/CatalogPromotion/DeleteCatalogPromotionHandler.php on lines 1..39
src/ActionHandler/Coupon/DeleteCouponHandler.php on lines 1..33
src/ActionHandler/Option/DeleteOptionHandler.php on lines 1..35
src/ActionHandler/Option/DeleteOptionValueHandler.php on lines 1..37
src/ActionHandler/Product/DeleteProductHandler.php on lines 1..33
src/ActionHandler/Tag/DeleteTagHandler.php on lines 1..33
src/ActionHandler/TaxRate/DeleteTaxRateHandler.php on lines 1..35
src/ActionHandler/Warehouse/DeleteInventoryLocationHandler.php on lines 1..37
src/ActionHandler/Warehouse/DeleteWarehouseHandler.php on lines 1..33

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 108.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 16 locations. Consider refactoring.
Open

<?php
namespace inklabs\kommerce\ActionHandler\Tag;

use inklabs\kommerce\Action\Tag\DeleteTagCommand;
use inklabs\kommerce\EntityRepository\TagRepositoryInterface;
Severity: Major
Found in src/ActionHandler/Tag/DeleteTagHandler.php and 15 other locations - About 1 hr to fix
src/ActionHandler/Attachment/DeleteAttachmentHandler.php on lines 1..37
src/ActionHandler/Attribute/DeleteAttributeHandler.php on lines 1..37
src/ActionHandler/Attribute/DeleteAttributeValueHandler.php on lines 1..38
src/ActionHandler/Attribute/DeleteProductAttributeHandler.php on lines 1..38
src/ActionHandler/CartPriceRule/DeleteCartPriceRuleDiscountHandler.php on lines 1..39
src/ActionHandler/CartPriceRule/DeleteCartPriceRuleHandler.php on lines 1..37
src/ActionHandler/CartPriceRule/DeleteCartPriceRuleItemHandler.php on lines 1..39
src/ActionHandler/CatalogPromotion/DeleteCatalogPromotionHandler.php on lines 1..39
src/ActionHandler/Coupon/DeleteCouponHandler.php on lines 1..33
src/ActionHandler/Option/DeleteOptionHandler.php on lines 1..35
src/ActionHandler/Option/DeleteOptionValueHandler.php on lines 1..37
src/ActionHandler/Product/DeleteProductHandler.php on lines 1..33
src/ActionHandler/TaxRate/DeleteTaxRateHandler.php on lines 1..35
src/ActionHandler/Warehouse/DeleteInventoryLocationHandler.php on lines 1..37
src/ActionHandler/Warehouse/DeleteWarehouseHandler.php on lines 1..33

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 108.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php
namespace inklabs\kommerce\ActionResponse\Product;

use inklabs\kommerce\EntityDTO\Builder\ProductDTOBuilder;
use inklabs\kommerce\EntityDTO\ProductDTO;
Severity: Major
Found in src/ActionResponse/Product/GetRelatedProductsResponse.php and 1 other location - About 1 hr to fix
src/ActionResponse/Product/GetProductsByIdsResponse.php on lines 1..40

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 108.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php
namespace inklabs\kommerce\ActionResponse\Product;

use inklabs\kommerce\EntityDTO\Builder\ProductDTOBuilder;
use inklabs\kommerce\EntityDTO\ProductDTO;
Severity: Major
Found in src/ActionResponse/Product/GetProductsByIdsResponse.php and 1 other location - About 1 hr to fix
src/ActionResponse/Product/GetRelatedProductsResponse.php on lines 1..40

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 108.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

<?php
namespace inklabs\kommerce\ActionHandler\Order;

use inklabs\kommerce\Action\Order\ImportOrderItemsFromCSVCommand;
use inklabs\kommerce\Lib\Authorization\AuthorizationContextInterface;
Severity: Major
Found in src/ActionHandler/Order/ImportOrderItemsFromCSVHandler.php and 2 other locations - About 1 hr to fix
src/ActionHandler/Order/ImportOrdersFromCSVHandler.php on lines 1..39
src/ActionHandler/Order/ImportPaymentsFromCSVHandler.php on lines 1..39

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 107.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

<?php
namespace inklabs\kommerce\ActionHandler\Order;

use inklabs\kommerce\Action\Order\ImportPaymentsFromCSVCommand;
use inklabs\kommerce\Lib\Authorization\AuthorizationContextInterface;
Severity: Major
Found in src/ActionHandler/Order/ImportPaymentsFromCSVHandler.php and 2 other locations - About 1 hr to fix
src/ActionHandler/Order/ImportOrderItemsFromCSVHandler.php on lines 1..39
src/ActionHandler/Order/ImportOrdersFromCSVHandler.php on lines 1..39

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 107.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

<?php
namespace inklabs\kommerce\ActionHandler\Order;

use inklabs\kommerce\Action\Order\ImportOrdersFromCSVCommand;
use inklabs\kommerce\Lib\Authorization\AuthorizationContextInterface;
Severity: Major
Found in src/ActionHandler/Order/ImportOrdersFromCSVHandler.php and 2 other locations - About 1 hr to fix
src/ActionHandler/Order/ImportOrderItemsFromCSVHandler.php on lines 1..39
src/ActionHandler/Order/ImportPaymentsFromCSVHandler.php on lines 1..39

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 107.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method loadValidatorMetadata has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function loadValidatorMetadata(ClassMetadata $metadata)
    {
        $metadata->addPropertyConstraint('externalId', new Assert\NotBlank);
        $metadata->addPropertyConstraint('externalId', new Assert\Length([
            'max' => 255,
Severity: Minor
Found in src/Lib/PaymentGateway/ChargeResponse.php - About 1 hr to fix

    Method import has 32 lines of code (exceeds 25 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 1 hr to fix

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

          private function loadOptionsFromTags()
          {
              $options = new ArrayCollection();
              $textOptions = new ArrayCollection();
              foreach ($this->entityDTO->tags as $tag) {
      Severity: Minor
      Found in src/EntityDTO/Builder/ProductDTOBuilder.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 __construct has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function __construct(ShipmentRate $shipmentRate, DTOBuilderFactoryInterface $dtoBuilderFactory)
          {
              $this->entity = $shipmentRate;
              $this->dtoBuilderFactory = $dtoBuilderFactory;
      
      
      Severity: Minor
      Found in src/EntityDTO/Builder/ShipmentRateDTOBuilder.php - About 1 hr to fix

        Method __construct has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function __construct(Cart $cart, DTOBuilderFactoryInterface $dtoBuilderFactory)
            {
                $this->entity = $cart;
                $this->dtoBuilderFactory = $dtoBuilderFactory;
        
        
        Severity: Minor
        Found in src/EntityDTO/Builder/CartDTOBuilder.php - About 1 hr to fix

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

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

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

                    int $promotionTypeId,
                    int $value,
                    bool $reducesTaxSubtotal,
                    ?int $maxRedemptions,
                    DateTime $startDate,
            Severity: Major
            Found in src/Action/Product/CreateProductQuantityDiscountCommand.php - About 1 hr to fix

              Method import has 28 lines of code (exceeds 25 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
                Severity
                Category
                Status
                Source
                Language