Passed
Pull Request — master (#23)
by Cesar
02:07
created
controllers/front/AbstractController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         }
125 125
         $parsedUrl = parse_url($url);
126 126
         $separator = ($parsedUrl['query'] == null) ? '?' : '&';
127
-        $redirectUrl = $url. $separator . http_build_query($parameters);
127
+        $redirectUrl = $url.$separator.http_build_query($parameters);
128 128
         Tools::redirect($redirectUrl);
129 129
         return;
130 130
     }
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
             429 => "Too Many Requests",
155 155
             500 => "Internal Server Error",
156 156
         );
157
-        return isset($httpStatusCodes)? $httpStatusCodes[$statusCode] : $httpStatusCodes[200];
157
+        return isset($httpStatusCodes) ? $httpStatusCodes[$statusCode] : $httpStatusCodes[200];
158 158
     }
159 159
 
160 160
     /**
Please login to merge, or discard this patch.
controllers/front/log.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
 
45 45
         header('HTTP/1.1 200 Ok', true, 200);
46 46
         header('Content-Type: application/json', true);
47
-        header('Content-Length: ' . Tools::strlen($result));
47
+        header('Content-Length: '.Tools::strlen($result));
48 48
 
49 49
         echo $result;
50 50
         exit();
Please login to merge, or discard this patch.
controllers/front/notify.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
     private function getPmtOrderId()
185 185
     {
186 186
         try {
187
-            $this->pmtOrderId= Db::getInstance()->getValue(
187
+            $this->pmtOrderId = Db::getInstance()->getValue(
188 188
                 'select order_id from '._DB_PREFIX_.'pmt_order where id = '.$this->merchantOrderId
189 189
             );
190 190
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
     public function validateAmount()
247 247
     {
248 248
         $totalAmount = $this->pmtOrder->getShoppingCart()->getTotalAmount();
249
-        $merchantAmount = (int)((string) (100 * $this->merchantOrder->getOrderTotal(true)));
249
+        $merchantAmount = (int) ((string) (100 * $this->merchantOrder->getOrderTotal(true)));
250 250
         if ($totalAmount != $merchantAmount) {
251 251
             throw new AmountMismatchException($totalAmount, $merchantAmount);
252 252
         }
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
                 Configuration::get('PS_OS_PAYMENT'),
266 266
                 $this->merchantOrder->getOrderTotal(true),
267 267
                 $this->module->displayName,
268
-                'pmtOrderId: ' . $this->pmtOrder->getId(),
268
+                'pmtOrderId: '.$this->pmtOrder->getId(),
269 269
                 array('transaction_id' => $this->pmtOrderId),
270 270
                 null,
271 271
                 false,
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
     protected function unblockConcurrency()
325 325
     {
326 326
         try {
327
-            Db::getInstance()->delete('pmt_cart_process', 'timestamp < ' . (time() - 6));
327
+            Db::getInstance()->delete('pmt_cart_process', 'timestamp < '.(time() - 6));
328 328
         } catch (\Exception $exception) {
329 329
             throw new ConcurrencyException();
330 330
         }
@@ -339,13 +339,13 @@  discard block
 block discarded – undo
339 339
     public function cancelProcess()
340 340
     {
341 341
         if ($this->merchantOrder) {
342
-            $id = (!is_null($this->pmtOrder))?$this->pmtOrder->getId():null;
342
+            $id = (!is_null($this->pmtOrder)) ? $this->pmtOrder->getId() : null;
343 343
             $this->module->validateOrder(
344 344
                 $this->merchantOrderId,
345 345
                 Configuration::get('PS_OS_ERROR'),
346 346
                 $this->merchantOrder->getOrderTotal(true),
347 347
                 $this->module->displayName,
348
-                'pmtOrderId: ' . $id,
348
+                'pmtOrderId: '.$id,
349 349
                 null,
350 350
                 null,
351 351
                 false,
@@ -383,9 +383,9 @@  discard block
 block discarded – undo
383 383
             'id_cart' => $this->merchantOrderId,
384 384
             'key' => $this->config['secureKey'],
385 385
             'id_module' => $this->module->id,
386
-            'id_order' => ($this->pmtOrder)?$this->pmtOrder->getId(): null,
386
+            'id_order' => ($this->pmtOrder) ? $this->pmtOrder->getId() : null,
387 387
         );
388
-        $url = ($error)? $this->config['urlKO'] : $this->config['urlOK'];
388
+        $url = ($error) ? $this->config['urlKO'] : $this->config['urlOK'];
389 389
         return $this->redirect($error, $url, $parameters);
390 390
     }
391 391
 }
Please login to merge, or discard this patch.
controllers/front/payment.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,8 +72,8 @@
 block discarded – undo
72 72
         $paylaterPublicKey = Configuration::get('pmt_public_key');
73 73
         $paylaterPrivateKey = Configuration::get('pmt_private_key');
74 74
         $okUrl = _PS_BASE_URL_.__PS_BASE_URI__
75
-                 .'index.php?canonical=true&fc=module&module=paylater&controller=notify&'
76
-                 .http_build_query($query)
75
+                    .'index.php?canonical=true&fc=module&module=paylater&controller=notify&'
76
+                    .http_build_query($query)
77 77
         ;
78 78
 
79 79
         $shippingAddress = new Address($cart->id_address_delivery);
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -15,9 +15,9 @@  discard block
 block discarded – undo
15 15
     {
16 16
         if (_PS_VERSION_ < 1.6) {
17 17
             Logger::addLog(
18
-                'PagaMasTarde Exception For user ' .
19
-                $customer->email .
20
-                ' : ' .
18
+                'PagaMasTarde Exception For user '.
19
+                $customer->email.
20
+                ' : '.
21 21
                 $exception->getMessage(),
22 22
                 3,
23 23
                 $exception->getCode(),
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
             );
28 28
         } else {
29 29
             PrestaShopLogger::addLog(
30
-                'PagaMasTarde Exception For user ' .
31
-                $customer->email .
32
-                ' : ' .
30
+                'PagaMasTarde Exception For user '.
31
+                $customer->email.
32
+                ' : '.
33 33
                 $exception->getMessage(),
34 34
                 3,
35 35
                 $exception->getCode(),
@@ -88,22 +88,22 @@  discard block
 block discarded – undo
88 88
         );
89 89
 
90 90
         try {
91
-            $userAddress =  new \PagaMasTarde\OrdersApiClient\Model\Order\User\Address();
91
+            $userAddress = new \PagaMasTarde\OrdersApiClient\Model\Order\User\Address();
92 92
             $userAddress
93 93
                 ->setZipCode($shippingAddress->postcode)
94
-                ->setFullName($shippingAddress->firstname . ' ' . $shippingAddress->lastname)
94
+                ->setFullName($shippingAddress->firstname.' '.$shippingAddress->lastname)
95 95
                 ->setCountryCode('ES')
96 96
                 ->setCity($shippingAddress->city)
97
-                ->setAddress($shippingAddress->address1 . ' ' . $shippingAddress->address2)
97
+                ->setAddress($shippingAddress->address1.' '.$shippingAddress->address2)
98 98
             ;
99 99
 
100
-            $orderShippingAddress =  new \PagaMasTarde\OrdersApiClient\Model\Order\User\Address();
100
+            $orderShippingAddress = new \PagaMasTarde\OrdersApiClient\Model\Order\User\Address();
101 101
             $orderShippingAddress
102 102
                 ->setZipCode($shippingAddress->postcode)
103
-                ->setFullName($shippingAddress->firstname . ' ' . $shippingAddress->lastname)
103
+                ->setFullName($shippingAddress->firstname.' '.$shippingAddress->lastname)
104 104
                 ->setCountryCode('ES')
105 105
                 ->setCity($shippingAddress->city)
106
-                ->setAddress($shippingAddress->address1 . ' ' . $shippingAddress->address2)
106
+                ->setAddress($shippingAddress->address1.' '.$shippingAddress->address2)
107 107
                 ->setDni($shippingAddress->dni)
108 108
                 ->setFixPhone($shippingAddress->phone)
109 109
                 ->setMobilePhone($shippingAddress->phone_mobile)
@@ -112,10 +112,10 @@  discard block
 block discarded – undo
112 112
             $orderBillingAddress = new \PagaMasTarde\OrdersApiClient\Model\Order\User\Address();
113 113
             $orderBillingAddress
114 114
                 ->setZipCode($billingAddress->postcode)
115
-                ->setFullName($billingAddress->firstname . ' ' . $billingAddress->lastname)
115
+                ->setFullName($billingAddress->firstname.' '.$billingAddress->lastname)
116 116
                 ->setCountryCode('ES')
117 117
                 ->setCity($billingAddress->city)
118
-                ->setAddress($billingAddress->address1 . ' ' . $billingAddress->address2)
118
+                ->setAddress($billingAddress->address1.' '.$billingAddress->address2)
119 119
                 ->setDni($billingAddress->dni)
120 120
                 ->setFixPhone($billingAddress->phone)
121 121
                 ->setMobilePhone($billingAddress->phone_mobile)
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
                 ->setDni($shippingAddress->dni)
134 134
             ;
135 135
 
136
-            if ($customer->birthday!='0000-00-00') {
136
+            if ($customer->birthday != '0000-00-00') {
137 137
                 $orderUser->setDateOfBirth($customer->birthday);
138 138
             }
139 139
 
@@ -207,13 +207,13 @@  discard block
 block discarded – undo
207 207
         } catch (\Exception $exception) {
208 208
             $this->saveLog(
209 209
                 array(
210
-                    'exception' => 'Exception for user ' . $customer->email . ' : ' . $exception->getMessage()
210
+                    'exception' => 'Exception for user '.$customer->email.' : '.$exception->getMessage()
211 211
                 )
212 212
             );
213 213
             Tools::redirect($cancelUrl);
214 214
         }
215 215
 
216
-        $url ='';
216
+        $url = '';
217 217
         try {
218 218
             $orderClient = new \PagaMasTarde\OrdersApiClient\Client(
219 219
                 $paylaterPublicKey,
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
                 $url = $order->getActionUrls()->getForm();
225 225
                 $orderId = $order->getId();
226 226
                 $result = Db::getInstance()->execute(
227
-                    "INSERT INTO `" . _DB_PREFIX_ . "pmt_order` (`id`, `order_id`)
227
+                    "INSERT INTO `"._DB_PREFIX_."pmt_order` (`id`, `order_id`)
228 228
                      VALUES ('$cart->id','$orderId') 
229 229
                      ON DUPLICATE KEY UPDATE `order_id` = '$orderId'"
230 230
                 );
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
         } catch (\Exception $exception) {
238 238
             $this->saveLog(
239 239
                 array(
240
-                    'exception' => 'Exception for user ' . $customer->email . ' : ' . $exception->getMessage()
240
+                    'exception' => 'Exception for user '.$customer->email.' : '.$exception->getMessage()
241 241
                 )
242 242
             );
243 243
             Tools::redirect($cancelUrl);
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
             } catch (\Exception $exception) {
261 261
                 $this->saveLog(
262 262
                     array(
263
-                        'exception' => 'Exception for user ' . $customer->email . ' : ' . $exception->getMessage()
263
+                        'exception' => 'Exception for user '.$customer->email.' : '.$exception->getMessage()
264 264
                     )
265 265
                 );
266 266
                 Tools::redirect($url);
Please login to merge, or discard this patch.
controllers/front/api.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
         header('HTTP/1.1 200 Ok', true, 200);
68 68
         header('Content-Type: application/json', true);
69
-        header('Content-Length: ' . Tools::strlen($result));
69
+        header('Content-Length: '.Tools::strlen($result));
70 70
 
71 71
         echo $result;
72 72
         exit();
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
         header('HTTP/1.1 403 Forbidden', true, 403);
92 92
         header('Content-Type: application/json', true);
93
-        header('Content-Length: ' . Tools::strlen($result));
93
+        header('Content-Length: '.Tools::strlen($result));
94 94
 
95 95
         echo $result;
96 96
         exit();
Please login to merge, or discard this patch.
paylater.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
     exit;
12 12
 }
13 13
 
14
-define('_PS_PAYLATER_DIR', _PS_MODULE_DIR_. '/paylater');
14
+define('_PS_PAYLATER_DIR', _PS_MODULE_DIR_.'/paylater');
15 15
 
16 16
 require _PS_PAYLATER_DIR.'/vendor/autoload.php';
17 17
 
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
             $envFile = new Dotenv\Dotenv(__DIR__);
74 74
             $envFile->load();
75 75
         } catch (\Exception $exception) {
76
-            $this->context->controller->errors[] = $this->l('Unable to read file') . ' '. __DIR__.'/.env ' .
76
+            $this->context->controller->errors[] = $this->l('Unable to read file').' '.__DIR__.'/.env '.
77 77
                 $this->l('Ensure that the file exists and have the correct permissions');
78
-            $this->_dotEnvError = $this->l('Unable to read file') . ' '. __DIR__.'/.env ' .
78
+            $this->_dotEnvError = $this->l('Unable to read file').' '.__DIR__.'/.env '.
79 79
                 $this->l('Ensure that the file exists and have the correct permissions');
80 80
         }
81 81
 
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
             $from = strpos($envFile, $key);
196 196
             if ($from !== false) {
197 197
                 $to = strpos($envFile, '#', $from);
198
-                $fromReplace = substr($envFile, $from, (($to - $from)-1));
199
-                $toReplace = $key . '=' . $value;
198
+                $fromReplace = substr($envFile, $from, (($to - $from) - 1));
199
+                $toReplace = $key.'='.$value;
200 200
                 $envFile = str_replace($fromReplace, $toReplace, $envFile);
201 201
             }
202 202
         }
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
         $cart                       = $this->context->cart;
239 239
         $currency                   = new Currency($cart->id_currency);
240 240
         $availableCurrencies        = array('EUR');
241
-        $pmtDisplayMinAmount          = getenv('PMT_DISPLAY_MIN_AMOUNT');
241
+        $pmtDisplayMinAmount = getenv('PMT_DISPLAY_MIN_AMOUNT');
242 242
         $pmtPublicKey               = Configuration::get('pmt_public_key');
243
-        $pmtPrivateKey             = Configuration::get('pmt_private_key');
243
+        $pmtPrivateKey = Configuration::get('pmt_private_key');
244 244
 
245 245
         return (
246 246
             $cart->getOrderTotal() >= $pmtDisplayMinAmount &&
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
         $paymentOption
304 304
             ->setCallToActionText($pmtTitle)
305 305
             ->setAction($link->getModuleLink('paylater', 'payment'))
306
-            ->setLogo($this->getPathUri(). 'logo.gif')
306
+            ->setLogo($this->getPathUri().'logo.gif')
307 307
             ->setModuleName(__CLASS__)
308 308
         ;
309 309
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
                 'input' => array(
338 338
                     array(
339 339
                         'name' => 'pmt_is_enabled',
340
-                        'type' =>  (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch',
340
+                        'type' =>  (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch',
341 341
                         'label' => $this->l('Module is enabled'),
342 342
                         'prefix' => '<i class="icon icon-key"></i>',
343 343
                         'class' => 't',
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
                     ),
378 378
                     array(
379 379
                         'name' => 'pmt_simulator_is_enabled',
380
-                        'type' => (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch',
380
+                        'type' => (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch',
381 381
                         'label' => $this->l('Simulator is enabled'),
382 382
                         'prefix' => '<i class="icon icon-key"></i>',
383 383
                         'class' => 't',
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
             $message = $this->displayError($this->_dotEnvError);
497 497
         }
498 498
 
499
-        $logo = $this->getPathUri(). 'views/img/logo_pagamastarde.png';
499
+        $logo = $this->getPathUri().'views/img/logo_pagamastarde.png';
500 500
         $tpl = $this->local_path.'views/templates/admin/config-info.tpl';
501 501
         $this->context->smarty->assign(array(
502 502
             'logo' => $logo,
@@ -673,10 +673,10 @@  discard block
 block discarded – undo
673 673
      */
674 674
     public function checkLogoExists()
675 675
     {
676
-        $logo = _PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments/'. Tools::strtolower(__CLASS__). '.png';
677
-        if (!file_exists($logo) && is_dir(_PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments')) {
676
+        $logo = _PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments/'.Tools::strtolower(__CLASS__).'.png';
677
+        if (!file_exists($logo) && is_dir(_PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments')) {
678 678
             copy(
679
-                _PS_PAYLATER_DIR . '/views/img/logo-64x64.png',
679
+                _PS_PAYLATER_DIR.'/views/img/logo-64x64.png',
680 680
                 $logo
681 681
             );
682 682
         }
Please login to merge, or discard this patch.