@@ -68,12 +68,12 @@ 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 SkuskuCustomerInterface) ) { |
|
76 | + if (!($customer instanceof SkuskuCustomerInterface)) { |
|
77 | 77 | $customer = null; |
78 | 78 | } |
79 | 79 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | ->getRepository('GGGGino\SkuskuCartBundle\Model\SkuskuCart') |
82 | 82 | ->getOneNonOrderedCartByCustomer($customer); |
83 | 83 | |
84 | - if ( !$cart ) { |
|
84 | + if (!$cart) { |
|
85 | 85 | $cart = $this->createNewCart($customer); |
86 | 86 | } |
87 | 87 | |
@@ -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 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $this->em->persist($cart); |
183 | 183 | |
184 | 184 | /** @var SkuskuCartProduct $productCart */ |
185 | - if ( $productCart = $cart->getProduct($product)->first() ) { |
|
185 | + if ($productCart = $cart->getProduct($product)->first()) { |
|
186 | 186 | // @todo what?? $productCart->getQuantity() + $quantity |
187 | 187 | $productCart->setQuantity($productCart->getQuantity() + $quantity); |
188 | 188 | } else { |
@@ -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 |
@@ -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 ) { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | $response = $flow->handleSubmit($form, $formData); |
59 | 59 | |
60 | - if ( $response instanceof RedirectResponse ) { |
|
60 | + if ($response instanceof RedirectResponse) { |
|
61 | 61 | return $response; |
62 | 62 | } |
63 | 63 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | $flow->handleDone($payment, $status); |
121 | 121 | |
122 | - if ( $this->container->hasParameter('ggggino_skuskucart.templates.done_layout') ) { |
|
122 | + if ($this->container->hasParameter('ggggino_skuskucart.templates.done_layout')) { |
|
123 | 123 | return $this->render($this->container->getParameter('ggggino_skuskucart.templates.done_layout'), array( |
124 | 124 | 'status' => $status, |
125 | 125 | 'payment' => $payment |
@@ -49,7 +49,7 @@ |
||
49 | 49 | /** @var SkuskuCurrencyInterface[] $Currencies */ |
50 | 50 | $currencies = $em->getRepository(SkuskuCurrencyInterface::class)->findAll(); |
51 | 51 | |
52 | - if ( count($currencies) > 0 ) { |
|
52 | + if (count($currencies) > 0) { |
|
53 | 53 | return 'Currency: <info> correct</info>'; |
54 | 54 | } else { |
55 | 55 | return 'Currency: <error>not correct</error>'; |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | |
62 | 62 | // If i make a mistake writing the class this enforce you to chose |
63 | 63 | // @todo now i'm forced to write thee entity namespace wth 2 backslash otherwise it will be removed |
64 | - if ( !in_array($input->getArgument('entity'), $abstractEntities) ) { |
|
65 | - $output->writeln('<error>Entity: ' . $input->getArgument('entity') . ' Not found</error>'); |
|
64 | + if (!in_array($input->getArgument('entity'), $abstractEntities)) { |
|
65 | + $output->writeln('<error>Entity: '.$input->getArgument('entity').' Not found</error>'); |
|
66 | 66 | $question = new ChoiceQuestion( |
67 | 67 | 'Please select the entity', |
68 | 68 | array_keys($abstractEntitiesInverted) |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | |
94 | 94 | $classReflectedProps = $classReflected->getProperties(); |
95 | 95 | |
96 | - foreach($classReflectedProps as $key => $value) { |
|
97 | - $question = new Question('Set value for (' . $value->name . '): ', false); |
|
96 | + foreach ($classReflectedProps as $key => $value) { |
|
97 | + $question = new Question('Set value for ('.$value->name.'): ', false); |
|
98 | 98 | |
99 | 99 | $response = $helper->ask($input, $output, $question); |
100 | - if( !$response ){ |
|
100 | + if (!$response) { |
|
101 | 101 | continue; |
102 | 102 | } |
103 | 103 | $propertyAccessor->setValue($entityInstance, $value->name, $response); |
@@ -47,7 +47,7 @@ |
||
47 | 47 | 'disabled' => true |
48 | 48 | )); |
49 | 49 | |
50 | - $builder->addEventListener(FormEvents::POST_SET_DATA, function (FormEvent $event) { |
|
50 | + $builder->addEventListener(FormEvents::POST_SET_DATA, function(FormEvent $event) { |
|
51 | 51 | /** @var FormInterface $form */ |
52 | 52 | $form = $event->getForm(); |
53 | 53 |