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') {
- 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
Method createOrderFromCart
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
UuidInterface $orderId,
User $user,
Cart $cart,
CartCalculatorInterface $cartCalculator,
string $ip4,
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
string $name,
string $promotionTypeSlug,
int $value,
bool $reducesTaxSubtotal,
?int $maxRedemptions,
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
EventDispatcherInterface $eventDispatcher,
InventoryServiceInterface $inventoryService,
OrderRepositoryInterface $orderRepository,
OrderItemRepositoryInterface $orderItemRepository,
PaymentGatewayInterface $paymentGateway,
Method createOrderFromCart
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
UuidInterface $orderId,
User $user,
Cart $cart,
CartCalculatorInterface $cartCalculator,
string $ip4,
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()) {
- 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
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') {
- 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
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) {
- 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
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);
- 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
Function getFullSku
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function getFullSku(): string
{
$fullSku = [];
if ($this->product !== null) {
- 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
Method __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
string $fileExtension,
string $basePath,
int $imageType,
string $mimeType,
int $width,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
CreateOrderFromCartCommand $command,
CartRepositoryInterface $cartRepository,
CartCalculatorInterface $cartCalculator,
OrderServiceInterface $orderService,
UserRepositoryInterface $userRepository,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
string $cartId,
string $productId,
int $quantity,
array $optionProductIds = null,
array $optionValuesIds = null,
Method transferProduct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Product $product,
int $quantity,
string $memo,
InventoryLocation $sourceLocation,
InventoryLocation $destinationLocation,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
RepositoryFactory $repositoryFactory,
CartCalculatorInterface $cartCalculator,
EventDispatcherInterface $eventDispatcher,
PaymentGatewayInterface $paymentGateway,
ShipmentGatewayInterface $shipmentGateway,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
string $name,
?int $maxRedemptions,
bool $reducesTaxSubtotal,
?int $startAt,
?int $endAt,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
User $user,
UserTokenType $type,
string $token,
string $userAgent,
string $ip4,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
string $cartId,
string $userId,
string $ip4,
CreditCardDTO $creditCardDTO,
OrderAddressDTO $shippingAddressDTO,
Method recordLogin
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
string $email,
string $ip4,
UserLoginResultType $result,
User $user = null,
UserToken $userToken = null
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
AttachmentRepositoryInterface $attachmentRepository,
FileManagerInterface $fileManager,
OrderItemRepositoryInterface $orderItemRepository,
ProductRepositoryInterface $productRepository,
UserRepositoryInterface $userRepository