@@ -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) |
@@ -1602,7 +1602,7 @@ discard block |
||
| 1602 | 1602 | && |
| 1603 | 1603 | self::$SUPPORT['mbstring'] === false |
| 1604 | 1604 | ) { |
| 1605 | - trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 1605 | + trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 1606 | 1606 | } |
| 1607 | 1607 | |
| 1608 | 1608 | do { |
@@ -1610,7 +1610,7 @@ discard block |
||
| 1610 | 1610 | |
| 1611 | 1611 | $str = \preg_replace_callback( |
| 1612 | 1612 | "/&#\d{2,6};/", |
| 1613 | - function ($matches) use ($encoding) { |
|
| 1613 | + function($matches) use ($encoding) { |
|
| 1614 | 1614 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
| 1615 | 1615 | |
| 1616 | 1616 | if ($returnTmp !== '"' && $returnTmp !== "'") { |
@@ -1932,9 +1932,9 @@ discard block |
||
| 1932 | 1932 | { |
| 1933 | 1933 | $hex = \dechex($int); |
| 1934 | 1934 | |
| 1935 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
| 1935 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
| 1936 | 1936 | |
| 1937 | - return $pfix . $hex; |
|
| 1937 | + return $pfix.$hex; |
|
| 1938 | 1938 | } |
| 1939 | 1939 | |
| 1940 | 1940 | /** |
@@ -2641,7 +2641,7 @@ discard block |
||
| 2641 | 2641 | $cleanUtf8 |
| 2642 | 2642 | ); |
| 2643 | 2643 | |
| 2644 | - return $strPartOne . $strPartTwo; |
|
| 2644 | + return $strPartOne.$strPartTwo; |
|
| 2645 | 2645 | } |
| 2646 | 2646 | |
| 2647 | 2647 | /** |
@@ -2729,7 +2729,7 @@ discard block |
||
| 2729 | 2729 | return \preg_replace('/^[\pZ\pC]+/u', '', $str); |
| 2730 | 2730 | } |
| 2731 | 2731 | |
| 2732 | - return \preg_replace('/^' . self::rxClass($chars) . '+/u', '', $str); |
|
| 2732 | + return \preg_replace('/^'.self::rxClass($chars).'+/u', '', $str); |
|
| 2733 | 2733 | } |
| 2734 | 2734 | |
| 2735 | 2735 | /** |
@@ -3062,7 +3062,7 @@ discard block |
||
| 3062 | 3062 | } |
| 3063 | 3063 | } |
| 3064 | 3064 | |
| 3065 | - $cacheKey = $chr_orig . $encoding; |
|
| 3065 | + $cacheKey = $chr_orig.$encoding; |
|
| 3066 | 3066 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
| 3067 | 3067 | return $CHAR_CACHE[$cacheKey]; |
| 3068 | 3068 | } |
@@ -3289,7 +3289,7 @@ discard block |
||
| 3289 | 3289 | if (\is_array($what) === true) { |
| 3290 | 3290 | /** @noinspection ForeachSourceInspection */ |
| 3291 | 3291 | foreach ($what as $item) { |
| 3292 | - $str = \preg_replace('/(' . \preg_quote($item, '/') . ')+/', $item, $str); |
|
| 3292 | + $str = \preg_replace('/('.\preg_quote($item, '/').')+/', $item, $str); |
|
| 3293 | 3293 | } |
| 3294 | 3294 | } |
| 3295 | 3295 | |
@@ -3399,7 +3399,7 @@ discard block |
||
| 3399 | 3399 | return \preg_replace('/[\pZ\pC]+$/u', '', $str); |
| 3400 | 3400 | } |
| 3401 | 3401 | |
| 3402 | - return \preg_replace('/' . self::rxClass($chars) . '+$/u', '', $str); |
|
| 3402 | + return \preg_replace('/'.self::rxClass($chars).'+$/u', '', $str); |
|
| 3403 | 3403 | } |
| 3404 | 3404 | |
| 3405 | 3405 | /** |
@@ -3414,7 +3414,7 @@ discard block |
||
| 3414 | 3414 | { |
| 3415 | 3415 | static $RX_CLASSS_CACHE = []; |
| 3416 | 3416 | |
| 3417 | - $cacheKey = $s . $class; |
|
| 3417 | + $cacheKey = $s.$class; |
|
| 3418 | 3418 | |
| 3419 | 3419 | if (isset($RX_CLASSS_CACHE[$cacheKey])) { |
| 3420 | 3420 | return $RX_CLASSS_CACHE[$cacheKey]; |
@@ -3426,7 +3426,7 @@ discard block |
||
| 3426 | 3426 | /** @noinspection SuspiciousLoopInspection */ |
| 3427 | 3427 | foreach (self::str_split($s) as $s) { |
| 3428 | 3428 | if ('-' === $s) { |
| 3429 | - $class[0] = '-' . $class[0]; |
|
| 3429 | + $class[0] = '-'.$class[0]; |
|
| 3430 | 3430 | } elseif (!isset($s[2])) { |
| 3431 | 3431 | $class[0] .= \preg_quote($s, '/'); |
| 3432 | 3432 | } elseif (1 === self::strlen($s)) { |
@@ -3437,13 +3437,13 @@ discard block |
||
| 3437 | 3437 | } |
| 3438 | 3438 | |
| 3439 | 3439 | if ($class[0]) { |
| 3440 | - $class[0] = '[' . $class[0] . ']'; |
|
| 3440 | + $class[0] = '['.$class[0].']'; |
|
| 3441 | 3441 | } |
| 3442 | 3442 | |
| 3443 | 3443 | if (1 === \count($class)) { |
| 3444 | 3444 | $return = $class[0]; |
| 3445 | 3445 | } else { |
| 3446 | - $return = '(?:' . \implode('|', $class) . ')'; |
|
| 3446 | + $return = '(?:'.\implode('|', $class).')'; |
|
| 3447 | 3447 | } |
| 3448 | 3448 | |
| 3449 | 3449 | $RX_CLASSS_CACHE[$cacheKey] = $return; |
@@ -3462,7 +3462,7 @@ discard block |
||
| 3462 | 3462 | |
| 3463 | 3463 | echo '<pre>'; |
| 3464 | 3464 | foreach (self::$SUPPORT as $key => $value) { |
| 3465 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
| 3465 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
| 3466 | 3466 | } |
| 3467 | 3467 | echo '</pre>'; |
| 3468 | 3468 | } |
@@ -3494,7 +3494,7 @@ discard block |
||
| 3494 | 3494 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 3495 | 3495 | } |
| 3496 | 3496 | |
| 3497 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
| 3497 | + return '&#'.self::ord($char, $encoding).';'; |
|
| 3498 | 3498 | } |
| 3499 | 3499 | |
| 3500 | 3500 | /** |
@@ -3555,7 +3555,7 @@ discard block |
||
| 3555 | 3555 | ) { |
| 3556 | 3556 | |
| 3557 | 3557 | if (($str[$i + 1] & "\xC0") === "\x80") { |
| 3558 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
| 3558 | + $ret[] = $str[$i].$str[$i + 1]; |
|
| 3559 | 3559 | |
| 3560 | 3560 | $i++; |
| 3561 | 3561 | } |
@@ -3571,7 +3571,7 @@ discard block |
||
| 3571 | 3571 | && |
| 3572 | 3572 | ($str[$i + 2] & "\xC0") === "\x80" |
| 3573 | 3573 | ) { |
| 3574 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
| 3574 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
| 3575 | 3575 | |
| 3576 | 3576 | $i += 2; |
| 3577 | 3577 | } |
@@ -3589,7 +3589,7 @@ discard block |
||
| 3589 | 3589 | && |
| 3590 | 3590 | ($str[$i + 3] & "\xC0") === "\x80" |
| 3591 | 3591 | ) { |
| 3592 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
| 3592 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
| 3593 | 3593 | |
| 3594 | 3594 | $i += 3; |
| 3595 | 3595 | } |
@@ -3602,7 +3602,7 @@ discard block |
||
| 3602 | 3602 | $ret = \array_chunk($ret, $length); |
| 3603 | 3603 | |
| 3604 | 3604 | return \array_map( |
| 3605 | - function ($item) { |
|
| 3605 | + function($item) { |
|
| 3606 | 3606 | return \implode('', $item); |
| 3607 | 3607 | }, $ret |
| 3608 | 3608 | ); |
@@ -3712,7 +3712,7 @@ discard block |
||
| 3712 | 3712 | foreach (self::$ENCODINGS as $encodingTmp) { |
| 3713 | 3713 | # INFO: //IGNORE and //TRANSLIT still throw notice |
| 3714 | 3714 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 3715 | - if (\md5(@\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str)) === $md5) { |
|
| 3715 | + if (\md5(@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str)) === $md5) { |
|
| 3716 | 3716 | return $encodingTmp; |
| 3717 | 3717 | } |
| 3718 | 3718 | } |
@@ -3796,7 +3796,7 @@ discard block |
||
| 3796 | 3796 | if ('' === $s .= '') { |
| 3797 | 3797 | $s = '/^(?<=.)$/'; |
| 3798 | 3798 | } else { |
| 3799 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
| 3799 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
| 3800 | 3800 | } |
| 3801 | 3801 | } |
| 3802 | 3802 | |
@@ -3847,7 +3847,7 @@ discard block |
||
| 3847 | 3847 | } |
| 3848 | 3848 | |
| 3849 | 3849 | if (self::substr($str, $length - 1, 1) === ' ') { |
| 3850 | - return (string)self::substr($str, 0, $length - 1) . $strAddOn; |
|
| 3850 | + return (string)self::substr($str, 0, $length - 1).$strAddOn; |
|
| 3851 | 3851 | } |
| 3852 | 3852 | |
| 3853 | 3853 | $str = (string)self::substr($str, 0, $length); |
@@ -3856,9 +3856,9 @@ discard block |
||
| 3856 | 3856 | $new_str = \implode(' ', $array); |
| 3857 | 3857 | |
| 3858 | 3858 | if ($new_str === '') { |
| 3859 | - $str = (string)self::substr($str, 0, $length - 1) . $strAddOn; |
|
| 3859 | + $str = (string)self::substr($str, 0, $length - 1).$strAddOn; |
|
| 3860 | 3860 | } else { |
| 3861 | - $str = $new_str . $strAddOn; |
|
| 3861 | + $str = $new_str.$strAddOn; |
|
| 3862 | 3862 | } |
| 3863 | 3863 | |
| 3864 | 3864 | return $str; |
@@ -3913,7 +3913,7 @@ discard block |
||
| 3913 | 3913 | $pre = ''; |
| 3914 | 3914 | } |
| 3915 | 3915 | |
| 3916 | - return $pre . $str . $post; |
|
| 3916 | + return $pre.$str.$post; |
|
| 3917 | 3917 | } |
| 3918 | 3918 | |
| 3919 | 3919 | return $str; |
@@ -3973,7 +3973,7 @@ discard block |
||
| 3973 | 3973 | * |
| 3974 | 3974 | * @return mixed <p>This function returns a string or an array with the replaced values.</p> |
| 3975 | 3975 | */ |
| 3976 | - public static function str_replace($search, $replace, $subject, int &$count = null) |
|
| 3976 | + public static function str_replace($search, $replace, $subject, int & $count = null) |
|
| 3977 | 3977 | { |
| 3978 | 3978 | return \str_replace($search, $replace, $subject, $count); |
| 3979 | 3979 | } |
@@ -4067,7 +4067,7 @@ discard block |
||
| 4067 | 4067 | } |
| 4068 | 4068 | |
| 4069 | 4069 | /** @noinspection PhpInternalEntityUsedInspection */ |
| 4070 | - \preg_match_all('/' . self::GRAPHEME_CLUSTER_RX . '/u', $str, $a); |
|
| 4070 | + \preg_match_all('/'.self::GRAPHEME_CLUSTER_RX.'/u', $str, $a); |
|
| 4071 | 4071 | $a = $a[0]; |
| 4072 | 4072 | |
| 4073 | 4073 | if ($len === 1) { |
@@ -4292,7 +4292,7 @@ discard block |
||
| 4292 | 4292 | public static function strcmp(string $str1, string $str2): int |
| 4293 | 4293 | { |
| 4294 | 4294 | /** @noinspection PhpUndefinedClassInspection */ |
| 4295 | - return $str1 . '' === $str2 . '' ? 0 : \strcmp( |
|
| 4295 | + return $str1.'' === $str2.'' ? 0 : \strcmp( |
|
| 4296 | 4296 | \Normalizer::normalize($str1, \Normalizer::NFD), |
| 4297 | 4297 | \Normalizer::normalize($str2, \Normalizer::NFD) |
| 4298 | 4298 | ); |
@@ -4326,7 +4326,7 @@ discard block |
||
| 4326 | 4326 | return null; |
| 4327 | 4327 | } |
| 4328 | 4328 | |
| 4329 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $length)) { |
|
| 4329 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $length)) { |
|
| 4330 | 4330 | return self::strlen($length[1]); |
| 4331 | 4331 | } |
| 4332 | 4332 | |
@@ -4518,7 +4518,7 @@ discard block |
||
| 4518 | 4518 | && |
| 4519 | 4519 | self::$SUPPORT['mbstring'] === false |
| 4520 | 4520 | ) { |
| 4521 | - trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 4521 | + trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 4522 | 4522 | } |
| 4523 | 4523 | |
| 4524 | 4524 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -4537,7 +4537,7 @@ discard block |
||
| 4537 | 4537 | return \stristr($haystack, $needle, $before_needle); |
| 4538 | 4538 | } |
| 4539 | 4539 | |
| 4540 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
| 4540 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
| 4541 | 4541 | |
| 4542 | 4542 | if (!isset($match[1])) { |
| 4543 | 4543 | return false; |
@@ -4604,7 +4604,7 @@ discard block |
||
| 4604 | 4604 | && |
| 4605 | 4605 | self::$SUPPORT['iconv'] === false |
| 4606 | 4606 | ) { |
| 4607 | - trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 4607 | + trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 4608 | 4608 | } |
| 4609 | 4609 | |
| 4610 | 4610 | if ( |
@@ -4708,7 +4708,7 @@ discard block |
||
| 4708 | 4708 | */ |
| 4709 | 4709 | public static function strnatcmp(string $str1, string $str2): int |
| 4710 | 4710 | { |
| 4711 | - return $str1 . '' === $str2 . '' ? 0 : \strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
| 4711 | + return $str1.'' === $str2.'' ? 0 : \strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
| 4712 | 4712 | } |
| 4713 | 4713 | |
| 4714 | 4714 | /** |
@@ -4766,7 +4766,7 @@ discard block |
||
| 4766 | 4766 | return false; |
| 4767 | 4767 | } |
| 4768 | 4768 | |
| 4769 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
| 4769 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
| 4770 | 4770 | return \substr($haystack, \strpos($haystack, $m[0])); |
| 4771 | 4771 | } |
| 4772 | 4772 | |
@@ -4830,7 +4830,7 @@ discard block |
||
| 4830 | 4830 | && |
| 4831 | 4831 | self::$SUPPORT['mbstring'] === false |
| 4832 | 4832 | ) { |
| 4833 | - trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 4833 | + trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 4834 | 4834 | } |
| 4835 | 4835 | |
| 4836 | 4836 | if ( |
@@ -5051,7 +5051,7 @@ discard block |
||
| 5051 | 5051 | && |
| 5052 | 5052 | self::$SUPPORT['mbstring'] === false |
| 5053 | 5053 | ) { |
| 5054 | - trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 5054 | + trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 5055 | 5055 | } |
| 5056 | 5056 | |
| 5057 | 5057 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -5122,7 +5122,7 @@ discard block |
||
| 5122 | 5122 | && |
| 5123 | 5123 | self::$SUPPORT['mbstring'] === false |
| 5124 | 5124 | ) { |
| 5125 | - trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 5125 | + trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 5126 | 5126 | } |
| 5127 | 5127 | |
| 5128 | 5128 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -5187,7 +5187,7 @@ discard block |
||
| 5187 | 5187 | return 0; |
| 5188 | 5188 | } |
| 5189 | 5189 | |
| 5190 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
| 5190 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
| 5191 | 5191 | } |
| 5192 | 5192 | |
| 5193 | 5193 | /** |
@@ -5230,7 +5230,7 @@ discard block |
||
| 5230 | 5230 | && |
| 5231 | 5231 | self::$SUPPORT['mbstring'] === false |
| 5232 | 5232 | ) { |
| 5233 | - trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 5233 | + trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 5234 | 5234 | } |
| 5235 | 5235 | |
| 5236 | 5236 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -5245,7 +5245,7 @@ discard block |
||
| 5245 | 5245 | return \grapheme_strstr($haystack, $needle, $before_needle); |
| 5246 | 5246 | } |
| 5247 | 5247 | |
| 5248 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
| 5248 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
| 5249 | 5249 | |
| 5250 | 5250 | if (!isset($match[1])) { |
| 5251 | 5251 | return false; |
@@ -5342,9 +5342,9 @@ discard block |
||
| 5342 | 5342 | |
| 5343 | 5343 | if (self::$SUPPORT['intl'] === true) { |
| 5344 | 5344 | |
| 5345 | - $langCode = $lang . '-Lower'; |
|
| 5345 | + $langCode = $lang.'-Lower'; |
|
| 5346 | 5346 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
| 5347 | - trigger_error('UTF8::strtolower() without intl for special language: ' . $lang, E_USER_WARNING); |
|
| 5347 | + trigger_error('UTF8::strtolower() without intl for special language: '.$lang, E_USER_WARNING); |
|
| 5348 | 5348 | |
| 5349 | 5349 | $langCode = 'Any-Lower'; |
| 5350 | 5350 | } |
@@ -5352,7 +5352,7 @@ discard block |
||
| 5352 | 5352 | return transliterator_transliterate($langCode, $str); |
| 5353 | 5353 | } |
| 5354 | 5354 | |
| 5355 | - trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: ' . $lang, E_USER_WARNING); |
|
| 5355 | + trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: '.$lang, E_USER_WARNING); |
|
| 5356 | 5356 | } |
| 5357 | 5357 | |
| 5358 | 5358 | return \mb_strtolower($str, $encoding); |
@@ -5407,9 +5407,9 @@ discard block |
||
| 5407 | 5407 | |
| 5408 | 5408 | if (self::$SUPPORT['intl'] === true) { |
| 5409 | 5409 | |
| 5410 | - $langCode = $lang . '-Upper'; |
|
| 5410 | + $langCode = $lang.'-Upper'; |
|
| 5411 | 5411 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
| 5412 | - trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, E_USER_WARNING); |
|
| 5412 | + trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, E_USER_WARNING); |
|
| 5413 | 5413 | |
| 5414 | 5414 | $langCode = 'Any-Upper'; |
| 5415 | 5415 | } |
@@ -5417,7 +5417,7 @@ discard block |
||
| 5417 | 5417 | return transliterator_transliterate($langCode, $str); |
| 5418 | 5418 | } |
| 5419 | 5419 | |
| 5420 | - trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: ' . $lang, E_USER_WARNING); |
|
| 5420 | + trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: '.$lang, E_USER_WARNING); |
|
| 5421 | 5421 | } |
| 5422 | 5422 | |
| 5423 | 5423 | return \mb_strtoupper($str, $encoding); |
@@ -5601,7 +5601,7 @@ discard block |
||
| 5601 | 5601 | && |
| 5602 | 5602 | self::$SUPPORT['mbstring'] === false |
| 5603 | 5603 | ) { |
| 5604 | - trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 5604 | + trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 5605 | 5605 | } |
| 5606 | 5606 | |
| 5607 | 5607 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -5629,8 +5629,7 @@ discard block |
||
| 5629 | 5629 | |
| 5630 | 5630 | if (self::is_ascii($str)) { |
| 5631 | 5631 | return ($length === null) ? |
| 5632 | - \substr($str, $offset) : |
|
| 5633 | - \substr($str, $offset, $length); |
|
| 5632 | + \substr($str, $offset) : \substr($str, $offset, $length); |
|
| 5634 | 5633 | } |
| 5635 | 5634 | |
| 5636 | 5635 | // fallback via vanilla php |
@@ -5758,14 +5757,14 @@ discard block |
||
| 5758 | 5757 | && |
| 5759 | 5758 | self::$SUPPORT['mbstring'] === false |
| 5760 | 5759 | ) { |
| 5761 | - trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 5760 | + trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 5762 | 5761 | } |
| 5763 | 5762 | |
| 5764 | 5763 | if (self::$SUPPORT['mbstring'] === true) { |
| 5765 | 5764 | return \mb_substr_count($haystack, $needle, $encoding); |
| 5766 | 5765 | } |
| 5767 | 5766 | |
| 5768 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, PREG_SET_ORDER); |
|
| 5767 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, PREG_SET_ORDER); |
|
| 5769 | 5768 | |
| 5770 | 5769 | return \count($matches); |
| 5771 | 5770 | } |
@@ -5943,8 +5942,7 @@ discard block |
||
| 5943 | 5942 | |
| 5944 | 5943 | if (self::is_ascii($str)) { |
| 5945 | 5944 | return ($length === null) ? |
| 5946 | - \substr_replace($str, $replacement, $offset) : |
|
| 5947 | - \substr_replace($str, $replacement, $offset, $length); |
|
| 5945 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
| 5948 | 5946 | } |
| 5949 | 5947 | |
| 5950 | 5948 | \preg_match_all('/./us', $str, $smatches); |
@@ -6015,7 +6013,7 @@ discard block |
||
| 6015 | 6013 | |
| 6016 | 6014 | $strSwappedCase = \preg_replace_callback( |
| 6017 | 6015 | '/[\S]/u', |
| 6018 | - function ($match) use ($encoding) { |
|
| 6016 | + function($match) use ($encoding) { |
|
| 6019 | 6017 | $marchToUpper = UTF8::strtoupper($match[0], $encoding); |
| 6020 | 6018 | |
| 6021 | 6019 | if ($match[0] === $marchToUpper) { |
@@ -6341,7 +6339,7 @@ discard block |
||
| 6341 | 6339 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
| 6342 | 6340 | |
| 6343 | 6341 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 6344 | - $buf .= $c1 . $c2; |
|
| 6342 | + $buf .= $c1.$c2; |
|
| 6345 | 6343 | $i++; |
| 6346 | 6344 | } else { // not valid UTF8 - convert it |
| 6347 | 6345 | $buf .= self::to_utf8_convert($c1); |
@@ -6353,7 +6351,7 @@ discard block |
||
| 6353 | 6351 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
| 6354 | 6352 | |
| 6355 | 6353 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 6356 | - $buf .= $c1 . $c2 . $c3; |
|
| 6354 | + $buf .= $c1.$c2.$c3; |
|
| 6357 | 6355 | $i += 2; |
| 6358 | 6356 | } else { // not valid UTF8 - convert it |
| 6359 | 6357 | $buf .= self::to_utf8_convert($c1); |
@@ -6366,7 +6364,7 @@ discard block |
||
| 6366 | 6364 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
| 6367 | 6365 | |
| 6368 | 6366 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 6369 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
| 6367 | + $buf .= $c1.$c2.$c3.$c4; |
|
| 6370 | 6368 | $i += 3; |
| 6371 | 6369 | } else { // not valid UTF8 - convert it |
| 6372 | 6370 | $buf .= self::to_utf8_convert($c1); |
@@ -6388,7 +6386,7 @@ discard block |
||
| 6388 | 6386 | // decode unicode escape sequences |
| 6389 | 6387 | $buf = \preg_replace_callback( |
| 6390 | 6388 | '/\\\\u([0-9a-f]{4})/i', |
| 6391 | - function ($match) { |
|
| 6389 | + function($match) { |
|
| 6392 | 6390 | return \mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); |
| 6393 | 6391 | }, |
| 6394 | 6392 | $buf |
@@ -6430,7 +6428,7 @@ discard block |
||
| 6430 | 6428 | } else { |
| 6431 | 6429 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
| 6432 | 6430 | $cc2 = ($int & "\x3F") | "\x80"; |
| 6433 | - $buf .= $cc1 . $cc2; |
|
| 6431 | + $buf .= $cc1.$cc2; |
|
| 6434 | 6432 | } |
| 6435 | 6433 | |
| 6436 | 6434 | return $buf; |
@@ -6491,7 +6489,7 @@ discard block |
||
| 6491 | 6489 | $cleanUtf8 |
| 6492 | 6490 | ); |
| 6493 | 6491 | |
| 6494 | - return $strPartOne . $strPartTwo; |
|
| 6492 | + return $strPartOne.$strPartTwo; |
|
| 6495 | 6493 | } |
| 6496 | 6494 | |
| 6497 | 6495 | /** |
@@ -6536,7 +6534,7 @@ discard block |
||
| 6536 | 6534 | $str = self::clean($str); |
| 6537 | 6535 | } |
| 6538 | 6536 | |
| 6539 | - $usePhpDefaultFunctions = !(bool)($charlist . \implode('', $exceptions)); |
|
| 6537 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
| 6540 | 6538 | |
| 6541 | 6539 | if ( |
| 6542 | 6540 | $usePhpDefaultFunctions === true |
@@ -7038,7 +7036,7 @@ discard block |
||
| 7038 | 7036 | return ''; |
| 7039 | 7037 | } |
| 7040 | 7038 | |
| 7041 | - \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches); |
|
| 7039 | + \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches); |
|
| 7042 | 7040 | |
| 7043 | 7041 | if ( |
| 7044 | 7042 | !isset($matches[0]) |
@@ -7048,7 +7046,7 @@ discard block |
||
| 7048 | 7046 | return $str; |
| 7049 | 7047 | } |
| 7050 | 7048 | |
| 7051 | - return self::rtrim($matches[0]) . $strAddOn; |
|
| 7049 | + return self::rtrim($matches[0]).$strAddOn; |
|
| 7052 | 7050 | } |
| 7053 | 7051 | |
| 7054 | 7052 | /** |
@@ -7113,7 +7111,7 @@ discard block |
||
| 7113 | 7111 | $strReturn .= $break; |
| 7114 | 7112 | } |
| 7115 | 7113 | |
| 7116 | - return $strReturn . \implode('', $chars); |
|
| 7114 | + return $strReturn.\implode('', $chars); |
|
| 7117 | 7115 | } |
| 7118 | 7116 | |
| 7119 | 7117 | /** |