Passed
Push — master ( 090c02...7a744e )
by Matthijs
04:11
created
src/Services/Cart/Cart.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -272,7 +272,9 @@
 block discarded – undo
272 272
             }
273 273
             return $this;
274 274
         }
275
-        if (!$condition instanceof CartCondition) throw new InvalidConditionException('Argument 1 must be an instance of \'Darryldecode\Cart\CartCondition\'');
275
+        if (!$condition instanceof CartCondition) {
276
+            throw new InvalidConditionException('Argument 1 must be an instance of \'Darryldecode\Cart\CartCondition\'');
277
+        }
276 278
         $conditions = $this->getConditions();
277 279
         // Check if order has been applied
278 280
         if ($condition->getOrder() == 0) {
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -727,10 +727,10 @@  discard block
 block discarded – undo
727 727
                 }
728 728
 
729 729
                 $this->update($productId, array(
730
-                  'quantity' => array(
731
-                      'relative' => false,
732
-                      'value' => $amount
733
-                  ),
730
+                    'quantity' => array(
731
+                        'relative' => false,
732
+                        'value' => $amount
733
+                    ),
734 734
                 ));
735 735
             } else {
736 736
                 $this->remove($productId);
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
 
797 797
                     if ($preSaleDiscount['discount_way'] == 'amount') {
798 798
                         $discountValue = "-".$preSaleDiscount->value;
799
-                      } elseif ($preSaleDiscount['discount_way'] == 'percent') {          
799
+                        } elseif ($preSaleDiscount['discount_way'] == 'percent') {          
800 800
                         $discountValue = "-".$preSaleDiscount['value']."%";                    
801 801
                     }                     
802 802
                 }
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
         $this->events = $events;
73 73
         $this->session = $session;
74 74
         $this->instanceName = $instanceName;
75
-        $this->sessionKeyCartItems = $session_key . '_cart_items';
76
-        $this->sessionKeyCartConditions = $session_key . '_cart_conditions';
77
-        $this->sessionKeyCartVoucher = $session_key . '_voucher';
75
+        $this->sessionKeyCartItems = $session_key.'_cart_items';
76
+        $this->sessionKeyCartConditions = $session_key.'_cart_conditions';
77
+        $this->sessionKeyCartVoucher = $session_key.'_voucher';
78 78
         $this->fireEvent('created');
79 79
         $this->config = $config;
80 80
     }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      */
157 157
     public function update($id, $data)
158 158
     {
159
-        if($this->fireEvent('updating', $data) === false) {
159
+        if ($this->fireEvent('updating', $data) === false) {
160 160
             return false;
161 161
         }
162 162
         $cart = $this->getContent();
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
      */
253 253
     protected function addRow($id, $item)
254 254
     {
255
-        if($this->fireEvent('adding', $item) === false) {
255
+        if ($this->fireEvent('adding', $item) === false) {
256 256
             return false;
257 257
         }
258 258
         $cart = $this->getContent();
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
             $condition->setOrder(!is_null($last) ? $last->getOrder() + 1 : 1);
286 286
         }
287 287
         $conditions->put($condition->getName(), $condition);
288
-        $conditions = $conditions->sortBy(function ($condition, $key) {
288
+        $conditions = $conditions->sortBy(function($condition, $key) {
289 289
             return $condition->getOrder();
290 290
         });
291 291
         $this->saveConditions($conditions);
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
      */
324 324
     public function getConditionsByType($type)
325 325
     {
326
-        return $this->getConditions()->filter(function (CartCondition $condition) use ($type) {
326
+        return $this->getConditions()->filter(function(CartCondition $condition) use ($type) {
327 327
             return $condition->getType() == $type;
328 328
         });
329 329
     }
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
      */
339 339
     public function removeConditionsByType($type)
340 340
     {
341
-        $this->getConditionsByType($type)->each(function ($condition) {
341
+        $this->getConditionsByType($type)->each(function($condition) {
342 342
             $this->removeCartCondition($condition->getName());
343 343
         });
344 344
     }
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
     public function getSubTotalWithoutConditions($formatted = true)
450 450
     {
451 451
         $cart = $this->getContent();
452
-        $sum = $cart->sum(function ($item) {
452
+        $sum = $cart->sum(function($item) {
453 453
             return $item->getOriginalPriceWithTaxSum();
454 454
         });
455 455
 
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
     public function getSubTotalWithTax($formatted = true)
465 465
     {
466 466
         $cart = $this->getContent();
467
-        $sum = $cart->sum(function ($item) {
467
+        $sum = $cart->sum(function($item) {
468 468
             return $item->getOriginalPriceWithTaxSum(false);
469 469
         });
470 470
 
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
     public function getSubTotalWithoutTax($formatted = true)
481 481
     {
482 482
         $cart = $this->getContent();
483
-        $sum = $cart->sum(function ($item) {
483
+        $sum = $cart->sum(function($item) {
484 484
             return $item->getOriginalPriceWithoutTaxSum(false);
485 485
         });
486 486
 
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
         $process = 0;
501 501
         $conditions = $this
502 502
             ->getConditions()
503
-            ->filter(function ($cond) {
503
+            ->filter(function($cond) {
504 504
                 return $cond->getTarget() === 'subtotal';
505 505
             });
506 506
         // if no conditions were added, just return the sub total
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
             return Helpers::formatValue(floatval($subTotal), $formatted, $this->config);
509 509
         }
510 510
         $conditions
511
-            ->each(function ($cond) use ($subTotal, &$newTotal, &$process) {
511
+            ->each(function($cond) use ($subTotal, &$newTotal, &$process) {
512 512
                 $toBeCalculated = ($process > 0) ? $newTotal : $subTotal;
513 513
                 $newTotal = $cond->applyCondition($toBeCalculated);
514 514
                 $process++;
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
         $process = 0;
532 532
         $conditions = $this
533 533
             ->getConditions()
534
-            ->filter(function ($cond) {
534
+            ->filter(function($cond) {
535 535
                 return $cond->getTarget() === 'subtotal';
536 536
             });
537 537
         // if no conditions were added, just return the sub total
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
             return $subTotal;
540 540
         }
541 541
         $conditions
542
-            ->each(function ($cond) use ($subTotal, &$newTotal, &$process) {
542
+            ->each(function($cond) use ($subTotal, &$newTotal, &$process) {
543 543
                 $toBeCalculated = ($process > 0) ? $newTotal : $subTotal;
544 544
                 $newTotal = $cond->applyConditionWithoutTax($toBeCalculated);
545 545
                 $process++;
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
     public function remove($id)
558 558
     {
559 559
         $cart = $this->getContent();
560
-        if($this->fireEvent('removing', $id) === false) {
560
+        if ($this->fireEvent('removing', $id) === false) {
561 561
             return false;
562 562
         }
563 563
         $cart->forget($id);
@@ -603,18 +603,18 @@  discard block
 block discarded – undo
603 603
     public function getVoucher()
604 604
     {
605 605
         $voucher = $this->session->get($this->sessionKeyCartVoucher);
606
-        if($voucher){
606
+        if ($voucher) {
607 607
 
608 608
         $totalWithTax = self::getTotalWithTax();
609 609
         $totalWithoutTax = self::getTotalWithoutTax();
610
-        $voucher['used_value_with_tax']  = $voucher['value'];
611
-        $voucher['used_value_without_tax']  = $voucher['value'];
612
-        if($totalWithTax <= $voucher['value']) {
613
-            $voucher['used_value_with_tax']  = $voucher['value'] - ($voucher['value'] - $totalWithTax);
610
+        $voucher['used_value_with_tax'] = $voucher['value'];
611
+        $voucher['used_value_without_tax'] = $voucher['value'];
612
+        if ($totalWithTax <= $voucher['value']) {
613
+            $voucher['used_value_with_tax'] = $voucher['value'] - ($voucher['value'] - $totalWithTax);
614 614
         }
615 615
 
616
-        if($totalWithTax <= $voucher['value']) {
617
-            $voucher['used_value_without_tax']  = $voucher['value'] - ($voucher['value'] - $totalWithoutTax);
616
+        if ($totalWithTax <= $voucher['value']) {
617
+            $voucher['used_value_without_tax'] = $voucher['value'] - ($voucher['value'] - $totalWithoutTax);
618 618
         }
619 619
 
620 620
         $this->session->put($this->sessionKeyCartVoucher, $voucher);
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
      */
656 656
     public function clear()
657 657
     {
658
-        if($this->fireEvent('clearing') === false) {
658
+        if ($this->fireEvent('clearing') === false) {
659 659
             return false;
660 660
         }
661 661
         $this->session->put(
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
      */
674 674
     protected function fireEvent($name, $value = [])
675 675
     {
676
-        return $this->events->fire($this->getInstanceName() . '.' . $name, array_values([$value, $this]));
676
+        return $this->events->fire($this->getInstanceName().'.'.$name, array_values([$value, $this]));
677 677
     }  
678 678
 
679 679
     public function updateAmountProduct($productId, $amount, $leadingAttributeId, $productAttributeId)
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
                     $productArray['reference_code'] = $productCombination->reference_code;
713 713
                 }
714 714
 
715
-                $productArray['product_images'] =     ProductService::ajaxProductImages($product, array($leadingAttributeId), $productAttributeId);
715
+                $productArray['product_images'] = ProductService::ajaxProductImages($product, array($leadingAttributeId), $productAttributeId);
716 716
             }
717 717
 
718 718
             if ($product->amountSeries()->where('active', '=', '1')->count()) {
@@ -720,9 +720,9 @@  discard block
 block discarded – undo
720 720
                 $productArray['product_amount_series_range'] = $product->amountSeries()->where('active', '=', '1')->first()->range();
721 721
             }
722 722
 
723
-            if($productArray['price_details']['amount'] > 0) {
723
+            if ($productArray['price_details']['amount'] > 0) {
724 724
 
725
-                if($amount >= $productArray['price_details']['amount']) {
725
+                if ($amount >= $productArray['price_details']['amount']) {
726 726
                     $amount = $productArray['price_details']['amount'];
727 727
                 }
728 728
 
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
                 $this->remove($productId);
737 737
             }
738 738
 
739
-            if($this->getConditionsByType('sending_method_country_price')->count()) {
739
+            if ($this->getConditionsByType('sending_method_country_price')->count()) {
740 740
                 $this->updateSendingMethodCountryPrice($this->getConditionsByType('sending_method_country_price')->first()->getAttributes()['data']['sending_method_country_price_id']);  
741 741
             }
742 742
         }
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
                     $productArray['reference_code'] = $productCombination->reference_code;
777 777
                 }
778 778
 
779
-                $productArray['product_images'] =     ProductService::ajaxProductImages($product, array($leadingAttributeId, $productAttributeId));
779
+                $productArray['product_images'] = ProductService::ajaxProductImages($product, array($leadingAttributeId, $productAttributeId));
780 780
             }
781 781
 
782 782
             $productId = $productArray['id'];
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 
788 788
             $discountValue = false;
789 789
 
790
-            if(session()->get('preSaleDiscount')) {
790
+            if (session()->get('preSaleDiscount')) {
791 791
                 $preSaleDiscount = session()->get('preSaleDiscount');             
792 792
 
793 793
 
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
                     }                     
802 802
                 }
803 803
 
804
-                if($preSaleDiscount['products']) {
804
+                if ($preSaleDiscount['products']) {
805 805
 
806 806
                     $productIds = array_column($preSaleDiscount['products'], 'id');
807 807
 
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
             }
828 828
 
829 829
             $discountCondition = array();
830
-            if($discountValue) {
830
+            if ($discountValue) {
831 831
 
832 832
                 $discountCondition = new \Hideyo\Ecommerce\Framework\Services\Cart\CartCondition(array(
833 833
                     'name' => 'Discount',
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
                 ));
838 838
             }
839 839
 
840
-            return $this->add($productId, $productArray,  $amount, $discountCondition);
840
+            return $this->add($productId, $productArray, $amount, $discountCondition);
841 841
         }
842 842
 
843 843
         return false;
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
         if (isset($sendingMethod->id)) {
851 851
             $sendingMethodArray = $sendingMethod->toArray();          
852 852
             $sendingMethodArray['price_details'] = $sendingMethod->getPriceDetails();
853
-            if($sendingMethod->relatedPaymentMethodsActive) {
853
+            if ($sendingMethod->relatedPaymentMethodsActive) {
854 854
                 $sendingMethodArray['related_payment_methods_list'] = $sendingMethod->relatedPaymentMethodsActive->pluck('title', 'id');                
855 855
             }
856 856
 
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
         $valueIncTax = $paymentMethodArray['price_details']['original_price_inc_tax'];
891 891
         $shop = ShopService::find(config()->get('app.shop_id'));
892 892
         $value = $valueIncTax;
893
-        $freeSending = ( $paymentMethodArray['no_price_from'] - $this->getSubTotalWithTax());
893
+        $freeSending = ($paymentMethodArray['no_price_from'] - $this->getSubTotalWithTax());
894 894
 
895 895
 
896 896
         if ($freeSending < 0) {
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
             $valueExTax = $sendingMethodArray['price_details']['original_price_ex_tax'];
944 944
             $valueIncTax = $sendingMethodArray['price_details']['original_price_inc_tax'];
945 945
             $value = $valueIncTax;
946
-            $freeSending = ( $sendingMethodArray['no_price_from'] - $this->getSubTotalWithTax());
946
+            $freeSending = ($sendingMethodArray['no_price_from'] - $this->getSubTotalWithTax());
947 947
       
948 948
             if ($freeSending < 0) {
949 949
                 $value = 0;
@@ -1016,12 +1016,12 @@  discard block
 block discarded – undo
1016 1016
         $couponData = array();
1017 1017
         $discountValue = 0;
1018 1018
 
1019
-        if($coupon) {
1019
+        if ($coupon) {
1020 1020
 
1021 1021
             $couponData = $coupon->toArray();
1022
-            if($coupon->type == 'total_price') {
1022
+            if ($coupon->type == 'total_price') {
1023 1023
 
1024
-                if($coupon->discount_way == 'total') {
1024
+                if ($coupon->discount_way == 'total') {
1025 1025
                     $discountValue = $coupon->value;
1026 1026
                 } elseif ($coupon->discount_way == 'percent') {
1027 1027
                     $discountValue = $coupon->value.'%';
@@ -1030,9 +1030,9 @@  discard block
 block discarded – undo
1030 1030
                 $this->setCouponCode($discountValue, $couponData, $couponCode);
1031 1031
             }
1032 1032
 
1033
-            if($coupon->type == 'product') {
1033
+            if ($coupon->type == 'product') {
1034 1034
 
1035
-                if($coupon->products()->count()) {
1035
+                if ($coupon->products()->count()) {
1036 1036
                     
1037 1037
                     foreach ($this->getContent() as $row) {
1038 1038
 
@@ -1040,9 +1040,9 @@  discard block
 block discarded – undo
1040 1040
                         $explode = explode('-', $id);
1041 1041
                         $contains = $coupon->products->contains($explode[0]);
1042 1042
 
1043
-                        if($contains) {
1043
+                        if ($contains) {
1044 1044
 
1045
-                            if($coupon->discount_way == 'total') {
1045
+                            if ($coupon->discount_way == 'total') {
1046 1046
                                 $discountValue += $coupon->value;
1047 1047
                             } elseif ($coupon->discount_way == 'percent') {
1048 1048
                                 $value = $coupon->value / 100;                      
@@ -1055,17 +1055,17 @@  discard block
 block discarded – undo
1055 1055
                 }
1056 1056
             }
1057 1057
 
1058
-            if($coupon->type == 'product_category') {
1058
+            if ($coupon->type == 'product_category') {
1059 1059
 
1060
-                if($coupon->productCategories()->count()) {
1060
+                if ($coupon->productCategories()->count()) {
1061 1061
 
1062 1062
                     foreach ($this->getContent()->sortBy('id')  as $row) {
1063 1063
 
1064 1064
                         $contains = $coupon->productCategories->contains($row['attributes']['product_category_id']);
1065 1065
 
1066
-                        if($contains) {
1066
+                        if ($contains) {
1067 1067
 
1068
-                            if($coupon->discount_way == 'total') {
1068
+                            if ($coupon->discount_way == 'total') {
1069 1069
                                 $discountValue += $coupon->value;
1070 1070
                             } elseif ($coupon->discount_way == 'percent') {
1071 1071
                                 $value = $coupon->value / 100;                      
@@ -1079,16 +1079,16 @@  discard block
 block discarded – undo
1079 1079
                 }
1080 1080
             }
1081 1081
 
1082
-            if($coupon->type == 'sending_method') {
1082
+            if ($coupon->type == 'sending_method') {
1083 1083
 
1084
-                if($coupon->sendingMethodCountries()->count()) {
1084
+                if ($coupon->sendingMethodCountries()->count()) {
1085 1085
 
1086 1086
                     foreach ($coupon->sendingMethodCountries as $country) {
1087 1087
 
1088
-                        if($this->getConditionsByType('sending_method_country_price')){
1089
-                            if($country->name == $this->getConditionsByType('sending_method_country_price')->first()->getAttributes()['data']['sending_method_country_price']['name']) {
1088
+                        if ($this->getConditionsByType('sending_method_country_price')) {
1089
+                            if ($country->name == $this->getConditionsByType('sending_method_country_price')->first()->getAttributes()['data']['sending_method_country_price']['name']) {
1090 1090
 
1091
-                                if($coupon->discount_way == 'total') {
1091
+                                if ($coupon->discount_way == 'total') {
1092 1092
                                     $discountValue += $coupon->value;
1093 1093
                                 } elseif ($coupon->discount_way == 'percent') {
1094 1094
                                     $value = $coupon->value / 100; 
@@ -1100,15 +1100,15 @@  discard block
 block discarded – undo
1100 1100
 
1101 1101
                     $this->setCouponCode($discountValue, $couponData, $couponCode);
1102 1102
 
1103
-                } elseif($coupon->sendingMethods()->count()) {
1103
+                } elseif ($coupon->sendingMethods()->count()) {
1104 1104
 
1105 1105
                     foreach ($coupon->sendingMethods as $sendingMethod) {
1106 1106
 
1107
-                        if($this->getConditionsByType('sending_cost')){
1107
+                        if ($this->getConditionsByType('sending_cost')) {
1108 1108
 
1109
-                            if($sendingMethod->id == $this->getConditionsByType('sending_cost')->first()->getAttributes()['data']['sending_method']['id']) {
1109
+                            if ($sendingMethod->id == $this->getConditionsByType('sending_cost')->first()->getAttributes()['data']['sending_method']['id']) {
1110 1110
 
1111
-                                if($coupon->discount_way == 'total') {
1111
+                                if ($coupon->discount_way == 'total') {
1112 1112
                                     $discountValue += $coupon->value;
1113 1113
                                 } elseif ($coupon->discount_way == 'percent') {
1114 1114
                                     $value = $coupon->value / 100; 
@@ -1122,17 +1122,17 @@  discard block
 block discarded – undo
1122 1122
                 }
1123 1123
             }
1124 1124
 
1125
-            if($coupon->type == 'payment_method') {
1125
+            if ($coupon->type == 'payment_method') {
1126 1126
 
1127
-                if($coupon->paymentMethods()->count()) {
1127
+                if ($coupon->paymentMethods()->count()) {
1128 1128
 
1129 1129
                     foreach ($coupon->paymentMethods as $paymentMethod) {
1130 1130
 
1131
-                        if($this->getConditionsByType('payment_method')){
1131
+                        if ($this->getConditionsByType('payment_method')) {
1132 1132
 
1133
-                            if($paymentMethod->id == $this->getConditionsByType('payment_method')->first()->getAttributes()['data']['id']) {
1133
+                            if ($paymentMethod->id == $this->getConditionsByType('payment_method')->first()->getAttributes()['data']['id']) {
1134 1134
 
1135
-                                if($coupon->discount_way == 'total') {
1135
+                                if ($coupon->discount_way == 'total') {
1136 1136
                                     $discountValue += $coupon->value;
1137 1137
                                 } elseif ($coupon->discount_way == 'percent') {
1138 1138
                                     $value = $coupon->value / 100; 
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
         );
1184 1184
 
1185 1185
         foreach ($replace as $key => $val) {
1186
-            $content = str_replace("[" . $key . "]", $val, $content);
1186
+            $content = str_replace("[".$key."]", $val, $content);
1187 1187
         }
1188 1188
         $content = nl2br($content);
1189 1189
         return $content;
Please login to merge, or discard this patch.
src/Services/Cart/Helpers/Helpers.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public static function isMultiArray($array, $recursive = false)
27 27
     {
28
-        if( $recursive )
28
+        if ($recursive)
29 29
         {
30 30
             return (count($array) == count($array, COUNT_RECURSIVE)) ? false : true;
31 31
         }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public static function issetAndHasValueOrAssignDefault(&$var, $default = false)
57 57
     {
58
-        if( (isset($var)) && ($var!='') ) return $var;
58
+        if ((isset($var)) && ($var != '')) return $var;
59 59
 
60 60
         return $default;
61 61
     }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     public static function formatValue($value, $format_numbers, $config)
64 64
     {
65 65
        
66
-        if($format_numbers && $config['format_numbers']) {
66
+        if ($format_numbers && $config['format_numbers']) {
67 67
 
68 68
 
69 69
             return number_format($value, $config['decimals'], $config['dec_point'], $config['thousands_sep']);
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,16 +28,14 @@  discard block
 block discarded – undo
28 28
         if( $recursive )
29 29
         {
30 30
             return (count($array) == count($array, COUNT_RECURSIVE)) ? false : true;
31
-        }
32
-        else
31
+        } else
33 32
         {
34 33
             foreach ($array as $k => $v)
35 34
             {
36 35
                 if (is_array($v))
37 36
                 {
38 37
                     return true;
39
-                }
40
-                else
38
+                } else
41 39
                 {
42 40
                     return false;
43 41
                 }
@@ -55,7 +53,9 @@  discard block
 block discarded – undo
55 53
      */
56 54
     public static function issetAndHasValueOrAssignDefault(&$var, $default = false)
57 55
     {
58
-        if( (isset($var)) && ($var!='') ) return $var;
56
+        if( (isset($var)) && ($var!='') ) {
57
+            return $var;
58
+        }
59 59
 
60 60
         return $default;
61 61
     }
Please login to merge, or discard this patch.
src/Services/Cart/CartCondition.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     {
27 27
         $this->args = $args;
28 28
 
29
-        if( Helpers::isMultiArray($args) )
29
+        if (Helpers::isMultiArray($args))
30 30
         {
31 31
             Throw new InvalidConditionException('Multi dimensional array is not supported.');
32 32
         }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function applyConditionWithoutTax($totalOrSubTotalOrPrice)
129 129
     {
130
-        if(isset($this->getAttributes()['data']['value_ex_tax']) AND $this->args['value']) {
130
+        if (isset($this->getAttributes()['data']['value_ex_tax']) AND $this->args['value']) {
131 131
             return $this->apply($totalOrSubTotalOrPrice, $this->getAttributes()['data']['value_ex_tax']);            
132 132
         }
133 133
 
@@ -173,19 +173,19 @@  discard block
 block discarded – undo
173 173
         // has a minus or plus sign so we can decide what to do with the
174 174
         // percentage, whether to add or subtract it to the total/subtotal/price
175 175
         // if we can't find any plus/minus sign, we will assume it as plus sign
176
-        if( $this->valueIsPercentage($conditionValue) )
176
+        if ($this->valueIsPercentage($conditionValue))
177 177
         {
178
-            if( $this->valueIsToBeSubtracted($conditionValue) )
178
+            if ($this->valueIsToBeSubtracted($conditionValue))
179 179
             {
180
-                $value = Helpers::normalizePrice( $this->cleanValue($conditionValue) );
180
+                $value = Helpers::normalizePrice($this->cleanValue($conditionValue));
181 181
 
182 182
                 $this->parsedRawValue = $totalOrSubTotalOrPrice * ($value / 100);
183 183
 
184 184
                 $result = floatval($totalOrSubTotalOrPrice - $this->parsedRawValue);
185 185
             }
186
-            else if ( $this->valueIsToBeAdded($conditionValue) )
186
+            else if ($this->valueIsToBeAdded($conditionValue))
187 187
             {
188
-                $value = Helpers::normalizePrice( $this->cleanValue($conditionValue) );
188
+                $value = Helpers::normalizePrice($this->cleanValue($conditionValue));
189 189
 
190 190
                 $this->parsedRawValue = $totalOrSubTotalOrPrice * ($value / 100);
191 191
 
@@ -205,15 +205,15 @@  discard block
 block discarded – undo
205 205
         // next is we will check if it has a minus/plus sign so then we can just deduct it to total/subtotal/price
206 206
         else
207 207
         {
208
-            if( $this->valueIsToBeSubtracted($conditionValue) )
208
+            if ($this->valueIsToBeSubtracted($conditionValue))
209 209
             {
210
-                $this->parsedRawValue = Helpers::normalizePrice( $this->cleanValue($conditionValue) );
210
+                $this->parsedRawValue = Helpers::normalizePrice($this->cleanValue($conditionValue));
211 211
 
212 212
                 $result = floatval($totalOrSubTotalOrPrice - $this->parsedRawValue);
213 213
             }
214
-            else if ( $this->valueIsToBeAdded($conditionValue) )
214
+            else if ($this->valueIsToBeAdded($conditionValue))
215 215
             {
216
-                $this->parsedRawValue = Helpers::normalizePrice( $this->cleanValue($conditionValue) );
216
+                $this->parsedRawValue = Helpers::normalizePrice($this->cleanValue($conditionValue));
217 217
 
218 218
                 $result = floatval($totalOrSubTotalOrPrice + $this->parsedRawValue);
219 219
             }
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
      */
271 271
     protected function cleanValue($value)
272 272
     {
273
-        return str_replace(array('%','-','+'),'',$value);
273
+        return str_replace(array('%', '-', '+'), '', $value);
274 274
     }
275 275
 
276 276
     /**
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
         if( Helpers::isMultiArray($args) )
30 30
         {
31 31
             Throw new InvalidConditionException('Multi dimensional array is not supported.');
32
-        }
33
-        else
32
+        } else
34 33
         {
35 34
             $this->validate($this->args);
36 35
         }
@@ -182,16 +181,14 @@  discard block
 block discarded – undo
182 181
                 $this->parsedRawValue = $totalOrSubTotalOrPrice * ($value / 100);
183 182
 
184 183
                 $result = floatval($totalOrSubTotalOrPrice - $this->parsedRawValue);
185
-            }
186
-            else if ( $this->valueIsToBeAdded($conditionValue) )
184
+            } else if ( $this->valueIsToBeAdded($conditionValue) )
187 185
             {
188 186
                 $value = Helpers::normalizePrice( $this->cleanValue($conditionValue) );
189 187
 
190 188
                 $this->parsedRawValue = $totalOrSubTotalOrPrice * ($value / 100);
191 189
 
192 190
                 $result = floatval($totalOrSubTotalOrPrice + $this->parsedRawValue);
193
-            }
194
-            else
191
+            } else
195 192
             {
196 193
                 $value = Helpers::normalizePrice($conditionValue);
197 194
 
@@ -210,14 +207,12 @@  discard block
 block discarded – undo
210 207
                 $this->parsedRawValue = Helpers::normalizePrice( $this->cleanValue($conditionValue) );
211 208
 
212 209
                 $result = floatval($totalOrSubTotalOrPrice - $this->parsedRawValue);
213
-            }
214
-            else if ( $this->valueIsToBeAdded($conditionValue) )
210
+            } else if ( $this->valueIsToBeAdded($conditionValue) )
215 211
             {
216 212
                 $this->parsedRawValue = Helpers::normalizePrice( $this->cleanValue($conditionValue) );
217 213
 
218 214
                 $result = floatval($totalOrSubTotalOrPrice + $this->parsedRawValue);
219
-            }
220
-            else
215
+            } else
221 216
             {
222 217
                 $this->parsedRawValue = Helpers::normalizePrice($conditionValue);
223 218
 
Please login to merge, or discard this patch.
src/Services/Cart/ItemCollection.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     protected $config;
15 15
 
16
-   /**
16
+    /**
17 17
      * ItemCollection constructor.
18 18
      * @param array|mixed $items
19 19
      */
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -68,15 +68,15 @@  discard block
 block discarded – undo
68 68
         $newPrice = 0.00;
69 69
         $processed = 0;
70 70
 
71
-        if( $this->hasConditions() )
71
+        if ($this->hasConditions())
72 72
         {
73
-            if( is_array($this->conditions) )
73
+            if (is_array($this->conditions))
74 74
             {
75
-                foreach($this->conditions as $condition)
75
+                foreach ($this->conditions as $condition)
76 76
                 {
77
-                    if( $condition->getTarget() === 'item' )
77
+                    if ($condition->getTarget() === 'item')
78 78
                     {
79
-                        ( $processed > 0 ) ? $toBeCalculated = $newPrice : $toBeCalculated = $originalPrice;
79
+                        ($processed > 0) ? $toBeCalculated = $newPrice : $toBeCalculated = $originalPrice;
80 80
                         $newPrice = $condition->applyCondition($toBeCalculated);
81 81
                         $processed++;
82 82
                     }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
             }
85 85
             else
86 86
             {
87
-                if( $this['conditions']->getTarget() === 'item' )
87
+                if ($this['conditions']->getTarget() === 'item')
88 88
                 {
89 89
                     $newPrice = $this['conditions']->applyCondition($originalPrice);
90 90
                 }
@@ -107,15 +107,15 @@  discard block
 block discarded – undo
107 107
         $newPrice = 0.00;
108 108
         $processed = 0;
109 109
 
110
-        if( $this->hasConditions() )
110
+        if ($this->hasConditions())
111 111
         {
112
-            if( is_array($this->conditions) )
112
+            if (is_array($this->conditions))
113 113
             {
114
-                foreach($this->conditions as $condition)
114
+                foreach ($this->conditions as $condition)
115 115
                 {
116
-                    if( $condition->getTarget() === 'item' )
116
+                    if ($condition->getTarget() === 'item')
117 117
                     {
118
-                        ( $processed > 0 ) ? $toBeCalculated = $newPrice : $toBeCalculated = $originalPrice;
118
+                        ($processed > 0) ? $toBeCalculated = $newPrice : $toBeCalculated = $originalPrice;
119 119
                         $newPrice = $condition->applyCondition($toBeCalculated);
120 120
                         $processed++;
121 121
                     }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
             }
124 124
             else
125 125
             {
126
-                if( $this['conditions']->getTarget() === 'item' )
126
+                if ($this['conditions']->getTarget() === 'item')
127 127
                 {
128 128
                     $newPrice = $this['conditions']->applyCondition($originalPrice);
129 129
                 }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 
160 160
     public function __get($name)
161 161
     {
162
-        if( $this->has($name) ) return $this->get($name);
162
+        if ($this->has($name)) return $this->get($name);
163 163
         return null;
164 164
     }
165 165
 
@@ -170,13 +170,13 @@  discard block
 block discarded – undo
170 170
      */
171 171
     public function hasConditions()
172 172
     {
173
-        if( ! isset($this['conditions']) ) return false;
174
-        if( is_array($this['conditions']) )
173
+        if (!isset($this['conditions'])) return false;
174
+        if (is_array($this['conditions']))
175 175
         {
176 176
             return count($this['conditions']) > 0;
177 177
         }
178 178
         $conditionInstance = "Hideyo\\Services\\Cart\\CartCondition";
179
-        if( $this['conditions'] instanceof $conditionInstance ) return true;
179
+        if ($this['conditions'] instanceof $conditionInstance) return true;
180 180
         return false;
181 181
     }
182 182
     
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      */
188 188
     public function getConditions()
189 189
     {
190
-        if(! $this->hasConditions() ) return [];
190
+        if (!$this->hasConditions()) return [];
191 191
         return $this['conditions'];
192 192
     }
193 193
 }
194 194
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +14 added lines, -8 removed lines patch added patch discarded remove patch
@@ -81,8 +81,7 @@  discard block
 block discarded – undo
81 81
                         $processed++;
82 82
                     }
83 83
                 }
84
-            }
85
-            else
84
+            } else
86 85
             {
87 86
                 if( $this['conditions']->getTarget() === 'item' )
88 87
                 {
@@ -120,8 +119,7 @@  discard block
 block discarded – undo
120 119
                         $processed++;
121 120
                     }
122 121
                 }
123
-            }
124
-            else
122
+            } else
125 123
             {
126 124
                 if( $this['conditions']->getTarget() === 'item' )
127 125
                 {
@@ -159,7 +157,9 @@  discard block
 block discarded – undo
159 157
 
160 158
     public function __get($name)
161 159
     {
162
-        if( $this->has($name) ) return $this->get($name);
160
+        if( $this->has($name) ) {
161
+            return $this->get($name);
162
+        }
163 163
         return null;
164 164
     }
165 165
 
@@ -170,13 +170,17 @@  discard block
 block discarded – undo
170 170
      */
171 171
     public function hasConditions()
172 172
     {
173
-        if( ! isset($this['conditions']) ) return false;
173
+        if( ! isset($this['conditions']) ) {
174
+            return false;
175
+        }
174 176
         if( is_array($this['conditions']) )
175 177
         {
176 178
             return count($this['conditions']) > 0;
177 179
         }
178 180
         $conditionInstance = "Hideyo\\Services\\Cart\\CartCondition";
179
-        if( $this['conditions'] instanceof $conditionInstance ) return true;
181
+        if( $this['conditions'] instanceof $conditionInstance ) {
182
+            return true;
183
+        }
180 184
         return false;
181 185
     }
182 186
     
@@ -187,7 +191,9 @@  discard block
 block discarded – undo
187 191
      */
188 192
     public function getConditions()
189 193
     {
190
-        if(! $this->hasConditions() ) return [];
194
+        if(! $this->hasConditions() ) {
195
+            return [];
196
+        }
191 197
         return $this['conditions'];
192 198
     }
193 199
 }
194 200
\ No newline at end of file
Please login to merge, or discard this patch.
src/Services/News/NewsService.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,24 +9,24 @@  discard block
 block discarded – undo
9 9
  
10 10
 class NewsService extends BaseService
11 11
 {
12
-	public function __construct(NewsRepository $news)
13
-	{
14
-		$this->repo = $news;
15
-	} 
12
+    public function __construct(NewsRepository $news)
13
+    {
14
+        $this->repo = $news;
15
+    } 
16 16
 
17 17
     public function selectByLimitAndOrderBy($shopId, $limit, $orderBy)
18 18
     {
19
-    	return $this->repo->selectByLimitAndOrderBy($shopId, $limit, $orderBy);
19
+        return $this->repo->selectByLimitAndOrderBy($shopId, $limit, $orderBy);
20 20
     }
21 21
 
22 22
     public function selectOneBySlug($shopId, $slug)
23 23
     {
24
-    	return $this->repo->selectOneBySlug($shopId, $slug);
24
+        return $this->repo->selectOneBySlug($shopId, $slug);
25 25
     }
26 26
 
27 27
     public function selectAllActiveGroupsByShopId($shopId)
28 28
     {
29
-    	return $this->repo->selectAllActiveGroupsByShopId($shopId);
29
+        return $this->repo->selectAllActiveGroupsByShopId($shopId);
30 30
     }
31 31
 
32 32
     public function findGroup($groupId)
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
     public function selectAllGroups()
53 53
     {
54
-       return $this->repo->selectAllGroups();
54
+        return $this->repo->selectAllGroups();
55 55
     }
56 56
 
57 57
 
Please login to merge, or discard this patch.
src/Services/News/Entity/NewsImage.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
     protected $table = 'news_image';
15 15
 
16 16
     // Add the 'avatar' attachment to the fillable array so that it's mass-assignable on this model.
17
-    protected $fillable = ['news_id', 'file', 'extension', 'size', 'path', 'rank', 'tag', 'modified_by_user_id',];
17
+    protected $fillable = ['news_id', 'file', 'extension', 'size', 'path', 'rank', 'tag', 'modified_by_user_id', ];
18 18
 
19 19
     public function news()
20 20
     {
Please login to merge, or discard this patch.
src/Services/ExtraField/ExtraFieldService.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
         );
46 46
         
47 47
         if ($extraFieldId) {
48
-            $rules['title'] =   'required|between:4,65|unique_with:'.$this->repo->getModel()->getTable().', shop_id, '.$extraFieldId.' = id';
48
+            $rules['title'] = 'required|between:4,65|unique_with:'.$this->repo->getModel()->getTable().', shop_id, '.$extraFieldId.' = id';
49 49
         }
50 50
 
51 51
         return $rules;
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@
 block discarded – undo
8 8
  
9 9
 class ExtraFieldService extends BaseService
10 10
 {
11
-	public function __construct(ExtraFieldRepository $extraField)
12
-	{
13
-		$this->repo = $extraField;
14
-	}
11
+    public function __construct(ExtraFieldRepository $extraField)
12
+    {
13
+        $this->repo = $extraField;
14
+    }
15 15
 
16 16
     private function rulesValue($defaultValueId = false)
17 17
     {
Please login to merge, or discard this patch.
src/Services/SendingMethod/SendingMethodService.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@  discard block
 block discarded – undo
8 8
  
9 9
 class SendingMethodService extends BaseService
10 10
 {
11
-	public function __construct(SendingMethodRepository $sendingMethod)
12
-	{
13
-		$this->repo = $sendingMethod;
14
-	} 
11
+    public function __construct(SendingMethodRepository $sendingMethod)
12
+    {
13
+        $this->repo = $sendingMethod;
14
+    } 
15 15
 
16 16
     /**
17 17
      * The validation rules for the model.
@@ -125,14 +125,14 @@  discard block
 block discarded – undo
125 125
         return $model;
126 126
     }
127 127
 
128
-	public function selectAllActiveByShopId($shopId)
128
+    public function selectAllActiveByShopId($shopId)
129 129
     {
130
-    	return $this->repo->selectAllActiveByShopId($shopId);
130
+        return $this->repo->selectAllActiveByShopId($shopId);
131 131
     }
132 132
 
133
-	public function selectOneByShopIdAndId($shopId, $sendingMethodId)
133
+    public function selectOneByShopIdAndId($shopId, $sendingMethodId)
134 134
     {
135
-    	$result = $this->repo->selectOneByShopIdAndId($shopId, $sendingMethodId);
135
+        $result = $this->repo->selectOneByShopIdAndId($shopId, $sendingMethodId);
136 136
 
137 137
         if ($result->isEmpty()) {
138 138
             return false;
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
             'maximal_weight'    => 'numeric|nullable'
30 30
         );
31 31
         
32
-        if($sendingMethodId) {
33
-            $rules['title'] =   $rules['title'].','.$sendingMethodId.' = id';
32
+        if ($sendingMethodId) {
33
+            $rules['title'] = $rules['title'].','.$sendingMethodId.' = id';
34 34
         }
35 35
 
36 36
         return $rules;
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
             'name' => 'required|between:4,65|unique_with:sending_method_country_price, sending_method_id'
45 45
         );
46 46
         
47
-        if($id) {
48
-            $rules['name'] =   'required|between:4,65|unique_with:sending_method_country_price, sending_method_id, '.$id.' = id';
47
+        if ($id) {
48
+            $rules['name'] = 'required|between:4,65|unique_with:sending_method_country_price, sending_method_id, '.$id.' = id';
49 49
         }
50 50
 
51 51
         return $rules;
Please login to merge, or discard this patch.
src/Services/Brand/Entity/BrandImage.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@
 block discarded – undo
13 13
      */
14 14
     protected $table = 'brand_image';
15 15
 
16
-    protected $guarded =  array('file');
16
+    protected $guarded = array('file');
17 17
 
18 18
     // Add the 'avatar' attachment to the fillable array so that it's mass-assignable on this model.
19
-    protected $fillable = ['brand_id', 'file', 'extension', 'size', 'path', 'rank', 'tag', 'modified_by_user_id',];
19
+    protected $fillable = ['brand_id', 'file', 'extension', 'size', 'path', 'rank', 'tag', 'modified_by_user_id', ];
20 20
 }
21 21
\ No newline at end of file
Please login to merge, or discard this patch.