Completed
Push — master ( 9c1b3c...83fed1 )
by Songda
03:57 queued 16s
created
src/Gateways/Alipay.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
         $this->payload['biz_content'] = json_encode($params);
127 127
 
128
-        $gateway = get_class($this).'\\'.Str::studly($gateway).'Gateway';
128
+        $gateway = get_class($this) . '\\' . Str::studly($gateway) . 'Gateway';
129 129
 
130 130
         if (class_exists($gateway)) {
131 131
             return $this->makePay($gateway);
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      */
188 188
     public function find($order, $type = 'wap'): Collection
189 189
     {
190
-        $gateway = get_class($this).'\\'.Str::studly($type).'Gateway';
190
+        $gateway = get_class($this) . '\\' . Str::studly($type) . 'Gateway';
191 191
 
192 192
         if (!class_exists($gateway) || !is_callable([new $gateway(), 'find'])) {
193 193
             throw new GatewayException("{$gateway} Done Not Exist Or Done Not Has FIND Method");
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
         $app = new $gateway();
347 347
 
348 348
         if ($app instanceof GatewayInterface) {
349
-            return $app->pay($this->gateway, array_filter($this->payload, function ($value) {
349
+            return $app->pay($this->gateway, array_filter($this->payload, function($value) {
350 350
                 return $value !== '' && !is_null($value);
351 351
             }));
352 352
         }
Please login to merge, or discard this patch.
src/Gateways/Alipay/Support.php 1 patch
Spacing   +13 added lines, -14 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     {
126 126
         Events::dispatch(new Events\ApiRequesting('Alipay', '', self::$instance->getBaseUri(), $data));
127 127
 
128
-        $data = array_filter($data, function ($value) {
128
+        $data = array_filter($data, function($value) {
129 129
             return ($value == '' || is_null($value)) ? false : true;
130 130
         });
131 131
 
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
 
160 160
         if (Str::endsWith($privateKey, '.pem')) {
161 161
             $privateKey = openssl_pkey_get_private($privateKey);
162
-        } else {
163
-            $privateKey = "-----BEGIN RSA PRIVATE KEY-----\n".
164
-                wordwrap($privateKey, 64, "\n", true).
162
+        }else {
163
+            $privateKey = "-----BEGIN RSA PRIVATE KEY-----\n" .
164
+                wordwrap($privateKey, 64, "\n", true) .
165 165
                 "\n-----END RSA PRIVATE KEY-----";
166 166
         }
167 167
 
@@ -201,16 +201,15 @@  discard block
 block discarded – undo
201 201
 
202 202
         if (Str::endsWith($publicKey, '.pem')) {
203 203
             $publicKey = openssl_pkey_get_public($publicKey);
204
-        } else {
205
-            $publicKey = "-----BEGIN PUBLIC KEY-----\n".
206
-                wordwrap($publicKey, 64, "\n", true).
204
+        }else {
205
+            $publicKey = "-----BEGIN PUBLIC KEY-----\n" .
206
+                wordwrap($publicKey, 64, "\n", true) .
207 207
                 "\n-----END PUBLIC KEY-----";
208 208
         }
209 209
 
210 210
         $sign = $sign ?? $data['sign'];
211 211
 
212
-        $toVerify = $sync ? mb_convert_encoding(json_encode($data, JSON_UNESCAPED_UNICODE), 'gb2312', 'utf-8') :
213
-                            self::getSignContent($data, true);
212
+        $toVerify = $sync ? mb_convert_encoding(json_encode($data, JSON_UNESCAPED_UNICODE), 'gb2312', 'utf-8') : self::getSignContent($data, true);
214 213
 
215 214
         $isVerify = openssl_verify($toVerify, base64_decode($sign), $publicKey, OPENSSL_ALGO_SHA256) === 1;
216 215
 
@@ -240,10 +239,10 @@  discard block
 block discarded – undo
240 239
         $stringToBeSigned = '';
241 240
         foreach ($data as $k => $v) {
242 241
             if ($verify && $k != 'sign' && $k != 'sign_type') {
243
-                $stringToBeSigned .= $k.'='.$v.'&';
242
+                $stringToBeSigned .= $k . '=' . $v . '&';
244 243
             }
245 244
             if (!$verify && $v !== '' && !is_null($v) && $k != 'sign' && '@' != substr($v, 0, 1)) {
246
-                $stringToBeSigned .= $k.'='.$v.'&';
245
+                $stringToBeSigned .= $k . '=' . $v . '&';
247 246
             }
248 247
         }
249 248
 
@@ -319,12 +318,12 @@  discard block
 block discarded – undo
319 318
      */
320 319
     protected static function processingApiResult($data, $result): Collection
321 320
     {
322
-        $method = str_replace('.', '_', $data['method']).'_response';
321
+        $method = str_replace('.', '_', $data['method']) . '_response';
323 322
 
324 323
         if (!isset($result['sign']) || $result[$method]['code'] != '10000') {
325 324
             throw new GatewayException(
326
-                'Get Alipay API Error:'.$result[$method]['msg'].
327
-                    (isset($result[$method]['sub_code']) ? (' - '.$result[$method]['sub_code']) : ''),
325
+                'Get Alipay API Error:' . $result[$method]['msg'] .
326
+                    (isset($result[$method]['sub_code']) ? (' - ' . $result[$method]['sub_code']) : ''),
328 327
                 $result
329 328
             );
330 329
         }
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
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      */
160 160
     public static function requestApi($endpoint, $data, $cert = false): Collection
161 161
     {
162
-        Events::dispatch(new Events\ApiRequesting('Wechat', '', self::$instance->getBaseUri().$endpoint, $data));
162
+        Events::dispatch(new Events\ApiRequesting('Wechat', '', self::$instance->getBaseUri() . $endpoint, $data));
163 163
 
164 164
         $result = self::$instance->post(
165 165
             $endpoint,
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         );
172 172
         $result = is_array($result) ? $result : self::fromXml($result);
173 173
 
174
-        Events::dispatch(new Events\ApiRequested('Wechat', '', self::$instance->getBaseUri().$endpoint, $result));
174
+        Events::dispatch(new Events\ApiRequested('Wechat', '', self::$instance->getBaseUri() . $endpoint, $result));
175 175
 
176 176
         return self::processingApiResult($endpoint, $result);
177 177
     }
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         $payload['appid'] = self::$instance->getConfig($type, '');
201 201
 
202 202
         if (self::$instance->getConfig('mode', Wechat::MODE_NORMAL) === Wechat::MODE_SERVICE) {
203
-            $payload['sub_appid'] = self::$instance->getConfig('sub_'.$type, '');
203
+            $payload['sub_appid'] = self::$instance->getConfig('sub_' . $type, '');
204 204
         }
205 205
 
206 206
         unset($payload['trade_type'], $payload['type']);
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 
235 235
         ksort($data);
236 236
 
237
-        $string = md5(self::getSignContent($data).'&key='.$key);
237
+        $string = md5(self::getSignContent($data) . '&key=' . $key);
238 238
 
239 239
         Log::debug('Wechat Generate Sign Before UPPER', [$data, $string]);
240 240
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
         $buff = '';
256 256
 
257 257
         foreach ($data as $k => $v) {
258
-            $buff .= ($k != 'sign' && $v != '' && !is_array($v)) ? $k.'='.$v.'&' : '';
258
+            $buff .= ($k != 'sign' && $v != '' && !is_array($v)) ? $k . '=' . $v . '&' : '';
259 259
         }
260 260
 
261 261
         Log::debug('Wechat Generate Sign Content Before Trim', [$data, $buff]);
@@ -301,8 +301,7 @@  discard block
 block discarded – undo
301 301
 
302 302
         $xml = '<xml>';
303 303
         foreach ($data as $key => $val) {
304
-            $xml .= is_numeric($val) ? '<'.$key.'>'.$val.'</'.$key.'>' :
305
-                                       '<'.$key.'><![CDATA['.$val.']]></'.$key.'>';
304
+            $xml .= is_numeric($val) ? '<' . $key . '>' . $val . '</' . $key . '>' : '<' . $key . '><![CDATA[' . $val . ']]></' . $key . '>';
306 305
         }
307 306
         $xml .= '</xml>';
308 307
 
@@ -373,7 +372,7 @@  discard block
 block discarded – undo
373 372
                 $type = 'appid';
374 373
                 break;
375 374
             default:
376
-                $type = $type.'_id';
375
+                $type = $type . '_id';
377 376
         }
378 377
 
379 378
         return $type;
@@ -409,14 +408,14 @@  discard block
 block discarded – undo
409 408
     {
410 409
         if (!isset($result['return_code']) || $result['return_code'] != 'SUCCESS') {
411 410
             throw new GatewayException(
412
-                'Get Wechat API Error:'.($result['return_msg'] ?? $result['retmsg'] ?? ''),
411
+                'Get Wechat API Error:' . ($result['return_msg'] ?? $result['retmsg'] ?? ''),
413 412
                 $result
414 413
             );
415 414
         }
416 415
 
417 416
         if (isset($result['result_code']) && $result['result_code'] != 'SUCCESS') {
418 417
             throw new BusinessException(
419
-                'Wechat Business Error: '.$result['err_code'].' - '.$result['err_code_des'],
418
+                'Wechat Business Error: ' . $result['err_code'] . ' - ' . $result['err_code_des'],
420 419
                 $result
421 420
             );
422 421
         }
Please login to merge, or discard this patch.
src/Gateways/Wechat/RefundGateway.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      *
37 37
      * @return void
38 38
      */
39
-    public function pay ($endpoint, array $payload)
39
+    public function pay($endpoint, array $payload)
40 40
     {
41 41
         throw new InvalidArgumentException('Not Support Refund In Pay');
42 42
     }
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      *
51 51
      * @return void
52 52
      */
53
-    protected function getTradeType ()
53
+    protected function getTradeType()
54 54
     {
55 55
         throw new InvalidArgumentException('Not Support Refund In Pay');
56 56
     }
Please login to merge, or discard this patch.