@@ -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; |
@@ -2170,7 +2170,7 @@ discard block |
||
| 2170 | 2170 | self::checkForSupport(); |
| 2171 | 2171 | |
| 2172 | 2172 | return \mb_convert_encoding( |
| 2173 | - '&#x' . dechex($code) . ';', |
|
| 2173 | + '&#x'.dechex($code).';', |
|
| 2174 | 2174 | 'UTF-8', |
| 2175 | 2175 | 'HTML-ENTITIES' |
| 2176 | 2176 | ); |
@@ -2428,7 +2428,7 @@ discard block |
||
| 2428 | 2428 | if ($var[0] >= "\x80" && isset($n[0], $leading_combining[0]) && preg_match('/^\p{Mn}/u', $var)) { |
| 2429 | 2429 | // Prevent leading combining chars |
| 2430 | 2430 | // for NFC-safe concatenations. |
| 2431 | - $var = $leading_combining . $var; |
|
| 2431 | + $var = $leading_combining.$var; |
|
| 2432 | 2432 | } |
| 2433 | 2433 | } |
| 2434 | 2434 | break; |
@@ -2716,7 +2716,7 @@ discard block |
||
| 2716 | 2716 | */ |
| 2717 | 2717 | protected static function getData($file) |
| 2718 | 2718 | { |
| 2719 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
| 2719 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
| 2720 | 2720 | if (file_exists($file)) { |
| 2721 | 2721 | /** @noinspection PhpIncludeInspection */ |
| 2722 | 2722 | return require $file; |
@@ -2791,7 +2791,7 @@ discard block |
||
| 2791 | 2791 | |
| 2792 | 2792 | return implode( |
| 2793 | 2793 | array_map( |
| 2794 | - function ($data) use ($keepAsciiChars) { |
|
| 2794 | + function($data) use ($keepAsciiChars) { |
|
| 2795 | 2795 | return UTF8::single_chr_html_encode($data, $keepAsciiChars); |
| 2796 | 2796 | }, |
| 2797 | 2797 | self::split($str) |
@@ -2897,8 +2897,8 @@ discard block |
||
| 2897 | 2897 | do { |
| 2898 | 2898 | $str_compare = $str; |
| 2899 | 2899 | |
| 2900 | - $str = preg_replace_callback("/&#\d{2,5};/", function ($matches) { |
|
| 2901 | - $returnTmp = \mb_convert_encoding($matches[0], 'UTF-8', 'HTML-ENTITIES'); |
|
| 2900 | + $str = preg_replace_callback("/&#\d{2,5};/", function($matches) { |
|
| 2901 | + $returnTmp = \mb_convert_encoding($matches[0], 'UTF-8', 'HTML-ENTITIES'); |
|
| 2902 | 2902 | |
| 2903 | 2903 | if ($returnTmp !== '"' && $returnTmp !== "'") { |
| 2904 | 2904 | return $returnTmp; |
@@ -3190,9 +3190,9 @@ discard block |
||
| 3190 | 3190 | if (ctype_digit((string)$int)) { |
| 3191 | 3191 | $hex = dechex((int)$int); |
| 3192 | 3192 | |
| 3193 | - $hex = (strlen($hex) < 4 ? substr('0000' . $hex, -4) : $hex); |
|
| 3193 | + $hex = (strlen($hex) < 4 ? substr('0000'.$hex, -4) : $hex); |
|
| 3194 | 3194 | |
| 3195 | - return $pfix . $hex; |
|
| 3195 | + return $pfix.$hex; |
|
| 3196 | 3196 | } |
| 3197 | 3197 | |
| 3198 | 3198 | return ''; |
@@ -3864,7 +3864,7 @@ discard block |
||
| 3864 | 3864 | */ |
| 3865 | 3865 | public static function lcfirst($str) |
| 3866 | 3866 | { |
| 3867 | - return self::strtolower(self::substr($str, 0, 1)) . self::substr($str, 1); |
|
| 3867 | + return self::strtolower(self::substr($str, 0, 1)).self::substr($str, 1); |
|
| 3868 | 3868 | } |
| 3869 | 3869 | |
| 3870 | 3870 | /** |
@@ -4309,7 +4309,7 @@ discard block |
||
| 4309 | 4309 | |
| 4310 | 4310 | if (is_array($what)) { |
| 4311 | 4311 | foreach ($what as $item) { |
| 4312 | - $str = preg_replace('/(' . preg_quote($item, '/') . ')+/', $item, $str); |
|
| 4312 | + $str = preg_replace('/('.preg_quote($item, '/').')+/', $item, $str); |
|
| 4313 | 4313 | } |
| 4314 | 4314 | } |
| 4315 | 4315 | |
@@ -4412,7 +4412,7 @@ discard block |
||
| 4412 | 4412 | { |
| 4413 | 4413 | static $rxClassCache = array(); |
| 4414 | 4414 | |
| 4415 | - $cacheKey = $s . $class; |
|
| 4415 | + $cacheKey = $s.$class; |
|
| 4416 | 4416 | |
| 4417 | 4417 | if (isset($rxClassCache[$cacheKey])) { |
| 4418 | 4418 | return $rxClassCache[$cacheKey]; |
@@ -4423,7 +4423,7 @@ discard block |
||
| 4423 | 4423 | /** @noinspection SuspiciousLoopInspection */ |
| 4424 | 4424 | foreach (self::str_split($s) as $s) { |
| 4425 | 4425 | if ('-' === $s) { |
| 4426 | - $class[0] = '-' . $class[0]; |
|
| 4426 | + $class[0] = '-'.$class[0]; |
|
| 4427 | 4427 | } elseif (!isset($s[2])) { |
| 4428 | 4428 | $class[0] .= preg_quote($s, '/'); |
| 4429 | 4429 | } elseif (1 === self::strlen($s)) { |
@@ -4434,13 +4434,13 @@ discard block |
||
| 4434 | 4434 | } |
| 4435 | 4435 | |
| 4436 | 4436 | if ($class[0]) { |
| 4437 | - $class[0] = '[' . $class[0] . ']'; |
|
| 4437 | + $class[0] = '['.$class[0].']'; |
|
| 4438 | 4438 | } |
| 4439 | 4439 | |
| 4440 | 4440 | if (1 === count($class)) { |
| 4441 | 4441 | $return = $class[0]; |
| 4442 | 4442 | } else { |
| 4443 | - $return = '(?:' . implode('|', $class) . ')'; |
|
| 4443 | + $return = '(?:'.implode('|', $class).')'; |
|
| 4444 | 4444 | } |
| 4445 | 4445 | |
| 4446 | 4446 | $rxClassCache[$cacheKey] = $return; |
@@ -4454,7 +4454,7 @@ discard block |
||
| 4454 | 4454 | public static function showSupport() |
| 4455 | 4455 | { |
| 4456 | 4456 | foreach (self::$support as $utf8Support) { |
| 4457 | - echo $utf8Support . "\n<br>"; |
|
| 4457 | + echo $utf8Support."\n<br>"; |
|
| 4458 | 4458 | } |
| 4459 | 4459 | } |
| 4460 | 4460 | |
@@ -4480,7 +4480,7 @@ discard block |
||
| 4480 | 4480 | return $char; |
| 4481 | 4481 | } |
| 4482 | 4482 | |
| 4483 | - return '&#' . self::ord($char) . ';'; |
|
| 4483 | + return '&#'.self::ord($char).';'; |
|
| 4484 | 4484 | } |
| 4485 | 4485 | |
| 4486 | 4486 | /** |
@@ -4529,19 +4529,19 @@ discard block |
||
| 4529 | 4529 | $ret[] = $str[$i]; |
| 4530 | 4530 | } elseif ((($str[$i] & "\xE0") === "\xC0") && isset($str[$i + 1])) { |
| 4531 | 4531 | if (($str[$i + 1] & "\xC0") === "\x80") { |
| 4532 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
| 4532 | + $ret[] = $str[$i].$str[$i + 1]; |
|
| 4533 | 4533 | |
| 4534 | 4534 | $i++; |
| 4535 | 4535 | } |
| 4536 | 4536 | } elseif ((($str[$i] & "\xF0") === "\xE0") && isset($str[$i + 2])) { |
| 4537 | 4537 | if ((($str[$i + 1] & "\xC0") === "\x80") && (($str[$i + 2] & "\xC0") === "\x80")) { |
| 4538 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
| 4538 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
| 4539 | 4539 | |
| 4540 | 4540 | $i += 2; |
| 4541 | 4541 | } |
| 4542 | 4542 | } elseif ((($str[$i] & "\xF8") === "\xF0") && isset($str[$i + 3])) { |
| 4543 | 4543 | if ((($str[$i + 1] & "\xC0") === "\x80") && (($str[$i + 2] & "\xC0") === "\x80") && (($str[$i + 3] & "\xC0") === "\x80")) { |
| 4544 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
| 4544 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
| 4545 | 4545 | |
| 4546 | 4546 | $i += 3; |
| 4547 | 4547 | } |
@@ -4676,7 +4676,7 @@ discard block |
||
| 4676 | 4676 | if ('' === $s .= '') { |
| 4677 | 4677 | $s = '/^(?<=.)$/'; |
| 4678 | 4678 | } else { |
| 4679 | - $s = '/' . preg_quote($s, '/') . '/ui'; |
|
| 4679 | + $s = '/'.preg_quote($s, '/').'/ui'; |
|
| 4680 | 4680 | } |
| 4681 | 4681 | } |
| 4682 | 4682 | |
@@ -4710,7 +4710,7 @@ discard block |
||
| 4710 | 4710 | } |
| 4711 | 4711 | |
| 4712 | 4712 | if (self::substr($str, $length - 1, 1) === ' ') { |
| 4713 | - return self::substr($str, 0, $length - 1) . $strAddOn; |
|
| 4713 | + return self::substr($str, 0, $length - 1).$strAddOn; |
|
| 4714 | 4714 | } |
| 4715 | 4715 | |
| 4716 | 4716 | $str = self::substr($str, 0, $length); |
@@ -4719,9 +4719,9 @@ discard block |
||
| 4719 | 4719 | $new_str = implode(' ', $array); |
| 4720 | 4720 | |
| 4721 | 4721 | if ($new_str === '') { |
| 4722 | - $str = self::substr($str, 0, $length - 1) . $strAddOn; |
|
| 4722 | + $str = self::substr($str, 0, $length - 1).$strAddOn; |
|
| 4723 | 4723 | } else { |
| 4724 | - $str = $new_str . $strAddOn; |
|
| 4724 | + $str = $new_str.$strAddOn; |
|
| 4725 | 4725 | } |
| 4726 | 4726 | |
| 4727 | 4727 | return $str; |
@@ -4767,7 +4767,7 @@ discard block |
||
| 4767 | 4767 | $pre = ''; |
| 4768 | 4768 | } |
| 4769 | 4769 | |
| 4770 | - return $pre . $str . $post; |
|
| 4770 | + return $pre.$str.$post; |
|
| 4771 | 4771 | } |
| 4772 | 4772 | |
| 4773 | 4773 | return $str; |
@@ -4893,7 +4893,7 @@ discard block |
||
| 4893 | 4893 | return str_split($str, $len); |
| 4894 | 4894 | } |
| 4895 | 4895 | |
| 4896 | - preg_match_all('/' . Grapheme::GRAPHEME_CLUSTER_RX . '/u', $str, $a); |
|
| 4896 | + preg_match_all('/'.Grapheme::GRAPHEME_CLUSTER_RX.'/u', $str, $a); |
|
| 4897 | 4897 | $a = $a[0]; |
| 4898 | 4898 | |
| 4899 | 4899 | if ($len === 1) { |
@@ -5016,7 +5016,7 @@ discard block |
||
| 5016 | 5016 | */ |
| 5017 | 5017 | public static function strcmp($str1, $str2) |
| 5018 | 5018 | { |
| 5019 | - return $str1 . '' === $str2 . '' ? 0 : strcmp( |
|
| 5019 | + return $str1.'' === $str2.'' ? 0 : strcmp( |
|
| 5020 | 5020 | \Normalizer::normalize($str1, \Normalizer::NFD), |
| 5021 | 5021 | \Normalizer::normalize($str2, \Normalizer::NFD) |
| 5022 | 5022 | ); |
@@ -5044,7 +5044,7 @@ discard block |
||
| 5044 | 5044 | $str = (string)$str; |
| 5045 | 5045 | } |
| 5046 | 5046 | |
| 5047 | - if (preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $length)) { |
|
| 5047 | + if (preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $length)) { |
|
| 5048 | 5048 | /** @noinspection OffsetOperationsInspection */ |
| 5049 | 5049 | return self::strlen($length[1]); |
| 5050 | 5050 | } else { |
@@ -5268,7 +5268,7 @@ discard block |
||
| 5268 | 5268 | */ |
| 5269 | 5269 | public static function strnatcmp($str1, $str2) |
| 5270 | 5270 | { |
| 5271 | - return $str1 . '' === $str2 . '' ? 0 : strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
| 5271 | + return $str1.'' === $str2.'' ? 0 : strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
| 5272 | 5272 | } |
| 5273 | 5273 | |
| 5274 | 5274 | /** |
@@ -5349,7 +5349,7 @@ discard block |
||
| 5349 | 5349 | return false; |
| 5350 | 5350 | } |
| 5351 | 5351 | |
| 5352 | - if (preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
| 5352 | + if (preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
| 5353 | 5353 | return substr($haystack, strpos($haystack, $m[0])); |
| 5354 | 5354 | } else { |
| 5355 | 5355 | return false; |
@@ -5626,7 +5626,7 @@ discard block |
||
| 5626 | 5626 | $str = self::substr($str, $offset, $length); |
| 5627 | 5627 | } |
| 5628 | 5628 | |
| 5629 | - return preg_match('/^' . self::rxClass($mask) . '+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
| 5629 | + return preg_match('/^'.self::rxClass($mask).'+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
| 5630 | 5630 | } |
| 5631 | 5631 | |
| 5632 | 5632 | /** |
@@ -6082,7 +6082,7 @@ discard block |
||
| 6082 | 6082 | |
| 6083 | 6083 | $strSwappedCase = preg_replace_callback( |
| 6084 | 6084 | '/[\S]/u', |
| 6085 | - function ($match) use ($encoding) { |
|
| 6085 | + function($match) use ($encoding) { |
|
| 6086 | 6086 | $marchToUpper = UTF8::strtoupper($match[0], $encoding); |
| 6087 | 6087 | |
| 6088 | 6088 | if ($match[0] === $marchToUpper) { |
@@ -6232,7 +6232,7 @@ discard block |
||
| 6232 | 6232 | |
| 6233 | 6233 | $bank = $ord >> 8; |
| 6234 | 6234 | if (!array_key_exists($bank, (array)$UTF8_TO_ASCII)) { |
| 6235 | - $bankfile = __DIR__ . '/data/' . sprintf('x%02x', $bank) . '.php'; |
|
| 6235 | + $bankfile = __DIR__.'/data/'.sprintf('x%02x', $bank).'.php'; |
|
| 6236 | 6236 | if (file_exists($bankfile)) { |
| 6237 | 6237 | /** @noinspection PhpIncludeInspection */ |
| 6238 | 6238 | require $bankfile; |
@@ -6333,40 +6333,40 @@ discard block |
||
| 6333 | 6333 | if ($c1 >= "\xc0" & $c1 <= "\xdf") { // looks like 2 bytes UTF8 |
| 6334 | 6334 | |
| 6335 | 6335 | if ($c2 >= "\x80" && $c2 <= "\xbf") { // yeah, almost sure it's UTF8 already |
| 6336 | - $buf .= $c1 . $c2; |
|
| 6336 | + $buf .= $c1.$c2; |
|
| 6337 | 6337 | $i++; |
| 6338 | 6338 | } else { // not valid UTF8 - convert it |
| 6339 | 6339 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
| 6340 | 6340 | $cc2 = ($c1 & "\x3f") | "\x80"; |
| 6341 | - $buf .= $cc1 . $cc2; |
|
| 6341 | + $buf .= $cc1.$cc2; |
|
| 6342 | 6342 | } |
| 6343 | 6343 | |
| 6344 | 6344 | } elseif ($c1 >= "\xe0" & $c1 <= "\xef") { // looks like 3 bytes UTF8 |
| 6345 | 6345 | |
| 6346 | 6346 | if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf") { // yeah, almost sure it's UTF8 already |
| 6347 | - $buf .= $c1 . $c2 . $c3; |
|
| 6347 | + $buf .= $c1.$c2.$c3; |
|
| 6348 | 6348 | $i += 2; |
| 6349 | 6349 | } else { // not valid UTF8 - convert it |
| 6350 | 6350 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
| 6351 | 6351 | $cc2 = ($c1 & "\x3f") | "\x80"; |
| 6352 | - $buf .= $cc1 . $cc2; |
|
| 6352 | + $buf .= $cc1.$cc2; |
|
| 6353 | 6353 | } |
| 6354 | 6354 | |
| 6355 | 6355 | } elseif ($c1 >= "\xf0" & $c1 <= "\xf7") { // looks like 4 bytes UTF8 |
| 6356 | 6356 | |
| 6357 | 6357 | if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf" && $c4 >= "\x80" && $c4 <= "\xbf") { // yeah, almost sure it's UTF8 already |
| 6358 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
| 6358 | + $buf .= $c1.$c2.$c3.$c4; |
|
| 6359 | 6359 | $i += 3; |
| 6360 | 6360 | } else { // not valid UTF8 - convert it |
| 6361 | 6361 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
| 6362 | 6362 | $cc2 = ($c1 & "\x3f") | "\x80"; |
| 6363 | - $buf .= $cc1 . $cc2; |
|
| 6363 | + $buf .= $cc1.$cc2; |
|
| 6364 | 6364 | } |
| 6365 | 6365 | |
| 6366 | 6366 | } else { // doesn't look like UTF8, but should be converted |
| 6367 | 6367 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
| 6368 | 6368 | $cc2 = (($c1 & "\x3f") | "\x80"); |
| 6369 | - $buf .= $cc1 . $cc2; |
|
| 6369 | + $buf .= $cc1.$cc2; |
|
| 6370 | 6370 | } |
| 6371 | 6371 | |
| 6372 | 6372 | } elseif (($c1 & "\xc0") === "\x80") { // needs conversion |
@@ -6377,7 +6377,7 @@ discard block |
||
| 6377 | 6377 | } else { |
| 6378 | 6378 | $cc1 = (chr($ordC1 / 64) | "\xc0"); |
| 6379 | 6379 | $cc2 = (($c1 & "\x3f") | "\x80"); |
| 6380 | - $buf .= $cc1 . $cc2; |
|
| 6380 | + $buf .= $cc1.$cc2; |
|
| 6381 | 6381 | } |
| 6382 | 6382 | |
| 6383 | 6383 | } else { // it doesn't need conversion |
@@ -6390,7 +6390,7 @@ discard block |
||
| 6390 | 6390 | // decode unicode escape sequences |
| 6391 | 6391 | $buf = preg_replace_callback( |
| 6392 | 6392 | '/\\\\u([0-9a-f]{4})/i', |
| 6393 | - function ($match) { |
|
| 6393 | + function($match) { |
|
| 6394 | 6394 | return \mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); |
| 6395 | 6395 | }, |
| 6396 | 6396 | $buf |
@@ -6399,7 +6399,7 @@ discard block |
||
| 6399 | 6399 | // decode UTF-8 codepoints |
| 6400 | 6400 | $buf = preg_replace_callback( |
| 6401 | 6401 | '/&#\d{2,4};/', |
| 6402 | - function ($match) { |
|
| 6402 | + function($match) { |
|
| 6403 | 6403 | return \mb_convert_encoding($match[0], 'UTF-8', 'HTML-ENTITIES'); |
| 6404 | 6404 | }, |
| 6405 | 6405 | $buf |
@@ -6474,7 +6474,7 @@ discard block |
||
| 6474 | 6474 | */ |
| 6475 | 6475 | public static function ucfirst($str) |
| 6476 | 6476 | { |
| 6477 | - return self::strtoupper(self::substr($str, 0, 1)) . self::substr($str, 1); |
|
| 6477 | + return self::strtoupper(self::substr($str, 0, 1)).self::substr($str, 1); |
|
| 6478 | 6478 | } |
| 6479 | 6479 | |
| 6480 | 6480 | /** |
@@ -6925,7 +6925,7 @@ discard block |
||
| 6925 | 6925 | return ''; |
| 6926 | 6926 | } |
| 6927 | 6927 | |
| 6928 | - preg_match('/^\s*+(?:\S++\s*+){1,' . $words . '}/u', $str, $matches); |
|
| 6928 | + preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $str, $matches); |
|
| 6929 | 6929 | |
| 6930 | 6930 | if ( |
| 6931 | 6931 | !isset($matches[0]) |
@@ -6935,7 +6935,7 @@ discard block |
||
| 6935 | 6935 | return $str; |
| 6936 | 6936 | } |
| 6937 | 6937 | |
| 6938 | - return self::rtrim($matches[0]) . $strAddOn; |
|
| 6938 | + return self::rtrim($matches[0]).$strAddOn; |
|
| 6939 | 6939 | } |
| 6940 | 6940 | |
| 6941 | 6941 | /** |
@@ -7017,7 +7017,7 @@ discard block |
||
| 7017 | 7017 | $strReturn .= $break; |
| 7018 | 7018 | } |
| 7019 | 7019 | |
| 7020 | - return $strReturn . implode('', $chars); |
|
| 7020 | + return $strReturn.implode('', $chars); |
|
| 7021 | 7021 | } |
| 7022 | 7022 | |
| 7023 | 7023 | /** |