@@ -86,7 +86,7 @@ |
||
86 | 86 | if (Strings::isStartsWith(trim($line), '#')) { |
87 | 87 | continue; |
88 | 88 | } |
89 | - list($name, $value) = Arrays::lists(explode('=', $line), 2, function ($row) { |
|
89 | + list($name, $value) = Arrays::lists(explode('=', $line), 2, function($row) { |
|
90 | 90 | return trim($row); |
91 | 91 | }); |
92 | 92 | $array[$name] = $value; |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | */ |
213 | 213 | public function getCallArray() |
214 | 214 | { |
215 | - C::assertTrue($this->isSuccess(), (string) I::get($this->_result, 'return_msg')); |
|
215 | + C::assertTrue($this->isSuccess(), (string)I::get($this->_result, 'return_msg')); |
|
216 | 216 | $array = []; |
217 | 217 | if ('APP' === I::get($this->_values, 'trade_type')) { |
218 | 218 | $array = [ |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | { |
245 | 245 | $xml = (new Request())->getRawBody(); |
246 | 246 | $array = Xml::toArray($xml); |
247 | - C::assertTrue('SUCCESS' === I::get($array, 'return_code') && 'SUCCESS' === I::get($array, 'result_code'), (string) I::get($array, 'return_msg')); |
|
247 | + C::assertTrue('SUCCESS' === I::get($array, 'return_code') && 'SUCCESS' === I::get($array, 'result_code'), (string)I::get($array, 'return_msg')); |
|
248 | 248 | $temp = $array; |
249 | 249 | $sign = $temp['sign']; |
250 | 250 | unset($temp['sign']); |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | */ |
480 | 480 | public function shortUrl() |
481 | 481 | { |
482 | - C::assertTrue(null !== ($longUrl = (string) I::get($this->_values, 'long_url')), '缺少 long_url 参数!'); |
|
482 | + C::assertTrue(null !== ($longUrl = (string)I::get($this->_values, 'long_url')), '缺少 long_url 参数!'); |
|
483 | 483 | $values = array_filter([ |
484 | 484 | 'appid' => $this->_appId, |
485 | 485 | 'mch_id' => $this->_mchId, |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | */ |
505 | 505 | public function getQrcodeUrl() |
506 | 506 | { |
507 | - C::assertTrue(null !== ($productId = (string) I::get($this->_values, 'product_id')), '缺少 product_id 参数!'); |
|
507 | + C::assertTrue(null !== ($productId = (string)I::get($this->_values, 'product_id')), '缺少 product_id 参数!'); |
|
508 | 508 | $values = [ |
509 | 509 | 'appid' => $this->_appId, |
510 | 510 | 'mch_id' => $this->_mchId, |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | 'charset' => 'UTF-8', |
76 | 76 | ])); |
77 | 77 | |
78 | - $this->_toArrayCall = function ($result) { |
|
79 | - return Arrays::column((array) I::get($result, 'items', []), 'item'); |
|
78 | + $this->_toArrayCall = function($result) { |
|
79 | + return Arrays::column((array)I::get($result, 'items', []), 'item'); |
|
80 | 80 | }; |
81 | 81 | |
82 | 82 | return $this; |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | 'access_token' => $this->_token, |
104 | 104 | 'charset' => 'UTF-8', |
105 | 105 | ])); |
106 | - $this->_toArrayCall = function ($result) { |
|
107 | - return Arrays::column((array) I::get($result, 'items', []), 'word'); |
|
106 | + $this->_toArrayCall = function($result) { |
|
107 | + return Arrays::column((array)I::get($result, 'items', []), 'word'); |
|
108 | 108 | }; |
109 | 109 | |
110 | 110 | return $this; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | 'access_token' => $this->_token, |
135 | 135 | 'charset' => 'UTF-8', |
136 | 136 | ])); |
137 | - $this->_toArrayCall = function ($result) { |
|
137 | + $this->_toArrayCall = function($result) { |
|
138 | 138 | return I::get($result, 'score'); |
139 | 139 | }; |
140 | 140 |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | } catch (ClientException $e) { |
158 | 158 | throw new Exception("access_token 获取失败,接口返回为:" . $e->getResponse()->getBody()->getContents()); |
159 | 159 | } |
160 | - $this->_token = (string) $this->getResult(self::RESULT_TOKEN); |
|
160 | + $this->_token = (string)$this->getResult(self::RESULT_TOKEN); |
|
161 | 161 | } |
162 | 162 | return $this; |
163 | 163 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | */ |
183 | 183 | public function getError() |
184 | 184 | { |
185 | - return (string) I::get($this->_errorMap, I::get($this->_result, 'error_code', 0), '未知错误'); |
|
185 | + return (string)I::get($this->_errorMap, I::get($this->_result, 'error_code', 0), '未知错误'); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function toArray() |
227 | 227 | { |
228 | - return (array) I::call($this->_toArrayCall, [$this->getResult()]); |
|
228 | + return (array)I::call($this->_toArrayCall, [$this->getResult()]); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | ]), [ |
77 | 77 | 'access_token' => $this->_token, |
78 | 78 | ])); |
79 | - $this->_toArrayCall = function ($result) { |
|
80 | - return Arrays::column((array) I::get($result, 'words_result', []), 'words'); |
|
79 | + $this->_toArrayCall = function($result) { |
|
80 | + return Arrays::column((array)I::get($result, 'words_result', []), 'words'); |
|
81 | 81 | }; |
82 | 82 | |
83 | 83 | return $this; |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | ]), [ |
103 | 103 | 'access_token' => $this->_token, |
104 | 104 | ])); |
105 | - $this->_toArrayCall = function ($result) { |
|
106 | - return Arrays::column((array) I::get($result, 'words_result', []), 'words'); |
|
105 | + $this->_toArrayCall = function($result) { |
|
106 | + return Arrays::column((array)I::get($result, 'words_result', []), 'words'); |
|
107 | 107 | }; |
108 | 108 | |
109 | 109 | return $this; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | ]), [ |
133 | 133 | 'access_token' => $this->_token, |
134 | 134 | ])); |
135 | - $this->_toArrayCall = function ($result) { |
|
135 | + $this->_toArrayCall = function($result) { |
|
136 | 136 | return I::get($result, 'words_result'); |
137 | 137 | }; |
138 | 138 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | ]), [ |
161 | 161 | 'access_token' => $this->_token, |
162 | 162 | ])); |
163 | - $this->_toArrayCall = function ($result) { |
|
163 | + $this->_toArrayCall = function($result) { |
|
164 | 164 | return I::get($result, 'words_result'); |
165 | 165 | }; |
166 | 166 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | ]), [ |
187 | 187 | 'access_token' => $this->_token, |
188 | 188 | ])); |
189 | - $this->_toArrayCall = function ($result) { |
|
189 | + $this->_toArrayCall = function($result) { |
|
190 | 190 | return I::get($result, 'words_result'); |
191 | 191 | }; |
192 | 192 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $this->_result = Json::decode(Http::post('https://aip.baidubce.com/rest/2.0/ocr/v1/idcard', $options, [ |
215 | 215 | 'access_token' => $this->_token, |
216 | 216 | ])); |
217 | - $this->_toArrayCall = function ($result) { |
|
217 | + $this->_toArrayCall = function($result) { |
|
218 | 218 | $return = []; |
219 | 219 | $words = I::get($result, 'words_result', []); |
220 | 220 | foreach ($words as $name => $word) { |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $this->_result = Json::decode(Http::post('https://aip.baidubce.com/rest/2.0/ocr/v1/bankcard', $options, [ |
241 | 241 | 'access_token' => $this->_token, |
242 | 242 | ])); |
243 | - $this->_toArrayCall = function ($result) { |
|
243 | + $this->_toArrayCall = function($result) { |
|
244 | 244 | return I::get($result, 'result'); |
245 | 245 | }; |
246 | 246 | return $this; |
@@ -107,7 +107,7 @@ |
||
107 | 107 | $params = array_filter($params); |
108 | 108 | foreach ($params as $key => $value) { |
109 | 109 | if ('sign' !== $key && false === Strings::isStartsWith($value, '@')) { |
110 | - $array[] = $key . '=' . Charset::convertTo($value, (string) I::get($this->_values, 'charset', 'utf-8')); |
|
110 | + $array[] = $key . '=' . Charset::convertTo($value, (string)I::get($this->_values, 'charset', 'utf-8')); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | $string = implode('&', $array); |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | */ |
328 | 328 | public function setBizContentExtendParams($key, $value) |
329 | 329 | { |
330 | - $array = (array) I::get($this->_values, 'biz_content.extend_params', []); |
|
330 | + $array = (array)I::get($this->_values, 'biz_content.extend_params', []); |
|
331 | 331 | $array[$key] = $value; |
332 | 332 | return $this->setBizContent('extend_params', $array); |
333 | 333 | } |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | */ |
478 | 478 | public function setBizContentExtUserInfo($key, $value) |
479 | 479 | { |
480 | - $array = (array) I::get($this->_values, 'biz_content.ext_user_info', []); |
|
480 | + $array = (array)I::get($this->_values, 'biz_content.ext_user_info', []); |
|
481 | 481 | $array[$key] = $value; |
482 | 482 | return $this->setBizContent('ext_user_info', $array); |
483 | 483 | } |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | if ($number % 2 == 1) { |
389 | 389 | $number += 1; |
390 | 390 | } |
391 | - return (int) $number; |
|
391 | + return (int)$number; |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | /** |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | */ |
413 | 413 | public static function fact($number) |
414 | 414 | { |
415 | - $number = (int) floor($number); |
|
415 | + $number = (int)floor($number); |
|
416 | 416 | if ($number == 0) { |
417 | 417 | return 1; |
418 | 418 | } |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | } |
441 | 441 | $result = 1; |
442 | 442 | $isEven = $number % 2 == 0; |
443 | - foreach (Arrays::rangeGenerator($isEven ? 2 : 1, (int) $number, 2) as $num) { |
|
443 | + foreach (Arrays::rangeGenerator($isEven ? 2 : 1, (int)$number, 2) as $num) { |
|
444 | 444 | $result *= $num; |
445 | 445 | } |
446 | 446 | return $result; |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | $arr = []; |
638 | 638 | for ($r = 0; $r < $row1; $r++) { |
639 | 639 | for ($c = 0; $c < $col2; $c++) { |
640 | - $arr[$r][$c] = array_sum(array_map(function ($a1, $a2) { |
|
640 | + $arr[$r][$c] = array_sum(array_map(function($a1, $a2) { |
|
641 | 641 | return $a1 * $a2; |
642 | 642 | }, $array1[$r], Arrays::column($array2, $c))); |
643 | 643 | } |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | public static function multinomial($number1) |
687 | 687 | { |
688 | 688 | $numbers = is_array($number1) ? $number1 : func_get_args(); |
689 | - return self::fact(array_sum($numbers)) / array_product(array_map(function ($num) { |
|
689 | + return self::fact(array_sum($numbers)) / array_product(array_map(function($num) { |
|
690 | 690 | return self::fact($num); |
691 | 691 | }, $numbers)); |
692 | 692 | } |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | if ($number % 2 == 0) { |
730 | 730 | $number += 1; |
731 | 731 | } |
732 | - return (int) $number; |
|
732 | + return (int)$number; |
|
733 | 733 | } |
734 | 734 | |
735 | 735 | /** |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | */ |
779 | 779 | public static function quotient($numberator, $denominator) |
780 | 780 | { |
781 | - return (int) ($numberator / $denominator); |
|
781 | + return (int)($numberator / $denominator); |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | /** |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | */ |
801 | 801 | public static function rand() |
802 | 802 | { |
803 | - return mt_rand(0, (int) self::power(10, 10)) / self::power(10, 10); |
|
803 | + return mt_rand(0, (int)self::power(10, 10)) / self::power(10, 10); |
|
804 | 804 | } |
805 | 805 | |
806 | 806 | /** |
@@ -816,11 +816,11 @@ discard block |
||
816 | 816 | */ |
817 | 817 | public static function randarray($row = 1, $col = 1, $min = 0, $max = null, $isInt = false) |
818 | 818 | { |
819 | - null === $max && $max = (int) pow(10, 10); |
|
819 | + null === $max && $max = (int)pow(10, 10); |
|
820 | 820 | $array = []; |
821 | 821 | for ($i = 0; $i < $row; $i++) { |
822 | 822 | for ($j = 0; $j < $col; $j++) { |
823 | - $array[$i][$j] = mt_rand($min, $max) + ($isInt ? 0 : mt_rand(0, (int) pow(10, 10)) / pow(10, 10)); |
|
823 | + $array[$i][$j] = mt_rand($min, $max) + ($isInt ? 0 : mt_rand(0, (int)pow(10, 10)) / pow(10, 10)); |
|
824 | 824 | } |
825 | 825 | } |
826 | 826 | return $array; |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | $k = 1; |
987 | 987 | for ($i = 0; $i < $row; $i++) { |
988 | 988 | for ($j = 0; $j < $col; $j++) { |
989 | - $array[$i][$j] = $start + ($k++ - 1) * $step; |
|
989 | + $array[$i][$j] = $start + ($k++ -1) * $step; |
|
990 | 990 | } |
991 | 991 | } |
992 | 992 | return $array; |
@@ -1123,7 +1123,7 @@ discard block |
||
1123 | 1123 | array_push($arr[$i], $array[$i]); |
1124 | 1124 | } |
1125 | 1125 | } |
1126 | - return array_sum(array_map(function ($rows) { |
|
1126 | + return array_sum(array_map(function($rows) { |
|
1127 | 1127 | return array_product($rows); |
1128 | 1128 | }, $arr)); |
1129 | 1129 | } |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | public static function sumsq($number1) |
1139 | 1139 | { |
1140 | 1140 | $numbers = is_array($number1) ? $number1 : func_get_args(); |
1141 | - return array_sum(array_map(function ($num) { |
|
1141 | + return array_sum(array_map(function($num) { |
|
1142 | 1142 | return $num * $num; |
1143 | 1143 | }, $numbers)); |
1144 | 1144 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public static function toCamel($string) |
114 | 114 | { |
115 | - return lcfirst(preg_replace_callback('/_+([a-z0-9_\x7f-\xff])/', function ($matches) { |
|
115 | + return lcfirst(preg_replace_callback('/_+([a-z0-9_\x7f-\xff])/', function($matches) { |
|
116 | 116 | return ucfirst($matches[1]); |
117 | 117 | }, strtolower($string))); |
118 | 118 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public static function isStartsWith($string, $search) |
145 | 145 | { |
146 | - return (string) $search !== "" && mb_strpos($string, $search) === 0; |
|
146 | + return (string)$search !== "" && mb_strpos($string, $search) === 0; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | public static function isEndsWith($string, $search) |
160 | 160 | { |
161 | - return (string) $search !== "" && mb_substr($string, -static::length($search)) === $search; |
|
161 | + return (string)$search !== "" && mb_substr($string, -static::length($search)) === $search; |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public static function isContains($string, $search, &$pos = null) |
176 | 176 | { |
177 | - return (string) $search !== "" && ($pos = mb_strpos($string, $search)) !== false; |
|
177 | + return (string)$search !== "" && ($pos = mb_strpos($string, $search)) !== false; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public static function split($string) |
242 | 242 | { |
243 | - return (array) preg_split('/(?<!^)(?!$)/u', $string); |
|
243 | + return (array)preg_split('/(?<!^)(?!$)/u', $string); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | */ |
296 | 296 | public static function toNumber($string) |
297 | 297 | { |
298 | - return (double) $string; |
|
298 | + return (double)$string; |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | /** |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | } elseif (false === $returnArray) { |
539 | 539 | return implode('', $result); |
540 | 540 | } else { |
541 | - return implode((string) $returnArray, $result); |
|
541 | + return implode((string)$returnArray, $result); |
|
542 | 542 | } |
543 | 543 | } |
544 | 544 | |
@@ -552,8 +552,8 @@ discard block |
||
552 | 552 | */ |
553 | 553 | public static function toPinyinFirst($text, $returnArray = false) |
554 | 554 | { |
555 | - $array = (array) self::toPinyin($text, true); |
|
556 | - $result = array_map(function ($row) { |
|
555 | + $array = (array)self::toPinyin($text, true); |
|
556 | + $result = array_map(function($row) { |
|
557 | 557 | return self::sub($row, 0, 1); |
558 | 558 | }, $array); |
559 | 559 | if (true === $returnArray) { |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | } elseif (false === $returnArray) { |
562 | 562 | return implode('', $result); |
563 | 563 | } else { |
564 | - return implode((string) $returnArray, $result); |
|
564 | + return implode((string)$returnArray, $result); |
|
565 | 565 | } |
566 | 566 | } |
567 | 567 |