@@ -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 | |
@@ -44,13 +44,13 @@ |
||
| 44 | 44 | C::assertFunction('ssh2_connect', '请开启 ssh2 扩展'); |
| 45 | 45 | C::assertTrue(Arrays::keyExistsAll(['host', 'username', 'password'], $config, $diff), '缺少 ' . implode(',', $diff) . ' 参数'); |
| 46 | 46 | $this->_conn = ssh2_connect( |
| 47 | - (string) I::get($config, 'host'), |
|
| 48 | - (int) I::get($config, 'port', 22), |
|
| 49 | - (array) I::get($config, 'methods', []), |
|
| 50 | - (array) I::get($config, 'callback', []) |
|
| 47 | + (string)I::get($config, 'host'), |
|
| 48 | + (int)I::get($config, 'port', 22), |
|
| 49 | + (array)I::get($config, 'methods', []), |
|
| 50 | + (array)I::get($config, 'callback', []) |
|
| 51 | 51 | ); |
| 52 | 52 | C::assertNotFalse($this->_conn, '连接失败'); |
| 53 | - C::assertNotFalse(ssh2_auth_password($this->_conn, (string) I::get($config, 'username'), (string) I::get($config, 'password')), '账号密码错误'); |
|
| 53 | + C::assertNotFalse(ssh2_auth_password($this->_conn, (string)I::get($config, 'username'), (string)I::get($config, 'password')), '账号密码错误'); |
|
| 54 | 54 | $this->_sftp = ssh2_sftp($this->_conn); |
| 55 | 55 | C::assertNotFalse($this->_sftp, '初始化 sftp 失败'); |
| 56 | 56 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | public function isAjax() |
| 188 | 188 | { |
| 189 | - return 'XMLHttpRequest' === Arrays::first((array) I::get($this->getHeaders(), 'x-requested-with', [])); |
|
| 189 | + return 'XMLHttpRequest' === Arrays::first((array)I::get($this->getHeaders(), 'x-requested-with', [])); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /** |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | $secure = $this->isSecureConnection(); |
| 382 | 382 | $http = $secure ? 'https' : 'http'; |
| 383 | 383 | if (I::get($this->getHeaders(), 'x-forwarded-host')) { |
| 384 | - $this->__hostInfo = $http . '://' . trim((string) Arrays::first(explode(',', (string) Arrays::first((array) I::get($this->getHeaders(), 'x-forward-host', []))))); |
|
| 384 | + $this->__hostInfo = $http . '://' . trim((string)Arrays::first(explode(',', (string)Arrays::first((array)I::get($this->getHeaders(), 'x-forward-host', []))))); |
|
| 385 | 385 | } elseif (I::get($this->getHeaders(), 'host')) { |
| 386 | 386 | $this->__hostInfo = $http . '://' . Arrays::first(I::get($this->getHeaders(), 'host')); |
| 387 | 387 | } elseif (isset($_SERVER['SERVER_NAME'])) { |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | */ |
| 465 | 465 | public function getQueryString() |
| 466 | 466 | { |
| 467 | - return (string) I::get($_SERVER, 'QUERY_STRING', ''); |
|
| 467 | + return (string)I::get($_SERVER, 'QUERY_STRING', ''); |
|
| 468 | 468 | } |
| 469 | 469 | |
| 470 | 470 | /** |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | return true; |
| 479 | 479 | } |
| 480 | 480 | foreach ($this->__secureProtocolHeaders as $header => $values) { |
| 481 | - if (($headerValue = (string) I::get($this->getHeaders(), $header)) !== null) { |
|
| 481 | + if (($headerValue = (string)I::get($this->getHeaders(), $header)) !== null) { |
|
| 482 | 482 | foreach ($values as $value) { |
| 483 | 483 | if (strcasecmp($headerValue, $value) === 0) { |
| 484 | 484 | return true; |
@@ -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 | /** |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | $promise = $client->requestAsync('GET', $url, [ |
| 56 | 56 | 'query' => $get, |
| 57 | 57 | ]); |
| 58 | - $promise->then(function (ResponseInterface $res) use ($success) { |
|
| 58 | + $promise->then(function(ResponseInterface $res) use ($success) { |
|
| 59 | 59 | $success && $success($res->getBody()->getContents(), $res); |
| 60 | - }, function (RequestException $err) use ($error) { |
|
| 60 | + }, function(RequestException $err) use ($error) { |
|
| 61 | 61 | $error && $error($err); |
| 62 | 62 | }); |
| 63 | 63 | } |
@@ -101,9 +101,9 @@ discard block |
||
| 101 | 101 | 'query' => $get, |
| 102 | 102 | 'form_params' => $post, |
| 103 | 103 | ]); |
| 104 | - $promise->then(function (ResponseInterface $res) use ($success) { |
|
| 104 | + $promise->then(function(ResponseInterface $res) use ($success) { |
|
| 105 | 105 | $success && $success($res->getBody()->getContents(), $res); |
| 106 | - }, function (RequestException $err) use ($error) { |
|
| 106 | + }, function(RequestException $err) use ($error) { |
|
| 107 | 107 | $error && $error($err); |
| 108 | 108 | }); |
| 109 | 109 | } |
@@ -147,9 +147,9 @@ discard block |
||
| 147 | 147 | 'query' => $get, |
| 148 | 148 | 'body' => $body, |
| 149 | 149 | ]); |
| 150 | - $promise->then(function (ResponseInterface $res) use ($success) { |
|
| 150 | + $promise->then(function(ResponseInterface $res) use ($success) { |
|
| 151 | 151 | $success && $success($res->getBody()->getContents(), $res); |
| 152 | - }, function (RequestException $err) use ($error) { |
|
| 152 | + }, function(RequestException $err) use ($error) { |
|
| 153 | 153 | $error && $error($err); |
| 154 | 154 | }); |
| 155 | 155 | } |
@@ -168,12 +168,12 @@ discard block |
||
| 168 | 168 | public function download($file) |
| 169 | 169 | { |
| 170 | 170 | list($from, $to) = (new LocalFile())->fileMap($file); |
| 171 | - try{ |
|
| 171 | + try { |
|
| 172 | 172 | (new Http())->get($from, [], [ |
| 173 | 173 | 'save_to' => I::getAlias($to), |
| 174 | 174 | ]); |
| 175 | 175 | return true; |
| 176 | - }catch(RequestException $e){ |
|
| 176 | + } catch (RequestException $e) { |
|
| 177 | 177 | return false; |
| 178 | 178 | } |
| 179 | 179 | } |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | public function dayRange($offset = 0, $time = null) |
| 39 | 39 | { |
| 40 | 40 | null === $time && $time = time(); |
| 41 | - $y = (int) (date('Y', $time)); |
|
| 42 | - $m = (int) (date('m', $time)); |
|
| 43 | - $d = (int) (date('d', $time) + $offset); |
|
| 41 | + $y = (int)(date('Y', $time)); |
|
| 42 | + $m = (int)(date('m', $time)); |
|
| 43 | + $d = (int)(date('d', $time) + $offset); |
|
| 44 | 44 | return [ |
| 45 | 45 | mktime(0, 0, 0, $m, $d, $y), |
| 46 | 46 | mktime(23, 59, 59, $m, $d, $y), |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | public function weekRange($offset = 0, $time = null) |
| 61 | 61 | { |
| 62 | 62 | null === $time && $time = time(); |
| 63 | - $offset = (int) $offset; |
|
| 63 | + $offset = (int)$offset; |
|
| 64 | 64 | return [ |
| 65 | 65 | strtotime(date('Y-m-d', strtotime('Sunday ' . ($offset - 1) . ' week', $time))), |
| 66 | 66 | strtotime(date('Y-m-d', strtotime('Saturday ' . $offset . ' week', $time))) + 24 * 3600 - 1, |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | public function monthRange($offset = 0, $time = null) |
| 79 | 79 | { |
| 80 | 80 | null === $time && $time = time(); |
| 81 | - $y = (int) (date('Y', $time)); |
|
| 82 | - $m = (int) (date('m', $time) + $offset); |
|
| 81 | + $y = (int)(date('Y', $time)); |
|
| 82 | + $m = (int)(date('m', $time) + $offset); |
|
| 83 | 83 | $begin = mktime(0, 0, 0, $m, 1, $y); |
| 84 | - $end = mktime(23, 59, 59, $m, (int) date('t', $begin), $y); |
|
| 84 | + $end = mktime(23, 59, 59, $m, (int)date('t', $begin), $y); |
|
| 85 | 85 | |
| 86 | 86 | return [$begin, $end]; |
| 87 | 87 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | public function yearRange($offset = 0, $time = null) |
| 98 | 98 | { |
| 99 | 99 | null === $time && $time = time(); |
| 100 | - $year = (int) (date('Y', $time) + $offset); |
|
| 100 | + $year = (int)(date('Y', $time) + $offset); |
|
| 101 | 101 | return [ |
| 102 | 102 | mktime(0, 0, 0, 1, 1, $year), |
| 103 | 103 | mktime(23, 59, 59, 12, 31, $year), |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | public function day($offset = 0, $time = null) |
| 116 | 116 | { |
| 117 | 117 | null === $time && $time = time(); |
| 118 | - $offset = (int) $offset; |
|
| 118 | + $offset = (int)$offset; |
|
| 119 | 119 | return $time + 3600 * 24 * $offset; |
| 120 | 120 | } |
| 121 | 121 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | public function week($offset = 0, $time = null) |
| 131 | 131 | { |
| 132 | 132 | null === $time && $time = time(); |
| 133 | - $offset = (int) $offset; |
|
| 133 | + $offset = (int)$offset; |
|
| 134 | 134 | return $time + 3600 * 24 * 7 * $offset; |
| 135 | 135 | } |
| 136 | 136 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | public function month($offset = 0, $time = null) |
| 146 | 146 | { |
| 147 | 147 | null === $time && $time = time(); |
| 148 | - $offset = (int) $offset; |
|
| 148 | + $offset = (int)$offset; |
|
| 149 | 149 | return $time + 3600 * 24 * date('t', $time) * $offset; |
| 150 | 150 | } |
| 151 | 151 | |
@@ -160,8 +160,8 @@ discard block |
||
| 160 | 160 | public function year($offset = 0, $time = null) |
| 161 | 161 | { |
| 162 | 162 | null === $time && $time = time(); |
| 163 | - $offset = (int) $offset; |
|
| 164 | - return mktime((int) date('H', $time), (int) date('i', $time), (int) date('s', $time), (int) date('m', $time), (int) date('d', $time), (int) date('Y', $time) + $offset); |
|
| 163 | + $offset = (int)$offset; |
|
| 164 | + return mktime((int)date('H', $time), (int)date('i', $time), (int)date('s', $time), (int)date('m', $time), (int)date('d', $time), (int)date('Y', $time) + $offset); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | public function isLeapYear($time = null) |
| 201 | 201 | { |
| 202 | 202 | null === $time && $time = time(); |
| 203 | - return (bool) date('L', $time); |
|
| 203 | + return (bool)date('L', $time); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /** |
@@ -215,6 +215,6 @@ discard block |
||
| 215 | 215 | public function yearPosition($time = null) |
| 216 | 216 | { |
| 217 | 217 | null === $time && $time = time(); |
| 218 | - return (int) date('z', $time) + 1; |
|
| 218 | + return (int)date('z', $time) + 1; |
|
| 219 | 219 | } |
| 220 | 220 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public static function stdin() |
| 152 | 152 | { |
| 153 | - return rtrim((string) fgets(\STDIN), PHP_EOL); |
|
| 153 | + return rtrim((string)fgets(\STDIN), PHP_EOL); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | /** |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | $input = self::stdin(); |
| 183 | 183 | if ('' === $input) { |
| 184 | - return (string) $defaultValue; |
|
| 184 | + return (string)$defaultValue; |
|
| 185 | 185 | } |
| 186 | 186 | return $input; |
| 187 | 187 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | */ |
| 211 | 211 | public static function outputList($array) |
| 212 | 212 | { |
| 213 | - foreach($array as $string){ |
|
| 213 | + foreach ($array as $string) { |
|
| 214 | 214 | self::output($string); |
| 215 | 215 | } |
| 216 | 216 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | */ |
| 242 | 242 | public static function moveCursorUp($rows = 1) |
| 243 | 243 | { |
| 244 | - echo '\033[' . (int) $rows . 'A'; |
|
| 244 | + echo '\033[' . (int)$rows . 'A'; |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | /** |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | public static function moveCursorDown($rows = 1) |
| 257 | 257 | { |
| 258 | - echo '\033[' . (int) $rows . 'B'; |
|
| 258 | + echo '\033[' . (int)$rows . 'B'; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | */ |
| 270 | 270 | public static function moveCursorForward($steps = 1) |
| 271 | 271 | { |
| 272 | - echo '\033[' . (int) $steps . 'C'; |
|
| 272 | + echo '\033[' . (int)$steps . 'C'; |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /** |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | */ |
| 284 | 284 | public static function moveCursorBackward($steps = 1) |
| 285 | 285 | { |
| 286 | - echo '\033[' . (int) $steps . 'D'; |
|
| 286 | + echo '\033[' . (int)$steps . 'D'; |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | /** |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | */ |
| 296 | 296 | public static function moveCursorNextLine($lines = 1) |
| 297 | 297 | { |
| 298 | - echo '\033[' . (int) $lines . 'E'; |
|
| 298 | + echo '\033[' . (int)$lines . 'E'; |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | /** |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | */ |
| 308 | 308 | public static function moveCursorPrevLine($lines = 1) |
| 309 | 309 | { |
| 310 | - echo '\033[' . (int) $lines . 'F'; |
|
| 310 | + echo '\033[' . (int)$lines . 'F'; |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | /** |
@@ -321,9 +321,9 @@ discard block |
||
| 321 | 321 | public static function moveCursorTo($column, $row = null) |
| 322 | 322 | { |
| 323 | 323 | if ($row === null) { |
| 324 | - echo '\033[' . (int) $column . 'G'; |
|
| 324 | + echo '\033[' . (int)$column . 'G'; |
|
| 325 | 325 | } else { |
| 326 | - echo '\033[' . (int) $row . ';' . (int) $column . 'H'; |
|
| 326 | + echo '\033[' . (int)$row . ';' . (int)$column . 'H'; |
|
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | 329 | |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | */ |
| 339 | 339 | public static function scrollUp($lines = 1) |
| 340 | 340 | { |
| 341 | - echo '\033[' . (int) $lines . 'S'; |
|
| 341 | + echo '\033[' . (int)$lines . 'S'; |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | /** |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | */ |
| 353 | 353 | public static function scrollDown($lines = 1) |
| 354 | 354 | { |
| 355 | - echo '\033[' . (int) $lines . 'T'; |
|
| 355 | + echo '\033[' . (int)$lines . 'T'; |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | /** |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | { |
| 70 | 70 | $base64 = false; |
| 71 | 71 | $local = new LocalFile(); |
| 72 | - $local->isFile($file) && $base64 = base64_encode((string) $local->getFileContent($file)); |
|
| 72 | + $local->isFile($file) && $base64 = base64_encode((string)$local->getFileContent($file)); |
|
| 73 | 73 | return $base64; |
| 74 | 74 | } |
| 75 | 75 | |
@@ -86,6 +86,6 @@ discard block |
||
| 86 | 86 | public static function toFile($string, $file = null) |
| 87 | 87 | { |
| 88 | 88 | null === $file && $file = './Base64_toFile_' . date('YmdHis') . '.txt'; |
| 89 | - return (bool) file_put_contents($file, base64_decode($string)); |
|
| 89 | + return (bool)file_put_contents($file, base64_decode($string)); |
|
| 90 | 90 | } |
| 91 | 91 | } |