Passed
Pull Request — master (#753)
by Songda
01:48
created
src/Functions.php 1 patch
Spacing   +8 added lines, -9 removed lines patch added patch discarded remove patch
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
             return file_get_contents($key);
64 64
         }
65 65
 
66
-        return "-----BEGIN RSA PRIVATE KEY-----\n".
67
-            wordwrap($key, 64, "\n", true).
66
+        return "-----BEGIN RSA PRIVATE KEY-----\n" .
67
+            wordwrap($key, 64, "\n", true) .
68 68
             "\n-----END RSA PRIVATE KEY-----";
69 69
     }
70 70
 }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
         $sign = $message->getHeaderLine('Wechatpay-Signature');
167 167
         $body = (string) $message->getBody();
168 168
 
169
-        $content = $timestamp."\n".$random."\n".$body."\n";
169
+        $content = $timestamp . "\n" . $random . "\n" . $body . "\n";
170 170
         $public = get_wechat_config($params)['wechat_public_cert_path'][$wechatSerial] ?? null;
171 171
 
172 172
         if (empty($sign)) {
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
         $wechatConfig = get_wechat_config($params);
224 224
 
225 225
         Pay::get(ConfigInterface::class)->set(
226
-            'wechat.'.get_tenant($params).'.wechat_public_cert_path',
226
+            'wechat.' . get_tenant($params) . '.wechat_public_cert_path',
227 227
             ((array) ($wechatConfig['wechat_public_cert_path'] ?? [])) + ($certs ?? []),
228 228
         );
229 229
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
         }
257 257
 
258 258
         foreach ($config['wechat_public_cert_path'] as $serialNo => $cert) {
259
-            file_put_contents($path.'/'.$serialNo.'.crt', $cert);
259
+            file_put_contents($path . '/' . $serialNo . '.crt', $cert);
260 260
         }
261 261
     }
262 262
 }
@@ -365,14 +365,13 @@  discard block
 block discarded – undo
365 365
 if (!function_exists('to_xml')) {
366 366
     function to_xml(array $data, string $root = 'xml'): string
367 367
     {
368
-        $xml = '<'.$root.'>';
368
+        $xml = '<' . $root . '>';
369 369
 
370 370
         foreach ($data as $key => $val) {
371
-            $xml .= is_numeric($val) ? '<'.$key.'>'.$val.'</'.$key.'>' :
372
-                                       '<'.$key.'><![CDATA['.$val.']]></'.$key.'>';
371
+            $xml .= is_numeric($val) ? '<' . $key . '>' . $val . '</' . $key . '>' : '<' . $key . '><![CDATA[' . $val . ']]></' . $key . '>';
373 372
         }
374 373
 
375
-        $xml .= '</'.$root.'>';
374
+        $xml .= '</' . $root . '>';
376 375
 
377 376
         return $xml;
378 377
     }
Please login to merge, or discard this patch.
src/Plugin/Wechat/Pay/Common/PrepayPlugin.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
                 'sub_mchid' => $payload->get('sub_mchid', $config['sub_mch_id'] ?? null),
57 57
             ];
58 58
 
59
-            $subAppId = $payload->get('sub_appid', $config['sub_'.$configKey] ?? null);
59
+            $subAppId = $payload->get('sub_appid', $config['sub_' . $configKey] ?? null);
60 60
 
61 61
             if (!empty($subAppId)) {
62 62
                 $result['sub_appid'] = $subAppId;
Please login to merge, or discard this patch.
src/Plugin/Wechat/GeneralPlugin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
         $url = Pay::MODE_SERVICE === (get_wechat_config($params)['mode'] ?? null) ? $this->getPartnerUri($rocket) : $this->getUri($rocket);
64 64
 
65
-        return 0 === strpos($url, 'http') ? $url : (get_wechat_base_uri($params).$url);
65
+        return 0 === strpos($url, 'http') ? $url : (get_wechat_base_uri($params) . $url);
66 66
     }
67 67
 
68 68
     protected function getHeaders(): array
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
     protected function getConfigKey(array $params): string
78 78
     {
79
-        $key = ($params['_type'] ?? 'mp').'_app_id';
79
+        $key = ($params['_type'] ?? 'mp') . '_app_id';
80 80
 
81 81
         if ('app_app_id' === $key) {
82 82
             $key = 'app_id';
Please login to merge, or discard this patch.
src/Plugin/Wechat/RadarSignPlugin.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
             throw new InvalidConfigException(Exception::WECHAT_CONFIG_ERROR, 'Missing Wechat Config -- [mch_secret_key_v2]');
79 79
         }
80 80
 
81
-        $string = md5($this->v2PayloadToString($payload).'&key='.$secret);
81
+        $string = md5($this->v2PayloadToString($payload) . '&key=' . $secret);
82 82
 
83 83
         return strtoupper($string);
84 84
     }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         $buff = '';
93 93
 
94 94
         foreach ($data as $k => $v) {
95
-            $buff .= ('sign' != $k && '' != $v && !is_array($v)) ? $k.'='.$v.'&' : '';
95
+            $buff .= ('sign' != $k && '' != $v && !is_array($v)) ? $k . '=' . $v . '&' : '';
96 96
         }
97 97
 
98 98
         return trim($buff, '&');
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
             get_wechat_sign($params, $contents),
155 155
         );
156 156
 
157
-        return 'WECHATPAY2-SHA256-RSA2048 '.$auth;
157
+        return 'WECHATPAY2-SHA256-RSA2048 ' . $auth;
158 158
     }
159 159
 
160 160
     /**
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
 
171 171
         $uri = $request->getUri();
172 172
 
173
-        return $request->getMethod()."\n".
174
-            $uri->getPath().(empty($uri->getQuery()) ? '' : '?'.$uri->getQuery())."\n".
175
-            $timestamp."\n".
176
-            $random."\n".
177
-            $this->v3PayloadToString($rocket->getPayload())."\n";
173
+        return $request->getMethod() . "\n" .
174
+            $uri->getPath() . (empty($uri->getQuery()) ? '' : '?' . $uri->getQuery()) . "\n" .
175
+            $timestamp . "\n" .
176
+            $random . "\n" .
177
+            $this->v3PayloadToString($rocket->getPayload()) . "\n";
178 178
     }
179 179
 
180 180
     protected function v3PayloadToString(?Collection $payload): string
Please login to merge, or discard this patch.