Test Failed
Push — master ( c17565...48ddb2 )
by David
04:25
created
Service/CartManager.php 1 patch
Braces   +19 added lines, -13 removed lines patch added patch discarded remove patch
@@ -73,16 +73,19 @@  discard block
 block discarded – undo
73 73
         }
74 74
 
75 75
         // If the user is anon. the arg $customer is a string, so i check it
76
-        if( !($customer instanceof UserInterface) )
77
-            $customer = null;
76
+        if( !($customer instanceof UserInterface) ) {
77
+                    $customer = null;
78
+        }
78 79
 
79
-        if( !$this->allowAnonymous && !$customer )
80
-            throw new AccessDeniedException("Anonymous users cannot buy");
80
+        if( !$this->allowAnonymous && !$customer ) {
81
+                    throw new AccessDeniedException("Anonymous users cannot buy");
82
+        }
81 83
 
82 84
         $cart = $this->em->getRepository('GGGGino\SkuskuCartBundle\Model\SkuskuCart')->findOneByCustomer($customer);
83 85
 
84
-        if( !$cart )
85
-            $cart = $this->createNewCart($customer);
86
+        if( !$cart ) {
87
+                    $cart = $this->createNewCart($customer);
88
+        }
86 89
 
87 90
         return $cart;
88 91
     }
@@ -133,8 +136,9 @@  discard block
 block discarded – undo
133 136
      */
134 137
     public function addProductToCartForm(Request $request, FormInterface $form)
135 138
     {
136
-        if( $this->handled )
137
-            return;
139
+        if( $this->handled ) {
140
+                    return;
141
+        }
138 142
 
139 143
         $form->handleRequest($request);
140 144
 
@@ -149,11 +153,13 @@  discard block
 block discarded – undo
149 153
             /** @var SkuskuProductInterface $productReference */
150 154
             $productReference = $this->em->getReference(SkuskuProductInterface::class, $idProduct);
151 155
 
152
-            if( !($customer instanceof UserInterface) )
153
-                $customer = null;
156
+            if( !($customer instanceof UserInterface) ) {
157
+                            $customer = null;
158
+            }
154 159
 
155
-            if( !$this->allowAnonymous && !$customer )
156
-                throw new AccessDeniedException("Anonymous users cannot buy");
160
+            if( !$this->allowAnonymous && !$customer ) {
161
+                            throw new AccessDeniedException("Anonymous users cannot buy");
162
+            }
157 163
 
158 164
             $this->addProductToCart($productReference, $quantity);
159 165
         }
@@ -186,7 +192,7 @@  discard block
 block discarded – undo
186 192
         if( $productCart = $cart->getProduct($product)->first() ){
187 193
             // @todo what?? $productCart->getQuantity() + $quantity
188 194
             $productCart->setQuantity($productCart->getQuantity() + $quantity);
189
-        }else{
195
+        } else{
190 196
             $productCart = new SkuskuCartProduct();
191 197
             $productCart->setProduct($product);
192 198
             $productCart->setQuantity($quantity);
Please login to merge, or discard this patch.