Showing 84 of 254 total issues
DTOBuilderFactory
has 70 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class DTOBuilderFactory implements DTOBuilderFactoryInterface
{
public function getAddressDTOBuilder(Address $address)
{
return new AddressDTOBuilder($address, $this);
Function getHandler
has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring. Open
Open
public function getHandler(string $handlerClassName, ActionInterface $action)
{
$reflection = new ReflectionClass($handlerClassName);
$constructorParameters = [];
- Read upRead up
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
Open
class Product implements IdEntityInterface, EnabledAttachmentInterface
{
use TimeTrait, IdTrait, StringSetterTrait;
/** @var string|null */
Order
has 41 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class Order implements IdEntityInterface, ReferenceNumberEntityInterface
{
use TimeTrait, IdTrait, EventGeneratorTrait;
/** @var string|null */
File DTOBuilderFactory.php
has 375 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
namespace inklabs\kommerce\EntityDTO\Builder;
use inklabs\kommerce\Entity\AbstractCartPriceRuleItem;
use inklabs\kommerce\Entity\AbstractPayment;
RepositoryFactory
has 35 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class RepositoryFactory
{
/** @var EntityManager */
protected $entityManager;
Method getHandler
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getHandler(string $handlerClassName, ActionInterface $action)
{
$reflection = new ReflectionClass($handlerClassName);
$constructorParameters = [];
OrderItem
has 33 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class OrderItem implements IdEntityInterface, EnabledAttachmentInterface
{
use TimeTrait, IdTrait;
/** @var int */
User
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class User implements IdEntityInterface
{
use TimeTrait, IdTrait, EventGeneratorTrait, StringSetterTrait;
/** @var string|null */
Tag
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class Tag implements IdEntityInterface, EnabledAttachmentInterface
{
use TimeTrait, IdTrait, StringSetterTrait;
/** @var string */
OrderAddress
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class OrderAddress implements ValidationInterface
{
/** @var string|null */
protected $firstName;
Cart
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class Cart implements IdEntityInterface
{
use TimeTrait, IdTrait;
/** @var string|null */
File Product.php
has 302 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
namespace inklabs\kommerce\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use inklabs\kommerce\Exception\InsufficientInventoryException;
CartItem
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class CartItem implements IdEntityInterface, EnabledAttachmentInterface
{
use TimeTrait, IdTrait;
/** @var int|null */
ShipmentRate
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class ShipmentRate implements ValidationInterface
{
/** @var string|null */
protected $externalId;
File Order.php
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
namespace inklabs\kommerce\Entity;
use inklabs\kommerce\Event\OrderShippedEvent;
use inklabs\kommerce\Lib\CartCalculatorInterface;
Method getValidStatesMap
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function getValidStatesMap(): array
{
return array(
'AL' => 'Alabama',
'AK' => 'Alaska',
Method __construct
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function __construct(Order $order, DTOBuilderFactoryInterface $dtoBuilderFactory)
{
$this->entity = $order;
$this->dtoBuilderFactory = $dtoBuilderFactory;
Method loadValidatorMetadata
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addPropertyConstraint('firstName', new Assert\Length([
'max' => 32,
]));
Method __construct
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
string $code,
bool $flagFreeShipping,
?int $minOrderValue,
?int $maxOrderValue,
bool $canCombineWithOtherCoupons,