@@ -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 | } |
@@ -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; |
@@ -2172,7 +2172,7 @@ discard block |
||
2172 | 2172 | self::checkForSupport(); |
2173 | 2173 | |
2174 | 2174 | return \mb_convert_encoding( |
2175 | - '&#x' . dechex($code) . ';', |
|
2175 | + '&#x'.dechex($code).';', |
|
2176 | 2176 | 'UTF-8', |
2177 | 2177 | 'HTML-ENTITIES' |
2178 | 2178 | ); |
@@ -2430,7 +2430,7 @@ discard block |
||
2430 | 2430 | if ($var[0] >= "\x80" && isset($n[0], $leading_combining[0]) && preg_match('/^\p{Mn}/u', $var)) { |
2431 | 2431 | // Prevent leading combining chars |
2432 | 2432 | // for NFC-safe concatenations. |
2433 | - $var = $leading_combining . $var; |
|
2433 | + $var = $leading_combining.$var; |
|
2434 | 2434 | } |
2435 | 2435 | } |
2436 | 2436 | break; |
@@ -2718,7 +2718,7 @@ discard block |
||
2718 | 2718 | */ |
2719 | 2719 | protected static function getData($file) |
2720 | 2720 | { |
2721 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
2721 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
2722 | 2722 | if (file_exists($file)) { |
2723 | 2723 | /** @noinspection PhpIncludeInspection */ |
2724 | 2724 | return require $file; |
@@ -2793,7 +2793,7 @@ discard block |
||
2793 | 2793 | |
2794 | 2794 | return implode( |
2795 | 2795 | array_map( |
2796 | - function ($data) use ($keepAsciiChars) { |
|
2796 | + function($data) use ($keepAsciiChars) { |
|
2797 | 2797 | return UTF8::single_chr_html_encode($data, $keepAsciiChars); |
2798 | 2798 | }, |
2799 | 2799 | self::split($str) |
@@ -2901,7 +2901,7 @@ discard block |
||
2901 | 2901 | |
2902 | 2902 | $str = preg_replace_callback( |
2903 | 2903 | "/&#\d{2,5};/", |
2904 | - function ($matches) { |
|
2904 | + function($matches) { |
|
2905 | 2905 | $returnTmp = \mb_convert_encoding($matches[0], 'UTF-8', 'HTML-ENTITIES'); |
2906 | 2906 | |
2907 | 2907 | if ($returnTmp !== '"' && $returnTmp !== "'") { |
@@ -3196,9 +3196,9 @@ discard block |
||
3196 | 3196 | if (ctype_digit((string)$int)) { |
3197 | 3197 | $hex = dechex((int)$int); |
3198 | 3198 | |
3199 | - $hex = (strlen($hex) < 4 ? substr('0000' . $hex, -4) : $hex); |
|
3199 | + $hex = (strlen($hex) < 4 ? substr('0000'.$hex, -4) : $hex); |
|
3200 | 3200 | |
3201 | - return $pfix . $hex; |
|
3201 | + return $pfix.$hex; |
|
3202 | 3202 | } |
3203 | 3203 | |
3204 | 3204 | return ''; |
@@ -3870,7 +3870,7 @@ discard block |
||
3870 | 3870 | */ |
3871 | 3871 | public static function lcfirst($str) |
3872 | 3872 | { |
3873 | - return self::strtolower(self::substr($str, 0, 1)) . self::substr($str, 1); |
|
3873 | + return self::strtolower(self::substr($str, 0, 1)).self::substr($str, 1); |
|
3874 | 3874 | } |
3875 | 3875 | |
3876 | 3876 | /** |
@@ -4315,7 +4315,7 @@ discard block |
||
4315 | 4315 | |
4316 | 4316 | if (is_array($what)) { |
4317 | 4317 | foreach ($what as $item) { |
4318 | - $str = preg_replace('/(' . preg_quote($item, '/') . ')+/', $item, $str); |
|
4318 | + $str = preg_replace('/('.preg_quote($item, '/').')+/', $item, $str); |
|
4319 | 4319 | } |
4320 | 4320 | } |
4321 | 4321 | |
@@ -4417,7 +4417,7 @@ discard block |
||
4417 | 4417 | { |
4418 | 4418 | static $rxClassCache = array(); |
4419 | 4419 | |
4420 | - $cacheKey = $s . $class; |
|
4420 | + $cacheKey = $s.$class; |
|
4421 | 4421 | |
4422 | 4422 | if (isset($rxClassCache[$cacheKey])) { |
4423 | 4423 | return $rxClassCache[$cacheKey]; |
@@ -4428,7 +4428,7 @@ discard block |
||
4428 | 4428 | /** @noinspection SuspiciousLoopInspection */ |
4429 | 4429 | foreach (self::str_split($s) as $s) { |
4430 | 4430 | if ('-' === $s) { |
4431 | - $class[0] = '-' . $class[0]; |
|
4431 | + $class[0] = '-'.$class[0]; |
|
4432 | 4432 | } elseif (!isset($s[2])) { |
4433 | 4433 | $class[0] .= preg_quote($s, '/'); |
4434 | 4434 | } elseif (1 === self::strlen($s)) { |
@@ -4439,13 +4439,13 @@ discard block |
||
4439 | 4439 | } |
4440 | 4440 | |
4441 | 4441 | if ($class[0]) { |
4442 | - $class[0] = '[' . $class[0] . ']'; |
|
4442 | + $class[0] = '['.$class[0].']'; |
|
4443 | 4443 | } |
4444 | 4444 | |
4445 | 4445 | if (1 === count($class)) { |
4446 | 4446 | $return = $class[0]; |
4447 | 4447 | } else { |
4448 | - $return = '(?:' . implode('|', $class) . ')'; |
|
4448 | + $return = '(?:'.implode('|', $class).')'; |
|
4449 | 4449 | } |
4450 | 4450 | |
4451 | 4451 | $rxClassCache[$cacheKey] = $return; |
@@ -4459,7 +4459,7 @@ discard block |
||
4459 | 4459 | public static function showSupport() |
4460 | 4460 | { |
4461 | 4461 | foreach (self::$support as $utf8Support) { |
4462 | - echo $utf8Support . "\n<br>"; |
|
4462 | + echo $utf8Support."\n<br>"; |
|
4463 | 4463 | } |
4464 | 4464 | } |
4465 | 4465 | |
@@ -4485,7 +4485,7 @@ discard block |
||
4485 | 4485 | return $char; |
4486 | 4486 | } |
4487 | 4487 | |
4488 | - return '&#' . self::ord($char) . ';'; |
|
4488 | + return '&#'.self::ord($char).';'; |
|
4489 | 4489 | } |
4490 | 4490 | |
4491 | 4491 | /** |
@@ -4534,19 +4534,19 @@ discard block |
||
4534 | 4534 | $ret[] = $str[$i]; |
4535 | 4535 | } elseif ((($str[$i] & "\xE0") === "\xC0") && isset($str[$i + 1])) { |
4536 | 4536 | if (($str[$i + 1] & "\xC0") === "\x80") { |
4537 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
4537 | + $ret[] = $str[$i].$str[$i + 1]; |
|
4538 | 4538 | |
4539 | 4539 | $i++; |
4540 | 4540 | } |
4541 | 4541 | } elseif ((($str[$i] & "\xF0") === "\xE0") && isset($str[$i + 2])) { |
4542 | 4542 | if ((($str[$i + 1] & "\xC0") === "\x80") && (($str[$i + 2] & "\xC0") === "\x80")) { |
4543 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
4543 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
4544 | 4544 | |
4545 | 4545 | $i += 2; |
4546 | 4546 | } |
4547 | 4547 | } elseif ((($str[$i] & "\xF8") === "\xF0") && isset($str[$i + 3])) { |
4548 | 4548 | if ((($str[$i + 1] & "\xC0") === "\x80") && (($str[$i + 2] & "\xC0") === "\x80") && (($str[$i + 3] & "\xC0") === "\x80")) { |
4549 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
4549 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
4550 | 4550 | |
4551 | 4551 | $i += 3; |
4552 | 4552 | } |
@@ -4695,7 +4695,7 @@ discard block |
||
4695 | 4695 | if ('' === $s .= '') { |
4696 | 4696 | $s = '/^(?<=.)$/'; |
4697 | 4697 | } else { |
4698 | - $s = '/' . preg_quote($s, '/') . '/ui'; |
|
4698 | + $s = '/'.preg_quote($s, '/').'/ui'; |
|
4699 | 4699 | } |
4700 | 4700 | } |
4701 | 4701 | |
@@ -4729,7 +4729,7 @@ discard block |
||
4729 | 4729 | } |
4730 | 4730 | |
4731 | 4731 | if (self::substr($str, $length - 1, 1) === ' ') { |
4732 | - return self::substr($str, 0, $length - 1) . $strAddOn; |
|
4732 | + return self::substr($str, 0, $length - 1).$strAddOn; |
|
4733 | 4733 | } |
4734 | 4734 | |
4735 | 4735 | $str = self::substr($str, 0, $length); |
@@ -4738,9 +4738,9 @@ discard block |
||
4738 | 4738 | $new_str = implode(' ', $array); |
4739 | 4739 | |
4740 | 4740 | if ($new_str === '') { |
4741 | - $str = self::substr($str, 0, $length - 1) . $strAddOn; |
|
4741 | + $str = self::substr($str, 0, $length - 1).$strAddOn; |
|
4742 | 4742 | } else { |
4743 | - $str = $new_str . $strAddOn; |
|
4743 | + $str = $new_str.$strAddOn; |
|
4744 | 4744 | } |
4745 | 4745 | |
4746 | 4746 | return $str; |
@@ -4786,7 +4786,7 @@ discard block |
||
4786 | 4786 | $pre = ''; |
4787 | 4787 | } |
4788 | 4788 | |
4789 | - return $pre . $str . $post; |
|
4789 | + return $pre.$str.$post; |
|
4790 | 4790 | } |
4791 | 4791 | |
4792 | 4792 | return $str; |
@@ -4912,7 +4912,7 @@ discard block |
||
4912 | 4912 | return str_split($str, $len); |
4913 | 4913 | } |
4914 | 4914 | |
4915 | - preg_match_all('/' . Grapheme::GRAPHEME_CLUSTER_RX . '/u', $str, $a); |
|
4915 | + preg_match_all('/'.Grapheme::GRAPHEME_CLUSTER_RX.'/u', $str, $a); |
|
4916 | 4916 | $a = $a[0]; |
4917 | 4917 | |
4918 | 4918 | if ($len === 1) { |
@@ -5039,7 +5039,7 @@ discard block |
||
5039 | 5039 | */ |
5040 | 5040 | public static function strcmp($str1, $str2) |
5041 | 5041 | { |
5042 | - return $str1 . '' === $str2 . '' ? 0 : strcmp( |
|
5042 | + return $str1.'' === $str2.'' ? 0 : strcmp( |
|
5043 | 5043 | \Normalizer::normalize($str1, \Normalizer::NFD), |
5044 | 5044 | \Normalizer::normalize($str2, \Normalizer::NFD) |
5045 | 5045 | ); |
@@ -5067,7 +5067,7 @@ discard block |
||
5067 | 5067 | $str = (string)$str; |
5068 | 5068 | } |
5069 | 5069 | |
5070 | - if (preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $length)) { |
|
5070 | + if (preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $length)) { |
|
5071 | 5071 | /** @noinspection OffsetOperationsInspection */ |
5072 | 5072 | return self::strlen($length[1]); |
5073 | 5073 | } else { |
@@ -5305,7 +5305,7 @@ discard block |
||
5305 | 5305 | */ |
5306 | 5306 | public static function strnatcmp($str1, $str2) |
5307 | 5307 | { |
5308 | - return $str1 . '' === $str2 . '' ? 0 : strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
5308 | + return $str1.'' === $str2.'' ? 0 : strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
5309 | 5309 | } |
5310 | 5310 | |
5311 | 5311 | /** |
@@ -5382,7 +5382,7 @@ discard block |
||
5382 | 5382 | return false; |
5383 | 5383 | } |
5384 | 5384 | |
5385 | - if (preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
5385 | + if (preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
5386 | 5386 | return substr($haystack, strpos($haystack, $m[0])); |
5387 | 5387 | } else { |
5388 | 5388 | return false; |
@@ -5695,7 +5695,7 @@ discard block |
||
5695 | 5695 | $str = self::substr($str, $offset, $length); |
5696 | 5696 | } |
5697 | 5697 | |
5698 | - return preg_match('/^' . self::rxClass($mask) . '+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
5698 | + return preg_match('/^'.self::rxClass($mask).'+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
5699 | 5699 | } |
5700 | 5700 | |
5701 | 5701 | /** |
@@ -6146,7 +6146,7 @@ discard block |
||
6146 | 6146 | |
6147 | 6147 | $strSwappedCase = preg_replace_callback( |
6148 | 6148 | '/[\S]/u', |
6149 | - function ($match) use ($encoding) { |
|
6149 | + function($match) use ($encoding) { |
|
6150 | 6150 | $marchToUpper = UTF8::strtoupper($match[0], $encoding); |
6151 | 6151 | |
6152 | 6152 | if ($match[0] === $marchToUpper) { |
@@ -6296,7 +6296,7 @@ discard block |
||
6296 | 6296 | |
6297 | 6297 | $bank = $ord >> 8; |
6298 | 6298 | if (!array_key_exists($bank, (array)$UTF8_TO_ASCII)) { |
6299 | - $bankfile = __DIR__ . '/data/' . sprintf('x%02x', $bank) . '.php'; |
|
6299 | + $bankfile = __DIR__.'/data/'.sprintf('x%02x', $bank).'.php'; |
|
6300 | 6300 | if (file_exists($bankfile)) { |
6301 | 6301 | /** @noinspection PhpIncludeInspection */ |
6302 | 6302 | require $bankfile; |
@@ -6397,40 +6397,40 @@ discard block |
||
6397 | 6397 | if ($c1 >= "\xc0" & $c1 <= "\xdf") { // looks like 2 bytes UTF8 |
6398 | 6398 | |
6399 | 6399 | if ($c2 >= "\x80" && $c2 <= "\xbf") { // yeah, almost sure it's UTF8 already |
6400 | - $buf .= $c1 . $c2; |
|
6400 | + $buf .= $c1.$c2; |
|
6401 | 6401 | $i++; |
6402 | 6402 | } else { // not valid UTF8 - convert it |
6403 | 6403 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
6404 | 6404 | $cc2 = ($c1 & "\x3f") | "\x80"; |
6405 | - $buf .= $cc1 . $cc2; |
|
6405 | + $buf .= $cc1.$cc2; |
|
6406 | 6406 | } |
6407 | 6407 | |
6408 | 6408 | } elseif ($c1 >= "\xe0" & $c1 <= "\xef") { // looks like 3 bytes UTF8 |
6409 | 6409 | |
6410 | 6410 | if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf") { // yeah, almost sure it's UTF8 already |
6411 | - $buf .= $c1 . $c2 . $c3; |
|
6411 | + $buf .= $c1.$c2.$c3; |
|
6412 | 6412 | $i += 2; |
6413 | 6413 | } else { // not valid UTF8 - convert it |
6414 | 6414 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
6415 | 6415 | $cc2 = ($c1 & "\x3f") | "\x80"; |
6416 | - $buf .= $cc1 . $cc2; |
|
6416 | + $buf .= $cc1.$cc2; |
|
6417 | 6417 | } |
6418 | 6418 | |
6419 | 6419 | } elseif ($c1 >= "\xf0" & $c1 <= "\xf7") { // looks like 4 bytes UTF8 |
6420 | 6420 | |
6421 | 6421 | if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf" && $c4 >= "\x80" && $c4 <= "\xbf") { // yeah, almost sure it's UTF8 already |
6422 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
6422 | + $buf .= $c1.$c2.$c3.$c4; |
|
6423 | 6423 | $i += 3; |
6424 | 6424 | } else { // not valid UTF8 - convert it |
6425 | 6425 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
6426 | 6426 | $cc2 = ($c1 & "\x3f") | "\x80"; |
6427 | - $buf .= $cc1 . $cc2; |
|
6427 | + $buf .= $cc1.$cc2; |
|
6428 | 6428 | } |
6429 | 6429 | |
6430 | 6430 | } else { // doesn't look like UTF8, but should be converted |
6431 | 6431 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
6432 | 6432 | $cc2 = (($c1 & "\x3f") | "\x80"); |
6433 | - $buf .= $cc1 . $cc2; |
|
6433 | + $buf .= $cc1.$cc2; |
|
6434 | 6434 | } |
6435 | 6435 | |
6436 | 6436 | } elseif (($c1 & "\xc0") === "\x80") { // needs conversion |
@@ -6441,7 +6441,7 @@ discard block |
||
6441 | 6441 | } else { |
6442 | 6442 | $cc1 = (chr($ordC1 / 64) | "\xc0"); |
6443 | 6443 | $cc2 = (($c1 & "\x3f") | "\x80"); |
6444 | - $buf .= $cc1 . $cc2; |
|
6444 | + $buf .= $cc1.$cc2; |
|
6445 | 6445 | } |
6446 | 6446 | |
6447 | 6447 | } else { // it doesn't need conversion |
@@ -6454,7 +6454,7 @@ discard block |
||
6454 | 6454 | // decode unicode escape sequences |
6455 | 6455 | $buf = preg_replace_callback( |
6456 | 6456 | '/\\\\u([0-9a-f]{4})/i', |
6457 | - function ($match) { |
|
6457 | + function($match) { |
|
6458 | 6458 | return \mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); |
6459 | 6459 | }, |
6460 | 6460 | $buf |
@@ -6463,7 +6463,7 @@ discard block |
||
6463 | 6463 | // decode UTF-8 codepoints |
6464 | 6464 | $buf = preg_replace_callback( |
6465 | 6465 | '/&#\d{2,4};/', |
6466 | - function ($match) { |
|
6466 | + function($match) { |
|
6467 | 6467 | return \mb_convert_encoding($match[0], 'UTF-8', 'HTML-ENTITIES'); |
6468 | 6468 | }, |
6469 | 6469 | $buf |
@@ -6538,7 +6538,7 @@ discard block |
||
6538 | 6538 | */ |
6539 | 6539 | public static function ucfirst($str) |
6540 | 6540 | { |
6541 | - return self::strtoupper(self::substr($str, 0, 1)) . self::substr($str, 1); |
|
6541 | + return self::strtoupper(self::substr($str, 0, 1)).self::substr($str, 1); |
|
6542 | 6542 | } |
6543 | 6543 | |
6544 | 6544 | /** |
@@ -6989,7 +6989,7 @@ discard block |
||
6989 | 6989 | return ''; |
6990 | 6990 | } |
6991 | 6991 | |
6992 | - preg_match('/^\s*+(?:\S++\s*+){1,' . $words . '}/u', $str, $matches); |
|
6992 | + preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $str, $matches); |
|
6993 | 6993 | |
6994 | 6994 | if ( |
6995 | 6995 | !isset($matches[0]) |
@@ -6999,7 +6999,7 @@ discard block |
||
6999 | 6999 | return $str; |
7000 | 7000 | } |
7001 | 7001 | |
7002 | - return self::rtrim($matches[0]) . $strAddOn; |
|
7002 | + return self::rtrim($matches[0]).$strAddOn; |
|
7003 | 7003 | } |
7004 | 7004 | |
7005 | 7005 | /** |
@@ -7079,7 +7079,7 @@ discard block |
||
7079 | 7079 | $strReturn .= $break; |
7080 | 7080 | } |
7081 | 7081 | |
7082 | - return $strReturn . implode('', $chars); |
|
7082 | + return $strReturn.implode('', $chars); |
|
7083 | 7083 | } |
7084 | 7084 | |
7085 | 7085 | /** |