Completed
Pull Request — master (#116)
by leo
03:34
created
src/Gateways/Wechat/Support.php 1 patch
Spacing   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      */
59 59
     public static function requestApi($endpoint, $data, $key = null, $cert = []): Collection
60 60
     {
61
-        Log::debug('Request To Wechat Api', [self::baseUri().$endpoint, $data]);
61
+        Log::debug('Request To Wechat Api', [self::baseUri() . $endpoint, $data]);
62 62
 
63 63
         $result = self::getInstance()->post(
64 64
             $endpoint,
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
         if (!isset($result['return_code']) || $result['return_code'] != 'SUCCESS' || $result['result_code'] != 'SUCCESS') {
71 71
             throw new GatewayException(
72
-                'Get Wechat API Error:'.$result['return_msg'].($result['err_code_des'] ?? ''),
72
+                'Get Wechat API Error:' . $result['return_msg'] . ($result['err_code_des'] ?? ''),
73 73
                 $result,
74 74
                 20000
75 75
             );
@@ -99,12 +99,12 @@  discard block
 block discarded – undo
99 99
     {
100 100
         $payload = array_merge($payload, is_array($order) ? $order : ['out_trade_no' => $order]);
101 101
 
102
-        $type = isset($order['type']) ? $order['type'].($order['type'] == 'app' ? '' : '_').'id' : 'app_id';
102
+        $type = isset($order['type']) ? $order['type'] . ($order['type'] == 'app' ? '' : '_') . 'id' : 'app_id';
103 103
 
104 104
         $payload['appid'] = $config->get($type, '');
105 105
         $mode = $config->get('mode', Wechat::MODE_NORMAL);
106 106
         if ($mode === Wechat::MODE_SERVICE) {
107
-            $payload['sub_appid'] = $config->get('sub_'.$type, '');
107
+            $payload['sub_appid'] = $config->get('sub_' . $type, '');
108 108
         }
109 109
 
110 110
         unset($payload['trade_type'], $payload['type']);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
         ksort($data);
137 137
 
138
-        $string = md5(self::getSignContent($data).'&key='.$key);
138
+        $string = md5(self::getSignContent($data) . '&key=' . $key);
139 139
 
140 140
         return strtoupper($string);
141 141
     }
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         $buff = '';
155 155
 
156 156
         foreach ($data as $k => $v) {
157
-            $buff .= ($k != 'sign' && $v != '' && !is_array($v)) ? $k.'='.$v.'&' : '';
157
+            $buff .= ($k != 'sign' && $v != '' && !is_array($v)) ? $k . '=' . $v . '&' : '';
158 158
         }
159 159
 
160 160
         return trim($buff, '&');
@@ -177,8 +177,7 @@  discard block
 block discarded – undo
177 177
 
178 178
         $xml = '<xml>';
179 179
         foreach ($data as $key => $val) {
180
-            $xml .= is_numeric($val) ? '<'.$key.'>'.$val.'</'.$key.'>' :
181
-                                       '<'.$key.'><![CDATA['.$val.']]></'.$key.'>';
180
+            $xml .= is_numeric($val) ? '<' . $key . '>' . $val . '</' . $key . '>' : '<' . $key . '><![CDATA[' . $val . ']]></' . $key . '>';
182 181
         }
183 182
         $xml .= '</xml>';
184 183
 
Please login to merge, or discard this patch.