Passed
Pull Request — master (#997)
by
unknown
02:11
created
src/Functions.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
         return file_get_contents($key);
47 47
     }
48 48
 
49
-    return "-----BEGIN RSA PRIVATE KEY-----\n".
50
-        wordwrap($key, 64, "\n", true).
49
+    return "-----BEGIN RSA PRIVATE KEY-----\n" .
50
+        wordwrap($key, 64, "\n", true) .
51 51
         "\n-----END RSA PRIVATE KEY-----";
52 52
 }
53 53
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         return $url;
187 187
     }
188 188
 
189
-    return Wechat::URL[$config['mode'] ?? Pay::MODE_NORMAL].$url;
189
+    return Wechat::URL[$config['mode'] ?? Pay::MODE_NORMAL] . $url;
190 190
 }
191 191
 
192 192
 /**
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 
209 209
 function get_wechat_type_key(array $params): string
210 210
 {
211
-    $key = ($params['_type'] ?? 'mp').'_app_id';
211
+    $key = ($params['_type'] ?? 'mp') . '_app_id';
212 212
 
213 213
     if ('app_app_id' === $key) {
214 214
         $key = 'app_id';
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
     $buff = '';
258 258
 
259 259
     foreach ($payload as $k => $v) {
260
-        $buff .= ('sign' != $k && '' != $v && !is_array($v)) ? $k.'='.$v.'&' : '';
260
+        $buff .= ('sign' != $k && '' != $v && !is_array($v)) ? $k . '=' . $v . '&' : '';
261 261
     }
262 262
 
263
-    $sign = md5($buff.'key='.$key);
263
+    $sign = md5($buff . 'key=' . $key);
264 264
 
265 265
     return $upper ? strtoupper($sign) : $sign;
266 266
 }
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
  * @throws InvalidSignException
274 274
  * @throws ServiceNotFoundException
275 275
  */
276
-function verify_wechat_sign(ResponseInterface|ServerRequestInterface $message, array $params): void
276
+function verify_wechat_sign(ResponseInterface | ServerRequestInterface $message, array $params): void
277 277
 {
278 278
     if ($message instanceof ServerRequestInterface && 'localhost' === $message->getUri()->getHost()) {
279 279
         return;
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
     $sign = $message->getHeaderLine('Wechatpay-Signature');
286 286
     $body = (string) $message->getBody();
287 287
 
288
-    $content = $timestamp."\n".$random."\n".$body."\n";
288
+    $content = $timestamp . "\n" . $random . "\n" . $body . "\n";
289 289
     $public = get_provider_config('wechat', $params)['wechat_public_cert_path'][$wechatSerial] ?? null;
290 290
 
291 291
     if (empty($sign)) {
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
     }
398 398
 
399 399
     Pay::get(ConfigInterface::class)->set(
400
-        'wechat.'.get_tenant($params).'.wechat_public_cert_path',
400
+        'wechat.' . get_tenant($params) . '.wechat_public_cert_path',
401 401
         ((array) ($wechatConfig['wechat_public_cert_path'] ?? [])) + ($certs ?? []),
402 402
     );
403 403
 
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
     }
432 432
 
433 433
     foreach ($config['wechat_public_cert_path'] as $serialNo => $cert) {
434
-        file_put_contents($path.'/'.$serialNo.'.crt', $cert);
434
+        file_put_contents($path . '/' . $serialNo . '.crt', $cert);
435 435
     }
436 436
 }
437 437
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
     string $secret,
483 483
     string $nonce,
484 484
     string $associatedData
485
-): array|string {
485
+): array | string {
486 486
     $decrypted = openssl_decrypt(
487 487
         substr($ciphertext, 0, -Wechat::AUTH_TAG_LENGTH_BYTE),
488 488
         'aes-256-gcm',
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
     if (empty($publicKey)) {
551 551
         throw new InvalidParamsException(
552 552
             Exception::PARAMS_WECHAT_SERIAL_NOT_FOUND,
553
-            '参数异常: 微信公钥序列号为找到 -'.$serialNo
553
+            '参数异常: 微信公钥序列号为找到 -' . $serialNo
554 554
         );
555 555
     }
556 556
 
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
         );
570 570
     }
571 571
 
572
-    return hash_hmac('sha256', $url.'&'.$payload, $config['mini_app_key_virtual_pay']);
572
+    return hash_hmac('sha256', $url . '&' . $payload, $config['mini_app_key_virtual_pay']);
573 573
 }
574 574
 
575 575
 function get_wechat_miniprogram_user_sign(string $sessionKey, string $payload): string
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
         return $url;
637 637
     }
638 638
 
639
-    return Unipay::URL[$config['mode'] ?? Pay::MODE_NORMAL].$url;
639
+    return Unipay::URL[$config['mode'] ?? Pay::MODE_NORMAL] . $url;
640 640
 }
641 641
 
642 642
 /**
@@ -675,10 +675,10 @@  discard block
 block discarded – undo
675 675
     $buff = '';
676 676
 
677 677
     foreach ($payload as $k => $v) {
678
-        $buff .= ('sign' != $k && '' != $v && !is_array($v)) ? $k.'='.$v.'&' : '';
678
+        $buff .= ('sign' != $k && '' != $v && !is_array($v)) ? $k . '=' . $v . '&' : '';
679 679
     }
680 680
 
681
-    return strtoupper(md5($buff.'key='.$key));
681
+    return strtoupper(md5($buff . 'key=' . $key));
682 682
 }
683 683
 
684 684
 /**
Please login to merge, or discard this patch.
src/Plugin/Alipay/V2/ResponsePlugin.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 
32 32
         $destination = $rocket->getDestination();
33 33
         $payload = $rocket->getPayload();
34
-        $resultKey = str_replace('.', '_', $payload->get('method')).'_response';
34
+        $resultKey = str_replace('.', '_', $payload->get('method')) . '_response';
35 35
 
36 36
         if (should_do_http_request($rocket->getDirection()) && $destination instanceof Collection) {
37 37
             $sign = $destination->get('sign', '');
Please login to merge, or discard this patch.