@@ -12,7 +12,7 @@ |
||
12 | 12 | { |
13 | 13 | public function register(Pay $pay, ?array $data = null): void |
14 | 14 | { |
15 | - $service = function () { |
|
15 | + $service = function() { |
|
16 | 16 | return new Wechat(); |
17 | 17 | }; |
18 | 18 |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $detail = $this->formatCert(openssl_x509_parse($cert)); |
90 | 90 | |
91 | 91 | if ('sha1WithRSAEncryption' == $detail['signatureTypeLN'] || 'sha256WithRSAEncryption' == $detail['signatureTypeLN']) { |
92 | - $sn .= $this->getCertSn($detail['issuer'], $detail['serialNumber']).'_'; |
|
92 | + $sn .= $this->getCertSn($detail['issuer'], $detail['serialNumber']) . '_'; |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | protected function getCertSn(array $issuer, string $serialNumber): string |
100 | 100 | { |
101 | 101 | return md5( |
102 | - $this->array2string(array_reverse($issuer)).$serialNumber |
|
102 | + $this->array2string(array_reverse($issuer)) . $serialNumber |
|
103 | 103 | ); |
104 | 104 | } |
105 | 105 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $string = []; |
109 | 109 | |
110 | 110 | foreach ($array as $key => $value) { |
111 | - $string[] = $key.'='.$value; |
|
111 | + $string[] = $key . '=' . $value; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | return implode(',', $string); |
@@ -36,7 +36,7 @@ |
||
36 | 36 | ->send((new Rocket())->setParams($params)->setPayload(new Collection())) |
37 | 37 | ->through($plugins) |
38 | 38 | ->via('assembly') |
39 | - ->then(function ($rocket) { |
|
39 | + ->then(function($rocket) { |
|
40 | 40 | return $this->ignite($rocket); |
41 | 41 | }); |
42 | 42 |
@@ -33,11 +33,11 @@ |
||
33 | 33 | $key = file_get_contents($key); |
34 | 34 | } elseif (Str::endsWith($key, '.pem')) { |
35 | 35 | $key = openssl_pkey_get_private( |
36 | - Str::startsWith($key, 'file://') ? $key : 'file://'.$key |
|
36 | + Str::startsWith($key, 'file://') ? $key : 'file://' . $key |
|
37 | 37 | ); |
38 | - } else { |
|
39 | - $key = "-----BEGIN RSA PRIVATE KEY-----\n". |
|
40 | - wordwrap($key, 64, "\n", true). |
|
38 | + }else { |
|
39 | + $key = "-----BEGIN RSA PRIVATE KEY-----\n" . |
|
40 | + wordwrap($key, 64, "\n", true) . |
|
41 | 41 | "\n-----END RSA PRIVATE KEY-----"; |
42 | 42 | } |
43 | 43 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | */ |
18 | 18 | public function getPlugins(array $params): array |
19 | 19 | { |
20 | - $typeMethod = ($params['_type'] ?? 'default').'Plugins'; |
|
20 | + $typeMethod = ($params['_type'] ?? 'default') . 'Plugins'; |
|
21 | 21 | |
22 | 22 | if (method_exists($this, $typeMethod)) { |
23 | 23 | return $this->{$typeMethod}(); |
@@ -23,15 +23,14 @@ discard block |
||
23 | 23 | $radar = $rocket->getRadar(); |
24 | 24 | |
25 | 25 | $response = 'GET' === $radar->getMethod() ? |
26 | - $this->buildRedirect($radar->getUri()->__toString(), $rocket->getPayload()) : |
|
27 | - $this->buildHtml($radar->getUri()->__toString(), $rocket->getPayload()); |
|
26 | + $this->buildRedirect($radar->getUri()->__toString(), $rocket->getPayload()) : $this->buildHtml($radar->getUri()->__toString(), $rocket->getPayload()); |
|
28 | 27 | |
29 | 28 | return $rocket->setDestination($response); |
30 | 29 | } |
31 | 30 | |
32 | 31 | protected function buildRedirect(string $endpoint, Collection $payload): Response |
33 | 32 | { |
34 | - $url = $endpoint.'?'.Arr::query($payload->all()); |
|
33 | + $url = $endpoint . '?' . Arr::query($payload->all()); |
|
35 | 34 | |
36 | 35 | $content = sprintf('<!DOCTYPE html> |
37 | 36 | <html lang="en"> |
@@ -52,10 +51,10 @@ discard block |
||
52 | 51 | |
53 | 52 | protected function buildHtml(string $endpoint, Collection $payload): Response |
54 | 53 | { |
55 | - $sHtml = "<form id='alipay_submit' name='alipay_submit' action='".$endpoint."' method='POST'>"; |
|
54 | + $sHtml = "<form id='alipay_submit' name='alipay_submit' action='" . $endpoint . "' method='POST'>"; |
|
56 | 55 | foreach ($payload->all() as $key => $val) { |
57 | 56 | $val = str_replace("'", ''', $val); |
58 | - $sHtml .= "<input type='hidden' name='".$key."' value='".$val."'/>"; |
|
57 | + $sHtml .= "<input type='hidden' name='" . $key . "' value='" . $val . "'/>"; |
|
59 | 58 | } |
60 | 59 | $sHtml .= "<input type='submit' value='ok' style='display:none;'></form>"; |
61 | 60 | $sHtml .= "<script>document.forms['alipay_submit'].submit();</script>"; |
@@ -16,7 +16,7 @@ |
||
16 | 16 | { |
17 | 17 | Pay::set(ParserInterface::class, CollectionParser::class); |
18 | 18 | |
19 | - $service = function () { |
|
19 | + $service = function() { |
|
20 | 20 | return new Alipay(); |
21 | 21 | }; |
22 | 22 |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function __call(string $shortcut, array $params) |
38 | 38 | { |
39 | - $plugin = '\\Yansongda\\Pay\\Plugin\\Alipay\\Shortcut\\'. |
|
40 | - Str::studly($shortcut).'Shortcut'; |
|
39 | + $plugin = '\\Yansongda\\Pay\\Plugin\\Alipay\\Shortcut\\' . |
|
40 | + Str::studly($shortcut) . 'Shortcut'; |
|
41 | 41 | |
42 | 42 | if (!class_exists($plugin) || !in_array(ShortcutInterface::class, class_implements($plugin))) { |
43 | 43 | throw new InvalidParamsException(InvalidParamsException::SHORTCUT_NOT_FOUND, "[$plugin] is not incompatible"); |
@@ -145,8 +145,7 @@ discard block |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | if ($contents instanceof ServerRequestInterface) { |
148 | - return Collection::wrap('GET' === $contents->getMethod() ? $contents->getQueryParams() : |
|
149 | - $contents->getParsedBody()); |
|
148 | + return Collection::wrap('GET' === $contents->getMethod() ? $contents->getQueryParams() : $contents->getParsedBody()); |
|
150 | 149 | } |
151 | 150 | |
152 | 151 | $request = ServerRequest::fromGlobals(); |
@@ -44,7 +44,7 @@ |
||
44 | 44 | |
45 | 45 | protected function filterPayload(Rocket $rocket): void |
46 | 46 | { |
47 | - $payload = (new Collection($rocket->getParams()))->filter(function ($v, $k) { |
|
47 | + $payload = (new Collection($rocket->getParams()))->filter(function($v, $k) { |
|
48 | 48 | return '' !== $v && !is_null($v) && 'sign' != $k && 'sign_type' != $k; |
49 | 49 | }); |
50 | 50 |