Passed
Push — master ( 8147ed...103d42 )
by Matthijs
02:06
created
src/Services/Cart/Entity/CartRepository.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
                     $productArray['reference_code'] = $productCombination->reference_code;
61 61
                 }
62 62
 
63
-                $productArray['product_images'] =     $this->product->ajaxProductImages($product, array($leadingAttributeId), $productAttributeId);
63
+                $productArray['product_images'] = $this->product->ajaxProductImages($product, array($leadingAttributeId), $productAttributeId);
64 64
             }
65 65
 
66 66
             if ($product->amountSeries()->where('active', '=', '1')->count()) {
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
                 $productArray['product_amount_series_range'] = $product->amountSeries()->where('active', '=', '1')->first()->range();
69 69
             }
70 70
 
71
-            if($productArray['price_details']['amount'] > 0) {
71
+            if ($productArray['price_details']['amount'] > 0) {
72 72
 
73
-                if($amount >= $productArray['price_details']['amount']) {
73
+                if ($amount >= $productArray['price_details']['amount']) {
74 74
                     $amount = $productArray['price_details']['amount'];
75 75
                 }
76 76
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
                 Cart::remove($productId);
85 85
             }
86 86
 
87
-            if(Cart::getConditionsByType('sending_method_country_price')->count()) {
87
+            if (Cart::getConditionsByType('sending_method_country_price')->count()) {
88 88
                 $this->updateSendingMethodCountryPrice(Cart::getConditionsByType('sending_method_country_price')->first()->getAttributes()['data']['sending_method_country_price_id']);  
89 89
             }
90 90
         }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
                     $productArray['reference_code'] = $productCombination->reference_code;
125 125
                 }
126 126
 
127
-                $productArray['product_images'] =     $this->product->ajaxProductImages($product, array($leadingAttributeId, $productAttributeId));
127
+                $productArray['product_images'] = $this->product->ajaxProductImages($product, array($leadingAttributeId, $productAttributeId));
128 128
             }
129 129
 
130 130
             $productId = $productArray['id'];
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
             $discountValue = false;
137 137
 
138
-            if(session()->get('preSaleDiscount')) {
138
+            if (session()->get('preSaleDiscount')) {
139 139
                 $preSaleDiscount = session()->get('preSaleDiscount');             
140 140
 
141 141
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
                     }                     
150 150
                 }
151 151
 
152
-                if($preSaleDiscount['products']) {
152
+                if ($preSaleDiscount['products']) {
153 153
 
154 154
                     $productIds = array_column($preSaleDiscount['products'], 'id');
155 155
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
             }
176 176
 
177 177
             $discountCondition = array();
178
-            if($discountValue) {
178
+            if ($discountValue) {
179 179
 
180 180
                 $discountCondition = new \Hideyo\Ecommerce\Framework\Services\Cart\CartCondition(array(
181 181
                     'name' => 'Discount',
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
                 ));
186 186
             }
187 187
 
188
-            return Cart::add($productId, $productArray,  $amount, $discountCondition);
188
+            return Cart::add($productId, $productArray, $amount, $discountCondition);
189 189
         }
190 190
 
191 191
         return false;
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         if (isset($sendingMethod->id)) {
199 199
             $sendingMethodArray = $sendingMethod->toArray();          
200 200
             $sendingMethodArray['price_details'] = $sendingMethod->getPriceDetails();
201
-            if($sendingMethod->relatedPaymentMethodsActive) {
201
+            if ($sendingMethod->relatedPaymentMethodsActive) {
202 202
                 $sendingMethodArray['related_payment_methods_list'] = $sendingMethod->relatedPaymentMethodsActive->pluck('title', 'id');                
203 203
             }
204 204
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
         $valueIncTax = $paymentMethodArray['price_details']['original_price_inc_tax'];
239 239
         $shop = ShopService::find(config()->get('app.shop_id'));
240 240
         $value = $valueIncTax;
241
-        $freeSending = ( $paymentMethodArray['no_price_from'] - Cart::getSubTotalWithTax());
241
+        $freeSending = ($paymentMethodArray['no_price_from'] - Cart::getSubTotalWithTax());
242 242
 
243 243
 
244 244
         if ($freeSending < 0) {
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
             $valueExTax = $sendingMethodArray['price_details']['original_price_ex_tax'];
292 292
             $valueIncTax = $sendingMethodArray['price_details']['original_price_inc_tax'];
293 293
             $value = $valueIncTax;
294
-            $freeSending = ( $sendingMethodArray['no_price_from'] - Cart::getSubTotalWithTax());
294
+            $freeSending = ($sendingMethodArray['no_price_from'] - Cart::getSubTotalWithTax());
295 295
       
296 296
             if ($freeSending < 0) {
297 297
                 $value = 0;
@@ -364,12 +364,12 @@  discard block
 block discarded – undo
364 364
         $couponData = array();
365 365
         $discountValue = 0;
366 366
 
367
-        if($coupon) {
367
+        if ($coupon) {
368 368
 
369 369
             $couponData = $coupon->toArray();
370
-            if($coupon->type == 'total_price') {
370
+            if ($coupon->type == 'total_price') {
371 371
 
372
-                if($coupon->discount_way == 'total') {
372
+                if ($coupon->discount_way == 'total') {
373 373
                     $discountValue = $coupon->value;
374 374
                 } elseif ($coupon->discount_way == 'percent') {
375 375
                     $discountValue = $coupon->value.'%';
@@ -378,9 +378,9 @@  discard block
 block discarded – undo
378 378
                 $this->setCouponCode($discountValue, $couponData, $couponCode);
379 379
             }
380 380
 
381
-            if($coupon->type == 'product') {
381
+            if ($coupon->type == 'product') {
382 382
 
383
-                if($coupon->products()->count()) {
383
+                if ($coupon->products()->count()) {
384 384
                     
385 385
                     foreach (Cart::getContent() as $row) {
386 386
 
@@ -388,9 +388,9 @@  discard block
 block discarded – undo
388 388
                         $explode = explode('-', $id);
389 389
                         $contains = $coupon->products->contains($explode[0]);
390 390
 
391
-                        if($contains) {
391
+                        if ($contains) {
392 392
 
393
-                            if($coupon->discount_way == 'total') {
393
+                            if ($coupon->discount_way == 'total') {
394 394
                                 $discountValue += $coupon->value;
395 395
                             } elseif ($coupon->discount_way == 'percent') {
396 396
                                 $value = $coupon->value / 100;                      
@@ -403,17 +403,17 @@  discard block
 block discarded – undo
403 403
                 }
404 404
             }
405 405
 
406
-            if($coupon->type == 'product_category') {
406
+            if ($coupon->type == 'product_category') {
407 407
 
408
-                if($coupon->productCategories()->count()) {
408
+                if ($coupon->productCategories()->count()) {
409 409
 
410 410
                     foreach (Cart::getContent()->sortBy('id')  as $row) {
411 411
 
412 412
                         $contains = $coupon->productCategories->contains($row['attributes']['product_category_id']);
413 413
 
414
-                        if($contains) {
414
+                        if ($contains) {
415 415
 
416
-                            if($coupon->discount_way == 'total') {
416
+                            if ($coupon->discount_way == 'total') {
417 417
                                 $discountValue += $coupon->value;
418 418
                             } elseif ($coupon->discount_way == 'percent') {
419 419
                                 $value = $coupon->value / 100;                      
@@ -427,16 +427,16 @@  discard block
 block discarded – undo
427 427
                 }
428 428
             }
429 429
 
430
-            if($coupon->type == 'sending_method') {
430
+            if ($coupon->type == 'sending_method') {
431 431
 
432
-                if($coupon->sendingMethodCountries()->count()) {
432
+                if ($coupon->sendingMethodCountries()->count()) {
433 433
 
434 434
                     foreach ($coupon->sendingMethodCountries as $country) {
435 435
 
436
-                        if(Cart::getConditionsByType('sending_method_country_price')){
437
-                            if($country->name == Cart::getConditionsByType('sending_method_country_price')->first()->getAttributes()['data']['sending_method_country_price']['name']) {
436
+                        if (Cart::getConditionsByType('sending_method_country_price')) {
437
+                            if ($country->name == Cart::getConditionsByType('sending_method_country_price')->first()->getAttributes()['data']['sending_method_country_price']['name']) {
438 438
 
439
-                                if($coupon->discount_way == 'total') {
439
+                                if ($coupon->discount_way == 'total') {
440 440
                                     $discountValue += $coupon->value;
441 441
                                 } elseif ($coupon->discount_way == 'percent') {
442 442
                                     $value = $coupon->value / 100; 
@@ -448,15 +448,15 @@  discard block
 block discarded – undo
448 448
 
449 449
                     $this->setCouponCode($discountValue, $couponData, $couponCode);
450 450
 
451
-                } elseif($coupon->sendingMethods()->count()) {
451
+                } elseif ($coupon->sendingMethods()->count()) {
452 452
 
453 453
                     foreach ($coupon->sendingMethods as $sendingMethod) {
454 454
 
455
-                        if(Cart::getConditionsByType('sending_cost')){
455
+                        if (Cart::getConditionsByType('sending_cost')) {
456 456
 
457
-                            if($sendingMethod->id == Cart::getConditionsByType('sending_cost')->first()->getAttributes()['data']['sending_method']['id']) {
457
+                            if ($sendingMethod->id == Cart::getConditionsByType('sending_cost')->first()->getAttributes()['data']['sending_method']['id']) {
458 458
 
459
-                                if($coupon->discount_way == 'total') {
459
+                                if ($coupon->discount_way == 'total') {
460 460
                                     $discountValue += $coupon->value;
461 461
                                 } elseif ($coupon->discount_way == 'percent') {
462 462
                                     $value = $coupon->value / 100; 
@@ -470,17 +470,17 @@  discard block
 block discarded – undo
470 470
                 }
471 471
             }
472 472
 
473
-            if($coupon->type == 'payment_method') {
473
+            if ($coupon->type == 'payment_method') {
474 474
 
475
-                if($coupon->paymentMethods()->count()) {
475
+                if ($coupon->paymentMethods()->count()) {
476 476
 
477 477
                     foreach ($coupon->paymentMethods as $paymentMethod) {
478 478
 
479
-                        if(Cart::getConditionsByType('payment_method')){
479
+                        if (Cart::getConditionsByType('payment_method')) {
480 480
 
481
-                            if($paymentMethod->id == Cart::getConditionsByType('payment_method')->first()->getAttributes()['data']['id']) {
481
+                            if ($paymentMethod->id == Cart::getConditionsByType('payment_method')->first()->getAttributes()['data']['id']) {
482 482
 
483
-                                if($coupon->discount_way == 'total') {
483
+                                if ($coupon->discount_way == 'total') {
484 484
                                     $discountValue += $coupon->value;
485 485
                                 } elseif ($coupon->discount_way == 'percent') {
486 486
                                     $value = $coupon->value / 100; 
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
         );
533 533
 
534 534
         foreach ($replace as $key => $val) {
535
-            $content = str_replace("[" . $key . "]", $val, $content);
535
+            $content = str_replace("[".$key."]", $val, $content);
536 536
         }
537 537
         $content = nl2br($content);
538 538
         return $content;
Please login to merge, or discard this patch.