Showing 50 of 99 total issues
Function priceVariants
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function priceVariants($item, $product)
{
$variants = json_decode($item->product_variants);
if ($variants) {
- 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 cancel
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function cancel($orderId)
{
$order = $this->repo->find($orderId);
if ($order->status != 'complete') {
- 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 up
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function up()
{
Schema::create(config('cms.db-prefix', '').'products', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
Method update
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function update($userId, $payload)
{
if (isset($payload['meta']) && ! isset($payload['meta']['terms_and_cond'])) {
throw new Exception("You must agree to the terms and conditions.", 1);
}
Function addToCart
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function addToCart($id, $type, $quantity, $variables)
{
$cart = Session::get('cart');
$variableArray = 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
Function collectNewCoupons
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function collectNewCoupons()
{
$stripeCoupons = $this->stripeService->collectStripeCoupons()->data;
foreach ($stripeCoupons as $coupon) {
- 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 purchase
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function purchase($stripeToken, $cart)
{
$user = auth()->user();
if (is_null($user->meta->stripe_id) && $stripeToken) {
- 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
Avoid deeply nested control flow statements. Open
if (copyIsArray) {
copyIsArray = false;
clone = src && is.array(src) ? src : [];
} else {
clone = src && is.hash(src) ? src : {};
Function addToCart
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function addToCart($id, $type, $quantity, $variants)
{
$variantArray = null;
if (json_decode($variants)) {
- 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
Avoid deeply nested control flow statements. Open
} else if (typeof copy !== 'undefined') {
target[name] = copy;
}
Function cancel
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function cancel($id)
{
try {
$orderItem = $this->find($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
Consider simplifying this complex logical expression. Open
} else if(obj.sourceMap &&
typeof URL === "function" &&
typeof URL.createObjectURL === "function" &&
typeof URL.revokeObjectURL === "function" &&
typeof Blob === "function" &&
Function favoriteToggle
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
favoriteToggle: function(_id, _button, _content, _isFavorite, _isNotFavorite) {
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Transaction $transaction,
OrderService $orderService,
LogisticService $logisticService,
OrderItemService $orderItemService,
TransactionService $transactionService
Method favoriteToggleBtn
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function favoriteToggleBtn($product, $content, $notFavorite, $isFavorite, $class = '')
Function balanceValues
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function balanceValues($transactions)
{
$collected = $transactions->groupBy(function ($item) {
return $item->created_at->format('d-M-y');
});
- 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
Avoid too many return
statements within this function. Open
return value.prototype === other.prototype;
Avoid too many return
statements within this function. Open
return QJ.val(target, value.replace(/\s\d?$/, ''));
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return true;