Passed
Pull Request — master (#913)
by Songda
01:55
created
src/Functions.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         $direction = Pay::get($direction);
50 50
 
51 51
         $direction = is_string($direction) ? Pay::get($direction) : $direction;
52
-    } catch (ContainerException|ServiceNotFoundException) {
52
+    } catch (ContainerException | ServiceNotFoundException) {
53 53
     }
54 54
 
55 55
     if (!$direction instanceof DirectionInterface) {
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
         return file_get_contents($key);
71 71
     }
72 72
 
73
-    return "-----BEGIN RSA PRIVATE KEY-----\n".
74
-        wordwrap($key, 64, "\n", true).
73
+    return "-----BEGIN RSA PRIVATE KEY-----\n" .
74
+        wordwrap($key, 64, "\n", true) .
75 75
         "\n-----END RSA PRIVATE KEY-----";
76 76
 }
77 77
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
         return $url;
176 176
     }
177 177
 
178
-    return Wechat::URL[$config['mode'] ?? Pay::MODE_NORMAL].$url;
178
+    return Wechat::URL[$config['mode'] ?? Pay::MODE_NORMAL] . $url;
179 179
 }
180 180
 
181 181
 /**
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 
195 195
 function get_wechat_type_key(array $params): string
196 196
 {
197
-    $key = ($params['_type'] ?? 'mp').'_app_id';
197
+    $key = ($params['_type'] ?? 'mp') . '_app_id';
198 198
 
199 199
     if ('app_app_id' === $key) {
200 200
         $key = 'app_id';
@@ -239,10 +239,10 @@  discard block
 block discarded – undo
239 239
     $buff = '';
240 240
 
241 241
     foreach ($payload as $k => $v) {
242
-        $buff .= ('sign' != $k && '' != $v && !is_array($v)) ? $k.'='.$v.'&' : '';
242
+        $buff .= ('sign' != $k && '' != $v && !is_array($v)) ? $k . '=' . $v . '&' : '';
243 243
     }
244 244
 
245
-    $sign = md5($buff.'key='.$key);
245
+    $sign = md5($buff . 'key=' . $key);
246 246
 
247 247
     return $upper ? strtoupper($sign) : $sign;
248 248
 }
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
  * @throws InvalidSignException
256 256
  * @throws ServiceNotFoundException
257 257
  */
258
-function verify_wechat_sign(ResponseInterface|ServerRequestInterface $message, array $params): void
258
+function verify_wechat_sign(ResponseInterface | ServerRequestInterface $message, array $params): void
259 259
 {
260 260
     if ($message instanceof ServerRequestInterface && 'localhost' === $message->getUri()->getHost()) {
261 261
         return;
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
     $sign = $message->getHeaderLine('Wechatpay-Signature');
268 268
     $body = (string) $message->getBody();
269 269
 
270
-    $content = $timestamp."\n".$random."\n".$body."\n";
270
+    $content = $timestamp . "\n" . $random . "\n" . $body . "\n";
271 271
     $public = get_wechat_config($params)['wechat_public_cert_path'][$wechatSerial] ?? null;
272 272
 
273 273
     if (empty($sign)) {
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
     }
330 330
 
331 331
     Pay::get(ConfigInterface::class)->set(
332
-        'wechat.'.get_tenant($params).'.wechat_public_cert_path',
332
+        'wechat.' . get_tenant($params) . '.wechat_public_cert_path',
333 333
         ((array) ($wechatConfig['wechat_public_cert_path'] ?? [])) + ($certs ?? []),
334 334
     );
335 335
 
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
     }
361 361
 
362 362
     foreach ($config['wechat_public_cert_path'] as $serialNo => $cert) {
363
-        file_put_contents($path.'/'.$serialNo.'.crt', $cert);
363
+        file_put_contents($path . '/' . $serialNo . '.crt', $cert);
364 364
     }
365 365
 }
366 366
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 /**
393 393
  * @throws DecryptException
394 394
  */
395
-function decrypt_wechat_resource_aes_256_gcm(string $ciphertext, string $secret, string $nonce, string $associatedData): array|string
395
+function decrypt_wechat_resource_aes_256_gcm(string $ciphertext, string $secret, string $nonce, string $associatedData): array | string
396 396
 {
397 397
     $decrypted = openssl_decrypt(
398 398
         substr($ciphertext, 0, -Wechat::AUTH_TAG_LENGTH_BYTE),
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
     $publicKey = $config['wechat_public_cert_path'][$serialNo] ?? null;
454 454
 
455 455
     if (empty($publicKey)) {
456
-        throw new InvalidParamsException(Exception::PARAMS_WECHAT_SERIAL_NOT_FOUND, '参数异常: 微信公钥序列号为找到 -'.$serialNo);
456
+        throw new InvalidParamsException(Exception::PARAMS_WECHAT_SERIAL_NOT_FOUND, '参数异常: 微信公钥序列号为找到 -' . $serialNo);
457 457
     }
458 458
 
459 459
     return $publicKey;
@@ -511,5 +511,5 @@  discard block
 block discarded – undo
511 511
         return $url;
512 512
     }
513 513
 
514
-    return Unipay::URL[$config['mode'] ?? Pay::MODE_NORMAL].$url;
514
+    return Unipay::URL[$config['mode'] ?? Pay::MODE_NORMAL] . $url;
515 515
 }
Please login to merge, or discard this patch.
src/Plugin/Unipay/StartPlugin.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
         $certs['cert_id'] = $ssl['serialNumber'] ?? '';
33 33
 
34
-        Pay::get(ConfigInterface::class)->set('unipay.'.$tenant.'.certs', $certs);
34
+        Pay::get(ConfigInterface::class)->set('unipay.' . $tenant . '.certs', $certs);
35 35
 
36 36
         return $certs['cert_id'];
37 37
     }
Please login to merge, or discard this patch.
src/Plugin/Unipay/ResponseHtmlPlugin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@
 block discarded – undo
35 35
 
36 36
     protected function buildHtml(string $endpoint, array $payload): Response
37 37
     {
38
-        $sHtml = "<form id='pay_form' name='pay_form' action='".$endpoint."' method='POST'>";
38
+        $sHtml = "<form id='pay_form' name='pay_form' action='" . $endpoint . "' method='POST'>";
39 39
         foreach ($payload as $key => $val) {
40
-            $sHtml .= "<input type='hidden' name='".$key."' value='".$val."'/>";
40
+            $sHtml .= "<input type='hidden' name='" . $key . "' value='" . $val . "'/>";
41 41
         }
42 42
         $sHtml .= "<input type='submit' value='ok' style='display:none;'></form>";
43 43
         $sHtml .= "<script>document.forms['pay_form'].submit();</script>";
Please login to merge, or discard this patch.