@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace voku\helper; |
6 | 6 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | public static function add_bom_to_string(string $str): string |
244 | 244 | { |
245 | 245 | if (self::string_has_bom($str) === false) { |
246 | - $str = self::bom() . $str; |
|
246 | + $str = self::bom().$str; |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | return $str; |
@@ -399,10 +399,10 @@ discard block |
||
399 | 399 | && |
400 | 400 | self::$SUPPORT['mbstring'] === false |
401 | 401 | ) { |
402 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
402 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
403 | 403 | } |
404 | 404 | |
405 | - $cacheKey = $code_point . $encoding; |
|
405 | + $cacheKey = $code_point.$encoding; |
|
406 | 406 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
407 | 407 | return $CHAR_CACHE[$cacheKey]; |
408 | 408 | } |
@@ -439,16 +439,16 @@ discard block |
||
439 | 439 | if ($code_point <= 0x7F) { |
440 | 440 | $chr = self::$CHR[$code_point]; |
441 | 441 | } elseif ($code_point <= 0x7FF) { |
442 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
442 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
443 | 443 | self::$CHR[($code_point & 0x3F) + 0x80]; |
444 | 444 | } elseif ($code_point <= 0xFFFF) { |
445 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
446 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
445 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
446 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
447 | 447 | self::$CHR[($code_point & 0x3F) + 0x80]; |
448 | 448 | } else { |
449 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
450 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
451 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
449 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
450 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
451 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
452 | 452 | self::$CHR[($code_point & 0x3F) + 0x80]; |
453 | 453 | } |
454 | 454 | |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | |
497 | 497 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
498 | 498 | return \array_map( |
499 | - function ($data) { |
|
499 | + function($data) { |
|
500 | 500 | return UTF8::strlen($data, 'CP850'); // 8-BIT |
501 | 501 | }, |
502 | 502 | $strSplit |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | } |
505 | 505 | |
506 | 506 | return \array_map( |
507 | - function ($data) { |
|
507 | + function($data) { |
|
508 | 508 | return \strlen($data); |
509 | 509 | }, |
510 | 510 | $strSplit |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | */ |
756 | 756 | public static function decimal_to_chr($int): string |
757 | 757 | { |
758 | - return self::html_entity_decode('&#' . $int . ';', ENT_QUOTES | ENT_HTML5); |
|
758 | + return self::html_entity_decode('&#'.$int.';', ENT_QUOTES | ENT_HTML5); |
|
759 | 759 | } |
760 | 760 | |
761 | 761 | /** |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | && |
829 | 829 | self::$SUPPORT['mbstring'] === false |
830 | 830 | ) { |
831 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
831 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
832 | 832 | } |
833 | 833 | |
834 | 834 | $strEncoded = \mb_convert_encoding( |
@@ -998,7 +998,7 @@ discard block |
||
998 | 998 | ) { |
999 | 999 | // Prevent leading combining chars |
1000 | 1000 | // for NFC-safe concatenations. |
1001 | - $var = $leading_combining . $var; |
|
1001 | + $var = $leading_combining.$var; |
|
1002 | 1002 | } |
1003 | 1003 | } |
1004 | 1004 | |
@@ -1420,7 +1420,7 @@ discard block |
||
1420 | 1420 | */ |
1421 | 1421 | private static function getData(string $file) |
1422 | 1422 | { |
1423 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
1423 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
1424 | 1424 | if (\file_exists($file)) { |
1425 | 1425 | /** @noinspection PhpIncludeInspection */ |
1426 | 1426 | return require $file; |
@@ -1560,7 +1560,7 @@ discard block |
||
1560 | 1560 | return \implode( |
1561 | 1561 | '', |
1562 | 1562 | \array_map( |
1563 | - function ($data) use ($keepAsciiChars, $encoding) { |
|
1563 | + function($data) use ($keepAsciiChars, $encoding) { |
|
1564 | 1564 | return UTF8::single_chr_html_encode($data, $keepAsciiChars, $encoding); |
1565 | 1565 | }, |
1566 | 1566 | self::split($str) |
@@ -1676,7 +1676,7 @@ discard block |
||
1676 | 1676 | && |
1677 | 1677 | self::$SUPPORT['mbstring'] === false |
1678 | 1678 | ) { |
1679 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
1679 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
1680 | 1680 | } |
1681 | 1681 | |
1682 | 1682 | do { |
@@ -1684,7 +1684,7 @@ discard block |
||
1684 | 1684 | |
1685 | 1685 | $str = (string)\preg_replace_callback( |
1686 | 1686 | "/&#\d{2,6};/", |
1687 | - function ($matches) use ($encoding) { |
|
1687 | + function($matches) use ($encoding) { |
|
1688 | 1688 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
1689 | 1689 | |
1690 | 1690 | if ($returnTmp !== '"' && $returnTmp !== "'") { |
@@ -1988,9 +1988,9 @@ discard block |
||
1988 | 1988 | { |
1989 | 1989 | $hex = \dechex($int); |
1990 | 1990 | |
1991 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
1991 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
1992 | 1992 | |
1993 | - return $pfix . $hex; |
|
1993 | + return $pfix.$hex; |
|
1994 | 1994 | } |
1995 | 1995 | |
1996 | 1996 | /** |
@@ -2734,7 +2734,7 @@ discard block |
||
2734 | 2734 | $cleanUtf8 |
2735 | 2735 | ); |
2736 | 2736 | |
2737 | - return $strPartOne . $strPartTwo; |
|
2737 | + return $strPartOne.$strPartTwo; |
|
2738 | 2738 | } |
2739 | 2739 | |
2740 | 2740 | /** |
@@ -2822,7 +2822,7 @@ discard block |
||
2822 | 2822 | return \preg_replace('/^[\pZ\pC]+/u', '', $str); |
2823 | 2823 | } |
2824 | 2824 | |
2825 | - return \preg_replace('/^' . self::rxClass($chars) . '+/u', '', $str); |
|
2825 | + return \preg_replace('/^'.self::rxClass($chars).'+/u', '', $str); |
|
2826 | 2826 | } |
2827 | 2827 | |
2828 | 2828 | /** |
@@ -3136,7 +3136,7 @@ discard block |
||
3136 | 3136 | } |
3137 | 3137 | } |
3138 | 3138 | |
3139 | - $cacheKey = $chr_orig . $encoding; |
|
3139 | + $cacheKey = $chr_orig.$encoding; |
|
3140 | 3140 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
3141 | 3141 | return $CHAR_CACHE[$cacheKey]; |
3142 | 3142 | } |
@@ -3363,7 +3363,7 @@ discard block |
||
3363 | 3363 | if (\is_array($what) === true) { |
3364 | 3364 | /** @noinspection ForeachSourceInspection */ |
3365 | 3365 | foreach ($what as $item) { |
3366 | - $str = (string)\preg_replace('/(' . \preg_quote($item, '/') . ')+/', $item, $str); |
|
3366 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/', $item, $str); |
|
3367 | 3367 | } |
3368 | 3368 | } |
3369 | 3369 | |
@@ -3473,7 +3473,7 @@ discard block |
||
3473 | 3473 | return \preg_replace('/[\pZ\pC]+$/u', '', $str); |
3474 | 3474 | } |
3475 | 3475 | |
3476 | - return \preg_replace('/' . self::rxClass($chars) . '+$/u', '', $str); |
|
3476 | + return \preg_replace('/'.self::rxClass($chars).'+$/u', '', $str); |
|
3477 | 3477 | } |
3478 | 3478 | |
3479 | 3479 | /** |
@@ -3488,7 +3488,7 @@ discard block |
||
3488 | 3488 | { |
3489 | 3489 | static $RX_CLASSS_CACHE = []; |
3490 | 3490 | |
3491 | - $cacheKey = $s . $class; |
|
3491 | + $cacheKey = $s.$class; |
|
3492 | 3492 | |
3493 | 3493 | if (isset($RX_CLASSS_CACHE[$cacheKey])) { |
3494 | 3494 | return $RX_CLASSS_CACHE[$cacheKey]; |
@@ -3500,7 +3500,7 @@ discard block |
||
3500 | 3500 | /** @noinspection SuspiciousLoopInspection */ |
3501 | 3501 | foreach (self::str_split($s) as $s) { |
3502 | 3502 | if ('-' === $s) { |
3503 | - $class[0] = '-' . $class[0]; |
|
3503 | + $class[0] = '-'.$class[0]; |
|
3504 | 3504 | } elseif (!isset($s[2])) { |
3505 | 3505 | $class[0] .= \preg_quote($s, '/'); |
3506 | 3506 | } elseif (1 === self::strlen($s)) { |
@@ -3511,13 +3511,13 @@ discard block |
||
3511 | 3511 | } |
3512 | 3512 | |
3513 | 3513 | if ($class[0]) { |
3514 | - $class[0] = '[' . $class[0] . ']'; |
|
3514 | + $class[0] = '['.$class[0].']'; |
|
3515 | 3515 | } |
3516 | 3516 | |
3517 | 3517 | if (1 === \count($class)) { |
3518 | 3518 | $return = $class[0]; |
3519 | 3519 | } else { |
3520 | - $return = '(?:' . \implode('|', $class) . ')'; |
|
3520 | + $return = '(?:'.\implode('|', $class).')'; |
|
3521 | 3521 | } |
3522 | 3522 | |
3523 | 3523 | $RX_CLASSS_CACHE[$cacheKey] = $return; |
@@ -3536,7 +3536,7 @@ discard block |
||
3536 | 3536 | |
3537 | 3537 | echo '<pre>'; |
3538 | 3538 | foreach (self::$SUPPORT as $key => $value) { |
3539 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
3539 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
3540 | 3540 | } |
3541 | 3541 | echo '</pre>'; |
3542 | 3542 | } |
@@ -3568,7 +3568,7 @@ discard block |
||
3568 | 3568 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
3569 | 3569 | } |
3570 | 3570 | |
3571 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
3571 | + return '&#'.self::ord($char, $encoding).';'; |
|
3572 | 3572 | } |
3573 | 3573 | |
3574 | 3574 | /** |
@@ -3629,7 +3629,7 @@ discard block |
||
3629 | 3629 | ) { |
3630 | 3630 | |
3631 | 3631 | if (($str[$i + 1] & "\xC0") === "\x80") { |
3632 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
3632 | + $ret[] = $str[$i].$str[$i + 1]; |
|
3633 | 3633 | |
3634 | 3634 | $i++; |
3635 | 3635 | } |
@@ -3645,7 +3645,7 @@ discard block |
||
3645 | 3645 | && |
3646 | 3646 | ($str[$i + 2] & "\xC0") === "\x80" |
3647 | 3647 | ) { |
3648 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
3648 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
3649 | 3649 | |
3650 | 3650 | $i += 2; |
3651 | 3651 | } |
@@ -3663,7 +3663,7 @@ discard block |
||
3663 | 3663 | && |
3664 | 3664 | ($str[$i + 3] & "\xC0") === "\x80" |
3665 | 3665 | ) { |
3666 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
3666 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
3667 | 3667 | |
3668 | 3668 | $i += 3; |
3669 | 3669 | } |
@@ -3676,7 +3676,7 @@ discard block |
||
3676 | 3676 | $ret = \array_chunk($ret, $length); |
3677 | 3677 | |
3678 | 3678 | return \array_map( |
3679 | - function ($item) { |
|
3679 | + function($item) { |
|
3680 | 3680 | return \implode('', $item); |
3681 | 3681 | }, $ret |
3682 | 3682 | ); |
@@ -3788,7 +3788,7 @@ discard block |
||
3788 | 3788 | foreach (self::$ENCODINGS as $encodingTmp) { |
3789 | 3789 | # INFO: //IGNORE and //TRANSLIT still throw notice |
3790 | 3790 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
3791 | - if (\md5(@\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str)) === $md5) { |
|
3791 | + if (\md5(@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str)) === $md5) { |
|
3792 | 3792 | return $encodingTmp; |
3793 | 3793 | } |
3794 | 3794 | } |
@@ -3872,7 +3872,7 @@ discard block |
||
3872 | 3872 | if ('' === $s .= '') { |
3873 | 3873 | $s = '/^(?<=.)$/'; |
3874 | 3874 | } else { |
3875 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
3875 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
3876 | 3876 | } |
3877 | 3877 | } |
3878 | 3878 | |
@@ -3923,7 +3923,7 @@ discard block |
||
3923 | 3923 | } |
3924 | 3924 | |
3925 | 3925 | if (self::substr($str, $length - 1, 1) === ' ') { |
3926 | - return (string)self::substr($str, 0, $length - 1) . $strAddOn; |
|
3926 | + return (string)self::substr($str, 0, $length - 1).$strAddOn; |
|
3927 | 3927 | } |
3928 | 3928 | |
3929 | 3929 | $str = (string)self::substr($str, 0, $length); |
@@ -3932,9 +3932,9 @@ discard block |
||
3932 | 3932 | $new_str = \implode(' ', $array); |
3933 | 3933 | |
3934 | 3934 | if ($new_str === '') { |
3935 | - $str = (string)self::substr($str, 0, $length - 1) . $strAddOn; |
|
3935 | + $str = (string)self::substr($str, 0, $length - 1).$strAddOn; |
|
3936 | 3936 | } else { |
3937 | - $str = $new_str . $strAddOn; |
|
3937 | + $str = $new_str.$strAddOn; |
|
3938 | 3938 | } |
3939 | 3939 | |
3940 | 3940 | return $str; |
@@ -3989,7 +3989,7 @@ discard block |
||
3989 | 3989 | $pre = ''; |
3990 | 3990 | } |
3991 | 3991 | |
3992 | - return $pre . $str . $post; |
|
3992 | + return $pre.$str.$post; |
|
3993 | 3993 | } |
3994 | 3994 | |
3995 | 3995 | return $str; |
@@ -4143,7 +4143,7 @@ discard block |
||
4143 | 4143 | } |
4144 | 4144 | |
4145 | 4145 | /** @noinspection PhpInternalEntityUsedInspection */ |
4146 | - \preg_match_all('/' . self::GRAPHEME_CLUSTER_RX . '/u', $str, $a); |
|
4146 | + \preg_match_all('/'.self::GRAPHEME_CLUSTER_RX.'/u', $str, $a); |
|
4147 | 4147 | $a = $a[0]; |
4148 | 4148 | |
4149 | 4149 | if ($len === 1) { |
@@ -4368,7 +4368,7 @@ discard block |
||
4368 | 4368 | public static function strcmp(string $str1, string $str2): int |
4369 | 4369 | { |
4370 | 4370 | /** @noinspection PhpUndefinedClassInspection */ |
4371 | - return $str1 . '' === $str2 . '' ? 0 : \strcmp( |
|
4371 | + return $str1.'' === $str2.'' ? 0 : \strcmp( |
|
4372 | 4372 | \Normalizer::normalize($str1, \Normalizer::NFD), |
4373 | 4373 | \Normalizer::normalize($str2, \Normalizer::NFD) |
4374 | 4374 | ); |
@@ -4402,7 +4402,7 @@ discard block |
||
4402 | 4402 | return null; |
4403 | 4403 | } |
4404 | 4404 | |
4405 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $length)) { |
|
4405 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $length)) { |
|
4406 | 4406 | return self::strlen($length[1]); |
4407 | 4407 | } |
4408 | 4408 | |
@@ -4612,7 +4612,7 @@ discard block |
||
4612 | 4612 | && |
4613 | 4613 | self::$SUPPORT['mbstring'] === false |
4614 | 4614 | ) { |
4615 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
4615 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
4616 | 4616 | } |
4617 | 4617 | |
4618 | 4618 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -4631,7 +4631,7 @@ discard block |
||
4631 | 4631 | return \stristr($haystack, $needle, $before_needle); |
4632 | 4632 | } |
4633 | 4633 | |
4634 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
4634 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
4635 | 4635 | |
4636 | 4636 | if (!isset($match[1])) { |
4637 | 4637 | return false; |
@@ -4697,7 +4697,7 @@ discard block |
||
4697 | 4697 | && |
4698 | 4698 | self::$SUPPORT['iconv'] === false |
4699 | 4699 | ) { |
4700 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
4700 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
4701 | 4701 | } |
4702 | 4702 | |
4703 | 4703 | if ( |
@@ -4801,7 +4801,7 @@ discard block |
||
4801 | 4801 | */ |
4802 | 4802 | public static function strnatcmp(string $str1, string $str2): int |
4803 | 4803 | { |
4804 | - return $str1 . '' === $str2 . '' ? 0 : \strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
4804 | + return $str1.'' === $str2.'' ? 0 : \strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
4805 | 4805 | } |
4806 | 4806 | |
4807 | 4807 | /** |
@@ -4859,7 +4859,7 @@ discard block |
||
4859 | 4859 | return false; |
4860 | 4860 | } |
4861 | 4861 | |
4862 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
4862 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
4863 | 4863 | return \substr($haystack, \strpos($haystack, $m[0])); |
4864 | 4864 | } |
4865 | 4865 | |
@@ -4923,7 +4923,7 @@ discard block |
||
4923 | 4923 | && |
4924 | 4924 | self::$SUPPORT['mbstring'] === false |
4925 | 4925 | ) { |
4926 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
4926 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
4927 | 4927 | } |
4928 | 4928 | |
4929 | 4929 | if ( |
@@ -5144,7 +5144,7 @@ discard block |
||
5144 | 5144 | && |
5145 | 5145 | self::$SUPPORT['mbstring'] === false |
5146 | 5146 | ) { |
5147 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
5147 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
5148 | 5148 | } |
5149 | 5149 | |
5150 | 5150 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -5215,7 +5215,7 @@ discard block |
||
5215 | 5215 | && |
5216 | 5216 | self::$SUPPORT['mbstring'] === false |
5217 | 5217 | ) { |
5218 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
5218 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
5219 | 5219 | } |
5220 | 5220 | |
5221 | 5221 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -5280,7 +5280,7 @@ discard block |
||
5280 | 5280 | return 0; |
5281 | 5281 | } |
5282 | 5282 | |
5283 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
5283 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
5284 | 5284 | } |
5285 | 5285 | |
5286 | 5286 | /** |
@@ -5323,7 +5323,7 @@ discard block |
||
5323 | 5323 | && |
5324 | 5324 | self::$SUPPORT['mbstring'] === false |
5325 | 5325 | ) { |
5326 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
5326 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
5327 | 5327 | } |
5328 | 5328 | |
5329 | 5329 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -5338,7 +5338,7 @@ discard block |
||
5338 | 5338 | return \grapheme_strstr($haystack, $needle, $before_needle); |
5339 | 5339 | } |
5340 | 5340 | |
5341 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
5341 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
5342 | 5342 | |
5343 | 5343 | if (!isset($match[1])) { |
5344 | 5344 | return false; |
@@ -5435,9 +5435,9 @@ discard block |
||
5435 | 5435 | |
5436 | 5436 | if (self::$SUPPORT['intl'] === true) { |
5437 | 5437 | |
5438 | - $langCode = $lang . '-Lower'; |
|
5438 | + $langCode = $lang.'-Lower'; |
|
5439 | 5439 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
5440 | - \trigger_error('UTF8::strtolower() without intl for special language: ' . $lang, E_USER_WARNING); |
|
5440 | + \trigger_error('UTF8::strtolower() without intl for special language: '.$lang, E_USER_WARNING); |
|
5441 | 5441 | |
5442 | 5442 | $langCode = 'Any-Lower'; |
5443 | 5443 | } |
@@ -5445,7 +5445,7 @@ discard block |
||
5445 | 5445 | return transliterator_transliterate($langCode, $str); |
5446 | 5446 | } |
5447 | 5447 | |
5448 | - \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: ' . $lang, E_USER_WARNING); |
|
5448 | + \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: '.$lang, E_USER_WARNING); |
|
5449 | 5449 | } |
5450 | 5450 | |
5451 | 5451 | return \mb_strtolower($str, $encoding); |
@@ -5500,9 +5500,9 @@ discard block |
||
5500 | 5500 | |
5501 | 5501 | if (self::$SUPPORT['intl'] === true) { |
5502 | 5502 | |
5503 | - $langCode = $lang . '-Upper'; |
|
5503 | + $langCode = $lang.'-Upper'; |
|
5504 | 5504 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
5505 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, E_USER_WARNING); |
|
5505 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, E_USER_WARNING); |
|
5506 | 5506 | |
5507 | 5507 | $langCode = 'Any-Upper'; |
5508 | 5508 | } |
@@ -5510,7 +5510,7 @@ discard block |
||
5510 | 5510 | return transliterator_transliterate($langCode, $str); |
5511 | 5511 | } |
5512 | 5512 | |
5513 | - \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: ' . $lang, E_USER_WARNING); |
|
5513 | + \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: '.$lang, E_USER_WARNING); |
|
5514 | 5514 | } |
5515 | 5515 | |
5516 | 5516 | return \mb_strtoupper($str, $encoding); |
@@ -5666,7 +5666,7 @@ discard block |
||
5666 | 5666 | && |
5667 | 5667 | self::$SUPPORT['mbstring'] === false |
5668 | 5668 | ) { |
5669 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
5669 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
5670 | 5670 | } |
5671 | 5671 | |
5672 | 5672 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -5694,8 +5694,7 @@ discard block |
||
5694 | 5694 | |
5695 | 5695 | if (self::is_ascii($str)) { |
5696 | 5696 | return ($length === null) ? |
5697 | - \substr($str, $offset) : |
|
5698 | - \substr($str, $offset, $length); |
|
5697 | + \substr($str, $offset) : \substr($str, $offset, $length); |
|
5699 | 5698 | } |
5700 | 5699 | |
5701 | 5700 | // fallback via vanilla php |
@@ -5823,14 +5822,14 @@ discard block |
||
5823 | 5822 | && |
5824 | 5823 | self::$SUPPORT['mbstring'] === false |
5825 | 5824 | ) { |
5826 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
5825 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
5827 | 5826 | } |
5828 | 5827 | |
5829 | 5828 | if (self::$SUPPORT['mbstring'] === true) { |
5830 | 5829 | return \mb_substr_count($haystack, $needle, $encoding); |
5831 | 5830 | } |
5832 | 5831 | |
5833 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, PREG_SET_ORDER); |
|
5832 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, PREG_SET_ORDER); |
|
5834 | 5833 | |
5835 | 5834 | return \count($matches); |
5836 | 5835 | } |
@@ -6008,8 +6007,7 @@ discard block |
||
6008 | 6007 | |
6009 | 6008 | if (self::is_ascii($str)) { |
6010 | 6009 | return ($length === null) ? |
6011 | - \substr_replace($str, $replacement, $offset) : |
|
6012 | - \substr_replace($str, $replacement, $offset, $length); |
|
6010 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
6013 | 6011 | } |
6014 | 6012 | |
6015 | 6013 | \preg_match_all('/./us', $str, $smatches); |
@@ -6080,7 +6078,7 @@ discard block |
||
6080 | 6078 | |
6081 | 6079 | $strSwappedCase = \preg_replace_callback( |
6082 | 6080 | '/[\S]/u', |
6083 | - function ($match) use ($encoding) { |
|
6081 | + function($match) use ($encoding) { |
|
6084 | 6082 | $marchToUpper = UTF8::strtoupper($match[0], $encoding); |
6085 | 6083 | |
6086 | 6084 | if ($match[0] === $marchToUpper) { |
@@ -6414,7 +6412,7 @@ discard block |
||
6414 | 6412 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
6415 | 6413 | |
6416 | 6414 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
6417 | - $buf .= $c1 . $c2; |
|
6415 | + $buf .= $c1.$c2; |
|
6418 | 6416 | $i++; |
6419 | 6417 | } else { // not valid UTF8 - convert it |
6420 | 6418 | $buf .= self::to_utf8_convert($c1); |
@@ -6426,7 +6424,7 @@ discard block |
||
6426 | 6424 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
6427 | 6425 | |
6428 | 6426 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
6429 | - $buf .= $c1 . $c2 . $c3; |
|
6427 | + $buf .= $c1.$c2.$c3; |
|
6430 | 6428 | $i += 2; |
6431 | 6429 | } else { // not valid UTF8 - convert it |
6432 | 6430 | $buf .= self::to_utf8_convert($c1); |
@@ -6439,7 +6437,7 @@ discard block |
||
6439 | 6437 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
6440 | 6438 | |
6441 | 6439 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
6442 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
6440 | + $buf .= $c1.$c2.$c3.$c4; |
|
6443 | 6441 | $i += 3; |
6444 | 6442 | } else { // not valid UTF8 - convert it |
6445 | 6443 | $buf .= self::to_utf8_convert($c1); |
@@ -6461,7 +6459,7 @@ discard block |
||
6461 | 6459 | // decode unicode escape sequences |
6462 | 6460 | $buf = \preg_replace_callback( |
6463 | 6461 | '/\\\\u([0-9a-f]{4})/i', |
6464 | - function ($match) { |
|
6462 | + function($match) { |
|
6465 | 6463 | return \mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); |
6466 | 6464 | }, |
6467 | 6465 | $buf |
@@ -6503,7 +6501,7 @@ discard block |
||
6503 | 6501 | } else { |
6504 | 6502 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
6505 | 6503 | $cc2 = ($int & "\x3F") | "\x80"; |
6506 | - $buf .= $cc1 . $cc2; |
|
6504 | + $buf .= $cc1.$cc2; |
|
6507 | 6505 | } |
6508 | 6506 | |
6509 | 6507 | return $buf; |
@@ -6564,7 +6562,7 @@ discard block |
||
6564 | 6562 | $cleanUtf8 |
6565 | 6563 | ); |
6566 | 6564 | |
6567 | - return $strPartOne . $strPartTwo; |
|
6565 | + return $strPartOne.$strPartTwo; |
|
6568 | 6566 | } |
6569 | 6567 | |
6570 | 6568 | /** |
@@ -6609,7 +6607,7 @@ discard block |
||
6609 | 6607 | $str = self::clean($str); |
6610 | 6608 | } |
6611 | 6609 | |
6612 | - $usePhpDefaultFunctions = !(bool)($charlist . \implode('', $exceptions)); |
|
6610 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
6613 | 6611 | |
6614 | 6612 | if ( |
6615 | 6613 | $usePhpDefaultFunctions === true |
@@ -7111,7 +7109,7 @@ discard block |
||
7111 | 7109 | return ''; |
7112 | 7110 | } |
7113 | 7111 | |
7114 | - \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches); |
|
7112 | + \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches); |
|
7115 | 7113 | |
7116 | 7114 | if ( |
7117 | 7115 | !isset($matches[0]) |
@@ -7121,7 +7119,7 @@ discard block |
||
7121 | 7119 | return $str; |
7122 | 7120 | } |
7123 | 7121 | |
7124 | - return self::rtrim($matches[0]) . $strAddOn; |
|
7122 | + return self::rtrim($matches[0]).$strAddOn; |
|
7125 | 7123 | } |
7126 | 7124 | |
7127 | 7125 | /** |
@@ -7186,7 +7184,7 @@ discard block |
||
7186 | 7184 | $strReturn .= $break; |
7187 | 7185 | } |
7188 | 7186 | |
7189 | - return $strReturn . \implode('', $chars); |
|
7187 | + return $strReturn.\implode('', $chars); |
|
7190 | 7188 | } |
7191 | 7189 | |
7192 | 7190 | /** |