@@ -73,15 +73,17 @@ discard block |
||
| 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 | 80 | $cart = $this->em |
| 80 | 81 | ->getRepository('GGGGino\SkuskuCartBundle\Model\SkuskuCart') |
| 81 | 82 | ->getOneNonOrderedCartByCustomer($customer); |
| 82 | 83 | |
| 83 | - if( !$cart ) |
|
| 84 | - $cart = $this->createNewCart($customer); |
|
| 84 | + if( !$cart ) { |
|
| 85 | + $cart = $this->createNewCart($customer); |
|
| 86 | + } |
|
| 85 | 87 | |
| 86 | 88 | return $cart; |
| 87 | 89 | } |
@@ -132,8 +134,9 @@ discard block |
||
| 132 | 134 | */ |
| 133 | 135 | public function addProductToCartForm(Request $request, FormInterface $form) |
| 134 | 136 | { |
| 135 | - if( $this->handled ) |
|
| 136 | - return; |
|
| 137 | + if( $this->handled ) { |
|
| 138 | + return; |
|
| 139 | + } |
|
| 137 | 140 | |
| 138 | 141 | $form->handleRequest($request); |
| 139 | 142 | |
@@ -148,8 +151,9 @@ discard block |
||
| 148 | 151 | /** @var SkuskuProductInterface $productReference */ |
| 149 | 152 | $productReference = $this->em->getReference(SkuskuProductInterface::class, $idProduct); |
| 150 | 153 | |
| 151 | - if( !($customer instanceof UserInterface) ) |
|
| 152 | - $customer = null; |
|
| 154 | + if( !($customer instanceof UserInterface) ) { |
|
| 155 | + $customer = null; |
|
| 156 | + } |
|
| 153 | 157 | |
| 154 | 158 | $this->addProductToCart($productReference, $quantity); |
| 155 | 159 | } |
@@ -182,7 +186,7 @@ discard block |
||
| 182 | 186 | if( $productCart = $cart->getProduct($product)->first() ){ |
| 183 | 187 | // @todo what?? $productCart->getQuantity() + $quantity |
| 184 | 188 | $productCart->setQuantity($productCart->getQuantity() + $quantity); |
| 185 | - }else{ |
|
| 189 | + } else{ |
|
| 186 | 190 | $productCart = new SkuskuCartProduct(); |
| 187 | 191 | $productCart->setProduct($product); |
| 188 | 192 | $productCart->setQuantity($quantity); |
@@ -100,8 +100,9 @@ discard block |
||
| 100 | 100 | $paymentMethod = $data->getPaymentMethod(); |
| 101 | 101 | |
| 102 | 102 | // se non è settato vuol dire che non ci sono ancora arrivato |
| 103 | - if( !$paymentMethod ) |
|
| 104 | - return false; |
|
| 103 | + if( !$paymentMethod ) { |
|
| 104 | + return false; |
|
| 105 | + } |
|
| 105 | 106 | |
| 106 | 107 | /** @var GatewayInterface $gateway */ |
| 107 | 108 | $gateway = $this->payum->getGateway($paymentMethod); |
@@ -125,8 +126,9 @@ discard block |
||
| 125 | 126 | if ($this->isValid($form)) { |
| 126 | 127 | $this->saveCurrentStepData($form); |
| 127 | 128 | |
| 128 | - if( !$this->allowAnonymous ) |
|
| 129 | - throw new AccessDeniedException("Anonymous users cannot buy"); |
|
| 129 | + if( !$this->allowAnonymous ) { |
|
| 130 | + throw new AccessDeniedException("Anonymous users cannot buy"); |
|
| 131 | + } |
|
| 130 | 132 | |
| 131 | 133 | // @todo done this because craue form flow doesn't permit to add a custom action |
| 132 | 134 | if( $this->requestStack->getCurrentRequest()->request->get('flow_cart_transition') == self::TRANSITION_RESET_CART ){ |
@@ -30,8 +30,9 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | public function getOneNonOrderedCartByCustomer(SkuskuCustomerInterface $customer = null) |
| 32 | 32 | { |
| 33 | - if( !$customer ) |
|
| 34 | - return null; |
|
| 33 | + if( !$customer ) { |
|
| 34 | + return null; |
|
| 35 | + } |
|
| 35 | 36 | |
| 36 | 37 | $qb = $this->createQueryBuilder('c') |
| 37 | 38 | ->where('c.status = :status') |