Passed
Pull Request — master (#218)
by
unknown
02:32
created
src/Drivers/Jibit/Jibit.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
         $requestResult = $this->jibit->paymentRequest($this->invoice->getAmount(), $this->invoice->getUuid(), $this->invoice->getDetail('mobile'), $this->settings->callbackUrl);
58 58
 
59 59
 
60
-        if (! empty($requestResult['pspSwitchingUrl'])) {
60
+        if (!empty($requestResult['pspSwitchingUrl'])) {
61 61
             $this->paymentUrl = $requestResult['pspSwitchingUrl'];
62 62
         }
63 63
 
64
-        if (! empty($requestResult['errors'])) {
65
-            $errMsgs = array_map(function ($err) {
64
+        if (!empty($requestResult['errors'])) {
65
+            $errMsgs = array_map(function($err) {
66 66
                 return $err['code'];
67 67
             }, $requestResult['errors']);
68 68
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
         $requestResult = $this->jibit->paymentVerify($purchaseId);
105 105
 
106
-        if (! empty($requestResult['status']) && $requestResult['status'] === 'SUCCESSFUL') {
106
+        if (!empty($requestResult['status']) && $requestResult['status'] === 'SUCCESSFUL') {
107 107
             $order = $this->jibit->getOrderById($purchaseId);
108 108
 
109 109
             $receipt = new Receipt('jibit', $purchaseId);
Please login to merge, or discard this patch.
src/Drivers/Jibit/JibitFileCache.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
         $cache = $this->cacheArray;
118 118
         $cache["hash-sum"] = $this->getStringHash(serialize($cache));
119 119
         $data = serialize($cache);
120
-        $firstLine = '<?php die("Access denied") ?>' . PHP_EOL;
121
-        $success = file_put_contents($this->getCacheFilePath(), $firstLine . $data) !== false;
120
+        $firstLine = '<?php die("Access denied") ?>'.PHP_EOL;
121
+        $success = file_put_contents($this->getCacheFilePath(), $firstLine.$data) !== false;
122 122
 
123 123
         if (!$success) {
124 124
             throw new \Exception("Cannot save cache");
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     public function store($key, $data, $expiration = 60, $permanent = false)
141 141
     {
142 142
         if (!is_string($key)) {
143
-            throw new \InvalidArgumentException('$key must be a string, got type "' . get_class($key) . '" instead');
143
+            throw new \InvalidArgumentException('$key must be a string, got type "'.get_class($key).'" instead');
144 144
         }
145 145
 
146 146
         if ($this->isDevMode()) {
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
     private function getStringHash($str)
347 347
     {
348 348
         if (!is_string($str)) {
349
-            throw new \InvalidArgumentException('$key must be a string, got type "' . get_class($str) . '" instead');
349
+            throw new \InvalidArgumentException('$key must be a string, got type "'.get_class($str).'" instead');
350 350
         }
351 351
 
352 352
         return md5($str);
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
     public function setCacheFilename($cacheFilename)
427 427
     {
428 428
         if (!is_string($cacheFilename)) {
429
-            throw new \InvalidArgumentException('$key must be a string, got type "' . get_class($cacheFilename) . '" instead');
429
+            throw new \InvalidArgumentException('$key must be a string, got type "'.get_class($cacheFilename).'" instead');
430 430
         }
431 431
 
432 432
         $this->cacheFilename = $cacheFilename;
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
      */
466 466
     public function getCacheFilePath()
467 467
     {
468
-        return $this->getCacheDir() . $this->getCacheFilenameHashed() . $this->getCacheFileExtension();
468
+        return $this->getCacheDir().$this->getCacheFilenameHashed().$this->getCacheFileExtension();
469 469
     }
470 470
 
471 471
     /**
Please login to merge, or discard this patch.
src/Drivers/Jibit/JibitClient.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public function getOrderById($id)
93 93
     {
94
-        return  $this->callCurl('/purchases?purchaseId=' . $id, [], true, 0, 'GET');
94
+        return  $this->callCurl('/purchases?purchaseId='.$id, [], true, 0, 'GET');
95 95
     }
96 96
 
97 97
     /**
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
         }
135 135
 
136 136
         if (!empty($result['accessToken'])) {
137
-            $this->cache->store('accessToken', 'Bearer ' . $result['accessToken'], 24 * 60 * 60 - 60);
137
+            $this->cache->store('accessToken', 'Bearer '.$result['accessToken'], 24 * 60 * 60 - 60);
138 138
             $this->cache->store('refreshToken', $result['refreshToken'], 48 * 60 * 60 - 60);
139 139
 
140
-            $this->setAccessToken('Bearer ' . $result['accessToken']);
140
+            $this->setAccessToken('Bearer '.$result['accessToken']);
141 141
             $this->setRefreshToken($result['refreshToken']);
142 142
 
143 143
             return 'ok';
@@ -167,15 +167,15 @@  discard block
 block discarded – undo
167 167
             $accessToken = $this->getAccessToken();
168 168
         }
169 169
 
170
-        $ch = curl_init($this->baseUrl . $url);
170
+        $ch = curl_init($this->baseUrl.$url);
171 171
         curl_setopt($ch, CURLOPT_USERAGENT, 'Jibit.class Rest Api');
172 172
         curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
173 173
         curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
174 174
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
175 175
         curl_setopt($ch, CURLOPT_HTTPHEADER, [
176 176
             'Content-Type: application/json',
177
-            'Authorization: ' . $accessToken,
178
-            'Content-Length: ' . strlen($jsonData)
177
+            'Authorization: '.$accessToken,
178
+            'Content-Length: '.strlen($jsonData)
179 179
         ]);
180 180
 
181 181
         $result = curl_exec($ch);
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
         curl_close($ch);
185 185
 
186 186
         if ($err) {
187
-            throw new \Shetabit\Multipay\Exceptions\PurchaseFailedException('cURL Error #:' . $err);
187
+            throw new \Shetabit\Multipay\Exceptions\PurchaseFailedException('cURL Error #:'.$err);
188 188
         }
189 189
 
190 190
         if (empty($result['errors'])) {
@@ -253,11 +253,11 @@  discard block
 block discarded – undo
253 253
             throw new \Shetabit\Multipay\Exceptions\PurchaseFailedException('Token generation encoutered an error.');
254 254
         }
255 255
 
256
-        if (! empty($result['accessToken'])) {
257
-            $this->cache->store('accessToken', 'Bearer ' . $result['accessToken'], 24 * 60 * 60 - 60);
256
+        if (!empty($result['accessToken'])) {
257
+            $this->cache->store('accessToken', 'Bearer '.$result['accessToken'], 24 * 60 * 60 - 60);
258 258
             $this->cache->store('refreshToken', $result['refreshToken'], 48 * 60 * 60 - 60);
259 259
 
260
-            $this->setAccessToken('Bearer ' . $result['accessToken']);
260
+            $this->setAccessToken('Bearer '.$result['accessToken']);
261 261
             $this->setRefreshToken($result['refreshToken']);
262 262
 
263 263
             return 'ok';
@@ -278,6 +278,6 @@  discard block
 block discarded – undo
278 278
         $this->generateToken();
279 279
         $data = [];
280 280
 
281
-        return $this->callCurl('/purchases/' . $purchaseId . '/verify', $data, true, 0, 'GET');
281
+        return $this->callCurl('/purchases/'.$purchaseId.'/verify', $data, true, 0, 'GET');
282 282
     }
283 283
 }
Please login to merge, or discard this patch.
config/payment.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -124,9 +124,9 @@
 block discarded – undo
124 124
             'apiPaymentUrl' => 'https://napi.jibit.ir/ppg/v3',
125 125
             'apiKey' => '',
126 126
             'secretKey' => '',
127
-           // you can change the token storage path in Laravel like this 
128
-           // 'tokenStoragePath' => function_exists('storage_path') ? storage_path('jibit/') : 'jibit/'
129
-           'tokenStoragePath' => 'jibit/',
127
+            // you can change the token storage path in Laravel like this 
128
+            // 'tokenStoragePath' => function_exists('storage_path') ? storage_path('jibit/') : 'jibit/'
129
+            'tokenStoragePath' => 'jibit/',
130 130
             'callbackUrl' => 'http://yoursite.com/path/to',
131 131
             'description' => 'payment using jibit',
132 132
         ],
Please login to merge, or discard this patch.