Passed
Pull Request — master (#132)
by
unknown
02:43
created
src/Drivers/Jibit/JibitCache.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         if (true === $this->_checkCacheDir()) {
107 107
             $filename = $this->getCache();
108 108
             $filename = preg_replace('/[^0-9a-z\.\_\-]/i', '', strtolower($filename));
109
-            return $this->getCachePath() . $this->_getHash($filename) . $this->getExtension();
109
+            return $this->getCachePath().$this->_getHash($filename).$this->getExtension();
110 110
         }
111 111
     }
112 112
 
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
     private function _checkCacheDir()
119 119
     {
120 120
         if (!is_dir($this->getCachePath()) && !mkdir($this->getCachePath(), 0775, true)) {
121
-            throw new \Exception('Unable to create cache directory ' . $this->getCachePath());
121
+            throw new \Exception('Unable to create cache directory '.$this->getCachePath());
122 122
         } elseif (!is_readable($this->getCachePath()) || !is_writable($this->getCachePath())) {
123 123
             if (!chmod($this->getCachePath(), 0775)) {
124
-                throw new \Exception($this->getCachePath() . ' must be readable and writeable');
124
+                throw new \Exception($this->getCachePath().' must be readable and writeable');
125 125
             }
126 126
         }
127 127
         return true;
Please login to merge, or discard this patch.
config/payment.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@
 block discarded – undo
116 116
             'merchantId' => '', //apiKey
117 117
             'apiSecret' => '',
118 118
             'merchantConfigID' => '',
119
-            'tokenStoragePath' => function_exists('storage_path')?storage_path('jibit/'):'jibit/',
119
+            'tokenStoragePath' => function_exists('storage_path') ?storage_path('jibit/') : 'jibit/',
120 120
             'callbackUrl' => 'http://yoursite.com/path/to',
121 121
             'description' => 'payment using jibit',
122 122
         ],
Please login to merge, or discard this patch.
src/Invoice.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
      */
70 70
     public function getUuid($needNumericUuid = false)
71 71
     {
72
-        if($needNumericUuid){
72
+        if ($needNumericUuid) {
73 73
             $this->uuid = !is_numeric($this->uuid) ? crc32($this->uuid) : $this->uuid;
74 74
         }
75 75
         return $this->uuid;
Please login to merge, or discard this patch.
src/Drivers/Jibit/Jibit.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         }
42 42
         if (!empty($requestResult['errors'])) {
43 43
             //fail result and show the error
44
-            $errMsgs = array_map(function ($err) {
44
+            $errMsgs = array_map(function($err) {
45 45
                 return $err['message'];
46 46
             }, $requestResult['errors']);
47 47
             throw new PurchaseFailedException(implode('\n', $errMsgs));
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
         $transId = $requestResult['orderIdentifier'];
51 51
         $referenceNumber = $requestResult['referenceNumber'];
52
-        $this->invoice->detail('referenceNumber',$referenceNumber);
52
+        $this->invoice->detail('referenceNumber', $referenceNumber);
53 53
 
54 54
         $this->invoice->transactionId($transId);
55 55
 
Please login to merge, or discard this patch.
src/Drivers/Jibit/JibitBase.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
             'password' => $this->secretKey,
38 38
             'amount' => $amount * 10, //convert to toman
39 39
             'referenceNumber' => $referenceNumber,
40
-            'userIdentifier' => $userIdentifier??"1",
40
+            'userIdentifier' => $userIdentifier ?? "1",
41 41
             'callbackUrl' => $callbackUrl,
42 42
             'currency' => $currency,
43 43
             'description' => $description,
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function getOrderById($id)
55 55
     {
56
-        return  $this->callCurl('/orders/' .$id, [], true, 0, 'GET');
56
+        return  $this->callCurl('/orders/'.$id, [], true, 0, 'GET');
57 57
     }
58 58
 
59 59
     /**
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
             throw new \Shetabit\Multipay\Exceptions\PurchaseFailedException('Err in refresh token.');
92 92
         }
93 93
         if (!empty($result['accessToken'])) {
94
-            $this->cache->store('accessToken', 'Bearer ' . $result['accessToken'], 24 * 60 * 60 - 60);
94
+            $this->cache->store('accessToken', 'Bearer '.$result['accessToken'], 24 * 60 * 60 - 60);
95 95
             $this->cache->store('refreshToken', $result['refreshToken'], 48 * 60 * 60 - 60);
96
-            $this->setAccessToken('Bearer ' . $result['accessToken']);
96
+            $this->setAccessToken('Bearer '.$result['accessToken']);
97 97
             $this->setRefreshToken($result['refreshToken']);
98 98
             return 'ok';
99 99
         }
@@ -117,15 +117,15 @@  discard block
 block discarded – undo
117 117
         if ($haveAuth) {
118 118
             $accessToken = $this->getAccessToken();
119 119
         }
120
-        $ch = curl_init($this->base_url . $url);
120
+        $ch = curl_init($this->base_url.$url);
121 121
         curl_setopt($ch, CURLOPT_USERAGENT, 'Jibit.class Rest Api');
122 122
         curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
123 123
         curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
124 124
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
125 125
         curl_setopt($ch, CURLOPT_HTTPHEADER, array(
126 126
             'Content-Type: application/json',
127
-            'Authorization: ' . $accessToken,
128
-            'Content-Length: ' . strlen($jsonData)
127
+            'Authorization: '.$accessToken,
128
+            'Content-Length: '.strlen($jsonData)
129 129
         ));
130 130
         $result = curl_exec($ch);
131 131
         $err = curl_error($ch);
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         curl_close($ch);
134 134
 
135 135
         if ($err) {
136
-            throw new \Shetabit\Multipay\Exceptions\PurchaseFailedException('cURL Error #:' . $err);
136
+            throw new \Shetabit\Multipay\Exceptions\PurchaseFailedException('cURL Error #:'.$err);
137 137
         }
138 138
         if (empty($result['errors'])) {
139 139
             return $result;
@@ -185,9 +185,9 @@  discard block
 block discarded – undo
185 185
             throw new \Shetabit\Multipay\Exceptions\PurchaseFailedException('Err in generate new token.');
186 186
         }
187 187
         if (!empty($result['accessToken'])) {
188
-            $this->cache->store('accessToken', 'Bearer ' . $result['accessToken'], 24 * 60 * 60 - 60);
188
+            $this->cache->store('accessToken', 'Bearer '.$result['accessToken'], 24 * 60 * 60 - 60);
189 189
             $this->cache->store('refreshToken', $result['refreshToken'], 48 * 60 * 60 - 60);
190
-            $this->setAccessToken('Bearer ' . $result['accessToken']);
190
+            $this->setAccessToken('Bearer '.$result['accessToken']);
191 191
             $this->setRefreshToken($result['refreshToken']);
192 192
             return 'ok';
193 193
         }
@@ -204,6 +204,6 @@  discard block
 block discarded – undo
204 204
         $this->generateToken();
205 205
         $data = [
206 206
         ];
207
-        return $this->callCurl('/orders/' . $refNum . '/verify', $data, true, 0, 'GET');
207
+        return $this->callCurl('/orders/'.$refNum.'/verify', $data, true, 0, 'GET');
208 208
     }
209 209
 }
Please login to merge, or discard this patch.
src/Drivers/Sadad/Sadad.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         if (empty($body)) {
98 98
             throw new PurchaseFailedException('دسترسی به صفحه مورد نظر امکان پذیر نمی باشد.');
99 99
         } elseif ($body->ResCode != 0) {
100
-            throw new PurchaseFailedException($body->Description, is_numeric($body->ResCode)?$body->ResCode:0);
100
+            throw new PurchaseFailedException($body->Description, is_numeric($body->ResCode) ? $body->ResCode : 0);
101 101
         }
102 102
 
103 103
         $this->invoice->transactionId($body->Token);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         $message = 'تراکنش نا موفق بود در صورت کسر مبلغ از حساب شما حداکثر پس از 72 ساعت مبلغ به حسابتان برمیگردد.';
136 136
 
137 137
         if ($resCode != 0) {
138
-            throw new InvalidPaymentException($message, is_numeric($resCode)?$resCode:0);
138
+            throw new InvalidPaymentException($message, is_numeric($resCode) ? $resCode : 0);
139 139
         }
140 140
 
141 141
         $data = array(
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
         $body = json_decode($response->getBody()->getContents());
162 162
 
163 163
         if ($body->ResCode != 0) {
164
-            throw new InvalidPaymentException($message, is_numeric($body->ResCode)?$body->ResCode:0);
164
+            throw new InvalidPaymentException($message, is_numeric($body->ResCode) ? $body->ResCode : 0);
165 165
         }
166 166
 
167 167
         /**
Please login to merge, or discard this patch.
src/Drivers/Nextpay/Nextpay.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         );
68 68
 
69 69
         if (isset($this->invoice->getDetails()['customer_phone'])) {
70
-            $data['customer_phone']=$this->invoice->getDetails()['customer_phone'];
70
+            $data['customer_phone'] = $this->invoice->getDetails()['customer_phone'];
71 71
         }
72 72
 
73 73
         $response = $this
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
         if (empty($body['code']) || $body['code'] != -1) {
87 87
             // error has happened
88
-            throw new PurchaseFailedException($body['message'], $body['code']??0);
88
+            throw new PurchaseFailedException($body['message'], $body['code'] ?? 0);
89 89
         }
90 90
 
91 91
         $this->invoice->transactionId($body['trans_id']);
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         if (!isset($body['code']) || $body['code'] != 0) {
142 142
             $message = $body['message'] ?? 'خطای ناشناخته ای رخ داده است';
143 143
 
144
-            throw new InvalidPaymentException($message, $body['code']??0);
144
+            throw new InvalidPaymentException($message, $body['code'] ?? 0);
145 145
         }
146 146
 
147 147
         return $this->createReceipt($transactionId);
Please login to merge, or discard this patch.
src/Drivers/Pasargad/Pasargad.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -193,7 +193,7 @@
 block discarded – undo
193 193
         $terminalCode = $this->settings->terminalCode;
194 194
         $amount = $this->invoice->getAmount(); //rial
195 195
         $redirectAddress = $this->settings->callbackUrl;
196
-        $invoiceNumber = $this->invoice->getUuid(true) . rand(0, time());
196
+        $invoiceNumber = $this->invoice->getUuid(true).rand(0, time());
197 197
         $timeStamp = date("Y/m/d H:i:s");
198 198
         $invoiceDate = date("Y/m/d H:i:s");
199 199
 
Please login to merge, or discard this patch.
src/Drivers/Saman/Saman.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     public function __construct(Invoice $invoice, $settings)
38 38
     {
39 39
         $this->invoice($invoice);
40
-        $this->settings = (object)$settings;
40
+        $this->settings = (object) $settings;
41 41
     }
42 42
 
43 43
     /**
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
         $response = $soap->RequestToken($data['MID'], $data['ResNum'], $data['Amount'], $data['CellNumber']);
70 70
 
71
-        $status = (int)$response;
71
+        $status = (int) $response;
72 72
 
73 73
         if ($status < 0) { // if something has done in a wrong way
74 74
             $this->purchaseFailed($response);
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
         );
117 117
 
118 118
         $soap = new \SoapClient($this->settings->apiVerificationUrl);
119
-        $status = (int)$soap->VerifyTransaction($data['RefNum'], $data['merchantId']);
119
+        $status = (int) $soap->VerifyTransaction($data['RefNum'], $data['merchantId']);
120 120
 
121 121
         if ($status < 0) {
122 122
             $this->notVerified($status);
123 123
         }
124 124
 
125
-        $receipt =  $this->createReceipt($data['RefNum']);
125
+        $receipt = $this->createReceipt($data['RefNum']);
126 126
         $receipt->detail([
127 127
             'traceNo' => Request::input('TRACENO'),
128 128
             'referenceNo' => Request::input('RRN'),
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
         );
177 177
 
178 178
         if (array_key_exists($status, $translations)) {
179
-            throw new PurchaseFailedException($translations[$status], is_numeric($status)?$status:0);
179
+            throw new PurchaseFailedException($translations[$status], is_numeric($status) ? $status : 0);
180 180
         } else {
181
-            throw new PurchaseFailedException('خطای ناشناخته ای رخ داده است.', is_numeric($status)?$status:0);
181
+            throw new PurchaseFailedException('خطای ناشناخته ای رخ داده است.', is_numeric($status) ? $status : 0);
182 182
         }
183 183
     }
184 184
 
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
         );
212 212
 
213 213
         if (array_key_exists($status, $translations)) {
214
-            throw new InvalidPaymentException($translations[$status], is_numeric($status)?$status:0);
214
+            throw new InvalidPaymentException($translations[$status], is_numeric($status) ? $status : 0);
215 215
         } else {
216
-            throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', is_numeric($status)?$status:0);
216
+            throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', is_numeric($status) ? $status : 0);
217 217
         }
218 218
     }
219 219
 }
Please login to merge, or discard this patch.