Passed
Pull Request — master (#28)
by Raúl
03:10
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.
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.
paylater.php 1 patch
Spacing   +21 added lines, -21 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
 
@@ -202,18 +202,18 @@  discard block
 block discarded – undo
202 202
     public function checkHooks()
203 203
     {
204 204
         try {
205
-            $sql_content = 'select * from ' . _DB_PREFIX_. 'hook_module where 
206
-            id_module = \'' . Module::getModuleIdByName($this->name) . '\' and 
207
-            id_shop = \'' . Shop::getContextShopID() . '\' and 
208
-            id_hook = \'' . Hook::getIdByName('header') . '\'';
205
+            $sql_content = 'select * from '._DB_PREFIX_.'hook_module where 
206
+            id_module = \'' . Module::getModuleIdByName($this->name).'\' and 
207
+            id_shop = \'' . Shop::getContextShopID().'\' and 
208
+            id_hook = \'' . Hook::getIdByName('header').'\'';
209 209
             $hook_exists = Db::getInstance()->ExecuteS($sql_content);
210 210
             if (empty($hook_exists)) {
211
-                $sql_insert = 'insert into ' . _DB_PREFIX_.  'hook_module 
211
+                $sql_insert = 'insert into '._DB_PREFIX_.'hook_module 
212 212
             (id_module, id_shop, id_hook, position)
213 213
             values
214
-            (\''. Module::getModuleIdByName($this->name) . '\',
215
-            \''. Shop::getContextShopID() . '\',
216
-            \''. Hook::getIdByName('header') . '\',
214
+            (\''. Module::getModuleIdByName($this->name).'\',
215
+            \''. Shop::getContextShopID().'\',
216
+            \''. Hook::getIdByName('header').'\',
217 217
             150)';
218 218
                 Db::getInstance()->execute($sql_insert);
219 219
             }
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 
225 225
     public function loadEnvVariables()
226 226
     {
227
-        $sql_content = 'select * from ' . _DB_PREFIX_. 'pmt_config';
227
+        $sql_content = 'select * from '._DB_PREFIX_.'pmt_config';
228 228
         $dbConfigs = Db::getInstance()->executeS($sql_content);
229 229
 
230 230
         // Convert a multimple dimension array for SQL insert statements into a simple key/value
@@ -245,11 +245,11 @@  discard block
 block discarded – undo
245 245
         }
246 246
 
247 247
         foreach (array_merge($this->defaultConfigs, $simpleDbConfigs) as $key => $value) {
248
-            putenv($key . '=' . $value);
248
+            putenv($key.'='.$value);
249 249
         }
250 250
 
251 251
         // Save defaultOptions as a env varible to have it in configController
252
-        putenv("PMT_DEFAULT_CONFIGS" . '=' . json_encode($this->defaultConfigs));
252
+        putenv("PMT_DEFAULT_CONFIGS".'='.json_encode($this->defaultConfigs));
253 253
     }
254 254
 
255 255
     /**
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
         } else {
333 333
             $this->context->controller->addJS('http://cdn.pagamastarde.com/js/pmt-v2/sdk.js');
334 334
         }
335
-        $this->context->controller->addJS($this->getPathUri(). 'views/js/simulator.js');
335
+        $this->context->controller->addJS($this->getPathUri().'views/js/simulator.js');
336 336
     }
337 337
 
338 338
     /**
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
         $paymentOption
382 382
             ->setCallToActionText($pmtTitle)
383 383
             ->setAction($link->getModuleLink('paylater', 'payment'))
384
-            ->setLogo($this->getPathUri(). 'logo.gif')
384
+            ->setLogo($this->getPathUri().'logo.gif')
385 385
             ->setModuleName(__CLASS__)
386 386
         ;
387 387
 
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
                 'input' => array(
412 412
                     array(
413 413
                         'name' => 'pmt_is_enabled',
414
-                        'type' =>  (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch',
414
+                        'type' =>  (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch',
415 415
                         'label' => $this->l('Module is enabled'),
416 416
                         'prefix' => '<i class="icon icon-key"></i>',
417 417
                         'class' => 't',
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
                     ),
452 452
                     array(
453 453
                         'name' => 'pmt_simulator_is_enabled',
454
-                        'type' => (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch',
454
+                        'type' => (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch',
455 455
                         'label' => $this->l('Simulator is enabled'),
456 456
                         'prefix' => '<i class="icon icon-key"></i>',
457 457
                         'class' => 't',
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
             $message = $this->displayError($this->dotEnvError);
571 571
         }
572 572
 
573
-        $logo = $this->getPathUri(). 'views/img/logo_pagamastarde.png';
573
+        $logo = $this->getPathUri().'views/img/logo_pagamastarde.png';
574 574
         $tpl = $this->local_path.'views/templates/admin/config-info.tpl';
575 575
         $this->context->smarty->assign(array(
576 576
             'logo' => $logo,
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
         /** @var ProductCore $product */
656 656
         $product = new Product(Tools::getValue('id_product'));
657 657
         $amount = $product->getPublicPrice();
658
-        $pmtPublicKey                = Configuration::get('pmt_public_key');
658
+        $pmtPublicKey = Configuration::get('pmt_public_key');
659 659
         $pmtSimulatorIsEnabled        = Configuration::get('pmt_simulator_is_enabled');
660 660
         $pmtIsEnabled                 = Configuration::get('pmt_is_enabled');
661 661
         $pmtSimulatorType             = getenv('PMT_SIMULATOR_DISPLAY_TYPE');
@@ -764,10 +764,10 @@  discard block
 block discarded – undo
764 764
      */
765 765
     public function checkLogoExists()
766 766
     {
767
-        $logo = _PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments/'. Tools::strtolower(__CLASS__). '.png';
768
-        if (!file_exists($logo) && is_dir(_PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments')) {
767
+        $logo = _PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments/'.Tools::strtolower(__CLASS__).'.png';
768
+        if (!file_exists($logo) && is_dir(_PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments')) {
769 769
             copy(
770
-                _PS_PAYLATER_DIR . '/views/img/logo-64x64.png',
770
+                _PS_PAYLATER_DIR.'/views/img/logo-64x64.png',
771 771
                 $logo
772 772
             );
773 773
         }
Please login to merge, or discard this patch.
controllers/front/config.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
     public function initContent()
19 19
     {
20 20
         $this->authorize();
21
-        $method = strtolower($_SERVER['REQUEST_METHOD']) . "Method";
21
+        $method = strtolower($_SERVER['REQUEST_METHOD'])."Method";
22 22
         if (method_exists($this, $method)) {
23 23
             header('HTTP/1.1 200 Ok', true, 200);
24 24
             header('Content-Type: application/json', true);
25
-            header('Content-Length: ' . Tools::strlen($result));
25
+            header('Content-Length: '.Tools::strlen($result));
26 26
             echo json_encode($this->{$method}());
27 27
             exit();
28 28
         }
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
                     Db::getInstance()->update(
46 46
                         'pmt_config',
47 47
                         array('value' => $value),
48
-                        'config = \''. $config .'\''
48
+                        'config = \''.$config.'\''
49 49
                     );
50 50
                 } else {
51 51
                     $errors[$config] = $value;
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      */
70 70
     public function getMethod()
71 71
     {
72
-        $sql_content = 'select * from ' . _DB_PREFIX_. 'pmt_config';
72
+        $sql_content = 'select * from '._DB_PREFIX_.'pmt_config';
73 73
         $dbConfigs = Db::getInstance()->executeS($sql_content);
74 74
 
75 75
         // Convert a multimple dimension array for SQL insert statements into a simple key/value
Please login to merge, or discard this patch.