Passed
Pull Request — master (#85)
by
unknown
07:19
created
src/Drivers/Yekpay/Yekpay.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
         if ($response->Code != 100) {
96 96
             //"Request failed with Error code: $response->Code and Error message: $response->Description";
97
-            throw new PurchaseFailedException($response->Description, is_numeric($response->Code)?$response->Code:0);
97
+            throw new PurchaseFailedException($response->Description, is_numeric($response->Code) ? $response->Code : 0);
98 98
         }
99 99
 
100 100
         $this->invoice->transactionId($response->Authority);
@@ -163,12 +163,12 @@  discard block
 block discarded – undo
163 163
      * @param $message
164 164
      * @throws InvalidPaymentException
165 165
      */
166
-    private function notVerified($message, $status=0)
166
+    private function notVerified($message, $status = 0)
167 167
     {
168 168
         if ($message) {
169
-            throw new InvalidPaymentException($message, is_numeric($status)?$status:0);
169
+            throw new InvalidPaymentException($message, is_numeric($status) ? $status : 0);
170 170
         } else {
171
-            throw new InvalidPaymentException('payment failed', is_numeric($status)?$status:0);
171
+            throw new InvalidPaymentException('payment failed', is_numeric($status) ? $status : 0);
172 172
         }
173 173
     }
174 174
 }
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
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         if (empty($body)) {
97 97
             throw new PurchaseFailedException('دسترسی به صفحه مورد نظر امکان پذیر نمی باشد.');
98 98
         } elseif ($body->ResCode != 0) {
99
-            throw new PurchaseFailedException($body->Description, is_numeric($body->ResCode)?$body->ResCode:0);
99
+            throw new PurchaseFailedException($body->Description, is_numeric($body->ResCode) ? $body->ResCode : 0);
100 100
         }
101 101
 
102 102
         $this->invoice->transactionId($body->Token);
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         $message = 'تراکنش نا موفق بود در صورت کسر مبلغ از حساب شما حداکثر پس از 72 ساعت مبلغ به حسابتان برمیگردد.';
135 135
 
136 136
         if ($resCode != 0) {
137
-            throw new InvalidPaymentException($message, is_numeric($resCode)?$resCode:0);
137
+            throw new InvalidPaymentException($message, is_numeric($resCode) ? $resCode : 0);
138 138
         }
139 139
 
140 140
         $data = array(
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
         $body = json_decode($response->getBody()->getContents());
161 161
 
162 162
         if ($body->ResCode == -1) {
163
-            throw new InvalidPaymentException($message, is_numeric($body->ResCode)?$body->ResCode:0);
163
+            throw new InvalidPaymentException($message, is_numeric($body->ResCode) ? $body->ResCode : 0);
164 164
         }
165 165
 
166 166
         /**
Please login to merge, or discard this patch.
src/Drivers/Parsian/Parsian.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
             $this->invoice->transactionId($result->Token);
67 67
         } else {
68 68
             // an error has happened
69
-            throw new PurchaseFailedException($result->Message, $result->Status??0);
69
+            throw new PurchaseFailedException($result->Message, $result->Status ?? 0);
70 70
         }
71 71
 
72 72
         // return the transaction's id
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function pay() : RedirectionForm
82 82
     {
83
-        $payUrl = $this->settings->apiPaymentUrl . '?Token=' . $this->invoice->getTransactionId() ;
83
+        $payUrl = $this->settings->apiPaymentUrl.'?Token='.$this->invoice->getTransactionId();
84 84
 
85 85
         return $this->redirectWithForm(
86 86
             $payUrl,
Please login to merge, or discard this patch.
src/Drivers/Irankish/Irankish.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -195,9 +195,9 @@
 block discarded – undo
195 195
             -90 => 'تراکنش قبلا تایید شده است'
196 196
         );
197 197
         if (array_key_exists($status, $translations)) {
198
-            throw new InvalidPaymentException($translations[$status], is_numeric($status)?$status:0);
198
+            throw new InvalidPaymentException($translations[$status], is_numeric($status) ? $status : 0);
199 199
         } else {
200
-            throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', is_numeric($status)?$status:0);
200
+            throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', is_numeric($status) ? $status : 0);
201 201
         }
202 202
     }
203 203
 }
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.
src/Drivers/Payir/Payir.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      */
112 112
     public function pay(): RedirectionForm
113 113
     {
114
-        $payUrl = $this->settings->apiPaymentUrl . $this->invoice->getTransactionId();
114
+        $payUrl = $this->settings->apiPaymentUrl.$this->invoice->getTransactionId();
115 115
 
116 116
         return $this->redirectWithForm($payUrl, [], 'GET');
117 117
     }
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
         );
207 207
 
208 208
         if (array_key_exists($status, $translations)) {
209
-            throw new InvalidPaymentException($translations[$status], is_numeric($status)?$status:0);
209
+            throw new InvalidPaymentException($translations[$status], is_numeric($status) ? $status : 0);
210 210
         } else {
211
-            throw new InvalidPaymentException('تراکنش با خطا مواجه شد.', is_numeric($status)?$status:0);
211
+            throw new InvalidPaymentException('تراکنش با خطا مواجه شد.', is_numeric($status) ? $status : 0);
212 212
         }
213 213
     }
214 214
 }
Please login to merge, or discard this patch.
src/Drivers/Local/Local.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     {
157 157
         $urlWithQuery = $url;
158 158
         foreach ($params as $key => $value) {
159
-            $urlWithQuery .= (parse_url($urlWithQuery, PHP_URL_QUERY) ? '&' : '?') . "{$key}={$value}";
159
+            $urlWithQuery .= (parse_url($urlWithQuery, PHP_URL_QUERY) ? '&' : '?')."{$key}={$value}";
160 160
         }
161 161
         return $urlWithQuery;
162 162
     }
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
         );
177 177
 
178 178
         if (array_key_exists($status, $translations)) {
179
-            throw new InvalidPaymentException($translations[$status], is_numeric($status)?$status:0);
179
+            throw new InvalidPaymentException($translations[$status], is_numeric($status) ? $status : 0);
180 180
         } else {
181
-            throw new InvalidPaymentException('تراکنش با خطا مواجه شد.', is_numeric($status)?$status:0);
181
+            throw new InvalidPaymentException('تراکنش با خطا مواجه شد.', is_numeric($status) ? $status : 0);
182 182
         }
183 183
     }
184 184
 }
Please login to merge, or discard this patch.
src/Drivers/Sepehr/Sepehr.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     public function __construct(Invoice $invoice, $settings)
40 40
     {
41 41
         $this->invoice($invoice);
42
-        $this->settings = (object)$settings;
42
+        $this->settings = (object) $settings;
43 43
     }
44 44
 
45 45
     /**
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
         $mobile = '';
57 57
         //set CellNumber for get user cards
58 58
         if (!empty($this->invoice->getDetails()['mobile'])) {
59
-            $mobile = '&CellNumber=' . $this->invoice->getDetails()['mobile'];
59
+            $mobile = '&CellNumber='.$this->invoice->getDetails()['mobile'];
60 60
         }
61 61
 
62
-        $data_query = 'Amount=' . $this->test_input($amount) . '&callbackURL=' . $this->test_input($this->settings->callbackUrl) . '&InvoiceID=' . $this->test_input($this->invoice->getUuid()) . '&TerminalID=' . $this->test_input($this->settings->terminalId) . '&Payload=' . $this->test_input("") . $mobile;
62
+        $data_query = 'Amount='.$this->test_input($amount).'&callbackURL='.$this->test_input($this->settings->callbackUrl).'&InvoiceID='.$this->test_input($this->invoice->getUuid()).'&TerminalID='.$this->test_input($this->settings->terminalId).'&Payload='.$this->test_input("").$mobile;
63 63
         $address_service_token = $this->settings->apiGetToken;
64 64
 
65 65
         $token_array = $this->makeHttpChargeRequest('POST', $data_query, $address_service_token);
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
             $this->notVerified($resp_code);
113 113
         }
114 114
 
115
-        $data_query = 'digitalreceipt=' . Request::input('digitalreceipt') . '&Tid=' . $this->settings->terminalId;
115
+        $data_query = 'digitalreceipt='.Request::input('digitalreceipt').'&Tid='.$this->settings->terminalId;
116 116
         $advice_array = $this->makeHttpChargeRequest('POST', $data_query, $this->settings->apiVerificationUrl);
117 117
         $decode_advice_array = json_decode($advice_array);
118 118
 
@@ -188,9 +188,9 @@  discard block
 block discarded – undo
188 188
         );
189 189
 
190 190
         if (array_key_exists($status, $translations)) {
191
-            throw new InvalidPaymentException($translations[$status], is_numeric($status)?$status:0);
191
+            throw new InvalidPaymentException($translations[$status], is_numeric($status) ? $status : 0);
192 192
         } else {
193
-            throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', is_numeric($status)?$status:0);
193
+            throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', is_numeric($status) ? $status : 0);
194 194
         }
195 195
     }
196 196
 
Please login to merge, or discard this patch.
src/Drivers/Behpardakht/Behpardakht.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
             $context = stream_context_create(
57 57
                 [
58 58
                 'ssl' => array(
59
-                  'verify_peer'       => false,
60
-                  'verify_peer_name'  => false
59
+                    'verify_peer'       => false,
60
+                    'verify_peer_name'  => false
61 61
                 )]
62 62
             );
63 63
 
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
             $context = stream_context_create(
131 131
                 [
132 132
                 'ssl' => array(
133
-                  'verify_peer'       => false,
134
-                  'verify_peer_name'  => false
133
+                    'verify_peer'       => false,
134
+                    'verify_peer_name'  => false
135 135
                 )]
136 136
             );
137 137
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     public function __construct(Invoice $invoice, $settings)
39 39
     {
40 40
         $this->invoice($invoice);
41
-        $this->settings = (object)$settings;
41
+        $this->settings = (object) $settings;
42 42
     }
43 43
 
44 44
     /**
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
         // purchase was not successful
81 81
         if ($data[0] != "0") {
82
-            throw new PurchaseFailedException($this->translateStatus($data[0]), (int)$data[0]);
82
+            throw new PurchaseFailedException($this->translateStatus($data[0]), (int) $data[0]);
83 83
         }
84 84
 
85 85
         $this->invoice->transactionId($data[1]);
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
         }
144 144
 
145 145
         // step1: verify request
146
-        $verifyResponse = (int)$soap->bpVerifyRequest($data)->return;
146
+        $verifyResponse = (int) $soap->bpVerifyRequest($data)->return;
147 147
         if ($verifyResponse != 0) {
148 148
             // rollback money and throw exception
149 149
             // avoid rollback if request was already verified
Please login to merge, or discard this patch.