Passed
Push — v6 ( 20d195...68f5c0 )
by 光春
03:59
created
src/service/curl/HttpService.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     {
70 70
         if (is_array($str)) {
71 71
             $this->data = json_encode($str, JSON_UNESCAPED_UNICODE);
72
-        } else {
72
+        }else {
73 73
             $this->data = $str;
74 74
         }
75 75
         return $this;
@@ -165,13 +165,13 @@  discard block
 block discarded – undo
165 165
         }
166 166
         if ($this->method === 'GET') {
167 167
             $this->httpGet();
168
-        } else if ($this->method === 'POST') {
168
+        }else if ($this->method === 'POST') {
169 169
             $this->httpPost();
170
-        } else if ($this->method === 'XML') {
170
+        }else if ($this->method === 'XML') {
171 171
             $this->httpXml();
172
-        } else if ($this->method === 'FILE') {
172
+        }else if ($this->method === 'FILE') {
173 173
             $this->httpFile();
174
-        } else {
174
+        }else {
175 175
             throw new HttpException(404, '请求方式异常');
176 176
         }
177 177
         if (empty($is)) {
@@ -213,12 +213,12 @@  discard block
 block discarded – undo
213 213
     {
214 214
         $ch = curl_init();
215 215
         curl_setopt($ch, CURLOPT_URL, $this->url);
216
-        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: ' . $this->headers));
216
+        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: '.$this->headers));
217 217
         curl_setopt($ch, CURLOPT_HEADER, 0);
218 218
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
219 219
         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
220 220
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // 跳过证书检查
221
-        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);  // 从证书中检查SSL加密算法是否存在
221
+        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // 从证书中检查SSL加密算法是否存在
222 222
         curl_setopt($ch, CURLOPT_POST, 1);
223 223
         curl_setopt($ch, CURLOPT_POSTFIELDS, $this->data);
224 224
         curl_setopt($ch, CURLOPT_TIMEOUT, 10);
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
         curl_setopt($ch, CURLOPT_TIMEOUT, 40);
255 255
         set_time_limit(0);
256 256
         if (!empty($this->headers)) {
257
-            curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: ' . $this->headers));
257
+            curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: '.$this->headers));
258 258
         }
259 259
         //运行curl
260 260
         $data = curl_exec($ch);
@@ -281,17 +281,17 @@  discard block
 block discarded – undo
281 281
             curl_setopt($ch, CURLOPT_SSLKEYTYPE, 'PEM');
282 282
             curl_setopt($ch, CURLOPT_SSLCERT, $this->cert['cert']);
283 283
             curl_setopt($ch, CURLOPT_SSLKEY, $this->cert['key']);
284
-        } else if (strpos($this->url, 'https') === 0) {
284
+        }else if (strpos($this->url, 'https') === 0) {
285 285
             curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // 信任任何证书
286 286
             curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); // 检查证书中是否设置域名
287 287
         }
288 288
         if (!empty($this->headers)) {
289
-            curl_setopt($ch, CURLOPT_HTTPHEADER, array('content-type: ' . $this->headers));
289
+            curl_setopt($ch, CURLOPT_HTTPHEADER, array('content-type: '.$this->headers));
290 290
         }
291
-        curl_setopt($ch, CURLOPT_HEADER, true);    // 是否需要响应 header
291
+        curl_setopt($ch, CURLOPT_HEADER, true); // 是否需要响应 header
292 292
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
293 293
         $output = curl_exec($ch);
294
-        $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);    // 获得响应结果里的:头大小
294
+        $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); // 获得响应结果里的:头大小
295 295
         $response_body = substr($output, $header_size);
296 296
         curl_close($ch);
297 297
         $this->output = $response_body;
Please login to merge, or discard this patch.
src/service/wechat/WebAppService.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
             $this->scope = $scope;
175 175
         } elseif ($scope === "snsapi_userinfo") {
176 176
             $this->scope = $scope;
177
-        } else {
177
+        }else {
178 178
             throw new DtaException("请检查scope参数");
179 179
         }
180 180
         return $this;
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
         // 获取数据
325 325
         $accessToken = $this->getAccessToken();
326 326
         if (!isset($accessToken['access_token'])) {
327
-            throw  new DtaException("获取access_token错误," . $accessToken['errmsg']);
327
+            throw  new DtaException("获取access_token错误,".$accessToken['errmsg']);
328 328
         }
329 329
         $res = HttpService::instance()
330 330
             ->url("https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token={$accessToken['access_token']}&type=jsapi")
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
             // 获取数据
334 334
             $accessToken = $this->getAccessToken();
335 335
             if (!isset($accessToken['access_token'])) {
336
-                throw  new DtaException("获取access_token错误," . $accessToken['errmsg']);
336
+                throw  new DtaException("获取access_token错误,".$accessToken['errmsg']);
337 337
             }
338 338
             $res = HttpService::instance()
339 339
                 ->url("https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token={$accessToken['access_token']}&type=jsapi")
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
         $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
374 374
         $str = "";
375 375
         for ($i = 0; $i < $length; $i++) {
376
-            $str .= $chars[random_int(0, strlen($chars) - 1)];
376
+            $str .= $chars[random_int(0, strlen($chars)-1)];
377 377
         }
378 378
         return $str;
379 379
     }
@@ -645,22 +645,22 @@  discard block
 block discarded – undo
645 645
                 $accessToken_res = HttpService::instance()
646 646
                     ->url("https://api.weixin.qq.com/cgi-bin/token?grant_type={$this->grant_type}&appid={$this->app_id}&secret={$this->app_secret}")
647 647
                     ->toArray();
648
-                $accessToken_res['expires_time'] = time() + 6000;
648
+                $accessToken_res['expires_time'] = time()+6000;
649 649
                 file_put_contents($file, json_encode($accessToken_res, JSON_UNESCAPED_UNICODE));
650 650
                 $accessToken = $accessToken_res;
651
-            } else if (!isset($accessToken['access_token'])) {
651
+            }else if (!isset($accessToken['access_token'])) {
652 652
                 // 内容不存在
653 653
                 $accessToken_res = HttpService::instance()
654 654
                     ->url("https://api.weixin.qq.com/cgi-bin/token?grant_type={$this->grant_type}&appid={$this->app_id}&secret={$this->app_secret}")
655 655
                     ->toArray();
656
-                $accessToken_res['expires_time'] = time() + 6000;
656
+                $accessToken_res['expires_time'] = time()+6000;
657 657
                 file_put_contents($file, json_encode($accessToken_res, JSON_UNESCAPED_UNICODE));
658 658
                 $accessToken = $accessToken_res;
659
-            } else if ($accessToken['expires_time'] <= time()) {
659
+            }else if ($accessToken['expires_time'] <= time()) {
660 660
                 $accessToken_res = HttpService::instance()
661 661
                     ->url("https://api.weixin.qq.com/cgi-bin/token?grant_type={$this->grant_type}&appid={$this->app_id}&secret={$this->app_secret}")
662 662
                     ->toArray();
663
-                $accessToken_res['expires_time'] = time() + 6000;
663
+                $accessToken_res['expires_time'] = time()+6000;
664 664
                 file_put_contents($file, json_encode($accessToken_res, JSON_UNESCAPED_UNICODE));
665 665
                 $accessToken = $accessToken_res;
666 666
             }
@@ -672,15 +672,15 @@  discard block
 block discarded – undo
672 672
                     $accessToken_res = HttpService::instance()
673 673
                         ->url("https://api.weixin.qq.com/cgi-bin/token?grant_type={$this->grant_type}&appid={$this->app_id}&secret={$this->app_secret}")
674 674
                         ->toArray();
675
-                    $accessToken_res['expires_time'] = time() + 6000;
675
+                    $accessToken_res['expires_time'] = time()+6000;
676 676
                     file_put_contents($file, json_encode($accessToken_res, JSON_UNESCAPED_UNICODE));
677 677
                     $accessToken = $accessToken_res;
678 678
                 }
679
-            } else {
679
+            }else {
680 680
                 $accessToken_res = HttpService::instance()
681 681
                     ->url("https://api.weixin.qq.com/cgi-bin/token?grant_type={$this->grant_type}&appid={$this->app_id}&secret={$this->app_secret}")
682 682
                     ->toArray();
683
-                $accessToken_res['expires_time'] = time() + 6000;
683
+                $accessToken_res['expires_time'] = time()+6000;
684 684
                 file_put_contents($file, json_encode($accessToken_res, JSON_UNESCAPED_UNICODE));
685 685
                 $accessToken = $accessToken_res;
686 686
             }
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
             $cache_mysql_value = dtacache($file);
696 696
             if (!empty($cache_mysql_value)) {
697 697
                 $access_token['access_token'] = $cache_mysql_value;
698
-            } else {
698
+            }else {
699 699
                 // 获取远程Token
700 700
                 $accessToken_res = HttpService::instance()
701 701
                     ->url("https://api.weixin.qq.com/cgi-bin/token?grant_type={$this->grant_type}&appid={$this->app_id}&secret={$this->app_secret}")
@@ -767,11 +767,11 @@  discard block
 block discarded – undo
767 767
         // 转成字符串
768 768
         $stringA = Urls::toParams($array);
769 769
         // 在字符串接商户支付秘钥
770
-        $stringSignTemp = "{$stringA}&key=" . $this->mch_key;
770
+        $stringSignTemp = "{$stringA}&key=".$this->mch_key;
771 771
         //步骤四:MD5或HMAC-SHA256C加密
772 772
         if ($hmacsha256) {
773 773
             $str = hash_hmac("sha256", $stringSignTemp, $this->mch_key);
774
-        } else {
774
+        }else {
775 775
             $str = md5($stringSignTemp);
776 776
         }
777 777
         //符转大写
@@ -795,8 +795,8 @@  discard block
 block discarded – undo
795 795
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
796 796
 
797 797
         //试试手气新增,增加之后 curl 不报 60# 错误,可以请求到微信的响应
798
-        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);  //不验证 SSL 证书
799
-        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);//不验证 SSL 证书域名
798
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //不验证 SSL 证书
799
+        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //不验证 SSL 证书域名
800 800
         //post提交方式
801 801
         curl_setopt($ch, CURLOPT_POST, TRUE);
802 802
         curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
@@ -810,6 +810,6 @@  discard block
 block discarded – undo
810 810
 
811 811
         $error = curl_errno($ch);
812 812
         curl_close($ch);
813
-        return "curl error, error code " . $error;
813
+        return "curl error, error code ".$error;
814 814
     }
815 815
 }
Please login to merge, or discard this patch.
src/service/wechat/QyService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@
 block discarded – undo
99 99
             $data['msgtype'] = $this->msgType;
100 100
         }
101 101
         $result = HttpService::instance()
102
-            ->url("https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=" . $this->key)
102
+            ->url("https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=".$this->key)
103 103
             ->data($data)
104 104
             ->toArray();
105 105
         return $result['errcode'] === 0;
Please login to merge, or discard this patch.
src/service/wechat/MiniService.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -427,21 +427,21 @@  discard block
 block discarded – undo
427 427
                 $accessToken_res = HttpService::instance()
428 428
                     ->url("https://api.weixin.qq.com/cgi-bin/token?grant_type={$this->grant_type}&appid={$this->app_id}&secret={$this->app_secret}")
429 429
                     ->toArray();
430
-                $accessToken_res['expires_time'] = time() + 6000;
430
+                $accessToken_res['expires_time'] = time()+6000;
431 431
                 file_put_contents($file, json_encode($accessToken_res, JSON_UNESCAPED_UNICODE));
432 432
                 $accessToken = $accessToken_res;
433
-            } else if (!isset($accessToken['access_token'])) {
433
+            }else if (!isset($accessToken['access_token'])) {
434 434
                 $accessToken_res = HttpService::instance()
435 435
                     ->url("https://api.weixin.qq.com/cgi-bin/token?grant_type={$this->grant_type}&appid={$this->app_id}&secret={$this->app_secret}")
436 436
                     ->toArray();
437
-                $accessToken_res['expires_time'] = time() + 6000;
437
+                $accessToken_res['expires_time'] = time()+6000;
438 438
                 file_put_contents($file, json_encode($accessToken_res, JSON_UNESCAPED_UNICODE));
439 439
                 $accessToken = $accessToken_res;
440
-            } else if ($accessToken['expires_time'] <= time()) {
440
+            }else if ($accessToken['expires_time'] <= time()) {
441 441
                 $accessToken_res = HttpService::instance()
442 442
                     ->url("https://api.weixin.qq.com/cgi-bin/token?grant_type={$this->grant_type}&appid={$this->app_id}&secret={$this->app_secret}")
443 443
                     ->toArray();
444
-                $accessToken_res['expires_time'] = time() + 6000;
444
+                $accessToken_res['expires_time'] = time()+6000;
445 445
                 file_put_contents($file, json_encode($accessToken_res, JSON_UNESCAPED_UNICODE));
446 446
                 $accessToken = $accessToken_res;
447 447
             }
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
             $cache_mysql_value = dtacache($file);
457 457
             if (!empty($cache_mysql_value)) {
458 458
                 $access_token['access_token'] = $cache_mysql_value;
459
-            } else {
459
+            }else {
460 460
                 $accessToken_res = HttpService::instance()
461 461
                     ->url("https://api.weixin.qq.com/cgi-bin/token?grant_type={$this->grant_type}&appid={$this->app_id}&secret={$this->app_secret}")
462 462
                     ->toArray();
Please login to merge, or discard this patch.
src/service/taobao/TbkService.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -596,12 +596,12 @@  discard block
 block discarded – undo
596 596
         $sign = $this->createSign();
597 597
         //组织参数
598 598
         $strParam = $this->createStrParam();
599
-        $strParam .= 'sign=' . $sign;
599
+        $strParam .= 'sign='.$sign;
600 600
         //访问服务
601 601
         if (empty($this->sandbox)) {
602
-            $url = 'http://gw.api.taobao.com/router/rest?' . $strParam;
603
-        } else {
604
-            $url = 'http://gw.api.tbsandbox.com/router/rest?' . $strParam;
602
+            $url = 'http://gw.api.taobao.com/router/rest?'.$strParam;
603
+        }else {
604
+            $url = 'http://gw.api.tbsandbox.com/router/rest?'.$strParam;
605 605
         }
606 606
         $result = file_get_contents($url);
607 607
         $result = json_decode($result, true);
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
         ksort($this->param);
626 626
         foreach ($this->param as $key => $val) {
627 627
             if ($key !== '' && $val !== '') {
628
-                $sign .= $key . $val;
628
+                $sign .= $key.$val;
629 629
             }
630 630
         }
631 631
         $sign .= $this->app_secret;
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
         $strParam = '';
643 643
         foreach ($this->param as $key => $val) {
644 644
             if ($key !== '' && $val !== '') {
645
-                $strParam .= $key . '=' . urlencode($val) . '&';
645
+                $strParam .= $key.'='.urlencode($val).'&';
646 646
             }
647 647
         }
648 648
         return $strParam;
Please login to merge, or discard this patch.
src/service/pinduoduo/JinBaoService.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
         $sign = $this->createSign();
126 126
         //组织参数
127 127
         $strParam = $this->createStrParam();
128
-        $strParam .= 'sign=' . $sign;
128
+        $strParam .= 'sign='.$sign;
129 129
         //访问服务
130
-        $url = "{$this->url}?" . $strParam;
130
+        $url = "{$this->url}?".$strParam;
131 131
         $result = file_get_contents($url);
132 132
         $result = json_decode($result, true);
133 133
         $this->output = $result;
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
     {
518 518
         if (is_object($object)) {
519 519
             $arr = (array)($object);
520
-        } else {
520
+        }else {
521 521
             $arr = &$object;
522 522
         }
523 523
         if (is_array($arr)) {
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
         ksort($this->param);
546 546
         foreach ($this->param as $key => $val) {
547 547
             if ($key !== '' && $val !== '') {
548
-                $sign .= $key . $val;
548
+                $sign .= $key.$val;
549 549
             }
550 550
         }
551 551
         $sign .= $this->client_secret;
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
         $strParam = '';
563 563
         foreach ($this->param as $key => $val) {
564 564
             if ($key !== '' && $val !== '' && !is_array($val)) {
565
-                $strParam .= $key . '=' . urlencode($val) . '&';
565
+                $strParam .= $key.'='.urlencode($val).'&';
566 566
             }
567 567
         }
568 568
         return $strParam;
Please login to merge, or discard this patch.
src/service/tencent/CosService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -119,6 +119,6 @@
 block discarded – undo
119 119
                 'Body' => $file
120 120
             ]);
121 121
         }
122
-        return config('dtapp.tencent.cos.url', '') . $object;
122
+        return config('dtapp.tencent.cos.url', '').$object;
123 123
     }
124 124
 }
Please login to merge, or discard this patch.
src/helper/Times.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 // | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library
18 18
 // +----------------------------------------------------------------------
19 19
 
20
-declare (strict_types=1);
20
+declare(strict_types=1);
21 21
 
22 22
 namespace DtApp\ThinkLibrary\helper;
23 23
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         date_default_timezone_set('Asia/Shanghai');
59 59
         $msec = 0;
60 60
         list($msec, $sec) = explode(' ', microtime());
61
-        return (float)sprintf('%.0f', ((float)$msec + (float)$sec) * 1000);
61
+        return (float)sprintf('%.0f', ((float)$msec+(float)$sec)*1000);
62 62
     }
63 63
 
64 64
     /**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         date_default_timezone_set('Asia/Shanghai');
73 73
         $end_time = strtotime($end_time);
74 74
         $start_time = $start_time === '' ? time() : strtotime($start_time);
75
-        return $end_time - $start_time;
75
+        return $end_time-$start_time;
76 76
     }
77 77
 
78 78
     /**
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         if (empty($time)) {
112 112
             $time = time();
113 113
         }
114
-        return date($format, $time - $mun);
114
+        return date($format, $time-$mun);
115 115
     }
116 116
 
117 117
     /**
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         if (empty($time)) {
128 128
             $time = time();
129 129
         }
130
-        return date($format, $time + $mun);
130
+        return date($format, $time+$mun);
131 131
     }
132 132
 
133 133
 
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
     {
142 142
         date_default_timezone_set('Asia/Shanghai');
143 143
         $date = date('H:i');
144
-        $curTime = strtotime($date);//当前时分
145
-        $assignTime1 = strtotime($start);//获得指定分钟时间戳,00:00
146
-        $assignTime2 = strtotime($end);//获得指定分钟时间戳,01:00
144
+        $curTime = strtotime($date); //当前时分
145
+        $assignTime1 = strtotime($start); //获得指定分钟时间戳,00:00
146
+        $assignTime2 = strtotime($end); //获得指定分钟时间戳,01:00
147 147
         $result = false;
148 148
         if ($curTime > $assignTime1 && $curTime < $assignTime2) {
149 149
             $result = true;
Please login to merge, or discard this patch.
src/helper/Ints.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 // | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library
18 18
 // +----------------------------------------------------------------------
19 19
 
20
-declare (strict_types=1);
20
+declare(strict_types=1);
21 21
 
22 22
 namespace DtApp\ThinkLibrary\helper;
23 23
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function isEvenNumbers(int $num): bool
37 37
     {
38
-        return $num % 2 === 0;
38
+        return $num%2 === 0;
39 39
     }
40 40
 
41 41
     /**
@@ -45,6 +45,6 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function isOddNumbers(int $num): bool
47 47
     {
48
-        return !($num % 2 === 0);
48
+        return !($num%2 === 0);
49 49
     }
50 50
 }
Please login to merge, or discard this patch.