Completed
Push — master ( a87b05...edb199 )
by Songda
01:58
created
src/Gateways/Wechat/Support.php 1 patch
Spacing   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      */
159 159
     public static function requestApi($endpoint, $data, $cert = false): Collection
160 160
     {
161
-        Events::dispatch(Events::API_REQUESTING, new Events\ApiRequesting('Wechat', '', self::$instance->getBaseUri().$endpoint, $data));
161
+        Events::dispatch(Events::API_REQUESTING, new Events\ApiRequesting('Wechat', '', self::$instance->getBaseUri() . $endpoint, $data));
162 162
 
163 163
         $result = self::$instance->post(
164 164
             $endpoint,
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
         );
171 171
         $result = is_array($result) ? $result : self::fromXml($result);
172 172
 
173
-        Events::dispatch(Events::API_REQUESTED, new Events\ApiRequested('Wechat', '', self::$instance->getBaseUri().$endpoint, $result));
173
+        Events::dispatch(Events::API_REQUESTED, new Events\ApiRequested('Wechat', '', self::$instance->getBaseUri() . $endpoint, $result));
174 174
 
175 175
         return self::processingApiResult($endpoint, $result);
176 176
     }
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         $payload['appid'] = self::$instance->getConfig($type, '');
200 200
 
201 201
         if (self::$instance->getConfig('mode', Wechat::MODE_NORMAL) === Wechat::MODE_SERVICE) {
202
-            $payload['sub_appid'] = self::$instance->getConfig('sub_'.$type, '');
202
+            $payload['sub_appid'] = self::$instance->getConfig('sub_' . $type, '');
203 203
         }
204 204
 
205 205
         unset($payload['trade_type'], $payload['type']);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
         ksort($data);
235 235
 
236
-        $string = md5(self::getSignContent($data).'&key='.$key);
236
+        $string = md5(self::getSignContent($data) . '&key=' . $key);
237 237
 
238 238
         Log::debug('Wechat Generate Sign Before UPPER', [$data, $string]);
239 239
 
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
         $buff = '';
255 255
 
256 256
         foreach ($data as $k => $v) {
257
-            $buff .= ($k != 'sign' && $v != '' && !is_array($v)) ? $k.'='.$v.'&' : '';
257
+            $buff .= ($k != 'sign' && $v != '' && !is_array($v)) ? $k . '=' . $v . '&' : '';
258 258
         }
259 259
 
260 260
         Log::debug('Wechat Generate Sign Content Before Trim', [$data, $buff]);
@@ -300,8 +300,7 @@  discard block
 block discarded – undo
300 300
 
301 301
         $xml = '<xml>';
302 302
         foreach ($data as $key => $val) {
303
-            $xml .= is_numeric($val) ? '<'.$key.'>'.$val.'</'.$key.'>' :
304
-                                       '<'.$key.'><![CDATA['.$val.']]></'.$key.'>';
303
+            $xml .= is_numeric($val) ? '<' . $key . '>' . $val . '</' . $key . '>' : '<' . $key . '><![CDATA[' . $val . ']]></' . $key . '>';
305 304
         }
306 305
         $xml .= '</xml>';
307 306
 
@@ -372,7 +371,7 @@  discard block
 block discarded – undo
372 371
                 $type = 'appid';
373 372
                 break;
374 373
             default:
375
-                $type = $type.'_id';
374
+                $type = $type . '_id';
376 375
         }
377 376
 
378 377
         return $type;
@@ -408,14 +407,14 @@  discard block
 block discarded – undo
408 407
     {
409 408
         if (!isset($result['return_code']) || $result['return_code'] != 'SUCCESS') {
410 409
             throw new GatewayException(
411
-                'Get Wechat API Error:'.($result['return_msg'] ?? $result['retmsg'] ?? ''),
410
+                'Get Wechat API Error:' . ($result['return_msg'] ?? $result['retmsg'] ?? ''),
412 411
                 $result
413 412
             );
414 413
         }
415 414
 
416 415
         if (isset($result['result_code']) && $result['result_code'] != 'SUCCESS') {
417 416
             throw new BusinessException(
418
-                'Wechat Business Error: '.$result['err_code'].' - '.$result['err_code_des'],
417
+                'Wechat Business Error: ' . $result['err_code'] . ' - ' . $result['err_code_des'],
419 418
                 $result
420 419
             );
421 420
         }
Please login to merge, or discard this patch.