@@ -16,7 +16,7 @@ |
||
16 | 16 | { |
17 | 17 | Pay::set(PackerInterface::class, CollectionPacker::class); |
18 | 18 | |
19 | - $service = function () { |
|
19 | + $service = function() { |
|
20 | 20 | return new Alipay(); |
21 | 21 | }; |
22 | 22 |
@@ -84,7 +84,7 @@ |
||
84 | 84 | { |
85 | 85 | $method = $rocket->getPayload()->get('method'); |
86 | 86 | |
87 | - return str_replace('.', '_', $method).'_response'; |
|
87 | + return str_replace('.', '_', $method) . '_response'; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -37,15 +37,14 @@ discard block |
||
37 | 37 | $radar = $rocket->getRadar(); |
38 | 38 | |
39 | 39 | $response = 'GET' === $radar->getMethod() ? |
40 | - $this->buildRedirect($radar->getUri()->__toString(), $rocket->getPayload()) : |
|
41 | - $this->buildHtml($radar->getUri()->__toString(), $rocket->getPayload()); |
|
40 | + $this->buildRedirect($radar->getUri()->__toString(), $rocket->getPayload()) : $this->buildHtml($radar->getUri()->__toString(), $rocket->getPayload()); |
|
42 | 41 | |
43 | 42 | return $rocket->setDestination($response); |
44 | 43 | } |
45 | 44 | |
46 | 45 | protected function buildRedirect(string $endpoint, Collection $payload): Response |
47 | 46 | { |
48 | - $url = $endpoint.'?'.Arr::query($payload->all()); |
|
47 | + $url = $endpoint . '?' . Arr::query($payload->all()); |
|
49 | 48 | |
50 | 49 | $content = sprintf('<!DOCTYPE html> |
51 | 50 | <html lang="en"> |
@@ -66,10 +65,10 @@ discard block |
||
66 | 65 | |
67 | 66 | protected function buildHtml(string $endpoint, Collection $payload): Response |
68 | 67 | { |
69 | - $sHtml = "<form id='alipay_submit' name='alipay_submit' action='".$endpoint."' method='POST'>"; |
|
68 | + $sHtml = "<form id='alipay_submit' name='alipay_submit' action='" . $endpoint . "' method='POST'>"; |
|
70 | 69 | foreach ($payload->all() as $key => $val) { |
71 | 70 | $val = str_replace("'", ''', $val); |
72 | - $sHtml .= "<input type='hidden' name='".$key."' value='".$val."'/>"; |
|
71 | + $sHtml .= "<input type='hidden' name='" . $key . "' value='" . $val . "'/>"; |
|
73 | 72 | } |
74 | 73 | $sHtml .= "<input type='submit' value='ok' style='display:none;'></form>"; |
75 | 74 | $sHtml .= "<script>document.forms['alipay_submit'].submit();</script>"; |
@@ -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 |
@@ -35,8 +35,8 @@ |
||
35 | 35 | */ |
36 | 36 | public function __call(string $shortcut, array $params) |
37 | 37 | { |
38 | - $plugin = '\\Yansongda\\Pay\\Plugin\\Alipay\\Shortcut\\'. |
|
39 | - Str::studly($shortcut).'Shortcut'; |
|
38 | + $plugin = '\\Yansongda\\Pay\\Plugin\\Alipay\\Shortcut\\' . |
|
39 | + Str::studly($shortcut) . 'Shortcut'; |
|
40 | 40 | |
41 | 41 | if (!class_exists($plugin) || !in_array(ShortcutInterface::class, class_implements($plugin))) { |
42 | 42 | throw new InvalidParamsException(InvalidParamsException::SHORTCUT_NOT_FOUND, "[$plugin] is not incompatible"); |
@@ -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 |