@@ -23,8 +23,7 @@ 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 | $rocket->setDestination($response); |
| 30 | 29 | |
@@ -35,7 +34,7 @@ discard block |
||
| 35 | 34 | |
| 36 | 35 | protected function buildRedirect(string $endpoint, Collection $payload): Response |
| 37 | 36 | { |
| 38 | - $url = $endpoint.(!str_contains($endpoint, '?') ? '?' : '&').$payload->query(); |
|
| 37 | + $url = $endpoint . (!str_contains($endpoint, '?') ? '?' : '&') . $payload->query(); |
|
| 39 | 38 | |
| 40 | 39 | $content = sprintf( |
| 41 | 40 | '<!DOCTYPE html> |
@@ -58,10 +57,10 @@ discard block |
||
| 58 | 57 | |
| 59 | 58 | protected function buildHtml(string $endpoint, Collection $payload): Response |
| 60 | 59 | { |
| 61 | - $sHtml = "<form id='alipay_submit' name='alipay_submit' action='".$endpoint."' method='POST'>"; |
|
| 60 | + $sHtml = "<form id='alipay_submit' name='alipay_submit' action='" . $endpoint . "' method='POST'>"; |
|
| 62 | 61 | foreach ($payload->all() as $key => $val) { |
| 63 | 62 | $val = str_replace("'", ''', $val); |
| 64 | - $sHtml .= "<input type='hidden' name='".$key."' value='".$val."'/>"; |
|
| 63 | + $sHtml .= "<input type='hidden' name='" . $key . "' value='" . $val . "'/>"; |
|
| 65 | 64 | } |
| 66 | 65 | $sHtml .= "<input type='submit' value='ok' style='display:none;'></form>"; |
| 67 | 66 | $sHtml .= "<script>document.forms['alipay_submit'].submit();</script>"; |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | $url = Pay::MODE_SERVICE === (get_wechat_config($params)['mode'] ?? null) ? $this->getPartnerUri($rocket) : $this->getUri($rocket); |
| 65 | 65 | |
| 66 | - return str_starts_with($url, 'http') ? $url : (get_wechat_base_uri($params).$url); |
|
| 66 | + return str_starts_with($url, 'http') ? $url : (get_wechat_base_uri($params) . $url); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | protected function getHeaders(): array |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | protected function getConfigKey(array $params): string |
| 79 | 79 | { |
| 80 | - $key = ($params['_type'] ?? 'mp').'_app_id'; |
|
| 80 | + $key = ($params['_type'] ?? 'mp') . '_app_id'; |
|
| 81 | 81 | |
| 82 | 82 | if ('app_app_id' === $key) { |
| 83 | 83 | $key = 'app_id'; |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | /** |
| 52 | 52 | * @throws InvalidResponseException |
| 53 | 53 | */ |
| 54 | - protected function validateResponse(Rocket $rocket): Collection|MessageInterface|array|null |
|
| 54 | + protected function validateResponse(Rocket $rocket): Collection | MessageInterface | array | null |
|
| 55 | 55 | { |
| 56 | 56 | $response = $rocket->getDestination(); |
| 57 | 57 | |
@@ -19,17 +19,17 @@ |
||
| 19 | 19 | * @throws InvalidParamsException |
| 20 | 20 | * @throws ServiceNotFoundException |
| 21 | 21 | */ |
| 22 | - public function pay(array $plugins, array $params): Collection|MessageInterface|array|null; |
|
| 22 | + public function pay(array $plugins, array $params): Collection | MessageInterface | array | null; |
|
| 23 | 23 | |
| 24 | - public function find(array|string $order): Collection|array; |
|
| 24 | + public function find(array | string $order): Collection | array; |
|
| 25 | 25 | |
| 26 | - public function cancel(array|string $order): array|Collection|null; |
|
| 26 | + public function cancel(array | string $order): array | Collection | null; |
|
| 27 | 27 | |
| 28 | - public function close(array|string $order): array|Collection|null; |
|
| 28 | + public function close(array | string $order): array | Collection | null; |
|
| 29 | 29 | |
| 30 | - public function refund(array $order): Collection|array; |
|
| 30 | + public function refund(array $order): Collection | array; |
|
| 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 | } |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | |
| 62 | 62 | protected function getDefaultHandler(): AbstractProcessingHandler |
| 63 | 63 | { |
| 64 | - $file = $this->config['file'] ?? (sys_get_temp_dir().'/logs/'.$this->config['identify'].'.log'); |
|
| 64 | + $file = $this->config['file'] ?? (sys_get_temp_dir() . '/logs/' . $this->config['identify'] . '.log'); |
|
| 65 | 65 | |
| 66 | 66 | return match ($this->config['type']) { |
| 67 | 67 | 'single' => new StreamHandler($file, $this->config['level']), |
@@ -13,9 +13,9 @@ |
||
| 13 | 13 | |
| 14 | 14 | public ?array $params = null; |
| 15 | 15 | |
| 16 | - public ServerRequestInterface|array|null $contents; |
|
| 16 | + public ServerRequestInterface | array | null $contents; |
|
| 17 | 17 | |
| 18 | - public function __construct(string $provider, ServerRequestInterface|array|null $contents, ?array $params = null, ?Rocket $rocket = null) |
|
| 18 | + public function __construct(string $provider, ServerRequestInterface | array | null $contents, ?array $params = null, ?Rocket $rocket = null) |
|
| 19 | 19 | { |
| 20 | 20 | $this->provider = $provider; |
| 21 | 21 | $this->contents = $contents; |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @throws InvalidParamsException |
| 36 | 36 | * @throws ServiceNotFoundException |
| 37 | 37 | */ |
| 38 | - public function call(string $plugin, array $params = []): Collection|MessageInterface|array|null |
|
| 38 | + public function call(string $plugin, array $params = []): Collection | MessageInterface | array | null |
|
| 39 | 39 | { |
| 40 | 40 | if (!class_exists($plugin) || !in_array(ShortcutInterface::class, class_implements($plugin))) { |
| 41 | 41 | throw new InvalidParamsException(Exception::SHORTCUT_NOT_FOUND, "[{$plugin}] is not incompatible"); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * @throws ContainerException |
| 58 | 58 | * @throws InvalidParamsException |
| 59 | 59 | */ |
| 60 | - public function pay(array $plugins, array $params): Collection|MessageInterface|array|null |
|
| 60 | + public function pay(array $plugins, array $params): Collection | MessageInterface | array | null |
|
| 61 | 61 | { |
| 62 | 62 | Logger::info('[AbstractProvider] 即将进行 pay 操作', func_get_args()); |
| 63 | 63 | |
@@ -71,12 +71,12 @@ discard block |
||
| 71 | 71 | HttpServiceProvider::class, |
| 72 | 72 | ]; |
| 73 | 73 | |
| 74 | - private static Closure|null|ContainerInterface $container = null; |
|
| 74 | + private static Closure | null | ContainerInterface $container = null; |
|
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | 77 | * @throws ContainerException |
| 78 | 78 | */ |
| 79 | - private function __construct(array $config, ContainerInterface|Closure $container = null) |
|
| 79 | + private function __construct(array $config, ContainerInterface | Closure $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 = [], ContainerInterface|Closure $container = null): bool |
|
| 105 | + public static function config(array $config = [], ContainerInterface | Closure $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(ContainerInterface|Closure|null $container): void |
|
| 195 | + public static function setContainer(ContainerInterface | Closure | null $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, ContainerInterface|Closure $container = null): void |
|
| 241 | + private function registerServices(array $config, ContainerInterface | Closure $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); |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | private string $direction = DirectionInterface::class; |
| 34 | 34 | |
| 35 | - private array|null|MessageInterface|Collection $destination = null; |
|
| 35 | + private array | null | MessageInterface | Collection $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(): Collection|MessageInterface|array|null |
|
| 117 | + public function getDestination(): Collection | MessageInterface | array | null |
|
| 118 | 118 | { |
| 119 | 119 | return $this->destination; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - public function setDestination(Collection|MessageInterface|array|null $destination): Rocket |
|
| 122 | + public function setDestination(Collection | MessageInterface | array | null $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 | |