@@ -57,7 +57,7 @@ |
||
57 | 57 | public static function stripTags($html, $allowTags = []) |
58 | 58 | { |
59 | 59 | $allowTags = array_map('strtolower', $allowTags); |
60 | - return preg_replace_callback('/<\/?([^>\s]+)[^>]*>/i', function ($matches) use (&$allowTags) { |
|
60 | + return preg_replace_callback('/<\/?([^>\s]+)[^>]*>/i', function($matches) use (&$allowTags) { |
|
61 | 61 | return in_array(strtolower($matches[1]), $allowTags) ? $matches[0] : ''; |
62 | 62 | }, $html); |
63 | 63 | } |
@@ -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 |
@@ -78,8 +78,8 @@ |
||
78 | 78 | } |
79 | 79 | return $mixed; |
80 | 80 | } elseif (is_string($mixed) || is_numeric($mixed)) { |
81 | - $pos = (int) $keyString; |
|
82 | - $length = null === $defaultValue ? 1 : (int) $defaultValue; |
|
81 | + $pos = (int)$keyString; |
|
82 | + $length = null === $defaultValue ? 1 : (int)$defaultValue; |
|
83 | 83 | return Strings::sub($mixed, $pos, $length); |
84 | 84 | } elseif (null === $mixed) { |
85 | 85 | return $defaultValue; |
@@ -486,6 +486,6 @@ |
||
486 | 486 | if (null === $this->_pemPublic) { |
487 | 487 | throw new Exception("请使用 setPair 提供公钥"); |
488 | 488 | } |
489 | - return (boolean) openssl_verify($data, $signature, $this->_pemPublic, $signType); |
|
489 | + return (boolean)openssl_verify($data, $signature, $this->_pemPublic, $signType); |
|
490 | 490 | } |
491 | 491 | } |
@@ -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 | /** |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | { |
51 | 51 | setlocale(LC_ALL, $locale); |
52 | 52 | clearstatcache(); |
53 | - $this->_functions['loader'] = function ($fileName) { |
|
53 | + $this->_functions['loader'] = function($fileName) { |
|
54 | 54 | $hashName = $this->__hash($fileName); |
55 | 55 | $this->_attributes[$hashName] = I::get($this->_attributes, $hashName, [ |
56 | 56 | 'isCached' => false, |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | } |
82 | 82 | } |
83 | 83 | curl_close($curl); |
84 | - } elseif ((bool) ini_get('allow_url_fopen')) { |
|
85 | - $headArray = (array) get_headers($fileName, 1); |
|
84 | + } elseif ((bool)ini_get('allow_url_fopen')) { |
|
85 | + $headArray = (array)get_headers($fileName, 1); |
|
86 | 86 | if (preg_match('/200/', $headArray[0])) { |
87 | 87 | $this->_attributes[$hashName]['isExists'] = true; |
88 | 88 | $this->_attributes[$hashName]['fileSize'] = $headArray['Content-Length']; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | private function __file($file) |
145 | 145 | { |
146 | - return (string) I::getAlias($file); |
|
146 | + return (string)I::getAlias($file); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | chmod($subFile, $mode); |
537 | 537 | } |
538 | 538 | } |
539 | - return (bool) chmod($file, $mode); |
|
539 | + return (bool)chmod($file, $mode); |
|
540 | 540 | } |
541 | 541 | |
542 | 542 | /** |
@@ -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 | } |