@@ -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; |
@@ -364,10 +364,10 @@ discard block |
||
| 364 | 364 | && |
| 365 | 365 | self::$SUPPORT['mbstring'] === false |
| 366 | 366 | ) { |
| 367 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 367 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - $cacheKey = $code_point . $encoding; |
|
| 370 | + $cacheKey = $code_point.$encoding; |
|
| 371 | 371 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
| 372 | 372 | return $CHAR_CACHE[$cacheKey]; |
| 373 | 373 | } |
@@ -404,16 +404,16 @@ discard block |
||
| 404 | 404 | if ($code_point <= 0x7F) { |
| 405 | 405 | $chr = self::$CHR[$code_point]; |
| 406 | 406 | } elseif ($code_point <= 0x7FF) { |
| 407 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
| 407 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
| 408 | 408 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 409 | 409 | } elseif ($code_point <= 0xFFFF) { |
| 410 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
| 411 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 410 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
| 411 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 412 | 412 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 413 | 413 | } else { |
| 414 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
| 415 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 416 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 414 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
| 415 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
| 416 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 417 | 417 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 418 | 418 | } |
| 419 | 419 | |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | return \array_map( |
| 461 | - function ($data) { |
|
| 461 | + function($data) { |
|
| 462 | 462 | return UTF8::strlen($data, '8BIT'); |
| 463 | 463 | }, |
| 464 | 464 | self::split($str) |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | */ |
| 690 | 690 | public static function decimal_to_chr($int): string |
| 691 | 691 | { |
| 692 | - return self::html_entity_decode('&#' . $int . ';', ENT_QUOTES | ENT_HTML5); |
|
| 692 | + return self::html_entity_decode('&#'.$int.';', ENT_QUOTES | ENT_HTML5); |
|
| 693 | 693 | } |
| 694 | 694 | |
| 695 | 695 | /** |
@@ -764,7 +764,7 @@ discard block |
||
| 764 | 764 | && |
| 765 | 765 | self::$SUPPORT['mbstring'] === false |
| 766 | 766 | ) { |
| 767 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 767 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 768 | 768 | } |
| 769 | 769 | |
| 770 | 770 | $strEncoded = \mb_convert_encoding( |
@@ -934,7 +934,7 @@ discard block |
||
| 934 | 934 | ) { |
| 935 | 935 | // Prevent leading combining chars |
| 936 | 936 | // for NFC-safe concatenations. |
| 937 | - $var = $leading_combining . $var; |
|
| 937 | + $var = $leading_combining.$var; |
|
| 938 | 938 | } |
| 939 | 939 | } |
| 940 | 940 | |
@@ -1356,7 +1356,7 @@ discard block |
||
| 1356 | 1356 | */ |
| 1357 | 1357 | private static function getData(string $file) |
| 1358 | 1358 | { |
| 1359 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
| 1359 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
| 1360 | 1360 | if (\file_exists($file)) { |
| 1361 | 1361 | /** @noinspection PhpIncludeInspection */ |
| 1362 | 1362 | return require $file; |
@@ -1496,7 +1496,7 @@ discard block |
||
| 1496 | 1496 | return \implode( |
| 1497 | 1497 | '', |
| 1498 | 1498 | \array_map( |
| 1499 | - function ($data) use ($keepAsciiChars, $encoding) { |
|
| 1499 | + function($data) use ($keepAsciiChars, $encoding) { |
|
| 1500 | 1500 | return UTF8::single_chr_html_encode($data, $keepAsciiChars, $encoding); |
| 1501 | 1501 | }, |
| 1502 | 1502 | self::split($str) |
@@ -1610,7 +1610,7 @@ discard block |
||
| 1610 | 1610 | && |
| 1611 | 1611 | self::$SUPPORT['mbstring'] === false |
| 1612 | 1612 | ) { |
| 1613 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 1613 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 1614 | 1614 | } |
| 1615 | 1615 | |
| 1616 | 1616 | do { |
@@ -1618,7 +1618,7 @@ discard block |
||
| 1618 | 1618 | |
| 1619 | 1619 | $str = (string)\preg_replace_callback( |
| 1620 | 1620 | "/&#\d{2,6};/", |
| 1621 | - function ($matches) use ($encoding) { |
|
| 1621 | + function($matches) use ($encoding) { |
|
| 1622 | 1622 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
| 1623 | 1623 | |
| 1624 | 1624 | if ($returnTmp !== '"' && $returnTmp !== "'") { |
@@ -1940,9 +1940,9 @@ discard block |
||
| 1940 | 1940 | { |
| 1941 | 1941 | $hex = \dechex($int); |
| 1942 | 1942 | |
| 1943 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
| 1943 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
| 1944 | 1944 | |
| 1945 | - return $pfix . $hex; |
|
| 1945 | + return $pfix.$hex; |
|
| 1946 | 1946 | } |
| 1947 | 1947 | |
| 1948 | 1948 | /** |
@@ -2655,7 +2655,7 @@ discard block |
||
| 2655 | 2655 | $cleanUtf8 |
| 2656 | 2656 | ); |
| 2657 | 2657 | |
| 2658 | - return $strPartOne . $strPartTwo; |
|
| 2658 | + return $strPartOne.$strPartTwo; |
|
| 2659 | 2659 | } |
| 2660 | 2660 | |
| 2661 | 2661 | /** |
@@ -2743,7 +2743,7 @@ discard block |
||
| 2743 | 2743 | return \preg_replace('/^[\pZ\pC]+/u', '', $str); |
| 2744 | 2744 | } |
| 2745 | 2745 | |
| 2746 | - return \preg_replace('/^' . self::rxClass($chars) . '+/u', '', $str); |
|
| 2746 | + return \preg_replace('/^'.self::rxClass($chars).'+/u', '', $str); |
|
| 2747 | 2747 | } |
| 2748 | 2748 | |
| 2749 | 2749 | /** |
@@ -3076,7 +3076,7 @@ discard block |
||
| 3076 | 3076 | } |
| 3077 | 3077 | } |
| 3078 | 3078 | |
| 3079 | - $cacheKey = $chr_orig . $encoding; |
|
| 3079 | + $cacheKey = $chr_orig.$encoding; |
|
| 3080 | 3080 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
| 3081 | 3081 | return $CHAR_CACHE[$cacheKey]; |
| 3082 | 3082 | } |
@@ -3303,7 +3303,7 @@ discard block |
||
| 3303 | 3303 | if (\is_array($what) === true) { |
| 3304 | 3304 | /** @noinspection ForeachSourceInspection */ |
| 3305 | 3305 | foreach ($what as $item) { |
| 3306 | - $str = (string)\preg_replace('/(' . \preg_quote($item, '/') . ')+/', $item, $str); |
|
| 3306 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/', $item, $str); |
|
| 3307 | 3307 | } |
| 3308 | 3308 | } |
| 3309 | 3309 | |
@@ -3413,7 +3413,7 @@ discard block |
||
| 3413 | 3413 | return \preg_replace('/[\pZ\pC]+$/u', '', $str); |
| 3414 | 3414 | } |
| 3415 | 3415 | |
| 3416 | - return \preg_replace('/' . self::rxClass($chars) . '+$/u', '', $str); |
|
| 3416 | + return \preg_replace('/'.self::rxClass($chars).'+$/u', '', $str); |
|
| 3417 | 3417 | } |
| 3418 | 3418 | |
| 3419 | 3419 | /** |
@@ -3428,7 +3428,7 @@ discard block |
||
| 3428 | 3428 | { |
| 3429 | 3429 | static $RX_CLASSS_CACHE = []; |
| 3430 | 3430 | |
| 3431 | - $cacheKey = $s . $class; |
|
| 3431 | + $cacheKey = $s.$class; |
|
| 3432 | 3432 | |
| 3433 | 3433 | if (isset($RX_CLASSS_CACHE[$cacheKey])) { |
| 3434 | 3434 | return $RX_CLASSS_CACHE[$cacheKey]; |
@@ -3440,7 +3440,7 @@ discard block |
||
| 3440 | 3440 | /** @noinspection SuspiciousLoopInspection */ |
| 3441 | 3441 | foreach (self::str_split($s) as $s) { |
| 3442 | 3442 | if ('-' === $s) { |
| 3443 | - $class[0] = '-' . $class[0]; |
|
| 3443 | + $class[0] = '-'.$class[0]; |
|
| 3444 | 3444 | } elseif (!isset($s[2])) { |
| 3445 | 3445 | $class[0] .= \preg_quote($s, '/'); |
| 3446 | 3446 | } elseif (1 === self::strlen($s)) { |
@@ -3451,13 +3451,13 @@ discard block |
||
| 3451 | 3451 | } |
| 3452 | 3452 | |
| 3453 | 3453 | if ($class[0]) { |
| 3454 | - $class[0] = '[' . $class[0] . ']'; |
|
| 3454 | + $class[0] = '['.$class[0].']'; |
|
| 3455 | 3455 | } |
| 3456 | 3456 | |
| 3457 | 3457 | if (1 === \count($class)) { |
| 3458 | 3458 | $return = $class[0]; |
| 3459 | 3459 | } else { |
| 3460 | - $return = '(?:' . \implode('|', $class) . ')'; |
|
| 3460 | + $return = '(?:'.\implode('|', $class).')'; |
|
| 3461 | 3461 | } |
| 3462 | 3462 | |
| 3463 | 3463 | $RX_CLASSS_CACHE[$cacheKey] = $return; |
@@ -3476,7 +3476,7 @@ discard block |
||
| 3476 | 3476 | |
| 3477 | 3477 | echo '<pre>'; |
| 3478 | 3478 | foreach (self::$SUPPORT as $key => $value) { |
| 3479 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
| 3479 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
| 3480 | 3480 | } |
| 3481 | 3481 | echo '</pre>'; |
| 3482 | 3482 | } |
@@ -3508,7 +3508,7 @@ discard block |
||
| 3508 | 3508 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 3509 | 3509 | } |
| 3510 | 3510 | |
| 3511 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
| 3511 | + return '&#'.self::ord($char, $encoding).';'; |
|
| 3512 | 3512 | } |
| 3513 | 3513 | |
| 3514 | 3514 | /** |
@@ -3569,7 +3569,7 @@ discard block |
||
| 3569 | 3569 | ) { |
| 3570 | 3570 | |
| 3571 | 3571 | if (($str[$i + 1] & "\xC0") === "\x80") { |
| 3572 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
| 3572 | + $ret[] = $str[$i].$str[$i + 1]; |
|
| 3573 | 3573 | |
| 3574 | 3574 | $i++; |
| 3575 | 3575 | } |
@@ -3585,7 +3585,7 @@ discard block |
||
| 3585 | 3585 | && |
| 3586 | 3586 | ($str[$i + 2] & "\xC0") === "\x80" |
| 3587 | 3587 | ) { |
| 3588 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
| 3588 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
| 3589 | 3589 | |
| 3590 | 3590 | $i += 2; |
| 3591 | 3591 | } |
@@ -3603,7 +3603,7 @@ discard block |
||
| 3603 | 3603 | && |
| 3604 | 3604 | ($str[$i + 3] & "\xC0") === "\x80" |
| 3605 | 3605 | ) { |
| 3606 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
| 3606 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
| 3607 | 3607 | |
| 3608 | 3608 | $i += 3; |
| 3609 | 3609 | } |
@@ -3616,7 +3616,7 @@ discard block |
||
| 3616 | 3616 | $ret = \array_chunk($ret, $length); |
| 3617 | 3617 | |
| 3618 | 3618 | return \array_map( |
| 3619 | - function ($item) { |
|
| 3619 | + function($item) { |
|
| 3620 | 3620 | return \implode('', $item); |
| 3621 | 3621 | }, $ret |
| 3622 | 3622 | ); |
@@ -3726,7 +3726,7 @@ discard block |
||
| 3726 | 3726 | foreach (self::$ENCODINGS as $encodingTmp) { |
| 3727 | 3727 | # INFO: //IGNORE and //TRANSLIT still throw notice |
| 3728 | 3728 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 3729 | - if (\md5(@\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str)) === $md5) { |
|
| 3729 | + if (\md5(@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str)) === $md5) { |
|
| 3730 | 3730 | return $encodingTmp; |
| 3731 | 3731 | } |
| 3732 | 3732 | } |
@@ -3810,7 +3810,7 @@ discard block |
||
| 3810 | 3810 | if ('' === $s .= '') { |
| 3811 | 3811 | $s = '/^(?<=.)$/'; |
| 3812 | 3812 | } else { |
| 3813 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
| 3813 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
| 3814 | 3814 | } |
| 3815 | 3815 | } |
| 3816 | 3816 | |
@@ -3861,7 +3861,7 @@ discard block |
||
| 3861 | 3861 | } |
| 3862 | 3862 | |
| 3863 | 3863 | if (self::substr($str, $length - 1, 1) === ' ') { |
| 3864 | - return (string)self::substr($str, 0, $length - 1) . $strAddOn; |
|
| 3864 | + return (string)self::substr($str, 0, $length - 1).$strAddOn; |
|
| 3865 | 3865 | } |
| 3866 | 3866 | |
| 3867 | 3867 | $str = (string)self::substr($str, 0, $length); |
@@ -3870,9 +3870,9 @@ discard block |
||
| 3870 | 3870 | $new_str = \implode(' ', $array); |
| 3871 | 3871 | |
| 3872 | 3872 | if ($new_str === '') { |
| 3873 | - $str = (string)self::substr($str, 0, $length - 1) . $strAddOn; |
|
| 3873 | + $str = (string)self::substr($str, 0, $length - 1).$strAddOn; |
|
| 3874 | 3874 | } else { |
| 3875 | - $str = $new_str . $strAddOn; |
|
| 3875 | + $str = $new_str.$strAddOn; |
|
| 3876 | 3876 | } |
| 3877 | 3877 | |
| 3878 | 3878 | return $str; |
@@ -3927,7 +3927,7 @@ discard block |
||
| 3927 | 3927 | $pre = ''; |
| 3928 | 3928 | } |
| 3929 | 3929 | |
| 3930 | - return $pre . $str . $post; |
|
| 3930 | + return $pre.$str.$post; |
|
| 3931 | 3931 | } |
| 3932 | 3932 | |
| 3933 | 3933 | return $str; |
@@ -4081,7 +4081,7 @@ discard block |
||
| 4081 | 4081 | } |
| 4082 | 4082 | |
| 4083 | 4083 | /** @noinspection PhpInternalEntityUsedInspection */ |
| 4084 | - \preg_match_all('/' . self::GRAPHEME_CLUSTER_RX . '/u', $str, $a); |
|
| 4084 | + \preg_match_all('/'.self::GRAPHEME_CLUSTER_RX.'/u', $str, $a); |
|
| 4085 | 4085 | $a = $a[0]; |
| 4086 | 4086 | |
| 4087 | 4087 | if ($len === 1) { |
@@ -4306,7 +4306,7 @@ discard block |
||
| 4306 | 4306 | public static function strcmp(string $str1, string $str2): int |
| 4307 | 4307 | { |
| 4308 | 4308 | /** @noinspection PhpUndefinedClassInspection */ |
| 4309 | - return $str1 . '' === $str2 . '' ? 0 : \strcmp( |
|
| 4309 | + return $str1.'' === $str2.'' ? 0 : \strcmp( |
|
| 4310 | 4310 | \Normalizer::normalize($str1, \Normalizer::NFD), |
| 4311 | 4311 | \Normalizer::normalize($str2, \Normalizer::NFD) |
| 4312 | 4312 | ); |
@@ -4340,7 +4340,7 @@ discard block |
||
| 4340 | 4340 | return null; |
| 4341 | 4341 | } |
| 4342 | 4342 | |
| 4343 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $length)) { |
|
| 4343 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $length)) { |
|
| 4344 | 4344 | return self::strlen($length[1]); |
| 4345 | 4345 | } |
| 4346 | 4346 | |
@@ -4532,7 +4532,7 @@ discard block |
||
| 4532 | 4532 | && |
| 4533 | 4533 | self::$SUPPORT['mbstring'] === false |
| 4534 | 4534 | ) { |
| 4535 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 4535 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 4536 | 4536 | } |
| 4537 | 4537 | |
| 4538 | 4538 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -4551,7 +4551,7 @@ discard block |
||
| 4551 | 4551 | return \stristr($haystack, $needle, $before_needle); |
| 4552 | 4552 | } |
| 4553 | 4553 | |
| 4554 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
| 4554 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
| 4555 | 4555 | |
| 4556 | 4556 | if (!isset($match[1])) { |
| 4557 | 4557 | return false; |
@@ -4618,7 +4618,7 @@ discard block |
||
| 4618 | 4618 | && |
| 4619 | 4619 | self::$SUPPORT['iconv'] === false |
| 4620 | 4620 | ) { |
| 4621 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 4621 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 4622 | 4622 | } |
| 4623 | 4623 | |
| 4624 | 4624 | if ( |
@@ -4722,7 +4722,7 @@ discard block |
||
| 4722 | 4722 | */ |
| 4723 | 4723 | public static function strnatcmp(string $str1, string $str2): int |
| 4724 | 4724 | { |
| 4725 | - return $str1 . '' === $str2 . '' ? 0 : \strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
| 4725 | + return $str1.'' === $str2.'' ? 0 : \strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
| 4726 | 4726 | } |
| 4727 | 4727 | |
| 4728 | 4728 | /** |
@@ -4780,7 +4780,7 @@ discard block |
||
| 4780 | 4780 | return false; |
| 4781 | 4781 | } |
| 4782 | 4782 | |
| 4783 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
| 4783 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
| 4784 | 4784 | return \substr($haystack, \strpos($haystack, $m[0])); |
| 4785 | 4785 | } |
| 4786 | 4786 | |
@@ -4844,7 +4844,7 @@ discard block |
||
| 4844 | 4844 | && |
| 4845 | 4845 | self::$SUPPORT['mbstring'] === false |
| 4846 | 4846 | ) { |
| 4847 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 4847 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 4848 | 4848 | } |
| 4849 | 4849 | |
| 4850 | 4850 | if ( |
@@ -5065,7 +5065,7 @@ discard block |
||
| 5065 | 5065 | && |
| 5066 | 5066 | self::$SUPPORT['mbstring'] === false |
| 5067 | 5067 | ) { |
| 5068 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 5068 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 5069 | 5069 | } |
| 5070 | 5070 | |
| 5071 | 5071 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -5136,7 +5136,7 @@ discard block |
||
| 5136 | 5136 | && |
| 5137 | 5137 | self::$SUPPORT['mbstring'] === false |
| 5138 | 5138 | ) { |
| 5139 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 5139 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 5140 | 5140 | } |
| 5141 | 5141 | |
| 5142 | 5142 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -5201,7 +5201,7 @@ discard block |
||
| 5201 | 5201 | return 0; |
| 5202 | 5202 | } |
| 5203 | 5203 | |
| 5204 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
| 5204 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
| 5205 | 5205 | } |
| 5206 | 5206 | |
| 5207 | 5207 | /** |
@@ -5244,7 +5244,7 @@ discard block |
||
| 5244 | 5244 | && |
| 5245 | 5245 | self::$SUPPORT['mbstring'] === false |
| 5246 | 5246 | ) { |
| 5247 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 5247 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 5248 | 5248 | } |
| 5249 | 5249 | |
| 5250 | 5250 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -5259,7 +5259,7 @@ discard block |
||
| 5259 | 5259 | return \grapheme_strstr($haystack, $needle, $before_needle); |
| 5260 | 5260 | } |
| 5261 | 5261 | |
| 5262 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
| 5262 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
| 5263 | 5263 | |
| 5264 | 5264 | if (!isset($match[1])) { |
| 5265 | 5265 | return false; |
@@ -5356,9 +5356,9 @@ discard block |
||
| 5356 | 5356 | |
| 5357 | 5357 | if (self::$SUPPORT['intl'] === true) { |
| 5358 | 5358 | |
| 5359 | - $langCode = $lang . '-Lower'; |
|
| 5359 | + $langCode = $lang.'-Lower'; |
|
| 5360 | 5360 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
| 5361 | - \trigger_error('UTF8::strtolower() without intl for special language: ' . $lang, E_USER_WARNING); |
|
| 5361 | + \trigger_error('UTF8::strtolower() without intl for special language: '.$lang, E_USER_WARNING); |
|
| 5362 | 5362 | |
| 5363 | 5363 | $langCode = 'Any-Lower'; |
| 5364 | 5364 | } |
@@ -5366,7 +5366,7 @@ discard block |
||
| 5366 | 5366 | return transliterator_transliterate($langCode, $str); |
| 5367 | 5367 | } |
| 5368 | 5368 | |
| 5369 | - \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: ' . $lang, E_USER_WARNING); |
|
| 5369 | + \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: '.$lang, E_USER_WARNING); |
|
| 5370 | 5370 | } |
| 5371 | 5371 | |
| 5372 | 5372 | return \mb_strtolower($str, $encoding); |
@@ -5421,9 +5421,9 @@ discard block |
||
| 5421 | 5421 | |
| 5422 | 5422 | if (self::$SUPPORT['intl'] === true) { |
| 5423 | 5423 | |
| 5424 | - $langCode = $lang . '-Upper'; |
|
| 5424 | + $langCode = $lang.'-Upper'; |
|
| 5425 | 5425 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
| 5426 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, E_USER_WARNING); |
|
| 5426 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, E_USER_WARNING); |
|
| 5427 | 5427 | |
| 5428 | 5428 | $langCode = 'Any-Upper'; |
| 5429 | 5429 | } |
@@ -5431,7 +5431,7 @@ discard block |
||
| 5431 | 5431 | return transliterator_transliterate($langCode, $str); |
| 5432 | 5432 | } |
| 5433 | 5433 | |
| 5434 | - \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: ' . $lang, E_USER_WARNING); |
|
| 5434 | + \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: '.$lang, E_USER_WARNING); |
|
| 5435 | 5435 | } |
| 5436 | 5436 | |
| 5437 | 5437 | return \mb_strtoupper($str, $encoding); |
@@ -5620,7 +5620,7 @@ discard block |
||
| 5620 | 5620 | && |
| 5621 | 5621 | self::$SUPPORT['mbstring'] === false |
| 5622 | 5622 | ) { |
| 5623 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 5623 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 5624 | 5624 | } |
| 5625 | 5625 | |
| 5626 | 5626 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -5648,8 +5648,7 @@ discard block |
||
| 5648 | 5648 | |
| 5649 | 5649 | if (self::is_ascii($str)) { |
| 5650 | 5650 | return ($length === null) ? |
| 5651 | - \substr($str, $offset) : |
|
| 5652 | - \substr($str, $offset, $length); |
|
| 5651 | + \substr($str, $offset) : \substr($str, $offset, $length); |
|
| 5653 | 5652 | } |
| 5654 | 5653 | |
| 5655 | 5654 | // fallback via vanilla php |
@@ -5777,14 +5776,14 @@ discard block |
||
| 5777 | 5776 | && |
| 5778 | 5777 | self::$SUPPORT['mbstring'] === false |
| 5779 | 5778 | ) { |
| 5780 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 5779 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 5781 | 5780 | } |
| 5782 | 5781 | |
| 5783 | 5782 | if (self::$SUPPORT['mbstring'] === true) { |
| 5784 | 5783 | return \mb_substr_count($haystack, $needle, $encoding); |
| 5785 | 5784 | } |
| 5786 | 5785 | |
| 5787 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, PREG_SET_ORDER); |
|
| 5786 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, PREG_SET_ORDER); |
|
| 5788 | 5787 | |
| 5789 | 5788 | return \count($matches); |
| 5790 | 5789 | } |
@@ -5962,8 +5961,7 @@ discard block |
||
| 5962 | 5961 | |
| 5963 | 5962 | if (self::is_ascii($str)) { |
| 5964 | 5963 | return ($length === null) ? |
| 5965 | - \substr_replace($str, $replacement, $offset) : |
|
| 5966 | - \substr_replace($str, $replacement, $offset, $length); |
|
| 5964 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
| 5967 | 5965 | } |
| 5968 | 5966 | |
| 5969 | 5967 | \preg_match_all('/./us', $str, $smatches); |
@@ -6034,7 +6032,7 @@ discard block |
||
| 6034 | 6032 | |
| 6035 | 6033 | $strSwappedCase = \preg_replace_callback( |
| 6036 | 6034 | '/[\S]/u', |
| 6037 | - function ($match) use ($encoding) { |
|
| 6035 | + function($match) use ($encoding) { |
|
| 6038 | 6036 | $marchToUpper = UTF8::strtoupper($match[0], $encoding); |
| 6039 | 6037 | |
| 6040 | 6038 | if ($match[0] === $marchToUpper) { |
@@ -6360,7 +6358,7 @@ discard block |
||
| 6360 | 6358 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
| 6361 | 6359 | |
| 6362 | 6360 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 6363 | - $buf .= $c1 . $c2; |
|
| 6361 | + $buf .= $c1.$c2; |
|
| 6364 | 6362 | $i++; |
| 6365 | 6363 | } else { // not valid UTF8 - convert it |
| 6366 | 6364 | $buf .= self::to_utf8_convert($c1); |
@@ -6372,7 +6370,7 @@ discard block |
||
| 6372 | 6370 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
| 6373 | 6371 | |
| 6374 | 6372 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 6375 | - $buf .= $c1 . $c2 . $c3; |
|
| 6373 | + $buf .= $c1.$c2.$c3; |
|
| 6376 | 6374 | $i += 2; |
| 6377 | 6375 | } else { // not valid UTF8 - convert it |
| 6378 | 6376 | $buf .= self::to_utf8_convert($c1); |
@@ -6385,7 +6383,7 @@ discard block |
||
| 6385 | 6383 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
| 6386 | 6384 | |
| 6387 | 6385 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 6388 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
| 6386 | + $buf .= $c1.$c2.$c3.$c4; |
|
| 6389 | 6387 | $i += 3; |
| 6390 | 6388 | } else { // not valid UTF8 - convert it |
| 6391 | 6389 | $buf .= self::to_utf8_convert($c1); |
@@ -6407,7 +6405,7 @@ discard block |
||
| 6407 | 6405 | // decode unicode escape sequences |
| 6408 | 6406 | $buf = \preg_replace_callback( |
| 6409 | 6407 | '/\\\\u([0-9a-f]{4})/i', |
| 6410 | - function ($match) { |
|
| 6408 | + function($match) { |
|
| 6411 | 6409 | return \mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); |
| 6412 | 6410 | }, |
| 6413 | 6411 | $buf |
@@ -6449,7 +6447,7 @@ discard block |
||
| 6449 | 6447 | } else { |
| 6450 | 6448 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
| 6451 | 6449 | $cc2 = ($int & "\x3F") | "\x80"; |
| 6452 | - $buf .= $cc1 . $cc2; |
|
| 6450 | + $buf .= $cc1.$cc2; |
|
| 6453 | 6451 | } |
| 6454 | 6452 | |
| 6455 | 6453 | return $buf; |
@@ -6510,7 +6508,7 @@ discard block |
||
| 6510 | 6508 | $cleanUtf8 |
| 6511 | 6509 | ); |
| 6512 | 6510 | |
| 6513 | - return $strPartOne . $strPartTwo; |
|
| 6511 | + return $strPartOne.$strPartTwo; |
|
| 6514 | 6512 | } |
| 6515 | 6513 | |
| 6516 | 6514 | /** |
@@ -6555,7 +6553,7 @@ discard block |
||
| 6555 | 6553 | $str = self::clean($str); |
| 6556 | 6554 | } |
| 6557 | 6555 | |
| 6558 | - $usePhpDefaultFunctions = !(bool)($charlist . \implode('', $exceptions)); |
|
| 6556 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
| 6559 | 6557 | |
| 6560 | 6558 | if ( |
| 6561 | 6559 | $usePhpDefaultFunctions === true |
@@ -7057,7 +7055,7 @@ discard block |
||
| 7057 | 7055 | return ''; |
| 7058 | 7056 | } |
| 7059 | 7057 | |
| 7060 | - \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches); |
|
| 7058 | + \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches); |
|
| 7061 | 7059 | |
| 7062 | 7060 | if ( |
| 7063 | 7061 | !isset($matches[0]) |
@@ -7067,7 +7065,7 @@ discard block |
||
| 7067 | 7065 | return $str; |
| 7068 | 7066 | } |
| 7069 | 7067 | |
| 7070 | - return self::rtrim($matches[0]) . $strAddOn; |
|
| 7068 | + return self::rtrim($matches[0]).$strAddOn; |
|
| 7071 | 7069 | } |
| 7072 | 7070 | |
| 7073 | 7071 | /** |
@@ -7132,7 +7130,7 @@ discard block |
||
| 7132 | 7130 | $strReturn .= $break; |
| 7133 | 7131 | } |
| 7134 | 7132 | |
| 7135 | - return $strReturn . \implode('', $chars); |
|
| 7133 | + return $strReturn.\implode('', $chars); |
|
| 7136 | 7134 | } |
| 7137 | 7135 | |
| 7138 | 7136 | /** |