Completed
Push — master ( fb392d...486d95 )
by Songda
02:12
created
src/Gateways/Wechat/Support.php 1 patch
Spacing   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      */
137 137
     public static function requestApi($endpoint, $data, $cert = false): Collection
138 138
     {
139
-        Log::debug('Request To Wechat Api', [self::getInstance()->getBaseUri().$endpoint, $data]);
139
+        Log::debug('Request To Wechat Api', [self::getInstance()->getBaseUri() . $endpoint, $data]);
140 140
 
141 141
         $result = self::getInstance()->post(
142 142
             $endpoint,
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 
153 153
         if (!isset($result['return_code']) || $result['return_code'] != 'SUCCESS' || $result['result_code'] != 'SUCCESS') {
154 154
             throw new GatewayException(
155
-                'Get Wechat API Error:'.$result['return_msg'].($result['err_code_des'] ?? ''),
155
+                'Get Wechat API Error:' . $result['return_msg'] . ($result['err_code_des'] ?? ''),
156 156
                 $result,
157 157
                 20000
158 158
             );
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         $payload['appid'] = self::getInstance()->getConfig($type, '');
192 192
 
193 193
         if (self::getInstance()->getConfig('mode', Wechat::MODE_NORMAL) === Wechat::MODE_SERVICE) {
194
-            $payload['sub_appid'] = self::getInstance()->getConfig('sub_'.$type, '');
194
+            $payload['sub_appid'] = self::getInstance()->getConfig('sub_' . $type, '');
195 195
         }
196 196
 
197 197
         unset($payload['trade_type'], $payload['type']);
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
         ksort($data);
227 227
 
228
-        $string = md5(self::getSignContent($data).'&key='.$key);
228
+        $string = md5(self::getSignContent($data) . '&key=' . $key);
229 229
 
230 230
         Log::debug('Wechat Generate Sign Before UPPER', [$data, $string]);
231 231
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
         $buff = '';
247 247
 
248 248
         foreach ($data as $k => $v) {
249
-            $buff .= ($k != 'sign' && $v != '' && !is_array($v)) ? $k.'='.$v.'&' : '';
249
+            $buff .= ($k != 'sign' && $v != '' && !is_array($v)) ? $k . '=' . $v . '&' : '';
250 250
         }
251 251
 
252 252
         Log::debug('Wechat Generate Sign Content Before Trim', [$data, $buff]);
@@ -294,8 +294,7 @@  discard block
 block discarded – undo
294 294
 
295 295
         $xml = '<xml>';
296 296
         foreach ($data as $key => $val) {
297
-            $xml .= is_numeric($val) ? '<'.$key.'>'.$val.'</'.$key.'>' :
298
-                                       '<'.$key.'><![CDATA['.$val.']]></'.$key.'>';
297
+            $xml .= is_numeric($val) ? '<' . $key . '>' . $val . '</' . $key . '>' : '<' . $key . '><![CDATA[' . $val . ']]></' . $key . '>';
299 298
         }
300 299
         $xml .= '</xml>';
301 300
 
@@ -382,7 +381,7 @@  discard block
 block discarded – undo
382 381
                 $type = 'appid';
383 382
                 break;
384 383
             default:
385
-                $type = $type.'_id';
384
+                $type = $type . '_id';
386 385
         }
387 386
 
388 387
         return $type;
Please login to merge, or discard this patch.