@@ -602,22 +602,22 @@ discard block |
||
602 | 602 | * @psalm-suppress PossiblyNullArrayAccess |
603 | 603 | */ |
604 | 604 | $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
605 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
605 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
606 | 606 | } elseif ($code_point <= 0xFFFF) { |
607 | 607 | /** |
608 | 608 | * @psalm-suppress PossiblyNullArrayAccess |
609 | 609 | */ |
610 | 610 | $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
611 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
612 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
611 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
612 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
613 | 613 | } else { |
614 | 614 | /** |
615 | 615 | * @psalm-suppress PossiblyNullArrayAccess |
616 | 616 | */ |
617 | 617 | $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
618 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
619 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
620 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
618 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
619 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
620 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
621 | 621 | } |
622 | 622 | |
623 | 623 | if ($encoding !== 'UTF-8') { |
@@ -5804,8 +5804,8 @@ discard block |
||
5804 | 5804 | |
5805 | 5805 | /** @noinspection UnnecessaryCastingInspection */ |
5806 | 5806 | return (string) \mb_substr($str, 0, $index) . |
5807 | - $substring . |
|
5808 | - (string) \mb_substr($str, $index, $len); |
|
5807 | + $substring . |
|
5808 | + (string) \mb_substr($str, $index, $len); |
|
5809 | 5809 | } |
5810 | 5810 | |
5811 | 5811 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -5816,8 +5816,8 @@ discard block |
||
5816 | 5816 | } |
5817 | 5817 | |
5818 | 5818 | return ((string) self::substr($str, 0, $index, $encoding)) . |
5819 | - $substring . |
|
5820 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5819 | + $substring . |
|
5820 | + ((string) self::substr($str, $index, $len, $encoding)); |
|
5821 | 5821 | } |
5822 | 5822 | |
5823 | 5823 | /** |
@@ -7757,11 +7757,11 @@ discard block |
||
7757 | 7757 | if ($useMbFunction === true) { |
7758 | 7758 | if ($encoding === 'UTF-8') { |
7759 | 7759 | return \mb_strtoupper(\mb_substr($match[0], 0, 1)) |
7760 | - . \mb_strtolower(\mb_substr($match[0], 1)); |
|
7760 | + . \mb_strtolower(\mb_substr($match[0], 1)); |
|
7761 | 7761 | } |
7762 | 7762 | |
7763 | 7763 | return \mb_strtoupper(\mb_substr($match[0], 0, 1, $encoding), $encoding) |
7764 | - . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
7764 | + . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
7765 | 7765 | } |
7766 | 7766 | |
7767 | 7767 | return self::ucfirst( |
@@ -8118,13 +8118,13 @@ discard block |
||
8118 | 8118 | } |
8119 | 8119 | |
8120 | 8120 | return ( |
8121 | - (string) self::substr( |
|
8122 | - $str, |
|
8123 | - 0, |
|
8124 | - $length, |
|
8125 | - $encoding |
|
8126 | - ) |
|
8127 | - ) . $substring; |
|
8121 | + (string) self::substr( |
|
8122 | + $str, |
|
8123 | + 0, |
|
8124 | + $length, |
|
8125 | + $encoding |
|
8126 | + ) |
|
8127 | + ) . $substring; |
|
8128 | 8128 | } |
8129 | 8129 | |
8130 | 8130 | /** |
@@ -10864,8 +10864,8 @@ discard block |
||
10864 | 10864 | |
10865 | 10865 | /** @noinspection AdditionOperationOnArraysInspection */ |
10866 | 10866 | return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
10867 | - $replacement . |
|
10868 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10867 | + $replacement . |
|
10868 | + ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10869 | 10869 | } |
10870 | 10870 | |
10871 | 10871 | // |
@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | } |
261 | 261 | |
262 | 262 | if ($encoding === 'UTF-8') { |
263 | - return (string) \mb_substr($str, $pos, 1); |
|
263 | + return (string)\mb_substr($str, $pos, 1); |
|
264 | 264 | } |
265 | 265 | |
266 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
266 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | public static function add_bom_to_string(string $str): string |
279 | 279 | { |
280 | 280 | if (self::string_has_bom($str) === false) { |
281 | - $str = self::bom() . $str; |
|
281 | + $str = self::bom().$str; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | return $str; |
@@ -307,8 +307,8 @@ discard block |
||
307 | 307 | $return = []; |
308 | 308 | foreach ($array as $key => &$value) { |
309 | 309 | $key = $case === \CASE_LOWER |
310 | - ? self::strtolower((string) $key, $encoding) |
|
311 | - : self::strtoupper((string) $key, $encoding); |
|
310 | + ? self::strtolower((string)$key, $encoding) |
|
311 | + : self::strtoupper((string)$key, $encoding); |
|
312 | 312 | |
313 | 313 | $return[$key] = $value; |
314 | 314 | } |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | return ''; |
343 | 343 | } |
344 | 344 | |
345 | - $substrIndex = $posStart + (int) \mb_strlen($start); |
|
345 | + $substrIndex = $posStart + (int)\mb_strlen($start); |
|
346 | 346 | $posEnd = \mb_strpos($str, $end, $substrIndex); |
347 | 347 | if ( |
348 | 348 | $posEnd === false |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | return ''; |
353 | 353 | } |
354 | 354 | |
355 | - return (string) \mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
355 | + return (string)\mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | return ''; |
363 | 363 | } |
364 | 364 | |
365 | - $substrIndex = $posStart + (int) self::strlen($start, $encoding); |
|
365 | + $substrIndex = $posStart + (int)self::strlen($start, $encoding); |
|
366 | 366 | $posEnd = self::strpos($str, $end, $substrIndex, $encoding); |
367 | 367 | if ( |
368 | 368 | $posEnd === false |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | return ''; |
373 | 373 | } |
374 | 374 | |
375 | - return (string) self::substr( |
|
375 | + return (string)self::substr( |
|
376 | 376 | $str, |
377 | 377 | $substrIndex, |
378 | 378 | $posEnd - $substrIndex, |
@@ -440,10 +440,10 @@ discard block |
||
440 | 440 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
441 | 441 | { |
442 | 442 | if ($encoding === 'UTF-8') { |
443 | - return (string) \mb_substr($str, $index, 1); |
|
443 | + return (string)\mb_substr($str, $index, 1); |
|
444 | 444 | } |
445 | 445 | |
446 | - return (string) self::substr($str, $index, 1, $encoding); |
|
446 | + return (string)self::substr($str, $index, 1, $encoding); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
@@ -542,10 +542,10 @@ discard block |
||
542 | 542 | && |
543 | 543 | self::$SUPPORT['mbstring'] === false |
544 | 544 | ) { |
545 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
545 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
546 | 546 | } |
547 | 547 | |
548 | - $cacheKey = $code_point . $encoding; |
|
548 | + $cacheKey = $code_point.$encoding; |
|
549 | 549 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
550 | 550 | return $CHAR_CACHE[$cacheKey]; |
551 | 551 | } |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | if ($code_point <= 127) { // use "simple"-char only until "\x80" |
554 | 554 | |
555 | 555 | if (self::$CHR === null) { |
556 | - self::$CHR = (array) self::getData('chr'); |
|
556 | + self::$CHR = (array)self::getData('chr'); |
|
557 | 557 | } |
558 | 558 | |
559 | 559 | /** |
@@ -588,10 +588,10 @@ discard block |
||
588 | 588 | // |
589 | 589 | |
590 | 590 | if (self::$CHR === null) { |
591 | - self::$CHR = (array) self::getData('chr'); |
|
591 | + self::$CHR = (array)self::getData('chr'); |
|
592 | 592 | } |
593 | 593 | |
594 | - $code_point = (int) $code_point; |
|
594 | + $code_point = (int)$code_point; |
|
595 | 595 | if ($code_point <= 0x7F) { |
596 | 596 | /** |
597 | 597 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -601,22 +601,22 @@ discard block |
||
601 | 601 | /** |
602 | 602 | * @psalm-suppress PossiblyNullArrayAccess |
603 | 603 | */ |
604 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
604 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
605 | 605 | self::$CHR[($code_point & 0x3F) + 0x80]; |
606 | 606 | } elseif ($code_point <= 0xFFFF) { |
607 | 607 | /** |
608 | 608 | * @psalm-suppress PossiblyNullArrayAccess |
609 | 609 | */ |
610 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
611 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
610 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
611 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
612 | 612 | self::$CHR[($code_point & 0x3F) + 0x80]; |
613 | 613 | } else { |
614 | 614 | /** |
615 | 615 | * @psalm-suppress PossiblyNullArrayAccess |
616 | 616 | */ |
617 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
618 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
619 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
617 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
618 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
619 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
620 | 620 | self::$CHR[($code_point & 0x3F) + 0x80]; |
621 | 621 | } |
622 | 622 | |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | |
664 | 664 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
665 | 665 | return \array_map( |
666 | - static function (string $data): int { |
|
666 | + static function(string $data): int { |
|
667 | 667 | // "mb_" is available if overload is used, so use it ... |
668 | 668 | return \mb_strlen($data, 'CP850'); // 8-BIT |
669 | 669 | }, |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | $char = ''; |
732 | 732 | } |
733 | 733 | |
734 | - return self::int_to_hex(self::ord((string) $char), $pfix); |
|
734 | + return self::int_to_hex(self::ord((string)$char), $pfix); |
|
735 | 735 | } |
736 | 736 | |
737 | 737 | /** |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | | ( [\x80-\xBF] ) # invalid byte in range 10000000 - 10111111 |
806 | 806 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
807 | 807 | /x'; |
808 | - $str = (string) \preg_replace($regx, '$1', $str); |
|
808 | + $str = (string)\preg_replace($regx, '$1', $str); |
|
809 | 809 | |
810 | 810 | if ($replace_diamond_question_mark === true) { |
811 | 811 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | public static function cleanup($str): string |
841 | 841 | { |
842 | 842 | // init |
843 | - $str = (string) $str; |
|
843 | + $str = (string)$str; |
|
844 | 844 | |
845 | 845 | if ($str === '') { |
846 | 846 | return ''; |
@@ -923,7 +923,7 @@ discard block |
||
923 | 923 | { |
924 | 924 | if (self::$SUPPORT['mbstring'] === true) { |
925 | 925 | /** @noinspection PhpComposerExtensionStubsInspection */ |
926 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
926 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
927 | 927 | } |
928 | 928 | |
929 | 929 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | */ |
964 | 964 | public static function css_stripe_media_queries(string $str): string |
965 | 965 | { |
966 | - return (string) \preg_replace( |
|
966 | + return (string)\preg_replace( |
|
967 | 967 | '#@media\\s+(?:only\\s)?(?:[\\s{\\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
968 | 968 | '', |
969 | 969 | $str |
@@ -990,7 +990,7 @@ discard block |
||
990 | 990 | */ |
991 | 991 | public static function decimal_to_chr($int): string |
992 | 992 | { |
993 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
993 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
994 | 994 | } |
995 | 995 | |
996 | 996 | /** |
@@ -1035,16 +1035,16 @@ discard block |
||
1035 | 1035 | self::initEmojiData(); |
1036 | 1036 | |
1037 | 1037 | if ($useReversibleStringMapping === true) { |
1038 | - return (string) \str_replace( |
|
1039 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1040 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1038 | + return (string)\str_replace( |
|
1039 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1040 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1041 | 1041 | $str |
1042 | 1042 | ); |
1043 | 1043 | } |
1044 | 1044 | |
1045 | - return (string) \str_replace( |
|
1046 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1047 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1045 | + return (string)\str_replace( |
|
1046 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1047 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1048 | 1048 | $str |
1049 | 1049 | ); |
1050 | 1050 | } |
@@ -1064,16 +1064,16 @@ discard block |
||
1064 | 1064 | self::initEmojiData(); |
1065 | 1065 | |
1066 | 1066 | if ($useReversibleStringMapping === true) { |
1067 | - return (string) \str_replace( |
|
1068 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1069 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1067 | + return (string)\str_replace( |
|
1068 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1069 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1070 | 1070 | $str |
1071 | 1071 | ); |
1072 | 1072 | } |
1073 | 1073 | |
1074 | - return (string) \str_replace( |
|
1075 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1076 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1074 | + return (string)\str_replace( |
|
1075 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1076 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1077 | 1077 | $str |
1078 | 1078 | ); |
1079 | 1079 | } |
@@ -1127,7 +1127,7 @@ discard block |
||
1127 | 1127 | if ($toEncoding === 'JSON') { |
1128 | 1128 | $return = self::json_encode($str); |
1129 | 1129 | if ($return === false) { |
1130 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1130 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1131 | 1131 | } |
1132 | 1132 | |
1133 | 1133 | return $return; |
@@ -1213,7 +1213,7 @@ discard block |
||
1213 | 1213 | && |
1214 | 1214 | self::$SUPPORT['mbstring'] === false |
1215 | 1215 | ) { |
1216 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $toEncoding . '" encoding', \E_USER_WARNING); |
|
1216 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$toEncoding.'" encoding', \E_USER_WARNING); |
|
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1307,31 +1307,31 @@ discard block |
||
1307 | 1307 | $trimChars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1308 | 1308 | |
1309 | 1309 | if ($length === null) { |
1310 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
1310 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
1311 | 1311 | } |
1312 | 1312 | |
1313 | 1313 | if ($search === '') { |
1314 | 1314 | if ($encoding === 'UTF-8') { |
1315 | 1315 | if ($length > 0) { |
1316 | - $stringLength = (int) \mb_strlen($str); |
|
1316 | + $stringLength = (int)\mb_strlen($str); |
|
1317 | 1317 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
1318 | 1318 | } else { |
1319 | 1319 | $end = 0; |
1320 | 1320 | } |
1321 | 1321 | |
1322 | - $pos = (int) \min( |
|
1322 | + $pos = (int)\min( |
|
1323 | 1323 | \mb_strpos($str, ' ', $end), |
1324 | 1324 | \mb_strpos($str, '.', $end) |
1325 | 1325 | ); |
1326 | 1326 | } else { |
1327 | 1327 | if ($length > 0) { |
1328 | - $stringLength = (int) self::strlen($str, $encoding); |
|
1328 | + $stringLength = (int)self::strlen($str, $encoding); |
|
1329 | 1329 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
1330 | 1330 | } else { |
1331 | 1331 | $end = 0; |
1332 | 1332 | } |
1333 | 1333 | |
1334 | - $pos = (int) \min( |
|
1334 | + $pos = (int)\min( |
|
1335 | 1335 | self::strpos($str, ' ', $end, $encoding), |
1336 | 1336 | self::strpos($str, '.', $end, $encoding) |
1337 | 1337 | ); |
@@ -1348,18 +1348,18 @@ discard block |
||
1348 | 1348 | return ''; |
1349 | 1349 | } |
1350 | 1350 | |
1351 | - return \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1351 | + return \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1352 | 1352 | } |
1353 | 1353 | |
1354 | 1354 | return $str; |
1355 | 1355 | } |
1356 | 1356 | |
1357 | 1357 | if ($encoding === 'UTF-8') { |
1358 | - $wordPos = (int) \mb_stripos($str, $search); |
|
1359 | - $halfSide = (int) ($wordPos - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1358 | + $wordPos = (int)\mb_stripos($str, $search); |
|
1359 | + $halfSide = (int)($wordPos - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1360 | 1360 | } else { |
1361 | - $wordPos = (int) self::stripos($str, $search, 0, $encoding); |
|
1362 | - $halfSide = (int) ($wordPos - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1361 | + $wordPos = (int)self::stripos($str, $search, 0, $encoding); |
|
1362 | + $halfSide = (int)($wordPos - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1363 | 1363 | } |
1364 | 1364 | |
1365 | 1365 | $pos_start = 0; |
@@ -1371,12 +1371,12 @@ discard block |
||
1371 | 1371 | } |
1372 | 1372 | if ($halfText !== false) { |
1373 | 1373 | if ($encoding === 'UTF-8') { |
1374 | - $pos_start = (int) \max( |
|
1374 | + $pos_start = (int)\max( |
|
1375 | 1375 | \mb_strrpos($halfText, ' '), |
1376 | 1376 | \mb_strrpos($halfText, '.') |
1377 | 1377 | ); |
1378 | 1378 | } else { |
1379 | - $pos_start = (int) \max( |
|
1379 | + $pos_start = (int)\max( |
|
1380 | 1380 | self::strrpos($halfText, ' ', 0, $encoding), |
1381 | 1381 | self::strrpos($halfText, '.', 0, $encoding) |
1382 | 1382 | ); |
@@ -1386,19 +1386,19 @@ discard block |
||
1386 | 1386 | |
1387 | 1387 | if ($wordPos && $halfSide > 0) { |
1388 | 1388 | $offset = $pos_start + $length - 1; |
1389 | - $realLength = (int) self::strlen($str, $encoding); |
|
1389 | + $realLength = (int)self::strlen($str, $encoding); |
|
1390 | 1390 | |
1391 | 1391 | if ($offset > $realLength) { |
1392 | 1392 | $offset = $realLength; |
1393 | 1393 | } |
1394 | 1394 | |
1395 | 1395 | if ($encoding === 'UTF-8') { |
1396 | - $pos_end = (int) \min( |
|
1396 | + $pos_end = (int)\min( |
|
1397 | 1397 | \mb_strpos($str, ' ', $offset), |
1398 | 1398 | \mb_strpos($str, '.', $offset) |
1399 | 1399 | ) - $pos_start; |
1400 | 1400 | } else { |
1401 | - $pos_end = (int) \min( |
|
1401 | + $pos_end = (int)\min( |
|
1402 | 1402 | self::strpos($str, ' ', $offset, $encoding), |
1403 | 1403 | self::strpos($str, '.', $offset, $encoding) |
1404 | 1404 | ) - $pos_start; |
@@ -1406,12 +1406,12 @@ discard block |
||
1406 | 1406 | |
1407 | 1407 | if (!$pos_end || $pos_end <= 0) { |
1408 | 1408 | if ($encoding === 'UTF-8') { |
1409 | - $strSub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1409 | + $strSub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1410 | 1410 | } else { |
1411 | - $strSub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1411 | + $strSub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1412 | 1412 | } |
1413 | 1413 | if ($strSub !== false) { |
1414 | - $extract = $replacerForSkippedText . \ltrim($strSub, $trimChars); |
|
1414 | + $extract = $replacerForSkippedText.\ltrim($strSub, $trimChars); |
|
1415 | 1415 | } else { |
1416 | 1416 | $extract = ''; |
1417 | 1417 | } |
@@ -1422,26 +1422,26 @@ discard block |
||
1422 | 1422 | $strSub = self::substr($str, $pos_start, $pos_end, $encoding); |
1423 | 1423 | } |
1424 | 1424 | if ($strSub !== false) { |
1425 | - $extract = $replacerForSkippedText . \trim($strSub, $trimChars) . $replacerForSkippedText; |
|
1425 | + $extract = $replacerForSkippedText.\trim($strSub, $trimChars).$replacerForSkippedText; |
|
1426 | 1426 | } else { |
1427 | 1427 | $extract = ''; |
1428 | 1428 | } |
1429 | 1429 | } |
1430 | 1430 | } else { |
1431 | 1431 | $offset = $length - 1; |
1432 | - $trueLength = (int) self::strlen($str, $encoding); |
|
1432 | + $trueLength = (int)self::strlen($str, $encoding); |
|
1433 | 1433 | |
1434 | 1434 | if ($offset > $trueLength) { |
1435 | 1435 | $offset = $trueLength; |
1436 | 1436 | } |
1437 | 1437 | |
1438 | 1438 | if ($encoding === 'UTF-8') { |
1439 | - $pos_end = (int) \min( |
|
1439 | + $pos_end = (int)\min( |
|
1440 | 1440 | \mb_strpos($str, ' ', $offset), |
1441 | 1441 | \mb_strpos($str, '.', $offset) |
1442 | 1442 | ); |
1443 | 1443 | } else { |
1444 | - $pos_end = (int) \min( |
|
1444 | + $pos_end = (int)\min( |
|
1445 | 1445 | self::strpos($str, ' ', $offset, $encoding), |
1446 | 1446 | self::strpos($str, '.', $offset, $encoding) |
1447 | 1447 | ); |
@@ -1454,7 +1454,7 @@ discard block |
||
1454 | 1454 | $strSub = self::substr($str, 0, $pos_end, $encoding); |
1455 | 1455 | } |
1456 | 1456 | if ($strSub !== false) { |
1457 | - $extract = \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1457 | + $extract = \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1458 | 1458 | } else { |
1459 | 1459 | $extract = ''; |
1460 | 1460 | } |
@@ -1578,7 +1578,7 @@ discard block |
||
1578 | 1578 | { |
1579 | 1579 | $file_content = \file_get_contents($file_path); |
1580 | 1580 | if ($file_content === false) { |
1581 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1581 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1582 | 1582 | } |
1583 | 1583 | |
1584 | 1584 | return self::string_has_bom($file_content); |
@@ -1639,7 +1639,7 @@ discard block |
||
1639 | 1639 | ) { |
1640 | 1640 | // Prevent leading combining chars |
1641 | 1641 | // for NFC-safe concatenations. |
1642 | - $var = $leading_combining . $var; |
|
1642 | + $var = $leading_combining.$var; |
|
1643 | 1643 | } |
1644 | 1644 | } |
1645 | 1645 | |
@@ -1878,10 +1878,10 @@ discard block |
||
1878 | 1878 | } |
1879 | 1879 | |
1880 | 1880 | if ($encoding === 'UTF-8') { |
1881 | - return (string) \mb_substr($str, 0, $n); |
|
1881 | + return (string)\mb_substr($str, 0, $n); |
|
1882 | 1882 | } |
1883 | 1883 | |
1884 | - return (string) self::substr($str, 0, $n, $encoding); |
|
1884 | + return (string)self::substr($str, 0, $n, $encoding); |
|
1885 | 1885 | } |
1886 | 1886 | |
1887 | 1887 | /** |
@@ -1956,7 +1956,7 @@ discard block |
||
1956 | 1956 | return $str; |
1957 | 1957 | } |
1958 | 1958 | |
1959 | - $str = (string) $str; |
|
1959 | + $str = (string)$str; |
|
1960 | 1960 | $last = ''; |
1961 | 1961 | while ($last !== $str) { |
1962 | 1962 | $last = $str; |
@@ -2144,7 +2144,7 @@ discard block |
||
2144 | 2144 | if ($str_info === false) { |
2145 | 2145 | return $fallback; |
2146 | 2146 | } |
2147 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2147 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2148 | 2148 | |
2149 | 2149 | // DEBUG |
2150 | 2150 | //var_dump($type_code); |
@@ -2233,7 +2233,7 @@ discard block |
||
2233 | 2233 | // |
2234 | 2234 | |
2235 | 2235 | if ($encoding === 'UTF-8') { |
2236 | - $maxlength = (int) \mb_strlen($possibleChars); |
|
2236 | + $maxlength = (int)\mb_strlen($possibleChars); |
|
2237 | 2237 | if ($maxlength === 0) { |
2238 | 2238 | return ''; |
2239 | 2239 | } |
@@ -2254,7 +2254,7 @@ discard block |
||
2254 | 2254 | } else { |
2255 | 2255 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2256 | 2256 | |
2257 | - $maxlength = (int) self::strlen($possibleChars, $encoding); |
|
2257 | + $maxlength = (int)self::strlen($possibleChars, $encoding); |
|
2258 | 2258 | if ($maxlength === 0) { |
2259 | 2259 | return ''; |
2260 | 2260 | } |
@@ -2285,16 +2285,16 @@ discard block |
||
2285 | 2285 | */ |
2286 | 2286 | public static function get_unique_string($entropyExtra = '', bool $md5 = true): string |
2287 | 2287 | { |
2288 | - $uniqueHelper = \random_int(0, \mt_getrandmax()) . |
|
2289 | - \session_id() . |
|
2290 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2291 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2288 | + $uniqueHelper = \random_int(0, \mt_getrandmax()). |
|
2289 | + \session_id(). |
|
2290 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2291 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2292 | 2292 | $entropyExtra; |
2293 | 2293 | |
2294 | 2294 | $uniqueString = \uniqid($uniqueHelper, true); |
2295 | 2295 | |
2296 | 2296 | if ($md5) { |
2297 | - $uniqueString = \md5($uniqueString . $uniqueHelper); |
|
2297 | + $uniqueString = \md5($uniqueString.$uniqueHelper); |
|
2298 | 2298 | } |
2299 | 2299 | |
2300 | 2300 | return $uniqueString; |
@@ -2373,7 +2373,7 @@ discard block |
||
2373 | 2373 | public static function hex_to_int($hexDec) |
2374 | 2374 | { |
2375 | 2375 | // init |
2376 | - $hexDec = (string) $hexDec; |
|
2376 | + $hexDec = (string)$hexDec; |
|
2377 | 2377 | |
2378 | 2378 | if ($hexDec === '') { |
2379 | 2379 | return false; |
@@ -2451,7 +2451,7 @@ discard block |
||
2451 | 2451 | return \implode( |
2452 | 2452 | '', |
2453 | 2453 | \array_map( |
2454 | - static function (string $chr) use ($keepAsciiChars, $encoding): string { |
|
2454 | + static function(string $chr) use ($keepAsciiChars, $encoding): string { |
|
2455 | 2455 | return self::single_chr_html_encode($chr, $keepAsciiChars, $encoding); |
2456 | 2456 | }, |
2457 | 2457 | self::str_split($str) |
@@ -2555,7 +2555,7 @@ discard block |
||
2555 | 2555 | && |
2556 | 2556 | self::$SUPPORT['mbstring'] === false |
2557 | 2557 | ) { |
2558 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2558 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2559 | 2559 | } |
2560 | 2560 | |
2561 | 2561 | do { |
@@ -2576,14 +2576,14 @@ discard block |
||
2576 | 2576 | ); |
2577 | 2577 | } |
2578 | 2578 | } else { |
2579 | - $str = (string) \preg_replace_callback( |
|
2579 | + $str = (string)\preg_replace_callback( |
|
2580 | 2580 | "/&#\d{2,6};/", |
2581 | 2581 | /** |
2582 | 2582 | * @param string[] $matches |
2583 | 2583 | * |
2584 | 2584 | * @return string |
2585 | 2585 | */ |
2586 | - static function (array $matches) use ($encoding): string { |
|
2586 | + static function(array $matches) use ($encoding): string { |
|
2587 | 2587 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
2588 | 2588 | if ($returnTmp !== '"' && $returnTmp !== "'") { |
2589 | 2589 | return $returnTmp; |
@@ -2598,7 +2598,7 @@ discard block |
||
2598 | 2598 | if (\strpos($str, '&') !== false) { |
2599 | 2599 | if (\strpos($str, '&#') !== false) { |
2600 | 2600 | // decode also numeric & UTF16 two byte entities |
2601 | - $str = (string) \preg_replace( |
|
2601 | + $str = (string)\preg_replace( |
|
2602 | 2602 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
2603 | 2603 | '$1;', |
2604 | 2604 | $str |
@@ -2644,7 +2644,7 @@ discard block |
||
2644 | 2644 | */ |
2645 | 2645 | public static function html_stripe_empty_tags(string $str): string |
2646 | 2646 | { |
2647 | - return (string) \preg_replace( |
|
2647 | + return (string)\preg_replace( |
|
2648 | 2648 | "/<[^\/>]*>(([\s]?)*|)<\/[^>]*>/u", |
2649 | 2649 | '', |
2650 | 2650 | $str |
@@ -2943,9 +2943,9 @@ discard block |
||
2943 | 2943 | { |
2944 | 2944 | $hex = \dechex($int); |
2945 | 2945 | |
2946 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
2946 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
2947 | 2947 | |
2948 | - return $pfix . $hex . ''; |
|
2948 | + return $pfix.$hex.''; |
|
2949 | 2949 | } |
2950 | 2950 | |
2951 | 2951 | /** |
@@ -3203,7 +3203,7 @@ discard block |
||
3203 | 3203 | */ |
3204 | 3204 | public static function is_binary($input, bool $strict = false): bool |
3205 | 3205 | { |
3206 | - $input = (string) $input; |
|
3206 | + $input = (string)$input; |
|
3207 | 3207 | if ($input === '') { |
3208 | 3208 | return false; |
3209 | 3209 | } |
@@ -3462,7 +3462,7 @@ discard block |
||
3462 | 3462 | public static function is_utf16($str, $checkIfStringIsBinary = true) |
3463 | 3463 | { |
3464 | 3464 | // init |
3465 | - $str = (string) $str; |
|
3465 | + $str = (string)$str; |
|
3466 | 3466 | $strChars = []; |
3467 | 3467 | |
3468 | 3468 | if ( |
@@ -3540,7 +3540,7 @@ discard block |
||
3540 | 3540 | public static function is_utf32($str, $checkIfStringIsBinary = true) |
3541 | 3541 | { |
3542 | 3542 | // init |
3543 | - $str = (string) $str; |
|
3543 | + $str = (string)$str; |
|
3544 | 3544 | $strChars = []; |
3545 | 3545 | |
3546 | 3546 | if ( |
@@ -3660,7 +3660,7 @@ discard block |
||
3660 | 3660 | self::$ORD = self::getData('ord'); |
3661 | 3661 | } |
3662 | 3662 | |
3663 | - $len = \strlen((string) $str); |
|
3663 | + $len = \strlen((string)$str); |
|
3664 | 3664 | /** @noinspection ForeachInvariantsInspection */ |
3665 | 3665 | for ($i = 0; $i < $len; ++$i) { |
3666 | 3666 | $in = self::$ORD[$str[$i]]; |
@@ -3897,15 +3897,15 @@ discard block |
||
3897 | 3897 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
3898 | 3898 | |
3899 | 3899 | if ($encoding === 'UTF-8') { |
3900 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
3900 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
3901 | 3901 | |
3902 | 3902 | if ($useMbFunction === true) { |
3903 | 3903 | $strPartOne = \mb_strtolower( |
3904 | - (string) \mb_substr($str, 0, 1) |
|
3904 | + (string)\mb_substr($str, 0, 1) |
|
3905 | 3905 | ); |
3906 | 3906 | } else { |
3907 | 3907 | $strPartOne = self::strtolower( |
3908 | - (string) \mb_substr($str, 0, 1), |
|
3908 | + (string)\mb_substr($str, 0, 1), |
|
3909 | 3909 | $encoding, |
3910 | 3910 | false, |
3911 | 3911 | $lang, |
@@ -3915,10 +3915,10 @@ discard block |
||
3915 | 3915 | } else { |
3916 | 3916 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
3917 | 3917 | |
3918 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
3918 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
3919 | 3919 | |
3920 | 3920 | $strPartOne = self::strtolower( |
3921 | - (string) self::substr($str, 0, 1, $encoding), |
|
3921 | + (string)self::substr($str, 0, 1, $encoding), |
|
3922 | 3922 | $encoding, |
3923 | 3923 | false, |
3924 | 3924 | $lang, |
@@ -3926,7 +3926,7 @@ discard block |
||
3926 | 3926 | ); |
3927 | 3927 | } |
3928 | 3928 | |
3929 | - return $strPartOne . $strPartTwo; |
|
3929 | + return $strPartOne.$strPartTwo; |
|
3930 | 3930 | } |
3931 | 3931 | |
3932 | 3932 | /** |
@@ -4045,7 +4045,7 @@ discard block |
||
4045 | 4045 | |
4046 | 4046 | if (self::$SUPPORT['mbstring'] === true) { |
4047 | 4047 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4048 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4048 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4049 | 4049 | } |
4050 | 4050 | |
4051 | 4051 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -4086,7 +4086,7 @@ discard block |
||
4086 | 4086 | { |
4087 | 4087 | $bytes = self::chr_size_list($str); |
4088 | 4088 | if (\count($bytes) > 0) { |
4089 | - return (int) \max($bytes); |
|
4089 | + return (int)\max($bytes); |
|
4090 | 4090 | } |
4091 | 4091 | |
4092 | 4092 | return 0; |
@@ -4155,7 +4155,7 @@ discard block |
||
4155 | 4155 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4156 | 4156 | |
4157 | 4157 | // init |
4158 | - $encoding = (string) $encoding; |
|
4158 | + $encoding = (string)$encoding; |
|
4159 | 4159 | |
4160 | 4160 | if (!$encoding) { |
4161 | 4161 | return $fallback; |
@@ -4209,7 +4209,7 @@ discard block |
||
4209 | 4209 | |
4210 | 4210 | $encodingOrig = $encoding; |
4211 | 4211 | $encoding = \strtoupper($encoding); |
4212 | - $encodingUpperHelper = (string) \preg_replace('/[^a-zA-Z0-9\s]/u', '', $encoding); |
|
4212 | + $encodingUpperHelper = (string)\preg_replace('/[^a-zA-Z0-9\s]/u', '', $encoding); |
|
4213 | 4213 | |
4214 | 4214 | $equivalences = [ |
4215 | 4215 | 'ISO8859' => 'ISO-8859-1', |
@@ -4367,7 +4367,7 @@ discard block |
||
4367 | 4367 | } |
4368 | 4368 | |
4369 | 4369 | static $WHITESPACE_CACHE = []; |
4370 | - $cacheKey = (int) $keepNonBreakingSpace; |
|
4370 | + $cacheKey = (int)$keepNonBreakingSpace; |
|
4371 | 4371 | |
4372 | 4372 | if (!isset($WHITESPACE_CACHE[$cacheKey])) { |
4373 | 4373 | $WHITESPACE_CACHE[$cacheKey] = self::$WHITESPACE_TABLE; |
@@ -4409,13 +4409,13 @@ discard block |
||
4409 | 4409 | static $CHAR_CACHE = []; |
4410 | 4410 | |
4411 | 4411 | // init |
4412 | - $chr = (string) $chr; |
|
4412 | + $chr = (string)$chr; |
|
4413 | 4413 | |
4414 | 4414 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4415 | 4415 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4416 | 4416 | } |
4417 | 4417 | |
4418 | - $cacheKey = $chr . $encoding; |
|
4418 | + $cacheKey = $chr.$encoding; |
|
4419 | 4419 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
4420 | 4420 | return $CHAR_CACHE[$cacheKey]; |
4421 | 4421 | } |
@@ -4450,22 +4450,22 @@ discard block |
||
4450 | 4450 | // |
4451 | 4451 | |
4452 | 4452 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
4453 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
4453 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
4454 | 4454 | $code = $chr ? $chr[1] : 0; |
4455 | 4455 | |
4456 | 4456 | if ($code >= 0xF0 && isset($chr[4])) { |
4457 | 4457 | /** @noinspection UnnecessaryCastingInspection */ |
4458 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4458 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4459 | 4459 | } |
4460 | 4460 | |
4461 | 4461 | if ($code >= 0xE0 && isset($chr[3])) { |
4462 | 4462 | /** @noinspection UnnecessaryCastingInspection */ |
4463 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4463 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4464 | 4464 | } |
4465 | 4465 | |
4466 | 4466 | if ($code >= 0xC0 && isset($chr[2])) { |
4467 | 4467 | /** @noinspection UnnecessaryCastingInspection */ |
4468 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4468 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4469 | 4469 | } |
4470 | 4470 | |
4471 | 4471 | return $CHAR_CACHE[$cacheKey] = $code; |
@@ -4514,7 +4514,7 @@ discard block |
||
4514 | 4514 | public static function pcre_utf8_support(): bool |
4515 | 4515 | { |
4516 | 4516 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4517 | - return (bool) @\preg_match('//u', ''); |
|
4517 | + return (bool)@\preg_match('//u', ''); |
|
4518 | 4518 | } |
4519 | 4519 | |
4520 | 4520 | /** |
@@ -4536,10 +4536,10 @@ discard block |
||
4536 | 4536 | } |
4537 | 4537 | |
4538 | 4538 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4539 | - if (\ctype_digit((string) $var1)) { |
|
4540 | - $start = (int) $var1; |
|
4539 | + if (\ctype_digit((string)$var1)) { |
|
4540 | + $start = (int)$var1; |
|
4541 | 4541 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var1)) { |
4542 | - $start = (int) self::hex_to_int($var1); |
|
4542 | + $start = (int)self::hex_to_int($var1); |
|
4543 | 4543 | } else { |
4544 | 4544 | $start = self::ord($var1); |
4545 | 4545 | } |
@@ -4549,10 +4549,10 @@ discard block |
||
4549 | 4549 | } |
4550 | 4550 | |
4551 | 4551 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4552 | - if (\ctype_digit((string) $var2)) { |
|
4553 | - $end = (int) $var2; |
|
4552 | + if (\ctype_digit((string)$var2)) { |
|
4553 | + $end = (int)$var2; |
|
4554 | 4554 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var2)) { |
4555 | - $end = (int) self::hex_to_int($var2); |
|
4555 | + $end = (int)self::hex_to_int($var2); |
|
4556 | 4556 | } else { |
4557 | 4557 | $end = self::ord($var2); |
4558 | 4558 | } |
@@ -4562,8 +4562,8 @@ discard block |
||
4562 | 4562 | } |
4563 | 4563 | |
4564 | 4564 | return \array_map( |
4565 | - static function (int $i): string { |
|
4566 | - return (string) self::chr($i); |
|
4565 | + static function(int $i): string { |
|
4566 | + return (string)self::chr($i); |
|
4567 | 4567 | }, |
4568 | 4568 | \range($start, $end) |
4569 | 4569 | ); |
@@ -4654,8 +4654,8 @@ discard block |
||
4654 | 4654 | $delimiter = '/'; |
4655 | 4655 | } |
4656 | 4656 | |
4657 | - return (string) \preg_replace( |
|
4658 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4657 | + return (string)\preg_replace( |
|
4658 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4659 | 4659 | $replacement, |
4660 | 4660 | $str |
4661 | 4661 | ); |
@@ -4697,9 +4697,9 @@ discard block |
||
4697 | 4697 | return ''; |
4698 | 4698 | } |
4699 | 4699 | |
4700 | - $strLength -= (int) $bomByteLength; |
|
4700 | + $strLength -= (int)$bomByteLength; |
|
4701 | 4701 | |
4702 | - $str = (string) $strTmp; |
|
4702 | + $str = (string)$strTmp; |
|
4703 | 4703 | } |
4704 | 4704 | } |
4705 | 4705 | |
@@ -4723,7 +4723,7 @@ discard block |
||
4723 | 4723 | if (\is_array($what) === true) { |
4724 | 4724 | /** @noinspection ForeachSourceInspection */ |
4725 | 4725 | foreach ($what as $item) { |
4726 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
4726 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
4727 | 4727 | } |
4728 | 4728 | } |
4729 | 4729 | |
@@ -4755,7 +4755,7 @@ discard block |
||
4755 | 4755 | */ |
4756 | 4756 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
4757 | 4757 | { |
4758 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4758 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4759 | 4759 | } |
4760 | 4760 | |
4761 | 4761 | /** |
@@ -4786,7 +4786,7 @@ discard block |
||
4786 | 4786 | $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
4787 | 4787 | |
4788 | 4788 | do { |
4789 | - $str = (string) \preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4789 | + $str = (string)\preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4790 | 4790 | } while ($count !== 0); |
4791 | 4791 | |
4792 | 4792 | return $str; |
@@ -4805,17 +4805,17 @@ discard block |
||
4805 | 4805 | { |
4806 | 4806 | if ($substring && \strpos($str, $substring) === 0) { |
4807 | 4807 | if ($encoding === 'UTF-8') { |
4808 | - return (string) \mb_substr( |
|
4808 | + return (string)\mb_substr( |
|
4809 | 4809 | $str, |
4810 | - (int) \mb_strlen($substring) |
|
4810 | + (int)\mb_strlen($substring) |
|
4811 | 4811 | ); |
4812 | 4812 | } |
4813 | 4813 | |
4814 | 4814 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4815 | 4815 | |
4816 | - return (string) self::substr( |
|
4816 | + return (string)self::substr( |
|
4817 | 4817 | $str, |
4818 | - (int) self::strlen($substring, $encoding), |
|
4818 | + (int)self::strlen($substring, $encoding), |
|
4819 | 4819 | null, |
4820 | 4820 | $encoding |
4821 | 4821 | ); |
@@ -4837,19 +4837,19 @@ discard block |
||
4837 | 4837 | { |
4838 | 4838 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
4839 | 4839 | if ($encoding === 'UTF-8') { |
4840 | - return (string) \mb_substr( |
|
4840 | + return (string)\mb_substr( |
|
4841 | 4841 | $str, |
4842 | 4842 | 0, |
4843 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
4843 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
4844 | 4844 | ); |
4845 | 4845 | } |
4846 | 4846 | |
4847 | 4847 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4848 | 4848 | |
4849 | - return (string) self::substr( |
|
4849 | + return (string)self::substr( |
|
4850 | 4850 | $str, |
4851 | 4851 | 0, |
4852 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
4852 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
4853 | 4853 | $encoding |
4854 | 4854 | ); |
4855 | 4855 | } |
@@ -4933,7 +4933,7 @@ discard block |
||
4933 | 4933 | $save = \mb_substitute_character(); |
4934 | 4934 | \mb_substitute_character($replacementCharHelper); |
4935 | 4935 | // the polyfill maybe return false, so cast to string |
4936 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4936 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4937 | 4937 | \mb_substitute_character($save); |
4938 | 4938 | } |
4939 | 4939 | |
@@ -4973,7 +4973,7 @@ discard block |
||
4973 | 4973 | |
4974 | 4974 | if (self::$SUPPORT['mbstring'] === true) { |
4975 | 4975 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4976 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4976 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4977 | 4977 | } |
4978 | 4978 | |
4979 | 4979 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -4988,7 +4988,7 @@ discard block |
||
4988 | 4988 | { |
4989 | 4989 | echo '<pre>'; |
4990 | 4990 | foreach (self::$SUPPORT as $key => &$value) { |
4991 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
4991 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
4992 | 4992 | } |
4993 | 4993 | unset($value); |
4994 | 4994 | echo '</pre>'; |
@@ -5017,7 +5017,7 @@ discard block |
||
5017 | 5017 | return $char; |
5018 | 5018 | } |
5019 | 5019 | |
5020 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
5020 | + return '&#'.self::ord($char, $encoding).';'; |
|
5021 | 5021 | } |
5022 | 5022 | |
5023 | 5023 | /** |
@@ -5108,18 +5108,18 @@ discard block |
||
5108 | 5108 | $lang, |
5109 | 5109 | $tryToKeepStringLength |
5110 | 5110 | ); |
5111 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5111 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5112 | 5112 | |
5113 | 5113 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5114 | 5114 | |
5115 | - $str = (string) \preg_replace_callback( |
|
5115 | + $str = (string)\preg_replace_callback( |
|
5116 | 5116 | '/[-_\s]+(.)?/u', |
5117 | 5117 | /** |
5118 | 5118 | * @param array $match |
5119 | 5119 | * |
5120 | 5120 | * @return string |
5121 | 5121 | */ |
5122 | - static function (array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5122 | + static function(array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5123 | 5123 | if (isset($match[1])) { |
5124 | 5124 | if ($useMbFunction === true) { |
5125 | 5125 | if ($encoding === 'UTF-8') { |
@@ -5137,14 +5137,14 @@ discard block |
||
5137 | 5137 | $str |
5138 | 5138 | ); |
5139 | 5139 | |
5140 | - return (string) \preg_replace_callback( |
|
5140 | + return (string)\preg_replace_callback( |
|
5141 | 5141 | '/[\d]+(.)?/u', |
5142 | 5142 | /** |
5143 | 5143 | * @param array $match |
5144 | 5144 | * |
5145 | 5145 | * @return string |
5146 | 5146 | */ |
5147 | - static function (array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5147 | + static function(array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5148 | 5148 | if ($useMbFunction === true) { |
5149 | 5149 | if ($encoding === 'UTF-8') { |
5150 | 5150 | return \mb_strtoupper($match[0]); |
@@ -5316,7 +5316,7 @@ discard block |
||
5316 | 5316 | ): string { |
5317 | 5317 | if (self::$SUPPORT['mbstring'] === true) { |
5318 | 5318 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5319 | - $str = (string) \mb_ereg_replace('\B(\p{Lu})', '-\1', \trim($str)); |
|
5319 | + $str = (string)\mb_ereg_replace('\B(\p{Lu})', '-\1', \trim($str)); |
|
5320 | 5320 | |
5321 | 5321 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5322 | 5322 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5326,10 +5326,10 @@ discard block |
||
5326 | 5326 | } |
5327 | 5327 | |
5328 | 5328 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5329 | - return (string) \mb_ereg_replace('[-_\s]+', $delimiter, $str); |
|
5329 | + return (string)\mb_ereg_replace('[-_\s]+', $delimiter, $str); |
|
5330 | 5330 | } |
5331 | 5331 | |
5332 | - $str = (string) \preg_replace('/\B(\p{Lu})/u', '-\1', \trim($str)); |
|
5332 | + $str = (string)\preg_replace('/\B(\p{Lu})/u', '-\1', \trim($str)); |
|
5333 | 5333 | |
5334 | 5334 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5335 | 5335 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5338,7 +5338,7 @@ discard block |
||
5338 | 5338 | $str = self::strtolower($str, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
5339 | 5339 | } |
5340 | 5340 | |
5341 | - return (string) \preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
5341 | + return (string)\preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
5342 | 5342 | } |
5343 | 5343 | |
5344 | 5344 | /** |
@@ -5353,7 +5353,7 @@ discard block |
||
5353 | 5353 | public static function str_detect_encoding($str) |
5354 | 5354 | { |
5355 | 5355 | // init |
5356 | - $str = (string) $str; |
|
5356 | + $str = (string)$str; |
|
5357 | 5357 | |
5358 | 5358 | // |
5359 | 5359 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5455,7 +5455,7 @@ discard block |
||
5455 | 5455 | foreach (self::$ENCODINGS as $encodingTmp) { |
5456 | 5456 | // INFO: //IGNORE but still throw notice |
5457 | 5457 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5458 | - if ((string) @\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str) === $str) { |
|
5458 | + if ((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str) === $str) { |
|
5459 | 5459 | return $encodingTmp; |
5460 | 5460 | } |
5461 | 5461 | } |
@@ -5543,7 +5543,7 @@ discard block |
||
5543 | 5543 | return $str; |
5544 | 5544 | } |
5545 | 5545 | |
5546 | - return $substring . $str; |
|
5546 | + return $substring.$str; |
|
5547 | 5547 | } |
5548 | 5548 | |
5549 | 5549 | /** |
@@ -5797,27 +5797,27 @@ discard block |
||
5797 | 5797 | string $encoding = 'UTF-8' |
5798 | 5798 | ): string { |
5799 | 5799 | if ($encoding === 'UTF-8') { |
5800 | - $len = (int) \mb_strlen($str); |
|
5800 | + $len = (int)\mb_strlen($str); |
|
5801 | 5801 | if ($index > $len) { |
5802 | 5802 | return $str; |
5803 | 5803 | } |
5804 | 5804 | |
5805 | 5805 | /** @noinspection UnnecessaryCastingInspection */ |
5806 | - return (string) \mb_substr($str, 0, $index) . |
|
5807 | - $substring . |
|
5808 | - (string) \mb_substr($str, $index, $len); |
|
5806 | + return (string)\mb_substr($str, 0, $index). |
|
5807 | + $substring. |
|
5808 | + (string)\mb_substr($str, $index, $len); |
|
5809 | 5809 | } |
5810 | 5810 | |
5811 | 5811 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5812 | 5812 | |
5813 | - $len = (int) self::strlen($str, $encoding); |
|
5813 | + $len = (int)self::strlen($str, $encoding); |
|
5814 | 5814 | if ($index > $len) { |
5815 | 5815 | return $str; |
5816 | 5816 | } |
5817 | 5817 | |
5818 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
5819 | - $substring . |
|
5820 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5818 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
5819 | + $substring. |
|
5820 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
5821 | 5821 | } |
5822 | 5822 | |
5823 | 5823 | /** |
@@ -5847,15 +5847,15 @@ discard block |
||
5847 | 5847 | */ |
5848 | 5848 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5849 | 5849 | { |
5850 | - $search = (array) $search; |
|
5850 | + $search = (array)$search; |
|
5851 | 5851 | |
5852 | 5852 | /** @noinspection AlterInForeachInspection */ |
5853 | 5853 | foreach ($search as &$s) { |
5854 | - $s = (string) $s; |
|
5854 | + $s = (string)$s; |
|
5855 | 5855 | if ($s === '') { |
5856 | 5856 | $s = '/^(?<=.)$/'; |
5857 | 5857 | } else { |
5858 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5858 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5859 | 5859 | } |
5860 | 5860 | } |
5861 | 5861 | |
@@ -5887,11 +5887,11 @@ discard block |
||
5887 | 5887 | } |
5888 | 5888 | |
5889 | 5889 | if ($search === '') { |
5890 | - return $str . $replacement; |
|
5890 | + return $str.$replacement; |
|
5891 | 5891 | } |
5892 | 5892 | |
5893 | 5893 | if (\stripos($str, $search) === 0) { |
5894 | - return $replacement . \substr($str, \strlen($search)); |
|
5894 | + return $replacement.\substr($str, \strlen($search)); |
|
5895 | 5895 | } |
5896 | 5896 | |
5897 | 5897 | 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; |
@@ -6000,15 +6000,15 @@ discard block |
||
6000 | 6000 | } |
6001 | 6001 | |
6002 | 6002 | if ($encoding === 'UTF-8') { |
6003 | - return (string) \mb_substr( |
|
6003 | + return (string)\mb_substr( |
|
6004 | 6004 | $str, |
6005 | - $offset + (int) \mb_strlen($separator) |
|
6005 | + $offset + (int)\mb_strlen($separator) |
|
6006 | 6006 | ); |
6007 | 6007 | } |
6008 | 6008 | |
6009 | - return (string) self::substr( |
|
6009 | + return (string)self::substr( |
|
6010 | 6010 | $str, |
6011 | - $offset + (int) self::strlen($separator, $encoding), |
|
6011 | + $offset + (int)self::strlen($separator, $encoding), |
|
6012 | 6012 | null, |
6013 | 6013 | $encoding |
6014 | 6014 | ); |
@@ -6035,15 +6035,15 @@ discard block |
||
6035 | 6035 | } |
6036 | 6036 | |
6037 | 6037 | if ($encoding === 'UTF-8') { |
6038 | - return (string) \mb_substr( |
|
6038 | + return (string)\mb_substr( |
|
6039 | 6039 | $str, |
6040 | - $offset + (int) self::strlen($separator) |
|
6040 | + $offset + (int)self::strlen($separator) |
|
6041 | 6041 | ); |
6042 | 6042 | } |
6043 | 6043 | |
6044 | - return (string) self::substr( |
|
6044 | + return (string)self::substr( |
|
6045 | 6045 | $str, |
6046 | - $offset + (int) self::strlen($separator, $encoding), |
|
6046 | + $offset + (int)self::strlen($separator, $encoding), |
|
6047 | 6047 | null, |
6048 | 6048 | $encoding |
6049 | 6049 | ); |
@@ -6070,10 +6070,10 @@ discard block |
||
6070 | 6070 | } |
6071 | 6071 | |
6072 | 6072 | if ($encoding === 'UTF-8') { |
6073 | - return (string) \mb_substr($str, 0, $offset); |
|
6073 | + return (string)\mb_substr($str, 0, $offset); |
|
6074 | 6074 | } |
6075 | 6075 | |
6076 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6076 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6077 | 6077 | } |
6078 | 6078 | |
6079 | 6079 | /** |
@@ -6097,7 +6097,7 @@ discard block |
||
6097 | 6097 | return ''; |
6098 | 6098 | } |
6099 | 6099 | |
6100 | - return (string) \mb_substr($str, 0, $offset); |
|
6100 | + return (string)\mb_substr($str, 0, $offset); |
|
6101 | 6101 | } |
6102 | 6102 | |
6103 | 6103 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6105,7 +6105,7 @@ discard block |
||
6105 | 6105 | return ''; |
6106 | 6106 | } |
6107 | 6107 | |
6108 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6108 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6109 | 6109 | } |
6110 | 6110 | |
6111 | 6111 | /** |
@@ -6193,12 +6193,12 @@ discard block |
||
6193 | 6193 | } |
6194 | 6194 | |
6195 | 6195 | if ($encoding === 'UTF-8') { |
6196 | - return (string) \mb_substr($str, -$n); |
|
6196 | + return (string)\mb_substr($str, -$n); |
|
6197 | 6197 | } |
6198 | 6198 | |
6199 | 6199 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6200 | 6200 | |
6201 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6201 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6202 | 6202 | } |
6203 | 6203 | |
6204 | 6204 | /** |
@@ -6222,21 +6222,21 @@ discard block |
||
6222 | 6222 | } |
6223 | 6223 | |
6224 | 6224 | if ($encoding === 'UTF-8') { |
6225 | - if ((int) \mb_strlen($str) <= $length) { |
|
6225 | + if ((int)\mb_strlen($str) <= $length) { |
|
6226 | 6226 | return $str; |
6227 | 6227 | } |
6228 | 6228 | |
6229 | 6229 | /** @noinspection UnnecessaryCastingInspection */ |
6230 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($strAddOn)) . $strAddOn; |
|
6230 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($strAddOn)).$strAddOn; |
|
6231 | 6231 | } |
6232 | 6232 | |
6233 | 6233 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6234 | 6234 | |
6235 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6235 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6236 | 6236 | return $str; |
6237 | 6237 | } |
6238 | 6238 | |
6239 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($strAddOn), $encoding)) . $strAddOn; |
|
6239 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($strAddOn), $encoding)).$strAddOn; |
|
6240 | 6240 | } |
6241 | 6241 | |
6242 | 6242 | /** |
@@ -6261,12 +6261,12 @@ discard block |
||
6261 | 6261 | |
6262 | 6262 | if ($encoding === 'UTF-8') { |
6263 | 6263 | /** @noinspection UnnecessaryCastingInspection */ |
6264 | - if ((int) \mb_strlen($str) <= $length) { |
|
6264 | + if ((int)\mb_strlen($str) <= $length) { |
|
6265 | 6265 | return $str; |
6266 | 6266 | } |
6267 | 6267 | |
6268 | 6268 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6269 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6269 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6270 | 6270 | } |
6271 | 6271 | |
6272 | 6272 | $str = \mb_substr($str, 0, $length); |
@@ -6276,20 +6276,20 @@ discard block |
||
6276 | 6276 | $new_str = \implode(' ', $array); |
6277 | 6277 | |
6278 | 6278 | if ($new_str === '') { |
6279 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6279 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6280 | 6280 | } |
6281 | 6281 | } else { |
6282 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6282 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6283 | 6283 | return $str; |
6284 | 6284 | } |
6285 | 6285 | |
6286 | 6286 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6287 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6287 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6288 | 6288 | } |
6289 | 6289 | |
6290 | 6290 | $str = self::substr($str, 0, $length, $encoding); |
6291 | 6291 | if ($str === false) { |
6292 | - return '' . $strAddOn; |
|
6292 | + return ''.$strAddOn; |
|
6293 | 6293 | } |
6294 | 6294 | |
6295 | 6295 | $array = \explode(' ', $str); |
@@ -6297,11 +6297,11 @@ discard block |
||
6297 | 6297 | $new_str = \implode(' ', $array); |
6298 | 6298 | |
6299 | 6299 | if ($new_str === '') { |
6300 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6300 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6301 | 6301 | } |
6302 | 6302 | } |
6303 | 6303 | |
6304 | - return $new_str . $strAddOn; |
|
6304 | + return $new_str.$strAddOn; |
|
6305 | 6305 | } |
6306 | 6306 | |
6307 | 6307 | /** |
@@ -6319,7 +6319,7 @@ discard block |
||
6319 | 6319 | $longestCommonPrefix = ''; |
6320 | 6320 | |
6321 | 6321 | if ($encoding === 'UTF-8') { |
6322 | - $maxLength = (int) \min( |
|
6322 | + $maxLength = (int)\min( |
|
6323 | 6323 | \mb_strlen($str), |
6324 | 6324 | \mb_strlen($otherStr) |
6325 | 6325 | ); |
@@ -6340,7 +6340,7 @@ discard block |
||
6340 | 6340 | } else { |
6341 | 6341 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6342 | 6342 | |
6343 | - $maxLength = (int) \min( |
|
6343 | + $maxLength = (int)\min( |
|
6344 | 6344 | self::strlen($str, $encoding), |
6345 | 6345 | self::strlen($otherStr, $encoding) |
6346 | 6346 | ); |
@@ -6383,13 +6383,13 @@ discard block |
||
6383 | 6383 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6384 | 6384 | |
6385 | 6385 | if ($encoding === 'UTF-8') { |
6386 | - $strLength = (int) \mb_strlen($str); |
|
6387 | - $otherLength = (int) \mb_strlen($otherStr); |
|
6386 | + $strLength = (int)\mb_strlen($str); |
|
6387 | + $otherLength = (int)\mb_strlen($otherStr); |
|
6388 | 6388 | } else { |
6389 | 6389 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6390 | 6390 | |
6391 | - $strLength = (int) self::strlen($str, $encoding); |
|
6392 | - $otherLength = (int) self::strlen($otherStr, $encoding); |
|
6391 | + $strLength = (int)self::strlen($str, $encoding); |
|
6392 | + $otherLength = (int)self::strlen($otherStr, $encoding); |
|
6393 | 6393 | } |
6394 | 6394 | |
6395 | 6395 | // Return if either string is empty |
@@ -6442,10 +6442,10 @@ discard block |
||
6442 | 6442 | } |
6443 | 6443 | |
6444 | 6444 | if ($encoding === 'UTF-8') { |
6445 | - return (string) \mb_substr($str, $end - $len, $len); |
|
6445 | + return (string)\mb_substr($str, $end - $len, $len); |
|
6446 | 6446 | } |
6447 | 6447 | |
6448 | - return (string) self::substr($str, $end - $len, $len, $encoding); |
|
6448 | + return (string)self::substr($str, $end - $len, $len, $encoding); |
|
6449 | 6449 | } |
6450 | 6450 | |
6451 | 6451 | /** |
@@ -6464,7 +6464,7 @@ discard block |
||
6464 | 6464 | } |
6465 | 6465 | |
6466 | 6466 | if ($encoding === 'UTF-8') { |
6467 | - $maxLength = (int) \min( |
|
6467 | + $maxLength = (int)\min( |
|
6468 | 6468 | \mb_strlen($str, $encoding), |
6469 | 6469 | \mb_strlen($otherStr, $encoding) |
6470 | 6470 | ); |
@@ -6478,7 +6478,7 @@ discard block |
||
6478 | 6478 | && |
6479 | 6479 | $char === \mb_substr($otherStr, -$i, 1) |
6480 | 6480 | ) { |
6481 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6481 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6482 | 6482 | } else { |
6483 | 6483 | break; |
6484 | 6484 | } |
@@ -6486,7 +6486,7 @@ discard block |
||
6486 | 6486 | } else { |
6487 | 6487 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6488 | 6488 | |
6489 | - $maxLength = (int) \min( |
|
6489 | + $maxLength = (int)\min( |
|
6490 | 6490 | self::strlen($str, $encoding), |
6491 | 6491 | self::strlen($otherStr, $encoding) |
6492 | 6492 | ); |
@@ -6500,7 +6500,7 @@ discard block |
||
6500 | 6500 | && |
6501 | 6501 | $char === self::substr($otherStr, -$i, 1, $encoding) |
6502 | 6502 | ) { |
6503 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6503 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6504 | 6504 | } else { |
6505 | 6505 | break; |
6506 | 6506 | } |
@@ -6520,7 +6520,7 @@ discard block |
||
6520 | 6520 | */ |
6521 | 6521 | public static function str_matches_pattern(string $str, string $pattern): bool |
6522 | 6522 | { |
6523 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6523 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6524 | 6524 | } |
6525 | 6525 | |
6526 | 6526 | /** |
@@ -6537,7 +6537,7 @@ discard block |
||
6537 | 6537 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6538 | 6538 | { |
6539 | 6539 | // init |
6540 | - $length = (int) self::strlen($str, $encoding); |
|
6540 | + $length = (int)self::strlen($str, $encoding); |
|
6541 | 6541 | |
6542 | 6542 | if ($offset >= 0) { |
6543 | 6543 | return $length > $offset; |
@@ -6563,7 +6563,7 @@ discard block |
||
6563 | 6563 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6564 | 6564 | { |
6565 | 6565 | // init |
6566 | - $length = (int) self::strlen($str); |
|
6566 | + $length = (int)self::strlen($str); |
|
6567 | 6567 | |
6568 | 6568 | if ( |
6569 | 6569 | ($index >= 0 && $length <= $index) |
@@ -6602,7 +6602,7 @@ discard block |
||
6602 | 6602 | return $str; |
6603 | 6603 | } |
6604 | 6604 | |
6605 | - if ($pad_type !== (int) $pad_type) { |
|
6605 | + if ($pad_type !== (int)$pad_type) { |
|
6606 | 6606 | if ($pad_type === 'left') { |
6607 | 6607 | $pad_type = \STR_PAD_LEFT; |
6608 | 6608 | } elseif ($pad_type === 'right') { |
@@ -6611,23 +6611,23 @@ discard block |
||
6611 | 6611 | $pad_type = \STR_PAD_BOTH; |
6612 | 6612 | } else { |
6613 | 6613 | throw new \InvalidArgumentException( |
6614 | - 'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6614 | + 'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6615 | 6615 | ); |
6616 | 6616 | } |
6617 | 6617 | } |
6618 | 6618 | |
6619 | 6619 | if ($encoding === 'UTF-8') { |
6620 | - $str_length = (int) \mb_strlen($str); |
|
6620 | + $str_length = (int)\mb_strlen($str); |
|
6621 | 6621 | |
6622 | 6622 | if ($pad_length >= $str_length) { |
6623 | 6623 | switch ($pad_type) { |
6624 | 6624 | case \STR_PAD_LEFT: |
6625 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6625 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6626 | 6626 | |
6627 | 6627 | $diff = ($pad_length - $str_length); |
6628 | 6628 | |
6629 | - $pre = (string) \mb_substr( |
|
6630 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6629 | + $pre = (string)\mb_substr( |
|
6630 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6631 | 6631 | 0, |
6632 | 6632 | $diff |
6633 | 6633 | ); |
@@ -6638,16 +6638,16 @@ discard block |
||
6638 | 6638 | case \STR_PAD_BOTH: |
6639 | 6639 | $diff = ($pad_length - $str_length); |
6640 | 6640 | |
6641 | - $ps_length_left = (int) \floor($diff / 2); |
|
6641 | + $ps_length_left = (int)\floor($diff / 2); |
|
6642 | 6642 | |
6643 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6643 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6644 | 6644 | |
6645 | - $pre = (string) \mb_substr( |
|
6645 | + $pre = (string)\mb_substr( |
|
6646 | 6646 | \str_repeat($pad_string, $ps_length_left), |
6647 | 6647 | 0, |
6648 | 6648 | $ps_length_left |
6649 | 6649 | ); |
6650 | - $post = (string) \mb_substr( |
|
6650 | + $post = (string)\mb_substr( |
|
6651 | 6651 | \str_repeat($pad_string, $ps_length_right), |
6652 | 6652 | 0, |
6653 | 6653 | $ps_length_right |
@@ -6657,19 +6657,19 @@ discard block |
||
6657 | 6657 | |
6658 | 6658 | case \STR_PAD_RIGHT: |
6659 | 6659 | default: |
6660 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6660 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6661 | 6661 | |
6662 | 6662 | $diff = ($pad_length - $str_length); |
6663 | 6663 | |
6664 | - $post = (string) \mb_substr( |
|
6665 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6664 | + $post = (string)\mb_substr( |
|
6665 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6666 | 6666 | 0, |
6667 | 6667 | $diff |
6668 | 6668 | ); |
6669 | 6669 | $pre = ''; |
6670 | 6670 | } |
6671 | 6671 | |
6672 | - return $pre . $str . $post; |
|
6672 | + return $pre.$str.$post; |
|
6673 | 6673 | } |
6674 | 6674 | |
6675 | 6675 | return $str; |
@@ -6677,17 +6677,17 @@ discard block |
||
6677 | 6677 | |
6678 | 6678 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6679 | 6679 | |
6680 | - $str_length = (int) self::strlen($str, $encoding); |
|
6680 | + $str_length = (int)self::strlen($str, $encoding); |
|
6681 | 6681 | |
6682 | 6682 | if ($pad_length >= $str_length) { |
6683 | 6683 | switch ($pad_type) { |
6684 | 6684 | case \STR_PAD_LEFT: |
6685 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6685 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6686 | 6686 | |
6687 | 6687 | $diff = ($pad_length - $str_length); |
6688 | 6688 | |
6689 | - $pre = (string) self::substr( |
|
6690 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6689 | + $pre = (string)self::substr( |
|
6690 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6691 | 6691 | 0, |
6692 | 6692 | $diff, |
6693 | 6693 | $encoding |
@@ -6699,17 +6699,17 @@ discard block |
||
6699 | 6699 | case \STR_PAD_BOTH: |
6700 | 6700 | $diff = ($pad_length - $str_length); |
6701 | 6701 | |
6702 | - $ps_length_left = (int) \floor($diff / 2); |
|
6702 | + $ps_length_left = (int)\floor($diff / 2); |
|
6703 | 6703 | |
6704 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6704 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6705 | 6705 | |
6706 | - $pre = (string) self::substr( |
|
6706 | + $pre = (string)self::substr( |
|
6707 | 6707 | \str_repeat($pad_string, $ps_length_left), |
6708 | 6708 | 0, |
6709 | 6709 | $ps_length_left, |
6710 | 6710 | $encoding |
6711 | 6711 | ); |
6712 | - $post = (string) self::substr( |
|
6712 | + $post = (string)self::substr( |
|
6713 | 6713 | \str_repeat($pad_string, $ps_length_right), |
6714 | 6714 | 0, |
6715 | 6715 | $ps_length_right, |
@@ -6720,12 +6720,12 @@ discard block |
||
6720 | 6720 | |
6721 | 6721 | case \STR_PAD_RIGHT: |
6722 | 6722 | default: |
6723 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6723 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6724 | 6724 | |
6725 | 6725 | $diff = ($pad_length - $str_length); |
6726 | 6726 | |
6727 | - $post = (string) self::substr( |
|
6728 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6727 | + $post = (string)self::substr( |
|
6728 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6729 | 6729 | 0, |
6730 | 6730 | $diff, |
6731 | 6731 | $encoding |
@@ -6733,7 +6733,7 @@ discard block |
||
6733 | 6733 | $pre = ''; |
6734 | 6734 | } |
6735 | 6735 | |
6736 | - return $pre . $str . $post; |
|
6736 | + return $pre.$str.$post; |
|
6737 | 6737 | } |
6738 | 6738 | |
6739 | 6739 | return $str; |
@@ -6892,11 +6892,11 @@ discard block |
||
6892 | 6892 | } |
6893 | 6893 | |
6894 | 6894 | if ($search === '') { |
6895 | - return $str . $replacement; |
|
6895 | + return $str.$replacement; |
|
6896 | 6896 | } |
6897 | 6897 | |
6898 | 6898 | if (\strpos($str, $search) === 0) { |
6899 | - return $replacement . \substr($str, \strlen($search)); |
|
6899 | + return $replacement.\substr($str, \strlen($search)); |
|
6900 | 6900 | } |
6901 | 6901 | |
6902 | 6902 | return $str; |
@@ -6924,11 +6924,11 @@ discard block |
||
6924 | 6924 | } |
6925 | 6925 | |
6926 | 6926 | if ($search === '') { |
6927 | - return $str . $replacement; |
|
6927 | + return $str.$replacement; |
|
6928 | 6928 | } |
6929 | 6929 | |
6930 | 6930 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6931 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6931 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6932 | 6932 | } |
6933 | 6933 | |
6934 | 6934 | return $str; |
@@ -6957,7 +6957,7 @@ discard block |
||
6957 | 6957 | $subject, |
6958 | 6958 | $replace, |
6959 | 6959 | $pos, |
6960 | - (int) self::strlen($search) |
|
6960 | + (int)self::strlen($search) |
|
6961 | 6961 | ); |
6962 | 6962 | } |
6963 | 6963 | |
@@ -6989,7 +6989,7 @@ discard block |
||
6989 | 6989 | $subject, |
6990 | 6990 | $replace, |
6991 | 6991 | $pos, |
6992 | - (int) self::strlen($search) |
|
6992 | + (int)self::strlen($search) |
|
6993 | 6993 | ); |
6994 | 6994 | } |
6995 | 6995 | |
@@ -7009,7 +7009,7 @@ discard block |
||
7009 | 7009 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
7010 | 7010 | { |
7011 | 7011 | if ($encoding === 'UTF-8') { |
7012 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
7012 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
7013 | 7013 | /** @noinspection NonSecureShuffleUsageInspection */ |
7014 | 7014 | \shuffle($indexes); |
7015 | 7015 | |
@@ -7025,7 +7025,7 @@ discard block |
||
7025 | 7025 | } else { |
7026 | 7026 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7027 | 7027 | |
7028 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
7028 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
7029 | 7029 | /** @noinspection NonSecureShuffleUsageInspection */ |
7030 | 7030 | \shuffle($indexes); |
7031 | 7031 | |
@@ -7066,11 +7066,11 @@ discard block |
||
7066 | 7066 | ) { |
7067 | 7067 | if ($encoding === 'UTF-8') { |
7068 | 7068 | if ($end === null) { |
7069 | - $length = (int) \mb_strlen($str); |
|
7069 | + $length = (int)\mb_strlen($str); |
|
7070 | 7070 | } elseif ($end >= 0 && $end <= $start) { |
7071 | 7071 | return ''; |
7072 | 7072 | } elseif ($end < 0) { |
7073 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7073 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7074 | 7074 | } else { |
7075 | 7075 | $length = $end - $start; |
7076 | 7076 | } |
@@ -7081,11 +7081,11 @@ discard block |
||
7081 | 7081 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7082 | 7082 | |
7083 | 7083 | if ($end === null) { |
7084 | - $length = (int) self::strlen($str, $encoding); |
|
7084 | + $length = (int)self::strlen($str, $encoding); |
|
7085 | 7085 | } elseif ($end >= 0 && $end <= $start) { |
7086 | 7086 | return ''; |
7087 | 7087 | } elseif ($end < 0) { |
7088 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7088 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7089 | 7089 | } else { |
7090 | 7090 | $length = $end - $start; |
7091 | 7091 | } |
@@ -7117,35 +7117,35 @@ discard block |
||
7117 | 7117 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7118 | 7118 | } |
7119 | 7119 | |
7120 | - $str = (string) \preg_replace_callback( |
|
7120 | + $str = (string)\preg_replace_callback( |
|
7121 | 7121 | '/([\d|\p{Lu}])/u', |
7122 | 7122 | /** |
7123 | 7123 | * @param string[] $matches |
7124 | 7124 | * |
7125 | 7125 | * @return string |
7126 | 7126 | */ |
7127 | - static function (array $matches) use ($encoding): string { |
|
7127 | + static function(array $matches) use ($encoding): string { |
|
7128 | 7128 | $match = $matches[1]; |
7129 | - $matchInt = (int) $match; |
|
7129 | + $matchInt = (int)$match; |
|
7130 | 7130 | |
7131 | - if ((string) $matchInt === $match) { |
|
7132 | - return '_' . $match . '_'; |
|
7131 | + if ((string)$matchInt === $match) { |
|
7132 | + return '_'.$match.'_'; |
|
7133 | 7133 | } |
7134 | 7134 | |
7135 | 7135 | if ($encoding === 'UTF-8') { |
7136 | - return '_' . \mb_strtolower($match); |
|
7136 | + return '_'.\mb_strtolower($match); |
|
7137 | 7137 | } |
7138 | 7138 | |
7139 | - return '_' . self::strtolower($match, $encoding); |
|
7139 | + return '_'.self::strtolower($match, $encoding); |
|
7140 | 7140 | }, |
7141 | 7141 | $str |
7142 | 7142 | ); |
7143 | 7143 | |
7144 | - $str = (string) \preg_replace( |
|
7144 | + $str = (string)\preg_replace( |
|
7145 | 7145 | [ |
7146 | - '/\s+/u', // convert spaces to "_" |
|
7147 | - '/^\s+|\s+$/u', // trim leading & trailing spaces |
|
7148 | - '/_+/', // remove double "_" |
|
7146 | + '/\s+/u', // convert spaces to "_" |
|
7147 | + '/^\s+|\s+$/u', // trim leading & trailing spaces |
|
7148 | + '/_+/', // remove double "_" |
|
7149 | 7149 | ], |
7150 | 7150 | [ |
7151 | 7151 | '_', |
@@ -7221,7 +7221,7 @@ discard block |
||
7221 | 7221 | } |
7222 | 7222 | |
7223 | 7223 | // init |
7224 | - $str = (string) $str; |
|
7224 | + $str = (string)$str; |
|
7225 | 7225 | |
7226 | 7226 | if ($str === '') { |
7227 | 7227 | return []; |
@@ -7268,7 +7268,7 @@ discard block |
||
7268 | 7268 | ($str[$i] & "\xE0") === "\xC0" |
7269 | 7269 | ) { |
7270 | 7270 | if (($str[$i + 1] & "\xC0") === "\x80") { |
7271 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
7271 | + $ret[] = $str[$i].$str[$i + 1]; |
|
7272 | 7272 | |
7273 | 7273 | ++$i; |
7274 | 7274 | } |
@@ -7282,7 +7282,7 @@ discard block |
||
7282 | 7282 | && |
7283 | 7283 | ($str[$i + 2] & "\xC0") === "\x80" |
7284 | 7284 | ) { |
7285 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
7285 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
7286 | 7286 | |
7287 | 7287 | $i += 2; |
7288 | 7288 | } |
@@ -7298,7 +7298,7 @@ discard block |
||
7298 | 7298 | && |
7299 | 7299 | ($str[$i + 3] & "\xC0") === "\x80" |
7300 | 7300 | ) { |
7301 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
7301 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
7302 | 7302 | |
7303 | 7303 | $i += 3; |
7304 | 7304 | } |
@@ -7310,7 +7310,7 @@ discard block |
||
7310 | 7310 | $ret = \array_chunk($ret, $length); |
7311 | 7311 | |
7312 | 7312 | return \array_map( |
7313 | - static function (array &$item): string { |
|
7313 | + static function(array &$item): string { |
|
7314 | 7314 | return \implode('', $item); |
7315 | 7315 | }, |
7316 | 7316 | $ret |
@@ -7373,7 +7373,7 @@ discard block |
||
7373 | 7373 | $limit = -1; |
7374 | 7374 | } |
7375 | 7375 | |
7376 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7376 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7377 | 7377 | |
7378 | 7378 | if ($array === false) { |
7379 | 7379 | return []; |
@@ -7457,9 +7457,9 @@ discard block |
||
7457 | 7457 | return ''; |
7458 | 7458 | } |
7459 | 7459 | |
7460 | - return (string) \mb_substr( |
|
7460 | + return (string)\mb_substr( |
|
7461 | 7461 | $str, |
7462 | - $offset + (int) \mb_strlen($separator) |
|
7462 | + $offset + (int)\mb_strlen($separator) |
|
7463 | 7463 | ); |
7464 | 7464 | } |
7465 | 7465 | |
@@ -7468,9 +7468,9 @@ discard block |
||
7468 | 7468 | return ''; |
7469 | 7469 | } |
7470 | 7470 | |
7471 | - return (string) \mb_substr( |
|
7471 | + return (string)\mb_substr( |
|
7472 | 7472 | $str, |
7473 | - $offset + (int) self::strlen($separator, $encoding), |
|
7473 | + $offset + (int)self::strlen($separator, $encoding), |
|
7474 | 7474 | null, |
7475 | 7475 | $encoding |
7476 | 7476 | ); |
@@ -7497,9 +7497,9 @@ discard block |
||
7497 | 7497 | return ''; |
7498 | 7498 | } |
7499 | 7499 | |
7500 | - return (string) \mb_substr( |
|
7500 | + return (string)\mb_substr( |
|
7501 | 7501 | $str, |
7502 | - $offset + (int) \mb_strlen($separator) |
|
7502 | + $offset + (int)\mb_strlen($separator) |
|
7503 | 7503 | ); |
7504 | 7504 | } |
7505 | 7505 | |
@@ -7508,9 +7508,9 @@ discard block |
||
7508 | 7508 | return ''; |
7509 | 7509 | } |
7510 | 7510 | |
7511 | - return (string) self::substr( |
|
7511 | + return (string)self::substr( |
|
7512 | 7512 | $str, |
7513 | - $offset + (int) self::strlen($separator, $encoding), |
|
7513 | + $offset + (int)self::strlen($separator, $encoding), |
|
7514 | 7514 | null, |
7515 | 7515 | $encoding |
7516 | 7516 | ); |
@@ -7540,7 +7540,7 @@ discard block |
||
7540 | 7540 | return ''; |
7541 | 7541 | } |
7542 | 7542 | |
7543 | - return (string) \mb_substr( |
|
7543 | + return (string)\mb_substr( |
|
7544 | 7544 | $str, |
7545 | 7545 | 0, |
7546 | 7546 | $offset |
@@ -7552,7 +7552,7 @@ discard block |
||
7552 | 7552 | return ''; |
7553 | 7553 | } |
7554 | 7554 | |
7555 | - return (string) self::substr( |
|
7555 | + return (string)self::substr( |
|
7556 | 7556 | $str, |
7557 | 7557 | 0, |
7558 | 7558 | $offset, |
@@ -7581,7 +7581,7 @@ discard block |
||
7581 | 7581 | return ''; |
7582 | 7582 | } |
7583 | 7583 | |
7584 | - return (string) \mb_substr( |
|
7584 | + return (string)\mb_substr( |
|
7585 | 7585 | $str, |
7586 | 7586 | 0, |
7587 | 7587 | $offset |
@@ -7595,7 +7595,7 @@ discard block |
||
7595 | 7595 | |
7596 | 7596 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7597 | 7597 | |
7598 | - return (string) self::substr( |
|
7598 | + return (string)self::substr( |
|
7599 | 7599 | $str, |
7600 | 7600 | 0, |
7601 | 7601 | $offset, |
@@ -7703,7 +7703,7 @@ discard block |
||
7703 | 7703 | */ |
7704 | 7704 | public static function str_surround(string $str, string $substring): string |
7705 | 7705 | { |
7706 | - return $substring . $str . $substring; |
|
7706 | + return $substring.$str.$substring; |
|
7707 | 7707 | } |
7708 | 7708 | |
7709 | 7709 | /** |
@@ -7747,9 +7747,9 @@ discard block |
||
7747 | 7747 | |
7748 | 7748 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
7749 | 7749 | |
7750 | - return (string) \preg_replace_callback( |
|
7750 | + return (string)\preg_replace_callback( |
|
7751 | 7751 | '/([\S]+)/u', |
7752 | - static function (array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7752 | + static function(array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7753 | 7753 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
7754 | 7754 | return $match[0]; |
7755 | 7755 | } |
@@ -7835,16 +7835,16 @@ discard block |
||
7835 | 7835 | } |
7836 | 7836 | |
7837 | 7837 | // the main substitutions |
7838 | - $str = (string) \preg_replace_callback( |
|
7838 | + $str = (string)\preg_replace_callback( |
|
7839 | 7839 | '~\b (_*) (?: # 1. Leading underscore and |
7840 | 7840 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
7841 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
7841 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
7842 | 7842 | | |
7843 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
7843 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
7844 | 7844 | | |
7845 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
7845 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
7846 | 7846 | | |
7847 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
7847 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
7848 | 7848 | ) (_*) \b # 6. With trailing underscore |
7849 | 7849 | ~ux', |
7850 | 7850 | /** |
@@ -7852,7 +7852,7 @@ discard block |
||
7852 | 7852 | * |
7853 | 7853 | * @return string |
7854 | 7854 | */ |
7855 | - static function (array $matches) use ($encoding): string { |
|
7855 | + static function(array $matches) use ($encoding): string { |
|
7856 | 7856 | // preserve leading underscore |
7857 | 7857 | $str = $matches[1]; |
7858 | 7858 | if ($matches[2]) { |
@@ -7877,26 +7877,26 @@ discard block |
||
7877 | 7877 | ); |
7878 | 7878 | |
7879 | 7879 | // Exceptions for small words: capitalize at start of title... |
7880 | - $str = (string) \preg_replace_callback( |
|
7880 | + $str = (string)\preg_replace_callback( |
|
7881 | 7881 | '~( \A [[:punct:]]* # start of title... |
7882 | 7882 | | [:.;?!][ ]+ # or of subsentence... |
7883 | 7883 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
7884 | - ( ' . $smallWordsRx . ' ) \b # ...followed by small word |
|
7884 | + ( ' . $smallWordsRx.' ) \b # ...followed by small word |
|
7885 | 7885 | ~uxi', |
7886 | 7886 | /** |
7887 | 7887 | * @param string[] $matches |
7888 | 7888 | * |
7889 | 7889 | * @return string |
7890 | 7890 | */ |
7891 | - static function (array $matches) use ($encoding): string { |
|
7892 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7891 | + static function(array $matches) use ($encoding): string { |
|
7892 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7893 | 7893 | }, |
7894 | 7894 | $str |
7895 | 7895 | ); |
7896 | 7896 | |
7897 | 7897 | // ...and end of title |
7898 | - $str = (string) \preg_replace_callback( |
|
7899 | - '~\b ( ' . $smallWordsRx . ' ) # small word... |
|
7898 | + $str = (string)\preg_replace_callback( |
|
7899 | + '~\b ( '.$smallWordsRx.' ) # small word... |
|
7900 | 7900 | (?= [[:punct:]]* \Z # ...at the end of the title... |
7901 | 7901 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
7902 | 7902 | ~uxi', |
@@ -7905,7 +7905,7 @@ discard block |
||
7905 | 7905 | * |
7906 | 7906 | * @return string |
7907 | 7907 | */ |
7908 | - static function (array $matches) use ($encoding): string { |
|
7908 | + static function(array $matches) use ($encoding): string { |
|
7909 | 7909 | return static::str_upper_first($matches[1], $encoding); |
7910 | 7910 | }, |
7911 | 7911 | $str |
@@ -7913,10 +7913,10 @@ discard block |
||
7913 | 7913 | |
7914 | 7914 | // Exceptions for small words in hyphenated compound words. |
7915 | 7915 | // e.g. "in-flight" -> In-Flight |
7916 | - $str = (string) \preg_replace_callback( |
|
7916 | + $str = (string)\preg_replace_callback( |
|
7917 | 7917 | '~\b |
7918 | 7918 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
7919 | - ( ' . $smallWordsRx . ' ) |
|
7919 | + ( ' . $smallWordsRx.' ) |
|
7920 | 7920 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
7921 | 7921 | ~uxi', |
7922 | 7922 | /** |
@@ -7924,18 +7924,18 @@ discard block |
||
7924 | 7924 | * |
7925 | 7925 | * @return string |
7926 | 7926 | */ |
7927 | - static function (array $matches) use ($encoding): string { |
|
7927 | + static function(array $matches) use ($encoding): string { |
|
7928 | 7928 | return static::str_upper_first($matches[1], $encoding); |
7929 | 7929 | }, |
7930 | 7930 | $str |
7931 | 7931 | ); |
7932 | 7932 | |
7933 | 7933 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
7934 | - $str = (string) \preg_replace_callback( |
|
7934 | + $str = (string)\preg_replace_callback( |
|
7935 | 7935 | '~\b |
7936 | 7936 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
7937 | 7937 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
7938 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
7938 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
7939 | 7939 | (?! - ) # Negative lookahead for another - |
7940 | 7940 | ~uxi', |
7941 | 7941 | /** |
@@ -7943,8 +7943,8 @@ discard block |
||
7943 | 7943 | * |
7944 | 7944 | * @return string |
7945 | 7945 | */ |
7946 | - static function (array $matches) use ($encoding): string { |
|
7947 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7946 | + static function(array $matches) use ($encoding): string { |
|
7947 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7948 | 7948 | }, |
7949 | 7949 | $str |
7950 | 7950 | ); |
@@ -8047,7 +8047,7 @@ discard block |
||
8047 | 8047 | ); |
8048 | 8048 | |
8049 | 8049 | foreach ($tmpReturn as &$item) { |
8050 | - $item = (string) $item; |
|
8050 | + $item = (string)$item; |
|
8051 | 8051 | } |
8052 | 8052 | |
8053 | 8053 | return $tmpReturn; |
@@ -8092,39 +8092,39 @@ discard block |
||
8092 | 8092 | } |
8093 | 8093 | |
8094 | 8094 | if ($encoding === 'UTF-8') { |
8095 | - if ($length >= (int) \mb_strlen($str)) { |
|
8095 | + if ($length >= (int)\mb_strlen($str)) { |
|
8096 | 8096 | return $str; |
8097 | 8097 | } |
8098 | 8098 | |
8099 | 8099 | if ($substring !== '') { |
8100 | - $length -= (int) \mb_strlen($substring); |
|
8100 | + $length -= (int)\mb_strlen($substring); |
|
8101 | 8101 | |
8102 | 8102 | /** @noinspection UnnecessaryCastingInspection */ |
8103 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8103 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8104 | 8104 | } |
8105 | 8105 | |
8106 | 8106 | /** @noinspection UnnecessaryCastingInspection */ |
8107 | - return (string) \mb_substr($str, 0, $length); |
|
8107 | + return (string)\mb_substr($str, 0, $length); |
|
8108 | 8108 | } |
8109 | 8109 | |
8110 | 8110 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8111 | 8111 | |
8112 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8112 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8113 | 8113 | return $str; |
8114 | 8114 | } |
8115 | 8115 | |
8116 | 8116 | if ($substring !== '') { |
8117 | - $length -= (int) self::strlen($substring, $encoding); |
|
8117 | + $length -= (int)self::strlen($substring, $encoding); |
|
8118 | 8118 | } |
8119 | 8119 | |
8120 | 8120 | return ( |
8121 | - (string) self::substr( |
|
8121 | + (string)self::substr( |
|
8122 | 8122 | $str, |
8123 | 8123 | 0, |
8124 | 8124 | $length, |
8125 | 8125 | $encoding |
8126 | 8126 | ) |
8127 | - ) . $substring; |
|
8127 | + ).$substring; |
|
8128 | 8128 | } |
8129 | 8129 | |
8130 | 8130 | /** |
@@ -8154,12 +8154,12 @@ discard block |
||
8154 | 8154 | } |
8155 | 8155 | |
8156 | 8156 | if ($encoding === 'UTF-8') { |
8157 | - if ($length >= (int) \mb_strlen($str)) { |
|
8157 | + if ($length >= (int)\mb_strlen($str)) { |
|
8158 | 8158 | return $str; |
8159 | 8159 | } |
8160 | 8160 | |
8161 | 8161 | // need to further trim the string so we can append the substring |
8162 | - $length -= (int) \mb_strlen($substring); |
|
8162 | + $length -= (int)\mb_strlen($substring); |
|
8163 | 8163 | if ($length <= 0) { |
8164 | 8164 | return $substring; |
8165 | 8165 | } |
@@ -8181,18 +8181,18 @@ discard block |
||
8181 | 8181 | || |
8182 | 8182 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8183 | 8183 | ) { |
8184 | - $truncated = (string) \mb_substr($truncated, 0, (int) $lastPos); |
|
8184 | + $truncated = (string)\mb_substr($truncated, 0, (int)$lastPos); |
|
8185 | 8185 | } |
8186 | 8186 | } |
8187 | 8187 | } else { |
8188 | 8188 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8189 | 8189 | |
8190 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8190 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8191 | 8191 | return $str; |
8192 | 8192 | } |
8193 | 8193 | |
8194 | 8194 | // need to further trim the string so we can append the substring |
8195 | - $length -= (int) self::strlen($substring, $encoding); |
|
8195 | + $length -= (int)self::strlen($substring, $encoding); |
|
8196 | 8196 | if ($length <= 0) { |
8197 | 8197 | return $substring; |
8198 | 8198 | } |
@@ -8214,12 +8214,12 @@ discard block |
||
8214 | 8214 | || |
8215 | 8215 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8216 | 8216 | ) { |
8217 | - $truncated = (string) self::substr($truncated, 0, (int) $lastPos, $encoding); |
|
8217 | + $truncated = (string)self::substr($truncated, 0, (int)$lastPos, $encoding); |
|
8218 | 8218 | } |
8219 | 8219 | } |
8220 | 8220 | } |
8221 | 8221 | |
8222 | - return $truncated . $substring; |
|
8222 | + return $truncated.$substring; |
|
8223 | 8223 | } |
8224 | 8224 | |
8225 | 8225 | /** |
@@ -8309,13 +8309,13 @@ discard block |
||
8309 | 8309 | } |
8310 | 8310 | } elseif ($format === 2) { |
8311 | 8311 | $numberOfWords = []; |
8312 | - $offset = (int) self::strlen($strParts[0]); |
|
8312 | + $offset = (int)self::strlen($strParts[0]); |
|
8313 | 8313 | for ($i = 1; $i < $len; $i += 2) { |
8314 | 8314 | $numberOfWords[$offset] = $strParts[$i]; |
8315 | - $offset += (int) self::strlen($strParts[$i]) + (int) self::strlen($strParts[$i + 1]); |
|
8315 | + $offset += (int)self::strlen($strParts[$i]) + (int)self::strlen($strParts[$i + 1]); |
|
8316 | 8316 | } |
8317 | 8317 | } else { |
8318 | - $numberOfWords = (int) (($len - 1) / 2); |
|
8318 | + $numberOfWords = (int)(($len - 1) / 2); |
|
8319 | 8319 | } |
8320 | 8320 | |
8321 | 8321 | return $numberOfWords; |
@@ -8379,7 +8379,7 @@ discard block |
||
8379 | 8379 | */ |
8380 | 8380 | public static function strcmp(string $str1, string $str2): int |
8381 | 8381 | { |
8382 | - return $str1 . '' === $str2 . '' ? 0 : \strcmp( |
|
8382 | + return $str1.'' === $str2.'' ? 0 : \strcmp( |
|
8383 | 8383 | \Normalizer::normalize($str1, \Normalizer::NFD), |
8384 | 8384 | \Normalizer::normalize($str2, \Normalizer::NFD) |
8385 | 8385 | ); |
@@ -8408,21 +8408,21 @@ discard block |
||
8408 | 8408 | } |
8409 | 8409 | |
8410 | 8410 | if ($charList === '') { |
8411 | - return (int) self::strlen($str, $encoding); |
|
8411 | + return (int)self::strlen($str, $encoding); |
|
8412 | 8412 | } |
8413 | 8413 | |
8414 | 8414 | if ($offset !== null || $length !== null) { |
8415 | 8415 | if ($encoding === 'UTF-8') { |
8416 | 8416 | if ($length === null) { |
8417 | 8417 | /** @noinspection UnnecessaryCastingInspection */ |
8418 | - $strTmp = \mb_substr($str, (int) $offset); |
|
8418 | + $strTmp = \mb_substr($str, (int)$offset); |
|
8419 | 8419 | } else { |
8420 | 8420 | /** @noinspection UnnecessaryCastingInspection */ |
8421 | - $strTmp = \mb_substr($str, (int) $offset, $length); |
|
8421 | + $strTmp = \mb_substr($str, (int)$offset, $length); |
|
8422 | 8422 | } |
8423 | 8423 | } else { |
8424 | 8424 | /** @noinspection UnnecessaryCastingInspection */ |
8425 | - $strTmp = self::substr($str, (int) $offset, $length, $encoding); |
|
8425 | + $strTmp = self::substr($str, (int)$offset, $length, $encoding); |
|
8426 | 8426 | } |
8427 | 8427 | |
8428 | 8428 | if ($strTmp === false) { |
@@ -8437,7 +8437,7 @@ discard block |
||
8437 | 8437 | } |
8438 | 8438 | |
8439 | 8439 | $matches = []; |
8440 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $matches)) { |
|
8440 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $matches)) { |
|
8441 | 8441 | $return = self::strlen($matches[1], $encoding); |
8442 | 8442 | if ($return === false) { |
8443 | 8443 | return 0; |
@@ -8446,7 +8446,7 @@ discard block |
||
8446 | 8446 | return $return; |
8447 | 8447 | } |
8448 | 8448 | |
8449 | - return (int) self::strlen($str, $encoding); |
|
8449 | + return (int)self::strlen($str, $encoding); |
|
8450 | 8450 | } |
8451 | 8451 | |
8452 | 8452 | /** |
@@ -8568,7 +8568,7 @@ discard block |
||
8568 | 8568 | return ''; |
8569 | 8569 | } |
8570 | 8570 | |
8571 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
8571 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
8572 | 8572 | } |
8573 | 8573 | |
8574 | 8574 | /** |
@@ -8633,7 +8633,7 @@ discard block |
||
8633 | 8633 | // fallback for ascii only |
8634 | 8634 | // |
8635 | 8635 | |
8636 | - if (self::is_ascii($haystack . $needle)) { |
|
8636 | + if (self::is_ascii($haystack.$needle)) { |
|
8637 | 8637 | return \stripos($haystack, $needle, $offset); |
8638 | 8638 | } |
8639 | 8639 | |
@@ -8700,7 +8700,7 @@ discard block |
||
8700 | 8700 | && |
8701 | 8701 | self::$SUPPORT['mbstring'] === false |
8702 | 8702 | ) { |
8703 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8703 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8704 | 8704 | } |
8705 | 8705 | |
8706 | 8706 | if ( |
@@ -8714,11 +8714,11 @@ discard block |
||
8714 | 8714 | } |
8715 | 8715 | } |
8716 | 8716 | |
8717 | - if (self::is_ascii($needle . $haystack)) { |
|
8717 | + if (self::is_ascii($needle.$haystack)) { |
|
8718 | 8718 | return \stristr($haystack, $needle, $before_needle); |
8719 | 8719 | } |
8720 | 8720 | |
8721 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
8721 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
8722 | 8722 | |
8723 | 8723 | if (!isset($match[1])) { |
8724 | 8724 | return false; |
@@ -8728,7 +8728,7 @@ discard block |
||
8728 | 8728 | return $match[1]; |
8729 | 8729 | } |
8730 | 8730 | |
8731 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
8731 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
8732 | 8732 | } |
8733 | 8733 | |
8734 | 8734 | /** |
@@ -8795,7 +8795,7 @@ discard block |
||
8795 | 8795 | && |
8796 | 8796 | self::$SUPPORT['iconv'] === false |
8797 | 8797 | ) { |
8798 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8798 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8799 | 8799 | } |
8800 | 8800 | |
8801 | 8801 | // |
@@ -8906,7 +8906,7 @@ discard block |
||
8906 | 8906 | */ |
8907 | 8907 | public static function strnatcmp(string $str1, string $str2): int |
8908 | 8908 | { |
8909 | - return $str1 . '' === $str2 . '' ? 0 : \strnatcmp((string) self::strtonatfold($str1), (string) self::strtonatfold($str2)); |
|
8909 | + return $str1.'' === $str2.'' ? 0 : \strnatcmp((string)self::strtonatfold($str1), (string)self::strtonatfold($str2)); |
|
8910 | 8910 | } |
8911 | 8911 | |
8912 | 8912 | /** |
@@ -8963,11 +8963,11 @@ discard block |
||
8963 | 8963 | } |
8964 | 8964 | |
8965 | 8965 | if ($encoding === 'UTF-8') { |
8966 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
8967 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
8966 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
8967 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
8968 | 8968 | } else { |
8969 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
8970 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
8969 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
8970 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
8971 | 8971 | } |
8972 | 8972 | |
8973 | 8973 | return self::strcmp($str1, $str2); |
@@ -8989,8 +8989,8 @@ discard block |
||
8989 | 8989 | return false; |
8990 | 8990 | } |
8991 | 8991 | |
8992 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
8993 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
8992 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
8993 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
8994 | 8994 | } |
8995 | 8995 | |
8996 | 8996 | return false; |
@@ -9023,10 +9023,10 @@ discard block |
||
9023 | 9023 | } |
9024 | 9024 | |
9025 | 9025 | // iconv and mbstring do not support integer $needle |
9026 | - if ((int) $needle === $needle) { |
|
9027 | - $needle = (string) self::chr($needle); |
|
9026 | + if ((int)$needle === $needle) { |
|
9027 | + $needle = (string)self::chr($needle); |
|
9028 | 9028 | } |
9029 | - $needle = (string) $needle; |
|
9029 | + $needle = (string)$needle; |
|
9030 | 9030 | |
9031 | 9031 | if ($needle === '') { |
9032 | 9032 | return false; |
@@ -9073,7 +9073,7 @@ discard block |
||
9073 | 9073 | && |
9074 | 9074 | self::$SUPPORT['mbstring'] === false |
9075 | 9075 | ) { |
9076 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9076 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9077 | 9077 | } |
9078 | 9078 | |
9079 | 9079 | // |
@@ -9114,7 +9114,7 @@ discard block |
||
9114 | 9114 | // fallback for ascii only |
9115 | 9115 | // |
9116 | 9116 | |
9117 | - if (self::is_ascii($haystack . $needle)) { |
|
9117 | + if (self::is_ascii($haystack.$needle)) { |
|
9118 | 9118 | return \strpos($haystack, $needle, $offset); |
9119 | 9119 | } |
9120 | 9120 | |
@@ -9126,7 +9126,7 @@ discard block |
||
9126 | 9126 | if ($haystackTmp === false) { |
9127 | 9127 | $haystackTmp = ''; |
9128 | 9128 | } |
9129 | - $haystack = (string) $haystackTmp; |
|
9129 | + $haystack = (string)$haystackTmp; |
|
9130 | 9130 | |
9131 | 9131 | if ($offset < 0) { |
9132 | 9132 | $offset = 0; |
@@ -9138,7 +9138,7 @@ discard block |
||
9138 | 9138 | } |
9139 | 9139 | |
9140 | 9140 | if ($pos) { |
9141 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9141 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9142 | 9142 | } |
9143 | 9143 | |
9144 | 9144 | return $offset + 0; |
@@ -9249,7 +9249,7 @@ discard block |
||
9249 | 9249 | && |
9250 | 9250 | self::$SUPPORT['mbstring'] === false |
9251 | 9251 | ) { |
9252 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9252 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9253 | 9253 | } |
9254 | 9254 | |
9255 | 9255 | // |
@@ -9261,7 +9261,7 @@ discard block |
||
9261 | 9261 | if ($needleTmp === false) { |
9262 | 9262 | return false; |
9263 | 9263 | } |
9264 | - $needle = (string) $needleTmp; |
|
9264 | + $needle = (string)$needleTmp; |
|
9265 | 9265 | |
9266 | 9266 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
9267 | 9267 | if ($pos === false) { |
@@ -9283,7 +9283,7 @@ discard block |
||
9283 | 9283 | if ($needleTmp === false) { |
9284 | 9284 | return false; |
9285 | 9285 | } |
9286 | - $needle = (string) $needleTmp; |
|
9286 | + $needle = (string)$needleTmp; |
|
9287 | 9287 | |
9288 | 9288 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
9289 | 9289 | if ($pos === false) { |
@@ -9319,7 +9319,7 @@ discard block |
||
9319 | 9319 | if ($encoding === 'UTF-8') { |
9320 | 9320 | if (self::$SUPPORT['intl'] === true) { |
9321 | 9321 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
9322 | - $i = (int) \grapheme_strlen($str); |
|
9322 | + $i = (int)\grapheme_strlen($str); |
|
9323 | 9323 | while ($i--) { |
9324 | 9324 | $reversedTmp = \grapheme_substr($str, $i, 1); |
9325 | 9325 | if ($reversedTmp !== false) { |
@@ -9327,7 +9327,7 @@ discard block |
||
9327 | 9327 | } |
9328 | 9328 | } |
9329 | 9329 | } else { |
9330 | - $i = (int) \mb_strlen($str); |
|
9330 | + $i = (int)\mb_strlen($str); |
|
9331 | 9331 | while ($i--) { |
9332 | 9332 | $reversedTmp = \mb_substr($str, $i, 1); |
9333 | 9333 | if ($reversedTmp !== false) { |
@@ -9338,7 +9338,7 @@ discard block |
||
9338 | 9338 | } else { |
9339 | 9339 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9340 | 9340 | |
9341 | - $i = (int) self::strlen($str, $encoding); |
|
9341 | + $i = (int)self::strlen($str, $encoding); |
|
9342 | 9342 | while ($i--) { |
9343 | 9343 | $reversedTmp = self::substr($str, $i, 1, $encoding); |
9344 | 9344 | if ($reversedTmp !== false) { |
@@ -9412,7 +9412,7 @@ discard block |
||
9412 | 9412 | if ($needleTmp === false) { |
9413 | 9413 | return false; |
9414 | 9414 | } |
9415 | - $needle = (string) $needleTmp; |
|
9415 | + $needle = (string)$needleTmp; |
|
9416 | 9416 | |
9417 | 9417 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
9418 | 9418 | if ($pos === false) { |
@@ -9451,10 +9451,10 @@ discard block |
||
9451 | 9451 | } |
9452 | 9452 | |
9453 | 9453 | // iconv and mbstring do not support integer $needle |
9454 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9455 | - $needle = (string) self::chr($needle); |
|
9454 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9455 | + $needle = (string)self::chr($needle); |
|
9456 | 9456 | } |
9457 | - $needle = (string) $needle; |
|
9457 | + $needle = (string)$needle; |
|
9458 | 9458 | |
9459 | 9459 | if ($needle === '') { |
9460 | 9460 | return false; |
@@ -9499,7 +9499,7 @@ discard block |
||
9499 | 9499 | && |
9500 | 9500 | self::$SUPPORT['mbstring'] === false |
9501 | 9501 | ) { |
9502 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9502 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9503 | 9503 | } |
9504 | 9504 | |
9505 | 9505 | // |
@@ -9523,7 +9523,7 @@ discard block |
||
9523 | 9523 | // fallback for ascii only |
9524 | 9524 | // |
9525 | 9525 | |
9526 | - if (self::is_ascii($haystack . $needle)) { |
|
9526 | + if (self::is_ascii($haystack.$needle)) { |
|
9527 | 9527 | return \strripos($haystack, $needle, $offset); |
9528 | 9528 | } |
9529 | 9529 | |
@@ -9599,10 +9599,10 @@ discard block |
||
9599 | 9599 | } |
9600 | 9600 | |
9601 | 9601 | // iconv and mbstring do not support integer $needle |
9602 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9603 | - $needle = (string) self::chr($needle); |
|
9602 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9603 | + $needle = (string)self::chr($needle); |
|
9604 | 9604 | } |
9605 | - $needle = (string) $needle; |
|
9605 | + $needle = (string)$needle; |
|
9606 | 9606 | |
9607 | 9607 | if ($needle === '') { |
9608 | 9608 | return false; |
@@ -9647,7 +9647,7 @@ discard block |
||
9647 | 9647 | && |
9648 | 9648 | self::$SUPPORT['mbstring'] === false |
9649 | 9649 | ) { |
9650 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9650 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9651 | 9651 | } |
9652 | 9652 | |
9653 | 9653 | // |
@@ -9671,7 +9671,7 @@ discard block |
||
9671 | 9671 | // fallback for ascii only |
9672 | 9672 | // |
9673 | 9673 | |
9674 | - if (self::is_ascii($haystack . $needle)) { |
|
9674 | + if (self::is_ascii($haystack.$needle)) { |
|
9675 | 9675 | return \strrpos($haystack, $needle, $offset); |
9676 | 9676 | } |
9677 | 9677 | |
@@ -9691,7 +9691,7 @@ discard block |
||
9691 | 9691 | if ($haystackTmp === false) { |
9692 | 9692 | $haystackTmp = ''; |
9693 | 9693 | } |
9694 | - $haystack = (string) $haystackTmp; |
|
9694 | + $haystack = (string)$haystackTmp; |
|
9695 | 9695 | } |
9696 | 9696 | |
9697 | 9697 | $pos = \strrpos($haystack, $needle); |
@@ -9704,7 +9704,7 @@ discard block |
||
9704 | 9704 | return false; |
9705 | 9705 | } |
9706 | 9706 | |
9707 | - return $offset + (int) self::strlen($strTmp); |
|
9707 | + return $offset + (int)self::strlen($strTmp); |
|
9708 | 9708 | } |
9709 | 9709 | |
9710 | 9710 | /** |
@@ -9764,12 +9764,12 @@ discard block |
||
9764 | 9764 | if ($offset || $length !== null) { |
9765 | 9765 | if ($encoding === 'UTF-8') { |
9766 | 9766 | if ($length === null) { |
9767 | - $str = (string) \mb_substr($str, $offset); |
|
9767 | + $str = (string)\mb_substr($str, $offset); |
|
9768 | 9768 | } else { |
9769 | - $str = (string) \mb_substr($str, $offset, $length); |
|
9769 | + $str = (string)\mb_substr($str, $offset, $length); |
|
9770 | 9770 | } |
9771 | 9771 | } else { |
9772 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
9772 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
9773 | 9773 | } |
9774 | 9774 | } |
9775 | 9775 | |
@@ -9779,7 +9779,7 @@ discard block |
||
9779 | 9779 | |
9780 | 9780 | $matches = []; |
9781 | 9781 | |
9782 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
9782 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
9783 | 9783 | } |
9784 | 9784 | |
9785 | 9785 | /** |
@@ -9848,7 +9848,7 @@ discard block |
||
9848 | 9848 | && |
9849 | 9849 | self::$SUPPORT['mbstring'] === false |
9850 | 9850 | ) { |
9851 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9851 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9852 | 9852 | } |
9853 | 9853 | |
9854 | 9854 | // |
@@ -9870,7 +9870,7 @@ discard block |
||
9870 | 9870 | // fallback for ascii only |
9871 | 9871 | // |
9872 | 9872 | |
9873 | - if (self::is_ascii($haystack . $needle)) { |
|
9873 | + if (self::is_ascii($haystack.$needle)) { |
|
9874 | 9874 | return \strstr($haystack, $needle, $before_needle); |
9875 | 9875 | } |
9876 | 9876 | |
@@ -9878,7 +9878,7 @@ discard block |
||
9878 | 9878 | // fallback via vanilla php |
9879 | 9879 | // |
9880 | 9880 | |
9881 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
9881 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
9882 | 9882 | |
9883 | 9883 | if (!isset($match[1])) { |
9884 | 9884 | return false; |
@@ -9888,7 +9888,7 @@ discard block |
||
9888 | 9888 | return $match[1]; |
9889 | 9889 | } |
9890 | 9890 | |
9891 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
9891 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
9892 | 9892 | } |
9893 | 9893 | |
9894 | 9894 | /** |
@@ -10002,7 +10002,7 @@ discard block |
||
10002 | 10002 | bool $tryToKeepStringLength = false |
10003 | 10003 | ): string { |
10004 | 10004 | // init |
10005 | - $str = (string) $str; |
|
10005 | + $str = (string)$str; |
|
10006 | 10006 | |
10007 | 10007 | if ($str === '') { |
10008 | 10008 | return ''; |
@@ -10031,19 +10031,19 @@ discard block |
||
10031 | 10031 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10032 | 10032 | } |
10033 | 10033 | |
10034 | - $langCode = $lang . '-Lower'; |
|
10034 | + $langCode = $lang.'-Lower'; |
|
10035 | 10035 | if (!\in_array($langCode, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10036 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, \E_USER_WARNING); |
|
10036 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, \E_USER_WARNING); |
|
10037 | 10037 | |
10038 | 10038 | $langCode = 'Any-Lower'; |
10039 | 10039 | } |
10040 | 10040 | |
10041 | 10041 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10042 | 10042 | /** @noinspection UnnecessaryCastingInspection */ |
10043 | - return (string) \transliterator_transliterate($langCode, $str); |
|
10043 | + return (string)\transliterator_transliterate($langCode, $str); |
|
10044 | 10044 | } |
10045 | 10045 | |
10046 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
10046 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
10047 | 10047 | } |
10048 | 10048 | |
10049 | 10049 | // always fallback via symfony polyfill |
@@ -10072,7 +10072,7 @@ discard block |
||
10072 | 10072 | bool $tryToKeepStringLength = false |
10073 | 10073 | ): string { |
10074 | 10074 | // init |
10075 | - $str = (string) $str; |
|
10075 | + $str = (string)$str; |
|
10076 | 10076 | |
10077 | 10077 | if ($str === '') { |
10078 | 10078 | return ''; |
@@ -10101,19 +10101,19 @@ discard block |
||
10101 | 10101 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10102 | 10102 | } |
10103 | 10103 | |
10104 | - $langCode = $lang . '-Upper'; |
|
10104 | + $langCode = $lang.'-Upper'; |
|
10105 | 10105 | if (!\in_array($langCode, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10106 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
10106 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
10107 | 10107 | |
10108 | 10108 | $langCode = 'Any-Upper'; |
10109 | 10109 | } |
10110 | 10110 | |
10111 | 10111 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10112 | 10112 | /** @noinspection UnnecessaryCastingInspection */ |
10113 | - return (string) \transliterator_transliterate($langCode, $str); |
|
10113 | + return (string)\transliterator_transliterate($langCode, $str); |
|
10114 | 10114 | } |
10115 | 10115 | |
10116 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
10116 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
10117 | 10117 | } |
10118 | 10118 | |
10119 | 10119 | // always fallback via symfony polyfill |
@@ -10157,7 +10157,7 @@ discard block |
||
10157 | 10157 | |
10158 | 10158 | $from = \array_combine($from, $to); |
10159 | 10159 | if ($from === false) { |
10160 | - 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) . ')'); |
|
10160 | + 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).')'); |
|
10161 | 10161 | } |
10162 | 10162 | } |
10163 | 10163 | |
@@ -10214,9 +10214,9 @@ discard block |
||
10214 | 10214 | } |
10215 | 10215 | |
10216 | 10216 | $wide = 0; |
10217 | - $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); |
|
10217 | + $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); |
|
10218 | 10218 | |
10219 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
10219 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
10220 | 10220 | } |
10221 | 10221 | |
10222 | 10222 | /** |
@@ -10316,9 +10316,9 @@ discard block |
||
10316 | 10316 | } |
10317 | 10317 | |
10318 | 10318 | if ($length === null) { |
10319 | - $length = (int) $str_length; |
|
10319 | + $length = (int)$str_length; |
|
10320 | 10320 | } else { |
10321 | - $length = (int) $length; |
|
10321 | + $length = (int)$length; |
|
10322 | 10322 | } |
10323 | 10323 | |
10324 | 10324 | if ( |
@@ -10326,7 +10326,7 @@ discard block |
||
10326 | 10326 | && |
10327 | 10327 | self::$SUPPORT['mbstring'] === false |
10328 | 10328 | ) { |
10329 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10329 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10330 | 10330 | } |
10331 | 10331 | |
10332 | 10332 | // |
@@ -10414,16 +10414,16 @@ discard block |
||
10414 | 10414 | ) { |
10415 | 10415 | if ($encoding === 'UTF-8') { |
10416 | 10416 | if ($length === null) { |
10417 | - $str1 = (string) \mb_substr($str1, $offset); |
|
10417 | + $str1 = (string)\mb_substr($str1, $offset); |
|
10418 | 10418 | } else { |
10419 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
10419 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
10420 | 10420 | } |
10421 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
10421 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
10422 | 10422 | } else { |
10423 | 10423 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10424 | 10424 | |
10425 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
10426 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
10425 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
10426 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
10427 | 10427 | } |
10428 | 10428 | } |
10429 | 10429 | |
@@ -10485,13 +10485,13 @@ discard block |
||
10485 | 10485 | if ($lengthTmp === false) { |
10486 | 10486 | return false; |
10487 | 10487 | } |
10488 | - $length = (int) $lengthTmp; |
|
10488 | + $length = (int)$lengthTmp; |
|
10489 | 10489 | } |
10490 | 10490 | |
10491 | 10491 | if ($encoding === 'UTF-8') { |
10492 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
10492 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
10493 | 10493 | } else { |
10494 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
10494 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
10495 | 10495 | } |
10496 | 10496 | } |
10497 | 10497 | |
@@ -10500,7 +10500,7 @@ discard block |
||
10500 | 10500 | && |
10501 | 10501 | self::$SUPPORT['mbstring'] === false |
10502 | 10502 | ) { |
10503 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10503 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10504 | 10504 | } |
10505 | 10505 | |
10506 | 10506 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10511,7 +10511,7 @@ discard block |
||
10511 | 10511 | return \mb_substr_count($haystack, $needle, $encoding); |
10512 | 10512 | } |
10513 | 10513 | |
10514 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10514 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10515 | 10515 | |
10516 | 10516 | return \count($matches); |
10517 | 10517 | } |
@@ -10558,7 +10558,7 @@ discard block |
||
10558 | 10558 | if ($lengthTmp === false) { |
10559 | 10559 | return false; |
10560 | 10560 | } |
10561 | - $length = (int) $lengthTmp; |
|
10561 | + $length = (int)$lengthTmp; |
|
10562 | 10562 | } |
10563 | 10563 | |
10564 | 10564 | if ( |
@@ -10579,7 +10579,7 @@ discard block |
||
10579 | 10579 | if ($haystackTmp === false) { |
10580 | 10580 | $haystackTmp = ''; |
10581 | 10581 | } |
10582 | - $haystack = (string) $haystackTmp; |
|
10582 | + $haystack = (string)$haystackTmp; |
|
10583 | 10583 | } |
10584 | 10584 | |
10585 | 10585 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10618,10 +10618,10 @@ discard block |
||
10618 | 10618 | |
10619 | 10619 | if ($encoding === 'UTF-8') { |
10620 | 10620 | if ($caseSensitive) { |
10621 | - return (int) \mb_substr_count($str, $substring); |
|
10621 | + return (int)\mb_substr_count($str, $substring); |
|
10622 | 10622 | } |
10623 | 10623 | |
10624 | - return (int) \mb_substr_count( |
|
10624 | + return (int)\mb_substr_count( |
|
10625 | 10625 | \mb_strtoupper($str), |
10626 | 10626 | \mb_strtoupper($substring) |
10627 | 10627 | |
@@ -10631,10 +10631,10 @@ discard block |
||
10631 | 10631 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10632 | 10632 | |
10633 | 10633 | if ($caseSensitive) { |
10634 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
10634 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
10635 | 10635 | } |
10636 | 10636 | |
10637 | - return (int) \mb_substr_count( |
|
10637 | + return (int)\mb_substr_count( |
|
10638 | 10638 | self::strtocasefold($str, true, false, $encoding, null, false), |
10639 | 10639 | self::strtocasefold($substring, true, false, $encoding, null, false), |
10640 | 10640 | $encoding |
@@ -10660,7 +10660,7 @@ discard block |
||
10660 | 10660 | } |
10661 | 10661 | |
10662 | 10662 | if (self::str_istarts_with($haystack, $needle) === true) { |
10663 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10663 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10664 | 10664 | } |
10665 | 10665 | |
10666 | 10666 | return $haystack; |
@@ -10717,7 +10717,7 @@ discard block |
||
10717 | 10717 | } |
10718 | 10718 | |
10719 | 10719 | if (self::str_iends_with($haystack, $needle) === true) { |
10720 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
10720 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
10721 | 10721 | } |
10722 | 10722 | |
10723 | 10723 | return $haystack; |
@@ -10742,7 +10742,7 @@ discard block |
||
10742 | 10742 | } |
10743 | 10743 | |
10744 | 10744 | if (self::str_starts_with($haystack, $needle) === true) { |
10745 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10745 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10746 | 10746 | } |
10747 | 10747 | |
10748 | 10748 | return $haystack; |
@@ -10794,7 +10794,7 @@ discard block |
||
10794 | 10794 | if (\is_array($offset) === true) { |
10795 | 10795 | $offset = \array_slice($offset, 0, $num); |
10796 | 10796 | foreach ($offset as &$valueTmp) { |
10797 | - $valueTmp = (int) $valueTmp === $valueTmp ? $valueTmp : 0; |
|
10797 | + $valueTmp = (int)$valueTmp === $valueTmp ? $valueTmp : 0; |
|
10798 | 10798 | } |
10799 | 10799 | unset($valueTmp); |
10800 | 10800 | } else { |
@@ -10807,7 +10807,7 @@ discard block |
||
10807 | 10807 | } elseif (\is_array($length) === true) { |
10808 | 10808 | $length = \array_slice($length, 0, $num); |
10809 | 10809 | foreach ($length as &$valueTmpV2) { |
10810 | - $valueTmpV2 = (int) $valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10810 | + $valueTmpV2 = (int)$valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10811 | 10811 | } |
10812 | 10812 | unset($valueTmpV2); |
10813 | 10813 | } else { |
@@ -10827,8 +10827,8 @@ discard block |
||
10827 | 10827 | } |
10828 | 10828 | |
10829 | 10829 | // init |
10830 | - $str = (string) $str; |
|
10831 | - $replacement = (string) $replacement; |
|
10830 | + $str = (string)$str; |
|
10831 | + $replacement = (string)$replacement; |
|
10832 | 10832 | |
10833 | 10833 | if (\is_array($length) === true) { |
10834 | 10834 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -10843,16 +10843,16 @@ discard block |
||
10843 | 10843 | } |
10844 | 10844 | |
10845 | 10845 | if (self::$SUPPORT['mbstring'] === true) { |
10846 | - $string_length = (int) self::strlen($str, $encoding); |
|
10846 | + $string_length = (int)self::strlen($str, $encoding); |
|
10847 | 10847 | |
10848 | 10848 | if ($offset < 0) { |
10849 | - $offset = (int) \max(0, $string_length + $offset); |
|
10849 | + $offset = (int)\max(0, $string_length + $offset); |
|
10850 | 10850 | } elseif ($offset > $string_length) { |
10851 | 10851 | $offset = $string_length; |
10852 | 10852 | } |
10853 | 10853 | |
10854 | 10854 | if ($length !== null && $length < 0) { |
10855 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
10855 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
10856 | 10856 | } elseif ($length === null || $length > $string_length) { |
10857 | 10857 | $length = $string_length; |
10858 | 10858 | } |
@@ -10863,9 +10863,9 @@ discard block |
||
10863 | 10863 | } |
10864 | 10864 | |
10865 | 10865 | /** @noinspection AdditionOperationOnArraysInspection */ |
10866 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
10867 | - $replacement . |
|
10868 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10866 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
10867 | + $replacement. |
|
10868 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10869 | 10869 | } |
10870 | 10870 | |
10871 | 10871 | // |
@@ -10874,8 +10874,7 @@ discard block |
||
10874 | 10874 | |
10875 | 10875 | if (self::is_ascii($str)) { |
10876 | 10876 | return ($length === null) ? |
10877 | - \substr_replace($str, $replacement, $offset) : |
|
10878 | - \substr_replace($str, $replacement, $offset, $length); |
|
10877 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
10879 | 10878 | } |
10880 | 10879 | |
10881 | 10880 | // |
@@ -10891,7 +10890,7 @@ discard block |
||
10891 | 10890 | // e.g.: non mbstring support + invalid chars |
10892 | 10891 | return ''; |
10893 | 10892 | } |
10894 | - $length = (int) $lengthTmp; |
|
10893 | + $length = (int)$lengthTmp; |
|
10895 | 10894 | } |
10896 | 10895 | |
10897 | 10896 | \array_splice($smatches[0], $offset, $length, $rmatches[0]); |
@@ -10926,14 +10925,14 @@ discard block |
||
10926 | 10925 | && |
10927 | 10926 | \substr($haystack, -\strlen($needle)) === $needle |
10928 | 10927 | ) { |
10929 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
10928 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
10930 | 10929 | } |
10931 | 10930 | |
10932 | 10931 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
10933 | - return (string) self::substr( |
|
10932 | + return (string)self::substr( |
|
10934 | 10933 | $haystack, |
10935 | 10934 | 0, |
10936 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
10935 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
10937 | 10936 | $encoding |
10938 | 10937 | ); |
10939 | 10938 | } |
@@ -10963,10 +10962,10 @@ discard block |
||
10963 | 10962 | } |
10964 | 10963 | |
10965 | 10964 | if ($encoding === 'UTF-8') { |
10966 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10965 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10967 | 10966 | } |
10968 | 10967 | |
10969 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10968 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10970 | 10969 | } |
10971 | 10970 | |
10972 | 10971 | /** |
@@ -11158,7 +11157,7 @@ discard block |
||
11158 | 11157 | // INFO: https://unicode.org/cldr/utility/character.jsp?a=%E2%84%8C |
11159 | 11158 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11160 | 11159 | /** @noinspection UnnecessaryCastingInspection */ |
11161 | - $str = (string) \transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11160 | + $str = (string)\transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11162 | 11161 | |
11163 | 11162 | // check again, if we only have ASCII, now ... |
11164 | 11163 | if (self::is_ascii($str) === true) { |
@@ -11281,7 +11280,7 @@ discard block |
||
11281 | 11280 | public static function to_boolean($str): bool |
11282 | 11281 | { |
11283 | 11282 | // init |
11284 | - $str = (string) $str; |
|
11283 | + $str = (string)$str; |
|
11285 | 11284 | |
11286 | 11285 | if ($str === '') { |
11287 | 11286 | return false; |
@@ -11309,10 +11308,10 @@ discard block |
||
11309 | 11308 | } |
11310 | 11309 | |
11311 | 11310 | if (\is_numeric($str)) { |
11312 | - return ((float) $str + 0) > 0; |
|
11311 | + return ((float)$str + 0) > 0; |
|
11313 | 11312 | } |
11314 | 11313 | |
11315 | - return (bool) \trim($str); |
|
11314 | + return (bool)\trim($str); |
|
11316 | 11315 | } |
11317 | 11316 | |
11318 | 11317 | /** |
@@ -11333,11 +11332,11 @@ discard block |
||
11333 | 11332 | |
11334 | 11333 | $fallback_char_escaped = \preg_quote($fallback_char, '/'); |
11335 | 11334 | |
11336 | - $string = (string) \preg_replace( |
|
11335 | + $string = (string)\preg_replace( |
|
11337 | 11336 | [ |
11338 | - '/[^' . $fallback_char_escaped . '\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
11339 | - '/[\s]+/u', // 2) convert spaces to $fallback_char |
|
11340 | - '/[' . $fallback_char_escaped . ']+/u', // 3) remove double $fallback_char's |
|
11337 | + '/[^'.$fallback_char_escaped.'\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
11338 | + '/[\s]+/u', // 2) convert spaces to $fallback_char |
|
11339 | + '/['.$fallback_char_escaped.']+/u', // 3) remove double $fallback_char's |
|
11341 | 11340 | ], |
11342 | 11341 | [ |
11343 | 11342 | '', |
@@ -11368,7 +11367,7 @@ discard block |
||
11368 | 11367 | return $str; |
11369 | 11368 | } |
11370 | 11369 | |
11371 | - $str = (string) $str; |
|
11370 | + $str = (string)$str; |
|
11372 | 11371 | if ($str === '') { |
11373 | 11372 | return ''; |
11374 | 11373 | } |
@@ -11415,7 +11414,7 @@ discard block |
||
11415 | 11414 | return $str; |
11416 | 11415 | } |
11417 | 11416 | |
11418 | - $str = (string) $str; |
|
11417 | + $str = (string)$str; |
|
11419 | 11418 | if ($str === '') { |
11420 | 11419 | return $str; |
11421 | 11420 | } |
@@ -11433,7 +11432,7 @@ discard block |
||
11433 | 11432 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
11434 | 11433 | |
11435 | 11434 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11436 | - $buf .= $c1 . $c2; |
|
11435 | + $buf .= $c1.$c2; |
|
11437 | 11436 | ++$i; |
11438 | 11437 | } else { // not valid UTF8 - convert it |
11439 | 11438 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11444,7 +11443,7 @@ discard block |
||
11444 | 11443 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
11445 | 11444 | |
11446 | 11445 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11447 | - $buf .= $c1 . $c2 . $c3; |
|
11446 | + $buf .= $c1.$c2.$c3; |
|
11448 | 11447 | $i += 2; |
11449 | 11448 | } else { // not valid UTF8 - convert it |
11450 | 11449 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11456,7 +11455,7 @@ discard block |
||
11456 | 11455 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
11457 | 11456 | |
11458 | 11457 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11459 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
11458 | + $buf .= $c1.$c2.$c3.$c4; |
|
11460 | 11459 | $i += 3; |
11461 | 11460 | } else { // not valid UTF8 - convert it |
11462 | 11461 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11482,13 +11481,13 @@ discard block |
||
11482 | 11481 | * |
11483 | 11482 | * @return string |
11484 | 11483 | */ |
11485 | - static function (array $matches): string { |
|
11484 | + static function(array $matches): string { |
|
11486 | 11485 | if (isset($matches[3])) { |
11487 | - $cp = (int) \hexdec($matches[3]); |
|
11486 | + $cp = (int)\hexdec($matches[3]); |
|
11488 | 11487 | } else { |
11489 | 11488 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
11490 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
11491 | - + (int) \hexdec($matches[2]) |
|
11489 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
11490 | + + (int)\hexdec($matches[2]) |
|
11492 | 11491 | + 0x10000 |
11493 | 11492 | - (0xD800 << 10) |
11494 | 11493 | - 0xDC00; |
@@ -11499,12 +11498,12 @@ discard block |
||
11499 | 11498 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
11500 | 11499 | |
11501 | 11500 | if ($cp < 0x80) { |
11502 | - return (string) self::chr($cp); |
|
11501 | + return (string)self::chr($cp); |
|
11503 | 11502 | } |
11504 | 11503 | |
11505 | 11504 | if ($cp < 0xA0) { |
11506 | 11505 | /** @noinspection UnnecessaryCastingInspection */ |
11507 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
11506 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
11508 | 11507 | } |
11509 | 11508 | |
11510 | 11509 | return self::decimal_to_chr($cp); |
@@ -11552,7 +11551,7 @@ discard block |
||
11552 | 11551 | |
11553 | 11552 | if (self::$SUPPORT['mbstring'] === true) { |
11554 | 11553 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11555 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
11554 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
11556 | 11555 | } |
11557 | 11556 | |
11558 | 11557 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -11589,15 +11588,15 @@ discard block |
||
11589 | 11588 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
11590 | 11589 | |
11591 | 11590 | if ($encoding === 'UTF-8') { |
11592 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
11591 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
11593 | 11592 | |
11594 | 11593 | if ($useMbFunction === true) { |
11595 | 11594 | $strPartOne = \mb_strtoupper( |
11596 | - (string) \mb_substr($str, 0, 1) |
|
11595 | + (string)\mb_substr($str, 0, 1) |
|
11597 | 11596 | ); |
11598 | 11597 | } else { |
11599 | 11598 | $strPartOne = self::strtoupper( |
11600 | - (string) \mb_substr($str, 0, 1), |
|
11599 | + (string)\mb_substr($str, 0, 1), |
|
11601 | 11600 | $encoding, |
11602 | 11601 | false, |
11603 | 11602 | $lang, |
@@ -11607,16 +11606,16 @@ discard block |
||
11607 | 11606 | } else { |
11608 | 11607 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11609 | 11608 | |
11610 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
11609 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
11611 | 11610 | |
11612 | 11611 | if ($useMbFunction === true) { |
11613 | 11612 | $strPartOne = \mb_strtoupper( |
11614 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
11613 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
11615 | 11614 | $encoding |
11616 | 11615 | ); |
11617 | 11616 | } else { |
11618 | 11617 | $strPartOne = self::strtoupper( |
11619 | - (string) self::substr($str, 0, 1, $encoding), |
|
11618 | + (string)self::substr($str, 0, 1, $encoding), |
|
11620 | 11619 | $encoding, |
11621 | 11620 | false, |
11622 | 11621 | $lang, |
@@ -11625,7 +11624,7 @@ discard block |
||
11625 | 11624 | } |
11626 | 11625 | } |
11627 | 11626 | |
11628 | - return $strPartOne . $strPartTwo; |
|
11627 | + return $strPartOne.$strPartTwo; |
|
11629 | 11628 | } |
11630 | 11629 | |
11631 | 11630 | /** |
@@ -11676,7 +11675,7 @@ discard block |
||
11676 | 11675 | $str = self::clean($str); |
11677 | 11676 | } |
11678 | 11677 | |
11679 | - $usePhpDefaultFunctions = !(bool) ($charlist . \implode('', $exceptions)); |
|
11678 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
11680 | 11679 | |
11681 | 11680 | if ( |
11682 | 11681 | $usePhpDefaultFunctions === true |
@@ -12063,7 +12062,7 @@ discard block |
||
12063 | 12062 | if ( |
12064 | 12063 | $keepUtf8Chars === true |
12065 | 12064 | && |
12066 | - self::strlen($return) >= (int) self::strlen($str_backup) |
|
12065 | + self::strlen($return) >= (int)self::strlen($str_backup) |
|
12067 | 12066 | ) { |
12068 | 12067 | return $str_backup; |
12069 | 12068 | } |
@@ -12139,17 +12138,17 @@ discard block |
||
12139 | 12138 | return ''; |
12140 | 12139 | } |
12141 | 12140 | |
12142 | - \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches); |
|
12141 | + \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches); |
|
12143 | 12142 | |
12144 | 12143 | if ( |
12145 | 12144 | !isset($matches[0]) |
12146 | 12145 | || |
12147 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
12146 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
12148 | 12147 | ) { |
12149 | 12148 | return $str; |
12150 | 12149 | } |
12151 | 12150 | |
12152 | - return \rtrim($matches[0]) . $strAddOn; |
|
12151 | + return \rtrim($matches[0]).$strAddOn; |
|
12153 | 12152 | } |
12154 | 12153 | |
12155 | 12154 | /** |
@@ -12220,7 +12219,7 @@ discard block |
||
12220 | 12219 | $strReturn .= $break; |
12221 | 12220 | } |
12222 | 12221 | |
12223 | - return $strReturn . \implode('', $chars); |
|
12222 | + return $strReturn.\implode('', $chars); |
|
12224 | 12223 | } |
12225 | 12224 | |
12226 | 12225 | /** |
@@ -12233,7 +12232,7 @@ discard block |
||
12233 | 12232 | */ |
12234 | 12233 | public static function wordwrap_per_line(string $str, int $limit): string |
12235 | 12234 | { |
12236 | - $strings = (array) \preg_split('/\\r\\n|\\r|\\n/', $str); |
|
12235 | + $strings = (array)\preg_split('/\\r\\n|\\r|\\n/', $str); |
|
12237 | 12236 | |
12238 | 12237 | $string = ''; |
12239 | 12238 | foreach ($strings as &$value) { |
@@ -12312,7 +12311,7 @@ discard block |
||
12312 | 12311 | /** @noinspection PhpIncludeInspection */ |
12313 | 12312 | /** @noinspection UsingInclusionReturnValueInspection */ |
12314 | 12313 | /** @psalm-suppress UnresolvableInclude */ |
12315 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
12314 | + return include __DIR__.'/data/'.$file.'.php'; |
|
12316 | 12315 | } |
12317 | 12316 | |
12318 | 12317 | /** |
@@ -12324,7 +12323,7 @@ discard block |
||
12324 | 12323 | */ |
12325 | 12324 | private static function getDataIfExists(string $file) |
12326 | 12325 | { |
12327 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
12326 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
12328 | 12327 | if (\file_exists($file)) { |
12329 | 12328 | /** @noinspection PhpIncludeInspection */ |
12330 | 12329 | /** @noinspection UsingInclusionReturnValueInspection */ |
@@ -12346,7 +12345,7 @@ discard block |
||
12346 | 12345 | |
12347 | 12346 | \uksort( |
12348 | 12347 | self::$EMOJI, |
12349 | - static function (string $a, string $b): int { |
|
12348 | + static function(string $a, string $b): int { |
|
12350 | 12349 | return \strlen($b) <=> \strlen($a); |
12351 | 12350 | } |
12352 | 12351 | ); |
@@ -12356,7 +12355,7 @@ discard block |
||
12356 | 12355 | |
12357 | 12356 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
12358 | 12357 | $tmpKey = \crc32($key); |
12359 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmpKey . '_-_' . \strrev((string) $tmpKey) . '_-_8FTU_ELBATROP_-_'; |
|
12358 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmpKey.'_-_'.\strrev((string)$tmpKey).'_-_8FTU_ELBATROP_-_'; |
|
12360 | 12359 | } |
12361 | 12360 | |
12362 | 12361 | return true; |
@@ -12380,7 +12379,7 @@ discard block |
||
12380 | 12379 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
12381 | 12380 | return \defined('MB_OVERLOAD_STRING') |
12382 | 12381 | && |
12383 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12382 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12384 | 12383 | } |
12385 | 12384 | |
12386 | 12385 | /** |
@@ -12430,7 +12429,7 @@ discard block |
||
12430 | 12429 | { |
12431 | 12430 | static $RX_CLASS_CACHE = []; |
12432 | 12431 | |
12433 | - $cacheKey = $s . $class; |
|
12432 | + $cacheKey = $s.$class; |
|
12434 | 12433 | |
12435 | 12434 | if (isset($RX_CLASS_CACHE[$cacheKey])) { |
12436 | 12435 | return $RX_CLASS_CACHE[$cacheKey]; |
@@ -12442,7 +12441,7 @@ discard block |
||
12442 | 12441 | /** @noinspection AlterInForeachInspection */ |
12443 | 12442 | foreach (self::str_split($s) as &$s) { |
12444 | 12443 | if ($s === '-') { |
12445 | - $classArray[0] = '-' . $classArray[0]; |
|
12444 | + $classArray[0] = '-'.$classArray[0]; |
|
12446 | 12445 | } elseif (!isset($s[2])) { |
12447 | 12446 | $classArray[0] .= \preg_quote($s, '/'); |
12448 | 12447 | } elseif (self::strlen($s) === 1) { |
@@ -12453,13 +12452,13 @@ discard block |
||
12453 | 12452 | } |
12454 | 12453 | |
12455 | 12454 | if ($classArray[0]) { |
12456 | - $classArray[0] = '[' . $classArray[0] . ']'; |
|
12455 | + $classArray[0] = '['.$classArray[0].']'; |
|
12457 | 12456 | } |
12458 | 12457 | |
12459 | 12458 | if (\count($classArray) === 1) { |
12460 | 12459 | $return = $classArray[0]; |
12461 | 12460 | } else { |
12462 | - $return = '(?:' . \implode('|', $classArray) . ')'; |
|
12461 | + $return = '(?:'.\implode('|', $classArray).')'; |
|
12463 | 12462 | } |
12464 | 12463 | |
12465 | 12464 | $RX_CLASS_CACHE[$cacheKey] = $return; |
@@ -12533,7 +12532,7 @@ discard block |
||
12533 | 12532 | $continue = false; |
12534 | 12533 | |
12535 | 12534 | if ($delimiter === '-') { |
12536 | - foreach ((array) $specialCases['names'] as &$beginning) { |
|
12535 | + foreach ((array)$specialCases['names'] as &$beginning) { |
|
12537 | 12536 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12538 | 12537 | $continue = true; |
12539 | 12538 | } |
@@ -12541,7 +12540,7 @@ discard block |
||
12541 | 12540 | unset($beginning); |
12542 | 12541 | } |
12543 | 12542 | |
12544 | - foreach ((array) $specialCases['prefixes'] as &$beginning) { |
|
12543 | + foreach ((array)$specialCases['prefixes'] as &$beginning) { |
|
12545 | 12544 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12546 | 12545 | $continue = true; |
12547 | 12546 | } |
@@ -12601,8 +12600,8 @@ discard block |
||
12601 | 12600 | $buf .= self::$WIN1252_TO_UTF8[$ordC1]; |
12602 | 12601 | } else { |
12603 | 12602 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
12604 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
12605 | - $buf .= $cc1 . $cc2; |
|
12603 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
12604 | + $buf .= $cc1.$cc2; |
|
12606 | 12605 | } |
12607 | 12606 | |
12608 | 12607 | return $buf; |
@@ -12617,7 +12616,7 @@ discard block |
||
12617 | 12616 | { |
12618 | 12617 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
12619 | 12618 | if (\preg_match($pattern, $str)) { |
12620 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
12619 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
12621 | 12620 | } |
12622 | 12621 | |
12623 | 12622 | return $str; |