@@ -37,15 +37,15 @@ |
||
37 | 37 | public function __construct($mchid, $appid, $apiKey) |
38 | 38 | { |
39 | 39 | $this->_mchId = $mchid; |
40 | - if(null === $this->_mchId){ |
|
40 | + if (null === $this->_mchId) { |
|
41 | 41 | throw new Exception("缺少商户号"); |
42 | 42 | } |
43 | 43 | $this->_appId = $appid; |
44 | - if(null === $this->_appId){ |
|
44 | + if (null === $this->_appId) { |
|
45 | 45 | throw new Exception("缺少应用 ID"); |
46 | 46 | } |
47 | 47 | $this->_apiKey = $apiKey; |
48 | - if(null === $this->_apiKey){ |
|
48 | + if (null === $this->_apiKey) { |
|
49 | 49 | throw new Exception("缺少密钥"); |
50 | 50 | } |
51 | 51 | } |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | $type = $this->_type; |
336 | 336 | $this->_type = self::TYPE_RGB; |
337 | 337 | if (self::TYPE_RGB === $type) { |
338 | - $this->_color = array_map(function ($i) { |
|
338 | + $this->_color = array_map(function($i) { |
|
339 | 339 | return (0.5 + $i) | 0; |
340 | 340 | }, $this->_color); |
341 | 341 | } elseif (self::TYPE_HEX === $type) { |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | $type = $this->_type; |
387 | 387 | $this->_type = self::TYPE_CMYK; |
388 | 388 | if (self::TYPE_CMYK === $type) { |
389 | - $this->_color = array_map(function ($i) { |
|
389 | + $this->_color = array_map(function($i) { |
|
390 | 390 | return sprintf('%01.4f', $i); |
391 | 391 | }, $this->_color); |
392 | 392 | } elseif (self::TYPE_RGB === $type) { |
@@ -83,6 +83,6 @@ |
||
83 | 83 | public static function toFile($string, $file = null) |
84 | 84 | { |
85 | 85 | null === $file && $file = './Base64_toFile_' . date('YmdHis') . '.txt'; |
86 | - return (bool) file_put_contents($file, base64_decode($string)); |
|
86 | + return (bool)file_put_contents($file, base64_decode($string)); |
|
87 | 87 | } |
88 | 88 | } |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | */ |
169 | 169 | public static function toCamel($string) |
170 | 170 | { |
171 | - return lcfirst(preg_replace_callback('/_+([a-z0-9_\x7f-\xff])/', function ($matches) { |
|
171 | + return lcfirst(preg_replace_callback('/_+([a-z0-9_\x7f-\xff])/', function($matches) { |
|
172 | 172 | return ucfirst($matches[1]); |
173 | 173 | }, strtolower($string))); |
174 | 174 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public static function isStartsWith($string, $search) |
197 | 197 | { |
198 | - return (string) $search !== "" && mb_strpos($string, $search) === 0; |
|
198 | + return (string)$search !== "" && mb_strpos($string, $search) === 0; |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public static function isEndsWith($string, $search) |
210 | 210 | { |
211 | - return (string) $search !== "" && mb_substr($string, -static::length($search)) === $search; |
|
211 | + return (string)$search !== "" && mb_substr($string, -static::length($search)) === $search; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | */ |
222 | 222 | public static function isContains($string, $search, &$pos = null) |
223 | 223 | { |
224 | - return (string) $search !== "" && ($pos = mb_strpos($string, $search)) !== false; |
|
224 | + return (string)$search !== "" && ($pos = mb_strpos($string, $search)) !== false; |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | public static function toPinyinFirst($text, $returnArray = false) |
521 | 521 | { |
522 | 522 | $array = self::toPinyin($text, true); |
523 | - $result = array_map(function ($row) { |
|
523 | + $result = array_map(function($row) { |
|
524 | 524 | return self::sub($row, 0, 1); |
525 | 525 | }, $array); |
526 | 526 | return true === $returnArray ? $result : implode('', $result); |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | $promise = $client->requestAsync('GET', $url, [ |
54 | 54 | 'query' => $get, |
55 | 55 | ]); |
56 | - $promise->then(function (ResponseInterface $res) use ($success) { |
|
56 | + $promise->then(function(ResponseInterface $res) use ($success) { |
|
57 | 57 | $success && $success($res->getBody()->getContents(), $res); |
58 | - }, function (RequestException $err) use ($error) { |
|
58 | + }, function(RequestException $err) use ($error) { |
|
59 | 59 | $error && $error($err); |
60 | 60 | }); |
61 | 61 | } |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | 'query' => $get, |
100 | 100 | 'form_params' => $post, |
101 | 101 | ]); |
102 | - $promise->then(function (ResponseInterface $res) use ($success) { |
|
102 | + $promise->then(function(ResponseInterface $res) use ($success) { |
|
103 | 103 | $success && $success($res->getBody()->getContents(), $res); |
104 | - }, function (RequestException $err) use ($error) { |
|
104 | + }, function(RequestException $err) use ($error) { |
|
105 | 105 | $error && $error($err); |
106 | 106 | }); |
107 | 107 | } |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | 'query' => $get, |
146 | 146 | 'body' => $body, |
147 | 147 | ]); |
148 | - $promise->then(function (ResponseInterface $res) use ($success) { |
|
148 | + $promise->then(function(ResponseInterface $res) use ($success) { |
|
149 | 149 | $success && $success($res->getBody()->getContents(), $res); |
150 | - }, function (RequestException $err) use ($error) { |
|
150 | + }, function(RequestException $err) use ($error) { |
|
151 | 151 | $error && $error($err); |
152 | 152 | }); |
153 | 153 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public static function ul($array) |
141 | 141 | { |
142 | - return implode(PHP_EOL, array_map(function ($row) { |
|
142 | + return implode(PHP_EOL, array_map(function($row) { |
|
143 | 143 | return '- ' . self::__text($row); |
144 | 144 | }, $array)); |
145 | 145 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public static function ol($array) |
157 | 157 | { |
158 | - return implode(PHP_EOL, array_map(function ($row) { |
|
158 | + return implode(PHP_EOL, array_map(function($row) { |
|
159 | 159 | static $i = 1; |
160 | 160 | return ($i++) . '. ' . self::__text($row); |
161 | 161 | }, $array)); |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | $title = array_shift($array); |
211 | 211 | $rows = $array; |
212 | 212 | } |
213 | - $lineFunc = function ($arr) { |
|
214 | - return '|' . implode('|', array_map(function ($line) { |
|
213 | + $lineFunc = function($arr) { |
|
214 | + return '|' . implode('|', array_map(function($line) { |
|
215 | 215 | return ' ' . self::__text($line) . ' '; |
216 | 216 | }, $arr)) . '|'; |
217 | 217 | }; |
@@ -91,7 +91,7 @@ |
||
91 | 91 | if (false === static::isJson($json)) { |
92 | 92 | $json = '[]'; |
93 | 93 | } |
94 | - echo $json;die; |
|
94 | + echo $json; die; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -116,7 +116,7 @@ |
||
116 | 116 | */ |
117 | 117 | public static function create() |
118 | 118 | { |
119 | - if (!static::$_instance instanceof static ) { |
|
119 | + if (!static::$_instance instanceof static) { |
|
120 | 120 | static::$_instance = new static(); |
121 | 121 | } |
122 | 122 |
@@ -50,7 +50,7 @@ |
||
50 | 50 | $sizeMap = [ |
51 | 51 | '' => 0, |
52 | 52 | 'b' => 0, // 为了简化正则 |
53 | - 'k' => 1, |
|
53 | + 'k' => 1, |
|
54 | 54 | 'm' => 2, |
55 | 55 | 'g' => 3, |
56 | 56 | 't' => 4, |
@@ -46,7 +46,7 @@ |
||
46 | 46 | */ |
47 | 47 | public static function size($sizeValue) |
48 | 48 | { |
49 | - $callback = function ($matches) { |
|
49 | + $callback = function($matches) { |
|
50 | 50 | $sizeMap = [ |
51 | 51 | '' => 0, |
52 | 52 | 'b' => 0, // 为了简化正则 |