@@ -68,20 +68,20 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public function getCartFromCustomer(SkuskuCustomerInterface $customer = null) |
| 70 | 70 | { |
| 71 | - if( !$customer ) { |
|
| 71 | + if (!$customer) { |
|
| 72 | 72 | $customer = $this->tokenStorage->getToken()->getUser(); |
| 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) ) |
|
| 76 | + if (!($customer instanceof UserInterface)) |
|
| 77 | 77 | $customer = null; |
| 78 | 78 | |
| 79 | - if( !$this->allowAnonymous && !$customer ) |
|
| 79 | + if (!$this->allowAnonymous && !$customer) |
|
| 80 | 80 | throw new AccessDeniedException("Anonymous users cannot buy"); |
| 81 | 81 | |
| 82 | 82 | $cart = $this->em->getRepository('GGGGino\SkuskuCartBundle\Model\SkuskuCart')->findOneByCustomer($customer); |
| 83 | 83 | |
| 84 | - if( !$cart ) |
|
| 84 | + if (!$cart) |
|
| 85 | 85 | $cart = $this->createNewCart($customer); |
| 86 | 86 | |
| 87 | 87 | return $cart; |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | public function addProductToCartForm(Request $request, FormInterface $form) |
| 135 | 135 | { |
| 136 | - if( $this->handled ) |
|
| 136 | + if ($this->handled) |
|
| 137 | 137 | return; |
| 138 | 138 | |
| 139 | 139 | $form->handleRequest($request); |
@@ -149,10 +149,10 @@ discard block |
||
| 149 | 149 | /** @var SkuskuProductInterface $productReference */ |
| 150 | 150 | $productReference = $this->em->getReference(SkuskuProductInterface::class, $idProduct); |
| 151 | 151 | |
| 152 | - if( !($customer instanceof UserInterface) ) |
|
| 152 | + if (!($customer instanceof UserInterface)) |
|
| 153 | 153 | $customer = null; |
| 154 | 154 | |
| 155 | - if( !$this->allowAnonymous && !$customer ) |
|
| 155 | + if (!$this->allowAnonymous && !$customer) |
|
| 156 | 156 | throw new AccessDeniedException("Anonymous users cannot buy"); |
| 157 | 157 | |
| 158 | 158 | $this->addProductToCart($productReference, $quantity); |
@@ -183,10 +183,10 @@ discard block |
||
| 183 | 183 | $this->em->persist($cart); |
| 184 | 184 | |
| 185 | 185 | /** @var SkuskuCartProduct $productCart */ |
| 186 | - if( $productCart = $cart->getProduct($product)->first() ){ |
|
| 186 | + if ($productCart = $cart->getProduct($product)->first()) { |
|
| 187 | 187 | // @todo what?? $productCart->getQuantity() + $quantity |
| 188 | 188 | $productCart->setQuantity($productCart->getQuantity() + $quantity); |
| 189 | - }else{ |
|
| 189 | + } else { |
|
| 190 | 190 | $productCart = new SkuskuCartProduct(); |
| 191 | 191 | $productCart->setProduct($product); |
| 192 | 192 | $productCart->setQuantity($quantity); |