@@ -2807,7 +2807,7 @@ discard block |
||
| 2807 | 2807 | /** |
| 2808 | 2808 | * Check if the input is binary... (is look like a hack). |
| 2809 | 2809 | * |
| 2810 | - * @param mixed $input |
|
| 2810 | + * @param string|false $input |
|
| 2811 | 2811 | * |
| 2812 | 2812 | * @return bool |
| 2813 | 2813 | */ |
@@ -5606,7 +5606,7 @@ discard block |
||
| 5606 | 5606 | * @link http://php.net/manual/en/function.mb-strrpos.php |
| 5607 | 5607 | * |
| 5608 | 5608 | * @param string $haystack <p>The string being checked, for the last occurrence of needle</p> |
| 5609 | - * @param string|int $needle <p>The string to find in haystack.<br />Or a code point as int.</p> |
|
| 5609 | + * @param string $needle <p>The string to find in haystack.<br />Or a code point as int.</p> |
|
| 5610 | 5610 | * @param int $offset [optional] <p>May be specified to begin searching an arbitrary number of characters |
| 5611 | 5611 | * into the string. Negative values will stop searching at an arbitrary point prior to |
| 5612 | 5612 | * the end of the string. |
@@ -6271,8 +6271,8 @@ discard block |
||
| 6271 | 6271 | * |
| 6272 | 6272 | * source: https://gist.github.com/stemar/8287074 |
| 6273 | 6273 | * |
| 6274 | - * @param string|string[] $str <p>The input string or an array of stings.</p> |
|
| 6275 | - * @param string|string[] $replacement <p>The replacement string or an array of stings.</p> |
|
| 6274 | + * @param string $str <p>The input string or an array of stings.</p> |
|
| 6275 | + * @param string $replacement <p>The replacement string or an array of stings.</p> |
|
| 6276 | 6276 | * @param int|int[] $start <p> |
| 6277 | 6277 | * If start is positive, the replacing will begin at the start'th offset |
| 6278 | 6278 | * into string. |
@@ -6280,7 +6280,7 @@ discard block |
||
| 6280 | 6280 | * If start is negative, the replacing will begin at the start'th character |
| 6281 | 6281 | * from the end of string. |
| 6282 | 6282 | * </p> |
| 6283 | - * @param int|int[]|void $length [optional] <p>If given and is positive, it represents the length of the |
|
| 6283 | + * @param integer $length [optional] <p>If given and is positive, it represents the length of the |
|
| 6284 | 6284 | * portion of string which is to be replaced. If it is negative, it |
| 6285 | 6285 | * represents the number of characters from the end of string at which to |
| 6286 | 6286 | * stop replacing. If it is not given, then it will default to strlen( |
@@ -6712,7 +6712,7 @@ discard block |
||
| 6712 | 6712 | * case.</li> |
| 6713 | 6713 | * </ul> |
| 6714 | 6714 | * |
| 6715 | - * @param string|string[] $str <p>Any string or array.</p> |
|
| 6715 | + * @param string|false $str <p>Any string or array.</p> |
|
| 6716 | 6716 | * @param bool $decodeHtmlEntityToUtf8 <p>Set to true, if you need to decode html-entities.</p> |
| 6717 | 6717 | * |
| 6718 | 6718 | * @return string|string[] <p>The UTF-8 encoded string.</p> |
@@ -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; |
@@ -5156,7 +5156,7 @@ discard block |
||
| 5156 | 5156 | && |
| 5157 | 5157 | self::$SUPPORT['iconv'] === false |
| 5158 | 5158 | ) { |
| 5159 | - trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 5159 | + trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 5160 | 5160 | } |
| 5161 | 5161 | |
| 5162 | 5162 | if ( |
@@ -5235,7 +5235,7 @@ discard block |
||
| 5235 | 5235 | */ |
| 5236 | 5236 | public static function strnatcmp($str1, $str2) |
| 5237 | 5237 | { |
| 5238 | - return $str1 . '' === $str2 . '' ? 0 : strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
| 5238 | + return $str1.'' === $str2.'' ? 0 : strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
| 5239 | 5239 | } |
| 5240 | 5240 | |
| 5241 | 5241 | /** |
@@ -5296,7 +5296,7 @@ discard block |
||
| 5296 | 5296 | return false; |
| 5297 | 5297 | } |
| 5298 | 5298 | |
| 5299 | - if (preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
| 5299 | + if (preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
| 5300 | 5300 | return substr($haystack, strpos($haystack, $m[0])); |
| 5301 | 5301 | } else { |
| 5302 | 5302 | return false; |
@@ -5365,7 +5365,7 @@ discard block |
||
| 5365 | 5365 | && |
| 5366 | 5366 | self::$SUPPORT['mbstring'] === false |
| 5367 | 5367 | ) { |
| 5368 | - trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 5368 | + trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 5369 | 5369 | } |
| 5370 | 5370 | |
| 5371 | 5371 | if ( |
@@ -5581,7 +5581,7 @@ discard block |
||
| 5581 | 5581 | && |
| 5582 | 5582 | self::$SUPPORT['mbstring'] === false |
| 5583 | 5583 | ) { |
| 5584 | - trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 5584 | + trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 5585 | 5585 | } |
| 5586 | 5586 | |
| 5587 | 5587 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -5661,7 +5661,7 @@ discard block |
||
| 5661 | 5661 | && |
| 5662 | 5662 | self::$SUPPORT['mbstring'] === false |
| 5663 | 5663 | ) { |
| 5664 | - trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 5664 | + trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 5665 | 5665 | } |
| 5666 | 5666 | |
| 5667 | 5667 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -5721,7 +5721,7 @@ discard block |
||
| 5721 | 5721 | return 0; |
| 5722 | 5722 | } |
| 5723 | 5723 | |
| 5724 | - return preg_match('/^' . self::rxClass($mask) . '+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
| 5724 | + return preg_match('/^'.self::rxClass($mask).'+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
| 5725 | 5725 | } |
| 5726 | 5726 | |
| 5727 | 5727 | /** |
@@ -5767,7 +5767,7 @@ discard block |
||
| 5767 | 5767 | && |
| 5768 | 5768 | self::$SUPPORT['mbstring'] === false |
| 5769 | 5769 | ) { |
| 5770 | - trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 5770 | + trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 5771 | 5771 | } |
| 5772 | 5772 | |
| 5773 | 5773 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -5784,7 +5784,7 @@ discard block |
||
| 5784 | 5784 | } |
| 5785 | 5785 | } |
| 5786 | 5786 | |
| 5787 | - preg_match('/^(.*?)' . preg_quote($needle, '/') . '/us', $haystack, $match); |
|
| 5787 | + preg_match('/^(.*?)'.preg_quote($needle, '/').'/us', $haystack, $match); |
|
| 5788 | 5788 | |
| 5789 | 5789 | if (!isset($match[1])) { |
| 5790 | 5790 | return false; |
@@ -6048,7 +6048,7 @@ discard block |
||
| 6048 | 6048 | && |
| 6049 | 6049 | self::$SUPPORT['mbstring'] === false |
| 6050 | 6050 | ) { |
| 6051 | - trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 6051 | + trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 6052 | 6052 | } |
| 6053 | 6053 | |
| 6054 | 6054 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -6167,14 +6167,14 @@ discard block |
||
| 6167 | 6167 | && |
| 6168 | 6168 | self::$SUPPORT['mbstring'] === false |
| 6169 | 6169 | ) { |
| 6170 | - trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING); |
|
| 6170 | + trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING); |
|
| 6171 | 6171 | } |
| 6172 | 6172 | |
| 6173 | 6173 | if (self::$SUPPORT['mbstring'] === true) { |
| 6174 | 6174 | return \mb_substr_count($haystack, $needle, $encoding); |
| 6175 | 6175 | } |
| 6176 | 6176 | |
| 6177 | - preg_match_all('/' . preg_quote($needle, '/') . '/us', $haystack, $matches, PREG_SET_ORDER); |
|
| 6177 | + preg_match_all('/'.preg_quote($needle, '/').'/us', $haystack, $matches, PREG_SET_ORDER); |
|
| 6178 | 6178 | |
| 6179 | 6179 | return count($matches); |
| 6180 | 6180 | } |
@@ -6421,7 +6421,7 @@ discard block |
||
| 6421 | 6421 | |
| 6422 | 6422 | $strSwappedCase = preg_replace_callback( |
| 6423 | 6423 | '/[\S]/u', |
| 6424 | - function ($match) use ($encoding) { |
|
| 6424 | + function($match) use ($encoding) { |
|
| 6425 | 6425 | $marchToUpper = UTF8::strtoupper($match[0], $encoding); |
| 6426 | 6426 | |
| 6427 | 6427 | if ($match[0] === $marchToUpper) { |
@@ -6760,13 +6760,13 @@ discard block |
||
| 6760 | 6760 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
| 6761 | 6761 | |
| 6762 | 6762 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 6763 | - $buf .= $c1 . $c2; |
|
| 6763 | + $buf .= $c1.$c2; |
|
| 6764 | 6764 | $i++; |
| 6765 | 6765 | } else { // not valid UTF8 - convert it |
| 6766 | 6766 | $cc1tmp = ord($c1) / 64; |
| 6767 | 6767 | $cc1 = self::chr_and_parse_int($cc1tmp) | "\xC0"; |
| 6768 | 6768 | $cc2 = ($c1 & "\x3F") | "\x80"; |
| 6769 | - $buf .= $cc1 . $cc2; |
|
| 6769 | + $buf .= $cc1.$cc2; |
|
| 6770 | 6770 | } |
| 6771 | 6771 | |
| 6772 | 6772 | } elseif ($c1 >= "\xE0" && $c1 <= "\xEF") { // looks like 3 bytes UTF8 |
@@ -6775,13 +6775,13 @@ discard block |
||
| 6775 | 6775 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
| 6776 | 6776 | |
| 6777 | 6777 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 6778 | - $buf .= $c1 . $c2 . $c3; |
|
| 6778 | + $buf .= $c1.$c2.$c3; |
|
| 6779 | 6779 | $i += 2; |
| 6780 | 6780 | } else { // not valid UTF8 - convert it |
| 6781 | 6781 | $cc1tmp = ord($c1) / 64; |
| 6782 | 6782 | $cc1 = self::chr_and_parse_int($cc1tmp) | "\xC0"; |
| 6783 | 6783 | $cc2 = ($c1 & "\x3F") | "\x80"; |
| 6784 | - $buf .= $cc1 . $cc2; |
|
| 6784 | + $buf .= $cc1.$cc2; |
|
| 6785 | 6785 | } |
| 6786 | 6786 | |
| 6787 | 6787 | } elseif ($c1 >= "\xF0" && $c1 <= "\xF7") { // looks like 4 bytes UTF8 |
@@ -6791,20 +6791,20 @@ discard block |
||
| 6791 | 6791 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
| 6792 | 6792 | |
| 6793 | 6793 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 6794 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
| 6794 | + $buf .= $c1.$c2.$c3.$c4; |
|
| 6795 | 6795 | $i += 3; |
| 6796 | 6796 | } else { // not valid UTF8 - convert it |
| 6797 | 6797 | $cc1tmp = ord($c1) / 64; |
| 6798 | 6798 | $cc1 = self::chr_and_parse_int($cc1tmp) | "\xC0"; |
| 6799 | 6799 | $cc2 = ($c1 & "\x3F") | "\x80"; |
| 6800 | - $buf .= $cc1 . $cc2; |
|
| 6800 | + $buf .= $cc1.$cc2; |
|
| 6801 | 6801 | } |
| 6802 | 6802 | |
| 6803 | 6803 | } else { // doesn't look like UTF8, but should be converted |
| 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 & "\xC0") === "\x80") { // needs conversion |
@@ -6815,7 +6815,7 @@ discard block |
||
| 6815 | 6815 | } else { |
| 6816 | 6816 | $cc1 = self::chr_and_parse_int($ordC1 / 64) | "\xC0"; |
| 6817 | 6817 | $cc2 = ($c1 & "\x3F") | "\x80"; |
| 6818 | - $buf .= $cc1 . $cc2; |
|
| 6818 | + $buf .= $cc1.$cc2; |
|
| 6819 | 6819 | } |
| 6820 | 6820 | |
| 6821 | 6821 | } else { // it doesn't need conversion |
@@ -6826,7 +6826,7 @@ discard block |
||
| 6826 | 6826 | // decode unicode escape sequences |
| 6827 | 6827 | $buf = preg_replace_callback( |
| 6828 | 6828 | '/\\\\u([0-9a-f]{4})/i', |
| 6829 | - function ($match) { |
|
| 6829 | + function($match) { |
|
| 6830 | 6830 | return \mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); |
| 6831 | 6831 | }, |
| 6832 | 6832 | $buf |
@@ -6880,7 +6880,7 @@ discard block |
||
| 6880 | 6880 | */ |
| 6881 | 6881 | public static function ucfirst($str, $encoding = 'UTF-8', $cleanUtf8 = false) |
| 6882 | 6882 | { |
| 6883 | - return self::strtoupper(self::substr($str, 0, 1, $encoding, $cleanUtf8), $encoding, $cleanUtf8) . self::substr($str, 1, null, $encoding, $cleanUtf8); |
|
| 6883 | + return self::strtoupper(self::substr($str, 0, 1, $encoding, $cleanUtf8), $encoding, $cleanUtf8).self::substr($str, 1, null, $encoding, $cleanUtf8); |
|
| 6884 | 6884 | } |
| 6885 | 6885 | |
| 6886 | 6886 | /** |
@@ -7387,7 +7387,7 @@ discard block |
||
| 7387 | 7387 | return ''; |
| 7388 | 7388 | } |
| 7389 | 7389 | |
| 7390 | - preg_match('/^\s*+(?:\S++\s*+){1,' . $words . '}/u', $str, $matches); |
|
| 7390 | + preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $str, $matches); |
|
| 7391 | 7391 | |
| 7392 | 7392 | if ( |
| 7393 | 7393 | !isset($matches[0]) |
@@ -7397,7 +7397,7 @@ discard block |
||
| 7397 | 7397 | return $str; |
| 7398 | 7398 | } |
| 7399 | 7399 | |
| 7400 | - return self::rtrim($matches[0]) . $strAddOn; |
|
| 7400 | + return self::rtrim($matches[0]).$strAddOn; |
|
| 7401 | 7401 | } |
| 7402 | 7402 | |
| 7403 | 7403 | /** |
@@ -7465,7 +7465,7 @@ discard block |
||
| 7465 | 7465 | $strReturn .= $break; |
| 7466 | 7466 | } |
| 7467 | 7467 | |
| 7468 | - return $strReturn . implode('', $chars); |
|
| 7468 | + return $strReturn.implode('', $chars); |
|
| 7469 | 7469 | } |
| 7470 | 7470 | |
| 7471 | 7471 | /** |