Passed
Push — master ( 9713c0...15fcb4 )
by Songda
03:12 queued 01:13
created
src/Provider/AbstractProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * @throws InvalidParamsException
34 34
      * @throws ServiceNotFoundException
35 35
      */
36
-    public function shortcut(string $shortcut, array $params = []): null|Collection|MessageInterface|Rocket
36
+    public function shortcut(string $shortcut, array $params = []): null | Collection | MessageInterface | Rocket
37 37
     {
38 38
         if (!class_exists($shortcut) || !in_array(ShortcutInterface::class, class_implements($shortcut))) {
39 39
             throw new InvalidParamsException(Exception::PARAMS_SHORTCUT_NOT_FOUND, "参数异常: [{$shortcut}] 未实现 `ShortcutInterface`");
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      * @throws ContainerException
50 50
      * @throws InvalidParamsException
51 51
      */
52
-    public function pay(array $plugins, array $params): null|Collection|MessageInterface|Rocket
52
+    public function pay(array $plugins, array $params): null | Collection | MessageInterface | Rocket
53 53
     {
54 54
         Logger::info('[AbstractProvider] 即将进行 pay 操作', func_get_args());
55 55
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         } catch (Throwable $e) {
108 108
             Logger::error('[AbstractProvider] 请求支付服务商 API 出错', ['message' => $e->getMessage(), 'rocket' => $rocket->toArray(), 'trace' => $e->getTrace()]);
109 109
 
110
-            throw new InvalidResponseException(Exception::REQUEST_RESPONSE_ERROR, '响应异常: 请求支付服务商 API 出错 - '.$e->getMessage(), [], $e);
110
+            throw new InvalidResponseException(Exception::REQUEST_RESPONSE_ERROR, '响应异常: 请求支付服务商 API 出错 - ' . $e->getMessage(), [], $e);
111 111
         }
112 112
 
113 113
         Logger::info('[AbstractProvider] 请求支付服务商 API 成功', ['response' => ['status' => $response->getStatusCode(), 'headers' => $response->getHeaders(), 'body' => (string) $response->getBody()], 'rocket' => $rocket->toArray()]);
Please login to merge, or discard this patch.
src/Provider/Wechat.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
      * @throws InvalidParamsException
56 56
      * @throws ServiceNotFoundException
57 57
      */
58
-    public function __call(string $shortcut, array $params): null|Collection|MessageInterface
58
+    public function __call(string $shortcut, array $params): null | Collection | MessageInterface
59 59
     {
60
-        $plugin = '\\Yansongda\\Pay\\Shortcut\\Wechat\\'.Str::studly($shortcut).'Shortcut';
60
+        $plugin = '\\Yansongda\\Pay\\Shortcut\\Wechat\\' . Str::studly($shortcut) . 'Shortcut';
61 61
 
62 62
         return $this->shortcut($plugin, ...$params);
63 63
     }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      * @throws InvalidParamsException
68 68
      * @throws ServiceNotFoundException
69 69
      */
70
-    public function query(array $order): Collection|Rocket
70
+    public function query(array $order): Collection | Rocket
71 71
     {
72 72
         Event::dispatch(new Event\MethodCalled('wechat', __METHOD__, $order, null));
73 73
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     /**
78 78
      * @throws InvalidParamsException
79 79
      */
80
-    public function cancel(array $order): Collection|Rocket
80
+    public function cancel(array $order): Collection | Rocket
81 81
     {
82 82
         throw new InvalidParamsException(Exception::PARAMS_METHOD_NOT_SUPPORTED, '参数异常: 微信不支持 cancel API');
83 83
     }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      * @throws InvalidParamsException
88 88
      * @throws ServiceNotFoundException
89 89
      */
90
-    public function close(array $order): Collection|Rocket
90
+    public function close(array $order): Collection | Rocket
91 91
     {
92 92
         Event::dispatch(new Event\MethodCalled('wechat', __METHOD__, $order, null));
93 93
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * @throws InvalidParamsException
102 102
      * @throws ServiceNotFoundException
103 103
      */
104
-    public function refund(array $order): Collection|Rocket
104
+    public function refund(array $order): Collection | Rocket
105 105
     {
106 106
         Event::dispatch(new Event\MethodCalled('wechat', __METHOD__, $order, null));
107 107
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      * @throws ContainerException
113 113
      * @throws InvalidParamsException
114 114
      */
115
-    public function callback(null|array|ServerRequestInterface $contents = null, ?array $params = null): Collection|Rocket
115
+    public function callback(null | array | ServerRequestInterface $contents = null, ?array $params = null): Collection | Rocket
116 116
     {
117 117
         $request = $this->getCallbackParams($contents);
118 118
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
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']);
Please login to merge, or discard this patch.
src/Provider/Unipay.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
      * @throws InvalidParamsException
43 43
      * @throws ServiceNotFoundException
44 44
      */
45
-    public function __call(string $shortcut, array $params): null|Collection|MessageInterface|Rocket
45
+    public function __call(string $shortcut, array $params): null | Collection | MessageInterface | Rocket
46 46
     {
47
-        $plugin = '\\Yansongda\\Pay\\Shortcut\\Unipay\\'.Str::studly($shortcut).'Shortcut';
47
+        $plugin = '\\Yansongda\\Pay\\Shortcut\\Unipay\\' . Str::studly($shortcut) . 'Shortcut';
48 48
 
49 49
         return $this->shortcut($plugin, ...$params);
50 50
     }
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      * @throws InvalidParamsException
55 55
      * @throws ServiceNotFoundException
56 56
      */
57
-    public function query(array $order): Collection|Rocket
57
+    public function query(array $order): Collection | Rocket
58 58
     {
59 59
         Event::dispatch(new Event\MethodCalled('unipay', __METHOD__, $order, null));
60 60
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      * @throws InvalidParamsException
67 67
      * @throws ServiceNotFoundException
68 68
      */
69
-    public function cancel(array $order): Collection|Rocket
69
+    public function cancel(array $order): Collection | Rocket
70 70
     {
71 71
         Event::dispatch(new Event\MethodCalled('unipay', __METHOD__, $order, null));
72 72
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     /**
77 77
      * @throws InvalidParamsException
78 78
      */
79
-    public function close(array $order): Collection|Rocket
79
+    public function close(array $order): Collection | Rocket
80 80
     {
81 81
         throw new InvalidParamsException(Exception::PARAMS_METHOD_NOT_SUPPORTED, '参数异常: 银联不支持 close API');
82 82
     }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      * @throws InvalidParamsException
87 87
      * @throws ServiceNotFoundException
88 88
      */
89
-    public function refund(array $order): Collection|Rocket
89
+    public function refund(array $order): Collection | Rocket
90 90
     {
91 91
         Event::dispatch(new Event\MethodCalled('unipay', __METHOD__, $order, null));
92 92
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      * @throws ContainerException
98 98
      * @throws InvalidParamsException
99 99
      */
100
-    public function callback(null|array|ServerRequestInterface $contents = null, ?array $params = null): Collection|Rocket
100
+    public function callback(null | array | ServerRequestInterface $contents = null, ?array $params = null): Collection | Rocket
101 101
     {
102 102
         $request = $this->getCallbackParams($contents);
103 103
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         );
124 124
     }
125 125
 
126
-    protected function getCallbackParams(null|array|ServerRequestInterface $contents = null): Collection
126
+    protected function getCallbackParams(null | array | ServerRequestInterface $contents = null): Collection
127 127
     {
128 128
         if (is_array($contents)) {
129 129
             return Collection::wrap($contents);
Please login to merge, or discard this patch.
src/Provider/Alipay.php 1 patch
Spacing   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
      * @throws InvalidParamsException
49 49
      * @throws ServiceNotFoundException
50 50
      */
51
-    public function __call(string $shortcut, array $params): null|Collection|MessageInterface|Rocket
51
+    public function __call(string $shortcut, array $params): null | Collection | MessageInterface | Rocket
52 52
     {
53
-        $plugin = '\\Yansongda\\Pay\\Shortcut\\Alipay\\'.Str::studly($shortcut).'Shortcut';
53
+        $plugin = '\\Yansongda\\Pay\\Shortcut\\Alipay\\' . Str::studly($shortcut) . 'Shortcut';
54 54
 
55 55
         return $this->shortcut($plugin, ...$params);
56 56
     }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      * @throws InvalidParamsException
61 61
      * @throws ServiceNotFoundException
62 62
      */
63
-    public function query(array $order): Collection|Rocket
63
+    public function query(array $order): Collection | Rocket
64 64
     {
65 65
         Event::dispatch(new Event\MethodCalled('alipay', __METHOD__, $order, null));
66 66
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      * @throws InvalidParamsException
73 73
      * @throws ServiceNotFoundException
74 74
      */
75
-    public function cancel(array $order): Collection|Rocket
75
+    public function cancel(array $order): Collection | Rocket
76 76
     {
77 77
         Event::dispatch(new Event\MethodCalled('alipay', __METHOD__, $order, null));
78 78
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      * @throws InvalidParamsException
85 85
      * @throws ServiceNotFoundException
86 86
      */
87
-    public function close(array $order): Collection|Rocket
87
+    public function close(array $order): Collection | Rocket
88 88
     {
89 89
         Event::dispatch(new Event\MethodCalled('alipay', __METHOD__, $order, null));
90 90
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      * @throws InvalidParamsException
97 97
      * @throws ServiceNotFoundException
98 98
      */
99
-    public function refund(array $order): Collection|Rocket
99
+    public function refund(array $order): Collection | Rocket
100 100
     {
101 101
         Event::dispatch(new Event\MethodCalled('alipay', __METHOD__, $order, null));
102 102
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      * @throws ContainerException
108 108
      * @throws InvalidParamsException
109 109
      */
110
-    public function callback(null|array|ServerRequestInterface $contents = null, ?array $params = null): Collection
110
+    public function callback(null | array | ServerRequestInterface $contents = null, ?array $params = null): Collection
111 111
     {
112 112
         $request = $this->getCallbackParams($contents);
113 113
 
@@ -130,15 +130,14 @@  discard block
 block discarded – undo
130 130
         );
131 131
     }
132 132
 
133
-    protected function getCallbackParams(array|ServerRequestInterface $contents = null): Collection
133
+    protected function getCallbackParams(array | ServerRequestInterface $contents = null): Collection
134 134
     {
135 135
         if (is_array($contents)) {
136 136
             return Collection::wrap($contents);
137 137
         }
138 138
 
139 139
         if ($contents instanceof ServerRequestInterface) {
140
-            return Collection::wrap('GET' === $contents->getMethod() ? $contents->getQueryParams() :
141
-                $contents->getParsedBody());
140
+            return Collection::wrap('GET' === $contents->getMethod() ? $contents->getQueryParams() : $contents->getParsedBody());
142 141
         }
143 142
 
144 143
         $request = ServerRequest::fromGlobals();
Please login to merge, or discard this patch.