Completed
Push — master ( 68d189...af18d0 )
by Songda
02:04 queued 13s
created
src/Exceptions/GatewayException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,6 +15,6 @@
 block discarded – undo
15 15
      */
16 16
     public function __construct($message, $raw = [], $code = self::ERROR_GATEWAY)
17 17
     {
18
-        parent::__construct('ERROR_GATEWAY: '.$message, $raw, $code);
18
+        parent::__construct('ERROR_GATEWAY: ' . $message, $raw, $code);
19 19
     }
20 20
 }
Please login to merge, or discard this patch.
src/Gateways/Wechat/MpGateway.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
             'appId' => !$this->payRequestUseSubAppId ? $payload['appid'] : $payload['sub_appid'],
41 41
             'timeStamp' => strval(time()),
42 42
             'nonceStr' => Str::random(),
43
-            'package' => 'prepay_id='.$this->preOrder($payload)->get('prepay_id'),
43
+            'package' => 'prepay_id=' . $this->preOrder($payload)->get('prepay_id'),
44 44
             'signType' => 'MD5',
45 45
         ];
46 46
         $pay_request['paySign'] = Support::generateSign($pay_request);
Please login to merge, or discard this patch.
src/Gateways/Wechat/Support.php 1 patch
Spacing   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      */
158 158
     public static function requestApi($endpoint, $data, $cert = false): Collection
159 159
     {
160
-        Events::dispatch(new Events\ApiRequesting('Wechat', '', self::$instance->getBaseUri().$endpoint, $data));
160
+        Events::dispatch(new Events\ApiRequesting('Wechat', '', self::$instance->getBaseUri() . $endpoint, $data));
161 161
 
162 162
         $result = self::$instance->post(
163 163
             $endpoint,
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
         );
170 170
         $result = is_array($result) ? $result : self::fromXml($result);
171 171
 
172
-        Events::dispatch(new Events\ApiRequested('Wechat', '', self::$instance->getBaseUri().$endpoint, $result));
172
+        Events::dispatch(new Events\ApiRequested('Wechat', '', self::$instance->getBaseUri() . $endpoint, $result));
173 173
 
174 174
         return self::processingApiResult($endpoint, $result);
175 175
     }
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         $payload['appid'] = self::$instance->getConfig($type, '');
199 199
 
200 200
         if (Wechat::MODE_SERVICE === self::$instance->getConfig('mode', Wechat::MODE_NORMAL)) {
201
-            $payload['sub_appid'] = self::$instance->getConfig('sub_'.$type, '');
201
+            $payload['sub_appid'] = self::$instance->getConfig('sub_' . $type, '');
202 202
         }
203 203
 
204 204
         unset($payload['trade_type'], $payload['type']);
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 
233 233
         ksort($data);
234 234
 
235
-        $string = md5(self::getSignContent($data).'&key='.$key);
235
+        $string = md5(self::getSignContent($data) . '&key=' . $key);
236 236
 
237 237
         Log::debug('Wechat Generate Sign Before UPPER', [$data, $string]);
238 238
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         $buff = '';
254 254
 
255 255
         foreach ($data as $k => $v) {
256
-            $buff .= ('sign' != $k && '' != $v && !is_array($v)) ? $k.'='.$v.'&' : '';
256
+            $buff .= ('sign' != $k && '' != $v && !is_array($v)) ? $k . '=' . $v . '&' : '';
257 257
         }
258 258
 
259 259
         Log::debug('Wechat Generate Sign Content Before Trim', [$data, $buff]);
@@ -299,8 +299,7 @@  discard block
 block discarded – undo
299 299
 
300 300
         $xml = '<xml>';
301 301
         foreach ($data as $key => $val) {
302
-            $xml .= is_numeric($val) ? '<'.$key.'>'.$val.'</'.$key.'>' :
303
-                                       '<'.$key.'><![CDATA['.$val.']]></'.$key.'>';
302
+            $xml .= is_numeric($val) ? '<' . $key . '>' . $val . '</' . $key . '>' : '<' . $key . '><![CDATA[' . $val . ']]></' . $key . '>';
304 303
         }
305 304
         $xml .= '</xml>';
306 305
 
@@ -371,7 +370,7 @@  discard block
 block discarded – undo
371 370
                 $type = 'appid';
372 371
                 break;
373 372
             default:
374
-                $type = $type.'_id';
373
+                $type = $type . '_id';
375 374
         }
376 375
 
377 376
         return $type;
@@ -407,14 +406,14 @@  discard block
 block discarded – undo
407 406
     {
408 407
         if (!isset($result['return_code']) || 'SUCCESS' != $result['return_code']) {
409 408
             throw new GatewayException(
410
-                'Get Wechat API Error:'.($result['return_msg'] ?? $result['retmsg'] ?? ''),
409
+                'Get Wechat API Error:' . ($result['return_msg'] ?? $result['retmsg'] ?? ''),
411 410
                 $result
412 411
             );
413 412
         }
414 413
 
415 414
         if (isset($result['result_code']) && 'SUCCESS' != $result['result_code']) {
416 415
             throw new BusinessException(
417
-                'Wechat Business Error: '.$result['err_code'].' - '.$result['err_code_des'],
416
+                'Wechat Business Error: ' . $result['err_code'] . ' - ' . $result['err_code_des'],
418 417
                 $result
419 418
             );
420 419
         }
Please login to merge, or discard this patch.
src/Gateways/Alipay.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
         $this->payload['biz_content'] = json_encode($params);
143 143
 
144
-        $gateway = get_class($this).'\\'.Str::studly($gateway).'Gateway';
144
+        $gateway = get_class($this) . '\\' . Str::studly($gateway) . 'Gateway';
145 145
 
146 146
         if (class_exists($gateway)) {
147 147
             return $this->makePay($gateway);
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
      */
203 203
     public function find($order, string $type = 'wap'): Collection
204 204
     {
205
-        $gateway = get_class($this).'\\'.Str::studly($type).'Gateway';
205
+        $gateway = get_class($this) . '\\' . Str::studly($type) . 'Gateway';
206 206
 
207 207
         if (!class_exists($gateway) || !is_callable([new $gateway(), 'find'])) {
208 208
             throw new GatewayException("{$gateway} Done Not Exist Or Done Not Has FIND Method");
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
         $app = new $gateway();
390 390
 
391 391
         if ($app instanceof GatewayInterface) {
392
-            return $app->pay($this->gateway, array_filter($this->payload, function ($value) {
392
+            return $app->pay($this->gateway, array_filter($this->payload, function($value) {
393 393
                 return '' !== $value && !is_null($value);
394 394
             }));
395 395
         }
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 
427 427
         Events::dispatch(new Events\MethodCalled(
428 428
             'Alipay',
429
-            'extend - '.$method,
429
+            'extend - ' . $method,
430 430
             $this->gateway,
431 431
             is_array($customize) ? $customize : $customize->toArray()
432 432
         ));
Please login to merge, or discard this patch.
src/Gateways/Alipay/WebGateway.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -71,13 +71,13 @@
 block discarded – undo
71 71
     protected function buildPayHtml($endpoint, $payload, $method = 'POST'): Response
72 72
     {
73 73
         if ('GET' === strtoupper($method)) {
74
-            return RedirectResponse::create($endpoint.'&'.http_build_query($payload));
74
+            return RedirectResponse::create($endpoint . '&' . http_build_query($payload));
75 75
         }
76 76
 
77
-        $sHtml = "<form id='alipay_submit' name='alipay_submit' action='".$endpoint."' method='".$method."'>";
77
+        $sHtml = "<form id='alipay_submit' name='alipay_submit' action='" . $endpoint . "' method='" . $method . "'>";
78 78
         foreach ($payload as $key => $val) {
79 79
             $val = str_replace("'", '&apos;', $val);
80
-            $sHtml .= "<input type='hidden' name='".$key."' value='".$val."'/>";
80
+            $sHtml .= "<input type='hidden' name='" . $key . "' value='" . $val . "'/>";
81 81
         }
82 82
         $sHtml .= "<input type='submit' value='ok' style='display:none;'></form>";
83 83
         $sHtml .= "<script>document.forms['alipay_submit'].submit();</script>";
Please login to merge, or discard this patch.
src/Gateways/Alipay/Support.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
     {
144 144
         Events::dispatch(new Events\ApiRequesting('Alipay', '', self::$instance->getBaseUri(), $data));
145 145
 
146
-        $data = array_filter($data, function ($value) {
146
+        $data = array_filter($data, function($value) {
147 147
             return ('' == $value || is_null($value)) ? false : true;
148 148
         });
149 149
 
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
 
176 176
         if (Str::endsWith($privateKey, '.pem')) {
177 177
             $privateKey = openssl_pkey_get_private(
178
-                Str::startsWith($privateKey, 'file://') ? $privateKey : 'file://'.$privateKey
178
+                Str::startsWith($privateKey, 'file://') ? $privateKey : 'file://' . $privateKey
179 179
             );
180
-        } else {
181
-            $privateKey = "-----BEGIN RSA PRIVATE KEY-----\n".
182
-                wordwrap($privateKey, 64, "\n", true).
180
+        }else {
181
+            $privateKey = "-----BEGIN RSA PRIVATE KEY-----\n" .
182
+                wordwrap($privateKey, 64, "\n", true) .
183 183
                 "\n-----END RSA PRIVATE KEY-----";
184 184
         }
185 185
 
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
             $publicKey = file_get_contents($publicKey);
222 222
         } elseif (Str::endsWith($publicKey, '.pem')) {
223 223
             $publicKey = openssl_pkey_get_public(
224
-                Str::startsWith($publicKey, 'file://') ? $publicKey : 'file://'.$publicKey
224
+                Str::startsWith($publicKey, 'file://') ? $publicKey : 'file://' . $publicKey
225 225
             );
226
-        } else {
227
-            $publicKey = "-----BEGIN PUBLIC KEY-----\n".
228
-                wordwrap($publicKey, 64, "\n", true).
226
+        }else {
227
+            $publicKey = "-----BEGIN PUBLIC KEY-----\n" .
228
+                wordwrap($publicKey, 64, "\n", true) .
229 229
                 "\n-----END PUBLIC KEY-----";
230 230
         }
231 231
 
@@ -259,10 +259,10 @@  discard block
 block discarded – undo
259 259
         $stringToBeSigned = '';
260 260
         foreach ($data as $k => $v) {
261 261
             if ($verify && 'sign' != $k && 'sign_type' != $k) {
262
-                $stringToBeSigned .= $k.'='.$v.'&';
262
+                $stringToBeSigned .= $k . '=' . $v . '&';
263 263
             }
264 264
             if (!$verify && '' !== $v && !is_null($v) && 'sign' != $k && '@' != substr($v, 0, 1)) {
265
-                $stringToBeSigned .= $k.'='.$v.'&';
265
+                $stringToBeSigned .= $k . '=' . $v . '&';
266 266
             }
267 267
         }
268 268
 
@@ -338,12 +338,12 @@  discard block
 block discarded – undo
338 338
      */
339 339
     protected static function processingApiResult($data, $result): Collection
340 340
     {
341
-        $method = str_replace('.', '_', $data['method']).'_response';
341
+        $method = str_replace('.', '_', $data['method']) . '_response';
342 342
 
343 343
         if (!isset($result['sign']) || '10000' != $result[$method]['code']) {
344 344
             throw new GatewayException(
345
-                'Get Alipay API Error:'.$result[$method]['msg'].
346
-                    (isset($result[$method]['sub_code']) ? (' - '.$result[$method]['sub_code']) : ''),
345
+                'Get Alipay API Error:' . $result[$method]['msg'] .
346
+                    (isset($result[$method]['sub_code']) ? (' - ' . $result[$method]['sub_code']) : ''),
347 347
                 $result
348 348
             );
349 349
         }
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
                     $_issuer = implode(',', array_reverse($issuer_arr));
459 459
                     if (strpos($_certdata['serialNumber'], '0x') === 0) {
460 460
                         $serialNumber = self::bchexdec($_certdata['serialNumber']);
461
-                    } else {
461
+                    }else {
462 462
                         $serialNumber = $_certdata['serialNumber'];
463 463
                     }
464 464
                     $md5_arr[] = md5($_issuer . $serialNumber);
Please login to merge, or discard this patch.