Passed
Push — master ( fcaab3...ad4c5d )
by Songda
04:41 queued 02:27
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
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         return $url;
142 142
     }
143 143
 
144
-    return Wechat::URL[$config['mode'] ?? Pay::MODE_NORMAL].$url;
144
+    return Wechat::URL[$config['mode'] ?? Pay::MODE_NORMAL] . $url;
145 145
 }
146 146
 
147 147
 /**
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
 function get_wechat_type_key(array $params): string
162 162
 {
163
-    $key = ($params['_type'] ?? 'mp').'_app_id';
163
+    $key = ($params['_type'] ?? 'mp') . '_app_id';
164 164
 
165 165
     if ('app_app_id' === $key) {
166 166
         $key = 'app_id';
@@ -203,10 +203,10 @@  discard block
 block discarded – undo
203 203
     $buff = '';
204 204
 
205 205
     foreach ($payload as $k => $v) {
206
-        $buff .= ('sign' != $k && '' != $v && !is_array($v)) ? $k.'='.$v.'&' : '';
206
+        $buff .= ('sign' != $k && '' != $v && !is_array($v)) ? $k . '=' . $v . '&' : '';
207 207
     }
208 208
 
209
-    $sign = md5($buff.'key='.$key);
209
+    $sign = md5($buff . 'key=' . $key);
210 210
 
211 211
     return $upper ? strtoupper($sign) : $sign;
212 212
 }
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
  * @throws InvalidSignException
220 220
  * @throws ServiceNotFoundException
221 221
  */
222
-function verify_wechat_sign(ResponseInterface|ServerRequestInterface $message, array $params): void
222
+function verify_wechat_sign(ResponseInterface | ServerRequestInterface $message, array $params): void
223 223
 {
224 224
     if ($message instanceof ServerRequestInterface && 'localhost' === $message->getUri()->getHost()) {
225 225
         return;
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
     $sign = $message->getHeaderLine('Wechatpay-Signature');
232 232
     $body = (string) $message->getBody();
233 233
 
234
-    $content = $timestamp."\n".$random."\n".$body."\n";
234
+    $content = $timestamp . "\n" . $random . "\n" . $body . "\n";
235 235
     $public = get_wechat_config($params)['wechat_public_cert_path'][$wechatSerial] ?? null;
236 236
 
237 237
     if (empty($sign)) {
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
     }
317 317
 
318 318
     Pay::get(ConfigInterface::class)->set(
319
-        'wechat.'.get_tenant($params).'.wechat_public_cert_path',
319
+        'wechat.' . get_tenant($params) . '.wechat_public_cert_path',
320 320
         ((array) ($wechatConfig['wechat_public_cert_path'] ?? [])) + ($certs ?? []),
321 321
     );
322 322
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
     }
348 348
 
349 349
     foreach ($config['wechat_public_cert_path'] as $serialNo => $cert) {
350
-        file_put_contents($path.'/'.$serialNo.'.crt', $cert);
350
+        file_put_contents($path . '/' . $serialNo . '.crt', $cert);
351 351
     }
352 352
 }
353 353
 
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 /**
380 380
  * @throws DecryptException
381 381
  */
382
-function decrypt_wechat_resource_aes_256_gcm(string $ciphertext, string $secret, string $nonce, string $associatedData): array|string
382
+function decrypt_wechat_resource_aes_256_gcm(string $ciphertext, string $secret, string $nonce, string $associatedData): array | string
383 383
 {
384 384
     $decrypted = openssl_decrypt(
385 385
         substr($ciphertext, 0, -Wechat::AUTH_TAG_LENGTH_BYTE),
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
     $publicKey = $config['wechat_public_cert_path'][$serialNo] ?? null;
441 441
 
442 442
     if (empty($publicKey)) {
443
-        throw new InvalidParamsException(Exception::PARAMS_WECHAT_SERIAL_NOT_FOUND, '参数异常: 微信公钥序列号为找到 -'.$serialNo);
443
+        throw new InvalidParamsException(Exception::PARAMS_WECHAT_SERIAL_NOT_FOUND, '参数异常: 微信公钥序列号为找到 -' . $serialNo);
444 444
     }
445 445
 
446 446
     return $publicKey;
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
         throw new InvalidConfigException(Exception::CONFIG_WECHAT_INVALID, '配置异常: 缺少微信配置 -- [mini_app_key_virtual_pay]');
456 456
     }
457 457
 
458
-    return hash_hmac('sha256', $url.'&'.$payload, $config['mini_app_key_virtual_pay']);
458
+    return hash_hmac('sha256', $url . '&' . $payload, $config['mini_app_key_virtual_pay']);
459 459
 }
460 460
 
461 461
 function get_wechat_miniprogram_user_sign(string $sessionKey, string $payload): string
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
         return $url;
516 516
     }
517 517
 
518
-    return Unipay::URL[$config['mode'] ?? Pay::MODE_NORMAL].$url;
518
+    return Unipay::URL[$config['mode'] ?? Pay::MODE_NORMAL] . $url;
519 519
 }
520 520
 
521 521
 /**
@@ -548,10 +548,10 @@  discard block
 block discarded – undo
548 548
     $buff = '';
549 549
 
550 550
     foreach ($payload as $k => $v) {
551
-        $buff .= ('sign' != $k && '' != $v && !is_array($v)) ? $k.'='.$v.'&' : '';
551
+        $buff .= ('sign' != $k && '' != $v && !is_array($v)) ? $k . '=' . $v . '&' : '';
552 552
     }
553 553
 
554
-    return strtoupper(md5($buff.'key='.$key));
554
+    return strtoupper(md5($buff . 'key=' . $key));
555 555
 }
556 556
 
557 557
 /**
Please login to merge, or discard this patch.
src/Plugin/Wechat/V3/Marketing/Coupon/Stock/RestartPlugin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@
 block discarded – undo
42 42
 
43 43
         $rocket->setPayload([
44 44
             '_method' => 'POST',
45
-            '_url' => 'v3/marketing/favor/stocks/'.$stockId.'/restart',
46
-            '_service_url' => 'v3/marketing/favor/stocks/'.$stockId.'/restart',
45
+            '_url' => 'v3/marketing/favor/stocks/' . $stockId . '/restart',
46
+            '_service_url' => 'v3/marketing/favor/stocks/' . $stockId . '/restart',
47 47
             'stock_creator_mchid' => $stockCreatorMchId,
48 48
         ]);
49 49
 
Please login to merge, or discard this patch.
src/Plugin/Wechat/V3/Marketing/Coupon/Stock/QueryRefundFlowPlugin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@
 block discarded – undo
32 32
 
33 33
         $rocket->setPayload([
34 34
             '_method' => 'GET',
35
-            '_url' => 'v3/marketing/favor/stocks/'.$stockId.'/refund-flow',
36
-            '_service_url' => 'v3/marketing/favor/stocks/'.$stockId.'/refund-flow',
35
+            '_url' => 'v3/marketing/favor/stocks/' . $stockId . '/refund-flow',
36
+            '_service_url' => 'v3/marketing/favor/stocks/' . $stockId . '/refund-flow',
37 37
         ]);
38 38
 
39 39
         Logger::info('[Wechat][V3][Marketing][Coupon][Stock][QueryRefundFlowPlugin] 插件装载完毕', ['rocket' => $rocket]);
Please login to merge, or discard this patch.
src/Plugin/Wechat/V3/Marketing/Coupon/Stock/StartPlugin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@
 block discarded – undo
41 41
 
42 42
         $rocket->setPayload([
43 43
             '_method' => 'POST',
44
-            '_url' => 'v3/marketing/favor/stocks/'.$stockId.'/start',
45
-            '_service_url' => 'v3/marketing/favor/stocks/'.$stockId.'/start',
44
+            '_url' => 'v3/marketing/favor/stocks/' . $stockId . '/start',
45
+            '_service_url' => 'v3/marketing/favor/stocks/' . $stockId . '/start',
46 46
             'stock_creator_mchid' => $payload->get('stock_creator_mchid') ?? $config['mch_id'] ?? '',
47 47
         ]);
48 48
 
Please login to merge, or discard this patch.
src/Plugin/Wechat/V3/Marketing/Coupon/Stock/QueryItemsPlugin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@
 block discarded – undo
42 42
 
43 43
         $rocket->setPayload([
44 44
             '_method' => 'GET',
45
-            '_url' => 'v3/marketing/favor/stocks/'.$stockId.'/items?'.$this->normal($payload, $config),
46
-            '_service_url' => 'v3/marketing/favor/stocks/'.$stockId.'/items?'.$this->normal($payload, $config),
45
+            '_url' => 'v3/marketing/favor/stocks/' . $stockId . '/items?' . $this->normal($payload, $config),
46
+            '_service_url' => 'v3/marketing/favor/stocks/' . $stockId . '/items?' . $this->normal($payload, $config),
47 47
         ]);
48 48
 
49 49
         Logger::info('[Wechat][V3][Marketing][Coupon][Stock][QueryItemsPlugin] 插件装载完毕', ['rocket' => $rocket]);
Please login to merge, or discard this patch.
src/Plugin/Wechat/V3/Marketing/Coupon/Stock/PausePlugin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@
 block discarded – undo
42 42
 
43 43
         $rocket->setPayload([
44 44
             '_method' => 'POST',
45
-            '_url' => 'v3/marketing/favor/stocks/'.$stockId.'/pause',
46
-            '_service_url' => 'v3/marketing/favor/stocks/'.$stockId.'/pause',
45
+            '_url' => 'v3/marketing/favor/stocks/' . $stockId . '/pause',
46
+            '_service_url' => 'v3/marketing/favor/stocks/' . $stockId . '/pause',
47 47
             'stock_creator_mchid' => $stockCreatorMchId,
48 48
         ]);
49 49
 
Please login to merge, or discard this patch.
src/Plugin/Wechat/V3/Marketing/Coupon/Stock/QueryPlugin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@
 block discarded – undo
41 41
 
42 42
         $rocket->setPayload([
43 43
             '_method' => 'GET',
44
-            '_url' => 'v3/marketing/favor/stocks?'.$this->normal($payload, $config),
45
-            '_service_url' => 'v3/marketing/favor/stocks?'.$this->normal($payload, $config),
44
+            '_url' => 'v3/marketing/favor/stocks?' . $this->normal($payload, $config),
45
+            '_service_url' => 'v3/marketing/favor/stocks?' . $this->normal($payload, $config),
46 46
         ]);
47 47
 
48 48
         Logger::info('[Wechat][V3][Marketing][Coupon][Stock][QueryPlugin] 插件装载完毕', ['rocket' => $rocket]);
Please login to merge, or discard this patch.
src/Plugin/Wechat/V3/Marketing/Coupon/Stock/QueryDetailPlugin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@
 block discarded – undo
41 41
 
42 42
         $rocket->setPayload([
43 43
             '_method' => 'GET',
44
-            '_url' => 'v3/marketing/favor/stocks/'.$stockId.'?stock_creator_mchid='.$mchId,
45
-            '_service_url' => 'v3/marketing/favor/stocks/'.$stockId.'?stock_creator_mchid='.$mchId,
44
+            '_url' => 'v3/marketing/favor/stocks/' . $stockId . '?stock_creator_mchid=' . $mchId,
45
+            '_service_url' => 'v3/marketing/favor/stocks/' . $stockId . '?stock_creator_mchid=' . $mchId,
46 46
         ]);
47 47
 
48 48
         Logger::info('[Wechat][V3][Marketing][Coupon][Stock][QueryDetailPlugin] 插件装载完毕', ['rocket' => $rocket]);
Please login to merge, or discard this patch.
src/Plugin/Wechat/V3/Marketing/Coupon/Stock/QueryUseFlowPlugin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@
 block discarded – undo
32 32
 
33 33
         $rocket->setPayload([
34 34
             '_method' => 'GET',
35
-            '_url' => 'v3/marketing/favor/stocks/'.$stockId.'/use-flow',
36
-            '_service_url' => 'v3/marketing/favor/stocks/'.$stockId.'/use-flow',
35
+            '_url' => 'v3/marketing/favor/stocks/' . $stockId . '/use-flow',
36
+            '_service_url' => 'v3/marketing/favor/stocks/' . $stockId . '/use-flow',
37 37
         ]);
38 38
 
39 39
         Logger::info('[Wechat][V3][Marketing][Coupon][Stock][QueryUseFlowPlugin] 插件装载完毕', ['rocket' => $rocket]);
Please login to merge, or discard this patch.