@@ -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(); |
@@ -68,21 +68,21 @@ 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') |
83 | 83 | ->getOneNonOrderedCartByCustomer($customer); |
84 | 84 | |
85 | - if( !$cart ) |
|
85 | + if (!$cart) |
|
86 | 86 | $cart = $this->createNewCart($customer); |
87 | 87 | |
88 | 88 | return $cart; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function addProductToCartForm(Request $request, FormInterface $form) |
136 | 136 | { |
137 | - if( $this->handled ) |
|
137 | + if ($this->handled) |
|
138 | 138 | return; |
139 | 139 | |
140 | 140 | $form->handleRequest($request); |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | /** @var SkuskuProductInterface $productReference */ |
151 | 151 | $productReference = $this->em->getReference(SkuskuProductInterface::class, $idProduct); |
152 | 152 | |
153 | - if( !($customer instanceof UserInterface) ) |
|
153 | + if (!($customer instanceof UserInterface)) |
|
154 | 154 | $customer = null; |
155 | 155 | |
156 | - if( !$this->allowAnonymous && !$customer ) |
|
156 | + if (!$this->allowAnonymous && !$customer) |
|
157 | 157 | throw new AccessDeniedException("Anonymous users cannot buy"); |
158 | 158 | |
159 | 159 | $this->addProductToCart($productReference, $quantity); |
@@ -184,10 +184,10 @@ discard block |
||
184 | 184 | $this->em->persist($cart); |
185 | 185 | |
186 | 186 | /** @var SkuskuCartProduct $productCart */ |
187 | - if( $productCart = $cart->getProduct($product)->first() ){ |
|
187 | + if ($productCart = $cart->getProduct($product)->first()) { |
|
188 | 188 | // @todo what?? $productCart->getQuantity() + $quantity |
189 | 189 | $productCart->setQuantity($productCart->getQuantity() + $quantity); |
190 | - }else{ |
|
190 | + } else { |
|
191 | 191 | $productCart = new SkuskuCartProduct(); |
192 | 192 | $productCart->setProduct($product); |
193 | 193 | $productCart->setQuantity($quantity); |
@@ -73,17 +73,20 @@ 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 | - 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') |
83 | 85 | ->getOneNonOrderedCartByCustomer($customer); |
84 | 86 | |
85 | - if( !$cart ) |
|
86 | - $cart = $this->createNewCart($customer); |
|
87 | + if( !$cart ) { |
|
88 | + $cart = $this->createNewCart($customer); |
|
89 | + } |
|
87 | 90 | |
88 | 91 | return $cart; |
89 | 92 | } |
@@ -134,8 +137,9 @@ discard block |
||
134 | 137 | */ |
135 | 138 | public function addProductToCartForm(Request $request, FormInterface $form) |
136 | 139 | { |
137 | - if( $this->handled ) |
|
138 | - return; |
|
140 | + if( $this->handled ) { |
|
141 | + return; |
|
142 | + } |
|
139 | 143 | |
140 | 144 | $form->handleRequest($request); |
141 | 145 | |
@@ -150,11 +154,13 @@ discard block |
||
150 | 154 | /** @var SkuskuProductInterface $productReference */ |
151 | 155 | $productReference = $this->em->getReference(SkuskuProductInterface::class, $idProduct); |
152 | 156 | |
153 | - if( !($customer instanceof UserInterface) ) |
|
154 | - $customer = null; |
|
157 | + if( !($customer instanceof UserInterface) ) { |
|
158 | + $customer = null; |
|
159 | + } |
|
155 | 160 | |
156 | - if( !$this->allowAnonymous && !$customer ) |
|
157 | - throw new AccessDeniedException("Anonymous users cannot buy"); |
|
161 | + if( !$this->allowAnonymous && !$customer ) { |
|
162 | + throw new AccessDeniedException("Anonymous users cannot buy"); |
|
163 | + } |
|
158 | 164 | |
159 | 165 | $this->addProductToCart($productReference, $quantity); |
160 | 166 | } |
@@ -187,7 +193,7 @@ discard block |
||
187 | 193 | if( $productCart = $cart->getProduct($product)->first() ){ |
188 | 194 | // @todo what?? $productCart->getQuantity() + $quantity |
189 | 195 | $productCart->setQuantity($productCart->getQuantity() + $quantity); |
190 | - }else{ |
|
196 | + } else{ |
|
191 | 197 | $productCart = new SkuskuCartProduct(); |
192 | 198 | $productCart->setProduct($product); |
193 | 199 | $productCart->setQuantity($quantity); |
@@ -84,7 +84,7 @@ |
||
84 | 84 | $paymentMethod = $data->getPaymentMethod(); |
85 | 85 | |
86 | 86 | // se non è settato vuol dire che non ci sono ancora arrivato |
87 | - if( !$paymentMethod ) |
|
87 | + if (!$paymentMethod) |
|
88 | 88 | return false; |
89 | 89 | |
90 | 90 | /** @var GatewayInterface $gateway */ |
@@ -84,8 +84,9 @@ |
||
84 | 84 | $paymentMethod = $data->getPaymentMethod(); |
85 | 85 | |
86 | 86 | // se non è settato vuol dire che non ci sono ancora arrivato |
87 | - if( !$paymentMethod ) |
|
88 | - return false; |
|
87 | + if( !$paymentMethod ) { |
|
88 | + return false; |
|
89 | + } |
|
89 | 90 | |
90 | 91 | /** @var GatewayInterface $gateway */ |
91 | 92 | $gateway = $this->payum->getGateway($paymentMethod); |
@@ -110,5 +110,5 @@ |
||
110 | 110 | return $this->getProduct()->getPrice(); |
111 | 111 | } |
112 | 112 | |
113 | - public function getProductAttribute(){} |
|
113 | + public function getProductAttribute() {} |
|
114 | 114 | } |