@@ -12,8 +12,8 @@ |
||
12 | 12 | */ |
13 | 13 | public function __construct($message = "", $code = 0, \Exception $previous = null) |
14 | 14 | { |
15 | - if( !empty($message) ) |
|
16 | - $message = ": " . $message; |
|
15 | + if (!empty($message)) |
|
16 | + $message = ": ".$message; |
|
17 | 17 | |
18 | 18 | $finalMessage = sprintf("Currency not found, maybe the db table is empty%s", $message); |
19 | 19 | parent::__construct($finalMessage, $code, $previous); |
@@ -12,8 +12,9 @@ |
||
12 | 12 | */ |
13 | 13 | public function __construct($message = "", $code = 0, \Exception $previous = null) |
14 | 14 | { |
15 | - if( !empty($message) ) |
|
16 | - $message = ": " . $message; |
|
15 | + if( !empty($message) ) { |
|
16 | + $message = ": " . $message; |
|
17 | + } |
|
17 | 18 | |
18 | 19 | $finalMessage = sprintf("Currency not found, maybe the db table is empty%s", $message); |
19 | 20 | parent::__construct($finalMessage, $code, $previous); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function renderPreviewCart($template = null) |
100 | 100 | { |
101 | - if( !$template ) |
|
101 | + if (!$template) |
|
102 | 102 | $template = $this->templatePreviewCart; |
103 | 103 | |
104 | 104 | /** @var SkuskuCart $cart */ |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function renderCurrencyCart($template = null) |
119 | 119 | { |
120 | - if( !$template ) |
|
120 | + if (!$template) |
|
121 | 121 | $template = $this->templateCurrencyCart; |
122 | 122 | |
123 | 123 | /** @var SkuskuCurrencyInterface[] $currencies */ |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function renderLangCart($template = null) |
139 | 139 | { |
140 | - if( !$template ) |
|
140 | + if (!$template) |
|
141 | 141 | $template = $this->templateLangCart; |
142 | 142 | |
143 | 143 | /** @var SkuskuLangInterface[] $languages */ |
@@ -98,8 +98,9 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function renderPreviewCart($template = null) |
100 | 100 | { |
101 | - if( !$template ) |
|
102 | - $template = $this->templatePreviewCart; |
|
101 | + if( !$template ) { |
|
102 | + $template = $this->templatePreviewCart; |
|
103 | + } |
|
103 | 104 | |
104 | 105 | /** @var SkuskuCart $cart */ |
105 | 106 | $cart = $this->cartManager->getCartFromCustomer(); |
@@ -117,8 +118,9 @@ discard block |
||
117 | 118 | */ |
118 | 119 | public function renderCurrencyCart($template = null) |
119 | 120 | { |
120 | - if( !$template ) |
|
121 | - $template = $this->templateCurrencyCart; |
|
121 | + if( !$template ) { |
|
122 | + $template = $this->templateCurrencyCart; |
|
123 | + } |
|
122 | 124 | |
123 | 125 | /** @var SkuskuCurrencyInterface[] $currencies */ |
124 | 126 | $currencies = $this->currencyManager->getActiveCurrencies(); |
@@ -137,8 +139,9 @@ discard block |
||
137 | 139 | */ |
138 | 140 | public function renderLangCart($template = null) |
139 | 141 | { |
140 | - if( !$template ) |
|
141 | - $template = $this->templateLangCart; |
|
142 | + if( !$template ) { |
|
143 | + $template = $this->templateLangCart; |
|
144 | + } |
|
142 | 145 | |
143 | 146 | /** @var SkuskuLangInterface[] $languages */ |
144 | 147 | $languages = $this->langManager->getActiveLanguages(); |
@@ -110,5 +110,5 @@ |
||
110 | 110 | return $this->getProduct()->getPrice(); |
111 | 111 | } |
112 | 112 | |
113 | - public function getProductAttribute(){} |
|
113 | + public function getProductAttribute() {} |
|
114 | 114 | } |
@@ -68,19 +68,19 @@ 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 | 79 | $cart = $this->em |
80 | 80 | ->getRepository('GGGGino\SkuskuCartBundle\Model\SkuskuCart') |
81 | 81 | ->getOneNonOrderedCartByCustomer($customer); |
82 | 82 | |
83 | - if( !$cart ) |
|
83 | + if (!$cart) |
|
84 | 84 | $cart = $this->createNewCart($customer); |
85 | 85 | |
86 | 86 | return $cart; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public function addProductToCartForm(Request $request, FormInterface $form) |
134 | 134 | { |
135 | - if( $this->handled ) |
|
135 | + if ($this->handled) |
|
136 | 136 | return; |
137 | 137 | |
138 | 138 | $form->handleRequest($request); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | /** @var SkuskuProductInterface $productReference */ |
149 | 149 | $productReference = $this->em->getReference(SkuskuProductInterface::class, $idProduct); |
150 | 150 | |
151 | - if( !($customer instanceof UserInterface) ) |
|
151 | + if (!($customer instanceof UserInterface)) |
|
152 | 152 | $customer = null; |
153 | 153 | |
154 | 154 | $this->addProductToCart($productReference, $quantity); |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | $this->em->persist($cart); |
180 | 180 | |
181 | 181 | /** @var SkuskuCartProduct $productCart */ |
182 | - if( $productCart = $cart->getProduct($product)->first() ){ |
|
182 | + if ($productCart = $cart->getProduct($product)->first()) { |
|
183 | 183 | // @todo what?? $productCart->getQuantity() + $quantity |
184 | 184 | $productCart->setQuantity($productCart->getQuantity() + $quantity); |
185 | - }else{ |
|
185 | + } else { |
|
186 | 186 | $productCart = new SkuskuCartProduct(); |
187 | 187 | $productCart->setProduct($product); |
188 | 188 | $productCart->setQuantity($quantity); |
@@ -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,7 +100,7 @@ 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 ) |
|
103 | + if (!$paymentMethod) |
|
104 | 104 | return false; |
105 | 105 | |
106 | 106 | /** @var GatewayInterface $gateway */ |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | if ($this->isValid($form)) { |
126 | 126 | $this->saveCurrentStepData($form); |
127 | 127 | |
128 | - if( !$this->allowAnonymous ) |
|
128 | + if (!$this->allowAnonymous) |
|
129 | 129 | throw new AccessDeniedException("Anonymous users cannot buy"); |
130 | 130 | |
131 | 131 | // @todo done this because craue form flow doesn't permit to add a custom action |
132 | - if( $this->requestStack->getCurrentRequest()->request->get('flow_cart_transition') == self::TRANSITION_RESET_CART ){ |
|
132 | + if ($this->requestStack->getCurrentRequest()->request->get('flow_cart_transition') == self::TRANSITION_RESET_CART) { |
|
133 | 133 | $this->emptyCart($formData); |
134 | 134 | $this->reset(); |
135 | 135 | $form = $this->createForm(); |
@@ -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,7 +30,7 @@ |
||
30 | 30 | */ |
31 | 31 | public function getOneNonOrderedCartByCustomer(SkuskuCustomerInterface $customer = null) |
32 | 32 | { |
33 | - if( !$customer ) |
|
33 | + if (!$customer) |
|
34 | 34 | return null; |
35 | 35 | |
36 | 36 | $qb = $this->createQueryBuilder('c') |
@@ -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') |