Passed
Branch master (bda0ff)
by Matthijs
02:31
created
src/Services/Order/OrderStatusEmailTemplateService.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@
 block discarded – undo
10 10
 
11 11
 class OrderStatusEmailTemplateService extends BaseService
12 12
 {
13
-	public function __construct(OrderStatusEmailTemplateRepository $orderStatusEmailTemplate)
14
-	{
15
-		$this->repo = $orderStatusEmailTemplate;
16
-	} 
13
+    public function __construct(OrderStatusEmailTemplateRepository $orderStatusEmailTemplate)
14
+    {
15
+        $this->repo = $orderStatusEmailTemplate;
16
+    } 
17 17
 
18 18
 
19 19
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
         );
34 34
         
35 35
         if ($id) {
36
-            $rules['title'] =   'required|unique_with:order_status_email_template, shop_id,'.$id;
36
+            $rules['title'] = 'required|unique_with:order_status_email_template, shop_id,'.$id;
37 37
         }
38 38
 
39 39
         return $rules;
Please login to merge, or discard this patch.
src/Services/Order/OrderStatusService.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@
 block discarded – undo
10 10
 
11 11
 class OrderStatusService extends BaseService
12 12
 {
13
-	public function __construct(OrderStatusRepository $orderStatus)
14
-	{
15
-		$this->repo = $orderStatus;
16
-	} 
13
+    public function __construct(OrderStatusRepository $orderStatus)
14
+    {
15
+        $this->repo = $orderStatus;
16
+    } 
17 17
 
18 18
     /**
19 19
      * The validation rules for the model.
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
         );
30 30
         
31 31
         if ($id) {
32
-            $rules['title'] =   'required|between:4,65|unique_with:order_status, shop_id, '.$id.' = id';
32
+            $rules['title'] = 'required|between:4,65|unique_with:order_status, shop_id, '.$id.' = id';
33 33
         }
34 34
 
35 35
         return $rules;
Please login to merge, or discard this patch.
src/Services/Order/Entity/OrderAddressRepository.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
     
41 41
     function selectAllByOrderId($orderId)
42 42
     {
43
-         return $this->model->where('order_id', '=', $orderId)->get();
43
+            return $this->model->where('order_id', '=', $orderId)->get();
44 44
     }
45 45
     
46 46
 
Please login to merge, or discard this patch.
src/Services/Order/Entity/Order.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
             }
54 54
         });
55 55
 
56
-          parent::boot();
56
+            parent::boot();
57 57
     }
58 58
 
59 59
     public function products()
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@
 block discarded – undo
18 18
     protected $table = 'order';
19 19
 
20 20
     // Add the 'avatar' attachment to the fillable array so that it's mass-assignable on this model.
21
-    protected $fillable = ['id', 'validated', 'client_id', 'shop_id', 'price_with_tax', 'price_without_tax', 'total_discount', 'coupon_id', 'coupon_title',  'coupon_discount_way', 'coupon_type', 'coupon_value', 'coupon_code', 'coupon_group_title', 'bill_order_address_id', 'delivery_order_address_id', 'order_status_id', 'mollie_payment_id', 'comments', 'present_gender', 'present_occassion', 'present_message', 'browser_detect'];
21
+    protected $fillable = ['id', 'validated', 'client_id', 'shop_id', 'price_with_tax', 'price_without_tax', 'total_discount', 'coupon_id', 'coupon_title', 'coupon_discount_way', 'coupon_type', 'coupon_value', 'coupon_code', 'coupon_group_title', 'bill_order_address_id', 'delivery_order_address_id', 'order_status_id', 'mollie_payment_id', 'comments', 'present_gender', 'present_occassion', 'present_message', 'browser_detect'];
22 22
 
23 23
     public static function boot()
24 24
     {
25
-        static::creating(function ($model) {
25
+        static::creating(function($model) {
26 26
 
27 27
             if ($model->created_at) {
28 28
                 $order = Order::where('shop_id', '=', $model->shop_id)->where('created_at', '>=', Carbon::createFromFormat('Y-m-d H:i:s', $model->created_at)->year)->orderBy('id', 'desc')->first();
Please login to merge, or discard this patch.
src/Services/Order/Entity/OrderRepository.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -154,7 +154,7 @@
 block discarded – undo
154 154
 
155 155
         if (Cart::getConditionsByType('payment_method')->count()) {
156 156
 
157
-           $attributes = Cart::getConditionsByType('payment_method')->first()->getAttributes();
157
+            $attributes = Cart::getConditionsByType('payment_method')->first()->getAttributes();
158 158
             $paymentMethod = PaymentMethodService::find($attributes['data']['id']);
159 159
             $price = $paymentMethod->getPriceDetails();
160 160
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     {
55 55
         $attributes['shop_id'] = $shopId;
56 56
         $attributes['client_id'] = $attributes['user_id'];
57
-        $client  = $this->client->selectOneByShopIdAndId($shopId, $attributes['user_id']);
57
+        $client = $this->client->selectOneByShopIdAndId($shopId, $attributes['user_id']);
58 58
 
59 59
         $this->model->fill($attributes);
60 60
         $this->model->save();
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
     public function orderProductsByClientId($clientId, $shopId)
220 220
     {
221 221
 
222
-        return $this->modelOrderProduct->with(array('product'))->whereHas('Order', function ($query) use ($clientId, $shopId) {
222
+        return $this->modelOrderProduct->with(array('product'))->whereHas('Order', function($query) use ($clientId, $shopId) {
223 223
             $query->where('client_id', '=', $clientId)->where('shop_id', '=', $shopId);
224 224
         });
225 225
     }
Please login to merge, or discard this patch.
src/Services/Order/Entity/OrderStatusEmailTemplateRepository.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@
 block discarded – undo
18 18
     public function selectBySendingMethodIdAndPaymentMethodId($paymentMethodId, $sendingMethodId)
19 19
     {
20 20
 
21
-        $result = $this->model->with(array('sendingPaymentMethodRelated' => function ($query) use ($paymentMethodId, $sendingMethodId) {
22
-            $query->with(array('sendingMethod' => function ($query) use ($sendingMethodId) {
21
+        $result = $this->model->with(array('sendingPaymentMethodRelated' => function($query) use ($paymentMethodId, $sendingMethodId) {
22
+            $query->with(array('sendingMethod' => function($query) use ($sendingMethodId) {
23 23
                 $query->where('id', '=', $sendingMethodId);
24
-            }, 'paymentMethod' => function ($query) use ($paymentMethodId) {
24
+            }, 'paymentMethod' => function($query) use ($paymentMethodId) {
25 25
                 $query->where('id', '=', $paymentMethodId);
26 26
             }));
27 27
         } ))
Please login to merge, or discard this patch.
src/Services/Order/Entity/OrderPaymentLogRepository.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
 
58 58
     function selectAllByOrderId($orderId)
59 59
     {
60
-         return $this->model->where('order_id', '=', $orderId)->get();
60
+            return $this->model->where('order_id', '=', $orderId)->get();
61 61
     }
62 62
 
63 63
 }
Please login to merge, or discard this patch.
src/Services/Cart/ItemAttributeCollection.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 
9 9
     public function __get($name)
10 10
     {
11
-        if( $this->has($name) ) return $this->get($name);
11
+        if ($this->has($name)) return $this->get($name);
12 12
         return null;
13 13
     }
14 14
 }
15 15
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@
 block discarded – undo
8 8
 
9 9
     public function __get($name)
10 10
     {
11
-        if( $this->has($name) ) return $this->get($name);
11
+        if( $this->has($name) ) {
12
+            return $this->get($name);
13
+        }
12 14
         return null;
13 15
     }
14 16
 }
15 17
\ No newline at end of file
Please login to merge, or discard this patch.
src/Services/Cart/Cart.php 3 patches
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -594,7 +594,6 @@
 block discarded – undo
594 594
     /**
595 595
      * get the cart voucher
596 596
      *
597
-
598 597
      */
599 598
     public function getVoucher()
600 599
     {
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
         $this->events = $events;
65 65
         $this->session = $session;
66 66
         $this->instanceName = $instanceName;
67
-        $this->sessionKeyCartItems = $session_key . '_cart_items';
68
-        $this->sessionKeyCartConditions = $session_key . '_cart_conditions';
69
-        $this->sessionKeyCartVoucher = $session_key . '_voucher';
67
+        $this->sessionKeyCartItems = $session_key.'_cart_items';
68
+        $this->sessionKeyCartConditions = $session_key.'_cart_conditions';
69
+        $this->sessionKeyCartVoucher = $session_key.'_voucher';
70 70
         $this->fireEvent('created');
71 71
         $this->config = $config;
72 72
     }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      */
152 152
     public function update($id, $data)
153 153
     {
154
-        if($this->fireEvent('updating', $data) === false) {
154
+        if ($this->fireEvent('updating', $data) === false) {
155 155
             return false;
156 156
         }
157 157
         $cart = $this->getContent();
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
      */
248 248
     protected function addRow($id, $item)
249 249
     {
250
-        if($this->fireEvent('adding', $item) === false) {
250
+        if ($this->fireEvent('adding', $item) === false) {
251 251
             return false;
252 252
         }
253 253
         $cart = $this->getContent();
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
             $condition->setOrder(!is_null($last) ? $last->getOrder() + 1 : 1);
281 281
         }
282 282
         $conditions->put($condition->getName(), $condition);
283
-        $conditions = $conditions->sortBy(function ($condition, $key) {
283
+        $conditions = $conditions->sortBy(function($condition, $key) {
284 284
             return $condition->getOrder();
285 285
         });
286 286
         $this->saveConditions($conditions);
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
      */
319 319
     public function getConditionsByType($type)
320 320
     {
321
-        return $this->getConditions()->filter(function (CartCondition $condition) use ($type) {
321
+        return $this->getConditions()->filter(function(CartCondition $condition) use ($type) {
322 322
             return $condition->getType() == $type;
323 323
         });
324 324
     }
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
      */
334 334
     public function removeConditionsByType($type)
335 335
     {
336
-        $this->getConditionsByType($type)->each(function ($condition) {
336
+        $this->getConditionsByType($type)->each(function($condition) {
337 337
             $this->removeCartCondition($condition->getName());
338 338
         });
339 339
     }
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
     public function getSubTotalWithoutConditions($formatted = true)
445 445
     {
446 446
         $cart = $this->getContent();
447
-        $sum = $cart->sum(function ($item) {
447
+        $sum = $cart->sum(function($item) {
448 448
             return $item->getOriginalPriceWithTaxSum();
449 449
         });
450 450
 
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
     public function getSubTotalWithTax($formatted = true)
460 460
     {
461 461
         $cart = $this->getContent();
462
-        $sum = $cart->sum(function ($item) {
462
+        $sum = $cart->sum(function($item) {
463 463
             return $item->getOriginalPriceWithTaxSum(false);
464 464
         });
465 465
 
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
     public function getSubTotalWithoutTax($formatted = true)
476 476
     {
477 477
         $cart = $this->getContent();
478
-        $sum = $cart->sum(function ($item) {
478
+        $sum = $cart->sum(function($item) {
479 479
             return $item->getOriginalPriceWithoutTaxSum(false);
480 480
         });
481 481
 
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
         $process = 0;
496 496
         $conditions = $this
497 497
             ->getConditions()
498
-            ->filter(function ($cond) {
498
+            ->filter(function($cond) {
499 499
                 return $cond->getTarget() === 'subtotal';
500 500
             });
501 501
         // if no conditions were added, just return the sub total
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
             return Helpers::formatValue(floatval($subTotal), $formatted, $this->config);
504 504
         }
505 505
         $conditions
506
-            ->each(function ($cond) use ($subTotal, &$newTotal, &$process) {
506
+            ->each(function($cond) use ($subTotal, &$newTotal, &$process) {
507 507
                 $toBeCalculated = ($process > 0) ? $newTotal : $subTotal;
508 508
                 $newTotal = $cond->applyCondition($toBeCalculated);
509 509
                 $process++;
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
         $process = 0;
527 527
         $conditions = $this
528 528
             ->getConditions()
529
-            ->filter(function ($cond) {
529
+            ->filter(function($cond) {
530 530
                 return $cond->getTarget() === 'subtotal';
531 531
             });
532 532
         // if no conditions were added, just return the sub total
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
             return $subTotal;
535 535
         }
536 536
         $conditions
537
-            ->each(function ($cond) use ($subTotal, &$newTotal, &$process) {
537
+            ->each(function($cond) use ($subTotal, &$newTotal, &$process) {
538 538
                 $toBeCalculated = ($process > 0) ? $newTotal : $subTotal;
539 539
                 $newTotal = $cond->applyConditionWithoutTax($toBeCalculated);
540 540
                 $process++;
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
     public function remove($id)
553 553
     {
554 554
         $cart = $this->getContent();
555
-        if($this->fireEvent('removing', $id) === false) {
555
+        if ($this->fireEvent('removing', $id) === false) {
556 556
             return false;
557 557
         }
558 558
         $cart->forget($id);
@@ -599,18 +599,18 @@  discard block
 block discarded – undo
599 599
     public function getVoucher()
600 600
     {
601 601
         $voucher = $this->session->get($this->sessionKeyCartVoucher);
602
-        if($voucher){
602
+        if ($voucher) {
603 603
 
604 604
         $totalWithTax = self::getTotalWithTax();
605 605
         $totalWithoutTax = self::getTotalWithoutTax();
606
-        $voucher['used_value_with_tax']  = $voucher['value'];
607
-        $voucher['used_value_without_tax']  = $voucher['value'];
608
-        if($totalWithTax <= $voucher['value']) {
609
-            $voucher['used_value_with_tax']  = $voucher['value'] - ($voucher['value'] - $totalWithTax);
606
+        $voucher['used_value_with_tax'] = $voucher['value'];
607
+        $voucher['used_value_without_tax'] = $voucher['value'];
608
+        if ($totalWithTax <= $voucher['value']) {
609
+            $voucher['used_value_with_tax'] = $voucher['value'] - ($voucher['value'] - $totalWithTax);
610 610
         }
611 611
 
612
-        if($totalWithTax <= $voucher['value']) {
613
-            $voucher['used_value_without_tax']  = $voucher['value'] - ($voucher['value'] - $totalWithoutTax);
612
+        if ($totalWithTax <= $voucher['value']) {
613
+            $voucher['used_value_without_tax'] = $voucher['value'] - ($voucher['value'] - $totalWithoutTax);
614 614
         }
615 615
 
616 616
         $this->session->put($this->sessionKeyCartVoucher, $voucher);
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
      */
652 652
     public function clear()
653 653
     {
654
-        if($this->fireEvent('clearing') === false) {
654
+        if ($this->fireEvent('clearing') === false) {
655 655
             return false;
656 656
         }
657 657
         $this->session->put(
@@ -669,6 +669,6 @@  discard block
 block discarded – undo
669 669
      */
670 670
     protected function fireEvent($name, $value = [])
671 671
     {
672
-        return $this->events->fire($this->getInstanceName() . '.' . $name, array_values([$value, $this]));
672
+        return $this->events->fire($this->getInstanceName().'.'.$name, array_values([$value, $this]));
673 673
     }  
674 674
 }
675 675
\ No newline at end of file
Please login to merge, or discard this patch.
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.