@@ -217,6 +217,6 @@ |
||
217 | 217 | ), |
218 | 218 | ); |
219 | 219 | |
220 | -$result =& $data; |
|
220 | +$result = & $data; |
|
221 | 221 | unset($data); |
222 | 222 | return $result; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | if (!preg_match('//u', urldecode($uri))) { |
90 | 90 | $uri = preg_replace_callback( |
91 | 91 | '/[\x80-\xFF]+/', |
92 | - function ($m) { |
|
92 | + function($m) { |
|
93 | 93 | return urlencode($m[0]); |
94 | 94 | }, |
95 | 95 | $uri |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | $uri = preg_replace_callback( |
99 | 99 | '/(?:%[89A-F][0-9A-F])+/i', |
100 | - function ($m) { |
|
100 | + function($m) { |
|
101 | 101 | return urlencode(UTF8::encode('UTF-8', urldecode($m[0]))); |
102 | 102 | }, |
103 | 103 | $uri |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | // Use ob_start() to buffer content and avoid problem of headers already sent... |
108 | 108 | if (headers_sent() === false) { |
109 | 109 | $severProtocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1'); |
110 | - header($severProtocol . ' 301 Moved Permanently'); |
|
111 | - header('Location: ' . $uri); |
|
110 | + header($severProtocol.' 301 Moved Permanently'); |
|
111 | + header('Location: '.$uri); |
|
112 | 112 | exit(); |
113 | 113 | } |
114 | 114 | } |
@@ -3412,7 +3412,7 @@ discard block |
||
3412 | 3412 | /** |
3413 | 3413 | * Check if the input is binary... (is look like a hack). |
3414 | 3414 | * |
3415 | - * @param mixed $input |
|
3415 | + * @param string $input |
|
3416 | 3416 | * |
3417 | 3417 | * @return bool |
3418 | 3418 | */ |
@@ -5551,7 +5551,7 @@ discard block |
||
5551 | 5551 | * The string being checked, for the last occurrence |
5552 | 5552 | * of needle |
5553 | 5553 | * </p> |
5554 | - * @param string|int $needle <p> |
|
5554 | + * @param string $needle <p> |
|
5555 | 5555 | * The string to find in haystack. |
5556 | 5556 | * Or a code point as int. |
5557 | 5557 | * </p> |
@@ -6296,7 +6296,7 @@ discard block |
||
6296 | 6296 | * 2) when any of these: àáâãäåæçèéêëìíîï are followed by TWO chars from group B, |
6297 | 6297 | * 3) when any of these: ðñòó are followed by THREE chars from group B. |
6298 | 6298 | * |
6299 | - * @param string|array $str Any string or array. |
|
6299 | + * @param string $str Any string or array. |
|
6300 | 6300 | * |
6301 | 6301 | * @return string The same string, but UTF8 encoded. |
6302 | 6302 | */ |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | public static function add_bom_to_string($str) |
835 | 835 | { |
836 | 836 | if (self::string_has_bom($str) === false) { |
837 | - $str = self::bom() . $str; |
|
837 | + $str = self::bom().$str; |
|
838 | 838 | } |
839 | 839 | |
840 | 840 | return $str; |
@@ -2155,7 +2155,7 @@ discard block |
||
2155 | 2155 | self::checkForSupport(); |
2156 | 2156 | |
2157 | 2157 | return \mb_convert_encoding( |
2158 | - '&#x' . dechex($code) . ';', |
|
2158 | + '&#x'.dechex($code).';', |
|
2159 | 2159 | 'UTF-8', |
2160 | 2160 | 'HTML-ENTITIES' |
2161 | 2161 | ); |
@@ -2435,7 +2435,7 @@ discard block |
||
2435 | 2435 | if ($var[0] >= "\x80" && isset($n[0], $leading_combining[0]) && preg_match('/^\p{Mn}/u', $var)) { |
2436 | 2436 | // Prevent leading combining chars |
2437 | 2437 | // for NFC-safe concatenations. |
2438 | - $var = $leading_combining . $var; |
|
2438 | + $var = $leading_combining.$var; |
|
2439 | 2439 | } |
2440 | 2440 | } |
2441 | 2441 | break; |
@@ -2723,7 +2723,7 @@ discard block |
||
2723 | 2723 | */ |
2724 | 2724 | protected static function getData($file) |
2725 | 2725 | { |
2726 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
2726 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
2727 | 2727 | if (file_exists($file)) { |
2728 | 2728 | /** @noinspection PhpIncludeInspection */ |
2729 | 2729 | return require $file; |
@@ -2848,7 +2848,7 @@ discard block |
||
2848 | 2848 | |
2849 | 2849 | return implode( |
2850 | 2850 | array_map( |
2851 | - function ($data) use ($keepAsciiChars) { |
|
2851 | + function($data) use ($keepAsciiChars) { |
|
2852 | 2852 | return UTF8::single_chr_html_encode($data, $keepAsciiChars); |
2853 | 2853 | }, |
2854 | 2854 | self::split($str) |
@@ -3237,9 +3237,9 @@ discard block |
||
3237 | 3237 | if (ctype_digit((string)$int)) { |
3238 | 3238 | $hex = dechex((int)$int); |
3239 | 3239 | |
3240 | - $hex = (strlen($hex) < 4 ? substr('0000' . $hex, -4) : $hex); |
|
3240 | + $hex = (strlen($hex) < 4 ? substr('0000'.$hex, -4) : $hex); |
|
3241 | 3241 | |
3242 | - return $pfix . $hex; |
|
3242 | + return $pfix.$hex; |
|
3243 | 3243 | } |
3244 | 3244 | |
3245 | 3245 | return ''; |
@@ -3893,7 +3893,7 @@ discard block |
||
3893 | 3893 | */ |
3894 | 3894 | public static function lcfirst($str) |
3895 | 3895 | { |
3896 | - return self::strtolower(self::substr($str, 0, 1)) . self::substr($str, 1); |
|
3896 | + return self::strtolower(self::substr($str, 0, 1)).self::substr($str, 1); |
|
3897 | 3897 | } |
3898 | 3898 | |
3899 | 3899 | /** |
@@ -4311,7 +4311,7 @@ discard block |
||
4311 | 4311 | |
4312 | 4312 | if (is_array($what)) { |
4313 | 4313 | foreach ($what as $item) { |
4314 | - $str = preg_replace('/(' . preg_quote($item, '/') . ')+/', $item, $str); |
|
4314 | + $str = preg_replace('/('.preg_quote($item, '/').')+/', $item, $str); |
|
4315 | 4315 | } |
4316 | 4316 | } |
4317 | 4317 | |
@@ -4411,7 +4411,7 @@ discard block |
||
4411 | 4411 | { |
4412 | 4412 | static $rxClassCache = array(); |
4413 | 4413 | |
4414 | - $cacheKey = $s . $class; |
|
4414 | + $cacheKey = $s.$class; |
|
4415 | 4415 | |
4416 | 4416 | if (isset($rxClassCache[$cacheKey])) { |
4417 | 4417 | return $rxClassCache[$cacheKey]; |
@@ -4422,7 +4422,7 @@ discard block |
||
4422 | 4422 | /** @noinspection SuspiciousLoopInspection */ |
4423 | 4423 | foreach (self::str_split($s) as $s) { |
4424 | 4424 | if ('-' === $s) { |
4425 | - $class[0] = '-' . $class[0]; |
|
4425 | + $class[0] = '-'.$class[0]; |
|
4426 | 4426 | } elseif (!isset($s[2])) { |
4427 | 4427 | $class[0] .= preg_quote($s, '/'); |
4428 | 4428 | } elseif (1 === self::strlen($s)) { |
@@ -4433,13 +4433,13 @@ discard block |
||
4433 | 4433 | } |
4434 | 4434 | |
4435 | 4435 | if ($class[0]) { |
4436 | - $class[0] = '[' . $class[0] . ']'; |
|
4436 | + $class[0] = '['.$class[0].']'; |
|
4437 | 4437 | } |
4438 | 4438 | |
4439 | 4439 | if (1 === count($class)) { |
4440 | 4440 | $return = $class[0]; |
4441 | 4441 | } else { |
4442 | - $return = '(?:' . implode('|', $class) . ')'; |
|
4442 | + $return = '(?:'.implode('|', $class).')'; |
|
4443 | 4443 | } |
4444 | 4444 | |
4445 | 4445 | $rxClassCache[$cacheKey] = $return; |
@@ -4453,7 +4453,7 @@ discard block |
||
4453 | 4453 | public static function showSupport() |
4454 | 4454 | { |
4455 | 4455 | foreach (self::$support as $utf8Support) { |
4456 | - echo $utf8Support . "\n<br>"; |
|
4456 | + echo $utf8Support."\n<br>"; |
|
4457 | 4457 | } |
4458 | 4458 | } |
4459 | 4459 | |
@@ -4479,7 +4479,7 @@ discard block |
||
4479 | 4479 | return $char; |
4480 | 4480 | } |
4481 | 4481 | |
4482 | - return '&#' . self::ord($char) . ';'; |
|
4482 | + return '&#'.self::ord($char).';'; |
|
4483 | 4483 | } |
4484 | 4484 | |
4485 | 4485 | /** |
@@ -4528,19 +4528,19 @@ discard block |
||
4528 | 4528 | $ret[] = $str[$i]; |
4529 | 4529 | } elseif ((($str[$i] & "\xE0") === "\xC0") && isset($str[$i + 1])) { |
4530 | 4530 | if (($str[$i + 1] & "\xC0") === "\x80") { |
4531 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
4531 | + $ret[] = $str[$i].$str[$i + 1]; |
|
4532 | 4532 | |
4533 | 4533 | $i++; |
4534 | 4534 | } |
4535 | 4535 | } elseif ((($str[$i] & "\xF0") === "\xE0") && isset($str[$i + 2])) { |
4536 | 4536 | if ((($str[$i + 1] & "\xC0") === "\x80") && (($str[$i + 2] & "\xC0") === "\x80")) { |
4537 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
4537 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
4538 | 4538 | |
4539 | 4539 | $i += 2; |
4540 | 4540 | } |
4541 | 4541 | } elseif ((($str[$i] & "\xF8") === "\xF0") && isset($str[$i + 3])) { |
4542 | 4542 | if ((($str[$i + 1] & "\xC0") === "\x80") && (($str[$i + 2] & "\xC0") === "\x80") && (($str[$i + 3] & "\xC0") === "\x80")) { |
4543 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
4543 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
4544 | 4544 | |
4545 | 4545 | $i += 3; |
4546 | 4546 | } |
@@ -4675,7 +4675,7 @@ discard block |
||
4675 | 4675 | if ('' === $s .= '') { |
4676 | 4676 | $s = '/^(?<=.)$/'; |
4677 | 4677 | } else { |
4678 | - $s = '/' . preg_quote($s, '/') . '/ui'; |
|
4678 | + $s = '/'.preg_quote($s, '/').'/ui'; |
|
4679 | 4679 | } |
4680 | 4680 | } |
4681 | 4681 | |
@@ -4709,7 +4709,7 @@ discard block |
||
4709 | 4709 | } |
4710 | 4710 | |
4711 | 4711 | if (self::substr($str, $length - 1, 1) === ' ') { |
4712 | - return self::substr($str, 0, $length - 1) . $strAddOn; |
|
4712 | + return self::substr($str, 0, $length - 1).$strAddOn; |
|
4713 | 4713 | } |
4714 | 4714 | |
4715 | 4715 | $str = self::substr($str, 0, $length); |
@@ -4718,9 +4718,9 @@ discard block |
||
4718 | 4718 | $new_str = implode(' ', $array); |
4719 | 4719 | |
4720 | 4720 | if ($new_str === '') { |
4721 | - $str = self::substr($str, 0, $length - 1) . $strAddOn; |
|
4721 | + $str = self::substr($str, 0, $length - 1).$strAddOn; |
|
4722 | 4722 | } else { |
4723 | - $str = $new_str . $strAddOn; |
|
4723 | + $str = $new_str.$strAddOn; |
|
4724 | 4724 | } |
4725 | 4725 | |
4726 | 4726 | return $str; |
@@ -4766,7 +4766,7 @@ discard block |
||
4766 | 4766 | $pre = ''; |
4767 | 4767 | } |
4768 | 4768 | |
4769 | - return $pre . $str . $post; |
|
4769 | + return $pre.$str.$post; |
|
4770 | 4770 | } |
4771 | 4771 | |
4772 | 4772 | return $str; |
@@ -4892,7 +4892,7 @@ discard block |
||
4892 | 4892 | return str_split($str, $len); |
4893 | 4893 | } |
4894 | 4894 | |
4895 | - preg_match_all('/' . Grapheme::GRAPHEME_CLUSTER_RX . '/u', $str, $a); |
|
4895 | + preg_match_all('/'.Grapheme::GRAPHEME_CLUSTER_RX.'/u', $str, $a); |
|
4896 | 4896 | $a = $a[0]; |
4897 | 4897 | |
4898 | 4898 | if ($len === 1) { |
@@ -5025,7 +5025,7 @@ discard block |
||
5025 | 5025 | */ |
5026 | 5026 | public static function strcmp($str1, $str2) |
5027 | 5027 | { |
5028 | - return $str1 . '' === $str2 . '' ? 0 : strcmp( |
|
5028 | + return $str1.'' === $str2.'' ? 0 : strcmp( |
|
5029 | 5029 | \Normalizer::normalize($str1, \Normalizer::NFD), |
5030 | 5030 | \Normalizer::normalize($str2, \Normalizer::NFD) |
5031 | 5031 | ); |
@@ -5053,7 +5053,7 @@ discard block |
||
5053 | 5053 | $str = (string)$str; |
5054 | 5054 | } |
5055 | 5055 | |
5056 | - if (preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $length)) { |
|
5056 | + if (preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $length)) { |
|
5057 | 5057 | /** @noinspection OffsetOperationsInspection */ |
5058 | 5058 | return self::strlen($length[1]); |
5059 | 5059 | } else { |
@@ -5277,7 +5277,7 @@ discard block |
||
5277 | 5277 | */ |
5278 | 5278 | public static function strnatcmp($str1, $str2) |
5279 | 5279 | { |
5280 | - return $str1 . '' === $str2 . '' ? 0 : strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
5280 | + return $str1.'' === $str2.'' ? 0 : strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
5281 | 5281 | } |
5282 | 5282 | |
5283 | 5283 | /** |
@@ -5358,7 +5358,7 @@ discard block |
||
5358 | 5358 | return false; |
5359 | 5359 | } |
5360 | 5360 | |
5361 | - if (preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
5361 | + if (preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
5362 | 5362 | return substr($haystack, strpos($haystack, $m[0])); |
5363 | 5363 | } else { |
5364 | 5364 | return false; |
@@ -5635,7 +5635,7 @@ discard block |
||
5635 | 5635 | $str = self::substr($str, $offset, $length); |
5636 | 5636 | } |
5637 | 5637 | |
5638 | - return preg_match('/^' . self::rxClass($mask) . '+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
5638 | + return preg_match('/^'.self::rxClass($mask).'+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
5639 | 5639 | } |
5640 | 5640 | |
5641 | 5641 | /** |
@@ -6091,7 +6091,7 @@ discard block |
||
6091 | 6091 | |
6092 | 6092 | $strSwappedCase = preg_replace_callback( |
6093 | 6093 | '/[\S]/u', |
6094 | - function ($match) use ($encoding) { |
|
6094 | + function($match) use ($encoding) { |
|
6095 | 6095 | $marchToUpper = UTF8::strtoupper($match[0], $encoding); |
6096 | 6096 | |
6097 | 6097 | if ($match[0] === $marchToUpper) { |
@@ -6235,7 +6235,7 @@ discard block |
||
6235 | 6235 | |
6236 | 6236 | $bank = $ord >> 8; |
6237 | 6237 | if (!array_key_exists($bank, (array)$UTF8_TO_ASCII)) { |
6238 | - $bankfile = __DIR__ . '/data/' . sprintf('x%02x', $bank) . '.php'; |
|
6238 | + $bankfile = __DIR__.'/data/'.sprintf('x%02x', $bank).'.php'; |
|
6239 | 6239 | if (file_exists($bankfile)) { |
6240 | 6240 | /** @noinspection PhpIncludeInspection */ |
6241 | 6241 | require $bankfile; |
@@ -6332,40 +6332,40 @@ discard block |
||
6332 | 6332 | if ($c1 >= "\xc0" & $c1 <= "\xdf") { // looks like 2 bytes UTF8 |
6333 | 6333 | |
6334 | 6334 | if ($c2 >= "\x80" && $c2 <= "\xbf") { // yeah, almost sure it's UTF8 already |
6335 | - $buf .= $c1 . $c2; |
|
6335 | + $buf .= $c1.$c2; |
|
6336 | 6336 | $i++; |
6337 | 6337 | } else { // not valid UTF8 - convert it |
6338 | 6338 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
6339 | 6339 | $cc2 = ($c1 & "\x3f") | "\x80"; |
6340 | - $buf .= $cc1 . $cc2; |
|
6340 | + $buf .= $cc1.$cc2; |
|
6341 | 6341 | } |
6342 | 6342 | |
6343 | 6343 | } elseif ($c1 >= "\xe0" & $c1 <= "\xef") { // looks like 3 bytes UTF8 |
6344 | 6344 | |
6345 | 6345 | if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf") { // yeah, almost sure it's UTF8 already |
6346 | - $buf .= $c1 . $c2 . $c3; |
|
6346 | + $buf .= $c1.$c2.$c3; |
|
6347 | 6347 | $i += 2; |
6348 | 6348 | } else { // not valid UTF8 - convert it |
6349 | 6349 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
6350 | 6350 | $cc2 = ($c1 & "\x3f") | "\x80"; |
6351 | - $buf .= $cc1 . $cc2; |
|
6351 | + $buf .= $cc1.$cc2; |
|
6352 | 6352 | } |
6353 | 6353 | |
6354 | 6354 | } elseif ($c1 >= "\xf0" & $c1 <= "\xf7") { // looks like 4 bytes UTF8 |
6355 | 6355 | |
6356 | 6356 | if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf" && $c4 >= "\x80" && $c4 <= "\xbf") { // yeah, almost sure it's UTF8 already |
6357 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
6357 | + $buf .= $c1.$c2.$c3.$c4; |
|
6358 | 6358 | $i += 3; |
6359 | 6359 | } else { // not valid UTF8 - convert it |
6360 | 6360 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
6361 | 6361 | $cc2 = ($c1 & "\x3f") | "\x80"; |
6362 | - $buf .= $cc1 . $cc2; |
|
6362 | + $buf .= $cc1.$cc2; |
|
6363 | 6363 | } |
6364 | 6364 | |
6365 | 6365 | } else { // doesn't look like UTF8, but should be converted |
6366 | 6366 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
6367 | 6367 | $cc2 = (($c1 & "\x3f") | "\x80"); |
6368 | - $buf .= $cc1 . $cc2; |
|
6368 | + $buf .= $cc1.$cc2; |
|
6369 | 6369 | } |
6370 | 6370 | |
6371 | 6371 | } elseif (($c1 & "\xc0") === "\x80") { // needs conversion |
@@ -6376,7 +6376,7 @@ discard block |
||
6376 | 6376 | } else { |
6377 | 6377 | $cc1 = (chr($ordC1 / 64) | "\xc0"); |
6378 | 6378 | $cc2 = (($c1 & "\x3f") | "\x80"); |
6379 | - $buf .= $cc1 . $cc2; |
|
6379 | + $buf .= $cc1.$cc2; |
|
6380 | 6380 | } |
6381 | 6381 | |
6382 | 6382 | } else { // it doesn't need conversion |
@@ -6389,7 +6389,7 @@ discard block |
||
6389 | 6389 | // decode unicode escape sequences |
6390 | 6390 | $buf = preg_replace_callback( |
6391 | 6391 | '/\\\\u([0-9a-f]{4})/i', |
6392 | - function ($match) { |
|
6392 | + function($match) { |
|
6393 | 6393 | return \mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); |
6394 | 6394 | }, |
6395 | 6395 | $buf |
@@ -6398,7 +6398,7 @@ discard block |
||
6398 | 6398 | // decode UTF-8 codepoints |
6399 | 6399 | $buf = preg_replace_callback( |
6400 | 6400 | '/&#\d{2,4};/', |
6401 | - function ($match) { |
|
6401 | + function($match) { |
|
6402 | 6402 | return \mb_convert_encoding($match[0], 'UTF-8', 'HTML-ENTITIES'); |
6403 | 6403 | }, |
6404 | 6404 | $buf |
@@ -6473,7 +6473,7 @@ discard block |
||
6473 | 6473 | */ |
6474 | 6474 | public static function ucfirst($str) |
6475 | 6475 | { |
6476 | - return self::strtoupper(self::substr($str, 0, 1)) . self::substr($str, 1); |
|
6476 | + return self::strtoupper(self::substr($str, 0, 1)).self::substr($str, 1); |
|
6477 | 6477 | } |
6478 | 6478 | |
6479 | 6479 | /** |
@@ -6922,7 +6922,7 @@ discard block |
||
6922 | 6922 | return ''; |
6923 | 6923 | } |
6924 | 6924 | |
6925 | - preg_match('/^\s*+(?:\S++\s*+){1,' . $words . '}/u', $str, $matches); |
|
6925 | + preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $str, $matches); |
|
6926 | 6926 | |
6927 | 6927 | if ( |
6928 | 6928 | !isset($matches[0]) |
@@ -6932,7 +6932,7 @@ discard block |
||
6932 | 6932 | return $str; |
6933 | 6933 | } |
6934 | 6934 | |
6935 | - return self::rtrim($matches[0]) . $strAddOn; |
|
6935 | + return self::rtrim($matches[0]).$strAddOn; |
|
6936 | 6936 | } |
6937 | 6937 | |
6938 | 6938 | /** |
@@ -7014,7 +7014,7 @@ discard block |
||
7014 | 7014 | $strReturn .= $break; |
7015 | 7015 | } |
7016 | 7016 | |
7017 | - return $strReturn . implode('', $chars); |
|
7017 | + return $strReturn.implode('', $chars); |
|
7018 | 7018 | } |
7019 | 7019 | |
7020 | 7020 | /** |