@@ -50,7 +50,7 @@ |
||
50 | 50 | { |
51 | 51 | $delta = 0.0; |
52 | 52 | if (isset(static::$_timers[$name])) { |
53 | - $delta = microtime(true)-static::$_timers[$name]; |
|
53 | + $delta = microtime(true) - static::$_timers[$name]; |
|
54 | 54 | unset(static::$_timers[$name]); |
55 | 55 | } |
56 | 56 |
@@ -201,7 +201,7 @@ |
||
201 | 201 | @ftp_chmod($this->_conn, $mode, $subFile); |
202 | 202 | } |
203 | 203 | } |
204 | - return (boolean) @ftp_chmod($this->_conn, $mode, $file); |
|
204 | + return (boolean)@ftp_chmod($this->_conn, $mode, $file); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -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 | } |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | $arr = []; |
639 | 639 | for ($r = 0; $r < $row1; $r++) { |
640 | 640 | for ($c = 0; $c < $col2; $c++) { |
641 | - $arr[$r][$c] = array_sum(array_map(function ($a1, $a2) { |
|
641 | + $arr[$r][$c] = array_sum(array_map(function($a1, $a2) { |
|
642 | 642 | return $a1 * $a2; |
643 | 643 | }, $array1[$r], Arrays::column($array2, $c))); |
644 | 644 | } |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | public static function multinomial($number1) |
688 | 688 | { |
689 | 689 | $numbers = is_array($number1) ? $number1 : func_get_args(); |
690 | - return self::fact(array_sum($numbers)) / array_product(array_map(function ($num) { |
|
690 | + return self::fact(array_sum($numbers)) / array_product(array_map(function($num) { |
|
691 | 691 | return self::fact($num); |
692 | 692 | }, $numbers)); |
693 | 693 | } |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | if ($number % 2 == 0) { |
731 | 731 | $number += 1; |
732 | 732 | } |
733 | - return (int) $number; |
|
733 | + return (int)$number; |
|
734 | 734 | } |
735 | 735 | |
736 | 736 | /** |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | */ |
780 | 780 | public static function quotient($numberator, $denominator) |
781 | 781 | { |
782 | - return (int) ($numberator / $denominator); |
|
782 | + return (int)($numberator / $denominator); |
|
783 | 783 | } |
784 | 784 | |
785 | 785 | /** |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | */ |
802 | 802 | public static function rand() |
803 | 803 | { |
804 | - return mt_rand(0, (int) self::power(10, 10)) / self::power(10, 10); |
|
804 | + return mt_rand(0, (int)self::power(10, 10)) / self::power(10, 10); |
|
805 | 805 | } |
806 | 806 | |
807 | 807 | /** |
@@ -817,11 +817,11 @@ discard block |
||
817 | 817 | */ |
818 | 818 | public static function randarray($row = 1, $col = 1, $min = 0, $max = null, $isInt = false) |
819 | 819 | { |
820 | - null === $max && $max = (int) pow(10, 10); |
|
820 | + null === $max && $max = (int)pow(10, 10); |
|
821 | 821 | $array = []; |
822 | 822 | for ($i = 0; $i < $row; $i++) { |
823 | 823 | for ($j = 0; $j < $col; $j++) { |
824 | - $array[$i][$j] = mt_rand($min, $max) + ($isInt ? 0 : mt_rand(0, (int) pow(10, 10)) / pow(10, 10)); |
|
824 | + $array[$i][$j] = mt_rand($min, $max) + ($isInt ? 0 : mt_rand(0, (int)pow(10, 10)) / pow(10, 10)); |
|
825 | 825 | } |
826 | 826 | } |
827 | 827 | return $array; |
@@ -987,7 +987,7 @@ discard block |
||
987 | 987 | $k = 1; |
988 | 988 | for ($i = 0; $i < $row; $i++) { |
989 | 989 | for ($j = 0; $j < $col; $j++) { |
990 | - $array[$i][$j] = $start + ($k++ - 1) * $step; |
|
990 | + $array[$i][$j] = $start + ($k++ -1) * $step; |
|
991 | 991 | } |
992 | 992 | } |
993 | 993 | return $array; |
@@ -1124,7 +1124,7 @@ discard block |
||
1124 | 1124 | array_push($arr[$i], $array[$i]); |
1125 | 1125 | } |
1126 | 1126 | } |
1127 | - return array_sum(array_map(function ($rows) { |
|
1127 | + return array_sum(array_map(function($rows) { |
|
1128 | 1128 | return array_product($rows); |
1129 | 1129 | }, $arr)); |
1130 | 1130 | } |
@@ -1139,7 +1139,7 @@ discard block |
||
1139 | 1139 | public static function sumsq($number1) |
1140 | 1140 | { |
1141 | 1141 | $numbers = is_array($number1) ? $number1 : func_get_args(); |
1142 | - return array_sum(array_map(function ($num) { |
|
1142 | + return array_sum(array_map(function($num) { |
|
1143 | 1143 | return $num * $num; |
1144 | 1144 | }, $numbers)); |
1145 | 1145 | } |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | */ |
498 | 498 | public function getServerName() |
499 | 499 | { |
500 | - return (string) I::get($_SERVER, 'SERVER_NAME'); |
|
500 | + return (string)I::get($_SERVER, 'SERVER_NAME'); |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | /** |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | */ |
508 | 508 | public function getServerPort() |
509 | 509 | { |
510 | - return (int) I::get($_SERVER, 'SERVER_PORT'); |
|
510 | + return (int)I::get($_SERVER, 'SERVER_PORT'); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | /** |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | */ |
563 | 563 | public function getRemoteIP() |
564 | 564 | { |
565 | - return (string) I::get($_SERVER, 'REMOTE_ADDR'); |
|
565 | + return (string)I::get($_SERVER, 'REMOTE_ADDR'); |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | /** |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | */ |
573 | 573 | public function getRemoteHost() |
574 | 574 | { |
575 | - return (string) I::get($_SERVER, 'REMOTE_HOST'); |
|
575 | + return (string)I::get($_SERVER, 'REMOTE_HOST'); |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | /** |
@@ -57,7 +57,7 @@ |
||
57 | 57 | public function __construct($pathRoot = null) |
58 | 58 | { |
59 | 59 | if (null === $pathRoot) { |
60 | - $this->_pathRoot = (string) I::getAlias('@icy2003/php_runtime/cache'); |
|
60 | + $this->_pathRoot = (string)I::getAlias('@icy2003/php_runtime/cache'); |
|
61 | 61 | } else { |
62 | 62 | $this->_pathRoot = $pathRoot; |
63 | 63 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | ]), [ |
103 | 103 | 'access_token' => $this->_token, |
104 | 104 | ])); |
105 | - $this->_toArrayCall = function ($result) { |
|
105 | + $this->_toArrayCall = function($result) { |
|
106 | 106 | return Arrays::column(I::get($result, 'words_result'), 'words'); |
107 | 107 | }; |
108 | 108 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | ]), [ |
129 | 129 | 'access_token' => $this->_token, |
130 | 130 | ])); |
131 | - $this->_toArrayCall = function ($result) { |
|
131 | + $this->_toArrayCall = function($result) { |
|
132 | 132 | return Arrays::column(I::get($result, 'words_result'), 'words'); |
133 | 133 | }; |
134 | 134 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | ]), [ |
159 | 159 | 'access_token' => $this->_token, |
160 | 160 | ])); |
161 | - $this->_toArrayCall = function ($result) { |
|
161 | + $this->_toArrayCall = function($result) { |
|
162 | 162 | return I::get($result, 'words_result'); |
163 | 163 | }; |
164 | 164 | |
@@ -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 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | ]), [ |
213 | 213 | 'access_token' => $this->_token, |
214 | 214 | ])); |
215 | - $this->_toArrayCall = function ($result) { |
|
215 | + $this->_toArrayCall = function($result) { |
|
216 | 216 | return I::get($result, 'words_result'); |
217 | 217 | }; |
218 | 218 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $this->_result = Json::decode(Http::post('https://aip.baidubce.com/rest/2.0/ocr/v1/idcard', $options, [ |
241 | 241 | 'access_token' => $this->_token, |
242 | 242 | ])); |
243 | - $this->_toArrayCall = function ($result) { |
|
243 | + $this->_toArrayCall = function($result) { |
|
244 | 244 | $return = []; |
245 | 245 | $words = I::get($result, 'words_result', []); |
246 | 246 | foreach ($words as $name => $word) { |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $this->_result = Json::decode(Http::post('https://aip.baidubce.com/rest/2.0/ocr/v1/bankcard', $options, [ |
267 | 267 | 'access_token' => $this->_token, |
268 | 268 | ])); |
269 | - $this->_toArrayCall = function ($result) { |
|
269 | + $this->_toArrayCall = function($result) { |
|
270 | 270 | return I::get($result, 'result'); |
271 | 271 | }; |
272 | 272 | return $this; |
@@ -38,10 +38,10 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function dayRange($offset = 0) |
40 | 40 | { |
41 | - $day = (int) (date('d') + $offset); |
|
41 | + $day = (int)(date('d') + $offset); |
|
42 | 42 | return [ |
43 | - mktime(0, 0, 0, (int) date('m'), $day, (int) date('Y')), |
|
44 | - mktime(23, 59, 59, (int) date('m'), $day, (int) date('Y')), |
|
43 | + mktime(0, 0, 0, (int)date('m'), $day, (int)date('Y')), |
|
44 | + mktime(23, 59, 59, (int)date('m'), $day, (int)date('Y')), |
|
45 | 45 | ]; |
46 | 46 | } |
47 | 47 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | public function weekRange($offset = 0) |
58 | 58 | { |
59 | 59 | $timestamp = time(); |
60 | - $offset = (int) $offset; |
|
60 | + $offset = (int)$offset; |
|
61 | 61 | return [ |
62 | 62 | strtotime(date('Y-m-d', strtotime('Sunday ' . ($offset - 1) . ' week', $timestamp))), |
63 | 63 | strtotime(date('Y-m-d', strtotime('Saturday ' . $offset . ' week', $timestamp))) + 24 * 3600 - 1, |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function monthRange($offset = 0) |
75 | 75 | { |
76 | - $month = (int) (date('m') + $offset); |
|
77 | - $begin = mktime(0, 0, 0, $month, 1, (int) date('Y')); |
|
78 | - $end = mktime(23, 59, 59, $month, (int) date('t', $begin), (int) date('Y')); |
|
76 | + $month = (int)(date('m') + $offset); |
|
77 | + $begin = mktime(0, 0, 0, $month, 1, (int)date('Y')); |
|
78 | + $end = mktime(23, 59, 59, $month, (int)date('t', $begin), (int)date('Y')); |
|
79 | 79 | |
80 | 80 | return [$begin, $end]; |
81 | 81 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function yearRange($offset = 0) |
91 | 91 | { |
92 | - $year = (int) (date('Y') + $offset); |
|
92 | + $year = (int)(date('Y') + $offset); |
|
93 | 93 | return [ |
94 | 94 | mktime(0, 0, 0, 1, 1, $year), |
95 | 95 | mktime(23, 59, 59, 12, 31, $year), |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | public function day($offset = 0, $time = null) |
108 | 108 | { |
109 | 109 | $timestamp = null === $time ? time() : $time; |
110 | - $offset = (int) $offset; |
|
110 | + $offset = (int)$offset; |
|
111 | 111 | return $timestamp + 3600 * 24 * $offset; |
112 | 112 | } |
113 | 113 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | public function week($offset = 0, $time = null) |
123 | 123 | { |
124 | 124 | $timestamp = null === $time ? time() : $time; |
125 | - $offset = (int) $offset; |
|
125 | + $offset = (int)$offset; |
|
126 | 126 | return $timestamp + 3600 * 24 * 7 * $offset; |
127 | 127 | } |
128 | 128 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | public function month($offset = 0, $time = null) |
138 | 138 | { |
139 | 139 | $timestamp = null === $time ? time() : $time; |
140 | - $offset = (int) $offset; |
|
140 | + $offset = (int)$offset; |
|
141 | 141 | return $timestamp + 3600 * 24 * date('t', $timestamp) * $offset; |
142 | 142 | } |
143 | 143 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | public function year($offset = 0, $time = null) |
153 | 153 | { |
154 | 154 | $timestamp = null === $time ? time() : $time; |
155 | - $offset = (int) $offset; |
|
155 | + $offset = (int)$offset; |
|
156 | 156 | return $timestamp + 3600 * 24 * (date('z', mktime(0, 0, 0, 12, 31, date('Y', $timestamp))) + 1) * $offset; |
157 | 157 | } |
158 | 158 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | public function isLeapYear($time = null) |
193 | 193 | { |
194 | 194 | $timestamp = null === $time ? time() : $time; |
195 | - return (bool) date('L', $timestamp); |
|
195 | + return (bool)date('L', $timestamp); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -207,6 +207,6 @@ discard block |
||
207 | 207 | public function yearPosition($time = null) |
208 | 208 | { |
209 | 209 | $timestamp = null === $time ? time() : $time; |
210 | - return (int) date('z', $timestamp) + 1; |
|
210 | + return (int)date('z', $timestamp) + 1; |
|
211 | 211 | } |
212 | 212 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | public static function combine($keys, $values) |
155 | 155 | { |
156 | 156 | if (count($keys) == count($values)) { |
157 | - return (array) array_combine($keys, $values); |
|
157 | + return (array)array_combine($keys, $values); |
|
158 | 158 | } |
159 | 159 | $array = []; |
160 | 160 | foreach ($keys as $index => $key) { |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | } else { |
472 | 472 | $function = $callback; |
473 | 473 | if (false === is_callable($callback)) { |
474 | - $function = function ($row) use ($callback, $isStrict) { |
|
474 | + $function = function($row) use ($callback, $isStrict) { |
|
475 | 475 | return true === $isStrict ? $row === $callback : $row == $callback; |
476 | 476 | }; |
477 | 477 | } |
@@ -76,7 +76,7 @@ |
||
76 | 76 | */ |
77 | 77 | public static function toBytes($size) |
78 | 78 | { |
79 | - $callback = function ($matches) { |
|
79 | + $callback = function($matches) { |
|
80 | 80 | $sizeMap = [ |
81 | 81 | '' => 0, |
82 | 82 | 'b' => 0, // 为了简化正则 |