@@ -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; |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | } catch (ContainerNotFoundException $e) { |
| 138 | 138 | throw $e; |
| 139 | 139 | } catch (Throwable $e) { |
| 140 | - throw new ContainerException('容器异常: '.$e->getMessage()); |
|
| 140 | + throw new ContainerException('容器异常: ' . $e->getMessage()); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | throw new ContainerException('容器异常: 当前容器类型不支持 `set` 方法'); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | } catch (ContainerNotFoundException $e) { |
| 160 | 160 | throw $e; |
| 161 | 161 | } catch (Throwable $e) { |
| 162 | - throw new ContainerException('容器异常: '.$e->getMessage()); |
|
| 162 | + throw new ContainerException('容器异常: ' . $e->getMessage()); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | $parameters = array_values($parameters); |
@@ -176,11 +176,11 @@ discard block |
||
| 176 | 176 | try { |
| 177 | 177 | return Pay::getContainer()->get($service); |
| 178 | 178 | } catch (NotFoundExceptionInterface $e) { |
| 179 | - throw new ServiceNotFoundException('服务未找到: '.$e->getMessage()); |
|
| 179 | + throw new ServiceNotFoundException('服务未找到: ' . $e->getMessage()); |
|
| 180 | 180 | } catch (ContainerNotFoundException $e) { |
| 181 | 181 | throw $e; |
| 182 | 182 | } catch (Throwable $e) { |
| 183 | - throw new ContainerException('容器异常: '.$e->getMessage()); |
|
| 183 | + throw new ContainerException('容器异常: ' . $e->getMessage()); |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
@@ -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); |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | return $this->combinePlugins(); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - $action = Str::camel($params['_action'] ?? 'default').'Plugins'; |
|
| 43 | + $action = Str::camel($params['_action'] ?? 'default') . 'Plugins'; |
|
| 44 | 44 | |
| 45 | 45 | if (method_exists($this, $action)) { |
| 46 | 46 | return $this->{$action}(); |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | public function getPlugins(array $params): array |
| 31 | 31 | { |
| 32 | - $action = Str::camel($params['_action'] ?? 'default').'Plugins'; |
|
| 32 | + $action = Str::camel($params['_action'] ?? 'default') . 'Plugins'; |
|
| 33 | 33 | |
| 34 | 34 | if (method_exists($this, $action)) { |
| 35 | 35 | return $this->{$action}(); |
@@ -20,17 +20,17 @@ |
||
| 20 | 20 | * @throws InvalidParamsException |
| 21 | 21 | * @throws ServiceNotFoundException |
| 22 | 22 | */ |
| 23 | - public function pay(array $plugins, array $params): null|Collection|MessageInterface|Rocket; |
|
| 23 | + public function pay(array $plugins, array $params): null | Collection | MessageInterface | Rocket; |
|
| 24 | 24 | |
| 25 | - public function query(array $order): Collection|Rocket; |
|
| 25 | + public function query(array $order): Collection | Rocket; |
|
| 26 | 26 | |
| 27 | - public function cancel(array $order): Collection|Rocket; |
|
| 27 | + public function cancel(array $order): Collection | Rocket; |
|
| 28 | 28 | |
| 29 | - public function close(array $order): Collection|Rocket; |
|
| 29 | + public function close(array $order): Collection | Rocket; |
|
| 30 | 30 | |
| 31 | - public function refund(array $order): Collection|Rocket; |
|
| 31 | + public function refund(array $order): Collection | Rocket; |
|
| 32 | 32 | |
| 33 | - public function callback(null|array|ServerRequestInterface $contents = null, ?array $params = null): Collection|Rocket; |
|
| 33 | + public function callback(null | array | ServerRequestInterface $contents = null, ?array $params = null): Collection | Rocket; |
|
| 34 | 34 | |
| 35 | 35 | public function success(): ResponseInterface; |
| 36 | 36 | } |
@@ -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 | { |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | return $this->payload; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public function setPayload(null|array|Collection $payload): Rocket |
|
| 75 | + public function setPayload(null | array | Collection $payload): Rocket |
|
| 76 | 76 | { |
| 77 | 77 | if (is_array($payload)) { |
| 78 | 78 | $payload = new Collection($payload); |
@@ -118,24 +118,24 @@ discard block |
||
| 118 | 118 | return $this; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - public function getDestination(): null|Collection|MessageInterface |
|
| 121 | + public function getDestination(): null | Collection | MessageInterface |
|
| 122 | 122 | { |
| 123 | 123 | return $this->destination; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - public function setDestination(null|Collection|MessageInterface $destination): Rocket |
|
| 126 | + public function setDestination(null | Collection | MessageInterface $destination): Rocket |
|
| 127 | 127 | { |
| 128 | 128 | $this->destination = $destination; |
| 129 | 129 | |
| 130 | 130 | return $this; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - public function getDestinationOrigin(): null|RequestInterface|ResponseInterface |
|
| 133 | + public function getDestinationOrigin(): null | RequestInterface | ResponseInterface |
|
| 134 | 134 | { |
| 135 | 135 | return $this->destinationOrigin; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - public function setDestinationOrigin(null|RequestInterface|ResponseInterface $destinationOrigin): Rocket |
|
| 138 | + public function setDestinationOrigin(null | RequestInterface | ResponseInterface $destinationOrigin): Rocket |
|
| 139 | 139 | { |
| 140 | 140 | $this->destinationOrigin = $destinationOrigin; |
| 141 | 141 | |
@@ -61,11 +61,11 @@ discard block |
||
| 61 | 61 | $urlPath = parse_url($url, PHP_URL_PATH); |
| 62 | 62 | $urlQuery = parse_url($url, PHP_URL_QUERY); |
| 63 | 63 | |
| 64 | - return get_wechat_method($payload)."\n". |
|
| 65 | - $urlPath.(empty($urlQuery) ? '' : '?'.$urlQuery)."\n". |
|
| 66 | - $timestamp."\n". |
|
| 67 | - $random."\n". |
|
| 68 | - get_wechat_body($payload)."\n"; |
|
| 64 | + return get_wechat_method($payload) . "\n" . |
|
| 65 | + $urlPath . (empty($urlQuery) ? '' : '?' . $urlQuery) . "\n" . |
|
| 66 | + $timestamp . "\n" . |
|
| 67 | + $random . "\n" . |
|
| 68 | + get_wechat_body($payload) . "\n"; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -94,6 +94,6 @@ discard block |
||
| 94 | 94 | get_wechat_sign($config, $contents), |
| 95 | 95 | ); |
| 96 | 96 | |
| 97 | - return 'WECHATPAY2-SHA256-RSA2048 '.$auth; |
|
| 97 | + return 'WECHATPAY2-SHA256-RSA2048 ' . $auth; |
|
| 98 | 98 | } |
| 99 | 99 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | |
| 41 | 41 | $rocket->setPayload([ |
| 42 | 42 | '_method' => 'GET', |
| 43 | - '_service_url' => 'v3/ecommerce/refunds/'.$refundId.'/return-advance?sub_mchid='.$payload->get('sub_mchid', $config['sub_mch_id']), |
|
| 43 | + '_service_url' => 'v3/ecommerce/refunds/' . $refundId . '/return-advance?sub_mchid=' . $payload->get('sub_mchid', $config['sub_mch_id']), |
|
| 44 | 44 | ]); |
| 45 | 45 | |
| 46 | 46 | Logger::info('[Wechat][Marketing][ECommerceRefund][QueryReturnAdvancePlugin] 插件装载完毕', ['rocket' => $rocket]); |
@@ -23,8 +23,8 @@ |
||
| 23 | 23 | |
| 24 | 24 | $rocket->setPayload([ |
| 25 | 25 | '_method' => 'GET', |
| 26 | - '_url' => 'v3/bill/tradebill?'.$payload->query(), |
|
| 27 | - '_service_url' => 'v3/bill/tradebill?'.$payload->query(), |
|
| 26 | + '_url' => 'v3/bill/tradebill?' . $payload->query(), |
|
| 27 | + '_service_url' => 'v3/bill/tradebill?' . $payload->query(), |
|
| 28 | 28 | ]); |
| 29 | 29 | |
| 30 | 30 | Logger::info('[Wechat][Pay][Combine][GetTradeBillPlugin] 插件装载完毕', ['rocket' => $rocket]); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | 'prepayid' => $prepayId, |
| 75 | 75 | 'package' => 'Sign=WXPay', |
| 76 | 76 | 'noncestr' => Str::random(32), |
| 77 | - 'timestamp' => time().'', |
|
| 77 | + 'timestamp' => time() . '', |
|
| 78 | 78 | ]); |
| 79 | 79 | |
| 80 | 80 | $invokeConfig->set('sign', $this->getSign($invokeConfig, $config)); |
@@ -87,10 +87,10 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | protected function getSign(Collection $invokeConfig, array $config): string |
| 89 | 89 | { |
| 90 | - $contents = $invokeConfig->get('appid', '')."\n". |
|
| 91 | - $invokeConfig->get('timestamp', '')."\n". |
|
| 92 | - $invokeConfig->get('noncestr', '')."\n". |
|
| 93 | - $invokeConfig->get('prepayid', '')."\n"; |
|
| 90 | + $contents = $invokeConfig->get('appid', '') . "\n" . |
|
| 91 | + $invokeConfig->get('timestamp', '') . "\n" . |
|
| 92 | + $invokeConfig->get('noncestr', '') . "\n" . |
|
| 93 | + $invokeConfig->get('prepayid', '') . "\n"; |
|
| 94 | 94 | |
| 95 | 95 | return get_wechat_sign($config, $contents); |
| 96 | 96 | } |