@@ -583,22 +583,22 @@ discard block |
||
583 | 583 | * @psalm-suppress PossiblyNullArrayAccess |
584 | 584 | */ |
585 | 585 | $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
586 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
586 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
587 | 587 | } elseif ($code_point <= 0xFFFF) { |
588 | 588 | /** |
589 | 589 | * @psalm-suppress PossiblyNullArrayAccess |
590 | 590 | */ |
591 | 591 | $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
592 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
593 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
592 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
593 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
594 | 594 | } else { |
595 | 595 | /** |
596 | 596 | * @psalm-suppress PossiblyNullArrayAccess |
597 | 597 | */ |
598 | 598 | $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
599 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
600 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
601 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
599 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
600 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
601 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | if ($encoding !== 'UTF-8') { |
@@ -2292,10 +2292,10 @@ discard block |
||
2292 | 2292 | public static function get_unique_string($entropy_extra = '', bool $use_md5 = true): string |
2293 | 2293 | { |
2294 | 2294 | $unique_helper = \random_int(0, \mt_getrandmax()) . |
2295 | - \session_id() . |
|
2296 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2297 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2298 | - $entropy_extra; |
|
2295 | + \session_id() . |
|
2296 | + ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2297 | + ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2298 | + $entropy_extra; |
|
2299 | 2299 | |
2300 | 2300 | $unique_string = \uniqid($unique_helper, true); |
2301 | 2301 | |
@@ -5803,8 +5803,8 @@ discard block |
||
5803 | 5803 | |
5804 | 5804 | /** @noinspection UnnecessaryCastingInspection */ |
5805 | 5805 | return (string) \mb_substr($str, 0, $index) . |
5806 | - $substring . |
|
5807 | - (string) \mb_substr($str, $index, $len); |
|
5806 | + $substring . |
|
5807 | + (string) \mb_substr($str, $index, $len); |
|
5808 | 5808 | } |
5809 | 5809 | |
5810 | 5810 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -5815,8 +5815,8 @@ discard block |
||
5815 | 5815 | } |
5816 | 5816 | |
5817 | 5817 | return ((string) self::substr($str, 0, $index, $encoding)) . |
5818 | - $substring . |
|
5819 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5818 | + $substring . |
|
5819 | + ((string) self::substr($str, $index, $len, $encoding)); |
|
5820 | 5820 | } |
5821 | 5821 | |
5822 | 5822 | /** |
@@ -7849,11 +7849,11 @@ discard block |
||
7849 | 7849 | if ($use_mb_functions === true) { |
7850 | 7850 | if ($encoding === 'UTF-8') { |
7851 | 7851 | return \mb_strtoupper(\mb_substr($match[0], 0, 1)) |
7852 | - . \mb_strtolower(\mb_substr($match[0], 1)); |
|
7852 | + . \mb_strtolower(\mb_substr($match[0], 1)); |
|
7853 | 7853 | } |
7854 | 7854 | |
7855 | 7855 | return \mb_strtoupper(\mb_substr($match[0], 0, 1, $encoding), $encoding) |
7856 | - . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
7856 | + . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
7857 | 7857 | } |
7858 | 7858 | |
7859 | 7859 | return self::ucfirst( |
@@ -8232,13 +8232,13 @@ discard block |
||
8232 | 8232 | } |
8233 | 8233 | |
8234 | 8234 | return ( |
8235 | - (string) self::substr( |
|
8236 | - $str, |
|
8237 | - 0, |
|
8238 | - $length, |
|
8239 | - $encoding |
|
8240 | - ) |
|
8241 | - ) . $substring; |
|
8235 | + (string) self::substr( |
|
8236 | + $str, |
|
8237 | + 0, |
|
8238 | + $length, |
|
8239 | + $encoding |
|
8240 | + ) |
|
8241 | + ) . $substring; |
|
8242 | 8242 | } |
8243 | 8243 | |
8244 | 8244 | /** |
@@ -11054,8 +11054,8 @@ discard block |
||
11054 | 11054 | |
11055 | 11055 | /** @noinspection AdditionOperationOnArraysInspection */ |
11056 | 11056 | return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
11057 | - $replacement . |
|
11058 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
11057 | + $replacement . |
|
11058 | + ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
11059 | 11059 | } |
11060 | 11060 | |
11061 | 11061 | // |
@@ -237,10 +237,10 @@ discard block |
||
237 | 237 | } |
238 | 238 | |
239 | 239 | if ($encoding === 'UTF-8') { |
240 | - return (string) \mb_substr($str, $pos, 1); |
|
240 | + return (string)\mb_substr($str, $pos, 1); |
|
241 | 241 | } |
242 | 242 | |
243 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
243 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | public static function add_bom_to_string(string $str): string |
256 | 256 | { |
257 | 257 | if (self::string_has_bom($str) === false) { |
258 | - $str = self::bom() . $str; |
|
258 | + $str = self::bom().$str; |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | return $str; |
@@ -288,8 +288,8 @@ discard block |
||
288 | 288 | $return = []; |
289 | 289 | foreach ($array as $key => &$value) { |
290 | 290 | $key = $case === \CASE_LOWER |
291 | - ? self::strtolower((string) $key, $encoding) |
|
292 | - : self::strtoupper((string) $key, $encoding); |
|
291 | + ? self::strtolower((string)$key, $encoding) |
|
292 | + : self::strtoupper((string)$key, $encoding); |
|
293 | 293 | |
294 | 294 | $return[$key] = $value; |
295 | 295 | } |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | return ''; |
324 | 324 | } |
325 | 325 | |
326 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
326 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
327 | 327 | $end_position = \mb_strpos($str, $end, $substr_index); |
328 | 328 | if ( |
329 | 329 | $end_position === false |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | return ''; |
334 | 334 | } |
335 | 335 | |
336 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
336 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | return ''; |
344 | 344 | } |
345 | 345 | |
346 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
346 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
347 | 347 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
348 | 348 | if ( |
349 | 349 | $end_position === false |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | return ''; |
354 | 354 | } |
355 | 355 | |
356 | - return (string) self::substr( |
|
356 | + return (string)self::substr( |
|
357 | 357 | $str, |
358 | 358 | $substr_index, |
359 | 359 | $end_position - $substr_index, |
@@ -421,10 +421,10 @@ discard block |
||
421 | 421 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
422 | 422 | { |
423 | 423 | if ($encoding === 'UTF-8') { |
424 | - return (string) \mb_substr($str, $index, 1); |
|
424 | + return (string)\mb_substr($str, $index, 1); |
|
425 | 425 | } |
426 | 426 | |
427 | - return (string) self::substr($str, $index, 1, $encoding); |
|
427 | + return (string)self::substr($str, $index, 1, $encoding); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | /** |
@@ -523,10 +523,10 @@ discard block |
||
523 | 523 | && |
524 | 524 | self::$SUPPORT['mbstring'] === false |
525 | 525 | ) { |
526 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
526 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
527 | 527 | } |
528 | 528 | |
529 | - $cache_key = $code_point . $encoding; |
|
529 | + $cache_key = $code_point.$encoding; |
|
530 | 530 | if (isset($CHAR_CACHE[$cache_key]) === true) { |
531 | 531 | return $CHAR_CACHE[$cache_key]; |
532 | 532 | } |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | self::$CHR = self::getData('chr'); |
573 | 573 | } |
574 | 574 | |
575 | - $code_point = (int) $code_point; |
|
575 | + $code_point = (int)$code_point; |
|
576 | 576 | if ($code_point <= 0x7F) { |
577 | 577 | /** |
578 | 578 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -582,22 +582,22 @@ discard block |
||
582 | 582 | /** |
583 | 583 | * @psalm-suppress PossiblyNullArrayAccess |
584 | 584 | */ |
585 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
585 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
586 | 586 | self::$CHR[($code_point & 0x3F) + 0x80]; |
587 | 587 | } elseif ($code_point <= 0xFFFF) { |
588 | 588 | /** |
589 | 589 | * @psalm-suppress PossiblyNullArrayAccess |
590 | 590 | */ |
591 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
592 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
591 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
592 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
593 | 593 | self::$CHR[($code_point & 0x3F) + 0x80]; |
594 | 594 | } else { |
595 | 595 | /** |
596 | 596 | * @psalm-suppress PossiblyNullArrayAccess |
597 | 597 | */ |
598 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
599 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
600 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
598 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
599 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
600 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
601 | 601 | self::$CHR[($code_point & 0x3F) + 0x80]; |
602 | 602 | } |
603 | 603 | |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | |
646 | 646 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
647 | 647 | return \array_map( |
648 | - static function (string $data): int { |
|
648 | + static function(string $data): int { |
|
649 | 649 | // "mb_" is available if overload is used, so use it ... |
650 | 650 | return \mb_strlen($data, 'CP850'); // 8-BIT |
651 | 651 | }, |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | $char = ''; |
722 | 722 | } |
723 | 723 | |
724 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
724 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | /** |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
803 | 803 | /x'; |
804 | 804 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
805 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
805 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
806 | 806 | |
807 | 807 | if ($replace_diamond_question_mark === true) { |
808 | 808 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -837,7 +837,7 @@ discard block |
||
837 | 837 | public static function cleanup($str): string |
838 | 838 | { |
839 | 839 | // init |
840 | - $str = (string) $str; |
|
840 | + $str = (string)$str; |
|
841 | 841 | |
842 | 842 | if ($str === '') { |
843 | 843 | return ''; |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | { |
928 | 928 | if (self::$SUPPORT['mbstring'] === true) { |
929 | 929 | /** @noinspection PhpComposerExtensionStubsInspection */ |
930 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
930 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
931 | 931 | } |
932 | 932 | |
933 | 933 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -967,7 +967,7 @@ discard block |
||
967 | 967 | */ |
968 | 968 | public static function css_stripe_media_queries(string $str): string |
969 | 969 | { |
970 | - return (string) \preg_replace( |
|
970 | + return (string)\preg_replace( |
|
971 | 971 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
972 | 972 | '', |
973 | 973 | $str |
@@ -994,7 +994,7 @@ discard block |
||
994 | 994 | */ |
995 | 995 | public static function decimal_to_chr($int): string |
996 | 996 | { |
997 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
997 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
998 | 998 | } |
999 | 999 | |
1000 | 1000 | /** |
@@ -1041,16 +1041,16 @@ discard block |
||
1041 | 1041 | self::initEmojiData(); |
1042 | 1042 | |
1043 | 1043 | if ($use_reversible_string_mappings === true) { |
1044 | - return (string) \str_replace( |
|
1045 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1046 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1044 | + return (string)\str_replace( |
|
1045 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1046 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1047 | 1047 | $str |
1048 | 1048 | ); |
1049 | 1049 | } |
1050 | 1050 | |
1051 | - return (string) \str_replace( |
|
1052 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1053 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1051 | + return (string)\str_replace( |
|
1052 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1053 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1054 | 1054 | $str |
1055 | 1055 | ); |
1056 | 1056 | } |
@@ -1072,16 +1072,16 @@ discard block |
||
1072 | 1072 | self::initEmojiData(); |
1073 | 1073 | |
1074 | 1074 | if ($use_reversible_string_mappings === true) { |
1075 | - return (string) \str_replace( |
|
1076 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1077 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1075 | + return (string)\str_replace( |
|
1076 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1077 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1078 | 1078 | $str |
1079 | 1079 | ); |
1080 | 1080 | } |
1081 | 1081 | |
1082 | - return (string) \str_replace( |
|
1083 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1084 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1082 | + return (string)\str_replace( |
|
1083 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1084 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1085 | 1085 | $str |
1086 | 1086 | ); |
1087 | 1087 | } |
@@ -1135,7 +1135,7 @@ discard block |
||
1135 | 1135 | if ($to_encoding === 'JSON') { |
1136 | 1136 | $return = self::json_encode($str); |
1137 | 1137 | if ($return === false) { |
1138 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1138 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1139 | 1139 | } |
1140 | 1140 | |
1141 | 1141 | return $return; |
@@ -1222,7 +1222,7 @@ discard block |
||
1222 | 1222 | && |
1223 | 1223 | self::$SUPPORT['mbstring'] === false |
1224 | 1224 | ) { |
1225 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
1225 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
1226 | 1226 | } |
1227 | 1227 | |
1228 | 1228 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1316,31 +1316,31 @@ discard block |
||
1316 | 1316 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1317 | 1317 | |
1318 | 1318 | if ($length === null) { |
1319 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
1319 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
1320 | 1320 | } |
1321 | 1321 | |
1322 | 1322 | if ($search === '') { |
1323 | 1323 | if ($encoding === 'UTF-8') { |
1324 | 1324 | if ($length > 0) { |
1325 | - $string_length = (int) \mb_strlen($str); |
|
1325 | + $string_length = (int)\mb_strlen($str); |
|
1326 | 1326 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1327 | 1327 | } else { |
1328 | 1328 | $end = 0; |
1329 | 1329 | } |
1330 | 1330 | |
1331 | - $pos = (int) \min( |
|
1331 | + $pos = (int)\min( |
|
1332 | 1332 | \mb_strpos($str, ' ', $end), |
1333 | 1333 | \mb_strpos($str, '.', $end) |
1334 | 1334 | ); |
1335 | 1335 | } else { |
1336 | 1336 | if ($length > 0) { |
1337 | - $string_length = (int) self::strlen($str, $encoding); |
|
1337 | + $string_length = (int)self::strlen($str, $encoding); |
|
1338 | 1338 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1339 | 1339 | } else { |
1340 | 1340 | $end = 0; |
1341 | 1341 | } |
1342 | 1342 | |
1343 | - $pos = (int) \min( |
|
1343 | + $pos = (int)\min( |
|
1344 | 1344 | self::strpos($str, ' ', $end, $encoding), |
1345 | 1345 | self::strpos($str, '.', $end, $encoding) |
1346 | 1346 | ); |
@@ -1357,18 +1357,18 @@ discard block |
||
1357 | 1357 | return ''; |
1358 | 1358 | } |
1359 | 1359 | |
1360 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1360 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1361 | 1361 | } |
1362 | 1362 | |
1363 | 1363 | return $str; |
1364 | 1364 | } |
1365 | 1365 | |
1366 | 1366 | if ($encoding === 'UTF-8') { |
1367 | - $word_position = (int) \mb_stripos($str, $search); |
|
1368 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1367 | + $word_position = (int)\mb_stripos($str, $search); |
|
1368 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1369 | 1369 | } else { |
1370 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
1371 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1370 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
1371 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1372 | 1372 | } |
1373 | 1373 | |
1374 | 1374 | $pos_start = 0; |
@@ -1380,12 +1380,12 @@ discard block |
||
1380 | 1380 | } |
1381 | 1381 | if ($half_text !== false) { |
1382 | 1382 | if ($encoding === 'UTF-8') { |
1383 | - $pos_start = (int) \max( |
|
1383 | + $pos_start = (int)\max( |
|
1384 | 1384 | \mb_strrpos($half_text, ' '), |
1385 | 1385 | \mb_strrpos($half_text, '.') |
1386 | 1386 | ); |
1387 | 1387 | } else { |
1388 | - $pos_start = (int) \max( |
|
1388 | + $pos_start = (int)\max( |
|
1389 | 1389 | self::strrpos($half_text, ' ', 0, $encoding), |
1390 | 1390 | self::strrpos($half_text, '.', 0, $encoding) |
1391 | 1391 | ); |
@@ -1395,19 +1395,19 @@ discard block |
||
1395 | 1395 | |
1396 | 1396 | if ($word_position && $half_side > 0) { |
1397 | 1397 | $offset = $pos_start + $length - 1; |
1398 | - $real_length = (int) self::strlen($str, $encoding); |
|
1398 | + $real_length = (int)self::strlen($str, $encoding); |
|
1399 | 1399 | |
1400 | 1400 | if ($offset > $real_length) { |
1401 | 1401 | $offset = $real_length; |
1402 | 1402 | } |
1403 | 1403 | |
1404 | 1404 | if ($encoding === 'UTF-8') { |
1405 | - $pos_end = (int) \min( |
|
1405 | + $pos_end = (int)\min( |
|
1406 | 1406 | \mb_strpos($str, ' ', $offset), |
1407 | 1407 | \mb_strpos($str, '.', $offset) |
1408 | 1408 | ) - $pos_start; |
1409 | 1409 | } else { |
1410 | - $pos_end = (int) \min( |
|
1410 | + $pos_end = (int)\min( |
|
1411 | 1411 | self::strpos($str, ' ', $offset, $encoding), |
1412 | 1412 | self::strpos($str, '.', $offset, $encoding) |
1413 | 1413 | ) - $pos_start; |
@@ -1415,12 +1415,12 @@ discard block |
||
1415 | 1415 | |
1416 | 1416 | if (!$pos_end || $pos_end <= 0) { |
1417 | 1417 | if ($encoding === 'UTF-8') { |
1418 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1418 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1419 | 1419 | } else { |
1420 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1420 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1421 | 1421 | } |
1422 | 1422 | if ($str_sub !== false) { |
1423 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
1423 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
1424 | 1424 | } else { |
1425 | 1425 | $extract = ''; |
1426 | 1426 | } |
@@ -1431,26 +1431,26 @@ discard block |
||
1431 | 1431 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
1432 | 1432 | } |
1433 | 1433 | if ($str_sub !== false) { |
1434 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1434 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1435 | 1435 | } else { |
1436 | 1436 | $extract = ''; |
1437 | 1437 | } |
1438 | 1438 | } |
1439 | 1439 | } else { |
1440 | 1440 | $offset = $length - 1; |
1441 | - $true_length = (int) self::strlen($str, $encoding); |
|
1441 | + $true_length = (int)self::strlen($str, $encoding); |
|
1442 | 1442 | |
1443 | 1443 | if ($offset > $true_length) { |
1444 | 1444 | $offset = $true_length; |
1445 | 1445 | } |
1446 | 1446 | |
1447 | 1447 | if ($encoding === 'UTF-8') { |
1448 | - $pos_end = (int) \min( |
|
1448 | + $pos_end = (int)\min( |
|
1449 | 1449 | \mb_strpos($str, ' ', $offset), |
1450 | 1450 | \mb_strpos($str, '.', $offset) |
1451 | 1451 | ); |
1452 | 1452 | } else { |
1453 | - $pos_end = (int) \min( |
|
1453 | + $pos_end = (int)\min( |
|
1454 | 1454 | self::strpos($str, ' ', $offset, $encoding), |
1455 | 1455 | self::strpos($str, '.', $offset, $encoding) |
1456 | 1456 | ); |
@@ -1463,7 +1463,7 @@ discard block |
||
1463 | 1463 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
1464 | 1464 | } |
1465 | 1465 | if ($str_sub !== false) { |
1466 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1466 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1467 | 1467 | } else { |
1468 | 1468 | $extract = ''; |
1469 | 1469 | } |
@@ -1586,7 +1586,7 @@ discard block |
||
1586 | 1586 | { |
1587 | 1587 | $file_content = \file_get_contents($file_path); |
1588 | 1588 | if ($file_content === false) { |
1589 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1589 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1590 | 1590 | } |
1591 | 1591 | |
1592 | 1592 | return self::string_has_bom($file_content); |
@@ -1652,7 +1652,7 @@ discard block |
||
1652 | 1652 | ) { |
1653 | 1653 | // Prevent leading combining chars |
1654 | 1654 | // for NFC-safe concatenations. |
1655 | - $var = $leading_combining . $var; |
|
1655 | + $var = $leading_combining.$var; |
|
1656 | 1656 | } |
1657 | 1657 | } |
1658 | 1658 | |
@@ -1903,10 +1903,10 @@ discard block |
||
1903 | 1903 | } |
1904 | 1904 | |
1905 | 1905 | if ($encoding === 'UTF-8') { |
1906 | - return (string) \mb_substr($str, 0, $n); |
|
1906 | + return (string)\mb_substr($str, 0, $n); |
|
1907 | 1907 | } |
1908 | 1908 | |
1909 | - return (string) self::substr($str, 0, $n, $encoding); |
|
1909 | + return (string)self::substr($str, 0, $n, $encoding); |
|
1910 | 1910 | } |
1911 | 1911 | |
1912 | 1912 | /** |
@@ -1919,7 +1919,7 @@ discard block |
||
1919 | 1919 | */ |
1920 | 1920 | public static function fits_inside(string $str, int $box_size): bool |
1921 | 1921 | { |
1922 | - return (int) self::strlen($str) <= $box_size; |
|
1922 | + return (int)self::strlen($str) <= $box_size; |
|
1923 | 1923 | } |
1924 | 1924 | |
1925 | 1925 | /** |
@@ -1981,7 +1981,7 @@ discard block |
||
1981 | 1981 | return $str; |
1982 | 1982 | } |
1983 | 1983 | |
1984 | - $str = (string) $str; |
|
1984 | + $str = (string)$str; |
|
1985 | 1985 | $last = ''; |
1986 | 1986 | while ($last !== $str) { |
1987 | 1987 | $last = $str; |
@@ -2181,7 +2181,7 @@ discard block |
||
2181 | 2181 | return $fallback; |
2182 | 2182 | } |
2183 | 2183 | /** @noinspection OffsetOperationsInspection */ |
2184 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2184 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2185 | 2185 | |
2186 | 2186 | // DEBUG |
2187 | 2187 | //var_dump($type_code); |
@@ -2239,7 +2239,7 @@ discard block |
||
2239 | 2239 | // |
2240 | 2240 | |
2241 | 2241 | if ($encoding === 'UTF-8') { |
2242 | - $max_length = (int) \mb_strlen($possible_chars); |
|
2242 | + $max_length = (int)\mb_strlen($possible_chars); |
|
2243 | 2243 | if ($max_length === 0) { |
2244 | 2244 | return ''; |
2245 | 2245 | } |
@@ -2260,7 +2260,7 @@ discard block |
||
2260 | 2260 | } else { |
2261 | 2261 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2262 | 2262 | |
2263 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
2263 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
2264 | 2264 | if ($max_length === 0) { |
2265 | 2265 | return ''; |
2266 | 2266 | } |
@@ -2291,16 +2291,16 @@ discard block |
||
2291 | 2291 | */ |
2292 | 2292 | public static function get_unique_string($entropy_extra = '', bool $use_md5 = true): string |
2293 | 2293 | { |
2294 | - $unique_helper = \random_int(0, \mt_getrandmax()) . |
|
2295 | - \session_id() . |
|
2296 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2297 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2294 | + $unique_helper = \random_int(0, \mt_getrandmax()). |
|
2295 | + \session_id(). |
|
2296 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2297 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2298 | 2298 | $entropy_extra; |
2299 | 2299 | |
2300 | 2300 | $unique_string = \uniqid($unique_helper, true); |
2301 | 2301 | |
2302 | 2302 | if ($use_md5) { |
2303 | - $unique_string = \md5($unique_string . $unique_helper); |
|
2303 | + $unique_string = \md5($unique_string.$unique_helper); |
|
2304 | 2304 | } |
2305 | 2305 | |
2306 | 2306 | return $unique_string; |
@@ -2398,7 +2398,7 @@ discard block |
||
2398 | 2398 | public static function hex_to_int($hexdec) |
2399 | 2399 | { |
2400 | 2400 | // init |
2401 | - $hexdec = (string) $hexdec; |
|
2401 | + $hexdec = (string)$hexdec; |
|
2402 | 2402 | |
2403 | 2403 | if ($hexdec === '') { |
2404 | 2404 | return false; |
@@ -2491,7 +2491,7 @@ discard block |
||
2491 | 2491 | return \implode( |
2492 | 2492 | '', |
2493 | 2493 | \array_map( |
2494 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2494 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2495 | 2495 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
2496 | 2496 | }, |
2497 | 2497 | self::str_split($str) |
@@ -2598,7 +2598,7 @@ discard block |
||
2598 | 2598 | && |
2599 | 2599 | self::$SUPPORT['mbstring'] === false |
2600 | 2600 | ) { |
2601 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2601 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2602 | 2602 | } |
2603 | 2603 | |
2604 | 2604 | do { |
@@ -2607,7 +2607,7 @@ discard block |
||
2607 | 2607 | if (\strpos($str, '&') !== false) { |
2608 | 2608 | if (\strpos($str, '&#') !== false) { |
2609 | 2609 | // decode also numeric & UTF16 two byte entities |
2610 | - $str = (string) \preg_replace( |
|
2610 | + $str = (string)\preg_replace( |
|
2611 | 2611 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
2612 | 2612 | '$1;', |
2613 | 2613 | $str |
@@ -2653,7 +2653,7 @@ discard block |
||
2653 | 2653 | */ |
2654 | 2654 | public static function html_stripe_empty_tags(string $str): string |
2655 | 2655 | { |
2656 | - return (string) \preg_replace( |
|
2656 | + return (string)\preg_replace( |
|
2657 | 2657 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
2658 | 2658 | '', |
2659 | 2659 | $str |
@@ -2963,9 +2963,9 @@ discard block |
||
2963 | 2963 | { |
2964 | 2964 | $hex = \dechex($int); |
2965 | 2965 | |
2966 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
2966 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
2967 | 2967 | |
2968 | - return $prefix . $hex . ''; |
|
2968 | + return $prefix.$hex.''; |
|
2969 | 2969 | } |
2970 | 2970 | |
2971 | 2971 | /** |
@@ -3225,7 +3225,7 @@ discard block |
||
3225 | 3225 | */ |
3226 | 3226 | public static function is_binary($input, bool $strict = false): bool |
3227 | 3227 | { |
3228 | - $input = (string) $input; |
|
3228 | + $input = (string)$input; |
|
3229 | 3229 | if ($input === '') { |
3230 | 3230 | return false; |
3231 | 3231 | } |
@@ -3492,7 +3492,7 @@ discard block |
||
3492 | 3492 | public static function is_utf16($str, $check_if_string_is_binary = true) |
3493 | 3493 | { |
3494 | 3494 | // init |
3495 | - $str = (string) $str; |
|
3495 | + $str = (string)$str; |
|
3496 | 3496 | $str_chars = []; |
3497 | 3497 | |
3498 | 3498 | if ( |
@@ -3573,7 +3573,7 @@ discard block |
||
3573 | 3573 | public static function is_utf32($str, $check_if_string_is_binary = true) |
3574 | 3574 | { |
3575 | 3575 | // init |
3576 | - $str = (string) $str; |
|
3576 | + $str = (string)$str; |
|
3577 | 3577 | $str_chars = []; |
3578 | 3578 | |
3579 | 3579 | if ( |
@@ -3660,7 +3660,7 @@ discard block |
||
3660 | 3660 | return true; |
3661 | 3661 | } |
3662 | 3662 | |
3663 | - return self::is_utf8_string((string) $str, $strict); |
|
3663 | + return self::is_utf8_string((string)$str, $strict); |
|
3664 | 3664 | } |
3665 | 3665 | |
3666 | 3666 | /** |
@@ -3800,15 +3800,15 @@ discard block |
||
3800 | 3800 | $use_mb_functions = ($lang === null && $try_to_keep_the_string_length === false); |
3801 | 3801 | |
3802 | 3802 | if ($encoding === 'UTF-8') { |
3803 | - $str_part_two = (string) \mb_substr($str, 1); |
|
3803 | + $str_part_two = (string)\mb_substr($str, 1); |
|
3804 | 3804 | |
3805 | 3805 | if ($use_mb_functions === true) { |
3806 | 3806 | $str_part_one = \mb_strtolower( |
3807 | - (string) \mb_substr($str, 0, 1) |
|
3807 | + (string)\mb_substr($str, 0, 1) |
|
3808 | 3808 | ); |
3809 | 3809 | } else { |
3810 | 3810 | $str_part_one = self::strtolower( |
3811 | - (string) \mb_substr($str, 0, 1), |
|
3811 | + (string)\mb_substr($str, 0, 1), |
|
3812 | 3812 | $encoding, |
3813 | 3813 | false, |
3814 | 3814 | $lang, |
@@ -3818,10 +3818,10 @@ discard block |
||
3818 | 3818 | } else { |
3819 | 3819 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
3820 | 3820 | |
3821 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
3821 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
3822 | 3822 | |
3823 | 3823 | $str_part_one = self::strtolower( |
3824 | - (string) self::substr($str, 0, 1, $encoding), |
|
3824 | + (string)self::substr($str, 0, 1, $encoding), |
|
3825 | 3825 | $encoding, |
3826 | 3826 | false, |
3827 | 3827 | $lang, |
@@ -3829,7 +3829,7 @@ discard block |
||
3829 | 3829 | ); |
3830 | 3830 | } |
3831 | 3831 | |
3832 | - return $str_part_one . $str_part_two; |
|
3832 | + return $str_part_one.$str_part_two; |
|
3833 | 3833 | } |
3834 | 3834 | |
3835 | 3835 | /** |
@@ -3966,7 +3966,7 @@ discard block |
||
3966 | 3966 | } |
3967 | 3967 | |
3968 | 3968 | /** @noinspection PhpComposerExtensionStubsInspection */ |
3969 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
3969 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
3970 | 3970 | } |
3971 | 3971 | |
3972 | 3972 | if ($chars) { |
@@ -4015,7 +4015,7 @@ discard block |
||
4015 | 4015 | { |
4016 | 4016 | $bytes = self::chr_size_list($str); |
4017 | 4017 | if ($bytes !== []) { |
4018 | - return (int) \max($bytes); |
|
4018 | + return (int)\max($bytes); |
|
4019 | 4019 | } |
4020 | 4020 | |
4021 | 4021 | return 0; |
@@ -4084,7 +4084,7 @@ discard block |
||
4084 | 4084 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4085 | 4085 | |
4086 | 4086 | // init |
4087 | - $encoding = (string) $encoding; |
|
4087 | + $encoding = (string)$encoding; |
|
4088 | 4088 | |
4089 | 4089 | if (!$encoding) { |
4090 | 4090 | return $fallback; |
@@ -4146,7 +4146,7 @@ discard block |
||
4146 | 4146 | |
4147 | 4147 | $encoding_original = $encoding; |
4148 | 4148 | $encoding = \strtoupper($encoding); |
4149 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4149 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4150 | 4150 | |
4151 | 4151 | $equivalences = [ |
4152 | 4152 | 'ISO8859' => 'ISO-8859-1', |
@@ -4290,13 +4290,13 @@ discard block |
||
4290 | 4290 | static $CHAR_CACHE = []; |
4291 | 4291 | |
4292 | 4292 | // init |
4293 | - $chr = (string) $chr; |
|
4293 | + $chr = (string)$chr; |
|
4294 | 4294 | |
4295 | 4295 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4296 | 4296 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4297 | 4297 | } |
4298 | 4298 | |
4299 | - $cache_key = $chr . $encoding; |
|
4299 | + $cache_key = $chr.$encoding; |
|
4300 | 4300 | if (isset($CHAR_CACHE[$cache_key]) === true) { |
4301 | 4301 | return $CHAR_CACHE[$cache_key]; |
4302 | 4302 | } |
@@ -4331,7 +4331,7 @@ discard block |
||
4331 | 4331 | // |
4332 | 4332 | |
4333 | 4333 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
4334 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
4334 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
4335 | 4335 | /** @noinspection OffsetOperationsInspection */ |
4336 | 4336 | $code = $chr ? $chr[1] : 0; |
4337 | 4337 | |
@@ -4339,21 +4339,21 @@ discard block |
||
4339 | 4339 | if ($code >= 0xF0 && isset($chr[4])) { |
4340 | 4340 | /** @noinspection UnnecessaryCastingInspection */ |
4341 | 4341 | /** @noinspection OffsetOperationsInspection */ |
4342 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4342 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4343 | 4343 | } |
4344 | 4344 | |
4345 | 4345 | /** @noinspection OffsetOperationsInspection */ |
4346 | 4346 | if ($code >= 0xE0 && isset($chr[3])) { |
4347 | 4347 | /** @noinspection UnnecessaryCastingInspection */ |
4348 | 4348 | /** @noinspection OffsetOperationsInspection */ |
4349 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4349 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4350 | 4350 | } |
4351 | 4351 | |
4352 | 4352 | /** @noinspection OffsetOperationsInspection */ |
4353 | 4353 | if ($code >= 0xC0 && isset($chr[2])) { |
4354 | 4354 | /** @noinspection UnnecessaryCastingInspection */ |
4355 | 4355 | /** @noinspection OffsetOperationsInspection */ |
4356 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4356 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4357 | 4357 | } |
4358 | 4358 | |
4359 | 4359 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -4404,7 +4404,7 @@ discard block |
||
4404 | 4404 | public static function pcre_utf8_support(): bool |
4405 | 4405 | { |
4406 | 4406 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4407 | - return (bool) @\preg_match('//u', ''); |
|
4407 | + return (bool)@\preg_match('//u', ''); |
|
4408 | 4408 | } |
4409 | 4409 | |
4410 | 4410 | /** |
@@ -4439,14 +4439,14 @@ discard block |
||
4439 | 4439 | * @psalm-suppress RedundantConditionGivenDocblockType |
4440 | 4440 | */ |
4441 | 4441 | if (!\is_numeric($step)) { |
4442 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
4442 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
4443 | 4443 | } |
4444 | 4444 | |
4445 | 4445 | /** |
4446 | 4446 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
4447 | 4447 | */ |
4448 | 4448 | if ($step <= 0) { |
4449 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
4449 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
4450 | 4450 | } |
4451 | 4451 | } |
4452 | 4452 | |
@@ -4458,14 +4458,14 @@ discard block |
||
4458 | 4458 | $is_xdigit = false; |
4459 | 4459 | |
4460 | 4460 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4461 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
4461 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
4462 | 4462 | $is_digit = true; |
4463 | - $start = (int) $var1; |
|
4463 | + $start = (int)$var1; |
|
4464 | 4464 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
4465 | 4465 | $is_xdigit = true; |
4466 | - $start = (int) self::hex_to_int($var1); |
|
4466 | + $start = (int)self::hex_to_int($var1); |
|
4467 | 4467 | } elseif (!$use_ctype && \is_numeric($var1)) { |
4468 | - $start = (int) $var1; |
|
4468 | + $start = (int)$var1; |
|
4469 | 4469 | } else { |
4470 | 4470 | $start = self::ord($var1); |
4471 | 4471 | } |
@@ -4475,11 +4475,11 @@ discard block |
||
4475 | 4475 | } |
4476 | 4476 | |
4477 | 4477 | if ($is_digit) { |
4478 | - $end = (int) $var2; |
|
4478 | + $end = (int)$var2; |
|
4479 | 4479 | } elseif ($is_xdigit) { |
4480 | - $end = (int) self::hex_to_int($var2); |
|
4480 | + $end = (int)self::hex_to_int($var2); |
|
4481 | 4481 | } elseif (!$use_ctype && \is_numeric($var2)) { |
4482 | - $end = (int) $var2; |
|
4482 | + $end = (int)$var2; |
|
4483 | 4483 | } else { |
4484 | 4484 | $end = self::ord($var2); |
4485 | 4485 | } |
@@ -4490,7 +4490,7 @@ discard block |
||
4490 | 4490 | |
4491 | 4491 | $array = []; |
4492 | 4492 | foreach (\range($start, $end, $step) as $i) { |
4493 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
4493 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
4494 | 4494 | } |
4495 | 4495 | |
4496 | 4496 | return $array; |
@@ -4596,8 +4596,8 @@ discard block |
||
4596 | 4596 | $delimiter = '/'; |
4597 | 4597 | } |
4598 | 4598 | |
4599 | - return (string) \preg_replace( |
|
4600 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4599 | + return (string)\preg_replace( |
|
4600 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4601 | 4601 | $replacement, |
4602 | 4602 | $str |
4603 | 4603 | ); |
@@ -4641,9 +4641,9 @@ discard block |
||
4641 | 4641 | return ''; |
4642 | 4642 | } |
4643 | 4643 | |
4644 | - $str_length -= (int) $bom_byte_length; |
|
4644 | + $str_length -= (int)$bom_byte_length; |
|
4645 | 4645 | |
4646 | - $str = (string) $str_tmp; |
|
4646 | + $str = (string)$str_tmp; |
|
4647 | 4647 | } |
4648 | 4648 | } |
4649 | 4649 | |
@@ -4670,7 +4670,7 @@ discard block |
||
4670 | 4670 | */ |
4671 | 4671 | if (\is_array($what) === true) { |
4672 | 4672 | foreach ($what as $item) { |
4673 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
4673 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
4674 | 4674 | } |
4675 | 4675 | } |
4676 | 4676 | |
@@ -4704,7 +4704,7 @@ discard block |
||
4704 | 4704 | */ |
4705 | 4705 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
4706 | 4706 | { |
4707 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4707 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4708 | 4708 | } |
4709 | 4709 | |
4710 | 4710 | /** |
@@ -4755,17 +4755,17 @@ discard block |
||
4755 | 4755 | ): string { |
4756 | 4756 | if ($substring && \strpos($str, $substring) === 0) { |
4757 | 4757 | if ($encoding === 'UTF-8') { |
4758 | - return (string) \mb_substr( |
|
4758 | + return (string)\mb_substr( |
|
4759 | 4759 | $str, |
4760 | - (int) \mb_strlen($substring) |
|
4760 | + (int)\mb_strlen($substring) |
|
4761 | 4761 | ); |
4762 | 4762 | } |
4763 | 4763 | |
4764 | 4764 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4765 | 4765 | |
4766 | - return (string) self::substr( |
|
4766 | + return (string)self::substr( |
|
4767 | 4767 | $str, |
4768 | - (int) self::strlen($substring, $encoding), |
|
4768 | + (int)self::strlen($substring, $encoding), |
|
4769 | 4769 | null, |
4770 | 4770 | $encoding |
4771 | 4771 | ); |
@@ -4791,19 +4791,19 @@ discard block |
||
4791 | 4791 | ): string { |
4792 | 4792 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
4793 | 4793 | if ($encoding === 'UTF-8') { |
4794 | - return (string) \mb_substr( |
|
4794 | + return (string)\mb_substr( |
|
4795 | 4795 | $str, |
4796 | 4796 | 0, |
4797 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
4797 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
4798 | 4798 | ); |
4799 | 4799 | } |
4800 | 4800 | |
4801 | 4801 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4802 | 4802 | |
4803 | - return (string) self::substr( |
|
4803 | + return (string)self::substr( |
|
4804 | 4804 | $str, |
4805 | 4805 | 0, |
4806 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
4806 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
4807 | 4807 | $encoding |
4808 | 4808 | ); |
4809 | 4809 | } |
@@ -4893,7 +4893,7 @@ discard block |
||
4893 | 4893 | $save = \mb_substitute_character(); |
4894 | 4894 | \mb_substitute_character($replacement_char_helper); |
4895 | 4895 | // the polyfill maybe return false, so cast to string |
4896 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4896 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4897 | 4897 | \mb_substitute_character($save); |
4898 | 4898 | } |
4899 | 4899 | |
@@ -4935,7 +4935,7 @@ discard block |
||
4935 | 4935 | } |
4936 | 4936 | |
4937 | 4937 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4938 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4938 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4939 | 4939 | } |
4940 | 4940 | |
4941 | 4941 | if ($chars) { |
@@ -4957,7 +4957,7 @@ discard block |
||
4957 | 4957 | { |
4958 | 4958 | echo '<pre>'; |
4959 | 4959 | foreach (self::$SUPPORT as $key => &$value) { |
4960 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
4960 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
4961 | 4961 | } |
4962 | 4962 | unset($value); |
4963 | 4963 | echo '</pre>'; |
@@ -4990,7 +4990,7 @@ discard block |
||
4990 | 4990 | return $char; |
4991 | 4991 | } |
4992 | 4992 | |
4993 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
4993 | + return '&#'.self::ord($char, $encoding).';'; |
|
4994 | 4994 | } |
4995 | 4995 | |
4996 | 4996 | /** |
@@ -5083,18 +5083,18 @@ discard block |
||
5083 | 5083 | $lang, |
5084 | 5084 | $try_to_keep_the_string_length |
5085 | 5085 | ); |
5086 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5086 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5087 | 5087 | |
5088 | 5088 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
5089 | 5089 | |
5090 | - $str = (string) \preg_replace_callback( |
|
5090 | + $str = (string)\preg_replace_callback( |
|
5091 | 5091 | '/[-_\\s]+(.)?/u', |
5092 | 5092 | /** |
5093 | 5093 | * @param array $match |
5094 | 5094 | * |
5095 | 5095 | * @return string |
5096 | 5096 | */ |
5097 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5097 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5098 | 5098 | if (isset($match[1])) { |
5099 | 5099 | if ($use_mb_functions === true) { |
5100 | 5100 | if ($encoding === 'UTF-8') { |
@@ -5112,14 +5112,14 @@ discard block |
||
5112 | 5112 | $str |
5113 | 5113 | ); |
5114 | 5114 | |
5115 | - return (string) \preg_replace_callback( |
|
5115 | + return (string)\preg_replace_callback( |
|
5116 | 5116 | '/[\\p{N}]+(.)?/u', |
5117 | 5117 | /** |
5118 | 5118 | * @param array $match |
5119 | 5119 | * |
5120 | 5120 | * @return string |
5121 | 5121 | */ |
5122 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5122 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5123 | 5123 | if ($use_mb_functions === true) { |
5124 | 5124 | if ($encoding === 'UTF-8') { |
5125 | 5125 | return \mb_strtoupper($match[0]); |
@@ -5299,7 +5299,7 @@ discard block |
||
5299 | 5299 | ): string { |
5300 | 5300 | if (self::$SUPPORT['mbstring'] === true) { |
5301 | 5301 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5302 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5302 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5303 | 5303 | |
5304 | 5304 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
5305 | 5305 | if ($use_mb_functions === true && $encoding === 'UTF-8') { |
@@ -5309,10 +5309,10 @@ discard block |
||
5309 | 5309 | } |
5310 | 5310 | |
5311 | 5311 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5312 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5312 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5313 | 5313 | } |
5314 | 5314 | |
5315 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5315 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5316 | 5316 | |
5317 | 5317 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
5318 | 5318 | if ($use_mb_functions === true && $encoding === 'UTF-8') { |
@@ -5321,7 +5321,7 @@ discard block |
||
5321 | 5321 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
5322 | 5322 | } |
5323 | 5323 | |
5324 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5324 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5325 | 5325 | } |
5326 | 5326 | |
5327 | 5327 | /** |
@@ -5336,7 +5336,7 @@ discard block |
||
5336 | 5336 | public static function str_detect_encoding($str) |
5337 | 5337 | { |
5338 | 5338 | // init |
5339 | - $str = (string) $str; |
|
5339 | + $str = (string)$str; |
|
5340 | 5340 | |
5341 | 5341 | // |
5342 | 5342 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5438,7 +5438,7 @@ discard block |
||
5438 | 5438 | foreach (self::$ENCODINGS as $encoding_tmp) { |
5439 | 5439 | // INFO: //IGNORE but still throw notice |
5440 | 5440 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5441 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
5441 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
5442 | 5442 | return $encoding_tmp; |
5443 | 5443 | } |
5444 | 5444 | } |
@@ -5527,7 +5527,7 @@ discard block |
||
5527 | 5527 | return $str; |
5528 | 5528 | } |
5529 | 5529 | |
5530 | - return $substring . $str; |
|
5530 | + return $substring.$str; |
|
5531 | 5531 | } |
5532 | 5532 | |
5533 | 5533 | /** |
@@ -5796,27 +5796,27 @@ discard block |
||
5796 | 5796 | string $encoding = 'UTF-8' |
5797 | 5797 | ): string { |
5798 | 5798 | if ($encoding === 'UTF-8') { |
5799 | - $len = (int) \mb_strlen($str); |
|
5799 | + $len = (int)\mb_strlen($str); |
|
5800 | 5800 | if ($index > $len) { |
5801 | 5801 | return $str; |
5802 | 5802 | } |
5803 | 5803 | |
5804 | 5804 | /** @noinspection UnnecessaryCastingInspection */ |
5805 | - return (string) \mb_substr($str, 0, $index) . |
|
5806 | - $substring . |
|
5807 | - (string) \mb_substr($str, $index, $len); |
|
5805 | + return (string)\mb_substr($str, 0, $index). |
|
5806 | + $substring. |
|
5807 | + (string)\mb_substr($str, $index, $len); |
|
5808 | 5808 | } |
5809 | 5809 | |
5810 | 5810 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5811 | 5811 | |
5812 | - $len = (int) self::strlen($str, $encoding); |
|
5812 | + $len = (int)self::strlen($str, $encoding); |
|
5813 | 5813 | if ($index > $len) { |
5814 | 5814 | return $str; |
5815 | 5815 | } |
5816 | 5816 | |
5817 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
5818 | - $substring . |
|
5819 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5817 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
5818 | + $substring. |
|
5819 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
5820 | 5820 | } |
5821 | 5821 | |
5822 | 5822 | /** |
@@ -5846,15 +5846,15 @@ discard block |
||
5846 | 5846 | */ |
5847 | 5847 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5848 | 5848 | { |
5849 | - $search = (array) $search; |
|
5849 | + $search = (array)$search; |
|
5850 | 5850 | |
5851 | 5851 | /** @noinspection AlterInForeachInspection */ |
5852 | 5852 | foreach ($search as &$s) { |
5853 | - $s = (string) $s; |
|
5853 | + $s = (string)$s; |
|
5854 | 5854 | if ($s === '') { |
5855 | 5855 | $s = '/^(?<=.)$/'; |
5856 | 5856 | } else { |
5857 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5857 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5858 | 5858 | } |
5859 | 5859 | } |
5860 | 5860 | |
@@ -5886,11 +5886,11 @@ discard block |
||
5886 | 5886 | } |
5887 | 5887 | |
5888 | 5888 | if ($search === '') { |
5889 | - return $str . $replacement; |
|
5889 | + return $str.$replacement; |
|
5890 | 5890 | } |
5891 | 5891 | |
5892 | 5892 | if (\stripos($str, $search) === 0) { |
5893 | - return $replacement . \substr($str, \strlen($search)); |
|
5893 | + return $replacement.\substr($str, \strlen($search)); |
|
5894 | 5894 | } |
5895 | 5895 | |
5896 | 5896 | return $str; |
@@ -5919,11 +5919,11 @@ discard block |
||
5919 | 5919 | } |
5920 | 5920 | |
5921 | 5921 | if ($search === '') { |
5922 | - return $str . $replacement; |
|
5922 | + return $str.$replacement; |
|
5923 | 5923 | } |
5924 | 5924 | |
5925 | 5925 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
5926 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
5926 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
5927 | 5927 | } |
5928 | 5928 | |
5929 | 5929 | return $str; |
@@ -6003,15 +6003,15 @@ discard block |
||
6003 | 6003 | } |
6004 | 6004 | |
6005 | 6005 | if ($encoding === 'UTF-8') { |
6006 | - return (string) \mb_substr( |
|
6006 | + return (string)\mb_substr( |
|
6007 | 6007 | $str, |
6008 | - $offset + (int) \mb_strlen($separator) |
|
6008 | + $offset + (int)\mb_strlen($separator) |
|
6009 | 6009 | ); |
6010 | 6010 | } |
6011 | 6011 | |
6012 | - return (string) self::substr( |
|
6012 | + return (string)self::substr( |
|
6013 | 6013 | $str, |
6014 | - $offset + (int) self::strlen($separator, $encoding), |
|
6014 | + $offset + (int)self::strlen($separator, $encoding), |
|
6015 | 6015 | null, |
6016 | 6016 | $encoding |
6017 | 6017 | ); |
@@ -6041,15 +6041,15 @@ discard block |
||
6041 | 6041 | } |
6042 | 6042 | |
6043 | 6043 | if ($encoding === 'UTF-8') { |
6044 | - return (string) \mb_substr( |
|
6044 | + return (string)\mb_substr( |
|
6045 | 6045 | $str, |
6046 | - $offset + (int) self::strlen($separator) |
|
6046 | + $offset + (int)self::strlen($separator) |
|
6047 | 6047 | ); |
6048 | 6048 | } |
6049 | 6049 | |
6050 | - return (string) self::substr( |
|
6050 | + return (string)self::substr( |
|
6051 | 6051 | $str, |
6052 | - $offset + (int) self::strlen($separator, $encoding), |
|
6052 | + $offset + (int)self::strlen($separator, $encoding), |
|
6053 | 6053 | null, |
6054 | 6054 | $encoding |
6055 | 6055 | ); |
@@ -6079,10 +6079,10 @@ discard block |
||
6079 | 6079 | } |
6080 | 6080 | |
6081 | 6081 | if ($encoding === 'UTF-8') { |
6082 | - return (string) \mb_substr($str, 0, $offset); |
|
6082 | + return (string)\mb_substr($str, 0, $offset); |
|
6083 | 6083 | } |
6084 | 6084 | |
6085 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6085 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6086 | 6086 | } |
6087 | 6087 | |
6088 | 6088 | /** |
@@ -6109,7 +6109,7 @@ discard block |
||
6109 | 6109 | return ''; |
6110 | 6110 | } |
6111 | 6111 | |
6112 | - return (string) \mb_substr($str, 0, $offset); |
|
6112 | + return (string)\mb_substr($str, 0, $offset); |
|
6113 | 6113 | } |
6114 | 6114 | |
6115 | 6115 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6117,7 +6117,7 @@ discard block |
||
6117 | 6117 | return ''; |
6118 | 6118 | } |
6119 | 6119 | |
6120 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6120 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6121 | 6121 | } |
6122 | 6122 | |
6123 | 6123 | /** |
@@ -6213,12 +6213,12 @@ discard block |
||
6213 | 6213 | } |
6214 | 6214 | |
6215 | 6215 | if ($encoding === 'UTF-8') { |
6216 | - return (string) \mb_substr($str, -$n); |
|
6216 | + return (string)\mb_substr($str, -$n); |
|
6217 | 6217 | } |
6218 | 6218 | |
6219 | 6219 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6220 | 6220 | |
6221 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6221 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6222 | 6222 | } |
6223 | 6223 | |
6224 | 6224 | /** |
@@ -6242,21 +6242,21 @@ discard block |
||
6242 | 6242 | } |
6243 | 6243 | |
6244 | 6244 | if ($encoding === 'UTF-8') { |
6245 | - if ((int) \mb_strlen($str) <= $length) { |
|
6245 | + if ((int)\mb_strlen($str) <= $length) { |
|
6246 | 6246 | return $str; |
6247 | 6247 | } |
6248 | 6248 | |
6249 | 6249 | /** @noinspection UnnecessaryCastingInspection */ |
6250 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
6250 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
6251 | 6251 | } |
6252 | 6252 | |
6253 | 6253 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6254 | 6254 | |
6255 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6255 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6256 | 6256 | return $str; |
6257 | 6257 | } |
6258 | 6258 | |
6259 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
6259 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
6260 | 6260 | } |
6261 | 6261 | |
6262 | 6262 | /** |
@@ -6281,12 +6281,12 @@ discard block |
||
6281 | 6281 | |
6282 | 6282 | if ($encoding === 'UTF-8') { |
6283 | 6283 | /** @noinspection UnnecessaryCastingInspection */ |
6284 | - if ((int) \mb_strlen($str) <= $length) { |
|
6284 | + if ((int)\mb_strlen($str) <= $length) { |
|
6285 | 6285 | return $str; |
6286 | 6286 | } |
6287 | 6287 | |
6288 | 6288 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6289 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6289 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6290 | 6290 | } |
6291 | 6291 | |
6292 | 6292 | $str = \mb_substr($str, 0, $length); |
@@ -6296,22 +6296,22 @@ discard block |
||
6296 | 6296 | $new_str = \implode(' ', $array); |
6297 | 6297 | |
6298 | 6298 | if ($new_str === '') { |
6299 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6299 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6300 | 6300 | } |
6301 | 6301 | } else { |
6302 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6302 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6303 | 6303 | return $str; |
6304 | 6304 | } |
6305 | 6305 | |
6306 | 6306 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6307 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6307 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6308 | 6308 | } |
6309 | 6309 | |
6310 | 6310 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6311 | 6311 | $str = self::substr($str, 0, $length, $encoding); |
6312 | 6312 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6313 | 6313 | if ($str === false) { |
6314 | - return '' . $str_add_on; |
|
6314 | + return ''.$str_add_on; |
|
6315 | 6315 | } |
6316 | 6316 | |
6317 | 6317 | $array = \explode(' ', $str); |
@@ -6319,11 +6319,11 @@ discard block |
||
6319 | 6319 | $new_str = \implode(' ', $array); |
6320 | 6320 | |
6321 | 6321 | if ($new_str === '') { |
6322 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6322 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6323 | 6323 | } |
6324 | 6324 | } |
6325 | 6325 | |
6326 | - return $new_str . $str_add_on; |
|
6326 | + return $new_str.$str_add_on; |
|
6327 | 6327 | } |
6328 | 6328 | |
6329 | 6329 | /** |
@@ -6344,7 +6344,7 @@ discard block |
||
6344 | 6344 | $longest_common_prefix = ''; |
6345 | 6345 | |
6346 | 6346 | if ($encoding === 'UTF-8') { |
6347 | - $max_length = (int) \min( |
|
6347 | + $max_length = (int)\min( |
|
6348 | 6348 | \mb_strlen($str1), |
6349 | 6349 | \mb_strlen($str2) |
6350 | 6350 | ); |
@@ -6365,7 +6365,7 @@ discard block |
||
6365 | 6365 | } else { |
6366 | 6366 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6367 | 6367 | |
6368 | - $max_length = (int) \min( |
|
6368 | + $max_length = (int)\min( |
|
6369 | 6369 | self::strlen($str1, $encoding), |
6370 | 6370 | self::strlen($str2, $encoding) |
6371 | 6371 | ); |
@@ -6412,13 +6412,13 @@ discard block |
||
6412 | 6412 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6413 | 6413 | |
6414 | 6414 | if ($encoding === 'UTF-8') { |
6415 | - $str_length = (int) \mb_strlen($str1); |
|
6416 | - $other_length = (int) \mb_strlen($str2); |
|
6415 | + $str_length = (int)\mb_strlen($str1); |
|
6416 | + $other_length = (int)\mb_strlen($str2); |
|
6417 | 6417 | } else { |
6418 | 6418 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6419 | 6419 | |
6420 | - $str_length = (int) self::strlen($str1, $encoding); |
|
6421 | - $other_length = (int) self::strlen($str2, $encoding); |
|
6420 | + $str_length = (int)self::strlen($str1, $encoding); |
|
6421 | + $other_length = (int)self::strlen($str2, $encoding); |
|
6422 | 6422 | } |
6423 | 6423 | |
6424 | 6424 | // Return if either string is empty |
@@ -6471,10 +6471,10 @@ discard block |
||
6471 | 6471 | } |
6472 | 6472 | |
6473 | 6473 | if ($encoding === 'UTF-8') { |
6474 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
6474 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
6475 | 6475 | } |
6476 | 6476 | |
6477 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
6477 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
6478 | 6478 | } |
6479 | 6479 | |
6480 | 6480 | /** |
@@ -6496,7 +6496,7 @@ discard block |
||
6496 | 6496 | } |
6497 | 6497 | |
6498 | 6498 | if ($encoding === 'UTF-8') { |
6499 | - $max_length = (int) \min( |
|
6499 | + $max_length = (int)\min( |
|
6500 | 6500 | \mb_strlen($str1, $encoding), |
6501 | 6501 | \mb_strlen($str2, $encoding) |
6502 | 6502 | ); |
@@ -6510,7 +6510,7 @@ discard block |
||
6510 | 6510 | && |
6511 | 6511 | $char === \mb_substr($str2, -$i, 1) |
6512 | 6512 | ) { |
6513 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
6513 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
6514 | 6514 | } else { |
6515 | 6515 | break; |
6516 | 6516 | } |
@@ -6518,7 +6518,7 @@ discard block |
||
6518 | 6518 | } else { |
6519 | 6519 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6520 | 6520 | |
6521 | - $max_length = (int) \min( |
|
6521 | + $max_length = (int)\min( |
|
6522 | 6522 | self::strlen($str1, $encoding), |
6523 | 6523 | self::strlen($str2, $encoding) |
6524 | 6524 | ); |
@@ -6532,7 +6532,7 @@ discard block |
||
6532 | 6532 | && |
6533 | 6533 | $char === self::substr($str2, -$i, 1, $encoding) |
6534 | 6534 | ) { |
6535 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
6535 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
6536 | 6536 | } else { |
6537 | 6537 | break; |
6538 | 6538 | } |
@@ -6552,7 +6552,7 @@ discard block |
||
6552 | 6552 | */ |
6553 | 6553 | public static function str_matches_pattern(string $str, string $pattern): bool |
6554 | 6554 | { |
6555 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6555 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6556 | 6556 | } |
6557 | 6557 | |
6558 | 6558 | /** |
@@ -6569,7 +6569,7 @@ discard block |
||
6569 | 6569 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6570 | 6570 | { |
6571 | 6571 | // init |
6572 | - $length = (int) self::strlen($str, $encoding); |
|
6572 | + $length = (int)self::strlen($str, $encoding); |
|
6573 | 6573 | |
6574 | 6574 | if ($offset >= 0) { |
6575 | 6575 | return $length > $offset; |
@@ -6596,7 +6596,7 @@ discard block |
||
6596 | 6596 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6597 | 6597 | { |
6598 | 6598 | // init |
6599 | - $length = (int) self::strlen($str); |
|
6599 | + $length = (int)self::strlen($str); |
|
6600 | 6600 | |
6601 | 6601 | if ( |
6602 | 6602 | ($index >= 0 && $length <= $index) |
@@ -6636,7 +6636,7 @@ discard block |
||
6636 | 6636 | return $str; |
6637 | 6637 | } |
6638 | 6638 | |
6639 | - if ($pad_type !== (int) $pad_type) { |
|
6639 | + if ($pad_type !== (int)$pad_type) { |
|
6640 | 6640 | if ($pad_type === 'left') { |
6641 | 6641 | $pad_type = \STR_PAD_LEFT; |
6642 | 6642 | } elseif ($pad_type === 'right') { |
@@ -6645,23 +6645,23 @@ discard block |
||
6645 | 6645 | $pad_type = \STR_PAD_BOTH; |
6646 | 6646 | } else { |
6647 | 6647 | throw new \InvalidArgumentException( |
6648 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6648 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6649 | 6649 | ); |
6650 | 6650 | } |
6651 | 6651 | } |
6652 | 6652 | |
6653 | 6653 | if ($encoding === 'UTF-8') { |
6654 | - $str_length = (int) \mb_strlen($str); |
|
6654 | + $str_length = (int)\mb_strlen($str); |
|
6655 | 6655 | |
6656 | 6656 | if ($pad_length >= $str_length) { |
6657 | 6657 | switch ($pad_type) { |
6658 | 6658 | case \STR_PAD_LEFT: |
6659 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6659 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6660 | 6660 | |
6661 | 6661 | $diff = ($pad_length - $str_length); |
6662 | 6662 | |
6663 | - $pre = (string) \mb_substr( |
|
6664 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6663 | + $pre = (string)\mb_substr( |
|
6664 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6665 | 6665 | 0, |
6666 | 6666 | $diff |
6667 | 6667 | ); |
@@ -6672,16 +6672,16 @@ discard block |
||
6672 | 6672 | case \STR_PAD_BOTH: |
6673 | 6673 | $diff = ($pad_length - $str_length); |
6674 | 6674 | |
6675 | - $ps_length_left = (int) \floor($diff / 2); |
|
6675 | + $ps_length_left = (int)\floor($diff / 2); |
|
6676 | 6676 | |
6677 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6677 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6678 | 6678 | |
6679 | - $pre = (string) \mb_substr( |
|
6679 | + $pre = (string)\mb_substr( |
|
6680 | 6680 | \str_repeat($pad_string, $ps_length_left), |
6681 | 6681 | 0, |
6682 | 6682 | $ps_length_left |
6683 | 6683 | ); |
6684 | - $post = (string) \mb_substr( |
|
6684 | + $post = (string)\mb_substr( |
|
6685 | 6685 | \str_repeat($pad_string, $ps_length_right), |
6686 | 6686 | 0, |
6687 | 6687 | $ps_length_right |
@@ -6691,19 +6691,19 @@ discard block |
||
6691 | 6691 | |
6692 | 6692 | case \STR_PAD_RIGHT: |
6693 | 6693 | default: |
6694 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6694 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6695 | 6695 | |
6696 | 6696 | $diff = ($pad_length - $str_length); |
6697 | 6697 | |
6698 | - $post = (string) \mb_substr( |
|
6699 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6698 | + $post = (string)\mb_substr( |
|
6699 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6700 | 6700 | 0, |
6701 | 6701 | $diff |
6702 | 6702 | ); |
6703 | 6703 | $pre = ''; |
6704 | 6704 | } |
6705 | 6705 | |
6706 | - return $pre . $str . $post; |
|
6706 | + return $pre.$str.$post; |
|
6707 | 6707 | } |
6708 | 6708 | |
6709 | 6709 | return $str; |
@@ -6711,17 +6711,17 @@ discard block |
||
6711 | 6711 | |
6712 | 6712 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6713 | 6713 | |
6714 | - $str_length = (int) self::strlen($str, $encoding); |
|
6714 | + $str_length = (int)self::strlen($str, $encoding); |
|
6715 | 6715 | |
6716 | 6716 | if ($pad_length >= $str_length) { |
6717 | 6717 | switch ($pad_type) { |
6718 | 6718 | case \STR_PAD_LEFT: |
6719 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6719 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6720 | 6720 | |
6721 | 6721 | $diff = ($pad_length - $str_length); |
6722 | 6722 | |
6723 | - $pre = (string) self::substr( |
|
6724 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6723 | + $pre = (string)self::substr( |
|
6724 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6725 | 6725 | 0, |
6726 | 6726 | $diff, |
6727 | 6727 | $encoding |
@@ -6733,17 +6733,17 @@ discard block |
||
6733 | 6733 | case \STR_PAD_BOTH: |
6734 | 6734 | $diff = ($pad_length - $str_length); |
6735 | 6735 | |
6736 | - $ps_length_left = (int) \floor($diff / 2); |
|
6736 | + $ps_length_left = (int)\floor($diff / 2); |
|
6737 | 6737 | |
6738 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6738 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6739 | 6739 | |
6740 | - $pre = (string) self::substr( |
|
6740 | + $pre = (string)self::substr( |
|
6741 | 6741 | \str_repeat($pad_string, $ps_length_left), |
6742 | 6742 | 0, |
6743 | 6743 | $ps_length_left, |
6744 | 6744 | $encoding |
6745 | 6745 | ); |
6746 | - $post = (string) self::substr( |
|
6746 | + $post = (string)self::substr( |
|
6747 | 6747 | \str_repeat($pad_string, $ps_length_right), |
6748 | 6748 | 0, |
6749 | 6749 | $ps_length_right, |
@@ -6754,12 +6754,12 @@ discard block |
||
6754 | 6754 | |
6755 | 6755 | case \STR_PAD_RIGHT: |
6756 | 6756 | default: |
6757 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6757 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6758 | 6758 | |
6759 | 6759 | $diff = ($pad_length - $str_length); |
6760 | 6760 | |
6761 | - $post = (string) self::substr( |
|
6762 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6761 | + $post = (string)self::substr( |
|
6762 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6763 | 6763 | 0, |
6764 | 6764 | $diff, |
6765 | 6765 | $encoding |
@@ -6767,7 +6767,7 @@ discard block |
||
6767 | 6767 | $pre = ''; |
6768 | 6768 | } |
6769 | 6769 | |
6770 | - return $pre . $str . $post; |
|
6770 | + return $pre.$str.$post; |
|
6771 | 6771 | } |
6772 | 6772 | |
6773 | 6773 | return $str; |
@@ -6952,11 +6952,11 @@ discard block |
||
6952 | 6952 | } |
6953 | 6953 | |
6954 | 6954 | if ($search === '') { |
6955 | - return $str . $replacement; |
|
6955 | + return $str.$replacement; |
|
6956 | 6956 | } |
6957 | 6957 | |
6958 | 6958 | if (\strpos($str, $search) === 0) { |
6959 | - return $replacement . \substr($str, \strlen($search)); |
|
6959 | + return $replacement.\substr($str, \strlen($search)); |
|
6960 | 6960 | } |
6961 | 6961 | |
6962 | 6962 | return $str; |
@@ -6988,11 +6988,11 @@ discard block |
||
6988 | 6988 | } |
6989 | 6989 | |
6990 | 6990 | if ($search === '') { |
6991 | - return $str . $replacement; |
|
6991 | + return $str.$replacement; |
|
6992 | 6992 | } |
6993 | 6993 | |
6994 | 6994 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6995 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6995 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6996 | 6996 | } |
6997 | 6997 | |
6998 | 6998 | return $str; |
@@ -7024,7 +7024,7 @@ discard block |
||
7024 | 7024 | $subject, |
7025 | 7025 | $replace, |
7026 | 7026 | $pos, |
7027 | - (int) self::strlen($search) |
|
7027 | + (int)self::strlen($search) |
|
7028 | 7028 | ); |
7029 | 7029 | } |
7030 | 7030 | |
@@ -7056,7 +7056,7 @@ discard block |
||
7056 | 7056 | $subject, |
7057 | 7057 | $replace, |
7058 | 7058 | $pos, |
7059 | - (int) self::strlen($search) |
|
7059 | + (int)self::strlen($search) |
|
7060 | 7060 | ); |
7061 | 7061 | } |
7062 | 7062 | |
@@ -7077,7 +7077,7 @@ discard block |
||
7077 | 7077 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
7078 | 7078 | { |
7079 | 7079 | if ($encoding === 'UTF-8') { |
7080 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
7080 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
7081 | 7081 | /** @noinspection NonSecureShuffleUsageInspection */ |
7082 | 7082 | \shuffle($indexes); |
7083 | 7083 | |
@@ -7093,7 +7093,7 @@ discard block |
||
7093 | 7093 | } else { |
7094 | 7094 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7095 | 7095 | |
7096 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
7096 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
7097 | 7097 | /** @noinspection NonSecureShuffleUsageInspection */ |
7098 | 7098 | \shuffle($indexes); |
7099 | 7099 | |
@@ -7134,11 +7134,11 @@ discard block |
||
7134 | 7134 | ) { |
7135 | 7135 | if ($encoding === 'UTF-8') { |
7136 | 7136 | if ($end === null) { |
7137 | - $length = (int) \mb_strlen($str); |
|
7137 | + $length = (int)\mb_strlen($str); |
|
7138 | 7138 | } elseif ($end >= 0 && $end <= $start) { |
7139 | 7139 | return ''; |
7140 | 7140 | } elseif ($end < 0) { |
7141 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7141 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7142 | 7142 | } else { |
7143 | 7143 | $length = $end - $start; |
7144 | 7144 | } |
@@ -7149,11 +7149,11 @@ discard block |
||
7149 | 7149 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7150 | 7150 | |
7151 | 7151 | if ($end === null) { |
7152 | - $length = (int) self::strlen($str, $encoding); |
|
7152 | + $length = (int)self::strlen($str, $encoding); |
|
7153 | 7153 | } elseif ($end >= 0 && $end <= $start) { |
7154 | 7154 | return ''; |
7155 | 7155 | } elseif ($end < 0) { |
7156 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7156 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7157 | 7157 | } else { |
7158 | 7158 | $length = $end - $start; |
7159 | 7159 | } |
@@ -7186,35 +7186,35 @@ discard block |
||
7186 | 7186 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7187 | 7187 | } |
7188 | 7188 | |
7189 | - $str = (string) \preg_replace_callback( |
|
7189 | + $str = (string)\preg_replace_callback( |
|
7190 | 7190 | '/([\\p{N}|\\p{Lu}])/u', |
7191 | 7191 | /** |
7192 | 7192 | * @param string[] $matches |
7193 | 7193 | * |
7194 | 7194 | * @return string |
7195 | 7195 | */ |
7196 | - static function (array $matches) use ($encoding): string { |
|
7196 | + static function(array $matches) use ($encoding): string { |
|
7197 | 7197 | $match = $matches[1]; |
7198 | - $match_int = (int) $match; |
|
7198 | + $match_int = (int)$match; |
|
7199 | 7199 | |
7200 | - if ((string) $match_int === $match) { |
|
7201 | - return '_' . $match . '_'; |
|
7200 | + if ((string)$match_int === $match) { |
|
7201 | + return '_'.$match.'_'; |
|
7202 | 7202 | } |
7203 | 7203 | |
7204 | 7204 | if ($encoding === 'UTF-8') { |
7205 | - return '_' . \mb_strtolower($match); |
|
7205 | + return '_'.\mb_strtolower($match); |
|
7206 | 7206 | } |
7207 | 7207 | |
7208 | - return '_' . self::strtolower($match, $encoding); |
|
7208 | + return '_'.self::strtolower($match, $encoding); |
|
7209 | 7209 | }, |
7210 | 7210 | $str |
7211 | 7211 | ); |
7212 | 7212 | |
7213 | - $str = (string) \preg_replace( |
|
7213 | + $str = (string)\preg_replace( |
|
7214 | 7214 | [ |
7215 | - '/\\s+/u', // convert spaces to "_" |
|
7215 | + '/\\s+/u', // convert spaces to "_" |
|
7216 | 7216 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
7217 | - '/_+/', // remove double "_" |
|
7217 | + '/_+/', // remove double "_" |
|
7218 | 7218 | ], |
7219 | 7219 | [ |
7220 | 7220 | '_', |
@@ -7291,7 +7291,7 @@ discard block |
||
7291 | 7291 | } |
7292 | 7292 | |
7293 | 7293 | // init |
7294 | - $str = (string) $str; |
|
7294 | + $str = (string)$str; |
|
7295 | 7295 | |
7296 | 7296 | if ($str === '') { |
7297 | 7297 | return []; |
@@ -7345,7 +7345,7 @@ discard block |
||
7345 | 7345 | ($str[$i] & "\xE0") === "\xC0" |
7346 | 7346 | ) { |
7347 | 7347 | if (($str[$i + 1] & "\xC0") === "\x80") { |
7348 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
7348 | + $ret[] = $str[$i].$str[$i + 1]; |
|
7349 | 7349 | |
7350 | 7350 | ++$i; |
7351 | 7351 | } |
@@ -7359,7 +7359,7 @@ discard block |
||
7359 | 7359 | && |
7360 | 7360 | ($str[$i + 2] & "\xC0") === "\x80" |
7361 | 7361 | ) { |
7362 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
7362 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
7363 | 7363 | |
7364 | 7364 | $i += 2; |
7365 | 7365 | } |
@@ -7375,7 +7375,7 @@ discard block |
||
7375 | 7375 | && |
7376 | 7376 | ($str[$i + 3] & "\xC0") === "\x80" |
7377 | 7377 | ) { |
7378 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
7378 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
7379 | 7379 | |
7380 | 7380 | $i += 3; |
7381 | 7381 | } |
@@ -7387,7 +7387,7 @@ discard block |
||
7387 | 7387 | $ret = \array_chunk($ret, $length); |
7388 | 7388 | |
7389 | 7389 | return \array_map( |
7390 | - static function (array &$item): string { |
|
7390 | + static function(array &$item): string { |
|
7391 | 7391 | return \implode('', $item); |
7392 | 7392 | }, |
7393 | 7393 | $ret |
@@ -7451,7 +7451,7 @@ discard block |
||
7451 | 7451 | $limit = -1; |
7452 | 7452 | } |
7453 | 7453 | |
7454 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7454 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7455 | 7455 | |
7456 | 7456 | if ($array === false) { |
7457 | 7457 | return []; |
@@ -7535,9 +7535,9 @@ discard block |
||
7535 | 7535 | return ''; |
7536 | 7536 | } |
7537 | 7537 | |
7538 | - return (string) \mb_substr( |
|
7538 | + return (string)\mb_substr( |
|
7539 | 7539 | $str, |
7540 | - $offset + (int) \mb_strlen($separator) |
|
7540 | + $offset + (int)\mb_strlen($separator) |
|
7541 | 7541 | ); |
7542 | 7542 | } |
7543 | 7543 | |
@@ -7546,9 +7546,9 @@ discard block |
||
7546 | 7546 | return ''; |
7547 | 7547 | } |
7548 | 7548 | |
7549 | - return (string) \mb_substr( |
|
7549 | + return (string)\mb_substr( |
|
7550 | 7550 | $str, |
7551 | - $offset + (int) self::strlen($separator, $encoding), |
|
7551 | + $offset + (int)self::strlen($separator, $encoding), |
|
7552 | 7552 | null, |
7553 | 7553 | $encoding |
7554 | 7554 | ); |
@@ -7575,9 +7575,9 @@ discard block |
||
7575 | 7575 | return ''; |
7576 | 7576 | } |
7577 | 7577 | |
7578 | - return (string) \mb_substr( |
|
7578 | + return (string)\mb_substr( |
|
7579 | 7579 | $str, |
7580 | - $offset + (int) \mb_strlen($separator) |
|
7580 | + $offset + (int)\mb_strlen($separator) |
|
7581 | 7581 | ); |
7582 | 7582 | } |
7583 | 7583 | |
@@ -7586,9 +7586,9 @@ discard block |
||
7586 | 7586 | return ''; |
7587 | 7587 | } |
7588 | 7588 | |
7589 | - return (string) self::substr( |
|
7589 | + return (string)self::substr( |
|
7590 | 7590 | $str, |
7591 | - $offset + (int) self::strlen($separator, $encoding), |
|
7591 | + $offset + (int)self::strlen($separator, $encoding), |
|
7592 | 7592 | null, |
7593 | 7593 | $encoding |
7594 | 7594 | ); |
@@ -7618,7 +7618,7 @@ discard block |
||
7618 | 7618 | return ''; |
7619 | 7619 | } |
7620 | 7620 | |
7621 | - return (string) \mb_substr( |
|
7621 | + return (string)\mb_substr( |
|
7622 | 7622 | $str, |
7623 | 7623 | 0, |
7624 | 7624 | $offset |
@@ -7630,7 +7630,7 @@ discard block |
||
7630 | 7630 | return ''; |
7631 | 7631 | } |
7632 | 7632 | |
7633 | - return (string) self::substr( |
|
7633 | + return (string)self::substr( |
|
7634 | 7634 | $str, |
7635 | 7635 | 0, |
7636 | 7636 | $offset, |
@@ -7659,7 +7659,7 @@ discard block |
||
7659 | 7659 | return ''; |
7660 | 7660 | } |
7661 | 7661 | |
7662 | - return (string) \mb_substr( |
|
7662 | + return (string)\mb_substr( |
|
7663 | 7663 | $str, |
7664 | 7664 | 0, |
7665 | 7665 | $offset |
@@ -7673,7 +7673,7 @@ discard block |
||
7673 | 7673 | |
7674 | 7674 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7675 | 7675 | |
7676 | - return (string) self::substr( |
|
7676 | + return (string)self::substr( |
|
7677 | 7677 | $str, |
7678 | 7678 | 0, |
7679 | 7679 | $offset, |
@@ -7782,7 +7782,7 @@ discard block |
||
7782 | 7782 | */ |
7783 | 7783 | public static function str_surround(string $str, string $substring): string |
7784 | 7784 | { |
7785 | - return $substring . $str . $substring; |
|
7785 | + return $substring.$str.$substring; |
|
7786 | 7786 | } |
7787 | 7787 | |
7788 | 7788 | /** |
@@ -7839,9 +7839,9 @@ discard block |
||
7839 | 7839 | $word_define_chars = ''; |
7840 | 7840 | } |
7841 | 7841 | |
7842 | - $str = (string) \preg_replace_callback( |
|
7843 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
7844 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
7842 | + $str = (string)\preg_replace_callback( |
|
7843 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
7844 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
7845 | 7845 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
7846 | 7846 | return $match[0]; |
7847 | 7847 | } |
@@ -7938,16 +7938,16 @@ discard block |
||
7938 | 7938 | } |
7939 | 7939 | |
7940 | 7940 | // the main substitutions |
7941 | - $str = (string) \preg_replace_callback( |
|
7941 | + $str = (string)\preg_replace_callback( |
|
7942 | 7942 | '~\\b (_*) (?: # 1. Leading underscore and |
7943 | 7943 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
7944 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
7944 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
7945 | 7945 | | |
7946 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
7946 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
7947 | 7947 | | |
7948 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
7948 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
7949 | 7949 | | |
7950 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
7950 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
7951 | 7951 | ) (_*) \\b # 6. With trailing underscore |
7952 | 7952 | ~ux', |
7953 | 7953 | /** |
@@ -7955,7 +7955,7 @@ discard block |
||
7955 | 7955 | * |
7956 | 7956 | * @return string |
7957 | 7957 | */ |
7958 | - static function (array $matches) use ($encoding): string { |
|
7958 | + static function(array $matches) use ($encoding): string { |
|
7959 | 7959 | // preserve leading underscore |
7960 | 7960 | $str = $matches[1]; |
7961 | 7961 | if ($matches[2]) { |
@@ -7980,26 +7980,26 @@ discard block |
||
7980 | 7980 | ); |
7981 | 7981 | |
7982 | 7982 | // Exceptions for small words: capitalize at start of title... |
7983 | - $str = (string) \preg_replace_callback( |
|
7983 | + $str = (string)\preg_replace_callback( |
|
7984 | 7984 | '~( \\A [[:punct:]]* # start of title... |
7985 | 7985 | | [:.;?!][ ]+ # or of subsentence... |
7986 | 7986 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
7987 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
7987 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
7988 | 7988 | ~uxi', |
7989 | 7989 | /** |
7990 | 7990 | * @param string[] $matches |
7991 | 7991 | * |
7992 | 7992 | * @return string |
7993 | 7993 | */ |
7994 | - static function (array $matches) use ($encoding): string { |
|
7995 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
7994 | + static function(array $matches) use ($encoding): string { |
|
7995 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
7996 | 7996 | }, |
7997 | 7997 | $str |
7998 | 7998 | ); |
7999 | 7999 | |
8000 | 8000 | // ...and end of title |
8001 | - $str = (string) \preg_replace_callback( |
|
8002 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
8001 | + $str = (string)\preg_replace_callback( |
|
8002 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
8003 | 8003 | (?= [[:punct:]]* \Z # ...at the end of the title... |
8004 | 8004 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
8005 | 8005 | ~uxi', |
@@ -8008,7 +8008,7 @@ discard block |
||
8008 | 8008 | * |
8009 | 8009 | * @return string |
8010 | 8010 | */ |
8011 | - static function (array $matches) use ($encoding): string { |
|
8011 | + static function(array $matches) use ($encoding): string { |
|
8012 | 8012 | return static::ucfirst($matches[1], $encoding); |
8013 | 8013 | }, |
8014 | 8014 | $str |
@@ -8016,10 +8016,10 @@ discard block |
||
8016 | 8016 | |
8017 | 8017 | // Exceptions for small words in hyphenated compound words. |
8018 | 8018 | // e.g. "in-flight" -> In-Flight |
8019 | - $str = (string) \preg_replace_callback( |
|
8019 | + $str = (string)\preg_replace_callback( |
|
8020 | 8020 | '~\\b |
8021 | 8021 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
8022 | - ( ' . $small_words_rx . ' ) |
|
8022 | + ( ' . $small_words_rx.' ) |
|
8023 | 8023 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
8024 | 8024 | ~uxi', |
8025 | 8025 | /** |
@@ -8027,18 +8027,18 @@ discard block |
||
8027 | 8027 | * |
8028 | 8028 | * @return string |
8029 | 8029 | */ |
8030 | - static function (array $matches) use ($encoding): string { |
|
8030 | + static function(array $matches) use ($encoding): string { |
|
8031 | 8031 | return static::ucfirst($matches[1], $encoding); |
8032 | 8032 | }, |
8033 | 8033 | $str |
8034 | 8034 | ); |
8035 | 8035 | |
8036 | 8036 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
8037 | - $str = (string) \preg_replace_callback( |
|
8037 | + $str = (string)\preg_replace_callback( |
|
8038 | 8038 | '~\\b |
8039 | 8039 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
8040 | 8040 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
8041 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
8041 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
8042 | 8042 | (?! - ) # Negative lookahead for another - |
8043 | 8043 | ~uxi', |
8044 | 8044 | /** |
@@ -8046,8 +8046,8 @@ discard block |
||
8046 | 8046 | * |
8047 | 8047 | * @return string |
8048 | 8048 | */ |
8049 | - static function (array $matches) use ($encoding): string { |
|
8050 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
8049 | + static function(array $matches) use ($encoding): string { |
|
8050 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
8051 | 8051 | }, |
8052 | 8052 | $str |
8053 | 8053 | ); |
@@ -8156,7 +8156,7 @@ discard block |
||
8156 | 8156 | ); |
8157 | 8157 | |
8158 | 8158 | foreach ($tmp_return as &$item) { |
8159 | - $item = (string) $item; |
|
8159 | + $item = (string)$item; |
|
8160 | 8160 | } |
8161 | 8161 | |
8162 | 8162 | return $tmp_return; |
@@ -8206,39 +8206,39 @@ discard block |
||
8206 | 8206 | } |
8207 | 8207 | |
8208 | 8208 | if ($encoding === 'UTF-8') { |
8209 | - if ($length >= (int) \mb_strlen($str)) { |
|
8209 | + if ($length >= (int)\mb_strlen($str)) { |
|
8210 | 8210 | return $str; |
8211 | 8211 | } |
8212 | 8212 | |
8213 | 8213 | if ($substring !== '') { |
8214 | - $length -= (int) \mb_strlen($substring); |
|
8214 | + $length -= (int)\mb_strlen($substring); |
|
8215 | 8215 | |
8216 | 8216 | /** @noinspection UnnecessaryCastingInspection */ |
8217 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8217 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8218 | 8218 | } |
8219 | 8219 | |
8220 | 8220 | /** @noinspection UnnecessaryCastingInspection */ |
8221 | - return (string) \mb_substr($str, 0, $length); |
|
8221 | + return (string)\mb_substr($str, 0, $length); |
|
8222 | 8222 | } |
8223 | 8223 | |
8224 | 8224 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8225 | 8225 | |
8226 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8226 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8227 | 8227 | return $str; |
8228 | 8228 | } |
8229 | 8229 | |
8230 | 8230 | if ($substring !== '') { |
8231 | - $length -= (int) self::strlen($substring, $encoding); |
|
8231 | + $length -= (int)self::strlen($substring, $encoding); |
|
8232 | 8232 | } |
8233 | 8233 | |
8234 | 8234 | return ( |
8235 | - (string) self::substr( |
|
8235 | + (string)self::substr( |
|
8236 | 8236 | $str, |
8237 | 8237 | 0, |
8238 | 8238 | $length, |
8239 | 8239 | $encoding |
8240 | 8240 | ) |
8241 | - ) . $substring; |
|
8241 | + ).$substring; |
|
8242 | 8242 | } |
8243 | 8243 | |
8244 | 8244 | /** |
@@ -8269,12 +8269,12 @@ discard block |
||
8269 | 8269 | } |
8270 | 8270 | |
8271 | 8271 | if ($encoding === 'UTF-8') { |
8272 | - if ($length >= (int) \mb_strlen($str)) { |
|
8272 | + if ($length >= (int)\mb_strlen($str)) { |
|
8273 | 8273 | return $str; |
8274 | 8274 | } |
8275 | 8275 | |
8276 | 8276 | // need to further trim the string so we can append the substring |
8277 | - $length -= (int) \mb_strlen($substring); |
|
8277 | + $length -= (int)\mb_strlen($substring); |
|
8278 | 8278 | if ($length <= 0) { |
8279 | 8279 | return $substring; |
8280 | 8280 | } |
@@ -8296,18 +8296,18 @@ discard block |
||
8296 | 8296 | || |
8297 | 8297 | ($space_position !== false && $ignore_do_not_split_words_for_one_word === false) |
8298 | 8298 | ) { |
8299 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
8299 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
8300 | 8300 | } |
8301 | 8301 | } |
8302 | 8302 | } else { |
8303 | 8303 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8304 | 8304 | |
8305 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8305 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8306 | 8306 | return $str; |
8307 | 8307 | } |
8308 | 8308 | |
8309 | 8309 | // need to further trim the string so we can append the substring |
8310 | - $length -= (int) self::strlen($substring, $encoding); |
|
8310 | + $length -= (int)self::strlen($substring, $encoding); |
|
8311 | 8311 | if ($length <= 0) { |
8312 | 8312 | return $substring; |
8313 | 8313 | } |
@@ -8329,12 +8329,12 @@ discard block |
||
8329 | 8329 | || |
8330 | 8330 | ($space_position !== false && $ignore_do_not_split_words_for_one_word === false) |
8331 | 8331 | ) { |
8332 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
8332 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
8333 | 8333 | } |
8334 | 8334 | } |
8335 | 8335 | } |
8336 | 8336 | |
8337 | - return $truncated . $substring; |
|
8337 | + return $truncated.$substring; |
|
8338 | 8338 | } |
8339 | 8339 | |
8340 | 8340 | /** |
@@ -8433,13 +8433,13 @@ discard block |
||
8433 | 8433 | } |
8434 | 8434 | } elseif ($format === 2) { |
8435 | 8435 | $number_of_words = []; |
8436 | - $offset = (int) self::strlen($str_parts[0]); |
|
8436 | + $offset = (int)self::strlen($str_parts[0]); |
|
8437 | 8437 | for ($i = 1; $i < $len; $i += 2) { |
8438 | 8438 | $number_of_words[$offset] = $str_parts[$i]; |
8439 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
8439 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
8440 | 8440 | } |
8441 | 8441 | } else { |
8442 | - $number_of_words = (int) (($len - 1) / 2); |
|
8442 | + $number_of_words = (int)(($len - 1) / 2); |
|
8443 | 8443 | } |
8444 | 8444 | |
8445 | 8445 | return $number_of_words; |
@@ -8560,21 +8560,21 @@ discard block |
||
8560 | 8560 | } |
8561 | 8561 | |
8562 | 8562 | if ($char_list === '') { |
8563 | - return (int) self::strlen($str, $encoding); |
|
8563 | + return (int)self::strlen($str, $encoding); |
|
8564 | 8564 | } |
8565 | 8565 | |
8566 | 8566 | if ($offset !== null || $length !== null) { |
8567 | 8567 | if ($encoding === 'UTF-8') { |
8568 | 8568 | if ($length === null) { |
8569 | 8569 | /** @noinspection UnnecessaryCastingInspection */ |
8570 | - $str_tmp = \mb_substr($str, (int) $offset); |
|
8570 | + $str_tmp = \mb_substr($str, (int)$offset); |
|
8571 | 8571 | } else { |
8572 | 8572 | /** @noinspection UnnecessaryCastingInspection */ |
8573 | - $str_tmp = \mb_substr($str, (int) $offset, $length); |
|
8573 | + $str_tmp = \mb_substr($str, (int)$offset, $length); |
|
8574 | 8574 | } |
8575 | 8575 | } else { |
8576 | 8576 | /** @noinspection UnnecessaryCastingInspection */ |
8577 | - $str_tmp = self::substr($str, (int) $offset, $length, $encoding); |
|
8577 | + $str_tmp = self::substr($str, (int)$offset, $length, $encoding); |
|
8578 | 8578 | } |
8579 | 8579 | |
8580 | 8580 | if ($str_tmp === false) { |
@@ -8590,7 +8590,7 @@ discard block |
||
8590 | 8590 | } |
8591 | 8591 | |
8592 | 8592 | $matches = []; |
8593 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
8593 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
8594 | 8594 | $return = self::strlen($matches[1], $encoding); |
8595 | 8595 | if ($return === false) { |
8596 | 8596 | return 0; |
@@ -8599,7 +8599,7 @@ discard block |
||
8599 | 8599 | return $return; |
8600 | 8600 | } |
8601 | 8601 | |
8602 | - return (int) self::strlen($str, $encoding); |
|
8602 | + return (int)self::strlen($str, $encoding); |
|
8603 | 8603 | } |
8604 | 8604 | |
8605 | 8605 | /** |
@@ -8650,7 +8650,7 @@ discard block |
||
8650 | 8650 | |
8651 | 8651 | $str = ''; |
8652 | 8652 | foreach ($array as $strPart) { |
8653 | - $str .= '&#' . (int) $strPart . ';'; |
|
8653 | + $str .= '&#'.(int)$strPart.';'; |
|
8654 | 8654 | } |
8655 | 8655 | |
8656 | 8656 | return self::html_entity_decode($str, \ENT_QUOTES | \ENT_HTML5); |
@@ -8733,7 +8733,7 @@ discard block |
||
8733 | 8733 | return ''; |
8734 | 8734 | } |
8735 | 8735 | |
8736 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
8736 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
8737 | 8737 | } |
8738 | 8738 | |
8739 | 8739 | /** |
@@ -8798,7 +8798,7 @@ discard block |
||
8798 | 8798 | // fallback for ascii only |
8799 | 8799 | // |
8800 | 8800 | |
8801 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
8801 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
8802 | 8802 | return \stripos($haystack, $needle, $offset); |
8803 | 8803 | } |
8804 | 8804 | |
@@ -8866,7 +8866,7 @@ discard block |
||
8866 | 8866 | && |
8867 | 8867 | self::$SUPPORT['mbstring'] === false |
8868 | 8868 | ) { |
8869 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8869 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8870 | 8870 | } |
8871 | 8871 | |
8872 | 8872 | if ( |
@@ -8880,11 +8880,11 @@ discard block |
||
8880 | 8880 | } |
8881 | 8881 | } |
8882 | 8882 | |
8883 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
8883 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
8884 | 8884 | return \stristr($haystack, $needle, $before_needle); |
8885 | 8885 | } |
8886 | 8886 | |
8887 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
8887 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
8888 | 8888 | |
8889 | 8889 | if (!isset($match[1])) { |
8890 | 8890 | return false; |
@@ -8894,7 +8894,7 @@ discard block |
||
8894 | 8894 | return $match[1]; |
8895 | 8895 | } |
8896 | 8896 | |
8897 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
8897 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
8898 | 8898 | } |
8899 | 8899 | |
8900 | 8900 | /** |
@@ -8966,7 +8966,7 @@ discard block |
||
8966 | 8966 | && |
8967 | 8967 | self::$SUPPORT['iconv'] === false |
8968 | 8968 | ) { |
8969 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8969 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8970 | 8970 | } |
8971 | 8971 | |
8972 | 8972 | // |
@@ -9082,8 +9082,8 @@ discard block |
||
9082 | 9082 | } |
9083 | 9083 | |
9084 | 9084 | return \strnatcmp( |
9085 | - (string) self::strtonatfold($str1), |
|
9086 | - (string) self::strtonatfold($str2) |
|
9085 | + (string)self::strtonatfold($str1), |
|
9086 | + (string)self::strtonatfold($str2) |
|
9087 | 9087 | ); |
9088 | 9088 | } |
9089 | 9089 | |
@@ -9141,11 +9141,11 @@ discard block |
||
9141 | 9141 | } |
9142 | 9142 | |
9143 | 9143 | if ($encoding === 'UTF-8') { |
9144 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
9145 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
9144 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
9145 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
9146 | 9146 | } else { |
9147 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
9148 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
9147 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
9148 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
9149 | 9149 | } |
9150 | 9150 | |
9151 | 9151 | return self::strcmp($str1, $str2); |
@@ -9167,8 +9167,8 @@ discard block |
||
9167 | 9167 | return false; |
9168 | 9168 | } |
9169 | 9169 | |
9170 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
9171 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
9170 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
9171 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
9172 | 9172 | } |
9173 | 9173 | |
9174 | 9174 | return false; |
@@ -9201,10 +9201,10 @@ discard block |
||
9201 | 9201 | } |
9202 | 9202 | |
9203 | 9203 | // iconv and mbstring do not support integer $needle |
9204 | - if ((int) $needle === $needle) { |
|
9205 | - $needle = (string) self::chr($needle); |
|
9204 | + if ((int)$needle === $needle) { |
|
9205 | + $needle = (string)self::chr($needle); |
|
9206 | 9206 | } |
9207 | - $needle = (string) $needle; |
|
9207 | + $needle = (string)$needle; |
|
9208 | 9208 | |
9209 | 9209 | if ($needle === '') { |
9210 | 9210 | return false; |
@@ -9251,7 +9251,7 @@ discard block |
||
9251 | 9251 | && |
9252 | 9252 | self::$SUPPORT['mbstring'] === false |
9253 | 9253 | ) { |
9254 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9254 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9255 | 9255 | } |
9256 | 9256 | |
9257 | 9257 | // |
@@ -9292,7 +9292,7 @@ discard block |
||
9292 | 9292 | // fallback for ascii only |
9293 | 9293 | // |
9294 | 9294 | |
9295 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9295 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9296 | 9296 | return \strpos($haystack, $needle, $offset); |
9297 | 9297 | } |
9298 | 9298 | |
@@ -9304,7 +9304,7 @@ discard block |
||
9304 | 9304 | if ($haystack_tmp === false) { |
9305 | 9305 | $haystack_tmp = ''; |
9306 | 9306 | } |
9307 | - $haystack = (string) $haystack_tmp; |
|
9307 | + $haystack = (string)$haystack_tmp; |
|
9308 | 9308 | |
9309 | 9309 | if ($offset < 0) { |
9310 | 9310 | $offset = 0; |
@@ -9316,7 +9316,7 @@ discard block |
||
9316 | 9316 | } |
9317 | 9317 | |
9318 | 9318 | if ($pos) { |
9319 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9319 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9320 | 9320 | } |
9321 | 9321 | |
9322 | 9322 | return $offset + 0; |
@@ -9427,7 +9427,7 @@ discard block |
||
9427 | 9427 | && |
9428 | 9428 | self::$SUPPORT['mbstring'] === false |
9429 | 9429 | ) { |
9430 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9430 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9431 | 9431 | } |
9432 | 9432 | |
9433 | 9433 | // |
@@ -9439,7 +9439,7 @@ discard block |
||
9439 | 9439 | if ($needle_tmp === false) { |
9440 | 9440 | return false; |
9441 | 9441 | } |
9442 | - $needle = (string) $needle_tmp; |
|
9442 | + $needle = (string)$needle_tmp; |
|
9443 | 9443 | |
9444 | 9444 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
9445 | 9445 | if ($pos === false) { |
@@ -9461,7 +9461,7 @@ discard block |
||
9461 | 9461 | if ($needle_tmp === false) { |
9462 | 9462 | return false; |
9463 | 9463 | } |
9464 | - $needle = (string) $needle_tmp; |
|
9464 | + $needle = (string)$needle_tmp; |
|
9465 | 9465 | |
9466 | 9466 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
9467 | 9467 | if ($pos === false) { |
@@ -9497,7 +9497,7 @@ discard block |
||
9497 | 9497 | if ($encoding === 'UTF-8') { |
9498 | 9498 | if (self::$SUPPORT['intl'] === true) { |
9499 | 9499 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
9500 | - $i = (int) \grapheme_strlen($str); |
|
9500 | + $i = (int)\grapheme_strlen($str); |
|
9501 | 9501 | while ($i--) { |
9502 | 9502 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
9503 | 9503 | if ($reversed_tmp !== false) { |
@@ -9505,7 +9505,7 @@ discard block |
||
9505 | 9505 | } |
9506 | 9506 | } |
9507 | 9507 | } else { |
9508 | - $i = (int) \mb_strlen($str); |
|
9508 | + $i = (int)\mb_strlen($str); |
|
9509 | 9509 | while ($i--) { |
9510 | 9510 | $reversed_tmp = \mb_substr($str, $i, 1); |
9511 | 9511 | if ($reversed_tmp !== false) { |
@@ -9516,7 +9516,7 @@ discard block |
||
9516 | 9516 | } else { |
9517 | 9517 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9518 | 9518 | |
9519 | - $i = (int) self::strlen($str, $encoding); |
|
9519 | + $i = (int)self::strlen($str, $encoding); |
|
9520 | 9520 | while ($i--) { |
9521 | 9521 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
9522 | 9522 | if ($reversed_tmp !== false) { |
@@ -9590,7 +9590,7 @@ discard block |
||
9590 | 9590 | if ($needle_tmp === false) { |
9591 | 9591 | return false; |
9592 | 9592 | } |
9593 | - $needle = (string) $needle_tmp; |
|
9593 | + $needle = (string)$needle_tmp; |
|
9594 | 9594 | |
9595 | 9595 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
9596 | 9596 | if ($pos === false) { |
@@ -9629,10 +9629,10 @@ discard block |
||
9629 | 9629 | } |
9630 | 9630 | |
9631 | 9631 | // iconv and mbstring do not support integer $needle |
9632 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9633 | - $needle = (string) self::chr($needle); |
|
9632 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9633 | + $needle = (string)self::chr($needle); |
|
9634 | 9634 | } |
9635 | - $needle = (string) $needle; |
|
9635 | + $needle = (string)$needle; |
|
9636 | 9636 | |
9637 | 9637 | if ($needle === '') { |
9638 | 9638 | return false; |
@@ -9677,7 +9677,7 @@ discard block |
||
9677 | 9677 | && |
9678 | 9678 | self::$SUPPORT['mbstring'] === false |
9679 | 9679 | ) { |
9680 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9680 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9681 | 9681 | } |
9682 | 9682 | |
9683 | 9683 | // |
@@ -9701,7 +9701,7 @@ discard block |
||
9701 | 9701 | // fallback for ascii only |
9702 | 9702 | // |
9703 | 9703 | |
9704 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9704 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9705 | 9705 | return \strripos($haystack, $needle, $offset); |
9706 | 9706 | } |
9707 | 9707 | |
@@ -9778,10 +9778,10 @@ discard block |
||
9778 | 9778 | } |
9779 | 9779 | |
9780 | 9780 | // iconv and mbstring do not support integer $needle |
9781 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9782 | - $needle = (string) self::chr($needle); |
|
9781 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9782 | + $needle = (string)self::chr($needle); |
|
9783 | 9783 | } |
9784 | - $needle = (string) $needle; |
|
9784 | + $needle = (string)$needle; |
|
9785 | 9785 | |
9786 | 9786 | if ($needle === '') { |
9787 | 9787 | return false; |
@@ -9826,7 +9826,7 @@ discard block |
||
9826 | 9826 | && |
9827 | 9827 | self::$SUPPORT['mbstring'] === false |
9828 | 9828 | ) { |
9829 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9829 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9830 | 9830 | } |
9831 | 9831 | |
9832 | 9832 | // |
@@ -9850,7 +9850,7 @@ discard block |
||
9850 | 9850 | // fallback for ascii only |
9851 | 9851 | // |
9852 | 9852 | |
9853 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9853 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9854 | 9854 | return \strrpos($haystack, $needle, $offset); |
9855 | 9855 | } |
9856 | 9856 | |
@@ -9870,7 +9870,7 @@ discard block |
||
9870 | 9870 | if ($haystack_tmp === false) { |
9871 | 9871 | $haystack_tmp = ''; |
9872 | 9872 | } |
9873 | - $haystack = (string) $haystack_tmp; |
|
9873 | + $haystack = (string)$haystack_tmp; |
|
9874 | 9874 | } |
9875 | 9875 | |
9876 | 9876 | $pos = \strrpos($haystack, $needle); |
@@ -9884,7 +9884,7 @@ discard block |
||
9884 | 9884 | return false; |
9885 | 9885 | } |
9886 | 9886 | |
9887 | - return $offset + (int) self::strlen($str_tmp); |
|
9887 | + return $offset + (int)self::strlen($str_tmp); |
|
9888 | 9888 | } |
9889 | 9889 | |
9890 | 9890 | /** |
@@ -9946,12 +9946,12 @@ discard block |
||
9946 | 9946 | if ($offset || $length !== null) { |
9947 | 9947 | if ($encoding === 'UTF-8') { |
9948 | 9948 | if ($length === null) { |
9949 | - $str = (string) \mb_substr($str, $offset); |
|
9949 | + $str = (string)\mb_substr($str, $offset); |
|
9950 | 9950 | } else { |
9951 | - $str = (string) \mb_substr($str, $offset, $length); |
|
9951 | + $str = (string)\mb_substr($str, $offset, $length); |
|
9952 | 9952 | } |
9953 | 9953 | } else { |
9954 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
9954 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
9955 | 9955 | } |
9956 | 9956 | } |
9957 | 9957 | |
@@ -9961,7 +9961,7 @@ discard block |
||
9961 | 9961 | |
9962 | 9962 | $matches = []; |
9963 | 9963 | |
9964 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
9964 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
9965 | 9965 | } |
9966 | 9966 | |
9967 | 9967 | /** |
@@ -10030,7 +10030,7 @@ discard block |
||
10030 | 10030 | && |
10031 | 10031 | self::$SUPPORT['mbstring'] === false |
10032 | 10032 | ) { |
10033 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10033 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10034 | 10034 | } |
10035 | 10035 | |
10036 | 10036 | // |
@@ -10052,7 +10052,7 @@ discard block |
||
10052 | 10052 | // fallback for ascii only |
10053 | 10053 | // |
10054 | 10054 | |
10055 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10055 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10056 | 10056 | return \strstr($haystack, $needle, $before_needle); |
10057 | 10057 | } |
10058 | 10058 | |
@@ -10060,7 +10060,7 @@ discard block |
||
10060 | 10060 | // fallback via vanilla php |
10061 | 10061 | // |
10062 | 10062 | |
10063 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
10063 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
10064 | 10064 | |
10065 | 10065 | if (!isset($match[1])) { |
10066 | 10066 | return false; |
@@ -10070,7 +10070,7 @@ discard block |
||
10070 | 10070 | return $match[1]; |
10071 | 10071 | } |
10072 | 10072 | |
10073 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
10073 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
10074 | 10074 | } |
10075 | 10075 | |
10076 | 10076 | /** |
@@ -10188,7 +10188,7 @@ discard block |
||
10188 | 10188 | bool $try_to_keep_the_string_length = false |
10189 | 10189 | ): string { |
10190 | 10190 | // init |
10191 | - $str = (string) $str; |
|
10191 | + $str = (string)$str; |
|
10192 | 10192 | |
10193 | 10193 | if ($str === '') { |
10194 | 10194 | return ''; |
@@ -10217,19 +10217,19 @@ discard block |
||
10217 | 10217 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10218 | 10218 | } |
10219 | 10219 | |
10220 | - $language_code = $lang . '-Lower'; |
|
10220 | + $language_code = $lang.'-Lower'; |
|
10221 | 10221 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10222 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
10222 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
10223 | 10223 | |
10224 | 10224 | $language_code = 'Any-Lower'; |
10225 | 10225 | } |
10226 | 10226 | |
10227 | 10227 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10228 | 10228 | /** @noinspection UnnecessaryCastingInspection */ |
10229 | - return (string) \transliterator_transliterate($language_code, $str); |
|
10229 | + return (string)\transliterator_transliterate($language_code, $str); |
|
10230 | 10230 | } |
10231 | 10231 | |
10232 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
10232 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
10233 | 10233 | } |
10234 | 10234 | |
10235 | 10235 | // always fallback via symfony polyfill |
@@ -10258,7 +10258,7 @@ discard block |
||
10258 | 10258 | bool $try_to_keep_the_string_length = false |
10259 | 10259 | ): string { |
10260 | 10260 | // init |
10261 | - $str = (string) $str; |
|
10261 | + $str = (string)$str; |
|
10262 | 10262 | |
10263 | 10263 | if ($str === '') { |
10264 | 10264 | return ''; |
@@ -10287,19 +10287,19 @@ discard block |
||
10287 | 10287 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10288 | 10288 | } |
10289 | 10289 | |
10290 | - $language_code = $lang . '-Upper'; |
|
10290 | + $language_code = $lang.'-Upper'; |
|
10291 | 10291 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10292 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
10292 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
10293 | 10293 | |
10294 | 10294 | $language_code = 'Any-Upper'; |
10295 | 10295 | } |
10296 | 10296 | |
10297 | 10297 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10298 | 10298 | /** @noinspection UnnecessaryCastingInspection */ |
10299 | - return (string) \transliterator_transliterate($language_code, $str); |
|
10299 | + return (string)\transliterator_transliterate($language_code, $str); |
|
10300 | 10300 | } |
10301 | 10301 | |
10302 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
10302 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
10303 | 10303 | } |
10304 | 10304 | |
10305 | 10305 | // always fallback via symfony polyfill |
@@ -10344,7 +10344,7 @@ discard block |
||
10344 | 10344 | $from = \array_combine($from, $to); |
10345 | 10345 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
10346 | 10346 | if ($from === false) { |
10347 | - 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) . ')'); |
|
10347 | + 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).')'); |
|
10348 | 10348 | } |
10349 | 10349 | } |
10350 | 10350 | |
@@ -10404,9 +10404,9 @@ discard block |
||
10404 | 10404 | } |
10405 | 10405 | |
10406 | 10406 | $wide = 0; |
10407 | - $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); |
|
10407 | + $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); |
|
10408 | 10408 | |
10409 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
10409 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
10410 | 10410 | } |
10411 | 10411 | |
10412 | 10412 | /** |
@@ -10506,9 +10506,9 @@ discard block |
||
10506 | 10506 | } |
10507 | 10507 | |
10508 | 10508 | if ($length === null) { |
10509 | - $length = (int) $str_length; |
|
10509 | + $length = (int)$str_length; |
|
10510 | 10510 | } else { |
10511 | - $length = (int) $length; |
|
10511 | + $length = (int)$length; |
|
10512 | 10512 | } |
10513 | 10513 | |
10514 | 10514 | if ( |
@@ -10516,7 +10516,7 @@ discard block |
||
10516 | 10516 | && |
10517 | 10517 | self::$SUPPORT['mbstring'] === false |
10518 | 10518 | ) { |
10519 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10519 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10520 | 10520 | } |
10521 | 10521 | |
10522 | 10522 | // |
@@ -10604,16 +10604,16 @@ discard block |
||
10604 | 10604 | ) { |
10605 | 10605 | if ($encoding === 'UTF-8') { |
10606 | 10606 | if ($length === null) { |
10607 | - $str1 = (string) \mb_substr($str1, $offset); |
|
10607 | + $str1 = (string)\mb_substr($str1, $offset); |
|
10608 | 10608 | } else { |
10609 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
10609 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
10610 | 10610 | } |
10611 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
10611 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
10612 | 10612 | } else { |
10613 | 10613 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10614 | 10614 | |
10615 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
10616 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
10615 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
10616 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
10617 | 10617 | } |
10618 | 10618 | } |
10619 | 10619 | |
@@ -10675,13 +10675,13 @@ discard block |
||
10675 | 10675 | if ($length_tmp === false) { |
10676 | 10676 | return false; |
10677 | 10677 | } |
10678 | - $length = (int) $length_tmp; |
|
10678 | + $length = (int)$length_tmp; |
|
10679 | 10679 | } |
10680 | 10680 | |
10681 | 10681 | if ($encoding === 'UTF-8') { |
10682 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
10682 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
10683 | 10683 | } else { |
10684 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
10684 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
10685 | 10685 | } |
10686 | 10686 | } |
10687 | 10687 | |
@@ -10690,7 +10690,7 @@ discard block |
||
10690 | 10690 | && |
10691 | 10691 | self::$SUPPORT['mbstring'] === false |
10692 | 10692 | ) { |
10693 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10693 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10694 | 10694 | } |
10695 | 10695 | |
10696 | 10696 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10701,7 +10701,7 @@ discard block |
||
10701 | 10701 | return \mb_substr_count($haystack, $needle, $encoding); |
10702 | 10702 | } |
10703 | 10703 | |
10704 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10704 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10705 | 10705 | |
10706 | 10706 | return \count($matches); |
10707 | 10707 | } |
@@ -10748,7 +10748,7 @@ discard block |
||
10748 | 10748 | if ($length_tmp === false) { |
10749 | 10749 | return false; |
10750 | 10750 | } |
10751 | - $length = (int) $length_tmp; |
|
10751 | + $length = (int)$length_tmp; |
|
10752 | 10752 | } |
10753 | 10753 | |
10754 | 10754 | if ( |
@@ -10770,7 +10770,7 @@ discard block |
||
10770 | 10770 | if ($haystack_tmp === false) { |
10771 | 10771 | $haystack_tmp = ''; |
10772 | 10772 | } |
10773 | - $haystack = (string) $haystack_tmp; |
|
10773 | + $haystack = (string)$haystack_tmp; |
|
10774 | 10774 | } |
10775 | 10775 | |
10776 | 10776 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10809,10 +10809,10 @@ discard block |
||
10809 | 10809 | |
10810 | 10810 | if ($encoding === 'UTF-8') { |
10811 | 10811 | if ($case_sensitive) { |
10812 | - return (int) \mb_substr_count($str, $substring); |
|
10812 | + return (int)\mb_substr_count($str, $substring); |
|
10813 | 10813 | } |
10814 | 10814 | |
10815 | - return (int) \mb_substr_count( |
|
10815 | + return (int)\mb_substr_count( |
|
10816 | 10816 | \mb_strtoupper($str), |
10817 | 10817 | \mb_strtoupper($substring) |
10818 | 10818 | ); |
@@ -10821,10 +10821,10 @@ discard block |
||
10821 | 10821 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10822 | 10822 | |
10823 | 10823 | if ($case_sensitive) { |
10824 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
10824 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
10825 | 10825 | } |
10826 | 10826 | |
10827 | - return (int) \mb_substr_count( |
|
10827 | + return (int)\mb_substr_count( |
|
10828 | 10828 | self::strtocasefold($str, true, false, $encoding, null, false), |
10829 | 10829 | self::strtocasefold($substring, true, false, $encoding, null, false), |
10830 | 10830 | $encoding |
@@ -10850,7 +10850,7 @@ discard block |
||
10850 | 10850 | } |
10851 | 10851 | |
10852 | 10852 | if (self::str_istarts_with($haystack, $needle) === true) { |
10853 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10853 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10854 | 10854 | } |
10855 | 10855 | |
10856 | 10856 | return $haystack; |
@@ -10907,7 +10907,7 @@ discard block |
||
10907 | 10907 | } |
10908 | 10908 | |
10909 | 10909 | if (self::str_iends_with($haystack, $needle) === true) { |
10910 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
10910 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
10911 | 10911 | } |
10912 | 10912 | |
10913 | 10913 | return $haystack; |
@@ -10932,7 +10932,7 @@ discard block |
||
10932 | 10932 | } |
10933 | 10933 | |
10934 | 10934 | if (self::str_starts_with($haystack, $needle) === true) { |
10935 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10935 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10936 | 10936 | } |
10937 | 10937 | |
10938 | 10938 | return $haystack; |
@@ -10984,7 +10984,7 @@ discard block |
||
10984 | 10984 | if (\is_array($offset) === true) { |
10985 | 10985 | $offset = \array_slice($offset, 0, $num); |
10986 | 10986 | foreach ($offset as &$value_tmp) { |
10987 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
10987 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
10988 | 10988 | } |
10989 | 10989 | unset($value_tmp); |
10990 | 10990 | } else { |
@@ -10997,7 +10997,7 @@ discard block |
||
10997 | 10997 | } elseif (\is_array($length) === true) { |
10998 | 10998 | $length = \array_slice($length, 0, $num); |
10999 | 10999 | foreach ($length as &$value_tmp_V2) { |
11000 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
11000 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
11001 | 11001 | } |
11002 | 11002 | unset($value_tmp_V2); |
11003 | 11003 | } else { |
@@ -11017,8 +11017,8 @@ discard block |
||
11017 | 11017 | } |
11018 | 11018 | |
11019 | 11019 | // init |
11020 | - $str = (string) $str; |
|
11021 | - $replacement = (string) $replacement; |
|
11020 | + $str = (string)$str; |
|
11021 | + $replacement = (string)$replacement; |
|
11022 | 11022 | |
11023 | 11023 | if (\is_array($length) === true) { |
11024 | 11024 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -11033,16 +11033,16 @@ discard block |
||
11033 | 11033 | } |
11034 | 11034 | |
11035 | 11035 | if (self::$SUPPORT['mbstring'] === true) { |
11036 | - $string_length = (int) self::strlen($str, $encoding); |
|
11036 | + $string_length = (int)self::strlen($str, $encoding); |
|
11037 | 11037 | |
11038 | 11038 | if ($offset < 0) { |
11039 | - $offset = (int) \max(0, $string_length + $offset); |
|
11039 | + $offset = (int)\max(0, $string_length + $offset); |
|
11040 | 11040 | } elseif ($offset > $string_length) { |
11041 | 11041 | $offset = $string_length; |
11042 | 11042 | } |
11043 | 11043 | |
11044 | 11044 | if ($length !== null && $length < 0) { |
11045 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
11045 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
11046 | 11046 | } elseif ($length === null || $length > $string_length) { |
11047 | 11047 | $length = $string_length; |
11048 | 11048 | } |
@@ -11053,9 +11053,9 @@ discard block |
||
11053 | 11053 | } |
11054 | 11054 | |
11055 | 11055 | /** @noinspection AdditionOperationOnArraysInspection */ |
11056 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
11057 | - $replacement . |
|
11058 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
11056 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
11057 | + $replacement. |
|
11058 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
11059 | 11059 | } |
11060 | 11060 | |
11061 | 11061 | // |
@@ -11064,8 +11064,7 @@ discard block |
||
11064 | 11064 | |
11065 | 11065 | if (ASCII::is_ascii($str)) { |
11066 | 11066 | return ($length === null) ? |
11067 | - \substr_replace($str, $replacement, $offset) : |
|
11068 | - \substr_replace($str, $replacement, $offset, $length); |
|
11067 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
11069 | 11068 | } |
11070 | 11069 | |
11071 | 11070 | // |
@@ -11081,7 +11080,7 @@ discard block |
||
11081 | 11080 | // e.g.: non mbstring support + invalid chars |
11082 | 11081 | return ''; |
11083 | 11082 | } |
11084 | - $length = (int) $length_tmp; |
|
11083 | + $length = (int)$length_tmp; |
|
11085 | 11084 | } |
11086 | 11085 | |
11087 | 11086 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -11116,14 +11115,14 @@ discard block |
||
11116 | 11115 | && |
11117 | 11116 | \substr($haystack, -\strlen($needle)) === $needle |
11118 | 11117 | ) { |
11119 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
11118 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
11120 | 11119 | } |
11121 | 11120 | |
11122 | 11121 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
11123 | - return (string) self::substr( |
|
11122 | + return (string)self::substr( |
|
11124 | 11123 | $haystack, |
11125 | 11124 | 0, |
11126 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
11125 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
11127 | 11126 | $encoding |
11128 | 11127 | ); |
11129 | 11128 | } |
@@ -11153,10 +11152,10 @@ discard block |
||
11153 | 11152 | } |
11154 | 11153 | |
11155 | 11154 | if ($encoding === 'UTF-8') { |
11156 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
11155 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
11157 | 11156 | } |
11158 | 11157 | |
11159 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
11158 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
11160 | 11159 | } |
11161 | 11160 | |
11162 | 11161 | /** |
@@ -11344,7 +11343,7 @@ discard block |
||
11344 | 11343 | public static function to_boolean($str): bool |
11345 | 11344 | { |
11346 | 11345 | // init |
11347 | - $str = (string) $str; |
|
11346 | + $str = (string)$str; |
|
11348 | 11347 | |
11349 | 11348 | if ($str === '') { |
11350 | 11349 | return false; |
@@ -11372,10 +11371,10 @@ discard block |
||
11372 | 11371 | } |
11373 | 11372 | |
11374 | 11373 | if (\is_numeric($str)) { |
11375 | - return ((float) $str + 0) > 0; |
|
11374 | + return ((float)$str + 0) > 0; |
|
11376 | 11375 | } |
11377 | 11376 | |
11378 | - return (bool) \trim($str); |
|
11377 | + return (bool)\trim($str); |
|
11379 | 11378 | } |
11380 | 11379 | |
11381 | 11380 | /** |
@@ -11417,7 +11416,7 @@ discard block |
||
11417 | 11416 | return $str; |
11418 | 11417 | } |
11419 | 11418 | |
11420 | - $str = (string) $str; |
|
11419 | + $str = (string)$str; |
|
11421 | 11420 | if ($str === '') { |
11422 | 11421 | return ''; |
11423 | 11422 | } |
@@ -11465,7 +11464,7 @@ discard block |
||
11465 | 11464 | return $str; |
11466 | 11465 | } |
11467 | 11466 | |
11468 | - $str = (string) $str; |
|
11467 | + $str = (string)$str; |
|
11469 | 11468 | if ($str === '') { |
11470 | 11469 | return $str; |
11471 | 11470 | } |
@@ -11483,7 +11482,7 @@ discard block |
||
11483 | 11482 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
11484 | 11483 | |
11485 | 11484 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11486 | - $buf .= $c1 . $c2; |
|
11485 | + $buf .= $c1.$c2; |
|
11487 | 11486 | ++$i; |
11488 | 11487 | } else { // not valid UTF8 - convert it |
11489 | 11488 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11494,7 +11493,7 @@ discard block |
||
11494 | 11493 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
11495 | 11494 | |
11496 | 11495 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11497 | - $buf .= $c1 . $c2 . $c3; |
|
11496 | + $buf .= $c1.$c2.$c3; |
|
11498 | 11497 | $i += 2; |
11499 | 11498 | } else { // not valid UTF8 - convert it |
11500 | 11499 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11506,7 +11505,7 @@ discard block |
||
11506 | 11505 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
11507 | 11506 | |
11508 | 11507 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11509 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
11508 | + $buf .= $c1.$c2.$c3.$c4; |
|
11510 | 11509 | $i += 3; |
11511 | 11510 | } else { // not valid UTF8 - convert it |
11512 | 11511 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11532,13 +11531,13 @@ discard block |
||
11532 | 11531 | * |
11533 | 11532 | * @return string |
11534 | 11533 | */ |
11535 | - static function (array $matches): string { |
|
11534 | + static function(array $matches): string { |
|
11536 | 11535 | if (isset($matches[3])) { |
11537 | - $cp = (int) \hexdec($matches[3]); |
|
11536 | + $cp = (int)\hexdec($matches[3]); |
|
11538 | 11537 | } else { |
11539 | 11538 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
11540 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
11541 | - + (int) \hexdec($matches[2]) |
|
11539 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
11540 | + + (int)\hexdec($matches[2]) |
|
11542 | 11541 | + 0x10000 |
11543 | 11542 | - (0xD800 << 10) |
11544 | 11543 | - 0xDC00; |
@@ -11549,12 +11548,12 @@ discard block |
||
11549 | 11548 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
11550 | 11549 | |
11551 | 11550 | if ($cp < 0x80) { |
11552 | - return (string) self::chr($cp); |
|
11551 | + return (string)self::chr($cp); |
|
11553 | 11552 | } |
11554 | 11553 | |
11555 | 11554 | if ($cp < 0xA0) { |
11556 | 11555 | /** @noinspection UnnecessaryCastingInspection */ |
11557 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
11556 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
11558 | 11557 | } |
11559 | 11558 | |
11560 | 11559 | return self::decimal_to_chr($cp); |
@@ -11603,7 +11602,7 @@ discard block |
||
11603 | 11602 | } |
11604 | 11603 | |
11605 | 11604 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11606 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
11605 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
11607 | 11606 | } |
11608 | 11607 | |
11609 | 11608 | if ($chars) { |
@@ -11647,15 +11646,15 @@ discard block |
||
11647 | 11646 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
11648 | 11647 | |
11649 | 11648 | if ($encoding === 'UTF-8') { |
11650 | - $str_part_two = (string) \mb_substr($str, 1); |
|
11649 | + $str_part_two = (string)\mb_substr($str, 1); |
|
11651 | 11650 | |
11652 | 11651 | if ($use_mb_functions === true) { |
11653 | 11652 | $str_part_one = \mb_strtoupper( |
11654 | - (string) \mb_substr($str, 0, 1) |
|
11653 | + (string)\mb_substr($str, 0, 1) |
|
11655 | 11654 | ); |
11656 | 11655 | } else { |
11657 | 11656 | $str_part_one = self::strtoupper( |
11658 | - (string) \mb_substr($str, 0, 1), |
|
11657 | + (string)\mb_substr($str, 0, 1), |
|
11659 | 11658 | $encoding, |
11660 | 11659 | false, |
11661 | 11660 | $lang, |
@@ -11665,16 +11664,16 @@ discard block |
||
11665 | 11664 | } else { |
11666 | 11665 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11667 | 11666 | |
11668 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
11667 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
11669 | 11668 | |
11670 | 11669 | if ($use_mb_functions === true) { |
11671 | 11670 | $str_part_one = \mb_strtoupper( |
11672 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
11671 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
11673 | 11672 | $encoding |
11674 | 11673 | ); |
11675 | 11674 | } else { |
11676 | 11675 | $str_part_one = self::strtoupper( |
11677 | - (string) self::substr($str, 0, 1, $encoding), |
|
11676 | + (string)self::substr($str, 0, 1, $encoding), |
|
11678 | 11677 | $encoding, |
11679 | 11678 | false, |
11680 | 11679 | $lang, |
@@ -11683,7 +11682,7 @@ discard block |
||
11683 | 11682 | } |
11684 | 11683 | } |
11685 | 11684 | |
11686 | - return $str_part_one . $str_part_two; |
|
11685 | + return $str_part_one.$str_part_two; |
|
11687 | 11686 | } |
11688 | 11687 | |
11689 | 11688 | /** |
@@ -11738,7 +11737,7 @@ discard block |
||
11738 | 11737 | $str = self::clean($str); |
11739 | 11738 | } |
11740 | 11739 | |
11741 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
11740 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
11742 | 11741 | |
11743 | 11742 | if ( |
11744 | 11743 | $use_php_default_functions === true |
@@ -12143,7 +12142,7 @@ discard block |
||
12143 | 12142 | if ( |
12144 | 12143 | $keep_utf8_chars === true |
12145 | 12144 | && |
12146 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
12145 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
12147 | 12146 | ) { |
12148 | 12147 | return $str_backup; |
12149 | 12148 | } |
@@ -12222,17 +12221,17 @@ discard block |
||
12222 | 12221 | return ''; |
12223 | 12222 | } |
12224 | 12223 | |
12225 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
12224 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
12226 | 12225 | |
12227 | 12226 | if ( |
12228 | 12227 | !isset($matches[0]) |
12229 | 12228 | || |
12230 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
12229 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
12231 | 12230 | ) { |
12232 | 12231 | return $str; |
12233 | 12232 | } |
12234 | 12233 | |
12235 | - return \rtrim($matches[0]) . $str_add_on; |
|
12234 | + return \rtrim($matches[0]).$str_add_on; |
|
12236 | 12235 | } |
12237 | 12236 | |
12238 | 12237 | /** |
@@ -12319,7 +12318,7 @@ discard block |
||
12319 | 12318 | } |
12320 | 12319 | } |
12321 | 12320 | |
12322 | - return $str_return . \implode('', $chars); |
|
12321 | + return $str_return.\implode('', $chars); |
|
12323 | 12322 | } |
12324 | 12323 | |
12325 | 12324 | /** |
@@ -12371,7 +12370,7 @@ discard block |
||
12371 | 12370 | $final_break = ''; |
12372 | 12371 | } |
12373 | 12372 | |
12374 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
12373 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
12375 | 12374 | } |
12376 | 12375 | |
12377 | 12376 | /** |
@@ -12593,7 +12592,7 @@ discard block |
||
12593 | 12592 | /** @noinspection PhpIncludeInspection */ |
12594 | 12593 | /** @noinspection UsingInclusionReturnValueInspection */ |
12595 | 12594 | /** @psalm-suppress UnresolvableInclude */ |
12596 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
12595 | + return include __DIR__.'/data/'.$file.'.php'; |
|
12597 | 12596 | } |
12598 | 12597 | |
12599 | 12598 | /** |
@@ -12608,7 +12607,7 @@ discard block |
||
12608 | 12607 | |
12609 | 12608 | \uksort( |
12610 | 12609 | self::$EMOJI, |
12611 | - static function (string $a, string $b): int { |
|
12610 | + static function(string $a, string $b): int { |
|
12612 | 12611 | return \strlen($b) <=> \strlen($a); |
12613 | 12612 | } |
12614 | 12613 | ); |
@@ -12618,7 +12617,7 @@ discard block |
||
12618 | 12617 | |
12619 | 12618 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
12620 | 12619 | $tmp_key = \crc32($key); |
12621 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
12620 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
12622 | 12621 | } |
12623 | 12622 | |
12624 | 12623 | return true; |
@@ -12644,7 +12643,7 @@ discard block |
||
12644 | 12643 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
12645 | 12644 | return \defined('MB_OVERLOAD_STRING') |
12646 | 12645 | && |
12647 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12646 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12648 | 12647 | } |
12649 | 12648 | |
12650 | 12649 | /** |
@@ -12701,7 +12700,7 @@ discard block |
||
12701 | 12700 | { |
12702 | 12701 | static $RX_CLASS_CACHE = []; |
12703 | 12702 | |
12704 | - $cache_key = $s . $class; |
|
12703 | + $cache_key = $s.$class; |
|
12705 | 12704 | |
12706 | 12705 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
12707 | 12706 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -12713,7 +12712,7 @@ discard block |
||
12713 | 12712 | /** @noinspection AlterInForeachInspection */ |
12714 | 12713 | foreach (self::str_split($s) as &$s) { |
12715 | 12714 | if ($s === '-') { |
12716 | - $class_array[0] = '-' . $class_array[0]; |
|
12715 | + $class_array[0] = '-'.$class_array[0]; |
|
12717 | 12716 | } elseif (!isset($s[2])) { |
12718 | 12717 | $class_array[0] .= \preg_quote($s, '/'); |
12719 | 12718 | } elseif (self::strlen($s) === 1) { |
@@ -12724,13 +12723,13 @@ discard block |
||
12724 | 12723 | } |
12725 | 12724 | |
12726 | 12725 | if ($class_array[0]) { |
12727 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
12726 | + $class_array[0] = '['.$class_array[0].']'; |
|
12728 | 12727 | } |
12729 | 12728 | |
12730 | 12729 | if (\count($class_array) === 1) { |
12731 | 12730 | $return = $class_array[0]; |
12732 | 12731 | } else { |
12733 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
12732 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
12734 | 12733 | } |
12735 | 12734 | |
12736 | 12735 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -12809,7 +12808,7 @@ discard block |
||
12809 | 12808 | |
12810 | 12809 | if ($delimiter === '-') { |
12811 | 12810 | /** @noinspection AlterInForeachInspection */ |
12812 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
12811 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
12813 | 12812 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12814 | 12813 | $continue = true; |
12815 | 12814 | } |
@@ -12817,7 +12816,7 @@ discard block |
||
12817 | 12816 | } |
12818 | 12817 | |
12819 | 12818 | /** @noinspection AlterInForeachInspection */ |
12820 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
12819 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
12821 | 12820 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12822 | 12821 | $continue = true; |
12823 | 12822 | } |
@@ -12880,8 +12879,8 @@ discard block |
||
12880 | 12879 | } else { |
12881 | 12880 | /** @noinspection OffsetOperationsInspection */ |
12882 | 12881 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
12883 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
12884 | - $buf .= $cc1 . $cc2; |
|
12882 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
12883 | + $buf .= $cc1.$cc2; |
|
12885 | 12884 | } |
12886 | 12885 | |
12887 | 12886 | return $buf; |
@@ -12898,7 +12897,7 @@ discard block |
||
12898 | 12897 | { |
12899 | 12898 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
12900 | 12899 | if (\preg_match($pattern, $str)) { |
12901 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
12900 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
12902 | 12901 | } |
12903 | 12902 | |
12904 | 12903 | return $str; |