Completed
Pull Request — master (#207)
by Xu
02:10
created
src/Gateways/Wechat.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@
 block discarded – undo
121 121
      * @author yansongda <[email protected]>
122 122
      *
123 123
      * @param string $gateway
124
-     * @param array  $params
124
+     * @param string  $params
125 125
      *
126 126
      * @throws InvalidGatewayException
127 127
      *
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
         $this->payload = array_merge($this->payload, $params);
146 146
 
147
-        $gateway = get_class($this).'\\'.Str::studly($gateway).'Gateway';
147
+        $gateway = get_class($this) . '\\' . Str::studly($gateway) . 'Gateway';
148 148
 
149 149
         if (class_exists($gateway)) {
150 150
             return $this->makePay($gateway);
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
         $app = new $gateway();
322 322
 
323 323
         if ($app instanceof GatewayInterface) {
324
-            return $app->pay($this->gateway, array_filter($this->payload, function ($value) {
324
+            return $app->pay($this->gateway, array_filter($this->payload, function($value) {
325 325
                 return $value !== '' && !is_null($value);
326 326
             }));
327 327
         }
Please login to merge, or discard this patch.
src/Gateways/Wechat/RedpackGateway.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
         }
37 37
 
38 38
         unset($payload['appid'], $payload['trade_type'],
39
-              $payload['notify_url'], $payload['spbill_create_ip']);
39
+                $payload['notify_url'], $payload['spbill_create_ip']);
40 40
 
41 41
         $payload['sign'] = Support::generateSign($payload);
42 42
 
Please login to merge, or discard this patch.
src/Gateways/Wechat/GroupRedpackGateway.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
         }
37 37
 
38 38
         unset($payload['appid'], $payload['trade_type'],
39
-              $payload['notify_url'], $payload['spbill_create_ip']);
39
+                $payload['notify_url'], $payload['spbill_create_ip']);
40 40
 
41 41
         $payload['sign'] = Support::generateSign($payload);
42 42
 
Please login to merge, or discard this patch.
src/Gateways/Alipay.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
         $this->payload['biz_content'] = json_encode($params);
125 125
 
126
-        $gateway = get_class($this).'\\'.Str::studly($gateway).'Gateway';
126
+        $gateway = get_class($this) . '\\' . Str::studly($gateway) . 'Gateway';
127 127
 
128 128
         if (class_exists($gateway)) {
129 129
             return $this->makePay($gateway);
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
         $app = new $gateway();
333 333
 
334 334
         if ($app instanceof GatewayInterface) {
335
-            return $app->pay($this->gateway, array_filter($this->payload, function ($value) {
335
+            return $app->pay($this->gateway, array_filter($this->payload, function($value) {
336 336
                 return $value !== '' && !is_null($value);
337 337
             }));
338 338
         }
Please login to merge, or discard this patch.
src/Gateways/Alipay/WebGateway.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,10 +47,10 @@
 block discarded – undo
47 47
      */
48 48
     protected function buildPayHtml($endpoint, $payload): Response
49 49
     {
50
-        $sHtml = "<form id='alipaysubmit' name='alipaysubmit' action='".$endpoint."' method='POST'>";
50
+        $sHtml = "<form id='alipaysubmit' name='alipaysubmit' action='" . $endpoint . "' method='POST'>";
51 51
         foreach ($payload as $key => $val) {
52 52
             $val = str_replace("'", '&apos;', $val);
53
-            $sHtml .= "<input type='hidden' name='".$key."' value='".$val."'/>";
53
+            $sHtml .= "<input type='hidden' name='" . $key . "' value='" . $val . "'/>";
54 54
         }
55 55
         $sHtml .= "<input type='submit' value='ok' style='display:none;'></form>";
56 56
         $sHtml .= "<script>document.forms['alipaysubmit'].submit();</script>";
Please login to merge, or discard this patch.
src/Pay.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
      */
74 74
     protected function create($method): GatewayApplicationInterface
75 75
     {
76
-        $gateway = __NAMESPACE__.'\\Gateways\\'.Str::studly($method);
76
+        $gateway = __NAMESPACE__ . '\\Gateways\\' . Str::studly($method);
77 77
 
78 78
         if (class_exists($gateway)) {
79 79
             return self::make($gateway);
Please login to merge, or discard this patch.
src/Gateways/Wechat/WapGateway.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@
 block discarded – undo
29 29
 
30 30
         $mweb_url = $this->preOrder($payload)->get('mweb_url');
31 31
 
32
-        $url = is_null(Support::getInstance()->return_url) ? $mweb_url : $mweb_url.
33
-                        '&redirect_url='.urlencode(Support::getInstance()->return_url);
32
+        $url = is_null(Support::getInstance()->return_url) ? $mweb_url : $mweb_url .
33
+                        '&redirect_url=' . urlencode(Support::getInstance()->return_url);
34 34
 
35 35
         return RedirectResponse::create($url);
36 36
     }
Please login to merge, or discard this patch.
src/Gateways/Wechat/MpGateway.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
             'appId'     => !$this->payRequestUseSubAppId ? $payload['appid'] : $payload['sub_appid'],
37 37
             'timeStamp' => strval(time()),
38 38
             'nonceStr'  => Str::random(),
39
-            'package'   => 'prepay_id='.$this->preOrder($payload)->get('prepay_id'),
39
+            'package'   => 'prepay_id=' . $this->preOrder($payload)->get('prepay_id'),
40 40
             'signType'  => 'MD5',
41 41
         ];
42 42
         $pay_request['paySign'] = Support::generateSign($pay_request);
Please login to merge, or discard this patch.
src/Gateways/Wechat/Support.php 1 patch
Spacing   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
         if (!isset($result['return_code']) || $result['return_code'] != 'SUCCESS' || $result['result_code'] != 'SUCCESS') {
168 168
             throw new GatewayException(
169
-                'Get Wechat API Error:'.($result['return_msg'] ?? $result['retmsg']).($result['err_code_des'] ?? ''),
169
+                'Get Wechat API Error:' . ($result['return_msg'] ?? $result['retmsg']) . ($result['err_code_des'] ?? ''),
170 170
                 $result,
171 171
                 20000
172 172
             );
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
         $payload['appid'] = self::$instance->getConfig($type, '');
206 206
 
207 207
         if (self::$instance->getConfig('mode', Wechat::MODE_NORMAL) === Wechat::MODE_SERVICE) {
208
-            $payload['sub_appid'] = self::$instance->getConfig('sub_'.$type, '');
208
+            $payload['sub_appid'] = self::$instance->getConfig('sub_' . $type, '');
209 209
         }
210 210
 
211 211
         unset($payload['trade_type'], $payload['type']);
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 
240 240
         ksort($data);
241 241
 
242
-        $string = md5(self::getSignContent($data).'&key='.$key);
242
+        $string = md5(self::getSignContent($data) . '&key=' . $key);
243 243
 
244 244
         Log::debug('Wechat Generate Sign Before UPPER', [$data, $string]);
245 245
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
         $buff = '';
261 261
 
262 262
         foreach ($data as $k => $v) {
263
-            $buff .= ($k != 'sign' && $v != '' && !is_array($v)) ? $k.'='.$v.'&' : '';
263
+            $buff .= ($k != 'sign' && $v != '' && !is_array($v)) ? $k . '=' . $v . '&' : '';
264 264
         }
265 265
 
266 266
         Log::debug('Wechat Generate Sign Content Before Trim', [$data, $buff]);
@@ -306,8 +306,7 @@  discard block
 block discarded – undo
306 306
 
307 307
         $xml = '<xml>';
308 308
         foreach ($data as $key => $val) {
309
-            $xml .= is_numeric($val) ? '<'.$key.'>'.$val.'</'.$key.'>' :
310
-                                       '<'.$key.'><![CDATA['.$val.']]></'.$key.'>';
309
+            $xml .= is_numeric($val) ? '<' . $key . '>' . $val . '</' . $key . '>' : '<' . $key . '><![CDATA[' . $val . ']]></' . $key . '>';
311 310
         }
312 311
         $xml .= '</xml>';
313 312
 
@@ -378,7 +377,7 @@  discard block
 block discarded – undo
378 377
                 $type = 'appid';
379 378
                 break;
380 379
             default:
381
-                $type = $type.'_id';
380
+                $type = $type . '_id';
382 381
         }
383 382
 
384 383
         return $type;
Please login to merge, or discard this patch.