@@ -71,12 +71,12 @@ discard block |
||
| 71 | 71 | HttpServiceProvider::class, |
| 72 | 72 | ]; |
| 73 | 73 | |
| 74 | - private static null|Closure|ContainerInterface $container = null; |
|
| 74 | + private static null | Closure | ContainerInterface $container = null; |
|
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | 77 | * @throws ContainerException |
| 78 | 78 | */ |
| 79 | - private function __construct(array $config, Closure|ContainerInterface $container = null) |
|
| 79 | + private function __construct(array $config, Closure | ContainerInterface $container = null) |
|
| 80 | 80 | { |
| 81 | 81 | $this->registerServices($config, $container); |
| 82 | 82 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | /** |
| 103 | 103 | * @throws ContainerException |
| 104 | 104 | */ |
| 105 | - public static function config(array $config = [], Closure|ContainerInterface $container = null): bool |
|
| 105 | + public static function config(array $config = [], Closure | ContainerInterface $container = null): bool |
|
| 106 | 106 | { |
| 107 | 107 | if (self::hasContainer() && !($config['_force'] ?? false)) { |
| 108 | 108 | return false; |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | return Pay::getContainer()->has($service); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - public static function setContainer(null|Closure|ContainerInterface $container): void |
|
| 195 | + public static function setContainer(null | Closure | ContainerInterface $container): void |
|
| 196 | 196 | { |
| 197 | 197 | self::$container = $container; |
| 198 | 198 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | /** |
| 239 | 239 | * @throws ContainerException |
| 240 | 240 | */ |
| 241 | - private function registerServices(array $config, Closure|ContainerInterface $container = null): void |
|
| 241 | + private function registerServices(array $config, Closure | ContainerInterface $container = null): void |
|
| 242 | 242 | { |
| 243 | 243 | foreach (array_merge($this->coreService, $this->service) as $service) { |
| 244 | 244 | self::registerService($service, ContainerServiceProvider::class == $service ? $container : $config); |
@@ -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 find(array|string $order): array|Collection; |
|
| 24 | + public function find(array | string $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 | } |
@@ -13,9 +13,9 @@ |
||
| 13 | 13 | |
| 14 | 14 | public ?array $params = null; |
| 15 | 15 | |
| 16 | - public null|array|ServerRequestInterface $contents; |
|
| 16 | + public null | array | ServerRequestInterface $contents; |
|
| 17 | 17 | |
| 18 | - public function __construct(string $provider, null|array|ServerRequestInterface $contents, ?array $params = null, ?Rocket $rocket = null) |
|
| 18 | + public function __construct(string $provider, null | array | ServerRequestInterface $contents, ?array $params = null, ?Rocket $rocket = null) |
|
| 19 | 19 | { |
| 20 | 20 | $this->provider = $provider; |
| 21 | 21 | $this->contents = $contents; |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | private string $direction = DirectionInterface::class; |
| 34 | 34 | |
| 35 | - private null|Collection|MessageInterface $destination = null; |
|
| 35 | + private null | Collection | MessageInterface $destination = null; |
|
| 36 | 36 | |
| 37 | - private null|RequestInterface|ResponseInterface $destinationOrigin = null; |
|
| 37 | + private null | RequestInterface | ResponseInterface $destinationOrigin = null; |
|
| 38 | 38 | |
| 39 | 39 | public function getRadar(): ?RequestInterface |
| 40 | 40 | { |
@@ -114,24 +114,24 @@ discard block |
||
| 114 | 114 | return $this; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - public function getDestination(): null|Collection|MessageInterface |
|
| 117 | + public function getDestination(): null | Collection | MessageInterface |
|
| 118 | 118 | { |
| 119 | 119 | return $this->destination; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - public function setDestination(null|Collection|MessageInterface $destination): Rocket |
|
| 122 | + public function setDestination(null | Collection | MessageInterface $destination): Rocket |
|
| 123 | 123 | { |
| 124 | 124 | $this->destination = $destination; |
| 125 | 125 | |
| 126 | 126 | return $this; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - public function getDestinationOrigin(): null|RequestInterface|ResponseInterface |
|
| 129 | + public function getDestinationOrigin(): null | RequestInterface | ResponseInterface |
|
| 130 | 130 | { |
| 131 | 131 | return $this->destinationOrigin; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - public function setDestinationOrigin(null|RequestInterface|ResponseInterface $destinationOrigin): Rocket |
|
| 134 | + public function setDestinationOrigin(null | RequestInterface | ResponseInterface $destinationOrigin): Rocket |
|
| 135 | 135 | { |
| 136 | 136 | $this->destinationOrigin = $destinationOrigin; |
| 137 | 137 | |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | /** |
| 52 | 52 | * @throws InvalidResponseException |
| 53 | 53 | */ |
| 54 | - protected function validateResponse(Rocket $rocket): null|array|Collection|MessageInterface |
|
| 54 | + protected function validateResponse(Rocket $rocket): null | array | Collection | MessageInterface |
|
| 55 | 55 | { |
| 56 | 56 | $response = $rocket->getDestination(); |
| 57 | 57 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @throws InvalidParamsException |
| 35 | 35 | * @throws ServiceNotFoundException |
| 36 | 36 | */ |
| 37 | - public function call(string $plugin, array $params = []): null|Collection|MessageInterface |
|
| 37 | + public function call(string $plugin, array $params = []): null | Collection | MessageInterface |
|
| 38 | 38 | { |
| 39 | 39 | if (!class_exists($plugin) || !in_array(ShortcutInterface::class, class_implements($plugin))) { |
| 40 | 40 | throw new InvalidParamsException(Exception::SHORTCUT_NOT_FOUND, "[{$plugin}] is not incompatible"); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * @throws ContainerException |
| 57 | 57 | * @throws InvalidParamsException |
| 58 | 58 | */ |
| 59 | - public function pay(array $plugins, array $params): null|Collection|MessageInterface |
|
| 59 | + public function pay(array $plugins, array $params): null | Collection | MessageInterface |
|
| 60 | 60 | { |
| 61 | 61 | Logger::info('[AbstractProvider] 即将进行 pay 操作', func_get_args()); |
| 62 | 62 | |
@@ -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 find(array|string $order): array|Collection |
|
| 67 | + public function find(array | string $order): array | Collection |
|
| 68 | 68 | { |
| 69 | 69 | $order = is_array($order) ? $order : ['transaction_id' => $order]; |
| 70 | 70 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | /** |
| 77 | 77 | * @throws InvalidParamsException |
| 78 | 78 | */ |
| 79 | - public function cancel(array|string $order): null|array|Collection |
|
| 79 | + public function cancel(array | string $order): null | array | Collection |
|
| 80 | 80 | { |
| 81 | 81 | throw new InvalidParamsException(Exception::METHOD_NOT_SUPPORTED, 'Wechat does not support cancel api'); |
| 82 | 82 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @throws InvalidParamsException |
| 87 | 87 | * @throws ServiceNotFoundException |
| 88 | 88 | */ |
| 89 | - public function close(array|string $order): null|array|Collection |
|
| 89 | + public function close(array | string $order): null | array | Collection |
|
| 90 | 90 | { |
| 91 | 91 | $order = is_array($order) ? $order : ['out_trade_no' => $order]; |
| 92 | 92 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * @throws InvalidParamsException |
| 103 | 103 | * @throws ServiceNotFoundException |
| 104 | 104 | */ |
| 105 | - public function refund(array $order): array|Collection |
|
| 105 | + public function refund(array $order): array | Collection |
|
| 106 | 106 | { |
| 107 | 107 | Event::dispatch(new Event\MethodCalled('wechat', __METHOD__, $order, null)); |
| 108 | 108 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * @throws ContainerException |
| 114 | 114 | * @throws InvalidParamsException |
| 115 | 115 | */ |
| 116 | - public function callback(null|array|ServerRequestInterface $contents = null, ?array $params = null): Collection |
|
| 116 | + public function callback(null | array | ServerRequestInterface $contents = null, ?array $params = null): Collection |
|
| 117 | 117 | { |
| 118 | 118 | $request = $this->getCallbackParams($contents); |
| 119 | 119 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | ); |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - protected function getCallbackParams(null|array|ServerRequestInterface $contents = null): ServerRequestInterface |
|
| 147 | + protected function getCallbackParams(null | array | ServerRequestInterface $contents = null): ServerRequestInterface |
|
| 148 | 148 | { |
| 149 | 149 | if (is_array($contents) && isset($contents['body'], $contents['headers'])) { |
| 150 | 150 | 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 find(array|string $order): array|Collection |
|
| 55 | + public function find(array | string $order): array | Collection |
|
| 56 | 56 | { |
| 57 | 57 | if (!is_array($order)) { |
| 58 | 58 | throw new InvalidParamsException(Exception::UNIPAY_FIND_STRING_NOT_SUPPORTED); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @throws InvalidParamsException |
| 69 | 69 | * @throws ServiceNotFoundException |
| 70 | 70 | */ |
| 71 | - public function cancel(array|string $order): null|array|Collection |
|
| 71 | + public function cancel(array | string $order): null | array | Collection |
|
| 72 | 72 | { |
| 73 | 73 | if (!is_array($order)) { |
| 74 | 74 | throw new InvalidParamsException(Exception::UNIPAY_CANCEL_STRING_NOT_SUPPORTED); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | /** |
| 83 | 83 | * @throws InvalidParamsException |
| 84 | 84 | */ |
| 85 | - public function close(array|string $order): null|array|Collection |
|
| 85 | + public function close(array | string $order): null | array | Collection |
|
| 86 | 86 | { |
| 87 | 87 | throw new InvalidParamsException(Exception::METHOD_NOT_SUPPORTED, 'Unipay does not support close api'); |
| 88 | 88 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * @throws InvalidParamsException |
| 93 | 93 | * @throws ServiceNotFoundException |
| 94 | 94 | */ |
| 95 | - public function refund(array $order): array|Collection |
|
| 95 | + public function refund(array $order): array | Collection |
|
| 96 | 96 | { |
| 97 | 97 | Event::dispatch(new Event\MethodCalled('unipay', __METHOD__, $order, null)); |
| 98 | 98 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * @throws ContainerException |
| 104 | 104 | * @throws InvalidParamsException |
| 105 | 105 | */ |
| 106 | - public function callback(null|array|ServerRequestInterface $contents = null, ?array $params = null): Collection |
|
| 106 | + public function callback(null | array | ServerRequestInterface $contents = null, ?array $params = null): Collection |
|
| 107 | 107 | { |
| 108 | 108 | $request = $this->getCallbackParams($contents); |
| 109 | 109 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | ); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - protected function getCallbackParams(null|array|ServerRequestInterface $contents = null): Collection |
|
| 133 | + protected function getCallbackParams(null | array | ServerRequestInterface $contents = null): Collection |
|
| 134 | 134 | { |
| 135 | 135 | if (is_array($contents)) { |
| 136 | 136 | return Collection::wrap($contents); |
@@ -44,10 +44,10 @@ discard block |
||
| 44 | 44 | * @throws InvalidParamsException |
| 45 | 45 | * @throws ServiceNotFoundException |
| 46 | 46 | */ |
| 47 | - public function __call(string $shortcut, array $params): null|Collection|MessageInterface |
|
| 47 | + public function __call(string $shortcut, array $params): null | Collection | MessageInterface |
|
| 48 | 48 | { |
| 49 | - $plugin = '\\Yansongda\\Pay\\Plugin\\Alipay\\Shortcut\\'. |
|
| 50 | - Str::studly($shortcut).'Shortcut'; |
|
| 49 | + $plugin = '\\Yansongda\\Pay\\Plugin\\Alipay\\Shortcut\\' . |
|
| 50 | + Str::studly($shortcut) . 'Shortcut'; |
|
| 51 | 51 | |
| 52 | 52 | return $this->call($plugin, ...$params); |
| 53 | 53 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * @throws InvalidParamsException |
| 58 | 58 | * @throws ServiceNotFoundException |
| 59 | 59 | */ |
| 60 | - public function find(array|string $order): array|Collection |
|
| 60 | + public function find(array | string $order): array | Collection |
|
| 61 | 61 | { |
| 62 | 62 | $order = is_array($order) ? $order : ['out_trade_no' => $order]; |
| 63 | 63 | |
@@ -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 | |
@@ -137,15 +137,14 @@ discard block |
||
| 137 | 137 | ); |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - protected function getCallbackParams(array|ServerRequestInterface $contents = null): Collection |
|
| 140 | + protected function getCallbackParams(array | ServerRequestInterface $contents = null): Collection |
|
| 141 | 141 | { |
| 142 | 142 | if (is_array($contents)) { |
| 143 | 143 | return Collection::wrap($contents); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | if ($contents instanceof ServerRequestInterface) { |
| 147 | - return Collection::wrap('GET' === $contents->getMethod() ? $contents->getQueryParams() : |
|
| 148 | - $contents->getParsedBody()); |
|
| 147 | + return Collection::wrap('GET' === $contents->getMethod() ? $contents->getQueryParams() : $contents->getParsedBody()); |
|
| 149 | 148 | } |
| 150 | 149 | |
| 151 | 150 | $request = ServerRequest::fromGlobals(); |