@@ -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 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | $uri = (string)\preg_replace_callback( |
99 | 99 | '/[\x80-\xFF]+/', |
100 | - function ($m) { |
|
100 | + function($m) { |
|
101 | 101 | return \rawurlencode($m[0]); |
102 | 102 | }, |
103 | 103 | $uri |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | $uri = (string)\preg_replace_callback( |
107 | 107 | '/(?:%[89A-F][0-9A-F])+/i', |
108 | - function ($m) { |
|
108 | + function($m) { |
|
109 | 109 | return \rawurlencode(UTF8::rawurldecode($m[0])); |
110 | 110 | }, |
111 | 111 | $uri |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | ) { |
121 | 121 | // Use ob_start() to buffer content and avoid problem of headers already sent... |
122 | 122 | $severProtocol = ($_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'); |
123 | - \header($severProtocol . ' 301 Moved Permanently'); |
|
124 | - \header('Location: ' . $uri); |
|
123 | + \header($severProtocol.' 301 Moved Permanently'); |
|
124 | + \header('Location: '.$uri); |
|
125 | 125 | exit(); |
126 | 126 | } |
127 | 127 |
@@ -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( |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | ) { |
923 | 923 | // Prevent leading combining chars |
924 | 924 | // for NFC-safe concatenations. |
925 | - $var = $leading_combining . $var; |
|
925 | + $var = $leading_combining.$var; |
|
926 | 926 | } |
927 | 927 | } |
928 | 928 | |
@@ -1344,7 +1344,7 @@ discard block |
||
1344 | 1344 | */ |
1345 | 1345 | private static function getData(string $file) |
1346 | 1346 | { |
1347 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
1347 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
1348 | 1348 | if (\file_exists($file)) { |
1349 | 1349 | /** @noinspection PhpIncludeInspection */ |
1350 | 1350 | return require $file; |
@@ -1484,7 +1484,7 @@ discard block |
||
1484 | 1484 | return \implode( |
1485 | 1485 | '', |
1486 | 1486 | \array_map( |
1487 | - function ($data) use ($keepAsciiChars, $encoding) { |
|
1487 | + function($data) use ($keepAsciiChars, $encoding) { |
|
1488 | 1488 | return UTF8::single_chr_html_encode($data, $keepAsciiChars, $encoding); |
1489 | 1489 | }, |
1490 | 1490 | self::split($str) |
@@ -1598,7 +1598,7 @@ discard block |
||
1598 | 1598 | && |
1599 | 1599 | self::$SUPPORT['mbstring'] === false |
1600 | 1600 | ) { |
1601 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
1601 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
1602 | 1602 | } |
1603 | 1603 | |
1604 | 1604 | do { |
@@ -1606,7 +1606,7 @@ discard block |
||
1606 | 1606 | |
1607 | 1607 | $str = (string)\preg_replace_callback( |
1608 | 1608 | "/&#\d{2,6};/", |
1609 | - function ($matches) use ($encoding) { |
|
1609 | + function($matches) use ($encoding) { |
|
1610 | 1610 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
1611 | 1611 | |
1612 | 1612 | if ($returnTmp !== '"' && $returnTmp !== "'") { |
@@ -1928,9 +1928,9 @@ discard block |
||
1928 | 1928 | { |
1929 | 1929 | $hex = \dechex($int); |
1930 | 1930 | |
1931 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
1931 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
1932 | 1932 | |
1933 | - return $pfix . $hex; |
|
1933 | + return $pfix.$hex; |
|
1934 | 1934 | } |
1935 | 1935 | |
1936 | 1936 | /** |
@@ -2637,7 +2637,7 @@ discard block |
||
2637 | 2637 | $cleanUtf8 |
2638 | 2638 | ); |
2639 | 2639 | |
2640 | - return $strPartOne . $strPartTwo; |
|
2640 | + return $strPartOne.$strPartTwo; |
|
2641 | 2641 | } |
2642 | 2642 | |
2643 | 2643 | /** |
@@ -2725,7 +2725,7 @@ discard block |
||
2725 | 2725 | return \preg_replace('/^[\pZ\pC]+/u', '', $str); |
2726 | 2726 | } |
2727 | 2727 | |
2728 | - return \preg_replace('/^' . self::rxClass($chars) . '+/u', '', $str); |
|
2728 | + return \preg_replace('/^'.self::rxClass($chars).'+/u', '', $str); |
|
2729 | 2729 | } |
2730 | 2730 | |
2731 | 2731 | /** |
@@ -3058,7 +3058,7 @@ discard block |
||
3058 | 3058 | } |
3059 | 3059 | } |
3060 | 3060 | |
3061 | - $cacheKey = $chr_orig . $encoding; |
|
3061 | + $cacheKey = $chr_orig.$encoding; |
|
3062 | 3062 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
3063 | 3063 | return $CHAR_CACHE[$cacheKey]; |
3064 | 3064 | } |
@@ -3285,7 +3285,7 @@ discard block |
||
3285 | 3285 | if (\is_array($what) === true) { |
3286 | 3286 | /** @noinspection ForeachSourceInspection */ |
3287 | 3287 | foreach ($what as $item) { |
3288 | - $str = (string)\preg_replace('/(' . \preg_quote($item, '/') . ')+/', $item, $str); |
|
3288 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/', $item, $str); |
|
3289 | 3289 | } |
3290 | 3290 | } |
3291 | 3291 | |
@@ -3395,7 +3395,7 @@ discard block |
||
3395 | 3395 | return \preg_replace('/[\pZ\pC]+$/u', '', $str); |
3396 | 3396 | } |
3397 | 3397 | |
3398 | - return \preg_replace('/' . self::rxClass($chars) . '+$/u', '', $str); |
|
3398 | + return \preg_replace('/'.self::rxClass($chars).'+$/u', '', $str); |
|
3399 | 3399 | } |
3400 | 3400 | |
3401 | 3401 | /** |
@@ -3410,7 +3410,7 @@ discard block |
||
3410 | 3410 | { |
3411 | 3411 | static $RX_CLASSS_CACHE = []; |
3412 | 3412 | |
3413 | - $cacheKey = $s . $class; |
|
3413 | + $cacheKey = $s.$class; |
|
3414 | 3414 | |
3415 | 3415 | if (isset($RX_CLASSS_CACHE[$cacheKey])) { |
3416 | 3416 | return $RX_CLASSS_CACHE[$cacheKey]; |
@@ -3422,7 +3422,7 @@ discard block |
||
3422 | 3422 | /** @noinspection SuspiciousLoopInspection */ |
3423 | 3423 | foreach (self::str_split($s) as $s) { |
3424 | 3424 | if ('-' === $s) { |
3425 | - $class[0] = '-' . $class[0]; |
|
3425 | + $class[0] = '-'.$class[0]; |
|
3426 | 3426 | } elseif (!isset($s[2])) { |
3427 | 3427 | $class[0] .= \preg_quote($s, '/'); |
3428 | 3428 | } elseif (1 === self::strlen($s)) { |
@@ -3433,13 +3433,13 @@ discard block |
||
3433 | 3433 | } |
3434 | 3434 | |
3435 | 3435 | if ($class[0]) { |
3436 | - $class[0] = '[' . $class[0] . ']'; |
|
3436 | + $class[0] = '['.$class[0].']'; |
|
3437 | 3437 | } |
3438 | 3438 | |
3439 | 3439 | if (1 === \count($class)) { |
3440 | 3440 | $return = $class[0]; |
3441 | 3441 | } else { |
3442 | - $return = '(?:' . \implode('|', $class) . ')'; |
|
3442 | + $return = '(?:'.\implode('|', $class).')'; |
|
3443 | 3443 | } |
3444 | 3444 | |
3445 | 3445 | $RX_CLASSS_CACHE[$cacheKey] = $return; |
@@ -3458,7 +3458,7 @@ discard block |
||
3458 | 3458 | |
3459 | 3459 | echo '<pre>'; |
3460 | 3460 | foreach (self::$SUPPORT as $key => $value) { |
3461 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
3461 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
3462 | 3462 | } |
3463 | 3463 | echo '</pre>'; |
3464 | 3464 | } |
@@ -3490,7 +3490,7 @@ discard block |
||
3490 | 3490 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
3491 | 3491 | } |
3492 | 3492 | |
3493 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
3493 | + return '&#'.self::ord($char, $encoding).';'; |
|
3494 | 3494 | } |
3495 | 3495 | |
3496 | 3496 | /** |
@@ -3551,7 +3551,7 @@ discard block |
||
3551 | 3551 | ) { |
3552 | 3552 | |
3553 | 3553 | if (($str[$i + 1] & "\xC0") === "\x80") { |
3554 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
3554 | + $ret[] = $str[$i].$str[$i + 1]; |
|
3555 | 3555 | |
3556 | 3556 | $i++; |
3557 | 3557 | } |
@@ -3567,7 +3567,7 @@ discard block |
||
3567 | 3567 | && |
3568 | 3568 | ($str[$i + 2] & "\xC0") === "\x80" |
3569 | 3569 | ) { |
3570 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
3570 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
3571 | 3571 | |
3572 | 3572 | $i += 2; |
3573 | 3573 | } |
@@ -3585,7 +3585,7 @@ discard block |
||
3585 | 3585 | && |
3586 | 3586 | ($str[$i + 3] & "\xC0") === "\x80" |
3587 | 3587 | ) { |
3588 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
3588 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
3589 | 3589 | |
3590 | 3590 | $i += 3; |
3591 | 3591 | } |
@@ -3598,7 +3598,7 @@ discard block |
||
3598 | 3598 | $ret = \array_chunk($ret, $length); |
3599 | 3599 | |
3600 | 3600 | return \array_map( |
3601 | - function ($item) { |
|
3601 | + function($item) { |
|
3602 | 3602 | return \implode('', $item); |
3603 | 3603 | }, $ret |
3604 | 3604 | ); |
@@ -3708,7 +3708,7 @@ discard block |
||
3708 | 3708 | foreach (self::$ENCODINGS as $encodingTmp) { |
3709 | 3709 | # INFO: //IGNORE and //TRANSLIT still throw notice |
3710 | 3710 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
3711 | - if (\md5(@\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str)) === $md5) { |
|
3711 | + if (\md5(@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str)) === $md5) { |
|
3712 | 3712 | return $encodingTmp; |
3713 | 3713 | } |
3714 | 3714 | } |
@@ -3792,7 +3792,7 @@ discard block |
||
3792 | 3792 | if ('' === $s .= '') { |
3793 | 3793 | $s = '/^(?<=.)$/'; |
3794 | 3794 | } else { |
3795 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
3795 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
3796 | 3796 | } |
3797 | 3797 | } |
3798 | 3798 | |
@@ -3843,7 +3843,7 @@ discard block |
||
3843 | 3843 | } |
3844 | 3844 | |
3845 | 3845 | if (self::substr($str, $length - 1, 1) === ' ') { |
3846 | - return (string)self::substr($str, 0, $length - 1) . $strAddOn; |
|
3846 | + return (string)self::substr($str, 0, $length - 1).$strAddOn; |
|
3847 | 3847 | } |
3848 | 3848 | |
3849 | 3849 | $str = (string)self::substr($str, 0, $length); |
@@ -3852,9 +3852,9 @@ discard block |
||
3852 | 3852 | $new_str = \implode(' ', $array); |
3853 | 3853 | |
3854 | 3854 | if ($new_str === '') { |
3855 | - $str = (string)self::substr($str, 0, $length - 1) . $strAddOn; |
|
3855 | + $str = (string)self::substr($str, 0, $length - 1).$strAddOn; |
|
3856 | 3856 | } else { |
3857 | - $str = $new_str . $strAddOn; |
|
3857 | + $str = $new_str.$strAddOn; |
|
3858 | 3858 | } |
3859 | 3859 | |
3860 | 3860 | return $str; |
@@ -3909,7 +3909,7 @@ discard block |
||
3909 | 3909 | $pre = ''; |
3910 | 3910 | } |
3911 | 3911 | |
3912 | - return $pre . $str . $post; |
|
3912 | + return $pre.$str.$post; |
|
3913 | 3913 | } |
3914 | 3914 | |
3915 | 3915 | return $str; |
@@ -3969,7 +3969,7 @@ discard block |
||
3969 | 3969 | * |
3970 | 3970 | * @return mixed <p>This function returns a string or an array with the replaced values.</p> |
3971 | 3971 | */ |
3972 | - public static function str_replace($search, $replace, $subject, int &$count = null) |
|
3972 | + public static function str_replace($search, $replace, $subject, int & $count = null) |
|
3973 | 3973 | { |
3974 | 3974 | return \str_replace($search, $replace, $subject, $count); |
3975 | 3975 | } |
@@ -4063,7 +4063,7 @@ discard block |
||
4063 | 4063 | } |
4064 | 4064 | |
4065 | 4065 | /** @noinspection PhpInternalEntityUsedInspection */ |
4066 | - \preg_match_all('/' . self::GRAPHEME_CLUSTER_RX . '/u', $str, $a); |
|
4066 | + \preg_match_all('/'.self::GRAPHEME_CLUSTER_RX.'/u', $str, $a); |
|
4067 | 4067 | $a = $a[0]; |
4068 | 4068 | |
4069 | 4069 | if ($len === 1) { |
@@ -4288,7 +4288,7 @@ discard block |
||
4288 | 4288 | public static function strcmp(string $str1, string $str2): int |
4289 | 4289 | { |
4290 | 4290 | /** @noinspection PhpUndefinedClassInspection */ |
4291 | - return $str1 . '' === $str2 . '' ? 0 : \strcmp( |
|
4291 | + return $str1.'' === $str2.'' ? 0 : \strcmp( |
|
4292 | 4292 | \Normalizer::normalize($str1, \Normalizer::NFD), |
4293 | 4293 | \Normalizer::normalize($str2, \Normalizer::NFD) |
4294 | 4294 | ); |
@@ -4322,7 +4322,7 @@ discard block |
||
4322 | 4322 | return null; |
4323 | 4323 | } |
4324 | 4324 | |
4325 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $length)) { |
|
4325 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $length)) { |
|
4326 | 4326 | return self::strlen($length[1]); |
4327 | 4327 | } |
4328 | 4328 | |
@@ -4514,7 +4514,7 @@ discard block |
||
4514 | 4514 | && |
4515 | 4515 | self::$SUPPORT['mbstring'] === false |
4516 | 4516 | ) { |
4517 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
4517 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
4518 | 4518 | } |
4519 | 4519 | |
4520 | 4520 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -4533,7 +4533,7 @@ discard block |
||
4533 | 4533 | return \stristr($haystack, $needle, $before_needle); |
4534 | 4534 | } |
4535 | 4535 | |
4536 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
4536 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
4537 | 4537 | |
4538 | 4538 | if (!isset($match[1])) { |
4539 | 4539 | return false; |
@@ -4600,7 +4600,7 @@ discard block |
||
4600 | 4600 | && |
4601 | 4601 | self::$SUPPORT['iconv'] === false |
4602 | 4602 | ) { |
4603 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
4603 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
4604 | 4604 | } |
4605 | 4605 | |
4606 | 4606 | if ( |
@@ -4704,7 +4704,7 @@ discard block |
||
4704 | 4704 | */ |
4705 | 4705 | public static function strnatcmp(string $str1, string $str2): int |
4706 | 4706 | { |
4707 | - return $str1 . '' === $str2 . '' ? 0 : \strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
4707 | + return $str1.'' === $str2.'' ? 0 : \strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
4708 | 4708 | } |
4709 | 4709 | |
4710 | 4710 | /** |
@@ -4762,7 +4762,7 @@ discard block |
||
4762 | 4762 | return false; |
4763 | 4763 | } |
4764 | 4764 | |
4765 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
4765 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
4766 | 4766 | return \substr($haystack, \strpos($haystack, $m[0])); |
4767 | 4767 | } |
4768 | 4768 | |
@@ -4826,7 +4826,7 @@ discard block |
||
4826 | 4826 | && |
4827 | 4827 | self::$SUPPORT['mbstring'] === false |
4828 | 4828 | ) { |
4829 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
4829 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
4830 | 4830 | } |
4831 | 4831 | |
4832 | 4832 | if ( |
@@ -5047,7 +5047,7 @@ discard block |
||
5047 | 5047 | && |
5048 | 5048 | self::$SUPPORT['mbstring'] === false |
5049 | 5049 | ) { |
5050 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
5050 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
5051 | 5051 | } |
5052 | 5052 | |
5053 | 5053 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -5118,7 +5118,7 @@ discard block |
||
5118 | 5118 | && |
5119 | 5119 | self::$SUPPORT['mbstring'] === false |
5120 | 5120 | ) { |
5121 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
5121 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
5122 | 5122 | } |
5123 | 5123 | |
5124 | 5124 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -5183,7 +5183,7 @@ discard block |
||
5183 | 5183 | return 0; |
5184 | 5184 | } |
5185 | 5185 | |
5186 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
5186 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
5187 | 5187 | } |
5188 | 5188 | |
5189 | 5189 | /** |
@@ -5226,7 +5226,7 @@ discard block |
||
5226 | 5226 | && |
5227 | 5227 | self::$SUPPORT['mbstring'] === false |
5228 | 5228 | ) { |
5229 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
5229 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
5230 | 5230 | } |
5231 | 5231 | |
5232 | 5232 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -5241,7 +5241,7 @@ discard block |
||
5241 | 5241 | return \grapheme_strstr($haystack, $needle, $before_needle); |
5242 | 5242 | } |
5243 | 5243 | |
5244 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
5244 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
5245 | 5245 | |
5246 | 5246 | if (!isset($match[1])) { |
5247 | 5247 | return false; |
@@ -5338,9 +5338,9 @@ discard block |
||
5338 | 5338 | |
5339 | 5339 | if (self::$SUPPORT['intl'] === true) { |
5340 | 5340 | |
5341 | - $langCode = $lang . '-Lower'; |
|
5341 | + $langCode = $lang.'-Lower'; |
|
5342 | 5342 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
5343 | - \trigger_error('UTF8::strtolower() without intl for special language: ' . $lang, E_USER_WARNING); |
|
5343 | + \trigger_error('UTF8::strtolower() without intl for special language: '.$lang, E_USER_WARNING); |
|
5344 | 5344 | |
5345 | 5345 | $langCode = 'Any-Lower'; |
5346 | 5346 | } |
@@ -5348,7 +5348,7 @@ discard block |
||
5348 | 5348 | return transliterator_transliterate($langCode, $str); |
5349 | 5349 | } |
5350 | 5350 | |
5351 | - \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: ' . $lang, E_USER_WARNING); |
|
5351 | + \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: '.$lang, E_USER_WARNING); |
|
5352 | 5352 | } |
5353 | 5353 | |
5354 | 5354 | return \mb_strtolower($str, $encoding); |
@@ -5403,9 +5403,9 @@ discard block |
||
5403 | 5403 | |
5404 | 5404 | if (self::$SUPPORT['intl'] === true) { |
5405 | 5405 | |
5406 | - $langCode = $lang . '-Upper'; |
|
5406 | + $langCode = $lang.'-Upper'; |
|
5407 | 5407 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
5408 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, E_USER_WARNING); |
|
5408 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, E_USER_WARNING); |
|
5409 | 5409 | |
5410 | 5410 | $langCode = 'Any-Upper'; |
5411 | 5411 | } |
@@ -5413,7 +5413,7 @@ discard block |
||
5413 | 5413 | return transliterator_transliterate($langCode, $str); |
5414 | 5414 | } |
5415 | 5415 | |
5416 | - \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: ' . $lang, E_USER_WARNING); |
|
5416 | + \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: '.$lang, E_USER_WARNING); |
|
5417 | 5417 | } |
5418 | 5418 | |
5419 | 5419 | return \mb_strtoupper($str, $encoding); |
@@ -5597,7 +5597,7 @@ discard block |
||
5597 | 5597 | && |
5598 | 5598 | self::$SUPPORT['mbstring'] === false |
5599 | 5599 | ) { |
5600 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
5600 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
5601 | 5601 | } |
5602 | 5602 | |
5603 | 5603 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -5625,8 +5625,7 @@ discard block |
||
5625 | 5625 | |
5626 | 5626 | if (self::is_ascii($str)) { |
5627 | 5627 | return ($length === null) ? |
5628 | - \substr($str, $offset) : |
|
5629 | - \substr($str, $offset, $length); |
|
5628 | + \substr($str, $offset) : \substr($str, $offset, $length); |
|
5630 | 5629 | } |
5631 | 5630 | |
5632 | 5631 | // fallback via vanilla php |
@@ -5754,14 +5753,14 @@ discard block |
||
5754 | 5753 | && |
5755 | 5754 | self::$SUPPORT['mbstring'] === false |
5756 | 5755 | ) { |
5757 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
5756 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
5758 | 5757 | } |
5759 | 5758 | |
5760 | 5759 | if (self::$SUPPORT['mbstring'] === true) { |
5761 | 5760 | return \mb_substr_count($haystack, $needle, $encoding); |
5762 | 5761 | } |
5763 | 5762 | |
5764 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, PREG_SET_ORDER); |
|
5763 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, PREG_SET_ORDER); |
|
5765 | 5764 | |
5766 | 5765 | return \count($matches); |
5767 | 5766 | } |
@@ -5939,8 +5938,7 @@ discard block |
||
5939 | 5938 | |
5940 | 5939 | if (self::is_ascii($str)) { |
5941 | 5940 | return ($length === null) ? |
5942 | - \substr_replace($str, $replacement, $offset) : |
|
5943 | - \substr_replace($str, $replacement, $offset, $length); |
|
5941 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
5944 | 5942 | } |
5945 | 5943 | |
5946 | 5944 | \preg_match_all('/./us', $str, $smatches); |
@@ -6011,7 +6009,7 @@ discard block |
||
6011 | 6009 | |
6012 | 6010 | $strSwappedCase = \preg_replace_callback( |
6013 | 6011 | '/[\S]/u', |
6014 | - function ($match) use ($encoding) { |
|
6012 | + function($match) use ($encoding) { |
|
6015 | 6013 | $marchToUpper = UTF8::strtoupper($match[0], $encoding); |
6016 | 6014 | |
6017 | 6015 | if ($match[0] === $marchToUpper) { |
@@ -6337,7 +6335,7 @@ discard block |
||
6337 | 6335 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
6338 | 6336 | |
6339 | 6337 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
6340 | - $buf .= $c1 . $c2; |
|
6338 | + $buf .= $c1.$c2; |
|
6341 | 6339 | $i++; |
6342 | 6340 | } else { // not valid UTF8 - convert it |
6343 | 6341 | $buf .= self::to_utf8_convert($c1); |
@@ -6349,7 +6347,7 @@ discard block |
||
6349 | 6347 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
6350 | 6348 | |
6351 | 6349 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
6352 | - $buf .= $c1 . $c2 . $c3; |
|
6350 | + $buf .= $c1.$c2.$c3; |
|
6353 | 6351 | $i += 2; |
6354 | 6352 | } else { // not valid UTF8 - convert it |
6355 | 6353 | $buf .= self::to_utf8_convert($c1); |
@@ -6362,7 +6360,7 @@ discard block |
||
6362 | 6360 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
6363 | 6361 | |
6364 | 6362 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
6365 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
6363 | + $buf .= $c1.$c2.$c3.$c4; |
|
6366 | 6364 | $i += 3; |
6367 | 6365 | } else { // not valid UTF8 - convert it |
6368 | 6366 | $buf .= self::to_utf8_convert($c1); |
@@ -6384,7 +6382,7 @@ discard block |
||
6384 | 6382 | // decode unicode escape sequences |
6385 | 6383 | $buf = \preg_replace_callback( |
6386 | 6384 | '/\\\\u([0-9a-f]{4})/i', |
6387 | - function ($match) { |
|
6385 | + function($match) { |
|
6388 | 6386 | return \mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); |
6389 | 6387 | }, |
6390 | 6388 | $buf |
@@ -6426,7 +6424,7 @@ discard block |
||
6426 | 6424 | } else { |
6427 | 6425 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
6428 | 6426 | $cc2 = ($int & "\x3F") | "\x80"; |
6429 | - $buf .= $cc1 . $cc2; |
|
6427 | + $buf .= $cc1.$cc2; |
|
6430 | 6428 | } |
6431 | 6429 | |
6432 | 6430 | return $buf; |
@@ -6487,7 +6485,7 @@ discard block |
||
6487 | 6485 | $cleanUtf8 |
6488 | 6486 | ); |
6489 | 6487 | |
6490 | - return $strPartOne . $strPartTwo; |
|
6488 | + return $strPartOne.$strPartTwo; |
|
6491 | 6489 | } |
6492 | 6490 | |
6493 | 6491 | /** |
@@ -6532,7 +6530,7 @@ discard block |
||
6532 | 6530 | $str = self::clean($str); |
6533 | 6531 | } |
6534 | 6532 | |
6535 | - $usePhpDefaultFunctions = !(bool)($charlist . \implode('', $exceptions)); |
|
6533 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
6536 | 6534 | |
6537 | 6535 | if ( |
6538 | 6536 | $usePhpDefaultFunctions === true |
@@ -7034,7 +7032,7 @@ discard block |
||
7034 | 7032 | return ''; |
7035 | 7033 | } |
7036 | 7034 | |
7037 | - \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches); |
|
7035 | + \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches); |
|
7038 | 7036 | |
7039 | 7037 | if ( |
7040 | 7038 | !isset($matches[0]) |
@@ -7044,7 +7042,7 @@ discard block |
||
7044 | 7042 | return $str; |
7045 | 7043 | } |
7046 | 7044 | |
7047 | - return self::rtrim($matches[0]) . $strAddOn; |
|
7045 | + return self::rtrim($matches[0]).$strAddOn; |
|
7048 | 7046 | } |
7049 | 7047 | |
7050 | 7048 | /** |
@@ -7109,7 +7107,7 @@ discard block |
||
7109 | 7107 | $strReturn .= $break; |
7110 | 7108 | } |
7111 | 7109 | |
7112 | - return $strReturn . \implode('', $chars); |
|
7110 | + return $strReturn.\implode('', $chars); |
|
7113 | 7111 | } |
7114 | 7112 | |
7115 | 7113 | /** |