inklabs/kommerce-core

View on GitHub

Showing 84 of 254 total issues

DTOBuilderFactory has 70 functions (exceeds 20 allowed). Consider refactoring.
Open

class DTOBuilderFactory implements DTOBuilderFactoryInterface
{
    public function getAddressDTOBuilder(Address $address)
    {
        return new AddressDTOBuilder($address, $this);
Severity: Major
Found in src/EntityDTO/Builder/DTOBuilderFactory.php - About 1 day to fix

    Function getHandler has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getHandler(string $handlerClassName, ActionInterface $action)
        {
            $reflection = new ReflectionClass($handlerClassName);
    
            $constructorParameters = [];
    Severity: Minor
    Found in src/Lib/Mapper.php - About 1 day 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

    Product has 50 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Product implements IdEntityInterface, EnabledAttachmentInterface
    {
        use TimeTrait, IdTrait, StringSetterTrait;
    
        /** @var string|null */
    Severity: Minor
    Found in src/Entity/Product.php - About 7 hrs to fix

      Order has 41 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Order implements IdEntityInterface, ReferenceNumberEntityInterface
      {
          use TimeTrait, IdTrait, EventGeneratorTrait;
      
          /** @var string|null */
      Severity: Minor
      Found in src/Entity/Order.php - About 5 hrs to fix

        File DTOBuilderFactory.php has 375 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        namespace inklabs\kommerce\EntityDTO\Builder;
        
        use inklabs\kommerce\Entity\AbstractCartPriceRuleItem;
        use inklabs\kommerce\Entity\AbstractPayment;
        Severity: Minor
        Found in src/EntityDTO/Builder/DTOBuilderFactory.php - About 5 hrs to fix

          RepositoryFactory has 35 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class RepositoryFactory
          {
              /** @var EntityManager */
              protected $entityManager;
          
          
          Severity: Minor
          Found in src/EntityRepository/RepositoryFactory.php - About 4 hrs to fix

            Method getHandler has 105 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getHandler(string $handlerClassName, ActionInterface $action)
                {
                    $reflection = new ReflectionClass($handlerClassName);
            
                    $constructorParameters = [];
            Severity: Major
            Found in src/Lib/Mapper.php - About 4 hrs to fix

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

              class OrderItem implements IdEntityInterface, EnabledAttachmentInterface
              {
                  use TimeTrait, IdTrait;
              
                  /** @var int */
              Severity: Minor
              Found in src/Entity/OrderItem.php - About 4 hrs to fix

                User has 30 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class User implements IdEntityInterface
                {
                    use TimeTrait, IdTrait, EventGeneratorTrait, StringSetterTrait;
                
                    /** @var string|null */
                Severity: Minor
                Found in src/Entity/User.php - About 3 hrs to fix

                  Tag has 30 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Tag implements IdEntityInterface, EnabledAttachmentInterface
                  {
                      use TimeTrait, IdTrait, StringSetterTrait;
                  
                      /** @var string */
                  Severity: Minor
                  Found in src/Entity/Tag.php - About 3 hrs to fix

                    OrderAddress has 29 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class OrderAddress implements ValidationInterface
                    {
                        /** @var string|null */
                        protected $firstName;
                    
                    
                    Severity: Minor
                    Found in src/Entity/OrderAddress.php - About 3 hrs to fix

                      Cart has 28 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class Cart implements IdEntityInterface
                      {
                          use TimeTrait, IdTrait;
                      
                          /** @var string|null */
                      Severity: Minor
                      Found in src/Entity/Cart.php - About 3 hrs to fix

                        File Product.php has 302 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        namespace inklabs\kommerce\Entity;
                        
                        use Doctrine\Common\Collections\ArrayCollection;
                        use inklabs\kommerce\Exception\InsufficientInventoryException;
                        Severity: Minor
                        Found in src/Entity/Product.php - About 3 hrs to fix

                          CartItem has 26 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class CartItem implements IdEntityInterface, EnabledAttachmentInterface
                          {
                              use TimeTrait, IdTrait;
                          
                              /** @var int|null */
                          Severity: Minor
                          Found in src/Entity/CartItem.php - About 3 hrs to fix

                            ShipmentRate has 26 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            class ShipmentRate implements ValidationInterface
                            {
                                /** @var string|null */
                                protected $externalId;
                            
                            
                            Severity: Minor
                            Found in src/Entity/ShipmentRate.php - About 3 hrs to fix

                              File Order.php has 270 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              <?php
                              namespace inklabs\kommerce\Entity;
                              
                              use inklabs\kommerce\Event\OrderShippedEvent;
                              use inklabs\kommerce\Lib\CartCalculatorInterface;
                              Severity: Minor
                              Found in src/Entity/Order.php - About 2 hrs to fix

                                Method getValidStatesMap has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public static function getValidStatesMap(): array
                                    {
                                        return array(
                                            'AL' => 'Alabama',
                                            'AK' => 'Alaska',
                                Severity: Major
                                Found in src/Entity/TaxRate.php - About 2 hrs to fix

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

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

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

                                        public static function loadValidatorMetadata(ClassMetadata $metadata)
                                        {
                                            $metadata->addPropertyConstraint('firstName', new Assert\Length([
                                                'max' => 32,
                                            ]));
                                    Severity: Minor
                                    Found in src/Entity/OrderAddress.php - About 1 hr to fix

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

                                              string $code,
                                              bool $flagFreeShipping,
                                              ?int $minOrderValue,
                                              ?int $maxOrderValue,
                                              bool $canCombineWithOtherCoupons,
                                      Severity: Major
                                      Found in src/Action/Coupon/AbstractCouponCommand.php - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language