Passed
Push — master ( 103d42...18aa9d )
by Matthijs
02:25
created
src/Services/Cart/Entity/CartRepository.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
                     $productArray['reference_code'] = $productCombination->reference_code;
49 49
                 }
50 50
 
51
-                $productArray['product_images'] =     ProductService::ajaxProductImages($product, array($leadingAttributeId), $productAttributeId);
51
+                $productArray['product_images'] = ProductService::ajaxProductImages($product, array($leadingAttributeId), $productAttributeId);
52 52
             }
53 53
 
54 54
             if ($product->amountSeries()->where('active', '=', '1')->count()) {
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
                 $productArray['product_amount_series_range'] = $product->amountSeries()->where('active', '=', '1')->first()->range();
57 57
             }
58 58
 
59
-            if($productArray['price_details']['amount'] > 0) {
59
+            if ($productArray['price_details']['amount'] > 0) {
60 60
 
61
-                if($amount >= $productArray['price_details']['amount']) {
61
+                if ($amount >= $productArray['price_details']['amount']) {
62 62
                     $amount = $productArray['price_details']['amount'];
63 63
                 }
64 64
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                 Cart::remove($productId);
73 73
             }
74 74
 
75
-            if(Cart::getConditionsByType('sending_method_country_price')->count()) {
75
+            if (Cart::getConditionsByType('sending_method_country_price')->count()) {
76 76
                 $this->updateSendingMethodCountryPrice(Cart::getConditionsByType('sending_method_country_price')->first()->getAttributes()['data']['sending_method_country_price_id']);  
77 77
             }
78 78
         }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
                     $productArray['reference_code'] = $productCombination->reference_code;
113 113
                 }
114 114
 
115
-                $productArray['product_images'] =     ProductService::ajaxProductImages($product, array($leadingAttributeId, $productAttributeId));
115
+                $productArray['product_images'] = ProductService::ajaxProductImages($product, array($leadingAttributeId, $productAttributeId));
116 116
             }
117 117
 
118 118
             $productId = $productArray['id'];
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
             $discountValue = false;
125 125
 
126
-            if(session()->get('preSaleDiscount')) {
126
+            if (session()->get('preSaleDiscount')) {
127 127
                 $preSaleDiscount = session()->get('preSaleDiscount');             
128 128
 
129 129
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
                     }                     
138 138
                 }
139 139
 
140
-                if($preSaleDiscount['products']) {
140
+                if ($preSaleDiscount['products']) {
141 141
 
142 142
                     $productIds = array_column($preSaleDiscount['products'], 'id');
143 143
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
             }
164 164
 
165 165
             $discountCondition = array();
166
-            if($discountValue) {
166
+            if ($discountValue) {
167 167
 
168 168
                 $discountCondition = new \Hideyo\Ecommerce\Framework\Services\Cart\CartCondition(array(
169 169
                     'name' => 'Discount',
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
                 ));
174 174
             }
175 175
 
176
-            return Cart::add($productId, $productArray,  $amount, $discountCondition);
176
+            return Cart::add($productId, $productArray, $amount, $discountCondition);
177 177
         }
178 178
 
179 179
         return false;
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         if (isset($sendingMethod->id)) {
187 187
             $sendingMethodArray = $sendingMethod->toArray();          
188 188
             $sendingMethodArray['price_details'] = $sendingMethod->getPriceDetails();
189
-            if($sendingMethod->relatedPaymentMethodsActive) {
189
+            if ($sendingMethod->relatedPaymentMethodsActive) {
190 190
                 $sendingMethodArray['related_payment_methods_list'] = $sendingMethod->relatedPaymentMethodsActive->pluck('title', 'id');                
191 191
             }
192 192
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
         $valueIncTax = $paymentMethodArray['price_details']['original_price_inc_tax'];
227 227
         $shop = ShopService::find(config()->get('app.shop_id'));
228 228
         $value = $valueIncTax;
229
-        $freeSending = ( $paymentMethodArray['no_price_from'] - Cart::getSubTotalWithTax());
229
+        $freeSending = ($paymentMethodArray['no_price_from'] - Cart::getSubTotalWithTax());
230 230
 
231 231
 
232 232
         if ($freeSending < 0) {
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
             $valueExTax = $sendingMethodArray['price_details']['original_price_ex_tax'];
280 280
             $valueIncTax = $sendingMethodArray['price_details']['original_price_inc_tax'];
281 281
             $value = $valueIncTax;
282
-            $freeSending = ( $sendingMethodArray['no_price_from'] - Cart::getSubTotalWithTax());
282
+            $freeSending = ($sendingMethodArray['no_price_from'] - Cart::getSubTotalWithTax());
283 283
       
284 284
             if ($freeSending < 0) {
285 285
                 $value = 0;
@@ -352,12 +352,12 @@  discard block
 block discarded – undo
352 352
         $couponData = array();
353 353
         $discountValue = 0;
354 354
 
355
-        if($coupon) {
355
+        if ($coupon) {
356 356
 
357 357
             $couponData = $coupon->toArray();
358
-            if($coupon->type == 'total_price') {
358
+            if ($coupon->type == 'total_price') {
359 359
 
360
-                if($coupon->discount_way == 'total') {
360
+                if ($coupon->discount_way == 'total') {
361 361
                     $discountValue = $coupon->value;
362 362
                 } elseif ($coupon->discount_way == 'percent') {
363 363
                     $discountValue = $coupon->value.'%';
@@ -366,9 +366,9 @@  discard block
 block discarded – undo
366 366
                 $this->setCouponCode($discountValue, $couponData, $couponCode);
367 367
             }
368 368
 
369
-            if($coupon->type == 'product') {
369
+            if ($coupon->type == 'product') {
370 370
 
371
-                if($coupon->products()->count()) {
371
+                if ($coupon->products()->count()) {
372 372
                     
373 373
                     foreach (Cart::getContent() as $row) {
374 374
 
@@ -376,9 +376,9 @@  discard block
 block discarded – undo
376 376
                         $explode = explode('-', $id);
377 377
                         $contains = $coupon->products->contains($explode[0]);
378 378
 
379
-                        if($contains) {
379
+                        if ($contains) {
380 380
 
381
-                            if($coupon->discount_way == 'total') {
381
+                            if ($coupon->discount_way == 'total') {
382 382
                                 $discountValue += $coupon->value;
383 383
                             } elseif ($coupon->discount_way == 'percent') {
384 384
                                 $value = $coupon->value / 100;                      
@@ -391,17 +391,17 @@  discard block
 block discarded – undo
391 391
                 }
392 392
             }
393 393
 
394
-            if($coupon->type == 'product_category') {
394
+            if ($coupon->type == 'product_category') {
395 395
 
396
-                if($coupon->productCategories()->count()) {
396
+                if ($coupon->productCategories()->count()) {
397 397
 
398 398
                     foreach (Cart::getContent()->sortBy('id')  as $row) {
399 399
 
400 400
                         $contains = $coupon->productCategories->contains($row['attributes']['product_category_id']);
401 401
 
402
-                        if($contains) {
402
+                        if ($contains) {
403 403
 
404
-                            if($coupon->discount_way == 'total') {
404
+                            if ($coupon->discount_way == 'total') {
405 405
                                 $discountValue += $coupon->value;
406 406
                             } elseif ($coupon->discount_way == 'percent') {
407 407
                                 $value = $coupon->value / 100;                      
@@ -415,16 +415,16 @@  discard block
 block discarded – undo
415 415
                 }
416 416
             }
417 417
 
418
-            if($coupon->type == 'sending_method') {
418
+            if ($coupon->type == 'sending_method') {
419 419
 
420
-                if($coupon->sendingMethodCountries()->count()) {
420
+                if ($coupon->sendingMethodCountries()->count()) {
421 421
 
422 422
                     foreach ($coupon->sendingMethodCountries as $country) {
423 423
 
424
-                        if(Cart::getConditionsByType('sending_method_country_price')){
425
-                            if($country->name == Cart::getConditionsByType('sending_method_country_price')->first()->getAttributes()['data']['sending_method_country_price']['name']) {
424
+                        if (Cart::getConditionsByType('sending_method_country_price')) {
425
+                            if ($country->name == Cart::getConditionsByType('sending_method_country_price')->first()->getAttributes()['data']['sending_method_country_price']['name']) {
426 426
 
427
-                                if($coupon->discount_way == 'total') {
427
+                                if ($coupon->discount_way == 'total') {
428 428
                                     $discountValue += $coupon->value;
429 429
                                 } elseif ($coupon->discount_way == 'percent') {
430 430
                                     $value = $coupon->value / 100; 
@@ -436,15 +436,15 @@  discard block
 block discarded – undo
436 436
 
437 437
                     $this->setCouponCode($discountValue, $couponData, $couponCode);
438 438
 
439
-                } elseif($coupon->sendingMethods()->count()) {
439
+                } elseif ($coupon->sendingMethods()->count()) {
440 440
 
441 441
                     foreach ($coupon->sendingMethods as $sendingMethod) {
442 442
 
443
-                        if(Cart::getConditionsByType('sending_cost')){
443
+                        if (Cart::getConditionsByType('sending_cost')) {
444 444
 
445
-                            if($sendingMethod->id == Cart::getConditionsByType('sending_cost')->first()->getAttributes()['data']['sending_method']['id']) {
445
+                            if ($sendingMethod->id == Cart::getConditionsByType('sending_cost')->first()->getAttributes()['data']['sending_method']['id']) {
446 446
 
447
-                                if($coupon->discount_way == 'total') {
447
+                                if ($coupon->discount_way == 'total') {
448 448
                                     $discountValue += $coupon->value;
449 449
                                 } elseif ($coupon->discount_way == 'percent') {
450 450
                                     $value = $coupon->value / 100; 
@@ -458,17 +458,17 @@  discard block
 block discarded – undo
458 458
                 }
459 459
             }
460 460
 
461
-            if($coupon->type == 'payment_method') {
461
+            if ($coupon->type == 'payment_method') {
462 462
 
463
-                if($coupon->paymentMethods()->count()) {
463
+                if ($coupon->paymentMethods()->count()) {
464 464
 
465 465
                     foreach ($coupon->paymentMethods as $paymentMethod) {
466 466
 
467
-                        if(Cart::getConditionsByType('payment_method')){
467
+                        if (Cart::getConditionsByType('payment_method')) {
468 468
 
469
-                            if($paymentMethod->id == Cart::getConditionsByType('payment_method')->first()->getAttributes()['data']['id']) {
469
+                            if ($paymentMethod->id == Cart::getConditionsByType('payment_method')->first()->getAttributes()['data']['id']) {
470 470
 
471
-                                if($coupon->discount_way == 'total') {
471
+                                if ($coupon->discount_way == 'total') {
472 472
                                     $discountValue += $coupon->value;
473 473
                                 } elseif ($coupon->discount_way == 'percent') {
474 474
                                     $value = $coupon->value / 100; 
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
         );
521 521
 
522 522
         foreach ($replace as $key => $val) {
523
-            $content = str_replace("[" . $key . "]", $val, $content);
523
+            $content = str_replace("[".$key."]", $val, $content);
524 524
         }
525 525
         $content = nl2br($content);
526 526
         return $content;
Please login to merge, or discard this patch.