Passed
Pull Request — master (#26)
by Raúl
01:53
created
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/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   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
     {
26 26
         if (_PS_VERSION_ < 1.6) {
27 27
             Logger::addLog(
28
-                'PagaMasTarde Exception For user ' .
29
-                $customer->email .
30
-                ' : ' .
28
+                'PagaMasTarde Exception For user '.
29
+                $customer->email.
30
+                ' : '.
31 31
                 $exception->getMessage(),
32 32
                 3,
33 33
                 $exception->getCode(),
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
             );
38 38
         } else {
39 39
             PrestaShopLogger::addLog(
40
-                'PagaMasTarde Exception For user ' .
41
-                $customer->email .
42
-                ' : ' .
40
+                'PagaMasTarde Exception For user '.
41
+                $customer->email.
42
+                ' : '.
43 43
                 $exception->getMessage(),
44 44
                 3,
45 45
                 $exception->getCode(),
@@ -98,22 +98,22 @@  discard block
 block discarded – undo
98 98
         );
99 99
 
100 100
         try {
101
-            $userAddress =  new \PagaMasTarde\OrdersApiClient\Model\Order\User\Address();
101
+            $userAddress = new \PagaMasTarde\OrdersApiClient\Model\Order\User\Address();
102 102
             $userAddress
103 103
                 ->setZipCode($shippingAddress->postcode)
104
-                ->setFullName($shippingAddress->firstname . ' ' . $shippingAddress->lastname)
104
+                ->setFullName($shippingAddress->firstname.' '.$shippingAddress->lastname)
105 105
                 ->setCountryCode('ES')
106 106
                 ->setCity($shippingAddress->city)
107
-                ->setAddress($shippingAddress->address1 . ' ' . $shippingAddress->address2)
107
+                ->setAddress($shippingAddress->address1.' '.$shippingAddress->address2)
108 108
             ;
109 109
 
110
-            $orderShippingAddress =  new \PagaMasTarde\OrdersApiClient\Model\Order\User\Address();
110
+            $orderShippingAddress = new \PagaMasTarde\OrdersApiClient\Model\Order\User\Address();
111 111
             $orderShippingAddress
112 112
                 ->setZipCode($shippingAddress->postcode)
113
-                ->setFullName($shippingAddress->firstname . ' ' . $shippingAddress->lastname)
113
+                ->setFullName($shippingAddress->firstname.' '.$shippingAddress->lastname)
114 114
                 ->setCountryCode('ES')
115 115
                 ->setCity($shippingAddress->city)
116
-                ->setAddress($shippingAddress->address1 . ' ' . $shippingAddress->address2)
116
+                ->setAddress($shippingAddress->address1.' '.$shippingAddress->address2)
117 117
                 ->setDni($shippingAddress->dni)
118 118
                 ->setFixPhone($shippingAddress->phone)
119 119
                 ->setMobilePhone($shippingAddress->phone_mobile)
@@ -122,10 +122,10 @@  discard block
 block discarded – undo
122 122
             $orderBillingAddress = new \PagaMasTarde\OrdersApiClient\Model\Order\User\Address();
123 123
             $orderBillingAddress
124 124
                 ->setZipCode($billingAddress->postcode)
125
-                ->setFullName($billingAddress->firstname . ' ' . $billingAddress->lastname)
125
+                ->setFullName($billingAddress->firstname.' '.$billingAddress->lastname)
126 126
                 ->setCountryCode('ES')
127 127
                 ->setCity($billingAddress->city)
128
-                ->setAddress($billingAddress->address1 . ' ' . $billingAddress->address2)
128
+                ->setAddress($billingAddress->address1.' '.$billingAddress->address2)
129 129
                 ->setDni($billingAddress->dni)
130 130
                 ->setFixPhone($billingAddress->phone)
131 131
                 ->setMobilePhone($billingAddress->phone_mobile)
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                 ->setDni($shippingAddress->dni)
144 144
             ;
145 145
 
146
-            if ($customer->birthday!='0000-00-00') {
146
+            if ($customer->birthday != '0000-00-00') {
147 147
                 $orderUser->setDateOfBirth($customer->birthday);
148 148
             }
149 149
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
             Tools::redirect($cancelUrl);
220 220
         }
221 221
 
222
-        $url ='';
222
+        $url = '';
223 223
         try {
224 224
             $orderClient = new \PagaMasTarde\OrdersApiClient\Client(
225 225
                 $paylaterPublicKey,
@@ -229,12 +229,12 @@  discard block
 block discarded – undo
229 229
             if ($order instanceof \PagaMasTarde\OrdersApiClient\Model\Order) {
230 230
                 $url = $order->getActionUrls()->getForm();
231 231
                 $orderId = $order->getId();
232
-                $sql = "INSERT INTO `" . _DB_PREFIX_ . "pmt_order` (`id`, `order_id`)
232
+                $sql = "INSERT INTO `"._DB_PREFIX_."pmt_order` (`id`, `order_id`)
233 233
                      VALUES ('$cart->id','$orderId') 
234 234
                      ON DUPLICATE KEY UPDATE `order_id` = '$orderId'";
235 235
                 $result = Db::getInstance()->execute($sql);
236 236
                 if (!$result) {
237
-                    throw new UnknownException('Unable to save pmt-order-id in database: '. $sql);
237
+                    throw new UnknownException('Unable to save pmt-order-id in database: '.$sql);
238 238
                 }
239 239
             } else {
240 240
                 throw new OrderNotFoundException();
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.
controllers/front/AbstractController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
     {
35 35
         $parsedUrl = parse_url($url);
36 36
         $separator = ($parsedUrl['query'] == null) ? '?' : '&';
37
-        $redirectUrl = $url. $separator . http_build_query($parameters);
37
+        $redirectUrl = $url.$separator.http_build_query($parameters);
38 38
         Tools::redirect($redirectUrl);
39 39
     }
40 40
 
Please login to merge, or discard this patch.
paylater.php 1 patch
Spacing   +25 added lines, -25 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
 
@@ -62,18 +62,18 @@  discard block
 block discarded – undo
62 62
         $continue = true;
63 63
         if (Module::isInstalled($this->name)) {
64 64
             if (!$this->upgrade()) {
65
-                $this->context->controller->errors[] = $this->l('Unable to write file') .
66
-                    ' ' . _PS_PAYLATER_DIR . '/.env ' .
65
+                $this->context->controller->errors[] = $this->l('Unable to write file').
66
+                    ' '._PS_PAYLATER_DIR.'/.env '.
67 67
                     $this->l('Ensure that the file exists and have the correct permissions');
68
-                $this->dotEnvError = $this->l('Unable to write file') .
69
-                    ' ' . _PS_PAYLATER_DIR . '/.env ' .
68
+                $this->dotEnvError = $this->l('Unable to write file').
69
+                    ' '._PS_PAYLATER_DIR.'/.env '.
70 70
                     $this->l('Ensure that the file exists and have the correct permissions');
71 71
                 $continue = false;
72 72
             }
73 73
         } else {
74 74
             copy(
75
-                _PS_PAYLATER_DIR . '/.env.dist',
76
-                _PS_PAYLATER_DIR . '/.env'
75
+                _PS_PAYLATER_DIR.'/.env.dist',
76
+                _PS_PAYLATER_DIR.'/.env'
77 77
             );
78 78
         }
79 79
 
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
                 $envFile = new Dotenv\Dotenv(_PS_PAYLATER_DIR);
86 86
                 $envFile->load();
87 87
             } catch (\Exception $exception) {
88
-                $this->context->controller->errors[] = $this->l('Unable to read file') .
89
-                    ' ' . _PS_PAYLATER_DIR . '/.env ' .
88
+                $this->context->controller->errors[] = $this->l('Unable to read file').
89
+                    ' '._PS_PAYLATER_DIR.'/.env '.
90 90
                     $this->l('Ensure that the file exists and have the correct permissions');
91
-                $this->dotEnvError = $this->l('Unable to read file') .
92
-                    ' ' . _PS_PAYLATER_DIR . '/.env ' .
91
+                $this->dotEnvError = $this->l('Unable to read file').
92
+                    ' '._PS_PAYLATER_DIR.'/.env '.
93 93
                     $this->l('Ensure that the file exists and have the correct permissions');
94 94
             }
95 95
         }
@@ -158,16 +158,16 @@  discard block
 block discarded – undo
158 158
     public function upgrade()
159 159
     {
160 160
 
161
-        if (file_exists(_PS_PAYLATER_DIR . '/.env') && !is_writable(_PS_PAYLATER_DIR . '/.env')) {
161
+        if (file_exists(_PS_PAYLATER_DIR.'/.env') && !is_writable(_PS_PAYLATER_DIR.'/.env')) {
162 162
             return false;
163 163
         }
164
-        $envFileVariables = $this->readEnvFileAsArray(_PS_PAYLATER_DIR . '/.env');
165
-        $distFileVariables = $this->readEnvFileAsArray(_PS_PAYLATER_DIR . '/.env.dist');
166
-        $distFile = Tools::file_get_contents(_PS_PAYLATER_DIR . '/.env.dist');
164
+        $envFileVariables = $this->readEnvFileAsArray(_PS_PAYLATER_DIR.'/.env');
165
+        $distFileVariables = $this->readEnvFileAsArray(_PS_PAYLATER_DIR.'/.env.dist');
166
+        $distFile = Tools::file_get_contents(_PS_PAYLATER_DIR.'/.env.dist');
167 167
 
168 168
         $newEnvFileArr = array_merge($distFileVariables, $envFileVariables);
169 169
         $newEnvFile = $this->replaceEnvFileValues($distFile, $newEnvFileArr);
170
-        file_put_contents(_PS_PAYLATER_DIR . '/.env', $newEnvFile);
170
+        file_put_contents(_PS_PAYLATER_DIR.'/.env', $newEnvFile);
171 171
 
172 172
         // migrating pk/tk from previous version
173 173
         if (Configuration::get('pmt_public_key') === false && Configuration::get('PAYLATER_PUBLIC_KEY_PROD')) {
@@ -225,8 +225,8 @@  discard block
 block discarded – undo
225 225
             $from = strpos($envFile, $key);
226 226
             if ($from !== false) {
227 227
                 $to = strpos($envFile, '#', $from);
228
-                $fromReplace = Tools::substr($envFile, $from, (($to - $from)-1));
229
-                $toReplace = $key . '=' . $value;
228
+                $fromReplace = Tools::substr($envFile, $from, (($to - $from) - 1));
229
+                $toReplace = $key.'='.$value;
230 230
                 $envFile = str_replace($fromReplace, $toReplace, $envFile);
231 231
             }
232 232
         }
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
         $paymentOption
334 334
             ->setCallToActionText($pmtTitle)
335 335
             ->setAction($link->getModuleLink('paylater', 'payment'))
336
-            ->setLogo($this->getPathUri(). 'logo.gif')
336
+            ->setLogo($this->getPathUri().'logo.gif')
337 337
             ->setModuleName(__CLASS__)
338 338
         ;
339 339
 
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
                 'input' => array(
368 368
                     array(
369 369
                         'name' => 'pmt_is_enabled',
370
-                        'type' =>  (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch',
370
+                        'type' =>  (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch',
371 371
                         'label' => $this->l('Module is enabled'),
372 372
                         'prefix' => '<i class="icon icon-key"></i>',
373 373
                         'class' => 't',
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
                     ),
408 408
                     array(
409 409
                         'name' => 'pmt_simulator_is_enabled',
410
-                        'type' => (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch',
410
+                        'type' => (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch',
411 411
                         'label' => $this->l('Simulator is enabled'),
412 412
                         'prefix' => '<i class="icon icon-key"></i>',
413 413
                         'class' => 't',
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
             $message = $this->displayError($this->dotEnvError);
527 527
         }
528 528
 
529
-        $logo = $this->getPathUri(). 'views/img/logo_pagamastarde.png';
529
+        $logo = $this->getPathUri().'views/img/logo_pagamastarde.png';
530 530
         $tpl = $this->local_path.'views/templates/admin/config-info.tpl';
531 531
         $this->context->smarty->assign(array(
532 532
             'logo' => $logo,
@@ -703,10 +703,10 @@  discard block
 block discarded – undo
703 703
      */
704 704
     public function checkLogoExists()
705 705
     {
706
-        $logo = _PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments/'. Tools::strtolower(__CLASS__). '.png';
707
-        if (!file_exists($logo) && is_dir(_PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments')) {
706
+        $logo = _PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments/'.Tools::strtolower(__CLASS__).'.png';
707
+        if (!file_exists($logo) && is_dir(_PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments')) {
708 708
             copy(
709
-                _PS_PAYLATER_DIR . '/views/img/logo-64x64.png',
709
+                _PS_PAYLATER_DIR.'/views/img/logo-64x64.png',
710 710
                 $logo
711 711
             );
712 712
         }
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
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     private function getPmtOrderId()
192 192
     {
193 193
         try {
194
-            $this->pmtOrderId= Db::getInstance()->getValue(
194
+            $this->pmtOrderId = Db::getInstance()->getValue(
195 195
                 'select order_id from '._DB_PREFIX_.'pmt_order where id = '.$this->merchantOrderId
196 196
             );
197 197
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
     public function validateAmount()
254 254
     {
255 255
         $totalAmount = $this->pmtOrder->getShoppingCart()->getTotalAmount();
256
-        $merchantAmount = (int)((string) (100 * $this->merchantOrder->getOrderTotal(true)));
256
+        $merchantAmount = (int) ((string) (100 * $this->merchantOrder->getOrderTotal(true)));
257 257
         if ($totalAmount != $merchantAmount) {
258 258
             throw new AmountMismatchException($totalAmount, $merchantAmount);
259 259
         }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
                 Configuration::get('PS_OS_PAYMENT'),
273 273
                 $this->merchantOrder->getOrderTotal(true),
274 274
                 $this->module->displayName,
275
-                'pmtOrderId: ' . $this->pmtOrder->getId(),
275
+                'pmtOrderId: '.$this->pmtOrder->getId(),
276 276
                 array('transaction_id' => $this->pmtOrderId),
277 277
                 null,
278 278
                 false,
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
     protected function unblockConcurrency()
332 332
     {
333 333
         try {
334
-            Db::getInstance()->delete('pmt_cart_process', 'timestamp < ' . (time() - 6));
334
+            Db::getInstance()->delete('pmt_cart_process', 'timestamp < '.(time() - 6));
335 335
         } catch (\Exception $exception) {
336 336
             throw new ConcurrencyException();
337 337
         }
@@ -348,13 +348,13 @@  discard block
 block discarded – undo
348 348
     public function cancelProcess($response = null)
349 349
     {
350 350
         if ($this->merchantOrder) {
351
-            $id = (!is_null($this->pmtOrder))?$this->pmtOrder->getId():null;
351
+            $id = (!is_null($this->pmtOrder)) ? $this->pmtOrder->getId() : null;
352 352
             $this->module->validateOrder(
353 353
                 $this->merchantOrderId,
354 354
                 Configuration::get('PS_OS_ERROR'),
355 355
                 $this->merchantOrder->getOrderTotal(true),
356 356
                 $this->module->displayName,
357
-                'pmtOrderId: ' . $id,
357
+                'pmtOrderId: '.$id,
358 358
                 null,
359 359
                 null,
360 360
                 false,
@@ -390,9 +390,9 @@  discard block
 block discarded – undo
390 390
             'id_cart' => $this->merchantOrderId,
391 391
             'key' => $this->config['secureKey'],
392 392
             'id_module' => $this->module->id,
393
-            'id_order' => ($this->pmtOrder)?$this->pmtOrder->getId(): null,
393
+            'id_order' => ($this->pmtOrder) ? $this->pmtOrder->getId() : null,
394 394
         );
395
-        $url = ($error)? $this->config['urlKO'] : $this->config['urlOK'];
395
+        $url = ($error) ? $this->config['urlKO'] : $this->config['urlOK'];
396 396
         return $this->redirect($url, $parameters);
397 397
     }
398 398
 }
Please login to merge, or discard this patch.