Passed
Push — master ( 3091d6...23e15f )
by ma
01:42
created
src/ChineseChar.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@
 block discarded – undo
110 110
         if ($len <= $split_len) {
111 111
             return array($str);
112 112
         }
113
-        preg_match_all('/.{' . $split_len . '}|[^\x00]{1,' . $split_len . '}$/us', $str, $ar);
113
+        preg_match_all('/.{'.$split_len.'}|[^\x00]{1,'.$split_len.'}$/us', $str, $ar);
114 114
 
115 115
         return $ar[0];
116 116
     }
Please login to merge, or discard this patch.
src/exception/TinymengException.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@
 block discarded – undo
18 18
 
19 19
     public function __construct(int $statusCode, string $message = '', Exception $previous = null, array $headers = [], $code = 0)
20 20
     {
21
-        $this->headers    = $headers;
21
+        $this->headers = $headers;
22 22
 
23 23
         /** message */
24
-        if(empty($message)) $message = isset(StatusCode::$status_code[$statusCode]) ? StatusCode::$status_code[$statusCode] :StatusCode::$status_code[StatusCode::COMMON_UNKNOWN];
24
+        if (empty($message)) $message = isset(StatusCode::$status_code[$statusCode]) ? StatusCode::$status_code[$statusCode] : StatusCode::$status_code[StatusCode::COMMON_UNKNOWN];
25 25
         parent::__construct('ERROR_TINYMENG_TOOL: '.$message, $code, $previous);
26 26
     }
27 27
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@
 block discarded – undo
21 21
         $this->headers    = $headers;
22 22
 
23 23
         /** message */
24
-        if(empty($message)) $message = isset(StatusCode::$status_code[$statusCode]) ? StatusCode::$status_code[$statusCode] :StatusCode::$status_code[StatusCode::COMMON_UNKNOWN];
24
+        if(empty($message)) {
25
+            $message = isset(StatusCode::$status_code[$statusCode]) ? StatusCode::$status_code[$statusCode] :StatusCode::$status_code[StatusCode::COMMON_UNKNOWN];
26
+        }
25 27
         parent::__construct('ERROR_TINYMENG_TOOL: '.$message, $code, $previous);
26 28
     }
27 29
 
Please login to merge, or discard this patch.
src/exception/StatusCode.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -12,43 +12,43 @@
 block discarded – undo
12 12
     /**
13 13
      * 公共状态码
14 14
      */
15
-    const COMMON_SUCCESS = 200;//成功
16
-    const COMMON_UNKNOWN = 400;//未知错误
17
-    const COMMON_REQUEST_METHOD = 401;//错误请求(请求方式错误)
18
-    const COMMON_HEADER_MISS_PARAM = 402;//缺失头信息
19
-    const COMMON_ACCESS_BARRED = 403;//禁止访问
20
-    const COMMON_NOT_REQUEST = 404;//请求不存在
21
-    const COMMON_TINYMENG_REQUEST_METHOD = 405;//站外链接请求错误
15
+    const COMMON_SUCCESS = 200; //成功
16
+    const COMMON_UNKNOWN = 400; //未知错误
17
+    const COMMON_REQUEST_METHOD = 401; //错误请求(请求方式错误)
18
+    const COMMON_HEADER_MISS_PARAM = 402; //缺失头信息
19
+    const COMMON_ACCESS_BARRED = 403; //禁止访问
20
+    const COMMON_NOT_REQUEST = 404; //请求不存在
21
+    const COMMON_TINYMENG_REQUEST_METHOD = 405; //站外链接请求错误
22 22
 
23 23
     /**
24 24
      * 未授权 420
25 25
      */
26
-    const COMMON_TOKEN_INVALID = 421;//token无效
27
-    const COMMON_SIGN_ERROR = 422;//签名错误
28
-    const COMMON_NO_ACCESS = 423;//没有权限
26
+    const COMMON_TOKEN_INVALID = 421; //token无效
27
+    const COMMON_SIGN_ERROR = 422; //签名错误
28
+    const COMMON_NO_ACCESS = 423; //没有权限
29 29
 
30 30
     /**
31 31
      * 数据错误 430
32 32
      */
33
-    const COMMON_PARAM_INVALID = 431;//参数无效
34
-    const COMMON_PARAM_MISS = 432;//参数缺失
35
-    const COMMON_PARAMS_VERIFY_ERROR = 433;//字段验证失败
36
-    const COMMON_CAPTCHA_INVALID = 434;//验证码错误
37
-    const COMMON_NO_DATA_EXIST = 435;//数据不存在
38
-    const COMMON_DATA_EXIST = 436;//数据已存在
39
-    const COMMON_SAVE_FAILURE = 437;//存储失败
33
+    const COMMON_PARAM_INVALID = 431; //参数无效
34
+    const COMMON_PARAM_MISS = 432; //参数缺失
35
+    const COMMON_PARAMS_VERIFY_ERROR = 433; //字段验证失败
36
+    const COMMON_CAPTCHA_INVALID = 434; //验证码错误
37
+    const COMMON_NO_DATA_EXIST = 435; //数据不存在
38
+    const COMMON_DATA_EXIST = 436; //数据已存在
39
+    const COMMON_SAVE_FAILURE = 437; //存储失败
40 40
 
41 41
     /**
42 42
      * 用户错误码 440
43 43
      */
44
-    const COMMON_NOT_ENTERED_PASSWORD = 440;//未输入密码
45
-    const COMMON_PASSWORD_INVALID = 441;//密码错误
44
+    const COMMON_NOT_ENTERED_PASSWORD = 440; //未输入密码
45
+    const COMMON_PASSWORD_INVALID = 441; //密码错误
46 46
 
47 47
     /**
48 48
      * 系统状态码 300000
49 49
      */
50
-    const USER_STOP_USE = 300105;//用户停止使用
51
-    const USER_SYSTEM_UPDATE = 300109;//系统升级
50
+    const USER_STOP_USE = 300105; //用户停止使用
51
+    const USER_SYSTEM_UPDATE = 300109; //系统升级
52 52
 
53 53
     public static $status_code = [
54 54
         //公共错误码
Please login to merge, or discard this patch.
src/async/AsyncHook.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace tinymeng\tools\async;
3 3
 
4
-class AsyncHook{
4
+class AsyncHook {
5 5
 
6 6
     /**
7 7
      * @var array
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
      */
21 21
     public static function hook(callable $callback, $params) {
22 22
         self::$hook_list[] = array('callback' => $callback, 'params' => $params);
23
-        if(self::$hooked == false) {
23
+        if (self::$hooked == false) {
24 24
             self::$hooked = true;
25 25
             //注册一个callback当前在脚本执行完后执行
26 26
             register_shutdown_function(array(__CLASS__, '__run'));
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
      */
34 34
     private static function __run() {
35 35
         fastcgi_finish_request();
36
-        if(empty(self::$hook_list)) {
36
+        if (empty(self::$hook_list)) {
37 37
             return;
38 38
         }
39
-        foreach(self::$hook_list as $hook) {
39
+        foreach (self::$hook_list as $hook) {
40 40
             $callback = $hook['callback'];
41 41
             $params = $hook['params'];
42 42
             call_user_func_array($callback, $params);
Please login to merge, or discard this patch.
src/Encryption.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * Description: Tool.php.
9 9
  */
10 10
 
11
-class Encryption{
11
+class Encryption {
12 12
 
13 13
 
14 14
     /**
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      * @return bool|string
23 23
      */
24 24
     static public function authcode($string, $operation = 'decode', $key = 'tinymeng', $expiry = 0) {
25
-        $ckey_length = 4;	// 随机密钥长度 取值 0-32;
25
+        $ckey_length = 4; // 随机密钥长度 取值 0-32;
26 26
         // 加入随机密钥,可以令密文无任何规律,即便是原文和密钥完全相同,加密结果也会每次不同,增大破解难度。
27 27
         // 取值越大,密文变动规律越大,密文变化 = 16 的 $ckey_length 次方
28 28
         // 当此值为 0 时,则不产生随机密钥
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
         $key = md5($key);
31 31
         $keya = md5(substr($key, 0, 16));
32 32
         $keyb = md5(substr($key, 16, 16));
33
-        $keyc = $ckey_length ? ($operation == 'decode' ? substr($string, 0, $ckey_length): substr(md5(microtime()), -$ckey_length)) : '';
33
+        $keyc = $ckey_length ? ($operation == 'decode' ? substr($string, 0, $ckey_length) : substr(md5(microtime()), -$ckey_length)) : '';
34 34
 
35 35
         $cryptkey = $keya.md5($keya.$keyc);
36 36
         $key_length = strlen($cryptkey);
37 37
 
38
-        if($operation == 'decode'){
38
+        if ($operation == 'decode') {
39 39
             $string = base64_decode(substr($string, $ckey_length));
40
-        }else{
40
+        } else {
41 41
             $a = $expiry ? $expiry + time() : 0;
42 42
             $string = sprintf('%010d', $a).substr(md5($string.$keyb), 0, 16).$string;
43 43
         }
@@ -47,27 +47,27 @@  discard block
 block discarded – undo
47 47
         $box = range(0, 255);
48 48
 
49 49
         $rndkey = array();
50
-        for($i = 0; $i <= 255; $i++) {
50
+        for ($i = 0; $i <= 255; $i++) {
51 51
             $rndkey[$i] = ord($cryptkey[$i % $key_length]);
52 52
         }
53
-        for($j = $i = 0; $i < 256; $i++) {
53
+        for ($j = $i = 0; $i < 256; $i++) {
54 54
             $j = ($j + $box[$i] + $rndkey[$i]) % 256;
55 55
             $tmp = $box[$i];
56 56
             $box[$i] = $box[$j];
57 57
             $box[$j] = $tmp;
58 58
         }
59 59
 
60
-        for($a = $j = $i = 0; $i < $string_length; $i++) {
60
+        for ($a = $j = $i = 0; $i < $string_length; $i++) {
61 61
             $a = ($a + 1) % 256;
62 62
             $j = ($j + $box[$a]) % 256;
63 63
             $tmp = $box[$a];
64 64
             $box[$a] = $box[$j];
65 65
             $box[$j] = $tmp;
66
-            $result .= chr( ord($string[$i])  ^ ( $box[($box[$a] + $box[$j]) % 256]));
66
+            $result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));
67 67
         }
68 68
 
69
-        if($operation == 'decode') {
70
-            if((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26).$keyb), 0, 16)) {
69
+        if ($operation == 'decode') {
70
+            if ((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26).$keyb), 0, 16)) {
71 71
                 return substr($result, 26);
72 72
             } else {
73 73
                 return '';
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 
38 38
         if($operation == 'decode'){
39 39
             $string = base64_decode(substr($string, $ckey_length));
40
-        }else{
40
+        } else{
41 41
             $a = $expiry ? $expiry + time() : 0;
42 42
             $string = sprintf('%010d', $a).substr(md5($string.$keyb), 0, 16).$string;
43 43
         }
Please login to merge, or discard this patch.
src/Calendar.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
     {
219 219
         $date = $this->makeDate("{$year}-{$month}-{$day}");
220 220
         $lunar = $this->solar2lunar($year, $month, $day, $hour);
221
-        $week = abs((int)$date->format('w')); // 0 ~ 6 修正 星期七 为 星期日
221
+        $week = abs((int) $date->format('w')); // 0 ~ 6 修正 星期七 为 星期日
222 222
 
223 223
         return array_merge(
224 224
             $lunar,
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
         if ($no < 1 || $no > 24) {
435 435
             return -1;
436 436
         }
437
-        $solarTermsOfYear = array_map('hexdec', (array)str_split($this->solarTerms[$year - 1900], 5));
437
+        $solarTermsOfYear = array_map('hexdec', (array) str_split($this->solarTerms[$year - 1900], 5));
438 438
         $positions = [
439 439
             0 => [0, 1],
440 440
             1 => [1, 2],
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
             throw new InvalidArgumentException("不支持的日期:{$year}-{$month}-{$day}");
599 599
         }
600 600
 
601
-        $offset = (int)$this->dateDiff($date, '1900-01-31')->days;
601
+        $offset = (int) $this->dateDiff($date, '1900-01-31')->days;
602 602
 
603 603
         for ($i = 1900; $i < 2101 && $offset > 0; ++$i) {
604 604
             $daysOfYear = $this->daysOfYear($i);
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
         $date = $this->makeDate("{$solar['solar_year']}-{$solar['solar_month']}-{$solar['solar_day']}");
1118 1118
         $date->modify($value.' day');
1119 1119
 
1120
-        return $this->solar2lunar((int)$date->format('Y'), (int)$date->format('m'), (int)$date->format('d'));
1120
+        return $this->solar2lunar((int) $date->format('Y'), (int) $date->format('m'), (int) $date->format('d'));
1121 1121
     }
1122 1122
 
1123 1123
     /**
Please login to merge, or discard this patch.
src/HttpRequest.php 2 patches
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -33,19 +33,19 @@  discard block
 block discarded – undo
33 33
      * @return mixed
34 34
      * @throws \Exception
35 35
      */
36
-    static public function httpPost($url, $param = array(), $httpHeaders = array(),$proxy='', $http_code = null)
36
+    static public function httpPost($url, $param = array(), $httpHeaders = array(), $proxy = '', $http_code = null)
37 37
     {
38 38
         /** 参数检测,object或者array进行http_build_query */
39
-        if(!empty($param) && is_array($param)){
39
+        if (!empty($param) && is_array($param)) {
40 40
             $flag = false;
41
-            foreach ($param as $value){
41
+            foreach ($param as $value) {
42 42
                 //判断参数是否是一个对象 或者 是一个数组
43
-                if(is_array($value) || (is_string($value) && is_object($value))){
43
+                if (is_array($value) || (is_string($value) && is_object($value))) {
44 44
                     $flag = true;
45 45
                     break;
46 46
                 }
47 47
             }
48
-            if($flag == true){
48
+            if ($flag == true) {
49 49
                 $param = http_build_query($param);
50 50
             }
51 51
         }
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
         curl_setopt($curl, CURLOPT_POSTFIELDS, $param);
63 63
 
64 64
         /** 设置请求headers */
65
-        if(empty($httpHeaders)){
65
+        if (empty($httpHeaders)) {
66 66
             $httpHeaders = array(
67 67
                 "user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36"
68 68
             );
69 69
         }
70
-        if (is_array($httpHeaders)){
70
+        if (is_array($httpHeaders)) {
71 71
             curl_setopt($curl, CURLOPT_HTTPHEADER, $httpHeaders);
72 72
         }
73 73
         /** gzip压缩 */
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
         }
82 82
 
83 83
         /** http代理 */
84
-        if(!empty($proxy)){
85
-            $proxy = explode(':',$proxy);
84
+        if (!empty($proxy)) {
85
+            $proxy = explode(':', $proxy);
86 86
             curl_setopt($curl, CURLOPT_PROXYAUTH, CURLAUTH_BASIC); //代理认证模式
87 87
             curl_setopt($curl, CURLOPT_PROXY, "$proxy[0]"); //代理服务器地址
88
-            curl_setopt($curl, CURLOPT_PROXYPORT,$proxy[1]); //代理服务器端口
88
+            curl_setopt($curl, CURLOPT_PROXYPORT, $proxy[1]); //代理服务器端口
89 89
         }
90 90
 
91 91
         /** 请求 */
@@ -95,20 +95,20 @@  discard block
 block discarded – undo
95 95
         /** 关闭请求资源 */
96 96
         curl_close($curl);
97 97
 
98
-        if($http_code != null){
98
+        if ($http_code != null) {
99 99
             /** 验证网络请求状态 */
100 100
             if (intval($info["http_code"]) === 0) {
101 101
                 throw new TinymengException(StatusCode::COMMON_TINYMENG_REQUEST_METHOD,
102
-                    '[httpPost]: POST request was aborted ! Request url :' . $url . ' , post request data : ' . var_export($param,true)
102
+                    '[httpPost]: POST request was aborted ! Request url :'.$url.' , post request data : '.var_export($param, true)
103 103
                 );
104
-            }elseif(intval($info["http_code"]) != $http_code){
104
+            }elseif (intval($info["http_code"]) != $http_code) {
105 105
                 throw new TinymengException(StatusCode::COMMON_TINYMENG_REQUEST_METHOD,
106
-                    '[httpPost]: POST request was aborted ! Request url :' . $url . ' , post request data : ' . var_export($param,true).' ,return code : '.$info["http_code"] .' ,return content : '.$content
106
+                    '[httpPost]: POST request was aborted ! Request url :'.$url.' , post request data : '.var_export($param, true).' ,return code : '.$info["http_code"].' ,return content : '.$content
107 107
                 );
108 108
             } else {
109 109
                 return $content;
110 110
             }
111
-        }else{
111
+        } else {
112 112
             return $content;
113 113
         }
114 114
     }
@@ -125,13 +125,13 @@  discard block
 block discarded – undo
125 125
      * @return mixed
126 126
      * @throws \Exception
127 127
      */
128
-    static public function httpGet($url, $param = array(), $httpHeaders = array(),$proxy= '',  $http_code = 200)
128
+    static public function httpGet($url, $param = array(), $httpHeaders = array(), $proxy = '', $http_code = 200)
129 129
     {
130 130
         $curl = curl_init();
131 131
 
132 132
         /** 设置请求参数 */
133 133
         if (!empty($param)) {
134
-            $url = $url . '?' . http_build_query($param);
134
+            $url = $url.'?'.http_build_query($param);
135 135
         }
136 136
 
137 137
         /** 设置请求链接 */
@@ -147,20 +147,20 @@  discard block
 block discarded – undo
147 147
         }
148 148
 
149 149
         /** http代理 */
150
-        if(!empty($proxy)){
151
-            $proxy = explode(':',$proxy);
150
+        if (!empty($proxy)) {
151
+            $proxy = explode(':', $proxy);
152 152
             curl_setopt($curl, CURLOPT_PROXYAUTH, CURLAUTH_BASIC); //代理认证模式
153 153
             curl_setopt($curl, CURLOPT_PROXY, "$proxy[0]"); //代理服务器地址
154
-            curl_setopt($curl, CURLOPT_PROXYPORT,$proxy[1]); //代理服务器端口
154
+            curl_setopt($curl, CURLOPT_PROXYPORT, $proxy[1]); //代理服务器端口
155 155
         }
156 156
 
157 157
         /** 设置请求headers */
158
-        if(empty($httpHeaders)){
158
+        if (empty($httpHeaders)) {
159 159
             $httpHeaders = array(
160 160
                 "user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36"
161 161
             );
162 162
         }
163
-        if (is_array($httpHeaders)){
163
+        if (is_array($httpHeaders)) {
164 164
             curl_setopt($curl, CURLOPT_HTTPHEADER, $httpHeaders);
165 165
         }
166 166
         /** gzip压缩 */
@@ -174,19 +174,19 @@  discard block
 block discarded – undo
174 174
         curl_close($curl);
175 175
 
176 176
         /** 验证网络请求状态 */
177
-        if($http_code != null){
177
+        if ($http_code != null) {
178 178
             if (intval($info["http_code"]) === 0) {
179 179
                 throw new TinymengException(StatusCode::COMMON_TINYMENG_REQUEST_METHOD,
180
-                    '[httpGet]: GET request was aborted ! Request url :' . $url
180
+                    '[httpGet]: GET request was aborted ! Request url :'.$url
181 181
                 );
182
-            }elseif(intval($info["http_code"]) != $http_code){
182
+            }elseif (intval($info["http_code"]) != $http_code) {
183 183
                 throw new TinymengException(StatusCode::COMMON_TINYMENG_REQUEST_METHOD,
184
-                    '[httpGet]: GET request was aborted ! Request url :' . $url .' ,return code : '.$info["http_code"] .' ,return content : '.$content
184
+                    '[httpGet]: GET request was aborted ! Request url :'.$url.' ,return code : '.$info["http_code"].' ,return content : '.$content
185 185
                 );
186 186
             } else {
187 187
                 return $content;
188 188
             }
189
-        }else{
189
+        } else {
190 190
             return $content;
191 191
         }
192 192
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -101,14 +101,14 @@  discard block
 block discarded – undo
101 101
                 throw new TinymengException(StatusCode::COMMON_TINYMENG_REQUEST_METHOD,
102 102
                     '[httpPost]: POST request was aborted ! Request url :' . $url . ' , post request data : ' . var_export($param,true)
103 103
                 );
104
-            }elseif(intval($info["http_code"]) != $http_code){
104
+            } elseif(intval($info["http_code"]) != $http_code){
105 105
                 throw new TinymengException(StatusCode::COMMON_TINYMENG_REQUEST_METHOD,
106 106
                     '[httpPost]: POST request was aborted ! Request url :' . $url . ' , post request data : ' . var_export($param,true).' ,return code : '.$info["http_code"] .' ,return content : '.$content
107 107
                 );
108 108
             } else {
109 109
                 return $content;
110 110
             }
111
-        }else{
111
+        } else{
112 112
             return $content;
113 113
         }
114 114
     }
@@ -179,14 +179,14 @@  discard block
 block discarded – undo
179 179
                 throw new TinymengException(StatusCode::COMMON_TINYMENG_REQUEST_METHOD,
180 180
                     '[httpGet]: GET request was aborted ! Request url :' . $url
181 181
                 );
182
-            }elseif(intval($info["http_code"]) != $http_code){
182
+            } elseif(intval($info["http_code"]) != $http_code){
183 183
                 throw new TinymengException(StatusCode::COMMON_TINYMENG_REQUEST_METHOD,
184 184
                     '[httpGet]: GET request was aborted ! Request url :' . $url .' ,return code : '.$info["http_code"] .' ,return content : '.$content
185 185
                 );
186 186
             } else {
187 187
                 return $content;
188 188
             }
189
-        }else{
189
+        } else{
190 190
             return $content;
191 191
         }
192 192
     }
Please login to merge, or discard this patch.
src/core/Singleton.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
      */
14 14
     private static $instance = null;
15 15
 
16
-    public function __construct($config=null){
16
+    public function __construct($config = null) {
17 17
         $this->config = $config;
18 18
     }
19 19
 
20
-    private function __clone(){}
20
+    private function __clone() {}
21 21
 
22 22
     public function __sleep(): array
23 23
     {
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         return [];
26 26
     }
27 27
 
28
-    protected static function init($gateway, $config=null)
28
+    protected static function init($gateway, $config = null)
29 29
     {
30 30
         if (!self::$instance instanceof static) {
31 31
             self::$instance = new static($config);
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      * @param $config
42 42
      * @return mixed
43 43
      */
44
-    public static function __callStatic($gateway, $config=null)
44
+    public static function __callStatic($gateway, $config = null)
45 45
     {
46 46
         return self::init($gateway, ...$config);
47 47
     }
Please login to merge, or discard this patch.
src/RsaTool.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 class RsaTool
11 11
 {
12 12
 
13
-    private $rsaPath = './';//公钥证书路径
13
+    private $rsaPath = './'; //公钥证书路径
14 14
 
15 15
     /**
16 16
      * Author: JiaMeng <[email protected]>
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
         // 生成私钥
63 63
         $rsa = openssl_pkey_new($config);
64 64
         openssl_pkey_export($rsa, $privKey, $this->privkeypass, $config);
65
-        file_put_contents($this->rsaPath . DIRECTORY_SEPARATOR . 'priv.key', $privKey);
65
+        file_put_contents($this->rsaPath.DIRECTORY_SEPARATOR.'priv.key', $privKey);
66 66
         // 生成公钥
67 67
         $rsaPri = openssl_pkey_get_details($rsa);
68 68
         $pubKey = $rsaPri['key'];
69
-        file_put_contents($this->rsaPath . DIRECTORY_SEPARATOR . 'pub.key', $pubKey);
69
+        file_put_contents($this->rsaPath.DIRECTORY_SEPARATOR.'pub.key', $pubKey);
70 70
     }
71 71
 
72 72
     /**
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      */
76 76
     public function setupPrivKey()
77 77
     {
78
-        $file = $this->rsaPath . DIRECTORY_SEPARATOR . 'priv.key';
78
+        $file = $this->rsaPath.DIRECTORY_SEPARATOR.'priv.key';
79 79
         $privKey = file_get_contents($file);
80 80
         $this->_privKey = openssl_pkey_get_private($privKey, $this->privkeypass);
81 81
         return true;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      */
88 88
     public function setupPubKey()
89 89
     {
90
-        $file = $this->rsaPath . DIRECTORY_SEPARATOR . 'pub.key';
90
+        $file = $this->rsaPath.DIRECTORY_SEPARATOR.'pub.key';
91 91
         $pubKey = file_get_contents($file);
92 92
         $this->_pubKey = openssl_pkey_get_public($pubKey);
93 93
         return true;
Please login to merge, or discard this patch.