Completed
Pull Request — master (#408)
by hui
01:26
created
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/Exceptions/InvalidGatewayException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,6 +14,6 @@
 block discarded – undo
14 14
      */
15 15
     public function __construct($message, $raw = [])
16 16
     {
17
-        parent::__construct('INVALID_GATEWAY: '.$message, $raw, self::INVALID_GATEWAY);
17
+        parent::__construct('INVALID_GATEWAY: ' . $message, $raw, self::INVALID_GATEWAY);
18 18
     }
19 19
 }
Please login to merge, or discard this patch.
src/Exceptions/InvalidSignException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,6 +14,6 @@
 block discarded – undo
14 14
      */
15 15
     public function __construct($message, $raw = [])
16 16
     {
17
-        parent::__construct('INVALID_SIGN: '.$message, $raw, self::INVALID_SIGN);
17
+        parent::__construct('INVALID_SIGN: ' . $message, $raw, self::INVALID_SIGN);
18 18
     }
19 19
 }
Please login to merge, or discard this patch.
src/Exceptions/BusinessException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,6 +14,6 @@
 block discarded – undo
14 14
      */
15 15
     public function __construct($message, $raw = [])
16 16
     {
17
-        parent::__construct('ERROR_BUSINESS: '.$message, $raw, self::ERROR_BUSINESS);
17
+        parent::__construct('ERROR_BUSINESS: ' . $message, $raw, self::ERROR_BUSINESS);
18 18
     }
19 19
 }
Please login to merge, or discard this patch.
src/Exceptions/InvalidConfigException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,6 +14,6 @@
 block discarded – undo
14 14
      */
15 15
     public function __construct($message, $raw = [])
16 16
     {
17
-        parent::__construct('INVALID_CONFIG: '.$message, $raw, self::INVALID_CONFIG);
17
+        parent::__construct('INVALID_CONFIG: ' . $message, $raw, self::INVALID_CONFIG);
18 18
     }
19 19
 }
Please login to merge, or discard this patch.
src/Exceptions/InvalidArgumentException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,6 +14,6 @@
 block discarded – undo
14 14
      */
15 15
     public function __construct($message, $raw = [])
16 16
     {
17
-        parent::__construct('INVALID_ARGUMENT: '.$message, $raw, self::INVALID_ARGUMENT);
17
+        parent::__construct('INVALID_ARGUMENT: ' . $message, $raw, self::INVALID_ARGUMENT);
18 18
     }
19 19
 }
Please login to merge, or discard this patch.
src/Exceptions/GatewayException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,6 +15,6 @@
 block discarded – undo
15 15
      */
16 16
     public function __construct($message, $raw = [], $code = self::ERROR_GATEWAY)
17 17
     {
18
-        parent::__construct('ERROR_GATEWAY: '.$message, $raw, $code);
18
+        parent::__construct('ERROR_GATEWAY: ' . $message, $raw, $code);
19 19
     }
20 20
 }
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
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
             'appId' => !$this->payRequestUseSubAppId ? $payload['appid'] : $payload['sub_appid'],
41 41
             'timeStamp' => strval(time()),
42 42
             'nonceStr' => Str::random(),
43
-            'package' => 'prepay_id='.$this->preOrder($payload)->get('prepay_id'),
43
+            'package' => 'prepay_id=' . $this->preOrder($payload)->get('prepay_id'),
44 44
             'signType' => 'MD5',
45 45
         ];
46 46
         $pay_request['paySign'] = Support::generateSign($pay_request);
Please login to merge, or discard this patch.
src/Gateways/Wechat/Support.php 1 patch
Spacing   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      */
152 152
     public static function requestApi($endpoint, $data, $cert = false): Collection
153 153
     {
154
-        Events::dispatch(new Events\ApiRequesting('Wechat', '', self::$instance->getBaseUri().$endpoint, $data));
154
+        Events::dispatch(new Events\ApiRequesting('Wechat', '', self::$instance->getBaseUri() . $endpoint, $data));
155 155
 
156 156
         $result = self::$instance->post(
157 157
             $endpoint,
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         );
164 164
         $result = is_array($result) ? $result : self::fromXml($result);
165 165
 
166
-        Events::dispatch(new Events\ApiRequested('Wechat', '', self::$instance->getBaseUri().$endpoint, $result));
166
+        Events::dispatch(new Events\ApiRequested('Wechat', '', self::$instance->getBaseUri() . $endpoint, $result));
167 167
 
168 168
         return self::processingApiResult($endpoint, $result);
169 169
     }
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
         $payload['appid'] = self::$instance->getConfig($type, '');
191 191
 
192 192
         if (Wechat::MODE_SERVICE === self::$instance->getConfig('mode', Wechat::MODE_NORMAL)) {
193
-            $payload['sub_appid'] = self::$instance->getConfig('sub_'.$type, '');
193
+            $payload['sub_appid'] = self::$instance->getConfig('sub_' . $type, '');
194 194
         }
195 195
 
196 196
         unset($payload['trade_type'], $payload['type']);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 
223 223
         ksort($data);
224 224
 
225
-        $string = md5(self::getSignContent($data).'&key='.$key);
225
+        $string = md5(self::getSignContent($data) . '&key=' . $key);
226 226
 
227 227
         Log::debug('Wechat Generate Sign Before UPPER', [$data, $string]);
228 228
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
         $buff = '';
242 242
 
243 243
         foreach ($data as $k => $v) {
244
-            $buff .= ('sign' != $k && '' != $v && !is_array($v)) ? $k.'='.$v.'&' : '';
244
+            $buff .= ('sign' != $k && '' != $v && !is_array($v)) ? $k . '=' . $v . '&' : '';
245 245
         }
246 246
 
247 247
         Log::debug('Wechat Generate Sign Content Before Trim', [$data, $buff]);
@@ -283,8 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
         $xml = '<xml>';
285 285
         foreach ($data as $key => $val) {
286
-            $xml .= is_numeric($val) ? '<'.$key.'>'.$val.'</'.$key.'>' :
287
-                                       '<'.$key.'><![CDATA['.$val.']]></'.$key.'>';
286
+            $xml .= is_numeric($val) ? '<' . $key . '>' . $val . '</' . $key . '>' : '<' . $key . '><![CDATA[' . $val . ']]></' . $key . '>';
288 287
         }
289 288
         $xml .= '</xml>';
290 289
 
@@ -351,7 +350,7 @@  discard block
 block discarded – undo
351 350
                 $type = 'appid';
352 351
                 break;
353 352
             default:
354
-                $type = $type.'_id';
353
+                $type = $type . '_id';
355 354
         }
356 355
 
357 356
         return $type;
@@ -385,11 +384,11 @@  discard block
 block discarded – undo
385 384
     protected static function processingApiResult($endpoint, array $result)
386 385
     {
387 386
         if (!isset($result['return_code']) || 'SUCCESS' != $result['return_code']) {
388
-            throw new GatewayException('Get Wechat API Error:'.($result['return_msg'] ?? $result['retmsg'] ?? ''), $result);
387
+            throw new GatewayException('Get Wechat API Error:' . ($result['return_msg'] ?? $result['retmsg'] ?? ''), $result);
389 388
         }
390 389
 
391 390
         if (isset($result['result_code']) && 'SUCCESS' != $result['result_code']) {
392
-            throw new BusinessException('Wechat Business Error: '.$result['err_code'].' - '.$result['err_code_des'], $result);
391
+            throw new BusinessException('Wechat Business Error: ' . $result['err_code'] . ' - ' . $result['err_code_des'], $result);
393 392
         }
394 393
 
395 394
         if ('pay/getsignkey' === $endpoint ||
Please login to merge, or discard this patch.