@@ -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 | /** |
@@ -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 | } |
@@ -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, // 为了简化正则 |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | ]), [ |
| 56 | 56 | 'access_token' => $this->_token, |
| 57 | 57 | ])); |
| 58 | - $this->_toArrayCall = function ($result) { |
|
| 58 | + $this->_toArrayCall = function($result) { |
|
| 59 | 59 | return I::get($result, 'image'); |
| 60 | 60 | }; |
| 61 | 61 | |
@@ -84,8 +84,8 @@ |
||
| 84 | 84 | } |
| 85 | 85 | return $mixed; |
| 86 | 86 | } elseif (is_string($mixed) || is_numeric($mixed)) { // 字符串或数字 |
| 87 | - $pos = (int) $keyString; |
|
| 88 | - $length = null === $defaultValue ? 1 : (int) $defaultValue; |
|
| 87 | + $pos = (int)$keyString; |
|
| 88 | + $length = null === $defaultValue ? 1 : (int)$defaultValue; |
|
| 89 | 89 | return Strings::sub($mixed, $pos, $length); |
| 90 | 90 | } elseif (null === $mixed) { // null |
| 91 | 91 | return $defaultValue; |
@@ -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 | /** |
@@ -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 | /** |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | $salt = sprintf('$2y$%02d$', $cost); |
| 352 | 352 | $salt .= str_replace('+', '.', substr(base64_encode(self::random(20)), 0, 22)); |
| 353 | 353 | $hash = crypt($password, $salt); |
| 354 | - C::assertNotTrue(!is_string($hash) || strlen($hash) !== 60 , '未知错误'); |
|
| 354 | + C::assertNotTrue(!is_string($hash) || strlen($hash) !== 60, '未知错误'); |
|
| 355 | 355 | return $hash; |
| 356 | 356 | } |
| 357 | 357 | |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | */ |
| 466 | 466 | public static function looksLike($string1, $string2, $array = ['0oO', 'yv', 'ij', '1lI']) |
| 467 | 467 | { |
| 468 | - if(self::length($string1) !== self::length($string2)){ |
|
| 468 | + if (self::length($string1) !== self::length($string2)) { |
|
| 469 | 469 | return false; |
| 470 | 470 | } |
| 471 | 471 | $array1 = self::split($string1); |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | } elseif (false === $returnArray) { |
| 536 | 536 | return implode('', $result); |
| 537 | 537 | } else { |
| 538 | - return implode((string) $returnArray, $result); |
|
| 538 | + return implode((string)$returnArray, $result); |
|
| 539 | 539 | } |
| 540 | 540 | } |
| 541 | 541 | |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | public static function toPinyinFirst($text, $returnArray = false) |
| 551 | 551 | { |
| 552 | 552 | $array = self::toPinyin($text, true); |
| 553 | - $result = array_map(function ($row) { |
|
| 553 | + $result = array_map(function($row) { |
|
| 554 | 554 | return self::sub($row, 0, 1); |
| 555 | 555 | }, $array); |
| 556 | 556 | if (true === $returnArray) { |
@@ -558,7 +558,7 @@ discard block |
||
| 558 | 558 | } elseif (false === $returnArray) { |
| 559 | 559 | return implode('', $result); |
| 560 | 560 | } else { |
| 561 | - return implode((string) $returnArray, $result); |
|
| 561 | + return implode((string)$returnArray, $result); |
|
| 562 | 562 | } |
| 563 | 563 | } |
| 564 | 564 | |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | return $string; |
| 584 | 584 | } |
| 585 | 585 | if (3 === Arrays::count($modeArray)) { |
| 586 | - C::assertTrue('?' === $modeArray[1] , '模式错误,三段时,? 符必须在中间,例如:3?4'); |
|
| 586 | + C::assertTrue('?' === $modeArray[1], '模式错误,三段时,? 符必须在中间,例如:3?4'); |
|
| 587 | 587 | return self::sub($string, 0, $modeArray[0]) . $hideChar . self::sub($string, $length - $modeArray[2], $modeArray[2]); |
| 588 | 588 | } elseif (2 === $modeCount) { |
| 589 | 589 | if ('?' === $modeArray[0]) { |
@@ -480,6 +480,6 @@ |
||
| 480 | 480 | public function isVerify($data, $signature, $signType = OPENSSL_ALGO_SHA256) |
| 481 | 481 | { |
| 482 | 482 | C::assertNotTrue(null === $this->_pemPublic, '请使用 setPair 提供公钥'); |
| 483 | - return (boolean) openssl_verify($data, $signature, $this->_pemPublic, $signType); |
|
| 483 | + return (boolean)openssl_verify($data, $signature, $this->_pemPublic, $signType); |
|
| 484 | 484 | } |
| 485 | 485 | } |