@@ -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 | |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | public static function add_bom_to_string($str) |
853 | 853 | { |
854 | 854 | if (self::string_has_bom($str) === false) { |
855 | - $str = self::bom() . $str; |
|
855 | + $str = self::bom().$str; |
|
856 | 856 | } |
857 | 857 | |
858 | 858 | return $str; |
@@ -995,7 +995,7 @@ discard block |
||
995 | 995 | |
996 | 996 | // use static cache, only if there is no support for "\IntlChar" |
997 | 997 | static $CHAR_CACHE = array(); |
998 | - $cacheKey = $code_point . $encoding; |
|
998 | + $cacheKey = $code_point.$encoding; |
|
999 | 999 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
1000 | 1000 | return $CHAR_CACHE[$cacheKey]; |
1001 | 1001 | } |
@@ -1003,16 +1003,16 @@ discard block |
||
1003 | 1003 | if (0x80 > $code_point %= 0x200000) { |
1004 | 1004 | $str = self::chr_and_parse_int($code_point); |
1005 | 1005 | } elseif (0x800 > $code_point) { |
1006 | - $str = self::chr_and_parse_int(0xC0 | $code_point >> 6) . |
|
1006 | + $str = self::chr_and_parse_int(0xC0 | $code_point >> 6). |
|
1007 | 1007 | self::chr_and_parse_int(0x80 | $code_point & 0x3F); |
1008 | 1008 | } elseif (0x10000 > $code_point) { |
1009 | - $str = self::chr_and_parse_int(0xE0 | $code_point >> 12) . |
|
1010 | - self::chr_and_parse_int(0x80 | $code_point >> 6 & 0x3F) . |
|
1009 | + $str = self::chr_and_parse_int(0xE0 | $code_point >> 12). |
|
1010 | + self::chr_and_parse_int(0x80 | $code_point >> 6 & 0x3F). |
|
1011 | 1011 | self::chr_and_parse_int(0x80 | $code_point & 0x3F); |
1012 | 1012 | } else { |
1013 | - $str = self::chr_and_parse_int(0xF0 | $code_point >> 18) . |
|
1014 | - self::chr_and_parse_int(0x80 | $code_point >> 12 & 0x3F) . |
|
1015 | - self::chr_and_parse_int(0x80 | $code_point >> 6 & 0x3F) . |
|
1013 | + $str = self::chr_and_parse_int(0xF0 | $code_point >> 18). |
|
1014 | + self::chr_and_parse_int(0x80 | $code_point >> 12 & 0x3F). |
|
1015 | + self::chr_and_parse_int(0x80 | $code_point >> 6 & 0x3F). |
|
1016 | 1016 | self::chr_and_parse_int(0x80 | $code_point & 0x3F); |
1017 | 1017 | } |
1018 | 1018 | |
@@ -1072,7 +1072,7 @@ discard block |
||
1072 | 1072 | } |
1073 | 1073 | |
1074 | 1074 | return array_map( |
1075 | - function ($data) { |
|
1075 | + function($data) { |
|
1076 | 1076 | return UTF8::strlen($data, '8BIT'); |
1077 | 1077 | }, |
1078 | 1078 | self::split($str) |
@@ -1314,7 +1314,7 @@ discard block |
||
1314 | 1314 | $flags = ENT_QUOTES; |
1315 | 1315 | } |
1316 | 1316 | |
1317 | - return self::html_entity_decode('&#' . $int . ';', $flags); |
|
1317 | + return self::html_entity_decode('&#'.$int.';', $flags); |
|
1318 | 1318 | } |
1319 | 1319 | |
1320 | 1320 | /** |
@@ -1391,7 +1391,7 @@ discard block |
||
1391 | 1391 | && |
1392 | 1392 | self::$SUPPORT['mbstring'] === false |
1393 | 1393 | ) { |
1394 | - trigger_error('UTF8::encode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
1394 | + trigger_error('UTF8::encode() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
1395 | 1395 | } |
1396 | 1396 | |
1397 | 1397 | $strEncoded = \mb_convert_encoding( |
@@ -1600,7 +1600,7 @@ discard block |
||
1600 | 1600 | ) { |
1601 | 1601 | // Prevent leading combining chars |
1602 | 1602 | // for NFC-safe concatenations. |
1603 | - $var = $leading_combining . $var; |
|
1603 | + $var = $leading_combining.$var; |
|
1604 | 1604 | } |
1605 | 1605 | } |
1606 | 1606 | |
@@ -2021,7 +2021,7 @@ discard block |
||
2021 | 2021 | */ |
2022 | 2022 | private static function getData($file) |
2023 | 2023 | { |
2024 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
2024 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
2025 | 2025 | if (file_exists($file)) { |
2026 | 2026 | /** @noinspection PhpIncludeInspection */ |
2027 | 2027 | return require $file; |
@@ -2140,7 +2140,7 @@ discard block |
||
2140 | 2140 | return implode( |
2141 | 2141 | '', |
2142 | 2142 | array_map( |
2143 | - function ($data) use ($keepAsciiChars, $encoding) { |
|
2143 | + function($data) use ($keepAsciiChars, $encoding) { |
|
2144 | 2144 | return UTF8::single_chr_html_encode($data, $keepAsciiChars, $encoding); |
2145 | 2145 | }, |
2146 | 2146 | self::split($str) |
@@ -2259,7 +2259,7 @@ discard block |
||
2259 | 2259 | |
2260 | 2260 | $str = preg_replace_callback( |
2261 | 2261 | "/&#\d{2,6};/", |
2262 | - function ($matches) use ($encoding) { |
|
2262 | + function($matches) use ($encoding) { |
|
2263 | 2263 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
2264 | 2264 | |
2265 | 2265 | if ($returnTmp !== '"' && $returnTmp !== "'") { |
@@ -2583,9 +2583,9 @@ discard block |
||
2583 | 2583 | if ((int)$int === $int) { |
2584 | 2584 | $hex = dechex($int); |
2585 | 2585 | |
2586 | - $hex = (strlen($hex) < 4 ? substr('0000' . $hex, -4) : $hex); |
|
2586 | + $hex = (strlen($hex) < 4 ? substr('0000'.$hex, -4) : $hex); |
|
2587 | 2587 | |
2588 | - return $pfix . $hex; |
|
2588 | + return $pfix.$hex; |
|
2589 | 2589 | } |
2590 | 2590 | |
2591 | 2591 | return ''; |
@@ -3315,7 +3315,7 @@ discard block |
||
3315 | 3315 | */ |
3316 | 3316 | public static function lcfirst($str) |
3317 | 3317 | { |
3318 | - return self::strtolower(self::substr($str, 0, 1)) . self::substr($str, 1); |
|
3318 | + return self::strtolower(self::substr($str, 0, 1)).self::substr($str, 1); |
|
3319 | 3319 | } |
3320 | 3320 | |
3321 | 3321 | /** |
@@ -3339,7 +3339,7 @@ discard block |
||
3339 | 3339 | return preg_replace('/^[\pZ\pC]+/u', '', $str); |
3340 | 3340 | } |
3341 | 3341 | |
3342 | - return preg_replace('/^' . self::rxClass($chars) . '+/u', '', $str); |
|
3342 | + return preg_replace('/^'.self::rxClass($chars).'+/u', '', $str); |
|
3343 | 3343 | } |
3344 | 3344 | |
3345 | 3345 | /** |
@@ -3853,7 +3853,7 @@ discard block |
||
3853 | 3853 | if (is_array($what) === true) { |
3854 | 3854 | /** @noinspection ForeachSourceInspection */ |
3855 | 3855 | foreach ($what as $item) { |
3856 | - $str = preg_replace('/(' . preg_quote($item, '/') . ')+/', $item, $str); |
|
3856 | + $str = preg_replace('/('.preg_quote($item, '/').')+/', $item, $str); |
|
3857 | 3857 | } |
3858 | 3858 | } |
3859 | 3859 | |
@@ -3966,7 +3966,7 @@ discard block |
||
3966 | 3966 | return preg_replace('/[\pZ\pC]+$/u', '', $str); |
3967 | 3967 | } |
3968 | 3968 | |
3969 | - return preg_replace('/' . self::rxClass($chars) . '+$/u', '', $str); |
|
3969 | + return preg_replace('/'.self::rxClass($chars).'+$/u', '', $str); |
|
3970 | 3970 | } |
3971 | 3971 | |
3972 | 3972 | /** |
@@ -3981,7 +3981,7 @@ discard block |
||
3981 | 3981 | { |
3982 | 3982 | static $RX_CLASSS_CACHE = array(); |
3983 | 3983 | |
3984 | - $cacheKey = $s . $class; |
|
3984 | + $cacheKey = $s.$class; |
|
3985 | 3985 | |
3986 | 3986 | if (isset($RX_CLASSS_CACHE[$cacheKey])) { |
3987 | 3987 | return $RX_CLASSS_CACHE[$cacheKey]; |
@@ -3993,7 +3993,7 @@ discard block |
||
3993 | 3993 | /** @noinspection SuspiciousLoopInspection */ |
3994 | 3994 | foreach (self::str_split($s) as $s) { |
3995 | 3995 | if ('-' === $s) { |
3996 | - $class[0] = '-' . $class[0]; |
|
3996 | + $class[0] = '-'.$class[0]; |
|
3997 | 3997 | } elseif (!isset($s[2])) { |
3998 | 3998 | $class[0] .= preg_quote($s, '/'); |
3999 | 3999 | } elseif (1 === self::strlen($s)) { |
@@ -4004,13 +4004,13 @@ discard block |
||
4004 | 4004 | } |
4005 | 4005 | |
4006 | 4006 | if ($class[0]) { |
4007 | - $class[0] = '[' . $class[0] . ']'; |
|
4007 | + $class[0] = '['.$class[0].']'; |
|
4008 | 4008 | } |
4009 | 4009 | |
4010 | 4010 | if (1 === count($class)) { |
4011 | 4011 | $return = $class[0]; |
4012 | 4012 | } else { |
4013 | - $return = '(?:' . implode('|', $class) . ')'; |
|
4013 | + $return = '(?:'.implode('|', $class).')'; |
|
4014 | 4014 | } |
4015 | 4015 | |
4016 | 4016 | $RX_CLASSS_CACHE[$cacheKey] = $return; |
@@ -4028,7 +4028,7 @@ discard block |
||
4028 | 4028 | } |
4029 | 4029 | |
4030 | 4030 | foreach (self::$SUPPORT as $utf8Support) { |
4031 | - echo $utf8Support . "\n<br>"; |
|
4031 | + echo $utf8Support."\n<br>"; |
|
4032 | 4032 | } |
4033 | 4033 | } |
4034 | 4034 | |
@@ -4062,7 +4062,7 @@ discard block |
||
4062 | 4062 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4063 | 4063 | } |
4064 | 4064 | |
4065 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
4065 | + return '&#'.self::ord($char, $encoding).';'; |
|
4066 | 4066 | } |
4067 | 4067 | |
4068 | 4068 | /** |
@@ -4129,7 +4129,7 @@ discard block |
||
4129 | 4129 | ) { |
4130 | 4130 | |
4131 | 4131 | if (($str[$i + 1] & "\xC0") === "\x80") { |
4132 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
4132 | + $ret[] = $str[$i].$str[$i + 1]; |
|
4133 | 4133 | |
4134 | 4134 | $i++; |
4135 | 4135 | } |
@@ -4145,7 +4145,7 @@ discard block |
||
4145 | 4145 | && |
4146 | 4146 | ($str[$i + 2] & "\xC0") === "\x80" |
4147 | 4147 | ) { |
4148 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
4148 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
4149 | 4149 | |
4150 | 4150 | $i += 2; |
4151 | 4151 | } |
@@ -4163,7 +4163,7 @@ discard block |
||
4163 | 4163 | && |
4164 | 4164 | ($str[$i + 3] & "\xC0") === "\x80" |
4165 | 4165 | ) { |
4166 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
4166 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
4167 | 4167 | |
4168 | 4168 | $i += 3; |
4169 | 4169 | } |
@@ -4176,7 +4176,7 @@ discard block |
||
4176 | 4176 | $ret = array_chunk($ret, $length); |
4177 | 4177 | |
4178 | 4178 | return array_map( |
4179 | - function ($item) { |
|
4179 | + function($item) { |
|
4180 | 4180 | return implode('', $item); |
4181 | 4181 | }, $ret |
4182 | 4182 | ); |
@@ -4275,7 +4275,7 @@ discard block |
||
4275 | 4275 | foreach (self::$ICONV_ENCODING as $encodingTmp) { |
4276 | 4276 | # INFO: //IGNORE and //TRANSLIT still throw notice |
4277 | 4277 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4278 | - if (md5(@\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str)) === $md5) { |
|
4278 | + if (md5(@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str)) === $md5) { |
|
4279 | 4279 | return $encodingTmp; |
4280 | 4280 | } |
4281 | 4281 | } |
@@ -4365,7 +4365,7 @@ discard block |
||
4365 | 4365 | if ('' === $s .= '') { |
4366 | 4366 | $s = '/^(?<=.)$/'; |
4367 | 4367 | } else { |
4368 | - $s = '/' . preg_quote($s, '/') . '/ui'; |
|
4368 | + $s = '/'.preg_quote($s, '/').'/ui'; |
|
4369 | 4369 | } |
4370 | 4370 | } |
4371 | 4371 | |
@@ -4423,7 +4423,7 @@ discard block |
||
4423 | 4423 | } |
4424 | 4424 | |
4425 | 4425 | if (self::substr($str, $length - 1, 1) === ' ') { |
4426 | - return self::substr($str, 0, $length - 1) . $strAddOn; |
|
4426 | + return self::substr($str, 0, $length - 1).$strAddOn; |
|
4427 | 4427 | } |
4428 | 4428 | |
4429 | 4429 | $str = self::substr($str, 0, $length); |
@@ -4432,9 +4432,9 @@ discard block |
||
4432 | 4432 | $new_str = implode(' ', $array); |
4433 | 4433 | |
4434 | 4434 | if ($new_str === '') { |
4435 | - $str = self::substr($str, 0, $length - 1) . $strAddOn; |
|
4435 | + $str = self::substr($str, 0, $length - 1).$strAddOn; |
|
4436 | 4436 | } else { |
4437 | - $str = $new_str . $strAddOn; |
|
4437 | + $str = $new_str.$strAddOn; |
|
4438 | 4438 | } |
4439 | 4439 | |
4440 | 4440 | return $str; |
@@ -4489,7 +4489,7 @@ discard block |
||
4489 | 4489 | $pre = ''; |
4490 | 4490 | } |
4491 | 4491 | |
4492 | - return $pre . $str . $post; |
|
4492 | + return $pre.$str.$post; |
|
4493 | 4493 | } |
4494 | 4494 | |
4495 | 4495 | return $str; |
@@ -4639,7 +4639,7 @@ discard block |
||
4639 | 4639 | } |
4640 | 4640 | |
4641 | 4641 | /** @noinspection PhpInternalEntityUsedInspection */ |
4642 | - preg_match_all('/' . Grapheme::GRAPHEME_CLUSTER_RX . '/u', $str, $a); |
|
4642 | + preg_match_all('/'.Grapheme::GRAPHEME_CLUSTER_RX.'/u', $str, $a); |
|
4643 | 4643 | $a = $a[0]; |
4644 | 4644 | |
4645 | 4645 | if ($len === 1) { |
@@ -4834,7 +4834,7 @@ discard block |
||
4834 | 4834 | public static function strcmp($str1, $str2) |
4835 | 4835 | { |
4836 | 4836 | /** @noinspection PhpUndefinedClassInspection */ |
4837 | - return $str1 . '' === $str2 . '' ? 0 : strcmp( |
|
4837 | + return $str1.'' === $str2.'' ? 0 : strcmp( |
|
4838 | 4838 | \Normalizer::normalize($str1, \Normalizer::NFD), |
4839 | 4839 | \Normalizer::normalize($str2, \Normalizer::NFD) |
4840 | 4840 | ); |
@@ -4865,7 +4865,7 @@ discard block |
||
4865 | 4865 | return null; |
4866 | 4866 | } |
4867 | 4867 | |
4868 | - if (preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $length)) { |
|
4868 | + if (preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $length)) { |
|
4869 | 4869 | /** @noinspection OffsetOperationsInspection */ |
4870 | 4870 | return self::strlen($length[1]); |
4871 | 4871 | } |
@@ -5080,7 +5080,7 @@ discard block |
||
5080 | 5080 | && |
5081 | 5081 | self::$SUPPORT['mbstring'] === false |
5082 | 5082 | ) { |
5083 | - trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
5083 | + trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
5084 | 5084 | } |
5085 | 5085 | |
5086 | 5086 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -5091,7 +5091,7 @@ discard block |
||
5091 | 5091 | return \grapheme_stristr($haystack, $needle, $before_needle); |
5092 | 5092 | } |
5093 | 5093 | |
5094 | - preg_match('/^(.*?)' . preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
5094 | + preg_match('/^(.*?)'.preg_quote($needle, '/').'/usi', $haystack, $match); |
|
5095 | 5095 | |
5096 | 5096 | if (!isset($match[1])) { |
5097 | 5097 | return false; |
@@ -5163,7 +5163,7 @@ discard block |
||
5163 | 5163 | && |
5164 | 5164 | self::$SUPPORT['iconv'] === false |
5165 | 5165 | ) { |
5166 | - trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
5166 | + trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
5167 | 5167 | } |
5168 | 5168 | |
5169 | 5169 | if ( |
@@ -5242,7 +5242,7 @@ discard block |
||
5242 | 5242 | */ |
5243 | 5243 | public static function strnatcmp($str1, $str2) |
5244 | 5244 | { |
5245 | - return $str1 . '' === $str2 . '' ? 0 : strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
5245 | + return $str1.'' === $str2.'' ? 0 : strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
5246 | 5246 | } |
5247 | 5247 | |
5248 | 5248 | /** |
@@ -5303,7 +5303,7 @@ discard block |
||
5303 | 5303 | return false; |
5304 | 5304 | } |
5305 | 5305 | |
5306 | - if (preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
5306 | + if (preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
5307 | 5307 | return substr($haystack, strpos($haystack, $m[0])); |
5308 | 5308 | } else { |
5309 | 5309 | return false; |
@@ -5380,7 +5380,7 @@ discard block |
||
5380 | 5380 | && |
5381 | 5381 | self::$SUPPORT['mbstring'] === false |
5382 | 5382 | ) { |
5383 | - trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
5383 | + trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
5384 | 5384 | } |
5385 | 5385 | |
5386 | 5386 | if ( |
@@ -5596,7 +5596,7 @@ discard block |
||
5596 | 5596 | && |
5597 | 5597 | self::$SUPPORT['mbstring'] === false |
5598 | 5598 | ) { |
5599 | - trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
5599 | + trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
5600 | 5600 | } |
5601 | 5601 | |
5602 | 5602 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -5676,7 +5676,7 @@ discard block |
||
5676 | 5676 | && |
5677 | 5677 | self::$SUPPORT['mbstring'] === false |
5678 | 5678 | ) { |
5679 | - trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
5679 | + trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
5680 | 5680 | } |
5681 | 5681 | |
5682 | 5682 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -5736,7 +5736,7 @@ discard block |
||
5736 | 5736 | return 0; |
5737 | 5737 | } |
5738 | 5738 | |
5739 | - return preg_match('/^' . self::rxClass($mask) . '+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
5739 | + return preg_match('/^'.self::rxClass($mask).'+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
5740 | 5740 | } |
5741 | 5741 | |
5742 | 5742 | /** |
@@ -5782,7 +5782,7 @@ discard block |
||
5782 | 5782 | && |
5783 | 5783 | self::$SUPPORT['mbstring'] === false |
5784 | 5784 | ) { |
5785 | - trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
5785 | + trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
5786 | 5786 | } |
5787 | 5787 | |
5788 | 5788 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -5799,7 +5799,7 @@ discard block |
||
5799 | 5799 | } |
5800 | 5800 | } |
5801 | 5801 | |
5802 | - preg_match('/^(.*?)' . preg_quote($needle, '/') . '/us', $haystack, $match); |
|
5802 | + preg_match('/^(.*?)'.preg_quote($needle, '/').'/us', $haystack, $match); |
|
5803 | 5803 | |
5804 | 5804 | if (!isset($match[1])) { |
5805 | 5805 | return false; |
@@ -6071,7 +6071,7 @@ discard block |
||
6071 | 6071 | && |
6072 | 6072 | self::$SUPPORT['mbstring'] === false |
6073 | 6073 | ) { |
6074 | - trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
6074 | + trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
6075 | 6075 | } |
6076 | 6076 | |
6077 | 6077 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -6190,14 +6190,14 @@ discard block |
||
6190 | 6190 | && |
6191 | 6191 | self::$SUPPORT['mbstring'] === false |
6192 | 6192 | ) { |
6193 | - trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
6193 | + trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
6194 | 6194 | } |
6195 | 6195 | |
6196 | 6196 | if (self::$SUPPORT['mbstring'] === true) { |
6197 | 6197 | return \mb_substr_count($haystack, $needle, $encoding); |
6198 | 6198 | } |
6199 | 6199 | |
6200 | - preg_match_all('/' . preg_quote($needle, '/') . '/us', $haystack, $matches, PREG_SET_ORDER); |
|
6200 | + preg_match_all('/'.preg_quote($needle, '/').'/us', $haystack, $matches, PREG_SET_ORDER); |
|
6201 | 6201 | |
6202 | 6202 | return count($matches); |
6203 | 6203 | } |
@@ -6444,7 +6444,7 @@ discard block |
||
6444 | 6444 | |
6445 | 6445 | $strSwappedCase = preg_replace_callback( |
6446 | 6446 | '/[\S]/u', |
6447 | - function ($match) use ($encoding) { |
|
6447 | + function($match) use ($encoding) { |
|
6448 | 6448 | $marchToUpper = UTF8::strtoupper($match[0], $encoding); |
6449 | 6449 | |
6450 | 6450 | if ($match[0] === $marchToUpper) { |
@@ -6783,13 +6783,13 @@ discard block |
||
6783 | 6783 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
6784 | 6784 | |
6785 | 6785 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
6786 | - $buf .= $c1 . $c2; |
|
6786 | + $buf .= $c1.$c2; |
|
6787 | 6787 | $i++; |
6788 | 6788 | } else { // not valid UTF8 - convert it |
6789 | 6789 | $cc1tmp = ord($c1) / 64; |
6790 | 6790 | $cc1 = self::chr_and_parse_int($cc1tmp) | "\xC0"; |
6791 | 6791 | $cc2 = ($c1 & "\x3F") | "\x80"; |
6792 | - $buf .= $cc1 . $cc2; |
|
6792 | + $buf .= $cc1.$cc2; |
|
6793 | 6793 | } |
6794 | 6794 | |
6795 | 6795 | } elseif ($c1 >= "\xE0" && $c1 <= "\xEF") { // looks like 3 bytes UTF8 |
@@ -6798,13 +6798,13 @@ discard block |
||
6798 | 6798 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
6799 | 6799 | |
6800 | 6800 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
6801 | - $buf .= $c1 . $c2 . $c3; |
|
6801 | + $buf .= $c1.$c2.$c3; |
|
6802 | 6802 | $i += 2; |
6803 | 6803 | } else { // not valid UTF8 - convert it |
6804 | 6804 | $cc1tmp = ord($c1) / 64; |
6805 | 6805 | $cc1 = self::chr_and_parse_int($cc1tmp) | "\xC0"; |
6806 | 6806 | $cc2 = ($c1 & "\x3F") | "\x80"; |
6807 | - $buf .= $cc1 . $cc2; |
|
6807 | + $buf .= $cc1.$cc2; |
|
6808 | 6808 | } |
6809 | 6809 | |
6810 | 6810 | } elseif ($c1 >= "\xF0" && $c1 <= "\xF7") { // looks like 4 bytes UTF8 |
@@ -6814,20 +6814,20 @@ discard block |
||
6814 | 6814 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
6815 | 6815 | |
6816 | 6816 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
6817 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
6817 | + $buf .= $c1.$c2.$c3.$c4; |
|
6818 | 6818 | $i += 3; |
6819 | 6819 | } else { // not valid UTF8 - convert it |
6820 | 6820 | $cc1tmp = ord($c1) / 64; |
6821 | 6821 | $cc1 = self::chr_and_parse_int($cc1tmp) | "\xC0"; |
6822 | 6822 | $cc2 = ($c1 & "\x3F") | "\x80"; |
6823 | - $buf .= $cc1 . $cc2; |
|
6823 | + $buf .= $cc1.$cc2; |
|
6824 | 6824 | } |
6825 | 6825 | |
6826 | 6826 | } else { // doesn't look like UTF8, but should be converted |
6827 | 6827 | $cc1tmp = ord($c1) / 64; |
6828 | 6828 | $cc1 = self::chr_and_parse_int($cc1tmp) | "\xC0"; |
6829 | 6829 | $cc2 = ($c1 & "\x3F") | "\x80"; |
6830 | - $buf .= $cc1 . $cc2; |
|
6830 | + $buf .= $cc1.$cc2; |
|
6831 | 6831 | } |
6832 | 6832 | |
6833 | 6833 | } elseif (($c1 & "\xC0") === "\x80") { // needs conversion |
@@ -6838,7 +6838,7 @@ discard block |
||
6838 | 6838 | } else { |
6839 | 6839 | $cc1 = self::chr_and_parse_int($ordC1 / 64) | "\xC0"; |
6840 | 6840 | $cc2 = ($c1 & "\x3F") | "\x80"; |
6841 | - $buf .= $cc1 . $cc2; |
|
6841 | + $buf .= $cc1.$cc2; |
|
6842 | 6842 | } |
6843 | 6843 | |
6844 | 6844 | } else { // it doesn't need conversion |
@@ -6849,7 +6849,7 @@ discard block |
||
6849 | 6849 | // decode unicode escape sequences |
6850 | 6850 | $buf = preg_replace_callback( |
6851 | 6851 | '/\\\\u([0-9a-f]{4})/i', |
6852 | - function ($match) { |
|
6852 | + function($match) { |
|
6853 | 6853 | return \mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); |
6854 | 6854 | }, |
6855 | 6855 | $buf |
@@ -6903,7 +6903,7 @@ discard block |
||
6903 | 6903 | */ |
6904 | 6904 | public static function ucfirst($str, $encoding = 'UTF-8', $cleanUtf8 = false) |
6905 | 6905 | { |
6906 | - return self::strtoupper(self::substr($str, 0, 1, $encoding, $cleanUtf8), $encoding, $cleanUtf8) . self::substr($str, 1, null, $encoding, $cleanUtf8); |
|
6906 | + return self::strtoupper(self::substr($str, 0, 1, $encoding, $cleanUtf8), $encoding, $cleanUtf8).self::substr($str, 1, null, $encoding, $cleanUtf8); |
|
6907 | 6907 | } |
6908 | 6908 | |
6909 | 6909 | /** |
@@ -7410,7 +7410,7 @@ discard block |
||
7410 | 7410 | return ''; |
7411 | 7411 | } |
7412 | 7412 | |
7413 | - preg_match('/^\s*+(?:\S++\s*+){1,' . $words . '}/u', $str, $matches); |
|
7413 | + preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $str, $matches); |
|
7414 | 7414 | |
7415 | 7415 | if ( |
7416 | 7416 | !isset($matches[0]) |
@@ -7420,7 +7420,7 @@ discard block |
||
7420 | 7420 | return $str; |
7421 | 7421 | } |
7422 | 7422 | |
7423 | - return self::rtrim($matches[0]) . $strAddOn; |
|
7423 | + return self::rtrim($matches[0]).$strAddOn; |
|
7424 | 7424 | } |
7425 | 7425 | |
7426 | 7426 | /** |
@@ -7488,7 +7488,7 @@ discard block |
||
7488 | 7488 | $strReturn .= $break; |
7489 | 7489 | } |
7490 | 7490 | |
7491 | - return $strReturn . implode('', $chars); |
|
7491 | + return $strReturn.implode('', $chars); |
|
7492 | 7492 | } |
7493 | 7493 | |
7494 | 7494 | /** |