@@ -543,16 +543,16 @@ discard block |
||
543 | 543 | $chr = self::$CHR[$code_point]; |
544 | 544 | } elseif ($code_point <= 0x7FF) { |
545 | 545 | $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
546 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
546 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
547 | 547 | } elseif ($code_point <= 0xFFFF) { |
548 | 548 | $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
549 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
550 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
549 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
550 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
551 | 551 | } else { |
552 | 552 | $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
553 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
554 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
555 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
553 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
554 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
555 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
556 | 556 | } |
557 | 557 | |
558 | 558 | if ($encoding !== 'UTF-8') { |
@@ -1040,9 +1040,9 @@ discard block |
||
1040 | 1040 | |
1041 | 1041 | if ($pos) { |
1042 | 1042 | return \rtrim( |
1043 | - self::substr($str, 0, $pos, $encoding), |
|
1044 | - $trimChars |
|
1045 | - ) . $replacerForSkippedText; |
|
1043 | + self::substr($str, 0, $pos, $encoding), |
|
1044 | + $trimChars |
|
1045 | + ) . $replacerForSkippedText; |
|
1046 | 1046 | } |
1047 | 1047 | |
1048 | 1048 | return $str; |
@@ -1081,9 +1081,9 @@ discard block |
||
1081 | 1081 | } |
1082 | 1082 | |
1083 | 1083 | $pos_end = \min( |
1084 | - self::strpos($str, ' ', $l, $encoding), |
|
1085 | - self::strpos($str, '.', $l, $encoding) |
|
1086 | - ) - $pos_start; |
|
1084 | + self::strpos($str, ' ', $l, $encoding), |
|
1085 | + self::strpos($str, '.', $l, $encoding) |
|
1086 | + ) - $pos_start; |
|
1087 | 1087 | |
1088 | 1088 | if (!$pos_end || $pos_end <= 0) { |
1089 | 1089 | $extract = $replacerForSkippedText . \ltrim( |
@@ -1123,9 +1123,9 @@ discard block |
||
1123 | 1123 | |
1124 | 1124 | if ($pos_end) { |
1125 | 1125 | $extract = \rtrim( |
1126 | - self::substr($str, 0, $pos_end, $encoding), |
|
1127 | - $trimChars |
|
1128 | - ) . $replacerForSkippedText; |
|
1126 | + self::substr($str, 0, $pos_end, $encoding), |
|
1127 | + $trimChars |
|
1128 | + ) . $replacerForSkippedText; |
|
1129 | 1129 | } else { |
1130 | 1130 | $extract = $str; |
1131 | 1131 | } |
@@ -2834,10 +2834,10 @@ discard block |
||
2834 | 2834 | |
2835 | 2835 | /** @noinspection PhpComposerExtensionStubsInspection */ |
2836 | 2836 | return ( |
2837 | - \is_object($json) === true |
|
2837 | + \is_object($json) === true |
|
2838 | 2838 | || |
2839 | 2839 | \is_array($json) === true |
2840 | - ) |
|
2840 | + ) |
|
2841 | 2841 | && |
2842 | 2842 | \json_last_error() === JSON_ERROR_NONE; |
2843 | 2843 | } |
@@ -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; |
@@ -501,10 +501,10 @@ discard block |
||
501 | 501 | && |
502 | 502 | self::$SUPPORT['mbstring'] === false |
503 | 503 | ) { |
504 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
504 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
505 | 505 | } |
506 | 506 | |
507 | - $cacheKey = $code_point . $encoding; |
|
507 | + $cacheKey = $code_point.$encoding; |
|
508 | 508 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
509 | 509 | return $CHAR_CACHE[$cacheKey]; |
510 | 510 | } |
@@ -542,16 +542,16 @@ discard block |
||
542 | 542 | if ($code_point <= 0x7F) { |
543 | 543 | $chr = self::$CHR[$code_point]; |
544 | 544 | } elseif ($code_point <= 0x7FF) { |
545 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
545 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
546 | 546 | self::$CHR[($code_point & 0x3F) + 0x80]; |
547 | 547 | } elseif ($code_point <= 0xFFFF) { |
548 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
549 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
548 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
549 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
550 | 550 | self::$CHR[($code_point & 0x3F) + 0x80]; |
551 | 551 | } else { |
552 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
553 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
554 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
552 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
553 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
554 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
555 | 555 | self::$CHR[($code_point & 0x3F) + 0x80]; |
556 | 556 | } |
557 | 557 | |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | |
600 | 600 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
601 | 601 | return \array_map( |
602 | - function ($data) { |
|
602 | + function($data) { |
|
603 | 603 | return UTF8::strlen($data, 'CP850'); // 8-BIT |
604 | 604 | }, |
605 | 605 | $strSplit |
@@ -903,7 +903,7 @@ discard block |
||
903 | 903 | */ |
904 | 904 | public static function decimal_to_chr($int): string |
905 | 905 | { |
906 | - return self::html_entity_decode('&#' . $int . ';', ENT_QUOTES | ENT_HTML5); |
|
906 | + return self::html_entity_decode('&#'.$int.';', ENT_QUOTES | ENT_HTML5); |
|
907 | 907 | } |
908 | 908 | |
909 | 909 | /** |
@@ -983,7 +983,7 @@ discard block |
||
983 | 983 | && |
984 | 984 | self::$SUPPORT['mbstring'] === false |
985 | 985 | ) { |
986 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
986 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
987 | 987 | } |
988 | 988 | |
989 | 989 | $strEncoded = \mb_convert_encoding( |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | return \rtrim( |
1043 | 1043 | self::substr($str, 0, $pos, $encoding), |
1044 | 1044 | $trimChars |
1045 | - ) . $replacerForSkippedText; |
|
1045 | + ).$replacerForSkippedText; |
|
1046 | 1046 | } |
1047 | 1047 | |
1048 | 1048 | return $str; |
@@ -1086,7 +1086,7 @@ discard block |
||
1086 | 1086 | ) - $pos_start; |
1087 | 1087 | |
1088 | 1088 | if (!$pos_end || $pos_end <= 0) { |
1089 | - $extract = $replacerForSkippedText . \ltrim( |
|
1089 | + $extract = $replacerForSkippedText.\ltrim( |
|
1090 | 1090 | self::substr( |
1091 | 1091 | $str, |
1092 | 1092 | $pos_start, |
@@ -1096,7 +1096,7 @@ discard block |
||
1096 | 1096 | $trimChars |
1097 | 1097 | ); |
1098 | 1098 | } else { |
1099 | - $extract = $replacerForSkippedText . \trim( |
|
1099 | + $extract = $replacerForSkippedText.\trim( |
|
1100 | 1100 | self::substr( |
1101 | 1101 | $str, |
1102 | 1102 | $pos_start, |
@@ -1104,7 +1104,7 @@ discard block |
||
1104 | 1104 | $encoding |
1105 | 1105 | ), |
1106 | 1106 | $trimChars |
1107 | - ) . $replacerForSkippedText; |
|
1107 | + ).$replacerForSkippedText; |
|
1108 | 1108 | } |
1109 | 1109 | |
1110 | 1110 | } else { |
@@ -1125,7 +1125,7 @@ discard block |
||
1125 | 1125 | $extract = \rtrim( |
1126 | 1126 | self::substr($str, 0, $pos_end, $encoding), |
1127 | 1127 | $trimChars |
1128 | - ) . $replacerForSkippedText; |
|
1128 | + ).$replacerForSkippedText; |
|
1129 | 1129 | } else { |
1130 | 1130 | $extract = $str; |
1131 | 1131 | } |
@@ -1292,7 +1292,7 @@ discard block |
||
1292 | 1292 | ) { |
1293 | 1293 | // Prevent leading combining chars |
1294 | 1294 | // for NFC-safe concatenations. |
1295 | - $var = $leading_combining . $var; |
|
1295 | + $var = $leading_combining.$var; |
|
1296 | 1296 | } |
1297 | 1297 | } |
1298 | 1298 | |
@@ -1743,7 +1743,7 @@ discard block |
||
1743 | 1743 | */ |
1744 | 1744 | private static function getData(string $file) |
1745 | 1745 | { |
1746 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
1746 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
1747 | 1747 | if (\file_exists($file)) { |
1748 | 1748 | /** @noinspection PhpIncludeInspection */ |
1749 | 1749 | return require $file; |
@@ -1820,16 +1820,16 @@ discard block |
||
1820 | 1820 | */ |
1821 | 1821 | public static function get_unique_string($entropyExtra = '', bool $md5 = true): string |
1822 | 1822 | { |
1823 | - $uniqueHelper = \mt_rand() . |
|
1824 | - \session_id() . |
|
1825 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
1826 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
1823 | + $uniqueHelper = \mt_rand(). |
|
1824 | + \session_id(). |
|
1825 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
1826 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
1827 | 1827 | $entropyExtra; |
1828 | 1828 | |
1829 | 1829 | $uniqueString = \uniqid($uniqueHelper, true); |
1830 | 1830 | |
1831 | 1831 | if ($md5) { |
1832 | - $uniqueString = \md5($uniqueString . $uniqueHelper); |
|
1832 | + $uniqueString = \md5($uniqueString.$uniqueHelper); |
|
1833 | 1833 | } |
1834 | 1834 | |
1835 | 1835 | return $uniqueString; |
@@ -1964,7 +1964,7 @@ discard block |
||
1964 | 1964 | return \implode( |
1965 | 1965 | '', |
1966 | 1966 | \array_map( |
1967 | - function ($data) use ($keepAsciiChars, $encoding) { |
|
1967 | + function($data) use ($keepAsciiChars, $encoding) { |
|
1968 | 1968 | return UTF8::single_chr_html_encode($data, $keepAsciiChars, $encoding); |
1969 | 1969 | }, |
1970 | 1970 | self::split($str) |
@@ -2080,7 +2080,7 @@ discard block |
||
2080 | 2080 | && |
2081 | 2081 | self::$SUPPORT['mbstring'] === false |
2082 | 2082 | ) { |
2083 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
2083 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
2084 | 2084 | } |
2085 | 2085 | |
2086 | 2086 | do { |
@@ -2088,7 +2088,7 @@ discard block |
||
2088 | 2088 | |
2089 | 2089 | $str = (string)\preg_replace_callback( |
2090 | 2090 | "/&#\d{2,6};/", |
2091 | - function ($matches) use ($encoding) { |
|
2091 | + function($matches) use ($encoding) { |
|
2092 | 2092 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
2093 | 2093 | |
2094 | 2094 | if ($returnTmp !== '"' && $returnTmp !== "'") { |
@@ -2427,9 +2427,9 @@ discard block |
||
2427 | 2427 | { |
2428 | 2428 | $hex = \dechex($int); |
2429 | 2429 | |
2430 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
2430 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
2431 | 2431 | |
2432 | - return $pfix . $hex; |
|
2432 | + return $pfix.$hex; |
|
2433 | 2433 | } |
2434 | 2434 | |
2435 | 2435 | /** |
@@ -3322,7 +3322,7 @@ discard block |
||
3322 | 3322 | $cleanUtf8 |
3323 | 3323 | ); |
3324 | 3324 | |
3325 | - return $strPartOne . $strPartTwo; |
|
3325 | + return $strPartOne.$strPartTwo; |
|
3326 | 3326 | } |
3327 | 3327 | |
3328 | 3328 | /** |
@@ -3754,7 +3754,7 @@ discard block |
||
3754 | 3754 | } |
3755 | 3755 | } |
3756 | 3756 | |
3757 | - $cacheKey = $chr_orig . $encoding; |
|
3757 | + $cacheKey = $chr_orig.$encoding; |
|
3758 | 3758 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
3759 | 3759 | return $CHAR_CACHE[$cacheKey]; |
3760 | 3760 | } |
@@ -3991,7 +3991,7 @@ discard block |
||
3991 | 3991 | } |
3992 | 3992 | |
3993 | 3993 | $str = (string)\preg_replace( |
3994 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
3994 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
3995 | 3995 | $replacement, |
3996 | 3996 | $str |
3997 | 3997 | ); |
@@ -4058,7 +4058,7 @@ discard block |
||
4058 | 4058 | if (\is_array($what) === true) { |
4059 | 4059 | /** @noinspection ForeachSourceInspection */ |
4060 | 4060 | foreach ($what as $item) { |
4061 | - $str = (string)\preg_replace('/(' . \preg_quote($item, '/') . ')+/', $item, $str); |
|
4061 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/', $item, $str); |
|
4062 | 4062 | } |
4063 | 4063 | } |
4064 | 4064 | |
@@ -4224,7 +4224,7 @@ discard block |
||
4224 | 4224 | { |
4225 | 4225 | static $RX_CLASSS_CACHE = []; |
4226 | 4226 | |
4227 | - $cacheKey = $s . $class; |
|
4227 | + $cacheKey = $s.$class; |
|
4228 | 4228 | |
4229 | 4229 | if (isset($RX_CLASSS_CACHE[$cacheKey])) { |
4230 | 4230 | return $RX_CLASSS_CACHE[$cacheKey]; |
@@ -4236,7 +4236,7 @@ discard block |
||
4236 | 4236 | /** @noinspection SuspiciousLoopInspection */ |
4237 | 4237 | foreach (self::str_split($s) as $s) { |
4238 | 4238 | if ('-' === $s) { |
4239 | - $class[0] = '-' . $class[0]; |
|
4239 | + $class[0] = '-'.$class[0]; |
|
4240 | 4240 | } elseif (!isset($s[2])) { |
4241 | 4241 | $class[0] .= \preg_quote($s, '/'); |
4242 | 4242 | } elseif (1 === self::strlen($s)) { |
@@ -4247,13 +4247,13 @@ discard block |
||
4247 | 4247 | } |
4248 | 4248 | |
4249 | 4249 | if ($class[0]) { |
4250 | - $class[0] = '[' . $class[0] . ']'; |
|
4250 | + $class[0] = '['.$class[0].']'; |
|
4251 | 4251 | } |
4252 | 4252 | |
4253 | 4253 | if (1 === \count($class)) { |
4254 | 4254 | $return = $class[0]; |
4255 | 4255 | } else { |
4256 | - $return = '(?:' . \implode('|', $class) . ')'; |
|
4256 | + $return = '(?:'.\implode('|', $class).')'; |
|
4257 | 4257 | } |
4258 | 4258 | |
4259 | 4259 | $RX_CLASSS_CACHE[$cacheKey] = $return; |
@@ -4272,7 +4272,7 @@ discard block |
||
4272 | 4272 | |
4273 | 4273 | echo '<pre>'; |
4274 | 4274 | foreach (self::$SUPPORT as $key => $value) { |
4275 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
4275 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
4276 | 4276 | } |
4277 | 4277 | echo '</pre>'; |
4278 | 4278 | } |
@@ -4304,7 +4304,7 @@ discard block |
||
4304 | 4304 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4305 | 4305 | } |
4306 | 4306 | |
4307 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
4307 | + return '&#'.self::ord($char, $encoding).';'; |
|
4308 | 4308 | } |
4309 | 4309 | |
4310 | 4310 | /** |
@@ -4376,7 +4376,7 @@ discard block |
||
4376 | 4376 | ) { |
4377 | 4377 | |
4378 | 4378 | if (($str[$i + 1] & "\xC0") === "\x80") { |
4379 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
4379 | + $ret[] = $str[$i].$str[$i + 1]; |
|
4380 | 4380 | |
4381 | 4381 | $i++; |
4382 | 4382 | } |
@@ -4392,7 +4392,7 @@ discard block |
||
4392 | 4392 | && |
4393 | 4393 | ($str[$i + 2] & "\xC0") === "\x80" |
4394 | 4394 | ) { |
4395 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
4395 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
4396 | 4396 | |
4397 | 4397 | $i += 2; |
4398 | 4398 | } |
@@ -4410,7 +4410,7 @@ discard block |
||
4410 | 4410 | && |
4411 | 4411 | ($str[$i + 3] & "\xC0") === "\x80" |
4412 | 4412 | ) { |
4413 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
4413 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
4414 | 4414 | |
4415 | 4415 | $i += 3; |
4416 | 4416 | } |
@@ -4423,7 +4423,7 @@ discard block |
||
4423 | 4423 | $ret = \array_chunk($ret, $length); |
4424 | 4424 | |
4425 | 4425 | return \array_map( |
4426 | - function ($item) { |
|
4426 | + function($item) { |
|
4427 | 4427 | return \implode('', $item); |
4428 | 4428 | }, $ret |
4429 | 4429 | ); |
@@ -4453,7 +4453,7 @@ discard block |
||
4453 | 4453 | |
4454 | 4454 | $str = (string)\preg_replace_callback( |
4455 | 4455 | '/[-_\s]+(.)?/u', |
4456 | - function ($match) use ($encoding) { |
|
4456 | + function($match) use ($encoding) { |
|
4457 | 4457 | if (isset($match[1])) { |
4458 | 4458 | return UTF8::strtoupper($match[1], $encoding); |
4459 | 4459 | } |
@@ -4465,7 +4465,7 @@ discard block |
||
4465 | 4465 | |
4466 | 4466 | $str = (string)\preg_replace_callback( |
4467 | 4467 | '/[\d]+(.)?/u', |
4468 | - function ($match) use ($encoding) { |
|
4468 | + function($match) use ($encoding) { |
|
4469 | 4469 | return UTF8::strtoupper($match[0], $encoding); |
4470 | 4470 | }, |
4471 | 4471 | $str |
@@ -4702,7 +4702,7 @@ discard block |
||
4702 | 4702 | foreach (self::$ENCODINGS as $encodingTmp) { |
4703 | 4703 | # INFO: //IGNORE and //TRANSLIT still throw notice |
4704 | 4704 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4705 | - if (\md5(@\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str)) === $md5) { |
|
4705 | + if (\md5(@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str)) === $md5) { |
|
4706 | 4706 | return $encodingTmp; |
4707 | 4707 | } |
4708 | 4708 | } |
@@ -4764,7 +4764,7 @@ discard block |
||
4764 | 4764 | public static function str_ensure_left(string $str, string $substring): string |
4765 | 4765 | { |
4766 | 4766 | if (!self::str_starts_with($str, $substring)) { |
4767 | - $str = $substring . $str; |
|
4767 | + $str = $substring.$str; |
|
4768 | 4768 | } |
4769 | 4769 | |
4770 | 4770 | return $str; |
@@ -4969,7 +4969,7 @@ discard block |
||
4969 | 4969 | $start = self::substr($str, 0, $index, $encoding); |
4970 | 4970 | $end = self::substr($str, $index, $len, $encoding); |
4971 | 4971 | |
4972 | - return $start . $substring . $end; |
|
4972 | + return $start.$substring.$end; |
|
4973 | 4973 | } |
4974 | 4974 | |
4975 | 4975 | /** |
@@ -5006,7 +5006,7 @@ discard block |
||
5006 | 5006 | if ('' === $s .= '') { |
5007 | 5007 | $s = '/^(?<=.)$/'; |
5008 | 5008 | } else { |
5009 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5009 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5010 | 5010 | } |
5011 | 5011 | } |
5012 | 5012 | |
@@ -5294,7 +5294,7 @@ discard block |
||
5294 | 5294 | } |
5295 | 5295 | |
5296 | 5296 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
5297 | - return self::substr($str, 0, $length - 1, $encoding) . $strAddOn; |
|
5297 | + return self::substr($str, 0, $length - 1, $encoding).$strAddOn; |
|
5298 | 5298 | } |
5299 | 5299 | |
5300 | 5300 | $str = (string)self::substr($str, 0, $length, $encoding); |
@@ -5303,9 +5303,9 @@ discard block |
||
5303 | 5303 | $new_str = \implode(' ', $array); |
5304 | 5304 | |
5305 | 5305 | if ($new_str === '') { |
5306 | - $str = self::substr($str, 0, $length - 1, $encoding) . $strAddOn; |
|
5306 | + $str = self::substr($str, 0, $length - 1, $encoding).$strAddOn; |
|
5307 | 5307 | } else { |
5308 | - $str = $new_str . $strAddOn; |
|
5308 | + $str = $new_str.$strAddOn; |
|
5309 | 5309 | } |
5310 | 5310 | |
5311 | 5311 | return $str; |
@@ -5411,7 +5411,7 @@ discard block |
||
5411 | 5411 | $char = self::substr($str, -$i, 1, $encoding); |
5412 | 5412 | |
5413 | 5413 | if ($char == self::substr($otherStr, -$i, 1, $encoding)) { |
5414 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
5414 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
5415 | 5415 | } else { |
5416 | 5416 | break; |
5417 | 5417 | } |
@@ -5430,7 +5430,7 @@ discard block |
||
5430 | 5430 | */ |
5431 | 5431 | public static function str_matches_pattern(string $str, string $pattern): bool |
5432 | 5432 | { |
5433 | - if (\preg_match('/' . $pattern . '/u', $str)) { |
|
5433 | + if (\preg_match('/'.$pattern.'/u', $str)) { |
|
5434 | 5434 | return true; |
5435 | 5435 | } |
5436 | 5436 | |
@@ -5520,7 +5520,7 @@ discard block |
||
5520 | 5520 | $pad_type = STR_PAD_BOTH; |
5521 | 5521 | } else { |
5522 | 5522 | throw new \InvalidArgumentException( |
5523 | - 'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
5523 | + 'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
5524 | 5524 | ); |
5525 | 5525 | } |
5526 | 5526 | } |
@@ -5557,7 +5557,7 @@ discard block |
||
5557 | 5557 | $pre = ''; |
5558 | 5558 | } |
5559 | 5559 | |
5560 | - return $pre . $str . $post; |
|
5560 | + return $pre.$str.$post; |
|
5561 | 5561 | } |
5562 | 5562 | |
5563 | 5563 | return $str; |
@@ -5760,7 +5760,7 @@ discard block |
||
5760 | 5760 | { |
5761 | 5761 | return self::regexReplace( |
5762 | 5762 | $str, |
5763 | - '^' . \preg_quote($search, '/'), |
|
5763 | + '^'.\preg_quote($search, '/'), |
|
5764 | 5764 | self::str_replace('\\', '\\\\', $replacement) |
5765 | 5765 | ); |
5766 | 5766 | } |
@@ -5778,7 +5778,7 @@ discard block |
||
5778 | 5778 | { |
5779 | 5779 | return self::regexReplace( |
5780 | 5780 | $str, |
5781 | - \preg_quote($search, '/') . '$', |
|
5781 | + \preg_quote($search, '/').'$', |
|
5782 | 5782 | self::str_replace('\\', '\\\\', $replacement) |
5783 | 5783 | ); |
5784 | 5784 | } |
@@ -5869,24 +5869,24 @@ discard block |
||
5869 | 5869 | |
5870 | 5870 | $str = (string)\preg_replace_callback( |
5871 | 5871 | '/([\d|A-Z])/u', |
5872 | - function ($matches) use ($encoding) { |
|
5872 | + function($matches) use ($encoding) { |
|
5873 | 5873 | $match = $matches[1]; |
5874 | 5874 | $matchInt = (int)$match; |
5875 | 5875 | |
5876 | 5876 | if ((string)$matchInt == $match) { |
5877 | - return '_' . $match . '_'; |
|
5877 | + return '_'.$match.'_'; |
|
5878 | 5878 | } |
5879 | 5879 | |
5880 | - return '_' . UTF8::strtolower($match, $encoding); |
|
5880 | + return '_'.UTF8::strtolower($match, $encoding); |
|
5881 | 5881 | }, |
5882 | 5882 | $str |
5883 | 5883 | ); |
5884 | 5884 | |
5885 | 5885 | $str = (string)\preg_replace( |
5886 | 5886 | [ |
5887 | - '/\s+/', // convert spaces to "_" |
|
5888 | - '/^\s+|\s+$/', // trim leading & trailing spaces |
|
5889 | - '/_+/', // remove double "_" |
|
5887 | + '/\s+/', // convert spaces to "_" |
|
5888 | + '/^\s+|\s+$/', // trim leading & trailing spaces |
|
5889 | + '/_+/', // remove double "_" |
|
5890 | 5890 | ], |
5891 | 5891 | [ |
5892 | 5892 | '_', |
@@ -5955,7 +5955,7 @@ discard block |
||
5955 | 5955 | } |
5956 | 5956 | |
5957 | 5957 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
5958 | - \preg_match_all('/' . self::GRAPHEME_CLUSTER_RX . '/u', $str, $a); |
|
5958 | + \preg_match_all('/'.self::GRAPHEME_CLUSTER_RX.'/u', $str, $a); |
|
5959 | 5959 | $a = $a[0]; |
5960 | 5960 | |
5961 | 5961 | if ($len === 1) { |
@@ -6008,7 +6008,7 @@ discard block |
||
6008 | 6008 | $limit = -1; |
6009 | 6009 | } |
6010 | 6010 | |
6011 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
6011 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
6012 | 6012 | |
6013 | 6013 | if ($limit > 0 && \count($array) === $limit) { |
6014 | 6014 | \array_pop($array); |
@@ -6286,7 +6286,7 @@ discard block |
||
6286 | 6286 | |
6287 | 6287 | $str = (string)\preg_replace_callback( |
6288 | 6288 | '/([\S]+)/u', |
6289 | - function ($match) use ($encoding, $ignore) { |
|
6289 | + function($match) use ($encoding, $ignore) { |
|
6290 | 6290 | if ($ignore && \in_array($match[0], $ignore, true)) { |
6291 | 6291 | return $match[0]; |
6292 | 6292 | } |
@@ -6355,16 +6355,16 @@ discard block |
||
6355 | 6355 | $str = (string)\preg_replace_callback( |
6356 | 6356 | '~\b (_*) (?: # 1. Leading underscore and |
6357 | 6357 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
6358 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
6358 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
6359 | 6359 | | |
6360 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
6360 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
6361 | 6361 | | |
6362 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
6362 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
6363 | 6363 | | |
6364 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
6364 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
6365 | 6365 | ) (_*) \b # 6. With trailing underscore |
6366 | 6366 | ~ux', |
6367 | - function ($matches) use ($encoding) { |
|
6367 | + function($matches) use ($encoding) { |
|
6368 | 6368 | // Preserve leading underscore |
6369 | 6369 | $str = $matches[1]; |
6370 | 6370 | if ($matches[2]) { |
@@ -6393,21 +6393,21 @@ discard block |
||
6393 | 6393 | '~( \A [[:punct:]]* # start of title... |
6394 | 6394 | | [:.;?!][ ]+ # or of subsentence... |
6395 | 6395 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
6396 | - ( ' . $smallWordsRx . ' ) \b # ...followed by small word |
|
6396 | + ( ' . $smallWordsRx.' ) \b # ...followed by small word |
|
6397 | 6397 | ~uxi', |
6398 | - function ($matches) use ($encoding) { |
|
6399 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
6398 | + function($matches) use ($encoding) { |
|
6399 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
6400 | 6400 | }, |
6401 | 6401 | $str |
6402 | 6402 | ); |
6403 | 6403 | |
6404 | 6404 | // ...and end of title |
6405 | 6405 | $str = (string)\preg_replace_callback( |
6406 | - '~\b ( ' . $smallWordsRx . ' ) # small word... |
|
6406 | + '~\b ( '.$smallWordsRx.' ) # small word... |
|
6407 | 6407 | (?= [[:punct:]]* \Z # ...at the end of the title... |
6408 | 6408 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
6409 | 6409 | ~uxi', |
6410 | - function ($matches) use ($encoding) { |
|
6410 | + function($matches) use ($encoding) { |
|
6411 | 6411 | return static::str_upper_first($matches[1], $encoding); |
6412 | 6412 | }, |
6413 | 6413 | $str |
@@ -6418,10 +6418,10 @@ discard block |
||
6418 | 6418 | $str = (string)\preg_replace_callback( |
6419 | 6419 | '~\b |
6420 | 6420 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
6421 | - ( ' . $smallWordsRx . ' ) |
|
6421 | + ( ' . $smallWordsRx.' ) |
|
6422 | 6422 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
6423 | 6423 | ~uxi', |
6424 | - function ($matches) use ($encoding) { |
|
6424 | + function($matches) use ($encoding) { |
|
6425 | 6425 | return static::str_upper_first($matches[1], $encoding); |
6426 | 6426 | }, |
6427 | 6427 | $str |
@@ -6432,11 +6432,11 @@ discard block |
||
6432 | 6432 | '~\b |
6433 | 6433 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
6434 | 6434 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
6435 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
6435 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
6436 | 6436 | (?! - ) # Negative lookahead for another - |
6437 | 6437 | ~uxi', |
6438 | - function ($matches) use ($encoding) { |
|
6439 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
6438 | + function($matches) use ($encoding) { |
|
6439 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
6440 | 6440 | }, |
6441 | 6441 | $str |
6442 | 6442 | ); |
@@ -6582,7 +6582,7 @@ discard block |
||
6582 | 6582 | |
6583 | 6583 | $truncated = self::substr($str, 0, $length, $encoding); |
6584 | 6584 | |
6585 | - return $truncated . $substring; |
|
6585 | + return $truncated.$substring; |
|
6586 | 6586 | } |
6587 | 6587 | |
6588 | 6588 | /** |
@@ -6621,7 +6621,7 @@ discard block |
||
6621 | 6621 | } |
6622 | 6622 | } |
6623 | 6623 | |
6624 | - $str = $truncated . $substring; |
|
6624 | + $str = $truncated.$substring; |
|
6625 | 6625 | |
6626 | 6626 | return $str; |
6627 | 6627 | } |
@@ -6768,7 +6768,7 @@ discard block |
||
6768 | 6768 | public static function strcmp(string $str1, string $str2): int |
6769 | 6769 | { |
6770 | 6770 | /** @noinspection PhpUndefinedClassInspection */ |
6771 | - return $str1 . '' === $str2 . '' ? 0 : \strcmp( |
|
6771 | + return $str1.'' === $str2.'' ? 0 : \strcmp( |
|
6772 | 6772 | \Normalizer::normalize($str1, \Normalizer::NFD), |
6773 | 6773 | \Normalizer::normalize($str2, \Normalizer::NFD) |
6774 | 6774 | ); |
@@ -6802,7 +6802,7 @@ discard block |
||
6802 | 6802 | return null; |
6803 | 6803 | } |
6804 | 6804 | |
6805 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $length)) { |
|
6805 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $length)) { |
|
6806 | 6806 | return self::strlen($length[1]); |
6807 | 6807 | } |
6808 | 6808 | |
@@ -7012,7 +7012,7 @@ discard block |
||
7012 | 7012 | && |
7013 | 7013 | self::$SUPPORT['mbstring'] === false |
7014 | 7014 | ) { |
7015 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
7015 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
7016 | 7016 | } |
7017 | 7017 | |
7018 | 7018 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -7031,7 +7031,7 @@ discard block |
||
7031 | 7031 | return \stristr($haystack, $needle, $before_needle); |
7032 | 7032 | } |
7033 | 7033 | |
7034 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
7034 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
7035 | 7035 | |
7036 | 7036 | if (!isset($match[1])) { |
7037 | 7037 | return false; |
@@ -7097,7 +7097,7 @@ discard block |
||
7097 | 7097 | && |
7098 | 7098 | self::$SUPPORT['iconv'] === false |
7099 | 7099 | ) { |
7100 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
7100 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
7101 | 7101 | } |
7102 | 7102 | |
7103 | 7103 | if ( |
@@ -7201,7 +7201,7 @@ discard block |
||
7201 | 7201 | */ |
7202 | 7202 | public static function strnatcmp(string $str1, string $str2): int |
7203 | 7203 | { |
7204 | - return $str1 . '' === $str2 . '' ? 0 : \strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
7204 | + return $str1.'' === $str2.'' ? 0 : \strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
7205 | 7205 | } |
7206 | 7206 | |
7207 | 7207 | /** |
@@ -7259,7 +7259,7 @@ discard block |
||
7259 | 7259 | return false; |
7260 | 7260 | } |
7261 | 7261 | |
7262 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
7262 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
7263 | 7263 | return \substr($haystack, \strpos($haystack, $m[0])); |
7264 | 7264 | } |
7265 | 7265 | |
@@ -7323,7 +7323,7 @@ discard block |
||
7323 | 7323 | && |
7324 | 7324 | self::$SUPPORT['mbstring'] === false |
7325 | 7325 | ) { |
7326 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
7326 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
7327 | 7327 | } |
7328 | 7328 | |
7329 | 7329 | if ( |
@@ -7544,7 +7544,7 @@ discard block |
||
7544 | 7544 | && |
7545 | 7545 | self::$SUPPORT['mbstring'] === false |
7546 | 7546 | ) { |
7547 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
7547 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
7548 | 7548 | } |
7549 | 7549 | |
7550 | 7550 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -7611,7 +7611,7 @@ discard block |
||
7611 | 7611 | && |
7612 | 7612 | self::$SUPPORT['mbstring'] === false |
7613 | 7613 | ) { |
7614 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
7614 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
7615 | 7615 | } |
7616 | 7616 | |
7617 | 7617 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -7676,7 +7676,7 @@ discard block |
||
7676 | 7676 | return 0; |
7677 | 7677 | } |
7678 | 7678 | |
7679 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
7679 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
7680 | 7680 | } |
7681 | 7681 | |
7682 | 7682 | /** |
@@ -7719,7 +7719,7 @@ discard block |
||
7719 | 7719 | && |
7720 | 7720 | self::$SUPPORT['mbstring'] === false |
7721 | 7721 | ) { |
7722 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
7722 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
7723 | 7723 | } |
7724 | 7724 | |
7725 | 7725 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -7734,7 +7734,7 @@ discard block |
||
7734 | 7734 | return \grapheme_strstr($haystack, $needle, $before_needle); |
7735 | 7735 | } |
7736 | 7736 | |
7737 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
7737 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
7738 | 7738 | |
7739 | 7739 | if (!isset($match[1])) { |
7740 | 7740 | return false; |
@@ -7833,9 +7833,9 @@ discard block |
||
7833 | 7833 | |
7834 | 7834 | if (self::$SUPPORT['intl'] === true) { |
7835 | 7835 | |
7836 | - $langCode = $lang . '-Lower'; |
|
7836 | + $langCode = $lang.'-Lower'; |
|
7837 | 7837 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
7838 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, E_USER_WARNING); |
|
7838 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, E_USER_WARNING); |
|
7839 | 7839 | |
7840 | 7840 | $langCode = 'Any-Lower'; |
7841 | 7841 | } |
@@ -7844,7 +7844,7 @@ discard block |
||
7844 | 7844 | return transliterator_transliterate($langCode, $str); |
7845 | 7845 | } |
7846 | 7846 | |
7847 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, E_USER_WARNING); |
|
7847 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, E_USER_WARNING); |
|
7848 | 7848 | } |
7849 | 7849 | |
7850 | 7850 | return \mb_strtolower($str, $encoding); |
@@ -7902,9 +7902,9 @@ discard block |
||
7902 | 7902 | |
7903 | 7903 | if (self::$SUPPORT['intl'] === true) { |
7904 | 7904 | |
7905 | - $langCode = $lang . '-Upper'; |
|
7905 | + $langCode = $lang.'-Upper'; |
|
7906 | 7906 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
7907 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, E_USER_WARNING); |
|
7907 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, E_USER_WARNING); |
|
7908 | 7908 | |
7909 | 7909 | $langCode = 'Any-Upper'; |
7910 | 7910 | } |
@@ -7913,7 +7913,7 @@ discard block |
||
7913 | 7913 | return transliterator_transliterate($langCode, $str); |
7914 | 7914 | } |
7915 | 7915 | |
7916 | - \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: ' . $lang, E_USER_WARNING); |
|
7916 | + \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: '.$lang, E_USER_WARNING); |
|
7917 | 7917 | } |
7918 | 7918 | |
7919 | 7919 | return \mb_strtoupper($str, $encoding); |
@@ -8069,7 +8069,7 @@ discard block |
||
8069 | 8069 | && |
8070 | 8070 | self::$SUPPORT['mbstring'] === false |
8071 | 8071 | ) { |
8072 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
8072 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
8073 | 8073 | } |
8074 | 8074 | |
8075 | 8075 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -8097,8 +8097,7 @@ discard block |
||
8097 | 8097 | |
8098 | 8098 | if (self::is_ascii($str)) { |
8099 | 8099 | return ($length === null) ? |
8100 | - \substr($str, $offset) : |
|
8101 | - \substr($str, $offset, $length); |
|
8100 | + \substr($str, $offset) : \substr($str, $offset, $length); |
|
8102 | 8101 | } |
8103 | 8102 | |
8104 | 8103 | // fallback via vanilla php |
@@ -8233,14 +8232,14 @@ discard block |
||
8233 | 8232 | && |
8234 | 8233 | self::$SUPPORT['mbstring'] === false |
8235 | 8234 | ) { |
8236 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
8235 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
8237 | 8236 | } |
8238 | 8237 | |
8239 | 8238 | if (self::$SUPPORT['mbstring'] === true) { |
8240 | 8239 | return \mb_substr_count($haystack, $needle, $encoding); |
8241 | 8240 | } |
8242 | 8241 | |
8243 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, PREG_SET_ORDER); |
|
8242 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, PREG_SET_ORDER); |
|
8244 | 8243 | |
8245 | 8244 | return \count($matches); |
8246 | 8245 | } |
@@ -8440,8 +8439,7 @@ discard block |
||
8440 | 8439 | |
8441 | 8440 | if (self::is_ascii($str)) { |
8442 | 8441 | return ($length === null) ? |
8443 | - \substr_replace($str, $replacement, $offset) : |
|
8444 | - \substr_replace($str, $replacement, $offset, $length); |
|
8442 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
8445 | 8443 | } |
8446 | 8444 | |
8447 | 8445 | \preg_match_all('/./us', $str, $smatches); |
@@ -8898,7 +8896,7 @@ discard block |
||
8898 | 8896 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
8899 | 8897 | |
8900 | 8898 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
8901 | - $buf .= $c1 . $c2; |
|
8899 | + $buf .= $c1.$c2; |
|
8902 | 8900 | $i++; |
8903 | 8901 | } else { // not valid UTF8 - convert it |
8904 | 8902 | $buf .= self::to_utf8_convert($c1); |
@@ -8910,7 +8908,7 @@ discard block |
||
8910 | 8908 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
8911 | 8909 | |
8912 | 8910 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
8913 | - $buf .= $c1 . $c2 . $c3; |
|
8911 | + $buf .= $c1.$c2.$c3; |
|
8914 | 8912 | $i += 2; |
8915 | 8913 | } else { // not valid UTF8 - convert it |
8916 | 8914 | $buf .= self::to_utf8_convert($c1); |
@@ -8923,7 +8921,7 @@ discard block |
||
8923 | 8921 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
8924 | 8922 | |
8925 | 8923 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
8926 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
8924 | + $buf .= $c1.$c2.$c3.$c4; |
|
8927 | 8925 | $i += 3; |
8928 | 8926 | } else { // not valid UTF8 - convert it |
8929 | 8927 | $buf .= self::to_utf8_convert($c1); |
@@ -8945,7 +8943,7 @@ discard block |
||
8945 | 8943 | // decode unicode escape sequences |
8946 | 8944 | $buf = \preg_replace_callback( |
8947 | 8945 | '/\\\\u([0-9a-f]{4})/i', |
8948 | - function ($match) { |
|
8946 | + function($match) { |
|
8949 | 8947 | return \mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); |
8950 | 8948 | }, |
8951 | 8949 | $buf |
@@ -8987,7 +8985,7 @@ discard block |
||
8987 | 8985 | } else { |
8988 | 8986 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
8989 | 8987 | $cc2 = ($int & "\x3F") | "\x80"; |
8990 | - $buf .= $cc1 . $cc2; |
|
8988 | + $buf .= $cc1.$cc2; |
|
8991 | 8989 | } |
8992 | 8990 | |
8993 | 8991 | return $buf; |
@@ -9051,7 +9049,7 @@ discard block |
||
9051 | 9049 | $cleanUtf8 |
9052 | 9050 | ); |
9053 | 9051 | |
9054 | - return $strPartOne . $strPartTwo; |
|
9052 | + return $strPartOne.$strPartTwo; |
|
9055 | 9053 | } |
9056 | 9054 | |
9057 | 9055 | /** |
@@ -9096,7 +9094,7 @@ discard block |
||
9096 | 9094 | $str = self::clean($str); |
9097 | 9095 | } |
9098 | 9096 | |
9099 | - $usePhpDefaultFunctions = !(bool)($charlist . \implode('', $exceptions)); |
|
9097 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
9100 | 9098 | |
9101 | 9099 | if ( |
9102 | 9100 | $usePhpDefaultFunctions === true |
@@ -9598,7 +9596,7 @@ discard block |
||
9598 | 9596 | return ''; |
9599 | 9597 | } |
9600 | 9598 | |
9601 | - \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches); |
|
9599 | + \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches); |
|
9602 | 9600 | |
9603 | 9601 | if ( |
9604 | 9602 | !isset($matches[0]) |
@@ -9608,7 +9606,7 @@ discard block |
||
9608 | 9606 | return $str; |
9609 | 9607 | } |
9610 | 9608 | |
9611 | - return self::rtrim($matches[0]) . $strAddOn; |
|
9609 | + return self::rtrim($matches[0]).$strAddOn; |
|
9612 | 9610 | } |
9613 | 9611 | |
9614 | 9612 | /** |
@@ -9673,7 +9671,7 @@ discard block |
||
9673 | 9671 | $strReturn .= $break; |
9674 | 9672 | } |
9675 | 9673 | |
9676 | - return $strReturn . \implode('', $chars); |
|
9674 | + return $strReturn.\implode('', $chars); |
|
9677 | 9675 | } |
9678 | 9676 | |
9679 | 9677 | /** |