@@ -629,22 +629,22 @@ discard block |
||
| 629 | 629 | * @psalm-suppress PossiblyNullArrayAccess |
| 630 | 630 | */ |
| 631 | 631 | $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
| 632 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 632 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 633 | 633 | } elseif ($code_point <= 0xFFFF) { |
| 634 | 634 | /** |
| 635 | 635 | * @psalm-suppress PossiblyNullArrayAccess |
| 636 | 636 | */ |
| 637 | 637 | $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
| 638 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 639 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 638 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 639 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 640 | 640 | } else { |
| 641 | 641 | /** |
| 642 | 642 | * @psalm-suppress PossiblyNullArrayAccess |
| 643 | 643 | */ |
| 644 | 644 | $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
| 645 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 646 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 647 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 645 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 646 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 647 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | if ($encoding !== 'UTF-8') { |
@@ -1131,7 +1131,7 @@ discard block |
||
| 1131 | 1131 | $asciiOffset = 0x41; |
| 1132 | 1132 | |
| 1133 | 1133 | return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? '') . |
| 1134 | - (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
|
| 1134 | + (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
|
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | 1137 | /** |
@@ -2484,10 +2484,10 @@ discard block |
||
| 2484 | 2484 | } |
| 2485 | 2485 | |
| 2486 | 2486 | $unique_helper = $rand_int . |
| 2487 | - \session_id() . |
|
| 2488 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2489 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2490 | - $extra_entropy; |
|
| 2487 | + \session_id() . |
|
| 2488 | + ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2489 | + ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2490 | + $extra_entropy; |
|
| 2491 | 2491 | |
| 2492 | 2492 | $unique_string = \uniqid($unique_helper, true); |
| 2493 | 2493 | |
@@ -6346,8 +6346,8 @@ discard block |
||
| 6346 | 6346 | |
| 6347 | 6347 | /** @noinspection UnnecessaryCastingInspection */ |
| 6348 | 6348 | return (string) \mb_substr($str, 0, $index) . |
| 6349 | - $substring . |
|
| 6350 | - (string) \mb_substr($str, $index, $len); |
|
| 6349 | + $substring . |
|
| 6350 | + (string) \mb_substr($str, $index, $len); |
|
| 6351 | 6351 | } |
| 6352 | 6352 | |
| 6353 | 6353 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -6358,8 +6358,8 @@ discard block |
||
| 6358 | 6358 | } |
| 6359 | 6359 | |
| 6360 | 6360 | return ((string) self::substr($str, 0, $index, $encoding)) . |
| 6361 | - $substring . |
|
| 6362 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
| 6361 | + $substring . |
|
| 6362 | + ((string) self::substr($str, $index, $len, $encoding)); |
|
| 6363 | 6363 | } |
| 6364 | 6364 | |
| 6365 | 6365 | /** |
@@ -8532,11 +8532,11 @@ discard block |
||
| 8532 | 8532 | if ($use_mb_functions) { |
| 8533 | 8533 | if ($encoding === 'UTF-8') { |
| 8534 | 8534 | return \mb_strtoupper(\mb_substr($match[0], 0, 1)) |
| 8535 | - . \mb_strtolower(\mb_substr($match[0], 1)); |
|
| 8535 | + . \mb_strtolower(\mb_substr($match[0], 1)); |
|
| 8536 | 8536 | } |
| 8537 | 8537 | |
| 8538 | 8538 | return \mb_strtoupper(\mb_substr($match[0], 0, 1, $encoding), $encoding) |
| 8539 | - . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
| 8539 | + . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
| 8540 | 8540 | } |
| 8541 | 8541 | |
| 8542 | 8542 | return self::ucfirst( |
@@ -8938,13 +8938,13 @@ discard block |
||
| 8938 | 8938 | } |
| 8939 | 8939 | |
| 8940 | 8940 | return ( |
| 8941 | - (string) self::substr( |
|
| 8942 | - $str, |
|
| 8943 | - 0, |
|
| 8944 | - $length, |
|
| 8945 | - $encoding |
|
| 8946 | - ) |
|
| 8947 | - ) . $substring; |
|
| 8941 | + (string) self::substr( |
|
| 8942 | + $str, |
|
| 8943 | + 0, |
|
| 8944 | + $length, |
|
| 8945 | + $encoding |
|
| 8946 | + ) |
|
| 8947 | + ) . $substring; |
|
| 8948 | 8948 | } |
| 8949 | 8949 | |
| 8950 | 8950 | /** |
@@ -11979,8 +11979,8 @@ discard block |
||
| 11979 | 11979 | |
| 11980 | 11980 | /** @noinspection AdditionOperationOnArraysInspection */ |
| 11981 | 11981 | return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
| 11982 | - $replacement . |
|
| 11983 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 11982 | + $replacement . |
|
| 11983 | + ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 11984 | 11984 | } |
| 11985 | 11985 | |
| 11986 | 11986 | // |
@@ -247,10 +247,10 @@ discard block |
||
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | if ($encoding === 'UTF-8') { |
| 250 | - return (string) \mb_substr($str, $pos, 1); |
|
| 250 | + return (string)\mb_substr($str, $pos, 1); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
| 253 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | /** |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | public static function add_bom_to_string(string $str): string |
| 269 | 269 | { |
| 270 | 270 | if (!self::string_has_bom($str)) { |
| 271 | - $str = self::bom() . $str; |
|
| 271 | + $str = self::bom().$str; |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | return $str; |
@@ -303,8 +303,8 @@ discard block |
||
| 303 | 303 | $return = []; |
| 304 | 304 | foreach ($array as $key => &$value) { |
| 305 | 305 | $key = $case === \CASE_LOWER |
| 306 | - ? self::strtolower((string) $key, $encoding) |
|
| 307 | - : self::strtoupper((string) $key, $encoding); |
|
| 306 | + ? self::strtolower((string)$key, $encoding) |
|
| 307 | + : self::strtoupper((string)$key, $encoding); |
|
| 308 | 308 | |
| 309 | 309 | $return[$key] = $value; |
| 310 | 310 | } |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | return ''; |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
| 343 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
| 344 | 344 | $end_position = \mb_strpos($str, $end, $substr_index); |
| 345 | 345 | if ( |
| 346 | 346 | $end_position === false |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | return ''; |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
| 353 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | return ''; |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
| 363 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
| 364 | 364 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
| 365 | 365 | if ( |
| 366 | 366 | $end_position === false |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | return ''; |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - return (string) self::substr( |
|
| 373 | + return (string)self::substr( |
|
| 374 | 374 | $str, |
| 375 | 375 | $substr_index, |
| 376 | 376 | $end_position - $substr_index, |
@@ -448,10 +448,10 @@ discard block |
||
| 448 | 448 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
| 449 | 449 | { |
| 450 | 450 | if ($encoding === 'UTF-8') { |
| 451 | - return (string) \mb_substr($str, $index, 1); |
|
| 451 | + return (string)\mb_substr($str, $index, 1); |
|
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - return (string) self::substr($str, $index, 1, $encoding); |
|
| 454 | + return (string)self::substr($str, $index, 1, $encoding); |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | /** |
@@ -565,14 +565,14 @@ discard block |
||
| 565 | 565 | /** |
| 566 | 566 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 567 | 567 | */ |
| 568 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 568 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | if ($code_point <= 0) { |
| 572 | 572 | return null; |
| 573 | 573 | } |
| 574 | 574 | |
| 575 | - $cache_key = $code_point . '_' . $encoding; |
|
| 575 | + $cache_key = $code_point.'_'.$encoding; |
|
| 576 | 576 | if (isset($CHAR_CACHE[$cache_key])) { |
| 577 | 577 | return $CHAR_CACHE[$cache_key]; |
| 578 | 578 | } |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | self::$CHR = self::getData('chr'); |
| 619 | 619 | } |
| 620 | 620 | |
| 621 | - $code_point = (int) $code_point; |
|
| 621 | + $code_point = (int)$code_point; |
|
| 622 | 622 | if ($code_point <= 0x7F) { |
| 623 | 623 | /** |
| 624 | 624 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -628,22 +628,22 @@ discard block |
||
| 628 | 628 | /** |
| 629 | 629 | * @psalm-suppress PossiblyNullArrayAccess |
| 630 | 630 | */ |
| 631 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
| 631 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
| 632 | 632 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 633 | 633 | } elseif ($code_point <= 0xFFFF) { |
| 634 | 634 | /** |
| 635 | 635 | * @psalm-suppress PossiblyNullArrayAccess |
| 636 | 636 | */ |
| 637 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
| 638 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 637 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
| 638 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 639 | 639 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 640 | 640 | } else { |
| 641 | 641 | /** |
| 642 | 642 | * @psalm-suppress PossiblyNullArrayAccess |
| 643 | 643 | */ |
| 644 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
| 645 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 646 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 644 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
| 645 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
| 646 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 647 | 647 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 648 | 648 | } |
| 649 | 649 | |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | |
| 697 | 697 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
| 698 | 698 | return \array_map( |
| 699 | - static function (string $data): int { |
|
| 699 | + static function(string $data): int { |
|
| 700 | 700 | // "mb_" is available if overload is used, so use it ... |
| 701 | 701 | return \mb_strlen($data, 'CP850'); // 8-BIT |
| 702 | 702 | }, |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | $char = ''; |
| 778 | 778 | } |
| 779 | 779 | |
| 780 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
| 780 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
| 781 | 781 | } |
| 782 | 782 | |
| 783 | 783 | /** |
@@ -870,7 +870,7 @@ discard block |
||
| 870 | 870 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
| 871 | 871 | /x'; |
| 872 | 872 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
| 873 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
| 873 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
| 874 | 874 | |
| 875 | 875 | if ($replace_diamond_question_mark) { |
| 876 | 876 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -907,7 +907,7 @@ discard block |
||
| 907 | 907 | public static function cleanup($str): string |
| 908 | 908 | { |
| 909 | 909 | // init |
| 910 | - $str = (string) $str; |
|
| 910 | + $str = (string)$str; |
|
| 911 | 911 | |
| 912 | 912 | if ($str === '') { |
| 913 | 913 | return ''; |
@@ -1004,7 +1004,7 @@ discard block |
||
| 1004 | 1004 | { |
| 1005 | 1005 | if (self::$SUPPORT['mbstring'] === true) { |
| 1006 | 1006 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 1007 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 1007 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 1008 | 1008 | } |
| 1009 | 1009 | |
| 1010 | 1010 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -1049,7 +1049,7 @@ discard block |
||
| 1049 | 1049 | */ |
| 1050 | 1050 | public static function css_stripe_media_queries(string $str): string |
| 1051 | 1051 | { |
| 1052 | - return (string) \preg_replace( |
|
| 1052 | + return (string)\preg_replace( |
|
| 1053 | 1053 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
| 1054 | 1054 | '', |
| 1055 | 1055 | $str |
@@ -1080,7 +1080,7 @@ discard block |
||
| 1080 | 1080 | */ |
| 1081 | 1081 | public static function decimal_to_chr($int): string |
| 1082 | 1082 | { |
| 1083 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
| 1083 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
| 1084 | 1084 | } |
| 1085 | 1085 | |
| 1086 | 1086 | /** |
@@ -1130,7 +1130,7 @@ discard block |
||
| 1130 | 1130 | $flagOffset = 0x1F1E6; |
| 1131 | 1131 | $asciiOffset = 0x41; |
| 1132 | 1132 | |
| 1133 | - return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? '') . |
|
| 1133 | + return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? ''). |
|
| 1134 | 1134 | (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
| 1135 | 1135 | } |
| 1136 | 1136 | |
@@ -1153,16 +1153,16 @@ discard block |
||
| 1153 | 1153 | self::initEmojiData(); |
| 1154 | 1154 | |
| 1155 | 1155 | if ($use_reversible_string_mappings) { |
| 1156 | - return (string) \str_replace( |
|
| 1157 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1158 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1156 | + return (string)\str_replace( |
|
| 1157 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1158 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1159 | 1159 | $str |
| 1160 | 1160 | ); |
| 1161 | 1161 | } |
| 1162 | 1162 | |
| 1163 | - return (string) \str_replace( |
|
| 1164 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 1165 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1163 | + return (string)\str_replace( |
|
| 1164 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 1165 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1166 | 1166 | $str |
| 1167 | 1167 | ); |
| 1168 | 1168 | } |
@@ -1186,16 +1186,16 @@ discard block |
||
| 1186 | 1186 | self::initEmojiData(); |
| 1187 | 1187 | |
| 1188 | 1188 | if ($use_reversible_string_mappings) { |
| 1189 | - return (string) \str_replace( |
|
| 1190 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1191 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1189 | + return (string)\str_replace( |
|
| 1190 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1191 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1192 | 1192 | $str |
| 1193 | 1193 | ); |
| 1194 | 1194 | } |
| 1195 | 1195 | |
| 1196 | - return (string) \str_replace( |
|
| 1197 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1198 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 1196 | + return (string)\str_replace( |
|
| 1197 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1198 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 1199 | 1199 | $str |
| 1200 | 1200 | ); |
| 1201 | 1201 | } |
@@ -1251,7 +1251,7 @@ discard block |
||
| 1251 | 1251 | if ($to_encoding === 'JSON') { |
| 1252 | 1252 | $return = self::json_encode($str); |
| 1253 | 1253 | if ($return === false) { |
| 1254 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
| 1254 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
| 1255 | 1255 | } |
| 1256 | 1256 | |
| 1257 | 1257 | return $return; |
@@ -1341,7 +1341,7 @@ discard block |
||
| 1341 | 1341 | /** |
| 1342 | 1342 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 1343 | 1343 | */ |
| 1344 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
| 1344 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
| 1345 | 1345 | } |
| 1346 | 1346 | |
| 1347 | 1347 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1440,31 +1440,31 @@ discard block |
||
| 1440 | 1440 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
| 1441 | 1441 | |
| 1442 | 1442 | if ($length === null) { |
| 1443 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
| 1443 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
| 1444 | 1444 | } |
| 1445 | 1445 | |
| 1446 | 1446 | if ($search === '') { |
| 1447 | 1447 | if ($encoding === 'UTF-8') { |
| 1448 | 1448 | if ($length > 0) { |
| 1449 | - $string_length = (int) \mb_strlen($str); |
|
| 1449 | + $string_length = (int)\mb_strlen($str); |
|
| 1450 | 1450 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
| 1451 | 1451 | } else { |
| 1452 | 1452 | $end = 0; |
| 1453 | 1453 | } |
| 1454 | 1454 | |
| 1455 | - $pos = (int) \min( |
|
| 1455 | + $pos = (int)\min( |
|
| 1456 | 1456 | \mb_strpos($str, ' ', $end), |
| 1457 | 1457 | \mb_strpos($str, '.', $end) |
| 1458 | 1458 | ); |
| 1459 | 1459 | } else { |
| 1460 | 1460 | if ($length > 0) { |
| 1461 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 1461 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 1462 | 1462 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
| 1463 | 1463 | } else { |
| 1464 | 1464 | $end = 0; |
| 1465 | 1465 | } |
| 1466 | 1466 | |
| 1467 | - $pos = (int) \min( |
|
| 1467 | + $pos = (int)\min( |
|
| 1468 | 1468 | self::strpos($str, ' ', $end, $encoding), |
| 1469 | 1469 | self::strpos($str, '.', $end, $encoding) |
| 1470 | 1470 | ); |
@@ -1481,18 +1481,18 @@ discard block |
||
| 1481 | 1481 | return ''; |
| 1482 | 1482 | } |
| 1483 | 1483 | |
| 1484 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1484 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1485 | 1485 | } |
| 1486 | 1486 | |
| 1487 | 1487 | return $str; |
| 1488 | 1488 | } |
| 1489 | 1489 | |
| 1490 | 1490 | if ($encoding === 'UTF-8') { |
| 1491 | - $word_position = (int) \mb_stripos($str, $search); |
|
| 1492 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
| 1491 | + $word_position = (int)\mb_stripos($str, $search); |
|
| 1492 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
| 1493 | 1493 | } else { |
| 1494 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
| 1495 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
| 1494 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
| 1495 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
| 1496 | 1496 | } |
| 1497 | 1497 | |
| 1498 | 1498 | $pos_start = 0; |
@@ -1504,12 +1504,12 @@ discard block |
||
| 1504 | 1504 | } |
| 1505 | 1505 | if ($half_text !== false) { |
| 1506 | 1506 | if ($encoding === 'UTF-8') { |
| 1507 | - $pos_start = (int) \max( |
|
| 1507 | + $pos_start = (int)\max( |
|
| 1508 | 1508 | \mb_strrpos($half_text, ' '), |
| 1509 | 1509 | \mb_strrpos($half_text, '.') |
| 1510 | 1510 | ); |
| 1511 | 1511 | } else { |
| 1512 | - $pos_start = (int) \max( |
|
| 1512 | + $pos_start = (int)\max( |
|
| 1513 | 1513 | self::strrpos($half_text, ' ', 0, $encoding), |
| 1514 | 1514 | self::strrpos($half_text, '.', 0, $encoding) |
| 1515 | 1515 | ); |
@@ -1519,19 +1519,19 @@ discard block |
||
| 1519 | 1519 | |
| 1520 | 1520 | if ($word_position && $half_side > 0) { |
| 1521 | 1521 | $offset = $pos_start + $length - 1; |
| 1522 | - $real_length = (int) self::strlen($str, $encoding); |
|
| 1522 | + $real_length = (int)self::strlen($str, $encoding); |
|
| 1523 | 1523 | |
| 1524 | 1524 | if ($offset > $real_length) { |
| 1525 | 1525 | $offset = $real_length; |
| 1526 | 1526 | } |
| 1527 | 1527 | |
| 1528 | 1528 | if ($encoding === 'UTF-8') { |
| 1529 | - $pos_end = (int) \min( |
|
| 1529 | + $pos_end = (int)\min( |
|
| 1530 | 1530 | \mb_strpos($str, ' ', $offset), |
| 1531 | 1531 | \mb_strpos($str, '.', $offset) |
| 1532 | 1532 | ) - $pos_start; |
| 1533 | 1533 | } else { |
| 1534 | - $pos_end = (int) \min( |
|
| 1534 | + $pos_end = (int)\min( |
|
| 1535 | 1535 | self::strpos($str, ' ', $offset, $encoding), |
| 1536 | 1536 | self::strpos($str, '.', $offset, $encoding) |
| 1537 | 1537 | ) - $pos_start; |
@@ -1539,12 +1539,12 @@ discard block |
||
| 1539 | 1539 | |
| 1540 | 1540 | if (!$pos_end || $pos_end <= 0) { |
| 1541 | 1541 | if ($encoding === 'UTF-8') { |
| 1542 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
| 1542 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
| 1543 | 1543 | } else { |
| 1544 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
| 1544 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
| 1545 | 1545 | } |
| 1546 | 1546 | if ($str_sub !== false) { |
| 1547 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
| 1547 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
| 1548 | 1548 | } else { |
| 1549 | 1549 | $extract = ''; |
| 1550 | 1550 | } |
@@ -1555,26 +1555,26 @@ discard block |
||
| 1555 | 1555 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
| 1556 | 1556 | } |
| 1557 | 1557 | if ($str_sub !== false) { |
| 1558 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1558 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1559 | 1559 | } else { |
| 1560 | 1560 | $extract = ''; |
| 1561 | 1561 | } |
| 1562 | 1562 | } |
| 1563 | 1563 | } else { |
| 1564 | 1564 | $offset = $length - 1; |
| 1565 | - $true_length = (int) self::strlen($str, $encoding); |
|
| 1565 | + $true_length = (int)self::strlen($str, $encoding); |
|
| 1566 | 1566 | |
| 1567 | 1567 | if ($offset > $true_length) { |
| 1568 | 1568 | $offset = $true_length; |
| 1569 | 1569 | } |
| 1570 | 1570 | |
| 1571 | 1571 | if ($encoding === 'UTF-8') { |
| 1572 | - $pos_end = (int) \min( |
|
| 1572 | + $pos_end = (int)\min( |
|
| 1573 | 1573 | \mb_strpos($str, ' ', $offset), |
| 1574 | 1574 | \mb_strpos($str, '.', $offset) |
| 1575 | 1575 | ); |
| 1576 | 1576 | } else { |
| 1577 | - $pos_end = (int) \min( |
|
| 1577 | + $pos_end = (int)\min( |
|
| 1578 | 1578 | self::strpos($str, ' ', $offset, $encoding), |
| 1579 | 1579 | self::strpos($str, '.', $offset, $encoding) |
| 1580 | 1580 | ); |
@@ -1587,7 +1587,7 @@ discard block |
||
| 1587 | 1587 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
| 1588 | 1588 | } |
| 1589 | 1589 | if ($str_sub !== false) { |
| 1590 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1590 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1591 | 1591 | } else { |
| 1592 | 1592 | $extract = ''; |
| 1593 | 1593 | } |
@@ -1716,7 +1716,7 @@ discard block |
||
| 1716 | 1716 | { |
| 1717 | 1717 | $file_content = \file_get_contents($file_path); |
| 1718 | 1718 | if ($file_content === false) { |
| 1719 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
| 1719 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
| 1720 | 1720 | } |
| 1721 | 1721 | |
| 1722 | 1722 | return self::string_has_bom($file_content); |
@@ -1776,7 +1776,7 @@ discard block |
||
| 1776 | 1776 | ) { |
| 1777 | 1777 | // Prevent leading combining chars |
| 1778 | 1778 | // for NFC-safe concatenations. |
| 1779 | - $var = $leading_combining . $var; |
|
| 1779 | + $var = $leading_combining.$var; |
|
| 1780 | 1780 | } |
| 1781 | 1781 | } |
| 1782 | 1782 | |
@@ -2061,10 +2061,10 @@ discard block |
||
| 2061 | 2061 | } |
| 2062 | 2062 | |
| 2063 | 2063 | if ($encoding === 'UTF-8') { |
| 2064 | - return (string) \mb_substr($str, 0, $n); |
|
| 2064 | + return (string)\mb_substr($str, 0, $n); |
|
| 2065 | 2065 | } |
| 2066 | 2066 | |
| 2067 | - return (string) self::substr($str, 0, $n, $encoding); |
|
| 2067 | + return (string)self::substr($str, 0, $n, $encoding); |
|
| 2068 | 2068 | } |
| 2069 | 2069 | |
| 2070 | 2070 | /** |
@@ -2080,7 +2080,7 @@ discard block |
||
| 2080 | 2080 | */ |
| 2081 | 2081 | public static function fits_inside(string $str, int $box_size): bool |
| 2082 | 2082 | { |
| 2083 | - return (int) self::strlen($str) <= $box_size; |
|
| 2083 | + return (int)self::strlen($str) <= $box_size; |
|
| 2084 | 2084 | } |
| 2085 | 2085 | |
| 2086 | 2086 | /** |
@@ -2159,7 +2159,7 @@ discard block |
||
| 2159 | 2159 | return $str; |
| 2160 | 2160 | } |
| 2161 | 2161 | |
| 2162 | - $str = (string) $str; |
|
| 2162 | + $str = (string)$str; |
|
| 2163 | 2163 | $last = ''; |
| 2164 | 2164 | while ($last !== $str) { |
| 2165 | 2165 | $last = $str; |
@@ -2366,7 +2366,7 @@ discard block |
||
| 2366 | 2366 | return $fallback; |
| 2367 | 2367 | } |
| 2368 | 2368 | /** @noinspection OffsetOperationsInspection */ |
| 2369 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
| 2369 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
| 2370 | 2370 | |
| 2371 | 2371 | // DEBUG |
| 2372 | 2372 | //var_dump($type_code); |
@@ -2424,7 +2424,7 @@ discard block |
||
| 2424 | 2424 | // |
| 2425 | 2425 | |
| 2426 | 2426 | if ($encoding === 'UTF-8') { |
| 2427 | - $max_length = (int) \mb_strlen($possible_chars); |
|
| 2427 | + $max_length = (int)\mb_strlen($possible_chars); |
|
| 2428 | 2428 | if ($max_length === 0) { |
| 2429 | 2429 | return ''; |
| 2430 | 2430 | } |
@@ -2445,7 +2445,7 @@ discard block |
||
| 2445 | 2445 | } else { |
| 2446 | 2446 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 2447 | 2447 | |
| 2448 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
| 2448 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
| 2449 | 2449 | if ($max_length === 0) { |
| 2450 | 2450 | return ''; |
| 2451 | 2451 | } |
@@ -2483,16 +2483,16 @@ discard block |
||
| 2483 | 2483 | $rand_int = \mt_rand(0, \mt_getrandmax()); |
| 2484 | 2484 | } |
| 2485 | 2485 | |
| 2486 | - $unique_helper = $rand_int . |
|
| 2487 | - \session_id() . |
|
| 2488 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2489 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2486 | + $unique_helper = $rand_int. |
|
| 2487 | + \session_id(). |
|
| 2488 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
| 2489 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
| 2490 | 2490 | $extra_entropy; |
| 2491 | 2491 | |
| 2492 | 2492 | $unique_string = \uniqid($unique_helper, true); |
| 2493 | 2493 | |
| 2494 | 2494 | if ($use_md5) { |
| 2495 | - $unique_string = \md5($unique_string . $unique_helper); |
|
| 2495 | + $unique_string = \md5($unique_string.$unique_helper); |
|
| 2496 | 2496 | } |
| 2497 | 2497 | |
| 2498 | 2498 | return $unique_string; |
@@ -2603,7 +2603,7 @@ discard block |
||
| 2603 | 2603 | public static function hex_to_int($hexdec) |
| 2604 | 2604 | { |
| 2605 | 2605 | // init |
| 2606 | - $hexdec = (string) $hexdec; |
|
| 2606 | + $hexdec = (string)$hexdec; |
|
| 2607 | 2607 | |
| 2608 | 2608 | if ($hexdec === '') { |
| 2609 | 2609 | return false; |
@@ -2700,7 +2700,7 @@ discard block |
||
| 2700 | 2700 | return \implode( |
| 2701 | 2701 | '', |
| 2702 | 2702 | \array_map( |
| 2703 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
| 2703 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
| 2704 | 2704 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
| 2705 | 2705 | }, |
| 2706 | 2706 | self::str_split($str) |
@@ -2812,7 +2812,7 @@ discard block |
||
| 2812 | 2812 | /** |
| 2813 | 2813 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 2814 | 2814 | */ |
| 2815 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 2815 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 2816 | 2816 | } |
| 2817 | 2817 | |
| 2818 | 2818 | do { |
@@ -2821,7 +2821,7 @@ discard block |
||
| 2821 | 2821 | if (\strpos($str, '&') !== false) { |
| 2822 | 2822 | if (\strpos($str, '&#') !== false) { |
| 2823 | 2823 | // decode also numeric & UTF16 two byte entities |
| 2824 | - $str = (string) \preg_replace( |
|
| 2824 | + $str = (string)\preg_replace( |
|
| 2825 | 2825 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
| 2826 | 2826 | '$1;', |
| 2827 | 2827 | $str |
@@ -2871,7 +2871,7 @@ discard block |
||
| 2871 | 2871 | */ |
| 2872 | 2872 | public static function html_stripe_empty_tags(string $str): string |
| 2873 | 2873 | { |
| 2874 | - return (string) \preg_replace( |
|
| 2874 | + return (string)\preg_replace( |
|
| 2875 | 2875 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
| 2876 | 2876 | '', |
| 2877 | 2877 | $str |
@@ -3191,9 +3191,9 @@ discard block |
||
| 3191 | 3191 | { |
| 3192 | 3192 | $hex = \dechex($int); |
| 3193 | 3193 | |
| 3194 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
| 3194 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
| 3195 | 3195 | |
| 3196 | - return $prefix . $hex . ''; |
|
| 3196 | + return $prefix.$hex.''; |
|
| 3197 | 3197 | } |
| 3198 | 3198 | |
| 3199 | 3199 | /** |
@@ -3514,7 +3514,7 @@ discard block |
||
| 3514 | 3514 | */ |
| 3515 | 3515 | public static function is_binary($input, bool $strict = false): bool |
| 3516 | 3516 | { |
| 3517 | - $input = (string) $input; |
|
| 3517 | + $input = (string)$input; |
|
| 3518 | 3518 | if ($input === '') { |
| 3519 | 3519 | return false; |
| 3520 | 3520 | } |
@@ -3858,7 +3858,7 @@ discard block |
||
| 3858 | 3858 | public static function is_utf16($str, bool $check_if_string_is_binary = true) |
| 3859 | 3859 | { |
| 3860 | 3860 | // init |
| 3861 | - $str = (string) $str; |
|
| 3861 | + $str = (string)$str; |
|
| 3862 | 3862 | $str_chars = []; |
| 3863 | 3863 | |
| 3864 | 3864 | if ( |
@@ -3944,7 +3944,7 @@ discard block |
||
| 3944 | 3944 | public static function is_utf32($str, bool $check_if_string_is_binary = true) |
| 3945 | 3945 | { |
| 3946 | 3946 | // init |
| 3947 | - $str = (string) $str; |
|
| 3947 | + $str = (string)$str; |
|
| 3948 | 3948 | $str_chars = []; |
| 3949 | 3949 | |
| 3950 | 3950 | if ( |
@@ -4036,7 +4036,7 @@ discard block |
||
| 4036 | 4036 | return true; |
| 4037 | 4037 | } |
| 4038 | 4038 | |
| 4039 | - return self::is_utf8_string((string) $str, $strict); |
|
| 4039 | + return self::is_utf8_string((string)$str, $strict); |
|
| 4040 | 4040 | } |
| 4041 | 4041 | |
| 4042 | 4042 | /** |
@@ -4186,15 +4186,15 @@ discard block |
||
| 4186 | 4186 | $use_mb_functions = ($lang === null && !$try_to_keep_the_string_length); |
| 4187 | 4187 | |
| 4188 | 4188 | if ($encoding === 'UTF-8') { |
| 4189 | - $str_part_two = (string) \mb_substr($str, 1); |
|
| 4189 | + $str_part_two = (string)\mb_substr($str, 1); |
|
| 4190 | 4190 | |
| 4191 | 4191 | if ($use_mb_functions) { |
| 4192 | 4192 | $str_part_one = \mb_strtolower( |
| 4193 | - (string) \mb_substr($str, 0, 1) |
|
| 4193 | + (string)\mb_substr($str, 0, 1) |
|
| 4194 | 4194 | ); |
| 4195 | 4195 | } else { |
| 4196 | 4196 | $str_part_one = self::strtolower( |
| 4197 | - (string) \mb_substr($str, 0, 1), |
|
| 4197 | + (string)\mb_substr($str, 0, 1), |
|
| 4198 | 4198 | $encoding, |
| 4199 | 4199 | false, |
| 4200 | 4200 | $lang, |
@@ -4204,10 +4204,10 @@ discard block |
||
| 4204 | 4204 | } else { |
| 4205 | 4205 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4206 | 4206 | |
| 4207 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
| 4207 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
| 4208 | 4208 | |
| 4209 | 4209 | $str_part_one = self::strtolower( |
| 4210 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 4210 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 4211 | 4211 | $encoding, |
| 4212 | 4212 | false, |
| 4213 | 4213 | $lang, |
@@ -4215,7 +4215,7 @@ discard block |
||
| 4215 | 4215 | ); |
| 4216 | 4216 | } |
| 4217 | 4217 | |
| 4218 | - return $str_part_one . $str_part_two; |
|
| 4218 | + return $str_part_one.$str_part_two; |
|
| 4219 | 4219 | } |
| 4220 | 4220 | |
| 4221 | 4221 | /** |
@@ -4362,7 +4362,7 @@ discard block |
||
| 4362 | 4362 | } |
| 4363 | 4363 | |
| 4364 | 4364 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4365 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 4365 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 4366 | 4366 | } |
| 4367 | 4367 | |
| 4368 | 4368 | if ($chars) { |
@@ -4415,7 +4415,7 @@ discard block |
||
| 4415 | 4415 | { |
| 4416 | 4416 | $bytes = self::chr_size_list($str); |
| 4417 | 4417 | if ($bytes !== []) { |
| 4418 | - return (int) \max($bytes); |
|
| 4418 | + return (int)\max($bytes); |
|
| 4419 | 4419 | } |
| 4420 | 4420 | |
| 4421 | 4421 | return 0; |
@@ -4497,7 +4497,7 @@ discard block |
||
| 4497 | 4497 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
| 4498 | 4498 | |
| 4499 | 4499 | // init |
| 4500 | - $encoding = (string) $encoding; |
|
| 4500 | + $encoding = (string)$encoding; |
|
| 4501 | 4501 | |
| 4502 | 4502 | if (!$encoding) { |
| 4503 | 4503 | return $fallback; |
@@ -4559,7 +4559,7 @@ discard block |
||
| 4559 | 4559 | |
| 4560 | 4560 | $encoding_original = $encoding; |
| 4561 | 4561 | $encoding = \strtoupper($encoding); |
| 4562 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
| 4562 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
| 4563 | 4563 | |
| 4564 | 4564 | $equivalences = [ |
| 4565 | 4565 | 'ISO8859' => 'ISO-8859-1', |
@@ -4717,13 +4717,13 @@ discard block |
||
| 4717 | 4717 | static $CHAR_CACHE = []; |
| 4718 | 4718 | |
| 4719 | 4719 | // init |
| 4720 | - $chr = (string) $chr; |
|
| 4720 | + $chr = (string)$chr; |
|
| 4721 | 4721 | |
| 4722 | 4722 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
| 4723 | 4723 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4724 | 4724 | } |
| 4725 | 4725 | |
| 4726 | - $cache_key = $chr . '_' . $encoding; |
|
| 4726 | + $cache_key = $chr.'_'.$encoding; |
|
| 4727 | 4727 | if (isset($CHAR_CACHE[$cache_key])) { |
| 4728 | 4728 | return $CHAR_CACHE[$cache_key]; |
| 4729 | 4729 | } |
@@ -4758,7 +4758,7 @@ discard block |
||
| 4758 | 4758 | // |
| 4759 | 4759 | |
| 4760 | 4760 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 4761 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
| 4761 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
| 4762 | 4762 | /** @noinspection OffsetOperationsInspection */ |
| 4763 | 4763 | $code = $chr ? $chr[1] : 0; |
| 4764 | 4764 | |
@@ -4766,21 +4766,21 @@ discard block |
||
| 4766 | 4766 | if ($code >= 0xF0 && isset($chr[4])) { |
| 4767 | 4767 | /** @noinspection UnnecessaryCastingInspection */ |
| 4768 | 4768 | /** @noinspection OffsetOperationsInspection */ |
| 4769 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 4769 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 4770 | 4770 | } |
| 4771 | 4771 | |
| 4772 | 4772 | /** @noinspection OffsetOperationsInspection */ |
| 4773 | 4773 | if ($code >= 0xE0 && isset($chr[3])) { |
| 4774 | 4774 | /** @noinspection UnnecessaryCastingInspection */ |
| 4775 | 4775 | /** @noinspection OffsetOperationsInspection */ |
| 4776 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 4776 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 4777 | 4777 | } |
| 4778 | 4778 | |
| 4779 | 4779 | /** @noinspection OffsetOperationsInspection */ |
| 4780 | 4780 | if ($code >= 0xC0 && isset($chr[2])) { |
| 4781 | 4781 | /** @noinspection UnnecessaryCastingInspection */ |
| 4782 | 4782 | /** @noinspection OffsetOperationsInspection */ |
| 4783 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 4783 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 4784 | 4784 | } |
| 4785 | 4785 | |
| 4786 | 4786 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -4837,7 +4837,7 @@ discard block |
||
| 4837 | 4837 | public static function pcre_utf8_support(): bool |
| 4838 | 4838 | { |
| 4839 | 4839 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 4840 | - return (bool) @\preg_match('//u', ''); |
|
| 4840 | + return (bool)@\preg_match('//u', ''); |
|
| 4841 | 4841 | } |
| 4842 | 4842 | |
| 4843 | 4843 | /** |
@@ -4876,14 +4876,14 @@ discard block |
||
| 4876 | 4876 | * @psalm-suppress DocblockTypeContradiction |
| 4877 | 4877 | */ |
| 4878 | 4878 | if (!\is_numeric($step)) { |
| 4879 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
| 4879 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
| 4880 | 4880 | } |
| 4881 | 4881 | |
| 4882 | 4882 | /** |
| 4883 | 4883 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
| 4884 | 4884 | */ |
| 4885 | 4885 | if ($step <= 0) { |
| 4886 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
| 4886 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
| 4887 | 4887 | } |
| 4888 | 4888 | } |
| 4889 | 4889 | |
@@ -4895,14 +4895,14 @@ discard block |
||
| 4895 | 4895 | $is_xdigit = false; |
| 4896 | 4896 | |
| 4897 | 4897 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4898 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
| 4898 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
| 4899 | 4899 | $is_digit = true; |
| 4900 | - $start = (int) $var1; |
|
| 4900 | + $start = (int)$var1; |
|
| 4901 | 4901 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
| 4902 | 4902 | $is_xdigit = true; |
| 4903 | - $start = (int) self::hex_to_int($var1); |
|
| 4903 | + $start = (int)self::hex_to_int($var1); |
|
| 4904 | 4904 | } elseif (!$use_ctype && \is_numeric($var1)) { |
| 4905 | - $start = (int) $var1; |
|
| 4905 | + $start = (int)$var1; |
|
| 4906 | 4906 | } else { |
| 4907 | 4907 | $start = self::ord($var1); |
| 4908 | 4908 | } |
@@ -4912,11 +4912,11 @@ discard block |
||
| 4912 | 4912 | } |
| 4913 | 4913 | |
| 4914 | 4914 | if ($is_digit) { |
| 4915 | - $end = (int) $var2; |
|
| 4915 | + $end = (int)$var2; |
|
| 4916 | 4916 | } elseif ($is_xdigit) { |
| 4917 | - $end = (int) self::hex_to_int($var2); |
|
| 4917 | + $end = (int)self::hex_to_int($var2); |
|
| 4918 | 4918 | } elseif (!$use_ctype && \is_numeric($var2)) { |
| 4919 | - $end = (int) $var2; |
|
| 4919 | + $end = (int)$var2; |
|
| 4920 | 4920 | } else { |
| 4921 | 4921 | $end = self::ord($var2); |
| 4922 | 4922 | } |
@@ -4927,7 +4927,7 @@ discard block |
||
| 4927 | 4927 | |
| 4928 | 4928 | $array = []; |
| 4929 | 4929 | foreach (\range($start, $end, $step) as $i) { |
| 4930 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
| 4930 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
| 4931 | 4931 | } |
| 4932 | 4932 | |
| 4933 | 4933 | return $array; |
@@ -5037,8 +5037,8 @@ discard block |
||
| 5037 | 5037 | $delimiter = '/'; |
| 5038 | 5038 | } |
| 5039 | 5039 | |
| 5040 | - return (string) \preg_replace( |
|
| 5041 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
| 5040 | + return (string)\preg_replace( |
|
| 5041 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
| 5042 | 5042 | $replacement, |
| 5043 | 5043 | $str |
| 5044 | 5044 | ); |
@@ -5086,9 +5086,9 @@ discard block |
||
| 5086 | 5086 | return ''; |
| 5087 | 5087 | } |
| 5088 | 5088 | |
| 5089 | - $str_length -= (int) $bom_byte_length; |
|
| 5089 | + $str_length -= (int)$bom_byte_length; |
|
| 5090 | 5090 | |
| 5091 | - $str = (string) $str_tmp; |
|
| 5091 | + $str = (string)$str_tmp; |
|
| 5092 | 5092 | } |
| 5093 | 5093 | } |
| 5094 | 5094 | |
@@ -5117,7 +5117,7 @@ discard block |
||
| 5117 | 5117 | */ |
| 5118 | 5118 | if (\is_array($what)) { |
| 5119 | 5119 | foreach ($what as $item) { |
| 5120 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
| 5120 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
| 5121 | 5121 | } |
| 5122 | 5122 | } |
| 5123 | 5123 | |
@@ -5155,7 +5155,7 @@ discard block |
||
| 5155 | 5155 | */ |
| 5156 | 5156 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
| 5157 | 5157 | { |
| 5158 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 5158 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 5159 | 5159 | } |
| 5160 | 5160 | |
| 5161 | 5161 | /** |
@@ -5210,17 +5210,17 @@ discard block |
||
| 5210 | 5210 | ): string { |
| 5211 | 5211 | if ($substring && \strpos($str, $substring) === 0) { |
| 5212 | 5212 | if ($encoding === 'UTF-8') { |
| 5213 | - return (string) \mb_substr( |
|
| 5213 | + return (string)\mb_substr( |
|
| 5214 | 5214 | $str, |
| 5215 | - (int) \mb_strlen($substring) |
|
| 5215 | + (int)\mb_strlen($substring) |
|
| 5216 | 5216 | ); |
| 5217 | 5217 | } |
| 5218 | 5218 | |
| 5219 | 5219 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5220 | 5220 | |
| 5221 | - return (string) self::substr( |
|
| 5221 | + return (string)self::substr( |
|
| 5222 | 5222 | $str, |
| 5223 | - (int) self::strlen($substring, $encoding), |
|
| 5223 | + (int)self::strlen($substring, $encoding), |
|
| 5224 | 5224 | null, |
| 5225 | 5225 | $encoding |
| 5226 | 5226 | ); |
@@ -5248,19 +5248,19 @@ discard block |
||
| 5248 | 5248 | ): string { |
| 5249 | 5249 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
| 5250 | 5250 | if ($encoding === 'UTF-8') { |
| 5251 | - return (string) \mb_substr( |
|
| 5251 | + return (string)\mb_substr( |
|
| 5252 | 5252 | $str, |
| 5253 | 5253 | 0, |
| 5254 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
| 5254 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
| 5255 | 5255 | ); |
| 5256 | 5256 | } |
| 5257 | 5257 | |
| 5258 | 5258 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5259 | 5259 | |
| 5260 | - return (string) self::substr( |
|
| 5260 | + return (string)self::substr( |
|
| 5261 | 5261 | $str, |
| 5262 | 5262 | 0, |
| 5263 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
| 5263 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
| 5264 | 5264 | $encoding |
| 5265 | 5265 | ); |
| 5266 | 5266 | } |
@@ -5360,7 +5360,7 @@ discard block |
||
| 5360 | 5360 | /** @noinspection PhpUsageOfSilenceOperatorInspection - ignore "Unknown character" warnings, it's working anyway */ |
| 5361 | 5361 | @\mb_substitute_character($replacement_char_helper); |
| 5362 | 5362 | // the polyfill maybe return false, so cast to string |
| 5363 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 5363 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 5364 | 5364 | \mb_substitute_character($save); |
| 5365 | 5365 | } |
| 5366 | 5366 | |
@@ -5404,7 +5404,7 @@ discard block |
||
| 5404 | 5404 | } |
| 5405 | 5405 | |
| 5406 | 5406 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5407 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 5407 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 5408 | 5408 | } |
| 5409 | 5409 | |
| 5410 | 5410 | if ($chars) { |
@@ -5434,7 +5434,7 @@ discard block |
||
| 5434 | 5434 | $html .= '<pre>'; |
| 5435 | 5435 | /** @noinspection AlterInForeachInspection */ |
| 5436 | 5436 | foreach (self::$SUPPORT as $key => &$value) { |
| 5437 | - $html .= $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
| 5437 | + $html .= $key.' - '.\print_r($value, true)."\n<br>"; |
|
| 5438 | 5438 | } |
| 5439 | 5439 | $html .= '</pre>'; |
| 5440 | 5440 | |
@@ -5474,7 +5474,7 @@ discard block |
||
| 5474 | 5474 | return $char; |
| 5475 | 5475 | } |
| 5476 | 5476 | |
| 5477 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
| 5477 | + return '&#'.self::ord($char, $encoding).';'; |
|
| 5478 | 5478 | } |
| 5479 | 5479 | |
| 5480 | 5480 | /** |
@@ -5578,11 +5578,11 @@ discard block |
||
| 5578 | 5578 | $lang, |
| 5579 | 5579 | $try_to_keep_the_string_length |
| 5580 | 5580 | ); |
| 5581 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
| 5581 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
| 5582 | 5582 | |
| 5583 | 5583 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 5584 | 5584 | |
| 5585 | - $str = (string) \preg_replace_callback( |
|
| 5585 | + $str = (string)\preg_replace_callback( |
|
| 5586 | 5586 | '/[-_\\s]+(.)?/u', |
| 5587 | 5587 | /** |
| 5588 | 5588 | * @param array $match |
@@ -5591,7 +5591,7 @@ discard block |
||
| 5591 | 5591 | * |
| 5592 | 5592 | * @return string |
| 5593 | 5593 | */ |
| 5594 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
| 5594 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
| 5595 | 5595 | if (isset($match[1])) { |
| 5596 | 5596 | if ($use_mb_functions) { |
| 5597 | 5597 | if ($encoding === 'UTF-8') { |
@@ -5609,7 +5609,7 @@ discard block |
||
| 5609 | 5609 | $str |
| 5610 | 5610 | ); |
| 5611 | 5611 | |
| 5612 | - return (string) \preg_replace_callback( |
|
| 5612 | + return (string)\preg_replace_callback( |
|
| 5613 | 5613 | '/[\\p{N}]+(.)?/u', |
| 5614 | 5614 | /** |
| 5615 | 5615 | * @param array $match |
@@ -5618,7 +5618,7 @@ discard block |
||
| 5618 | 5618 | * |
| 5619 | 5619 | * @return string |
| 5620 | 5620 | */ |
| 5621 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
| 5621 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
| 5622 | 5622 | if ($use_mb_functions) { |
| 5623 | 5623 | if ($encoding === 'UTF-8') { |
| 5624 | 5624 | return \mb_strtoupper($match[0]); |
@@ -5810,7 +5810,7 @@ discard block |
||
| 5810 | 5810 | ): string { |
| 5811 | 5811 | if (self::$SUPPORT['mbstring'] === true) { |
| 5812 | 5812 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5813 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
| 5813 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
| 5814 | 5814 | |
| 5815 | 5815 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 5816 | 5816 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -5820,10 +5820,10 @@ discard block |
||
| 5820 | 5820 | } |
| 5821 | 5821 | |
| 5822 | 5822 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5823 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
| 5823 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
| 5824 | 5824 | } |
| 5825 | 5825 | |
| 5826 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
| 5826 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
| 5827 | 5827 | |
| 5828 | 5828 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 5829 | 5829 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -5832,7 +5832,7 @@ discard block |
||
| 5832 | 5832 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
| 5833 | 5833 | } |
| 5834 | 5834 | |
| 5835 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
| 5835 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
| 5836 | 5836 | } |
| 5837 | 5837 | |
| 5838 | 5838 | /** |
@@ -5849,7 +5849,7 @@ discard block |
||
| 5849 | 5849 | public static function str_detect_encoding($str) |
| 5850 | 5850 | { |
| 5851 | 5851 | // init |
| 5852 | - $str = (string) $str; |
|
| 5852 | + $str = (string)$str; |
|
| 5853 | 5853 | |
| 5854 | 5854 | // |
| 5855 | 5855 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5951,7 +5951,7 @@ discard block |
||
| 5951 | 5951 | foreach (self::$ENCODINGS as $encoding_tmp) { |
| 5952 | 5952 | // INFO: //IGNORE but still throw notice |
| 5953 | 5953 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 5954 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
| 5954 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
| 5955 | 5955 | return $encoding_tmp; |
| 5956 | 5956 | } |
| 5957 | 5957 | } |
@@ -6048,7 +6048,7 @@ discard block |
||
| 6048 | 6048 | return $str; |
| 6049 | 6049 | } |
| 6050 | 6050 | |
| 6051 | - return $substring . $str; |
|
| 6051 | + return $substring.$str; |
|
| 6052 | 6052 | } |
| 6053 | 6053 | |
| 6054 | 6054 | /** |
@@ -6339,27 +6339,27 @@ discard block |
||
| 6339 | 6339 | string $encoding = 'UTF-8' |
| 6340 | 6340 | ): string { |
| 6341 | 6341 | if ($encoding === 'UTF-8') { |
| 6342 | - $len = (int) \mb_strlen($str); |
|
| 6342 | + $len = (int)\mb_strlen($str); |
|
| 6343 | 6343 | if ($index > $len) { |
| 6344 | 6344 | return $str; |
| 6345 | 6345 | } |
| 6346 | 6346 | |
| 6347 | 6347 | /** @noinspection UnnecessaryCastingInspection */ |
| 6348 | - return (string) \mb_substr($str, 0, $index) . |
|
| 6349 | - $substring . |
|
| 6350 | - (string) \mb_substr($str, $index, $len); |
|
| 6348 | + return (string)\mb_substr($str, 0, $index). |
|
| 6349 | + $substring. |
|
| 6350 | + (string)\mb_substr($str, $index, $len); |
|
| 6351 | 6351 | } |
| 6352 | 6352 | |
| 6353 | 6353 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6354 | 6354 | |
| 6355 | - $len = (int) self::strlen($str, $encoding); |
|
| 6355 | + $len = (int)self::strlen($str, $encoding); |
|
| 6356 | 6356 | if ($index > $len) { |
| 6357 | 6357 | return $str; |
| 6358 | 6358 | } |
| 6359 | 6359 | |
| 6360 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
| 6361 | - $substring . |
|
| 6362 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
| 6360 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
| 6361 | + $substring. |
|
| 6362 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
| 6363 | 6363 | } |
| 6364 | 6364 | |
| 6365 | 6365 | /** |
@@ -6390,15 +6390,15 @@ discard block |
||
| 6390 | 6390 | */ |
| 6391 | 6391 | public static function str_ireplace($search, $replacement, $subject, &$count = null) |
| 6392 | 6392 | { |
| 6393 | - $search = (array) $search; |
|
| 6393 | + $search = (array)$search; |
|
| 6394 | 6394 | |
| 6395 | 6395 | /** @noinspection AlterInForeachInspection */ |
| 6396 | 6396 | foreach ($search as &$s) { |
| 6397 | - $s = (string) $s; |
|
| 6397 | + $s = (string)$s; |
|
| 6398 | 6398 | if ($s === '') { |
| 6399 | 6399 | $s = '/^(?<=.)$/'; |
| 6400 | 6400 | } else { |
| 6401 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
| 6401 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
| 6402 | 6402 | } |
| 6403 | 6403 | } |
| 6404 | 6404 | |
@@ -6434,11 +6434,11 @@ discard block |
||
| 6434 | 6434 | } |
| 6435 | 6435 | |
| 6436 | 6436 | if ($search === '') { |
| 6437 | - return $str . $replacement; |
|
| 6437 | + return $str.$replacement; |
|
| 6438 | 6438 | } |
| 6439 | 6439 | |
| 6440 | 6440 | if (\stripos($str, $search) === 0) { |
| 6441 | - return $replacement . \substr($str, \strlen($search)); |
|
| 6441 | + return $replacement.\substr($str, \strlen($search)); |
|
| 6442 | 6442 | } |
| 6443 | 6443 | |
| 6444 | 6444 | return $str; |
@@ -6469,11 +6469,11 @@ discard block |
||
| 6469 | 6469 | } |
| 6470 | 6470 | |
| 6471 | 6471 | if ($search === '') { |
| 6472 | - return $str . $replacement; |
|
| 6472 | + return $str.$replacement; |
|
| 6473 | 6473 | } |
| 6474 | 6474 | |
| 6475 | 6475 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 6476 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 6476 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 6477 | 6477 | } |
| 6478 | 6478 | |
| 6479 | 6479 | return $str; |
@@ -6559,15 +6559,15 @@ discard block |
||
| 6559 | 6559 | } |
| 6560 | 6560 | |
| 6561 | 6561 | if ($encoding === 'UTF-8') { |
| 6562 | - return (string) \mb_substr( |
|
| 6562 | + return (string)\mb_substr( |
|
| 6563 | 6563 | $str, |
| 6564 | - $offset + (int) \mb_strlen($separator) |
|
| 6564 | + $offset + (int)\mb_strlen($separator) |
|
| 6565 | 6565 | ); |
| 6566 | 6566 | } |
| 6567 | 6567 | |
| 6568 | - return (string) self::substr( |
|
| 6568 | + return (string)self::substr( |
|
| 6569 | 6569 | $str, |
| 6570 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6570 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6571 | 6571 | null, |
| 6572 | 6572 | $encoding |
| 6573 | 6573 | ); |
@@ -6599,15 +6599,15 @@ discard block |
||
| 6599 | 6599 | } |
| 6600 | 6600 | |
| 6601 | 6601 | if ($encoding === 'UTF-8') { |
| 6602 | - return (string) \mb_substr( |
|
| 6602 | + return (string)\mb_substr( |
|
| 6603 | 6603 | $str, |
| 6604 | - $offset + (int) self::strlen($separator) |
|
| 6604 | + $offset + (int)self::strlen($separator) |
|
| 6605 | 6605 | ); |
| 6606 | 6606 | } |
| 6607 | 6607 | |
| 6608 | - return (string) self::substr( |
|
| 6608 | + return (string)self::substr( |
|
| 6609 | 6609 | $str, |
| 6610 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6610 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6611 | 6611 | null, |
| 6612 | 6612 | $encoding |
| 6613 | 6613 | ); |
@@ -6639,10 +6639,10 @@ discard block |
||
| 6639 | 6639 | } |
| 6640 | 6640 | |
| 6641 | 6641 | if ($encoding === 'UTF-8') { |
| 6642 | - return (string) \mb_substr($str, 0, $offset); |
|
| 6642 | + return (string)\mb_substr($str, 0, $offset); |
|
| 6643 | 6643 | } |
| 6644 | 6644 | |
| 6645 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 6645 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 6646 | 6646 | } |
| 6647 | 6647 | |
| 6648 | 6648 | /** |
@@ -6671,7 +6671,7 @@ discard block |
||
| 6671 | 6671 | return ''; |
| 6672 | 6672 | } |
| 6673 | 6673 | |
| 6674 | - return (string) \mb_substr($str, 0, $offset); |
|
| 6674 | + return (string)\mb_substr($str, 0, $offset); |
|
| 6675 | 6675 | } |
| 6676 | 6676 | |
| 6677 | 6677 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6679,7 +6679,7 @@ discard block |
||
| 6679 | 6679 | return ''; |
| 6680 | 6680 | } |
| 6681 | 6681 | |
| 6682 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 6682 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 6683 | 6683 | } |
| 6684 | 6684 | |
| 6685 | 6685 | /** |
@@ -6781,12 +6781,12 @@ discard block |
||
| 6781 | 6781 | } |
| 6782 | 6782 | |
| 6783 | 6783 | if ($encoding === 'UTF-8') { |
| 6784 | - return (string) \mb_substr($str, -$n); |
|
| 6784 | + return (string)\mb_substr($str, -$n); |
|
| 6785 | 6785 | } |
| 6786 | 6786 | |
| 6787 | 6787 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6788 | 6788 | |
| 6789 | - return (string) self::substr($str, -$n, null, $encoding); |
|
| 6789 | + return (string)self::substr($str, -$n, null, $encoding); |
|
| 6790 | 6790 | } |
| 6791 | 6791 | |
| 6792 | 6792 | /** |
@@ -6812,21 +6812,21 @@ discard block |
||
| 6812 | 6812 | } |
| 6813 | 6813 | |
| 6814 | 6814 | if ($encoding === 'UTF-8') { |
| 6815 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 6815 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 6816 | 6816 | return $str; |
| 6817 | 6817 | } |
| 6818 | 6818 | |
| 6819 | 6819 | /** @noinspection UnnecessaryCastingInspection */ |
| 6820 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
| 6820 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
| 6821 | 6821 | } |
| 6822 | 6822 | |
| 6823 | 6823 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6824 | 6824 | |
| 6825 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 6825 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 6826 | 6826 | return $str; |
| 6827 | 6827 | } |
| 6828 | 6828 | |
| 6829 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
| 6829 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
| 6830 | 6830 | } |
| 6831 | 6831 | |
| 6832 | 6832 | /** |
@@ -6853,12 +6853,12 @@ discard block |
||
| 6853 | 6853 | |
| 6854 | 6854 | if ($encoding === 'UTF-8') { |
| 6855 | 6855 | /** @noinspection UnnecessaryCastingInspection */ |
| 6856 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 6856 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 6857 | 6857 | return $str; |
| 6858 | 6858 | } |
| 6859 | 6859 | |
| 6860 | 6860 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
| 6861 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
| 6861 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
| 6862 | 6862 | } |
| 6863 | 6863 | |
| 6864 | 6864 | $str = \mb_substr($str, 0, $length); |
@@ -6867,33 +6867,33 @@ discard block |
||
| 6867 | 6867 | $new_str = \implode(' ', $array); |
| 6868 | 6868 | |
| 6869 | 6869 | if ($new_str === '') { |
| 6870 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
| 6870 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
| 6871 | 6871 | } |
| 6872 | 6872 | } else { |
| 6873 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 6873 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 6874 | 6874 | return $str; |
| 6875 | 6875 | } |
| 6876 | 6876 | |
| 6877 | 6877 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
| 6878 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
| 6878 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
| 6879 | 6879 | } |
| 6880 | 6880 | |
| 6881 | 6881 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 6882 | 6882 | $str = self::substr($str, 0, $length, $encoding); |
| 6883 | 6883 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 6884 | 6884 | if ($str === false) { |
| 6885 | - return '' . $str_add_on; |
|
| 6885 | + return ''.$str_add_on; |
|
| 6886 | 6886 | } |
| 6887 | 6887 | |
| 6888 | 6888 | $array = \explode(' ', $str, -1); |
| 6889 | 6889 | $new_str = \implode(' ', $array); |
| 6890 | 6890 | |
| 6891 | 6891 | if ($new_str === '') { |
| 6892 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
| 6892 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
| 6893 | 6893 | } |
| 6894 | 6894 | } |
| 6895 | 6895 | |
| 6896 | - return $new_str . $str_add_on; |
|
| 6896 | + return $new_str.$str_add_on; |
|
| 6897 | 6897 | } |
| 6898 | 6898 | |
| 6899 | 6899 | /** |
@@ -6916,7 +6916,7 @@ discard block |
||
| 6916 | 6916 | $longest_common_prefix = ''; |
| 6917 | 6917 | |
| 6918 | 6918 | if ($encoding === 'UTF-8') { |
| 6919 | - $max_length = (int) \min( |
|
| 6919 | + $max_length = (int)\min( |
|
| 6920 | 6920 | \mb_strlen($str1), |
| 6921 | 6921 | \mb_strlen($str2) |
| 6922 | 6922 | ); |
@@ -6937,7 +6937,7 @@ discard block |
||
| 6937 | 6937 | } else { |
| 6938 | 6938 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6939 | 6939 | |
| 6940 | - $max_length = (int) \min( |
|
| 6940 | + $max_length = (int)\min( |
|
| 6941 | 6941 | self::strlen($str1, $encoding), |
| 6942 | 6942 | self::strlen($str2, $encoding) |
| 6943 | 6943 | ); |
@@ -6986,13 +6986,13 @@ discard block |
||
| 6986 | 6986 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
| 6987 | 6987 | |
| 6988 | 6988 | if ($encoding === 'UTF-8') { |
| 6989 | - $str_length = (int) \mb_strlen($str1); |
|
| 6990 | - $other_length = (int) \mb_strlen($str2); |
|
| 6989 | + $str_length = (int)\mb_strlen($str1); |
|
| 6990 | + $other_length = (int)\mb_strlen($str2); |
|
| 6991 | 6991 | } else { |
| 6992 | 6992 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6993 | 6993 | |
| 6994 | - $str_length = (int) self::strlen($str1, $encoding); |
|
| 6995 | - $other_length = (int) self::strlen($str2, $encoding); |
|
| 6994 | + $str_length = (int)self::strlen($str1, $encoding); |
|
| 6995 | + $other_length = (int)self::strlen($str2, $encoding); |
|
| 6996 | 6996 | } |
| 6997 | 6997 | |
| 6998 | 6998 | // Return if either string is empty |
@@ -7045,10 +7045,10 @@ discard block |
||
| 7045 | 7045 | } |
| 7046 | 7046 | |
| 7047 | 7047 | if ($encoding === 'UTF-8') { |
| 7048 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
| 7048 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
| 7049 | 7049 | } |
| 7050 | 7050 | |
| 7051 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
| 7051 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
| 7052 | 7052 | } |
| 7053 | 7053 | |
| 7054 | 7054 | /** |
@@ -7072,7 +7072,7 @@ discard block |
||
| 7072 | 7072 | } |
| 7073 | 7073 | |
| 7074 | 7074 | if ($encoding === 'UTF-8') { |
| 7075 | - $max_length = (int) \min( |
|
| 7075 | + $max_length = (int)\min( |
|
| 7076 | 7076 | \mb_strlen($str1, $encoding), |
| 7077 | 7077 | \mb_strlen($str2, $encoding) |
| 7078 | 7078 | ); |
@@ -7086,7 +7086,7 @@ discard block |
||
| 7086 | 7086 | && |
| 7087 | 7087 | $char === \mb_substr($str2, -$i, 1) |
| 7088 | 7088 | ) { |
| 7089 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
| 7089 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
| 7090 | 7090 | } else { |
| 7091 | 7091 | break; |
| 7092 | 7092 | } |
@@ -7094,7 +7094,7 @@ discard block |
||
| 7094 | 7094 | } else { |
| 7095 | 7095 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7096 | 7096 | |
| 7097 | - $max_length = (int) \min( |
|
| 7097 | + $max_length = (int)\min( |
|
| 7098 | 7098 | self::strlen($str1, $encoding), |
| 7099 | 7099 | self::strlen($str2, $encoding) |
| 7100 | 7100 | ); |
@@ -7108,7 +7108,7 @@ discard block |
||
| 7108 | 7108 | && |
| 7109 | 7109 | $char === self::substr($str2, -$i, 1, $encoding) |
| 7110 | 7110 | ) { |
| 7111 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
| 7111 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
| 7112 | 7112 | } else { |
| 7113 | 7113 | break; |
| 7114 | 7114 | } |
@@ -7130,7 +7130,7 @@ discard block |
||
| 7130 | 7130 | */ |
| 7131 | 7131 | public static function str_matches_pattern(string $str, string $pattern): bool |
| 7132 | 7132 | { |
| 7133 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
| 7133 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
| 7134 | 7134 | } |
| 7135 | 7135 | |
| 7136 | 7136 | /** |
@@ -7149,7 +7149,7 @@ discard block |
||
| 7149 | 7149 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
| 7150 | 7150 | { |
| 7151 | 7151 | // init |
| 7152 | - $length = (int) self::strlen($str, $encoding); |
|
| 7152 | + $length = (int)self::strlen($str, $encoding); |
|
| 7153 | 7153 | |
| 7154 | 7154 | if ($offset >= 0) { |
| 7155 | 7155 | return $length > $offset; |
@@ -7178,7 +7178,7 @@ discard block |
||
| 7178 | 7178 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
| 7179 | 7179 | { |
| 7180 | 7180 | // init |
| 7181 | - $length = (int) self::strlen($str); |
|
| 7181 | + $length = (int)self::strlen($str); |
|
| 7182 | 7182 | |
| 7183 | 7183 | if ( |
| 7184 | 7184 | ($index >= 0 && $length <= $index) |
@@ -7220,7 +7220,7 @@ discard block |
||
| 7220 | 7220 | return $str; |
| 7221 | 7221 | } |
| 7222 | 7222 | |
| 7223 | - if ($pad_type !== (int) $pad_type) { |
|
| 7223 | + if ($pad_type !== (int)$pad_type) { |
|
| 7224 | 7224 | if ($pad_type === 'left') { |
| 7225 | 7225 | $pad_type = \STR_PAD_LEFT; |
| 7226 | 7226 | } elseif ($pad_type === 'right') { |
@@ -7229,23 +7229,23 @@ discard block |
||
| 7229 | 7229 | $pad_type = \STR_PAD_BOTH; |
| 7230 | 7230 | } else { |
| 7231 | 7231 | throw new \InvalidArgumentException( |
| 7232 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
| 7232 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
| 7233 | 7233 | ); |
| 7234 | 7234 | } |
| 7235 | 7235 | } |
| 7236 | 7236 | |
| 7237 | 7237 | if ($encoding === 'UTF-8') { |
| 7238 | - $str_length = (int) \mb_strlen($str); |
|
| 7238 | + $str_length = (int)\mb_strlen($str); |
|
| 7239 | 7239 | |
| 7240 | 7240 | if ($pad_length >= $str_length) { |
| 7241 | 7241 | switch ($pad_type) { |
| 7242 | 7242 | case \STR_PAD_LEFT: |
| 7243 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 7243 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 7244 | 7244 | |
| 7245 | 7245 | $diff = ($pad_length - $str_length); |
| 7246 | 7246 | |
| 7247 | - $pre = (string) \mb_substr( |
|
| 7248 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7247 | + $pre = (string)\mb_substr( |
|
| 7248 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7249 | 7249 | 0, |
| 7250 | 7250 | $diff |
| 7251 | 7251 | ); |
@@ -7256,16 +7256,16 @@ discard block |
||
| 7256 | 7256 | case \STR_PAD_BOTH: |
| 7257 | 7257 | $diff = ($pad_length - $str_length); |
| 7258 | 7258 | |
| 7259 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 7259 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 7260 | 7260 | |
| 7261 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 7261 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 7262 | 7262 | |
| 7263 | - $pre = (string) \mb_substr( |
|
| 7263 | + $pre = (string)\mb_substr( |
|
| 7264 | 7264 | \str_repeat($pad_string, $ps_length_left), |
| 7265 | 7265 | 0, |
| 7266 | 7266 | $ps_length_left |
| 7267 | 7267 | ); |
| 7268 | - $post = (string) \mb_substr( |
|
| 7268 | + $post = (string)\mb_substr( |
|
| 7269 | 7269 | \str_repeat($pad_string, $ps_length_right), |
| 7270 | 7270 | 0, |
| 7271 | 7271 | $ps_length_right |
@@ -7275,19 +7275,19 @@ discard block |
||
| 7275 | 7275 | |
| 7276 | 7276 | case \STR_PAD_RIGHT: |
| 7277 | 7277 | default: |
| 7278 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 7278 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 7279 | 7279 | |
| 7280 | 7280 | $diff = ($pad_length - $str_length); |
| 7281 | 7281 | |
| 7282 | - $post = (string) \mb_substr( |
|
| 7283 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7282 | + $post = (string)\mb_substr( |
|
| 7283 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7284 | 7284 | 0, |
| 7285 | 7285 | $diff |
| 7286 | 7286 | ); |
| 7287 | 7287 | $pre = ''; |
| 7288 | 7288 | } |
| 7289 | 7289 | |
| 7290 | - return $pre . $str . $post; |
|
| 7290 | + return $pre.$str.$post; |
|
| 7291 | 7291 | } |
| 7292 | 7292 | |
| 7293 | 7293 | return $str; |
@@ -7295,17 +7295,17 @@ discard block |
||
| 7295 | 7295 | |
| 7296 | 7296 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7297 | 7297 | |
| 7298 | - $str_length = (int) self::strlen($str, $encoding); |
|
| 7298 | + $str_length = (int)self::strlen($str, $encoding); |
|
| 7299 | 7299 | |
| 7300 | 7300 | if ($pad_length >= $str_length) { |
| 7301 | 7301 | switch ($pad_type) { |
| 7302 | 7302 | case \STR_PAD_LEFT: |
| 7303 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 7303 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 7304 | 7304 | |
| 7305 | 7305 | $diff = ($pad_length - $str_length); |
| 7306 | 7306 | |
| 7307 | - $pre = (string) self::substr( |
|
| 7308 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7307 | + $pre = (string)self::substr( |
|
| 7308 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7309 | 7309 | 0, |
| 7310 | 7310 | $diff, |
| 7311 | 7311 | $encoding |
@@ -7317,17 +7317,17 @@ discard block |
||
| 7317 | 7317 | case \STR_PAD_BOTH: |
| 7318 | 7318 | $diff = ($pad_length - $str_length); |
| 7319 | 7319 | |
| 7320 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 7320 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 7321 | 7321 | |
| 7322 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 7322 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 7323 | 7323 | |
| 7324 | - $pre = (string) self::substr( |
|
| 7324 | + $pre = (string)self::substr( |
|
| 7325 | 7325 | \str_repeat($pad_string, $ps_length_left), |
| 7326 | 7326 | 0, |
| 7327 | 7327 | $ps_length_left, |
| 7328 | 7328 | $encoding |
| 7329 | 7329 | ); |
| 7330 | - $post = (string) self::substr( |
|
| 7330 | + $post = (string)self::substr( |
|
| 7331 | 7331 | \str_repeat($pad_string, $ps_length_right), |
| 7332 | 7332 | 0, |
| 7333 | 7333 | $ps_length_right, |
@@ -7338,12 +7338,12 @@ discard block |
||
| 7338 | 7338 | |
| 7339 | 7339 | case \STR_PAD_RIGHT: |
| 7340 | 7340 | default: |
| 7341 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 7341 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 7342 | 7342 | |
| 7343 | 7343 | $diff = ($pad_length - $str_length); |
| 7344 | 7344 | |
| 7345 | - $post = (string) self::substr( |
|
| 7346 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7345 | + $post = (string)self::substr( |
|
| 7346 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7347 | 7347 | 0, |
| 7348 | 7348 | $diff, |
| 7349 | 7349 | $encoding |
@@ -7351,7 +7351,7 @@ discard block |
||
| 7351 | 7351 | $pre = ''; |
| 7352 | 7352 | } |
| 7353 | 7353 | |
| 7354 | - return $pre . $str . $post; |
|
| 7354 | + return $pre.$str.$post; |
|
| 7355 | 7355 | } |
| 7356 | 7356 | |
| 7357 | 7357 | return $str; |
@@ -7548,11 +7548,11 @@ discard block |
||
| 7548 | 7548 | } |
| 7549 | 7549 | |
| 7550 | 7550 | if ($search === '') { |
| 7551 | - return $str . $replacement; |
|
| 7551 | + return $str.$replacement; |
|
| 7552 | 7552 | } |
| 7553 | 7553 | |
| 7554 | 7554 | if (\strpos($str, $search) === 0) { |
| 7555 | - return $replacement . \substr($str, \strlen($search)); |
|
| 7555 | + return $replacement.\substr($str, \strlen($search)); |
|
| 7556 | 7556 | } |
| 7557 | 7557 | |
| 7558 | 7558 | return $str; |
@@ -7586,11 +7586,11 @@ discard block |
||
| 7586 | 7586 | } |
| 7587 | 7587 | |
| 7588 | 7588 | if ($search === '') { |
| 7589 | - return $str . $replacement; |
|
| 7589 | + return $str.$replacement; |
|
| 7590 | 7590 | } |
| 7591 | 7591 | |
| 7592 | 7592 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 7593 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 7593 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 7594 | 7594 | } |
| 7595 | 7595 | |
| 7596 | 7596 | return $str; |
@@ -7624,7 +7624,7 @@ discard block |
||
| 7624 | 7624 | $subject, |
| 7625 | 7625 | $replace, |
| 7626 | 7626 | $pos, |
| 7627 | - (int) self::strlen($search) |
|
| 7627 | + (int)self::strlen($search) |
|
| 7628 | 7628 | ); |
| 7629 | 7629 | } |
| 7630 | 7630 | |
@@ -7658,7 +7658,7 @@ discard block |
||
| 7658 | 7658 | $subject, |
| 7659 | 7659 | $replace, |
| 7660 | 7660 | $pos, |
| 7661 | - (int) self::strlen($search) |
|
| 7661 | + (int)self::strlen($search) |
|
| 7662 | 7662 | ); |
| 7663 | 7663 | } |
| 7664 | 7664 | |
@@ -7679,7 +7679,7 @@ discard block |
||
| 7679 | 7679 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
| 7680 | 7680 | { |
| 7681 | 7681 | if ($encoding === 'UTF-8') { |
| 7682 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
| 7682 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
| 7683 | 7683 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 7684 | 7684 | \shuffle($indexes); |
| 7685 | 7685 | |
@@ -7695,7 +7695,7 @@ discard block |
||
| 7695 | 7695 | } else { |
| 7696 | 7696 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7697 | 7697 | |
| 7698 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
| 7698 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
| 7699 | 7699 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 7700 | 7700 | \shuffle($indexes); |
| 7701 | 7701 | |
@@ -7738,11 +7738,11 @@ discard block |
||
| 7738 | 7738 | ) { |
| 7739 | 7739 | if ($encoding === 'UTF-8') { |
| 7740 | 7740 | if ($end === null) { |
| 7741 | - $length = (int) \mb_strlen($str); |
|
| 7741 | + $length = (int)\mb_strlen($str); |
|
| 7742 | 7742 | } elseif ($end >= 0 && $end <= $start) { |
| 7743 | 7743 | return ''; |
| 7744 | 7744 | } elseif ($end < 0) { |
| 7745 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
| 7745 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
| 7746 | 7746 | } else { |
| 7747 | 7747 | $length = $end - $start; |
| 7748 | 7748 | } |
@@ -7753,11 +7753,11 @@ discard block |
||
| 7753 | 7753 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7754 | 7754 | |
| 7755 | 7755 | if ($end === null) { |
| 7756 | - $length = (int) self::strlen($str, $encoding); |
|
| 7756 | + $length = (int)self::strlen($str, $encoding); |
|
| 7757 | 7757 | } elseif ($end >= 0 && $end <= $start) { |
| 7758 | 7758 | return ''; |
| 7759 | 7759 | } elseif ($end < 0) { |
| 7760 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
| 7760 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
| 7761 | 7761 | } else { |
| 7762 | 7762 | $length = $end - $start; |
| 7763 | 7763 | } |
@@ -7792,7 +7792,7 @@ discard block |
||
| 7792 | 7792 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7793 | 7793 | } |
| 7794 | 7794 | |
| 7795 | - $str = (string) \preg_replace_callback( |
|
| 7795 | + $str = (string)\preg_replace_callback( |
|
| 7796 | 7796 | '/([\\p{N}|\\p{Lu}])/u', |
| 7797 | 7797 | /** |
| 7798 | 7798 | * @param string[] $matches |
@@ -7801,28 +7801,28 @@ discard block |
||
| 7801 | 7801 | * |
| 7802 | 7802 | * @return string |
| 7803 | 7803 | */ |
| 7804 | - static function (array $matches) use ($encoding): string { |
|
| 7804 | + static function(array $matches) use ($encoding): string { |
|
| 7805 | 7805 | $match = $matches[1]; |
| 7806 | - $match_int = (int) $match; |
|
| 7806 | + $match_int = (int)$match; |
|
| 7807 | 7807 | |
| 7808 | - if ((string) $match_int === $match) { |
|
| 7809 | - return '_' . $match . '_'; |
|
| 7808 | + if ((string)$match_int === $match) { |
|
| 7809 | + return '_'.$match.'_'; |
|
| 7810 | 7810 | } |
| 7811 | 7811 | |
| 7812 | 7812 | if ($encoding === 'UTF-8') { |
| 7813 | - return '_' . \mb_strtolower($match); |
|
| 7813 | + return '_'.\mb_strtolower($match); |
|
| 7814 | 7814 | } |
| 7815 | 7815 | |
| 7816 | - return '_' . self::strtolower($match, $encoding); |
|
| 7816 | + return '_'.self::strtolower($match, $encoding); |
|
| 7817 | 7817 | }, |
| 7818 | 7818 | $str |
| 7819 | 7819 | ); |
| 7820 | 7820 | |
| 7821 | - $str = (string) \preg_replace( |
|
| 7821 | + $str = (string)\preg_replace( |
|
| 7822 | 7822 | [ |
| 7823 | - '/\\s+/u', // convert spaces to "_" |
|
| 7823 | + '/\\s+/u', // convert spaces to "_" |
|
| 7824 | 7824 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
| 7825 | - '/_+/', // remove double "_" |
|
| 7825 | + '/_+/', // remove double "_" |
|
| 7826 | 7826 | ], |
| 7827 | 7827 | [ |
| 7828 | 7828 | '_', |
@@ -7944,7 +7944,7 @@ discard block |
||
| 7944 | 7944 | } |
| 7945 | 7945 | |
| 7946 | 7946 | // init |
| 7947 | - $input = (string) $input; |
|
| 7947 | + $input = (string)$input; |
|
| 7948 | 7948 | |
| 7949 | 7949 | if ($input === '') { |
| 7950 | 7950 | return []; |
@@ -8001,7 +8001,7 @@ discard block |
||
| 8001 | 8001 | ($input[$i] & "\xE0") === "\xC0" |
| 8002 | 8002 | ) { |
| 8003 | 8003 | if (($input[$i + 1] & "\xC0") === "\x80") { |
| 8004 | - $ret[] = $input[$i] . $input[$i + 1]; |
|
| 8004 | + $ret[] = $input[$i].$input[$i + 1]; |
|
| 8005 | 8005 | |
| 8006 | 8006 | ++$i; |
| 8007 | 8007 | } |
@@ -8015,7 +8015,7 @@ discard block |
||
| 8015 | 8015 | && |
| 8016 | 8016 | ($input[$i + 2] & "\xC0") === "\x80" |
| 8017 | 8017 | ) { |
| 8018 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2]; |
|
| 8018 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2]; |
|
| 8019 | 8019 | |
| 8020 | 8020 | $i += 2; |
| 8021 | 8021 | } |
@@ -8031,7 +8031,7 @@ discard block |
||
| 8031 | 8031 | && |
| 8032 | 8032 | ($input[$i + 3] & "\xC0") === "\x80" |
| 8033 | 8033 | ) { |
| 8034 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2] . $input[$i + 3]; |
|
| 8034 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2].$input[$i + 3]; |
|
| 8035 | 8035 | |
| 8036 | 8036 | $i += 3; |
| 8037 | 8037 | } |
@@ -8043,7 +8043,7 @@ discard block |
||
| 8043 | 8043 | $ret = \array_chunk($ret, $length); |
| 8044 | 8044 | |
| 8045 | 8045 | return \array_map( |
| 8046 | - static function (array &$item): string { |
|
| 8046 | + static function(array &$item): string { |
|
| 8047 | 8047 | return \implode('', $item); |
| 8048 | 8048 | }, |
| 8049 | 8049 | $ret |
@@ -8109,7 +8109,7 @@ discard block |
||
| 8109 | 8109 | $limit = -1; |
| 8110 | 8110 | } |
| 8111 | 8111 | |
| 8112 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
| 8112 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
| 8113 | 8113 | |
| 8114 | 8114 | if ($array === false) { |
| 8115 | 8115 | return []; |
@@ -8199,9 +8199,9 @@ discard block |
||
| 8199 | 8199 | return ''; |
| 8200 | 8200 | } |
| 8201 | 8201 | |
| 8202 | - return (string) \mb_substr( |
|
| 8202 | + return (string)\mb_substr( |
|
| 8203 | 8203 | $str, |
| 8204 | - $offset + (int) \mb_strlen($separator) |
|
| 8204 | + $offset + (int)\mb_strlen($separator) |
|
| 8205 | 8205 | ); |
| 8206 | 8206 | } |
| 8207 | 8207 | |
@@ -8210,9 +8210,9 @@ discard block |
||
| 8210 | 8210 | return ''; |
| 8211 | 8211 | } |
| 8212 | 8212 | |
| 8213 | - return (string) \mb_substr( |
|
| 8213 | + return (string)\mb_substr( |
|
| 8214 | 8214 | $str, |
| 8215 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 8215 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 8216 | 8216 | null, |
| 8217 | 8217 | $encoding |
| 8218 | 8218 | ); |
@@ -8241,9 +8241,9 @@ discard block |
||
| 8241 | 8241 | return ''; |
| 8242 | 8242 | } |
| 8243 | 8243 | |
| 8244 | - return (string) \mb_substr( |
|
| 8244 | + return (string)\mb_substr( |
|
| 8245 | 8245 | $str, |
| 8246 | - $offset + (int) \mb_strlen($separator) |
|
| 8246 | + $offset + (int)\mb_strlen($separator) |
|
| 8247 | 8247 | ); |
| 8248 | 8248 | } |
| 8249 | 8249 | |
@@ -8252,9 +8252,9 @@ discard block |
||
| 8252 | 8252 | return ''; |
| 8253 | 8253 | } |
| 8254 | 8254 | |
| 8255 | - return (string) self::substr( |
|
| 8255 | + return (string)self::substr( |
|
| 8256 | 8256 | $str, |
| 8257 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 8257 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 8258 | 8258 | null, |
| 8259 | 8259 | $encoding |
| 8260 | 8260 | ); |
@@ -8286,7 +8286,7 @@ discard block |
||
| 8286 | 8286 | return ''; |
| 8287 | 8287 | } |
| 8288 | 8288 | |
| 8289 | - return (string) \mb_substr( |
|
| 8289 | + return (string)\mb_substr( |
|
| 8290 | 8290 | $str, |
| 8291 | 8291 | 0, |
| 8292 | 8292 | $offset |
@@ -8298,7 +8298,7 @@ discard block |
||
| 8298 | 8298 | return ''; |
| 8299 | 8299 | } |
| 8300 | 8300 | |
| 8301 | - return (string) self::substr( |
|
| 8301 | + return (string)self::substr( |
|
| 8302 | 8302 | $str, |
| 8303 | 8303 | 0, |
| 8304 | 8304 | $offset, |
@@ -8329,7 +8329,7 @@ discard block |
||
| 8329 | 8329 | return ''; |
| 8330 | 8330 | } |
| 8331 | 8331 | |
| 8332 | - return (string) \mb_substr( |
|
| 8332 | + return (string)\mb_substr( |
|
| 8333 | 8333 | $str, |
| 8334 | 8334 | 0, |
| 8335 | 8335 | $offset |
@@ -8343,7 +8343,7 @@ discard block |
||
| 8343 | 8343 | |
| 8344 | 8344 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8345 | 8345 | |
| 8346 | - return (string) self::substr( |
|
| 8346 | + return (string)self::substr( |
|
| 8347 | 8347 | $str, |
| 8348 | 8348 | 0, |
| 8349 | 8349 | $offset, |
@@ -8458,7 +8458,7 @@ discard block |
||
| 8458 | 8458 | */ |
| 8459 | 8459 | public static function str_surround(string $str, string $substring): string |
| 8460 | 8460 | { |
| 8461 | - return $substring . $str . $substring; |
|
| 8461 | + return $substring.$str.$substring; |
|
| 8462 | 8462 | } |
| 8463 | 8463 | |
| 8464 | 8464 | /** |
@@ -8522,9 +8522,9 @@ discard block |
||
| 8522 | 8522 | $word_define_chars = ''; |
| 8523 | 8523 | } |
| 8524 | 8524 | |
| 8525 | - $str = (string) \preg_replace_callback( |
|
| 8526 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
| 8527 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
| 8525 | + $str = (string)\preg_replace_callback( |
|
| 8526 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
| 8527 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
| 8528 | 8528 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
| 8529 | 8529 | return $match[0]; |
| 8530 | 8530 | } |
@@ -8624,16 +8624,16 @@ discard block |
||
| 8624 | 8624 | |
| 8625 | 8625 | // the main substitutions |
| 8626 | 8626 | /** @noinspection RegExpDuplicateAlternationBranch - false-positive - https://youtrack.jetbrains.com/issue/WI-51002 */ |
| 8627 | - $str = (string) \preg_replace_callback( |
|
| 8627 | + $str = (string)\preg_replace_callback( |
|
| 8628 | 8628 | '~\\b (_*) (?: # 1. Leading underscore and |
| 8629 | 8629 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
| 8630 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
| 8630 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
| 8631 | 8631 | | |
| 8632 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
| 8632 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
| 8633 | 8633 | | |
| 8634 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
| 8634 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
| 8635 | 8635 | | |
| 8636 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
| 8636 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
| 8637 | 8637 | ) (_*) \\b # 6. With trailing underscore |
| 8638 | 8638 | ~ux', |
| 8639 | 8639 | /** |
@@ -8643,7 +8643,7 @@ discard block |
||
| 8643 | 8643 | * |
| 8644 | 8644 | * @return string |
| 8645 | 8645 | */ |
| 8646 | - static function (array $matches) use ($encoding): string { |
|
| 8646 | + static function(array $matches) use ($encoding): string { |
|
| 8647 | 8647 | // preserve leading underscore |
| 8648 | 8648 | $str = $matches[1]; |
| 8649 | 8649 | if ($matches[2]) { |
@@ -8668,11 +8668,11 @@ discard block |
||
| 8668 | 8668 | ); |
| 8669 | 8669 | |
| 8670 | 8670 | // Exceptions for small words: capitalize at start of title... |
| 8671 | - $str = (string) \preg_replace_callback( |
|
| 8671 | + $str = (string)\preg_replace_callback( |
|
| 8672 | 8672 | '~( \\A [[:punct:]]* # start of title... |
| 8673 | 8673 | | [:.;?!][ ]+ # or of subsentence... |
| 8674 | 8674 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
| 8675 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
| 8675 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
| 8676 | 8676 | ~uxi', |
| 8677 | 8677 | /** |
| 8678 | 8678 | * @param string[] $matches |
@@ -8681,15 +8681,15 @@ discard block |
||
| 8681 | 8681 | * |
| 8682 | 8682 | * @return string |
| 8683 | 8683 | */ |
| 8684 | - static function (array $matches) use ($encoding): string { |
|
| 8685 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
| 8684 | + static function(array $matches) use ($encoding): string { |
|
| 8685 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
| 8686 | 8686 | }, |
| 8687 | 8687 | $str |
| 8688 | 8688 | ); |
| 8689 | 8689 | |
| 8690 | 8690 | // ...and end of title |
| 8691 | - $str = (string) \preg_replace_callback( |
|
| 8692 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
| 8691 | + $str = (string)\preg_replace_callback( |
|
| 8692 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
| 8693 | 8693 | (?= [[:punct:]]* \Z # ...at the end of the title... |
| 8694 | 8694 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
| 8695 | 8695 | ~uxi', |
@@ -8700,7 +8700,7 @@ discard block |
||
| 8700 | 8700 | * |
| 8701 | 8701 | * @return string |
| 8702 | 8702 | */ |
| 8703 | - static function (array $matches) use ($encoding): string { |
|
| 8703 | + static function(array $matches) use ($encoding): string { |
|
| 8704 | 8704 | return static::ucfirst($matches[1], $encoding); |
| 8705 | 8705 | }, |
| 8706 | 8706 | $str |
@@ -8708,10 +8708,10 @@ discard block |
||
| 8708 | 8708 | |
| 8709 | 8709 | // Exceptions for small words in hyphenated compound words. |
| 8710 | 8710 | // e.g. "in-flight" -> In-Flight |
| 8711 | - $str = (string) \preg_replace_callback( |
|
| 8711 | + $str = (string)\preg_replace_callback( |
|
| 8712 | 8712 | '~\\b |
| 8713 | 8713 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
| 8714 | - ( ' . $small_words_rx . ' ) |
|
| 8714 | + ( ' . $small_words_rx.' ) |
|
| 8715 | 8715 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
| 8716 | 8716 | ~uxi', |
| 8717 | 8717 | /** |
@@ -8721,18 +8721,18 @@ discard block |
||
| 8721 | 8721 | * |
| 8722 | 8722 | * @return string |
| 8723 | 8723 | */ |
| 8724 | - static function (array $matches) use ($encoding): string { |
|
| 8724 | + static function(array $matches) use ($encoding): string { |
|
| 8725 | 8725 | return static::ucfirst($matches[1], $encoding); |
| 8726 | 8726 | }, |
| 8727 | 8727 | $str |
| 8728 | 8728 | ); |
| 8729 | 8729 | |
| 8730 | 8730 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
| 8731 | - $str = (string) \preg_replace_callback( |
|
| 8731 | + $str = (string)\preg_replace_callback( |
|
| 8732 | 8732 | '~\\b |
| 8733 | 8733 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
| 8734 | 8734 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
| 8735 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
| 8735 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
| 8736 | 8736 | (?! - ) # Negative lookahead for another - |
| 8737 | 8737 | ~uxi', |
| 8738 | 8738 | /** |
@@ -8742,8 +8742,8 @@ discard block |
||
| 8742 | 8742 | * |
| 8743 | 8743 | * @return string |
| 8744 | 8744 | */ |
| 8745 | - static function (array $matches) use ($encoding): string { |
|
| 8746 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
| 8745 | + static function(array $matches) use ($encoding): string { |
|
| 8746 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
| 8747 | 8747 | }, |
| 8748 | 8748 | $str |
| 8749 | 8749 | ); |
@@ -8858,7 +8858,7 @@ discard block |
||
| 8858 | 8858 | ); |
| 8859 | 8859 | |
| 8860 | 8860 | foreach ($tmp_return as &$item) { |
| 8861 | - $item = (string) $item; |
|
| 8861 | + $item = (string)$item; |
|
| 8862 | 8862 | } |
| 8863 | 8863 | |
| 8864 | 8864 | return $tmp_return; |
@@ -8912,39 +8912,39 @@ discard block |
||
| 8912 | 8912 | } |
| 8913 | 8913 | |
| 8914 | 8914 | if ($encoding === 'UTF-8') { |
| 8915 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 8915 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 8916 | 8916 | return $str; |
| 8917 | 8917 | } |
| 8918 | 8918 | |
| 8919 | 8919 | if ($substring !== '') { |
| 8920 | - $length -= (int) \mb_strlen($substring); |
|
| 8920 | + $length -= (int)\mb_strlen($substring); |
|
| 8921 | 8921 | |
| 8922 | 8922 | /** @noinspection UnnecessaryCastingInspection */ |
| 8923 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
| 8923 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
| 8924 | 8924 | } |
| 8925 | 8925 | |
| 8926 | 8926 | /** @noinspection UnnecessaryCastingInspection */ |
| 8927 | - return (string) \mb_substr($str, 0, $length); |
|
| 8927 | + return (string)\mb_substr($str, 0, $length); |
|
| 8928 | 8928 | } |
| 8929 | 8929 | |
| 8930 | 8930 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8931 | 8931 | |
| 8932 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 8932 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 8933 | 8933 | return $str; |
| 8934 | 8934 | } |
| 8935 | 8935 | |
| 8936 | 8936 | if ($substring !== '') { |
| 8937 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 8937 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 8938 | 8938 | } |
| 8939 | 8939 | |
| 8940 | 8940 | return ( |
| 8941 | - (string) self::substr( |
|
| 8941 | + (string)self::substr( |
|
| 8942 | 8942 | $str, |
| 8943 | 8943 | 0, |
| 8944 | 8944 | $length, |
| 8945 | 8945 | $encoding |
| 8946 | 8946 | ) |
| 8947 | - ) . $substring; |
|
| 8947 | + ).$substring; |
|
| 8948 | 8948 | } |
| 8949 | 8949 | |
| 8950 | 8950 | /** |
@@ -8978,12 +8978,12 @@ discard block |
||
| 8978 | 8978 | } |
| 8979 | 8979 | |
| 8980 | 8980 | if ($encoding === 'UTF-8') { |
| 8981 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 8981 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 8982 | 8982 | return $str; |
| 8983 | 8983 | } |
| 8984 | 8984 | |
| 8985 | 8985 | // need to further trim the string so we can append the substring |
| 8986 | - $length -= (int) \mb_strlen($substring); |
|
| 8986 | + $length -= (int)\mb_strlen($substring); |
|
| 8987 | 8987 | if ($length <= 0) { |
| 8988 | 8988 | return $substring; |
| 8989 | 8989 | } |
@@ -9009,18 +9009,18 @@ discard block |
||
| 9009 | 9009 | !$ignore_do_not_split_words_for_one_word |
| 9010 | 9010 | ) |
| 9011 | 9011 | ) { |
| 9012 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
| 9012 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
| 9013 | 9013 | } |
| 9014 | 9014 | } |
| 9015 | 9015 | } else { |
| 9016 | 9016 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 9017 | 9017 | |
| 9018 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 9018 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 9019 | 9019 | return $str; |
| 9020 | 9020 | } |
| 9021 | 9021 | |
| 9022 | 9022 | // need to further trim the string so we can append the substring |
| 9023 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 9023 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 9024 | 9024 | if ($length <= 0) { |
| 9025 | 9025 | return $substring; |
| 9026 | 9026 | } |
@@ -9046,12 +9046,12 @@ discard block |
||
| 9046 | 9046 | !$ignore_do_not_split_words_for_one_word |
| 9047 | 9047 | ) |
| 9048 | 9048 | ) { |
| 9049 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
| 9049 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
| 9050 | 9050 | } |
| 9051 | 9051 | } |
| 9052 | 9052 | } |
| 9053 | 9053 | |
| 9054 | - return $truncated . $substring; |
|
| 9054 | + return $truncated.$substring; |
|
| 9055 | 9055 | } |
| 9056 | 9056 | |
| 9057 | 9057 | /** |
@@ -9161,13 +9161,13 @@ discard block |
||
| 9161 | 9161 | } |
| 9162 | 9162 | } elseif ($format === 2) { |
| 9163 | 9163 | $number_of_words = []; |
| 9164 | - $offset = (int) self::strlen($str_parts[0]); |
|
| 9164 | + $offset = (int)self::strlen($str_parts[0]); |
|
| 9165 | 9165 | for ($i = 1; $i < $len; $i += 2) { |
| 9166 | 9166 | $number_of_words[$offset] = $str_parts[$i]; |
| 9167 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
| 9167 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
| 9168 | 9168 | } |
| 9169 | 9169 | } else { |
| 9170 | - $number_of_words = (int) (($len - 1) / 2); |
|
| 9170 | + $number_of_words = (int)(($len - 1) / 2); |
|
| 9171 | 9171 | } |
| 9172 | 9172 | |
| 9173 | 9173 | return $number_of_words; |
@@ -9296,21 +9296,21 @@ discard block |
||
| 9296 | 9296 | } |
| 9297 | 9297 | |
| 9298 | 9298 | if ($char_list === '') { |
| 9299 | - return (int) self::strlen($str, $encoding); |
|
| 9299 | + return (int)self::strlen($str, $encoding); |
|
| 9300 | 9300 | } |
| 9301 | 9301 | |
| 9302 | 9302 | if ($offset !== null || $length !== null) { |
| 9303 | 9303 | if ($encoding === 'UTF-8') { |
| 9304 | 9304 | if ($length === null) { |
| 9305 | 9305 | /** @noinspection UnnecessaryCastingInspection */ |
| 9306 | - $str_tmp = \mb_substr($str, (int) $offset); |
|
| 9306 | + $str_tmp = \mb_substr($str, (int)$offset); |
|
| 9307 | 9307 | } else { |
| 9308 | 9308 | /** @noinspection UnnecessaryCastingInspection */ |
| 9309 | - $str_tmp = \mb_substr($str, (int) $offset, $length); |
|
| 9309 | + $str_tmp = \mb_substr($str, (int)$offset, $length); |
|
| 9310 | 9310 | } |
| 9311 | 9311 | } else { |
| 9312 | 9312 | /** @noinspection UnnecessaryCastingInspection */ |
| 9313 | - $str_tmp = self::substr($str, (int) $offset, $length, $encoding); |
|
| 9313 | + $str_tmp = self::substr($str, (int)$offset, $length, $encoding); |
|
| 9314 | 9314 | } |
| 9315 | 9315 | |
| 9316 | 9316 | if ($str_tmp === false) { |
@@ -9326,7 +9326,7 @@ discard block |
||
| 9326 | 9326 | } |
| 9327 | 9327 | |
| 9328 | 9328 | $matches = []; |
| 9329 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
| 9329 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
| 9330 | 9330 | $return = self::strlen($matches[1], $encoding); |
| 9331 | 9331 | if ($return === false) { |
| 9332 | 9332 | return 0; |
@@ -9335,7 +9335,7 @@ discard block |
||
| 9335 | 9335 | return $return; |
| 9336 | 9336 | } |
| 9337 | 9337 | |
| 9338 | - return (int) self::strlen($str, $encoding); |
|
| 9338 | + return (int)self::strlen($str, $encoding); |
|
| 9339 | 9339 | } |
| 9340 | 9340 | |
| 9341 | 9341 | /** |
@@ -9390,7 +9390,7 @@ discard block |
||
| 9390 | 9390 | |
| 9391 | 9391 | $str = ''; |
| 9392 | 9392 | foreach ($array as $strPart) { |
| 9393 | - $str .= '&#' . (int) $strPart . ';'; |
|
| 9393 | + $str .= '&#'.(int)$strPart.';'; |
|
| 9394 | 9394 | } |
| 9395 | 9395 | |
| 9396 | 9396 | return self::html_entity_decode($str, \ENT_QUOTES | \ENT_HTML5); |
@@ -9479,7 +9479,7 @@ discard block |
||
| 9479 | 9479 | return ''; |
| 9480 | 9480 | } |
| 9481 | 9481 | |
| 9482 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
| 9482 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
| 9483 | 9483 | } |
| 9484 | 9484 | |
| 9485 | 9485 | /** |
@@ -9546,7 +9546,7 @@ discard block |
||
| 9546 | 9546 | // fallback for ascii only |
| 9547 | 9547 | // |
| 9548 | 9548 | |
| 9549 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 9549 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 9550 | 9550 | return \stripos($haystack, $needle, $offset); |
| 9551 | 9551 | } |
| 9552 | 9552 | |
@@ -9619,7 +9619,7 @@ discard block |
||
| 9619 | 9619 | /** |
| 9620 | 9620 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 9621 | 9621 | */ |
| 9622 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9622 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9623 | 9623 | } |
| 9624 | 9624 | |
| 9625 | 9625 | if ( |
@@ -9633,11 +9633,11 @@ discard block |
||
| 9633 | 9633 | } |
| 9634 | 9634 | } |
| 9635 | 9635 | |
| 9636 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
| 9636 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
| 9637 | 9637 | return \stristr($haystack, $needle, $before_needle); |
| 9638 | 9638 | } |
| 9639 | 9639 | |
| 9640 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
| 9640 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
| 9641 | 9641 | |
| 9642 | 9642 | if (!isset($match[1])) { |
| 9643 | 9643 | return false; |
@@ -9647,7 +9647,7 @@ discard block |
||
| 9647 | 9647 | return $match[1]; |
| 9648 | 9648 | } |
| 9649 | 9649 | |
| 9650 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
| 9650 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
| 9651 | 9651 | } |
| 9652 | 9652 | |
| 9653 | 9653 | /** |
@@ -9726,7 +9726,7 @@ discard block |
||
| 9726 | 9726 | /** |
| 9727 | 9727 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 9728 | 9728 | */ |
| 9729 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9729 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9730 | 9730 | } |
| 9731 | 9731 | |
| 9732 | 9732 | // |
@@ -9848,8 +9848,8 @@ discard block |
||
| 9848 | 9848 | } |
| 9849 | 9849 | |
| 9850 | 9850 | return \strnatcmp( |
| 9851 | - (string) self::strtonatfold($str1), |
|
| 9852 | - (string) self::strtonatfold($str2) |
|
| 9851 | + (string)self::strtonatfold($str1), |
|
| 9852 | + (string)self::strtonatfold($str2) |
|
| 9853 | 9853 | ); |
| 9854 | 9854 | } |
| 9855 | 9855 | |
@@ -9911,11 +9911,11 @@ discard block |
||
| 9911 | 9911 | } |
| 9912 | 9912 | |
| 9913 | 9913 | if ($encoding === 'UTF-8') { |
| 9914 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
| 9915 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
| 9914 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
| 9915 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
| 9916 | 9916 | } else { |
| 9917 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
| 9918 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
| 9917 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
| 9918 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
| 9919 | 9919 | } |
| 9920 | 9920 | |
| 9921 | 9921 | return self::strcmp($str1, $str2); |
@@ -9940,8 +9940,8 @@ discard block |
||
| 9940 | 9940 | return false; |
| 9941 | 9941 | } |
| 9942 | 9942 | |
| 9943 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
| 9944 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
| 9943 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
| 9944 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
| 9945 | 9945 | } |
| 9946 | 9946 | |
| 9947 | 9947 | return false; |
@@ -9976,10 +9976,10 @@ discard block |
||
| 9976 | 9976 | } |
| 9977 | 9977 | |
| 9978 | 9978 | // iconv and mbstring do not support integer $needle |
| 9979 | - if ((int) $needle === $needle) { |
|
| 9980 | - $needle = (string) self::chr($needle); |
|
| 9979 | + if ((int)$needle === $needle) { |
|
| 9980 | + $needle = (string)self::chr($needle); |
|
| 9981 | 9981 | } |
| 9982 | - $needle = (string) $needle; |
|
| 9982 | + $needle = (string)$needle; |
|
| 9983 | 9983 | |
| 9984 | 9984 | if ($needle === '') { |
| 9985 | 9985 | return false; |
@@ -10029,7 +10029,7 @@ discard block |
||
| 10029 | 10029 | /** |
| 10030 | 10030 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10031 | 10031 | */ |
| 10032 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10032 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10033 | 10033 | } |
| 10034 | 10034 | |
| 10035 | 10035 | // |
@@ -10070,7 +10070,7 @@ discard block |
||
| 10070 | 10070 | // fallback for ascii only |
| 10071 | 10071 | // |
| 10072 | 10072 | |
| 10073 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10073 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10074 | 10074 | return \strpos($haystack, $needle, $offset); |
| 10075 | 10075 | } |
| 10076 | 10076 | |
@@ -10082,7 +10082,7 @@ discard block |
||
| 10082 | 10082 | if ($haystack_tmp === false) { |
| 10083 | 10083 | $haystack_tmp = ''; |
| 10084 | 10084 | } |
| 10085 | - $haystack = (string) $haystack_tmp; |
|
| 10085 | + $haystack = (string)$haystack_tmp; |
|
| 10086 | 10086 | |
| 10087 | 10087 | if ($offset < 0) { |
| 10088 | 10088 | $offset = 0; |
@@ -10094,7 +10094,7 @@ discard block |
||
| 10094 | 10094 | } |
| 10095 | 10095 | |
| 10096 | 10096 | if ($pos) { |
| 10097 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 10097 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 10098 | 10098 | } |
| 10099 | 10099 | |
| 10100 | 10100 | return $offset + 0; |
@@ -10247,7 +10247,7 @@ discard block |
||
| 10247 | 10247 | /** |
| 10248 | 10248 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10249 | 10249 | */ |
| 10250 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10250 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10251 | 10251 | } |
| 10252 | 10252 | |
| 10253 | 10253 | // |
@@ -10259,7 +10259,7 @@ discard block |
||
| 10259 | 10259 | if ($needle_tmp === false) { |
| 10260 | 10260 | return false; |
| 10261 | 10261 | } |
| 10262 | - $needle = (string) $needle_tmp; |
|
| 10262 | + $needle = (string)$needle_tmp; |
|
| 10263 | 10263 | |
| 10264 | 10264 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
| 10265 | 10265 | if ($pos === false) { |
@@ -10281,7 +10281,7 @@ discard block |
||
| 10281 | 10281 | if ($needle_tmp === false) { |
| 10282 | 10282 | return false; |
| 10283 | 10283 | } |
| 10284 | - $needle = (string) $needle_tmp; |
|
| 10284 | + $needle = (string)$needle_tmp; |
|
| 10285 | 10285 | |
| 10286 | 10286 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
| 10287 | 10287 | if ($pos === false) { |
@@ -10320,7 +10320,7 @@ discard block |
||
| 10320 | 10320 | if ($encoding === 'UTF-8') { |
| 10321 | 10321 | if (self::$SUPPORT['intl'] === true) { |
| 10322 | 10322 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
| 10323 | - $i = (int) \grapheme_strlen($str); |
|
| 10323 | + $i = (int)\grapheme_strlen($str); |
|
| 10324 | 10324 | while ($i--) { |
| 10325 | 10325 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
| 10326 | 10326 | if ($reversed_tmp !== false) { |
@@ -10328,7 +10328,7 @@ discard block |
||
| 10328 | 10328 | } |
| 10329 | 10329 | } |
| 10330 | 10330 | } else { |
| 10331 | - $i = (int) \mb_strlen($str); |
|
| 10331 | + $i = (int)\mb_strlen($str); |
|
| 10332 | 10332 | while ($i--) { |
| 10333 | 10333 | $reversed_tmp = \mb_substr($str, $i, 1); |
| 10334 | 10334 | if ($reversed_tmp !== false) { |
@@ -10339,7 +10339,7 @@ discard block |
||
| 10339 | 10339 | } else { |
| 10340 | 10340 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 10341 | 10341 | |
| 10342 | - $i = (int) self::strlen($str, $encoding); |
|
| 10342 | + $i = (int)self::strlen($str, $encoding); |
|
| 10343 | 10343 | while ($i--) { |
| 10344 | 10344 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
| 10345 | 10345 | if ($reversed_tmp !== false) { |
@@ -10416,7 +10416,7 @@ discard block |
||
| 10416 | 10416 | if ($needle_tmp === false) { |
| 10417 | 10417 | return false; |
| 10418 | 10418 | } |
| 10419 | - $needle = (string) $needle_tmp; |
|
| 10419 | + $needle = (string)$needle_tmp; |
|
| 10420 | 10420 | |
| 10421 | 10421 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
| 10422 | 10422 | if ($pos === false) { |
@@ -10457,10 +10457,10 @@ discard block |
||
| 10457 | 10457 | } |
| 10458 | 10458 | |
| 10459 | 10459 | // iconv and mbstring do not support integer $needle |
| 10460 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 10461 | - $needle = (string) self::chr($needle); |
|
| 10460 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 10461 | + $needle = (string)self::chr($needle); |
|
| 10462 | 10462 | } |
| 10463 | - $needle = (string) $needle; |
|
| 10463 | + $needle = (string)$needle; |
|
| 10464 | 10464 | |
| 10465 | 10465 | if ($needle === '') { |
| 10466 | 10466 | return false; |
@@ -10508,7 +10508,7 @@ discard block |
||
| 10508 | 10508 | /** |
| 10509 | 10509 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10510 | 10510 | */ |
| 10511 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10511 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10512 | 10512 | } |
| 10513 | 10513 | |
| 10514 | 10514 | // |
@@ -10532,7 +10532,7 @@ discard block |
||
| 10532 | 10532 | // fallback for ascii only |
| 10533 | 10533 | // |
| 10534 | 10534 | |
| 10535 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10535 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10536 | 10536 | return \strripos($haystack, $needle, $offset); |
| 10537 | 10537 | } |
| 10538 | 10538 | |
@@ -10613,10 +10613,10 @@ discard block |
||
| 10613 | 10613 | } |
| 10614 | 10614 | |
| 10615 | 10615 | // iconv and mbstring do not support integer $needle |
| 10616 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 10617 | - $needle = (string) self::chr($needle); |
|
| 10616 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 10617 | + $needle = (string)self::chr($needle); |
|
| 10618 | 10618 | } |
| 10619 | - $needle = (string) $needle; |
|
| 10619 | + $needle = (string)$needle; |
|
| 10620 | 10620 | |
| 10621 | 10621 | if ($needle === '') { |
| 10622 | 10622 | return false; |
@@ -10664,7 +10664,7 @@ discard block |
||
| 10664 | 10664 | /** |
| 10665 | 10665 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10666 | 10666 | */ |
| 10667 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10667 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10668 | 10668 | } |
| 10669 | 10669 | |
| 10670 | 10670 | // |
@@ -10688,7 +10688,7 @@ discard block |
||
| 10688 | 10688 | // fallback for ascii only |
| 10689 | 10689 | // |
| 10690 | 10690 | |
| 10691 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10691 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10692 | 10692 | return \strrpos($haystack, $needle, $offset); |
| 10693 | 10693 | } |
| 10694 | 10694 | |
@@ -10708,7 +10708,7 @@ discard block |
||
| 10708 | 10708 | if ($haystack_tmp === false) { |
| 10709 | 10709 | $haystack_tmp = ''; |
| 10710 | 10710 | } |
| 10711 | - $haystack = (string) $haystack_tmp; |
|
| 10711 | + $haystack = (string)$haystack_tmp; |
|
| 10712 | 10712 | } |
| 10713 | 10713 | |
| 10714 | 10714 | $pos = \strrpos($haystack, $needle); |
@@ -10722,7 +10722,7 @@ discard block |
||
| 10722 | 10722 | return false; |
| 10723 | 10723 | } |
| 10724 | 10724 | |
| 10725 | - return $offset + (int) self::strlen($str_tmp); |
|
| 10725 | + return $offset + (int)self::strlen($str_tmp); |
|
| 10726 | 10726 | } |
| 10727 | 10727 | |
| 10728 | 10728 | /** |
@@ -10788,12 +10788,12 @@ discard block |
||
| 10788 | 10788 | if ($offset || $length !== null) { |
| 10789 | 10789 | if ($encoding === 'UTF-8') { |
| 10790 | 10790 | if ($length === null) { |
| 10791 | - $str = (string) \mb_substr($str, $offset); |
|
| 10791 | + $str = (string)\mb_substr($str, $offset); |
|
| 10792 | 10792 | } else { |
| 10793 | - $str = (string) \mb_substr($str, $offset, $length); |
|
| 10793 | + $str = (string)\mb_substr($str, $offset, $length); |
|
| 10794 | 10794 | } |
| 10795 | 10795 | } else { |
| 10796 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
| 10796 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
| 10797 | 10797 | } |
| 10798 | 10798 | } |
| 10799 | 10799 | |
@@ -10803,7 +10803,7 @@ discard block |
||
| 10803 | 10803 | |
| 10804 | 10804 | $matches = []; |
| 10805 | 10805 | |
| 10806 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
| 10806 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
| 10807 | 10807 | } |
| 10808 | 10808 | |
| 10809 | 10809 | /** |
@@ -10877,7 +10877,7 @@ discard block |
||
| 10877 | 10877 | /** |
| 10878 | 10878 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10879 | 10879 | */ |
| 10880 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10880 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10881 | 10881 | } |
| 10882 | 10882 | |
| 10883 | 10883 | // |
@@ -10899,7 +10899,7 @@ discard block |
||
| 10899 | 10899 | // fallback for ascii only |
| 10900 | 10900 | // |
| 10901 | 10901 | |
| 10902 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10902 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10903 | 10903 | return \strstr($haystack, $needle, $before_needle); |
| 10904 | 10904 | } |
| 10905 | 10905 | |
@@ -10907,7 +10907,7 @@ discard block |
||
| 10907 | 10907 | // fallback via vanilla php |
| 10908 | 10908 | // |
| 10909 | 10909 | |
| 10910 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
| 10910 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
| 10911 | 10911 | |
| 10912 | 10912 | if (!isset($match[1])) { |
| 10913 | 10913 | return false; |
@@ -10917,7 +10917,7 @@ discard block |
||
| 10917 | 10917 | return $match[1]; |
| 10918 | 10918 | } |
| 10919 | 10919 | |
| 10920 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
| 10920 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
| 10921 | 10921 | } |
| 10922 | 10922 | |
| 10923 | 10923 | /** |
@@ -11043,7 +11043,7 @@ discard block |
||
| 11043 | 11043 | bool $try_to_keep_the_string_length = false |
| 11044 | 11044 | ): string { |
| 11045 | 11045 | // init |
| 11046 | - $str = (string) $str; |
|
| 11046 | + $str = (string)$str; |
|
| 11047 | 11047 | |
| 11048 | 11048 | if ($str === '') { |
| 11049 | 11049 | return ''; |
@@ -11072,25 +11072,25 @@ discard block |
||
| 11072 | 11072 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 11073 | 11073 | } |
| 11074 | 11074 | |
| 11075 | - $language_code = $lang . '-Lower'; |
|
| 11075 | + $language_code = $lang.'-Lower'; |
|
| 11076 | 11076 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 11077 | 11077 | /** |
| 11078 | 11078 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11079 | 11079 | */ |
| 11080 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
| 11080 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
| 11081 | 11081 | |
| 11082 | 11082 | $language_code = 'Any-Lower'; |
| 11083 | 11083 | } |
| 11084 | 11084 | |
| 11085 | 11085 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 11086 | 11086 | /** @noinspection UnnecessaryCastingInspection */ |
| 11087 | - return (string) \transliterator_transliterate($language_code, $str); |
|
| 11087 | + return (string)\transliterator_transliterate($language_code, $str); |
|
| 11088 | 11088 | } |
| 11089 | 11089 | |
| 11090 | 11090 | /** |
| 11091 | 11091 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11092 | 11092 | */ |
| 11093 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
| 11093 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
| 11094 | 11094 | } |
| 11095 | 11095 | |
| 11096 | 11096 | // always fallback via symfony polyfill |
@@ -11123,7 +11123,7 @@ discard block |
||
| 11123 | 11123 | bool $try_to_keep_the_string_length = false |
| 11124 | 11124 | ): string { |
| 11125 | 11125 | // init |
| 11126 | - $str = (string) $str; |
|
| 11126 | + $str = (string)$str; |
|
| 11127 | 11127 | |
| 11128 | 11128 | if ($str === '') { |
| 11129 | 11129 | return ''; |
@@ -11152,25 +11152,25 @@ discard block |
||
| 11152 | 11152 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 11153 | 11153 | } |
| 11154 | 11154 | |
| 11155 | - $language_code = $lang . '-Upper'; |
|
| 11155 | + $language_code = $lang.'-Upper'; |
|
| 11156 | 11156 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 11157 | 11157 | /** |
| 11158 | 11158 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11159 | 11159 | */ |
| 11160 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
| 11160 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
| 11161 | 11161 | |
| 11162 | 11162 | $language_code = 'Any-Upper'; |
| 11163 | 11163 | } |
| 11164 | 11164 | |
| 11165 | 11165 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 11166 | 11166 | /** @noinspection UnnecessaryCastingInspection */ |
| 11167 | - return (string) \transliterator_transliterate($language_code, $str); |
|
| 11167 | + return (string)\transliterator_transliterate($language_code, $str); |
|
| 11168 | 11168 | } |
| 11169 | 11169 | |
| 11170 | 11170 | /** |
| 11171 | 11171 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11172 | 11172 | */ |
| 11173 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
| 11173 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
| 11174 | 11174 | } |
| 11175 | 11175 | |
| 11176 | 11176 | // always fallback via symfony polyfill |
@@ -11239,7 +11239,7 @@ discard block |
||
| 11239 | 11239 | $from = \array_combine($from, $to); |
| 11240 | 11240 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 11241 | 11241 | if ($from === false) { |
| 11242 | - throw new \InvalidArgumentException('The number of elements for each array isn\'t equal or the arrays are empty: (from: ' . \print_r($from, true) . ' | to: ' . \print_r($to, true) . ')'); |
|
| 11242 | + throw new \InvalidArgumentException('The number of elements for each array isn\'t equal or the arrays are empty: (from: '.\print_r($from, true).' | to: '.\print_r($to, true).')'); |
|
| 11243 | 11243 | } |
| 11244 | 11244 | } |
| 11245 | 11245 | |
@@ -11301,9 +11301,9 @@ discard block |
||
| 11301 | 11301 | } |
| 11302 | 11302 | |
| 11303 | 11303 | $wide = 0; |
| 11304 | - $str = (string) \preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $str, -1, $wide); |
|
| 11304 | + $str = (string)\preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $str, -1, $wide); |
|
| 11305 | 11305 | |
| 11306 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
| 11306 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
| 11307 | 11307 | } |
| 11308 | 11308 | |
| 11309 | 11309 | /** |
@@ -11401,9 +11401,9 @@ discard block |
||
| 11401 | 11401 | } |
| 11402 | 11402 | |
| 11403 | 11403 | if ($length === null) { |
| 11404 | - $length = (int) $str_length; |
|
| 11404 | + $length = (int)$str_length; |
|
| 11405 | 11405 | } else { |
| 11406 | - $length = (int) $length; |
|
| 11406 | + $length = (int)$length; |
|
| 11407 | 11407 | } |
| 11408 | 11408 | |
| 11409 | 11409 | if ( |
@@ -11414,7 +11414,7 @@ discard block |
||
| 11414 | 11414 | /** |
| 11415 | 11415 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11416 | 11416 | */ |
| 11417 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11417 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11418 | 11418 | } |
| 11419 | 11419 | |
| 11420 | 11420 | // |
@@ -11504,16 +11504,16 @@ discard block |
||
| 11504 | 11504 | ) { |
| 11505 | 11505 | if ($encoding === 'UTF-8') { |
| 11506 | 11506 | if ($length === null) { |
| 11507 | - $str1 = (string) \mb_substr($str1, $offset); |
|
| 11507 | + $str1 = (string)\mb_substr($str1, $offset); |
|
| 11508 | 11508 | } else { |
| 11509 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
| 11509 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
| 11510 | 11510 | } |
| 11511 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
| 11511 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
| 11512 | 11512 | } else { |
| 11513 | 11513 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 11514 | 11514 | |
| 11515 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
| 11516 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
| 11515 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
| 11516 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
| 11517 | 11517 | } |
| 11518 | 11518 | } |
| 11519 | 11519 | |
@@ -11578,13 +11578,13 @@ discard block |
||
| 11578 | 11578 | if ($length_tmp === false) { |
| 11579 | 11579 | return false; |
| 11580 | 11580 | } |
| 11581 | - $length = (int) $length_tmp; |
|
| 11581 | + $length = (int)$length_tmp; |
|
| 11582 | 11582 | } |
| 11583 | 11583 | |
| 11584 | 11584 | if ($encoding === 'UTF-8') { |
| 11585 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
| 11585 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
| 11586 | 11586 | } else { |
| 11587 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
| 11587 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
| 11588 | 11588 | } |
| 11589 | 11589 | } |
| 11590 | 11590 | |
@@ -11596,7 +11596,7 @@ discard block |
||
| 11596 | 11596 | /** |
| 11597 | 11597 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11598 | 11598 | */ |
| 11599 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11599 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11600 | 11600 | } |
| 11601 | 11601 | |
| 11602 | 11602 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -11607,7 +11607,7 @@ discard block |
||
| 11607 | 11607 | return \mb_substr_count($haystack, $needle, $encoding); |
| 11608 | 11608 | } |
| 11609 | 11609 | |
| 11610 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 11610 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 11611 | 11611 | |
| 11612 | 11612 | return \count($matches); |
| 11613 | 11613 | } |
@@ -11657,7 +11657,7 @@ discard block |
||
| 11657 | 11657 | if ($length_tmp === false) { |
| 11658 | 11658 | return false; |
| 11659 | 11659 | } |
| 11660 | - $length = (int) $length_tmp; |
|
| 11660 | + $length = (int)$length_tmp; |
|
| 11661 | 11661 | } |
| 11662 | 11662 | |
| 11663 | 11663 | if ( |
@@ -11679,7 +11679,7 @@ discard block |
||
| 11679 | 11679 | if ($haystack_tmp === false) { |
| 11680 | 11680 | $haystack_tmp = ''; |
| 11681 | 11681 | } |
| 11682 | - $haystack = (string) $haystack_tmp; |
|
| 11682 | + $haystack = (string)$haystack_tmp; |
|
| 11683 | 11683 | } |
| 11684 | 11684 | |
| 11685 | 11685 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -11720,10 +11720,10 @@ discard block |
||
| 11720 | 11720 | |
| 11721 | 11721 | if ($encoding === 'UTF-8') { |
| 11722 | 11722 | if ($case_sensitive) { |
| 11723 | - return (int) \mb_substr_count($str, $substring); |
|
| 11723 | + return (int)\mb_substr_count($str, $substring); |
|
| 11724 | 11724 | } |
| 11725 | 11725 | |
| 11726 | - return (int) \mb_substr_count( |
|
| 11726 | + return (int)\mb_substr_count( |
|
| 11727 | 11727 | \mb_strtoupper($str), |
| 11728 | 11728 | \mb_strtoupper($substring) |
| 11729 | 11729 | ); |
@@ -11732,10 +11732,10 @@ discard block |
||
| 11732 | 11732 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 11733 | 11733 | |
| 11734 | 11734 | if ($case_sensitive) { |
| 11735 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
| 11735 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
| 11736 | 11736 | } |
| 11737 | 11737 | |
| 11738 | - return (int) \mb_substr_count( |
|
| 11738 | + return (int)\mb_substr_count( |
|
| 11739 | 11739 | self::strtocasefold($str, true, false, $encoding, null, false), |
| 11740 | 11740 | self::strtocasefold($substring, true, false, $encoding, null, false), |
| 11741 | 11741 | $encoding |
@@ -11764,7 +11764,7 @@ discard block |
||
| 11764 | 11764 | } |
| 11765 | 11765 | |
| 11766 | 11766 | if (self::str_istarts_with($haystack, $needle)) { |
| 11767 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 11767 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 11768 | 11768 | } |
| 11769 | 11769 | |
| 11770 | 11770 | return $haystack; |
@@ -11826,7 +11826,7 @@ discard block |
||
| 11826 | 11826 | } |
| 11827 | 11827 | |
| 11828 | 11828 | if (self::str_iends_with($haystack, $needle)) { |
| 11829 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
| 11829 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
| 11830 | 11830 | } |
| 11831 | 11831 | |
| 11832 | 11832 | return $haystack; |
@@ -11854,7 +11854,7 @@ discard block |
||
| 11854 | 11854 | } |
| 11855 | 11855 | |
| 11856 | 11856 | if (self::str_starts_with($haystack, $needle)) { |
| 11857 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 11857 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 11858 | 11858 | } |
| 11859 | 11859 | |
| 11860 | 11860 | return $haystack; |
@@ -11909,7 +11909,7 @@ discard block |
||
| 11909 | 11909 | if (\is_array($offset)) { |
| 11910 | 11910 | $offset = \array_slice($offset, 0, $num); |
| 11911 | 11911 | foreach ($offset as &$value_tmp) { |
| 11912 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
| 11912 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
| 11913 | 11913 | } |
| 11914 | 11914 | unset($value_tmp); |
| 11915 | 11915 | } else { |
@@ -11922,7 +11922,7 @@ discard block |
||
| 11922 | 11922 | } elseif (\is_array($length)) { |
| 11923 | 11923 | $length = \array_slice($length, 0, $num); |
| 11924 | 11924 | foreach ($length as &$value_tmp_V2) { |
| 11925 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
| 11925 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
| 11926 | 11926 | } |
| 11927 | 11927 | unset($value_tmp_V2); |
| 11928 | 11928 | } else { |
@@ -11942,8 +11942,8 @@ discard block |
||
| 11942 | 11942 | } |
| 11943 | 11943 | |
| 11944 | 11944 | // init |
| 11945 | - $str = (string) $str; |
|
| 11946 | - $replacement = (string) $replacement; |
|
| 11945 | + $str = (string)$str; |
|
| 11946 | + $replacement = (string)$replacement; |
|
| 11947 | 11947 | |
| 11948 | 11948 | if (\is_array($length)) { |
| 11949 | 11949 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -11958,16 +11958,16 @@ discard block |
||
| 11958 | 11958 | } |
| 11959 | 11959 | |
| 11960 | 11960 | if (self::$SUPPORT['mbstring'] === true) { |
| 11961 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 11961 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 11962 | 11962 | |
| 11963 | 11963 | if ($offset < 0) { |
| 11964 | - $offset = (int) \max(0, $string_length + $offset); |
|
| 11964 | + $offset = (int)\max(0, $string_length + $offset); |
|
| 11965 | 11965 | } elseif ($offset > $string_length) { |
| 11966 | 11966 | $offset = $string_length; |
| 11967 | 11967 | } |
| 11968 | 11968 | |
| 11969 | 11969 | if ($length !== null && $length < 0) { |
| 11970 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
| 11970 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
| 11971 | 11971 | } elseif ($length === null || $length > $string_length) { |
| 11972 | 11972 | $length = $string_length; |
| 11973 | 11973 | } |
@@ -11978,9 +11978,9 @@ discard block |
||
| 11978 | 11978 | } |
| 11979 | 11979 | |
| 11980 | 11980 | /** @noinspection AdditionOperationOnArraysInspection */ |
| 11981 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
| 11982 | - $replacement . |
|
| 11983 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 11981 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
| 11982 | + $replacement. |
|
| 11983 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 11984 | 11984 | } |
| 11985 | 11985 | |
| 11986 | 11986 | // |
@@ -11989,8 +11989,7 @@ discard block |
||
| 11989 | 11989 | |
| 11990 | 11990 | if (ASCII::is_ascii($str)) { |
| 11991 | 11991 | return ($length === null) ? |
| 11992 | - \substr_replace($str, $replacement, $offset) : |
|
| 11993 | - \substr_replace($str, $replacement, $offset, $length); |
|
| 11992 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
| 11994 | 11993 | } |
| 11995 | 11994 | |
| 11996 | 11995 | // |
@@ -12006,7 +12005,7 @@ discard block |
||
| 12006 | 12005 | // e.g.: non mbstring support + invalid chars |
| 12007 | 12006 | return ''; |
| 12008 | 12007 | } |
| 12009 | - $length = (int) $length_tmp; |
|
| 12008 | + $length = (int)$length_tmp; |
|
| 12010 | 12009 | } |
| 12011 | 12010 | |
| 12012 | 12011 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -12044,14 +12043,14 @@ discard block |
||
| 12044 | 12043 | && |
| 12045 | 12044 | \substr($haystack, -\strlen($needle)) === $needle |
| 12046 | 12045 | ) { |
| 12047 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
| 12046 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
| 12048 | 12047 | } |
| 12049 | 12048 | |
| 12050 | 12049 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
| 12051 | - return (string) self::substr( |
|
| 12050 | + return (string)self::substr( |
|
| 12052 | 12051 | $haystack, |
| 12053 | 12052 | 0, |
| 12054 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
| 12053 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
| 12055 | 12054 | $encoding |
| 12056 | 12055 | ); |
| 12057 | 12056 | } |
@@ -12084,10 +12083,10 @@ discard block |
||
| 12084 | 12083 | } |
| 12085 | 12084 | |
| 12086 | 12085 | if ($encoding === 'UTF-8') { |
| 12087 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 12086 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 12088 | 12087 | } |
| 12089 | 12088 | |
| 12090 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 12089 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 12091 | 12090 | } |
| 12092 | 12091 | |
| 12093 | 12092 | /** |
@@ -12295,7 +12294,7 @@ discard block |
||
| 12295 | 12294 | public static function to_boolean($str): bool |
| 12296 | 12295 | { |
| 12297 | 12296 | // init |
| 12298 | - $str = (string) $str; |
|
| 12297 | + $str = (string)$str; |
|
| 12299 | 12298 | |
| 12300 | 12299 | if ($str === '') { |
| 12301 | 12300 | return false; |
@@ -12323,10 +12322,10 @@ discard block |
||
| 12323 | 12322 | } |
| 12324 | 12323 | |
| 12325 | 12324 | if (\is_numeric($str)) { |
| 12326 | - return ((float) $str + 0) > 0; |
|
| 12325 | + return ((float)$str + 0) > 0; |
|
| 12327 | 12326 | } |
| 12328 | 12327 | |
| 12329 | - return (bool) \trim($str); |
|
| 12328 | + return (bool)\trim($str); |
|
| 12330 | 12329 | } |
| 12331 | 12330 | |
| 12332 | 12331 | /** |
@@ -12372,7 +12371,7 @@ discard block |
||
| 12372 | 12371 | return $str; |
| 12373 | 12372 | } |
| 12374 | 12373 | |
| 12375 | - $str = (string) $str; |
|
| 12374 | + $str = (string)$str; |
|
| 12376 | 12375 | if ($str === '') { |
| 12377 | 12376 | return ''; |
| 12378 | 12377 | } |
@@ -12427,7 +12426,7 @@ discard block |
||
| 12427 | 12426 | return $str; |
| 12428 | 12427 | } |
| 12429 | 12428 | |
| 12430 | - $str = (string) $str; |
|
| 12429 | + $str = (string)$str; |
|
| 12431 | 12430 | if ($str === '') { |
| 12432 | 12431 | return $str; |
| 12433 | 12432 | } |
@@ -12445,7 +12444,7 @@ discard block |
||
| 12445 | 12444 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
| 12446 | 12445 | |
| 12447 | 12446 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 12448 | - $buf .= $c1 . $c2; |
|
| 12447 | + $buf .= $c1.$c2; |
|
| 12449 | 12448 | ++$i; |
| 12450 | 12449 | } else { // not valid UTF8 - convert it |
| 12451 | 12450 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12456,7 +12455,7 @@ discard block |
||
| 12456 | 12455 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
| 12457 | 12456 | |
| 12458 | 12457 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 12459 | - $buf .= $c1 . $c2 . $c3; |
|
| 12458 | + $buf .= $c1.$c2.$c3; |
|
| 12460 | 12459 | $i += 2; |
| 12461 | 12460 | } else { // not valid UTF8 - convert it |
| 12462 | 12461 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12468,7 +12467,7 @@ discard block |
||
| 12468 | 12467 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
| 12469 | 12468 | |
| 12470 | 12469 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 12471 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
| 12470 | + $buf .= $c1.$c2.$c3.$c4; |
|
| 12472 | 12471 | $i += 3; |
| 12473 | 12472 | } else { // not valid UTF8 - convert it |
| 12474 | 12473 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12496,13 +12495,13 @@ discard block |
||
| 12496 | 12495 | * |
| 12497 | 12496 | * @return string |
| 12498 | 12497 | */ |
| 12499 | - static function (array $matches): string { |
|
| 12498 | + static function(array $matches): string { |
|
| 12500 | 12499 | if (isset($matches[3])) { |
| 12501 | - $cp = (int) \hexdec($matches[3]); |
|
| 12500 | + $cp = (int)\hexdec($matches[3]); |
|
| 12502 | 12501 | } else { |
| 12503 | 12502 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
| 12504 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
| 12505 | - + (int) \hexdec($matches[2]) |
|
| 12503 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
| 12504 | + + (int)\hexdec($matches[2]) |
|
| 12506 | 12505 | + 0x10000 |
| 12507 | 12506 | - (0xD800 << 10) |
| 12508 | 12507 | - 0xDC00; |
@@ -12513,12 +12512,12 @@ discard block |
||
| 12513 | 12512 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
| 12514 | 12513 | |
| 12515 | 12514 | if ($cp < 0x80) { |
| 12516 | - return (string) self::chr($cp); |
|
| 12515 | + return (string)self::chr($cp); |
|
| 12517 | 12516 | } |
| 12518 | 12517 | |
| 12519 | 12518 | if ($cp < 0xA0) { |
| 12520 | 12519 | /** @noinspection UnnecessaryCastingInspection */ |
| 12521 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
| 12520 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
| 12522 | 12521 | } |
| 12523 | 12522 | |
| 12524 | 12523 | return self::decimal_to_chr($cp); |
@@ -12551,7 +12550,7 @@ discard block |
||
| 12551 | 12550 | public static function to_int(string $str) |
| 12552 | 12551 | { |
| 12553 | 12552 | if (\is_numeric($str)) { |
| 12554 | - return (int) $str; |
|
| 12553 | + return (int)$str; |
|
| 12555 | 12554 | } |
| 12556 | 12555 | |
| 12557 | 12556 | return null; |
@@ -12582,7 +12581,7 @@ discard block |
||
| 12582 | 12581 | || |
| 12583 | 12582 | $input_type === 'double' |
| 12584 | 12583 | ) { |
| 12585 | - return (string) $input; |
|
| 12584 | + return (string)$input; |
|
| 12586 | 12585 | } |
| 12587 | 12586 | |
| 12588 | 12587 | if ( |
@@ -12590,7 +12589,7 @@ discard block |
||
| 12590 | 12589 | && |
| 12591 | 12590 | \method_exists($input, '__toString') |
| 12592 | 12591 | ) { |
| 12593 | - return (string) $input; |
|
| 12592 | + return (string)$input; |
|
| 12594 | 12593 | } |
| 12595 | 12594 | |
| 12596 | 12595 | return null; |
@@ -12628,7 +12627,7 @@ discard block |
||
| 12628 | 12627 | } |
| 12629 | 12628 | |
| 12630 | 12629 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 12631 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 12630 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 12632 | 12631 | } |
| 12633 | 12632 | |
| 12634 | 12633 | if ($chars) { |
@@ -12677,15 +12676,15 @@ discard block |
||
| 12677 | 12676 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 12678 | 12677 | |
| 12679 | 12678 | if ($encoding === 'UTF-8') { |
| 12680 | - $str_part_two = (string) \mb_substr($str, 1); |
|
| 12679 | + $str_part_two = (string)\mb_substr($str, 1); |
|
| 12681 | 12680 | |
| 12682 | 12681 | if ($use_mb_functions) { |
| 12683 | 12682 | $str_part_one = \mb_strtoupper( |
| 12684 | - (string) \mb_substr($str, 0, 1) |
|
| 12683 | + (string)\mb_substr($str, 0, 1) |
|
| 12685 | 12684 | ); |
| 12686 | 12685 | } else { |
| 12687 | 12686 | $str_part_one = self::strtoupper( |
| 12688 | - (string) \mb_substr($str, 0, 1), |
|
| 12687 | + (string)\mb_substr($str, 0, 1), |
|
| 12689 | 12688 | $encoding, |
| 12690 | 12689 | false, |
| 12691 | 12690 | $lang, |
@@ -12695,16 +12694,16 @@ discard block |
||
| 12695 | 12694 | } else { |
| 12696 | 12695 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 12697 | 12696 | |
| 12698 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
| 12697 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
| 12699 | 12698 | |
| 12700 | 12699 | if ($use_mb_functions) { |
| 12701 | 12700 | $str_part_one = \mb_strtoupper( |
| 12702 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
| 12701 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
| 12703 | 12702 | $encoding |
| 12704 | 12703 | ); |
| 12705 | 12704 | } else { |
| 12706 | 12705 | $str_part_one = self::strtoupper( |
| 12707 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 12706 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 12708 | 12707 | $encoding, |
| 12709 | 12708 | false, |
| 12710 | 12709 | $lang, |
@@ -12713,7 +12712,7 @@ discard block |
||
| 12713 | 12712 | } |
| 12714 | 12713 | } |
| 12715 | 12714 | |
| 12716 | - return $str_part_one . $str_part_two; |
|
| 12715 | + return $str_part_one.$str_part_two; |
|
| 12717 | 12716 | } |
| 12718 | 12717 | |
| 12719 | 12718 | /** |
@@ -12772,7 +12771,7 @@ discard block |
||
| 12772 | 12771 | $str = self::clean($str); |
| 12773 | 12772 | } |
| 12774 | 12773 | |
| 12775 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
| 12774 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
| 12776 | 12775 | |
| 12777 | 12776 | if ( |
| 12778 | 12777 | $use_php_default_functions |
@@ -13185,7 +13184,7 @@ discard block |
||
| 13185 | 13184 | if ( |
| 13186 | 13185 | $keep_utf8_chars |
| 13187 | 13186 | && |
| 13188 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
| 13187 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
| 13189 | 13188 | ) { |
| 13190 | 13189 | return $str_backup; |
| 13191 | 13190 | } |
@@ -13272,17 +13271,17 @@ discard block |
||
| 13272 | 13271 | return ''; |
| 13273 | 13272 | } |
| 13274 | 13273 | |
| 13275 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
| 13274 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
| 13276 | 13275 | |
| 13277 | 13276 | if ( |
| 13278 | 13277 | !isset($matches[0]) |
| 13279 | 13278 | || |
| 13280 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
| 13279 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
| 13281 | 13280 | ) { |
| 13282 | 13281 | return $str; |
| 13283 | 13282 | } |
| 13284 | 13283 | |
| 13285 | - return \rtrim($matches[0]) . $str_add_on; |
|
| 13284 | + return \rtrim($matches[0]).$str_add_on; |
|
| 13286 | 13285 | } |
| 13287 | 13286 | |
| 13288 | 13287 | /** |
@@ -13375,7 +13374,7 @@ discard block |
||
| 13375 | 13374 | } |
| 13376 | 13375 | } |
| 13377 | 13376 | |
| 13378 | - return $str_return . \implode('', $charsArray); |
|
| 13377 | + return $str_return.\implode('', $charsArray); |
|
| 13379 | 13378 | } |
| 13380 | 13379 | |
| 13381 | 13380 | /** |
@@ -13429,7 +13428,7 @@ discard block |
||
| 13429 | 13428 | $final_break = ''; |
| 13430 | 13429 | } |
| 13431 | 13430 | |
| 13432 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
| 13431 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
| 13433 | 13432 | } |
| 13434 | 13433 | |
| 13435 | 13434 | /** |
@@ -13665,7 +13664,7 @@ discard block |
||
| 13665 | 13664 | /** @noinspection PhpIncludeInspection */ |
| 13666 | 13665 | /** @noinspection UsingInclusionReturnValueInspection */ |
| 13667 | 13666 | /** @psalm-suppress UnresolvableInclude */ |
| 13668 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
| 13667 | + return include __DIR__.'/data/'.$file.'.php'; |
|
| 13669 | 13668 | } |
| 13670 | 13669 | |
| 13671 | 13670 | /** |
@@ -13685,7 +13684,7 @@ discard block |
||
| 13685 | 13684 | */ |
| 13686 | 13685 | \uksort( |
| 13687 | 13686 | self::$EMOJI, |
| 13688 | - static function (string $a, string $b): int { |
|
| 13687 | + static function(string $a, string $b): int { |
|
| 13689 | 13688 | return \strlen($b) <=> \strlen($a); |
| 13690 | 13689 | } |
| 13691 | 13690 | ); |
@@ -13695,7 +13694,7 @@ discard block |
||
| 13695 | 13694 | |
| 13696 | 13695 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
| 13697 | 13696 | $tmp_key = \crc32($key); |
| 13698 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
| 13697 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
| 13699 | 13698 | } |
| 13700 | 13699 | |
| 13701 | 13700 | return true; |
@@ -13723,7 +13722,7 @@ discard block |
||
| 13723 | 13722 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 13724 | 13723 | return \defined('MB_OVERLOAD_STRING') |
| 13725 | 13724 | && |
| 13726 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 13725 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 13727 | 13726 | } |
| 13728 | 13727 | |
| 13729 | 13728 | /** |
@@ -13789,7 +13788,7 @@ discard block |
||
| 13789 | 13788 | */ |
| 13790 | 13789 | static $RX_CLASS_CACHE = []; |
| 13791 | 13790 | |
| 13792 | - $cache_key = $s . '_' . $class; |
|
| 13791 | + $cache_key = $s.'_'.$class; |
|
| 13793 | 13792 | |
| 13794 | 13793 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
| 13795 | 13794 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -13802,7 +13801,7 @@ discard block |
||
| 13802 | 13801 | /** @noinspection AlterInForeachInspection */ |
| 13803 | 13802 | foreach (self::str_split($s) as &$s) { |
| 13804 | 13803 | if ($s === '-') { |
| 13805 | - $class_array[0] = '-' . $class_array[0]; |
|
| 13804 | + $class_array[0] = '-'.$class_array[0]; |
|
| 13806 | 13805 | } elseif (!isset($s[2])) { |
| 13807 | 13806 | $class_array[0] .= \preg_quote($s, '/'); |
| 13808 | 13807 | } elseif (self::strlen($s) === 1) { |
@@ -13813,13 +13812,13 @@ discard block |
||
| 13813 | 13812 | } |
| 13814 | 13813 | |
| 13815 | 13814 | if ($class_array[0]) { |
| 13816 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
| 13815 | + $class_array[0] = '['.$class_array[0].']'; |
|
| 13817 | 13816 | } |
| 13818 | 13817 | |
| 13819 | 13818 | if (\count($class_array) === 1) { |
| 13820 | 13819 | $return = $class_array[0]; |
| 13821 | 13820 | } else { |
| 13822 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
| 13821 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
| 13823 | 13822 | } |
| 13824 | 13823 | |
| 13825 | 13824 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -13900,7 +13899,7 @@ discard block |
||
| 13900 | 13899 | |
| 13901 | 13900 | if ($delimiter === '-') { |
| 13902 | 13901 | /** @noinspection AlterInForeachInspection */ |
| 13903 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
| 13902 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
| 13904 | 13903 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
| 13905 | 13904 | $continue = true; |
| 13906 | 13905 | |
@@ -13910,7 +13909,7 @@ discard block |
||
| 13910 | 13909 | } |
| 13911 | 13910 | |
| 13912 | 13911 | /** @noinspection AlterInForeachInspection */ |
| 13913 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
| 13912 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
| 13914 | 13913 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
| 13915 | 13914 | $continue = true; |
| 13916 | 13915 | |
@@ -13980,8 +13979,8 @@ discard block |
||
| 13980 | 13979 | } else { |
| 13981 | 13980 | /** @noinspection OffsetOperationsInspection */ |
| 13982 | 13981 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
| 13983 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
| 13984 | - $buf .= $cc1 . $cc2; |
|
| 13982 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
| 13983 | + $buf .= $cc1.$cc2; |
|
| 13985 | 13984 | } |
| 13986 | 13985 | |
| 13987 | 13986 | return $buf; |
@@ -14000,7 +13999,7 @@ discard block |
||
| 14000 | 13999 | { |
| 14001 | 14000 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
| 14002 | 14001 | if (\preg_match($pattern, $str)) { |
| 14003 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
| 14002 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
| 14004 | 14003 | } |
| 14005 | 14004 | |
| 14006 | 14005 | return $str; |