@@ -19,17 +19,17 @@ |
||
| 19 | 19 | * @throws InvalidParamsException |
| 20 | 20 | * @throws ServiceNotFoundException |
| 21 | 21 | */ |
| 22 | - public function pay(array $plugins, array $params): null|array|Collection|MessageInterface; |
|
| 22 | + public function pay(array $plugins, array $params): null | array | Collection | MessageInterface; |
|
| 23 | 23 | |
| 24 | - public function query(array $order): array|Collection; |
|
| 24 | + public function query(array $order): array | Collection; |
|
| 25 | 25 | |
| 26 | - public function cancel(array|string $order): null|array|Collection; |
|
| 26 | + public function cancel(array | string $order): null | array | Collection; |
|
| 27 | 27 | |
| 28 | - public function close(array|string $order): null|array|Collection; |
|
| 28 | + public function close(array | string $order): null | array | Collection; |
|
| 29 | 29 | |
| 30 | - public function refund(array $order): array|Collection; |
|
| 30 | + public function refund(array $order): array | Collection; |
|
| 31 | 31 | |
| 32 | - public function callback(null|array|ServerRequestInterface $contents = null, ?array $params = null): Collection; |
|
| 32 | + public function callback(null | array | ServerRequestInterface $contents = null, ?array $params = null): Collection; |
|
| 33 | 33 | |
| 34 | 34 | public function success(): ResponseInterface; |
| 35 | 35 | } |
@@ -51,10 +51,10 @@ discard block |
||
| 51 | 51 | * @throws InvalidParamsException |
| 52 | 52 | * @throws ServiceNotFoundException |
| 53 | 53 | */ |
| 54 | - public function __call(string $shortcut, array $params): null|Collection|MessageInterface |
|
| 54 | + public function __call(string $shortcut, array $params): null | Collection | MessageInterface |
|
| 55 | 55 | { |
| 56 | - $plugin = '\\Yansongda\\Pay\\Plugin\\Wechat\\Shortcut\\'. |
|
| 57 | - Str::studly($shortcut).'Shortcut'; |
|
| 56 | + $plugin = '\\Yansongda\\Pay\\Plugin\\Wechat\\Shortcut\\' . |
|
| 57 | + Str::studly($shortcut) . 'Shortcut'; |
|
| 58 | 58 | |
| 59 | 59 | return $this->call($plugin, ...$params); |
| 60 | 60 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * @throws InvalidParamsException |
| 65 | 65 | * @throws ServiceNotFoundException |
| 66 | 66 | */ |
| 67 | - public function query(array $order): array|Collection |
|
| 67 | + public function query(array $order): array | Collection |
|
| 68 | 68 | { |
| 69 | 69 | Event::dispatch(new Event\MethodCalled('wechat', __METHOD__, $order, null)); |
| 70 | 70 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | /** |
| 75 | 75 | * @throws InvalidParamsException |
| 76 | 76 | */ |
| 77 | - public function cancel(array|string $order): null|array|Collection |
|
| 77 | + public function cancel(array | string $order): null | array | Collection |
|
| 78 | 78 | { |
| 79 | 79 | throw new InvalidParamsException(Exception::METHOD_NOT_SUPPORTED, 'Wechat does not support cancel api'); |
| 80 | 80 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * @throws InvalidParamsException |
| 85 | 85 | * @throws ServiceNotFoundException |
| 86 | 86 | */ |
| 87 | - public function close(array|string $order): null|array|Collection |
|
| 87 | + public function close(array | string $order): null | array | Collection |
|
| 88 | 88 | { |
| 89 | 89 | $order = is_array($order) ? $order : ['out_trade_no' => $order]; |
| 90 | 90 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * @throws InvalidParamsException |
| 101 | 101 | * @throws ServiceNotFoundException |
| 102 | 102 | */ |
| 103 | - public function refund(array $order): array|Collection |
|
| 103 | + public function refund(array $order): array | Collection |
|
| 104 | 104 | { |
| 105 | 105 | Event::dispatch(new Event\MethodCalled('wechat', __METHOD__, $order, null)); |
| 106 | 106 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * @throws ContainerException |
| 112 | 112 | * @throws InvalidParamsException |
| 113 | 113 | */ |
| 114 | - public function callback(null|array|ServerRequestInterface $contents = null, ?array $params = null): Collection |
|
| 114 | + public function callback(null | array | ServerRequestInterface $contents = null, ?array $params = null): Collection |
|
| 115 | 115 | { |
| 116 | 116 | $request = $this->getCallbackParams($contents); |
| 117 | 117 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | ); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - protected function getCallbackParams(null|array|ServerRequestInterface $contents = null): ServerRequestInterface |
|
| 145 | + protected function getCallbackParams(null | array | ServerRequestInterface $contents = null): ServerRequestInterface |
|
| 146 | 146 | { |
| 147 | 147 | if (is_array($contents) && isset($contents['body'], $contents['headers'])) { |
| 148 | 148 | return new ServerRequest('POST', 'http://localhost', $contents['headers'], $contents['body']); |
@@ -39,10 +39,10 @@ discard block |
||
| 39 | 39 | * @throws InvalidParamsException |
| 40 | 40 | * @throws ServiceNotFoundException |
| 41 | 41 | */ |
| 42 | - public function __call(string $shortcut, array $params): null|Collection|MessageInterface |
|
| 42 | + public function __call(string $shortcut, array $params): null | Collection | MessageInterface |
|
| 43 | 43 | { |
| 44 | - $plugin = '\\Yansongda\\Pay\\Plugin\\Unipay\\Shortcut\\'. |
|
| 45 | - Str::studly($shortcut).'Shortcut'; |
|
| 44 | + $plugin = '\\Yansongda\\Pay\\Plugin\\Unipay\\Shortcut\\' . |
|
| 45 | + Str::studly($shortcut) . 'Shortcut'; |
|
| 46 | 46 | |
| 47 | 47 | return $this->call($plugin, ...$params); |
| 48 | 48 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @throws InvalidParamsException |
| 53 | 53 | * @throws ServiceNotFoundException |
| 54 | 54 | */ |
| 55 | - public function query(array $order): array|Collection |
|
| 55 | + public function query(array $order): array | Collection |
|
| 56 | 56 | { |
| 57 | 57 | Event::dispatch(new Event\MethodCalled('unipay', __METHOD__, $order, null)); |
| 58 | 58 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * @throws InvalidParamsException |
| 65 | 65 | * @throws ServiceNotFoundException |
| 66 | 66 | */ |
| 67 | - public function cancel(array|string $order): null|array|Collection |
|
| 67 | + public function cancel(array | string $order): null | array | Collection |
|
| 68 | 68 | { |
| 69 | 69 | if (!is_array($order)) { |
| 70 | 70 | throw new InvalidParamsException(Exception::UNIPAY_CANCEL_STRING_NOT_SUPPORTED); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | /** |
| 79 | 79 | * @throws InvalidParamsException |
| 80 | 80 | */ |
| 81 | - public function close(array|string $order): null|array|Collection |
|
| 81 | + public function close(array | string $order): null | array | Collection |
|
| 82 | 82 | { |
| 83 | 83 | throw new InvalidParamsException(Exception::METHOD_NOT_SUPPORTED, 'Unipay does not support close api'); |
| 84 | 84 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * @throws InvalidParamsException |
| 89 | 89 | * @throws ServiceNotFoundException |
| 90 | 90 | */ |
| 91 | - public function refund(array $order): array|Collection |
|
| 91 | + public function refund(array $order): array | Collection |
|
| 92 | 92 | { |
| 93 | 93 | Event::dispatch(new Event\MethodCalled('unipay', __METHOD__, $order, null)); |
| 94 | 94 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @throws ContainerException |
| 100 | 100 | * @throws InvalidParamsException |
| 101 | 101 | */ |
| 102 | - public function callback(null|array|ServerRequestInterface $contents = null, ?array $params = null): Collection |
|
| 102 | + public function callback(null | array | ServerRequestInterface $contents = null, ?array $params = null): Collection |
|
| 103 | 103 | { |
| 104 | 104 | $request = $this->getCallbackParams($contents); |
| 105 | 105 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | ); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - protected function getCallbackParams(null|array|ServerRequestInterface $contents = null): Collection |
|
| 129 | + protected function getCallbackParams(null | array | ServerRequestInterface $contents = null): Collection |
|
| 130 | 130 | { |
| 131 | 131 | if (is_array($contents)) { |
| 132 | 132 | return Collection::wrap($contents); |
@@ -47,9 +47,9 @@ discard block |
||
| 47 | 47 | * @throws InvalidParamsException |
| 48 | 48 | * @throws ServiceNotFoundException |
| 49 | 49 | */ |
| 50 | - public function __call(string $shortcut, array $params): null|Collection|MessageInterface |
|
| 50 | + public function __call(string $shortcut, array $params): null | Collection | MessageInterface |
|
| 51 | 51 | { |
| 52 | - $plugin = '\\Yansongda\\Pay\\Shortcut\\Alipay\\'.Str::studly($shortcut).'Shortcut'; |
|
| 52 | + $plugin = '\\Yansongda\\Pay\\Shortcut\\Alipay\\' . Str::studly($shortcut) . 'Shortcut'; |
|
| 53 | 53 | |
| 54 | 54 | return $this->call($plugin, ...$params); |
| 55 | 55 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * @throws InvalidParamsException |
| 60 | 60 | * @throws ServiceNotFoundException |
| 61 | 61 | */ |
| 62 | - public function query(array $order): array|Collection |
|
| 62 | + public function query(array $order): array | Collection |
|
| 63 | 63 | { |
| 64 | 64 | Event::dispatch(new Event\MethodCalled('alipay', __METHOD__, $order, null)); |
| 65 | 65 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * @throws InvalidParamsException |
| 72 | 72 | * @throws ServiceNotFoundException |
| 73 | 73 | */ |
| 74 | - public function cancel(array|string $order): null|array|Collection |
|
| 74 | + public function cancel(array | string $order): null | array | Collection |
|
| 75 | 75 | { |
| 76 | 76 | $order = is_array($order) ? $order : ['out_trade_no' => $order]; |
| 77 | 77 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * @throws InvalidParamsException |
| 86 | 86 | * @throws ServiceNotFoundException |
| 87 | 87 | */ |
| 88 | - public function close(array|string $order): null|array|Collection |
|
| 88 | + public function close(array | string $order): null | array | Collection |
|
| 89 | 89 | { |
| 90 | 90 | $order = is_array($order) ? $order : ['out_trade_no' => $order]; |
| 91 | 91 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @throws InvalidParamsException |
| 100 | 100 | * @throws ServiceNotFoundException |
| 101 | 101 | */ |
| 102 | - public function refund(array $order): array|Collection |
|
| 102 | + public function refund(array $order): array | Collection |
|
| 103 | 103 | { |
| 104 | 104 | Event::dispatch(new Event\MethodCalled('alipay', __METHOD__, $order, null)); |
| 105 | 105 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @throws ContainerException |
| 111 | 111 | * @throws InvalidParamsException |
| 112 | 112 | */ |
| 113 | - public function callback(null|array|ServerRequestInterface $contents = null, ?array $params = null): Collection |
|
| 113 | + public function callback(null | array | ServerRequestInterface $contents = null, ?array $params = null): Collection |
|
| 114 | 114 | { |
| 115 | 115 | $request = $this->getCallbackParams($contents); |
| 116 | 116 | |
@@ -136,15 +136,14 @@ discard block |
||
| 136 | 136 | ); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - protected function getCallbackParams(array|ServerRequestInterface $contents = null): Collection |
|
| 139 | + protected function getCallbackParams(array | ServerRequestInterface $contents = null): Collection |
|
| 140 | 140 | { |
| 141 | 141 | if (is_array($contents)) { |
| 142 | 142 | return Collection::wrap($contents); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | if ($contents instanceof ServerRequestInterface) { |
| 146 | - return Collection::wrap('GET' === $contents->getMethod() ? $contents->getQueryParams() : |
|
| 147 | - $contents->getParsedBody()); |
|
| 146 | + return Collection::wrap('GET' === $contents->getMethod() ? $contents->getQueryParams() : $contents->getParsedBody()); |
|
| 148 | 147 | } |
| 149 | 148 | |
| 150 | 149 | $request = ServerRequest::fromGlobals(); |