Passed
Pull Request — master (#24)
by Raúl
03:45
created
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.