Completed
Push — master ( e93a7f...644a66 )
by Songda
02:17 queued 42s
created
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/Wechat.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 
148 148
         $this->payload = array_merge($this->payload, $params);
149 149
 
150
-        $gateway = get_class($this).'\\'.Str::studly($gateway).'Gateway';
150
+        $gateway = get_class($this) . '\\' . Str::studly($gateway) . 'Gateway';
151 151
 
152 152
         if (class_exists($gateway)) {
153 153
             return $this->makePay($gateway);
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
             unset($this->payload['spbill_create_ip']);
213 213
         }
214 214
 
215
-        $gateway = get_class($this).'\\'.Str::studly($type).'Gateway';
215
+        $gateway = get_class($this) . '\\' . Str::studly($type) . 'Gateway';
216 216
 
217 217
         if (!class_exists($gateway) || !is_callable([new $gateway(), 'find'])) {
218 218
             throw new GatewayException("{$gateway} Done Not Exist Or Done Not Has FIND Method");
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
         );
356 356
 
357 357
         if (is_array($result)) {
358
-            throw new GatewayException('Get Wechat API Error: '.$result['return_msg'], $result);
358
+            throw new GatewayException('Get Wechat API Error: ' . $result['return_msg'], $result);
359 359
         }
360 360
 
361 361
         return $result;
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
         $app = new $gateway();
378 378
 
379 379
         if ($app instanceof GatewayInterface) {
380
-            return $app->pay($this->gateway, array_filter($this->payload, function ($value) {
380
+            return $app->pay($this->gateway, array_filter($this->payload, function($value) {
381 381
                 return '' !== $value && !is_null($value);
382 382
             }));
383 383
         }
Please login to merge, or discard this patch.
src/Gateways/Alipay/Support.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     {
124 124
         Events::dispatch(new Events\ApiRequesting('Alipay', '', self::$instance->getBaseUri(), $data));
125 125
 
126
-        $data = array_filter($data, function ($value) {
126
+        $data = array_filter($data, function($value) {
127 127
             return ('' == $value || is_null($value)) ? false : true;
128 128
         });
129 129
 
@@ -155,11 +155,11 @@  discard block
 block discarded – undo
155 155
 
156 156
         if (Str::endsWith($privateKey, '.pem')) {
157 157
             $privateKey = openssl_pkey_get_private(
158
-                Str::startsWith($privateKey, 'file://') ? $privateKey : 'file://'.$privateKey
158
+                Str::startsWith($privateKey, 'file://') ? $privateKey : 'file://' . $privateKey
159 159
             );
160
-        } else {
161
-            $privateKey = "-----BEGIN RSA PRIVATE KEY-----\n".
162
-                wordwrap($privateKey, 64, "\n", true).
160
+        }else {
161
+            $privateKey = "-----BEGIN RSA PRIVATE KEY-----\n" .
162
+                wordwrap($privateKey, 64, "\n", true) .
163 163
                 "\n-----END RSA PRIVATE KEY-----";
164 164
         }
165 165
 
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 
200 200
         if (Str::endsWith($publicKey, '.pem')) {
201 201
             $publicKey = openssl_pkey_get_public(
202
-                Str::startsWith($publicKey, 'file://') ? $publicKey : 'file://'.$publicKey
202
+                Str::startsWith($publicKey, 'file://') ? $publicKey : 'file://' . $publicKey
203 203
             );
204
-        } else {
205
-            $publicKey = "-----BEGIN PUBLIC KEY-----\n".
206
-                wordwrap($publicKey, 64, "\n", true).
204
+        }else {
205
+            $publicKey = "-----BEGIN PUBLIC KEY-----\n" .
206
+                wordwrap($publicKey, 64, "\n", true) .
207 207
                 "\n-----END PUBLIC KEY-----";
208 208
         }
209 209
 
@@ -237,10 +237,10 @@  discard block
 block discarded – undo
237 237
         $stringToBeSigned = '';
238 238
         foreach ($data as $k => $v) {
239 239
             if ($verify && 'sign' != $k && 'sign_type' != $k) {
240
-                $stringToBeSigned .= $k.'='.$v.'&';
240
+                $stringToBeSigned .= $k . '=' . $v . '&';
241 241
             }
242 242
             if (!$verify && '' !== $v && !is_null($v) && 'sign' != $k && '@' != substr($v, 0, 1)) {
243
-                $stringToBeSigned .= $k.'='.$v.'&';
243
+                $stringToBeSigned .= $k . '=' . $v . '&';
244 244
             }
245 245
         }
246 246
 
@@ -316,12 +316,12 @@  discard block
 block discarded – undo
316 316
      */
317 317
     protected static function processingApiResult($data, $result): Collection
318 318
     {
319
-        $method = str_replace('.', '_', $data['method']).'_response';
319
+        $method = str_replace('.', '_', $data['method']) . '_response';
320 320
 
321 321
         if (!isset($result['sign']) || '10000' != $result[$method]['code']) {
322 322
             throw new GatewayException(
323
-                'Get Alipay API Error:'.$result[$method]['msg'].
324
-                    (isset($result[$method]['sub_code']) ? (' - '.$result[$method]['sub_code']) : ''),
323
+                'Get Alipay API Error:' . $result[$method]['msg'] .
324
+                    (isset($result[$method]['sub_code']) ? (' - ' . $result[$method]['sub_code']) : ''),
325 325
                 $result
326 326
             );
327 327
         }
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.