@@ -245,10 +245,10 @@ discard block |
||
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | if ($encoding === 'UTF-8') { |
| 248 | - return (string) \mb_substr($str, $pos, 1); |
|
| 248 | + return (string)\mb_substr($str, $pos, 1); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
| 251 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | /** |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | public static function add_bom_to_string(string $str): string |
| 267 | 267 | { |
| 268 | 268 | if (!self::string_has_bom($str)) { |
| 269 | - $str = self::bom() . $str; |
|
| 269 | + $str = self::bom().$str; |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | return $str; |
@@ -301,8 +301,8 @@ discard block |
||
| 301 | 301 | $return = []; |
| 302 | 302 | foreach ($array as $key => &$value) { |
| 303 | 303 | $key = $case === \CASE_LOWER |
| 304 | - ? self::strtolower((string) $key, $encoding) |
|
| 305 | - : self::strtoupper((string) $key, $encoding); |
|
| 304 | + ? self::strtolower((string)$key, $encoding) |
|
| 305 | + : self::strtoupper((string)$key, $encoding); |
|
| 306 | 306 | |
| 307 | 307 | $return[$key] = $value; |
| 308 | 308 | } |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | return ''; |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
| 341 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
| 342 | 342 | $end_position = \mb_strpos($str, $end, $substr_index); |
| 343 | 343 | if ( |
| 344 | 344 | $end_position === false |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | return ''; |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
| 351 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | return ''; |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
| 361 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
| 362 | 362 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
| 363 | 363 | if ( |
| 364 | 364 | $end_position === false |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | return ''; |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - return (string) self::substr( |
|
| 371 | + return (string)self::substr( |
|
| 372 | 372 | $str, |
| 373 | 373 | $substr_index, |
| 374 | 374 | $end_position - $substr_index, |
@@ -446,10 +446,10 @@ discard block |
||
| 446 | 446 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
| 447 | 447 | { |
| 448 | 448 | if ($encoding === 'UTF-8') { |
| 449 | - return (string) \mb_substr($str, $index, 1); |
|
| 449 | + return (string)\mb_substr($str, $index, 1); |
|
| 450 | 450 | } |
| 451 | 451 | |
| 452 | - return (string) self::substr($str, $index, 1, $encoding); |
|
| 452 | + return (string)self::substr($str, $index, 1, $encoding); |
|
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | /** |
@@ -563,10 +563,10 @@ discard block |
||
| 563 | 563 | /** |
| 564 | 564 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 565 | 565 | */ |
| 566 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 566 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 567 | 567 | } |
| 568 | 568 | |
| 569 | - $cache_key = $code_point . '_' . $encoding; |
|
| 569 | + $cache_key = $code_point.'_'.$encoding; |
|
| 570 | 570 | if (isset($CHAR_CACHE[$cache_key])) { |
| 571 | 571 | return $CHAR_CACHE[$cache_key]; |
| 572 | 572 | } |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | self::$CHR = self::getData('chr'); |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | - $code_point = (int) $code_point; |
|
| 615 | + $code_point = (int)$code_point; |
|
| 616 | 616 | if ($code_point <= 0x7F) { |
| 617 | 617 | /** |
| 618 | 618 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -622,22 +622,22 @@ discard block |
||
| 622 | 622 | /** |
| 623 | 623 | * @psalm-suppress PossiblyNullArrayAccess |
| 624 | 624 | */ |
| 625 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
| 625 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
| 626 | 626 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 627 | 627 | } elseif ($code_point <= 0xFFFF) { |
| 628 | 628 | /** |
| 629 | 629 | * @psalm-suppress PossiblyNullArrayAccess |
| 630 | 630 | */ |
| 631 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
| 632 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 631 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
| 632 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 633 | 633 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 634 | 634 | } else { |
| 635 | 635 | /** |
| 636 | 636 | * @psalm-suppress PossiblyNullArrayAccess |
| 637 | 637 | */ |
| 638 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
| 639 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 640 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 638 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
| 639 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
| 640 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 641 | 641 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 642 | 642 | } |
| 643 | 643 | |
@@ -690,7 +690,7 @@ discard block |
||
| 690 | 690 | |
| 691 | 691 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
| 692 | 692 | return \array_map( |
| 693 | - static function (string $data): int { |
|
| 693 | + static function(string $data): int { |
|
| 694 | 694 | // "mb_" is available if overload is used, so use it ... |
| 695 | 695 | return \mb_strlen($data, 'CP850'); // 8-BIT |
| 696 | 696 | }, |
@@ -771,7 +771,7 @@ discard block |
||
| 771 | 771 | $char = ''; |
| 772 | 772 | } |
| 773 | 773 | |
| 774 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
| 774 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
| 775 | 775 | } |
| 776 | 776 | |
| 777 | 777 | /** |
@@ -864,7 +864,7 @@ discard block |
||
| 864 | 864 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
| 865 | 865 | /x'; |
| 866 | 866 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
| 867 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
| 867 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
| 868 | 868 | |
| 869 | 869 | if ($replace_diamond_question_mark) { |
| 870 | 870 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -901,7 +901,7 @@ discard block |
||
| 901 | 901 | public static function cleanup($str): string |
| 902 | 902 | { |
| 903 | 903 | // init |
| 904 | - $str = (string) $str; |
|
| 904 | + $str = (string)$str; |
|
| 905 | 905 | |
| 906 | 906 | if ($str === '') { |
| 907 | 907 | return ''; |
@@ -998,7 +998,7 @@ discard block |
||
| 998 | 998 | { |
| 999 | 999 | if (self::$SUPPORT['mbstring'] === true) { |
| 1000 | 1000 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 1001 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 1001 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 1002 | 1002 | } |
| 1003 | 1003 | |
| 1004 | 1004 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -1043,7 +1043,7 @@ discard block |
||
| 1043 | 1043 | */ |
| 1044 | 1044 | public static function css_stripe_media_queries(string $str): string |
| 1045 | 1045 | { |
| 1046 | - return (string) \preg_replace( |
|
| 1046 | + return (string)\preg_replace( |
|
| 1047 | 1047 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
| 1048 | 1048 | '', |
| 1049 | 1049 | $str |
@@ -1074,7 +1074,7 @@ discard block |
||
| 1074 | 1074 | */ |
| 1075 | 1075 | public static function decimal_to_chr($int): string |
| 1076 | 1076 | { |
| 1077 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
| 1077 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
| 1078 | 1078 | } |
| 1079 | 1079 | |
| 1080 | 1080 | /** |
@@ -1124,7 +1124,7 @@ discard block |
||
| 1124 | 1124 | $flagOffset = 0x1F1E6; |
| 1125 | 1125 | $asciiOffset = 0x41; |
| 1126 | 1126 | |
| 1127 | - return self::chr(self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset) . |
|
| 1127 | + return self::chr(self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset). |
|
| 1128 | 1128 | self::chr(self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset); |
| 1129 | 1129 | } |
| 1130 | 1130 | |
@@ -1147,16 +1147,16 @@ discard block |
||
| 1147 | 1147 | self::initEmojiData(); |
| 1148 | 1148 | |
| 1149 | 1149 | if ($use_reversible_string_mappings) { |
| 1150 | - return (string) \str_replace( |
|
| 1151 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1152 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1150 | + return (string)\str_replace( |
|
| 1151 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1152 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1153 | 1153 | $str |
| 1154 | 1154 | ); |
| 1155 | 1155 | } |
| 1156 | 1156 | |
| 1157 | - return (string) \str_replace( |
|
| 1158 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 1159 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1157 | + return (string)\str_replace( |
|
| 1158 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 1159 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1160 | 1160 | $str |
| 1161 | 1161 | ); |
| 1162 | 1162 | } |
@@ -1180,16 +1180,16 @@ discard block |
||
| 1180 | 1180 | self::initEmojiData(); |
| 1181 | 1181 | |
| 1182 | 1182 | if ($use_reversible_string_mappings) { |
| 1183 | - return (string) \str_replace( |
|
| 1184 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1185 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1183 | + return (string)\str_replace( |
|
| 1184 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1185 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1186 | 1186 | $str |
| 1187 | 1187 | ); |
| 1188 | 1188 | } |
| 1189 | 1189 | |
| 1190 | - return (string) \str_replace( |
|
| 1191 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1192 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 1190 | + return (string)\str_replace( |
|
| 1191 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1192 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 1193 | 1193 | $str |
| 1194 | 1194 | ); |
| 1195 | 1195 | } |
@@ -1245,7 +1245,7 @@ discard block |
||
| 1245 | 1245 | if ($to_encoding === 'JSON') { |
| 1246 | 1246 | $return = self::json_encode($str); |
| 1247 | 1247 | if ($return === false) { |
| 1248 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
| 1248 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
| 1249 | 1249 | } |
| 1250 | 1250 | |
| 1251 | 1251 | return $return; |
@@ -1335,7 +1335,7 @@ discard block |
||
| 1335 | 1335 | /** |
| 1336 | 1336 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 1337 | 1337 | */ |
| 1338 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
| 1338 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
| 1339 | 1339 | } |
| 1340 | 1340 | |
| 1341 | 1341 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1434,31 +1434,31 @@ discard block |
||
| 1434 | 1434 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
| 1435 | 1435 | |
| 1436 | 1436 | if ($length === null) { |
| 1437 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
| 1437 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
| 1438 | 1438 | } |
| 1439 | 1439 | |
| 1440 | 1440 | if ($search === '') { |
| 1441 | 1441 | if ($encoding === 'UTF-8') { |
| 1442 | 1442 | if ($length > 0) { |
| 1443 | - $string_length = (int) \mb_strlen($str); |
|
| 1443 | + $string_length = (int)\mb_strlen($str); |
|
| 1444 | 1444 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
| 1445 | 1445 | } else { |
| 1446 | 1446 | $end = 0; |
| 1447 | 1447 | } |
| 1448 | 1448 | |
| 1449 | - $pos = (int) \min( |
|
| 1449 | + $pos = (int)\min( |
|
| 1450 | 1450 | \mb_strpos($str, ' ', $end), |
| 1451 | 1451 | \mb_strpos($str, '.', $end) |
| 1452 | 1452 | ); |
| 1453 | 1453 | } else { |
| 1454 | 1454 | if ($length > 0) { |
| 1455 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 1455 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 1456 | 1456 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
| 1457 | 1457 | } else { |
| 1458 | 1458 | $end = 0; |
| 1459 | 1459 | } |
| 1460 | 1460 | |
| 1461 | - $pos = (int) \min( |
|
| 1461 | + $pos = (int)\min( |
|
| 1462 | 1462 | self::strpos($str, ' ', $end, $encoding), |
| 1463 | 1463 | self::strpos($str, '.', $end, $encoding) |
| 1464 | 1464 | ); |
@@ -1475,18 +1475,18 @@ discard block |
||
| 1475 | 1475 | return ''; |
| 1476 | 1476 | } |
| 1477 | 1477 | |
| 1478 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1478 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1479 | 1479 | } |
| 1480 | 1480 | |
| 1481 | 1481 | return $str; |
| 1482 | 1482 | } |
| 1483 | 1483 | |
| 1484 | 1484 | if ($encoding === 'UTF-8') { |
| 1485 | - $word_position = (int) \mb_stripos($str, $search); |
|
| 1486 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
| 1485 | + $word_position = (int)\mb_stripos($str, $search); |
|
| 1486 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
| 1487 | 1487 | } else { |
| 1488 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
| 1489 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
| 1488 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
| 1489 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
| 1490 | 1490 | } |
| 1491 | 1491 | |
| 1492 | 1492 | $pos_start = 0; |
@@ -1498,12 +1498,12 @@ discard block |
||
| 1498 | 1498 | } |
| 1499 | 1499 | if ($half_text !== false) { |
| 1500 | 1500 | if ($encoding === 'UTF-8') { |
| 1501 | - $pos_start = (int) \max( |
|
| 1501 | + $pos_start = (int)\max( |
|
| 1502 | 1502 | \mb_strrpos($half_text, ' '), |
| 1503 | 1503 | \mb_strrpos($half_text, '.') |
| 1504 | 1504 | ); |
| 1505 | 1505 | } else { |
| 1506 | - $pos_start = (int) \max( |
|
| 1506 | + $pos_start = (int)\max( |
|
| 1507 | 1507 | self::strrpos($half_text, ' ', 0, $encoding), |
| 1508 | 1508 | self::strrpos($half_text, '.', 0, $encoding) |
| 1509 | 1509 | ); |
@@ -1513,19 +1513,19 @@ discard block |
||
| 1513 | 1513 | |
| 1514 | 1514 | if ($word_position && $half_side > 0) { |
| 1515 | 1515 | $offset = $pos_start + $length - 1; |
| 1516 | - $real_length = (int) self::strlen($str, $encoding); |
|
| 1516 | + $real_length = (int)self::strlen($str, $encoding); |
|
| 1517 | 1517 | |
| 1518 | 1518 | if ($offset > $real_length) { |
| 1519 | 1519 | $offset = $real_length; |
| 1520 | 1520 | } |
| 1521 | 1521 | |
| 1522 | 1522 | if ($encoding === 'UTF-8') { |
| 1523 | - $pos_end = (int) \min( |
|
| 1523 | + $pos_end = (int)\min( |
|
| 1524 | 1524 | \mb_strpos($str, ' ', $offset), |
| 1525 | 1525 | \mb_strpos($str, '.', $offset) |
| 1526 | 1526 | ) - $pos_start; |
| 1527 | 1527 | } else { |
| 1528 | - $pos_end = (int) \min( |
|
| 1528 | + $pos_end = (int)\min( |
|
| 1529 | 1529 | self::strpos($str, ' ', $offset, $encoding), |
| 1530 | 1530 | self::strpos($str, '.', $offset, $encoding) |
| 1531 | 1531 | ) - $pos_start; |
@@ -1533,12 +1533,12 @@ discard block |
||
| 1533 | 1533 | |
| 1534 | 1534 | if (!$pos_end || $pos_end <= 0) { |
| 1535 | 1535 | if ($encoding === 'UTF-8') { |
| 1536 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
| 1536 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
| 1537 | 1537 | } else { |
| 1538 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
| 1538 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
| 1539 | 1539 | } |
| 1540 | 1540 | if ($str_sub !== false) { |
| 1541 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
| 1541 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
| 1542 | 1542 | } else { |
| 1543 | 1543 | $extract = ''; |
| 1544 | 1544 | } |
@@ -1549,26 +1549,26 @@ discard block |
||
| 1549 | 1549 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
| 1550 | 1550 | } |
| 1551 | 1551 | if ($str_sub !== false) { |
| 1552 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1552 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1553 | 1553 | } else { |
| 1554 | 1554 | $extract = ''; |
| 1555 | 1555 | } |
| 1556 | 1556 | } |
| 1557 | 1557 | } else { |
| 1558 | 1558 | $offset = $length - 1; |
| 1559 | - $true_length = (int) self::strlen($str, $encoding); |
|
| 1559 | + $true_length = (int)self::strlen($str, $encoding); |
|
| 1560 | 1560 | |
| 1561 | 1561 | if ($offset > $true_length) { |
| 1562 | 1562 | $offset = $true_length; |
| 1563 | 1563 | } |
| 1564 | 1564 | |
| 1565 | 1565 | if ($encoding === 'UTF-8') { |
| 1566 | - $pos_end = (int) \min( |
|
| 1566 | + $pos_end = (int)\min( |
|
| 1567 | 1567 | \mb_strpos($str, ' ', $offset), |
| 1568 | 1568 | \mb_strpos($str, '.', $offset) |
| 1569 | 1569 | ); |
| 1570 | 1570 | } else { |
| 1571 | - $pos_end = (int) \min( |
|
| 1571 | + $pos_end = (int)\min( |
|
| 1572 | 1572 | self::strpos($str, ' ', $offset, $encoding), |
| 1573 | 1573 | self::strpos($str, '.', $offset, $encoding) |
| 1574 | 1574 | ); |
@@ -1581,7 +1581,7 @@ discard block |
||
| 1581 | 1581 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
| 1582 | 1582 | } |
| 1583 | 1583 | if ($str_sub !== false) { |
| 1584 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1584 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1585 | 1585 | } else { |
| 1586 | 1586 | $extract = ''; |
| 1587 | 1587 | } |
@@ -1710,7 +1710,7 @@ discard block |
||
| 1710 | 1710 | { |
| 1711 | 1711 | $file_content = \file_get_contents($file_path); |
| 1712 | 1712 | if ($file_content === false) { |
| 1713 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
| 1713 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
| 1714 | 1714 | } |
| 1715 | 1715 | |
| 1716 | 1716 | return self::string_has_bom($file_content); |
@@ -1770,7 +1770,7 @@ discard block |
||
| 1770 | 1770 | ) { |
| 1771 | 1771 | // Prevent leading combining chars |
| 1772 | 1772 | // for NFC-safe concatenations. |
| 1773 | - $var = $leading_combining . $var; |
|
| 1773 | + $var = $leading_combining.$var; |
|
| 1774 | 1774 | } |
| 1775 | 1775 | } |
| 1776 | 1776 | |
@@ -2055,10 +2055,10 @@ discard block |
||
| 2055 | 2055 | } |
| 2056 | 2056 | |
| 2057 | 2057 | if ($encoding === 'UTF-8') { |
| 2058 | - return (string) \mb_substr($str, 0, $n); |
|
| 2058 | + return (string)\mb_substr($str, 0, $n); |
|
| 2059 | 2059 | } |
| 2060 | 2060 | |
| 2061 | - return (string) self::substr($str, 0, $n, $encoding); |
|
| 2061 | + return (string)self::substr($str, 0, $n, $encoding); |
|
| 2062 | 2062 | } |
| 2063 | 2063 | |
| 2064 | 2064 | /** |
@@ -2074,7 +2074,7 @@ discard block |
||
| 2074 | 2074 | */ |
| 2075 | 2075 | public static function fits_inside(string $str, int $box_size): bool |
| 2076 | 2076 | { |
| 2077 | - return (int) self::strlen($str) <= $box_size; |
|
| 2077 | + return (int)self::strlen($str) <= $box_size; |
|
| 2078 | 2078 | } |
| 2079 | 2079 | |
| 2080 | 2080 | /** |
@@ -2153,7 +2153,7 @@ discard block |
||
| 2153 | 2153 | return $str; |
| 2154 | 2154 | } |
| 2155 | 2155 | |
| 2156 | - $str = (string) $str; |
|
| 2156 | + $str = (string)$str; |
|
| 2157 | 2157 | $last = ''; |
| 2158 | 2158 | while ($last !== $str) { |
| 2159 | 2159 | $last = $str; |
@@ -2360,7 +2360,7 @@ discard block |
||
| 2360 | 2360 | return $fallback; |
| 2361 | 2361 | } |
| 2362 | 2362 | /** @noinspection OffsetOperationsInspection */ |
| 2363 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
| 2363 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
| 2364 | 2364 | |
| 2365 | 2365 | // DEBUG |
| 2366 | 2366 | //var_dump($type_code); |
@@ -2418,7 +2418,7 @@ discard block |
||
| 2418 | 2418 | // |
| 2419 | 2419 | |
| 2420 | 2420 | if ($encoding === 'UTF-8') { |
| 2421 | - $max_length = (int) \mb_strlen($possible_chars); |
|
| 2421 | + $max_length = (int)\mb_strlen($possible_chars); |
|
| 2422 | 2422 | if ($max_length === 0) { |
| 2423 | 2423 | return ''; |
| 2424 | 2424 | } |
@@ -2439,7 +2439,7 @@ discard block |
||
| 2439 | 2439 | } else { |
| 2440 | 2440 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 2441 | 2441 | |
| 2442 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
| 2442 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
| 2443 | 2443 | if ($max_length === 0) { |
| 2444 | 2444 | return ''; |
| 2445 | 2445 | } |
@@ -2477,16 +2477,16 @@ discard block |
||
| 2477 | 2477 | $rand_int = \mt_rand(0, \mt_getrandmax()); |
| 2478 | 2478 | } |
| 2479 | 2479 | |
| 2480 | - $unique_helper = $rand_int . |
|
| 2481 | - \session_id() . |
|
| 2482 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2483 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2480 | + $unique_helper = $rand_int. |
|
| 2481 | + \session_id(). |
|
| 2482 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
| 2483 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
| 2484 | 2484 | $extra_entropy; |
| 2485 | 2485 | |
| 2486 | 2486 | $unique_string = \uniqid($unique_helper, true); |
| 2487 | 2487 | |
| 2488 | 2488 | if ($use_md5) { |
| 2489 | - $unique_string = \md5($unique_string . $unique_helper); |
|
| 2489 | + $unique_string = \md5($unique_string.$unique_helper); |
|
| 2490 | 2490 | } |
| 2491 | 2491 | |
| 2492 | 2492 | return $unique_string; |
@@ -2597,7 +2597,7 @@ discard block |
||
| 2597 | 2597 | public static function hex_to_int($hexdec) |
| 2598 | 2598 | { |
| 2599 | 2599 | // init |
| 2600 | - $hexdec = (string) $hexdec; |
|
| 2600 | + $hexdec = (string)$hexdec; |
|
| 2601 | 2601 | |
| 2602 | 2602 | if ($hexdec === '') { |
| 2603 | 2603 | return false; |
@@ -2694,7 +2694,7 @@ discard block |
||
| 2694 | 2694 | return \implode( |
| 2695 | 2695 | '', |
| 2696 | 2696 | \array_map( |
| 2697 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
| 2697 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
| 2698 | 2698 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
| 2699 | 2699 | }, |
| 2700 | 2700 | self::str_split($str) |
@@ -2806,7 +2806,7 @@ discard block |
||
| 2806 | 2806 | /** |
| 2807 | 2807 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 2808 | 2808 | */ |
| 2809 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 2809 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 2810 | 2810 | } |
| 2811 | 2811 | |
| 2812 | 2812 | do { |
@@ -2815,7 +2815,7 @@ discard block |
||
| 2815 | 2815 | if (\strpos($str, '&') !== false) { |
| 2816 | 2816 | if (\strpos($str, '&#') !== false) { |
| 2817 | 2817 | // decode also numeric & UTF16 two byte entities |
| 2818 | - $str = (string) \preg_replace( |
|
| 2818 | + $str = (string)\preg_replace( |
|
| 2819 | 2819 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
| 2820 | 2820 | '$1;', |
| 2821 | 2821 | $str |
@@ -2865,7 +2865,7 @@ discard block |
||
| 2865 | 2865 | */ |
| 2866 | 2866 | public static function html_stripe_empty_tags(string $str): string |
| 2867 | 2867 | { |
| 2868 | - return (string) \preg_replace( |
|
| 2868 | + return (string)\preg_replace( |
|
| 2869 | 2869 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
| 2870 | 2870 | '', |
| 2871 | 2871 | $str |
@@ -3185,9 +3185,9 @@ discard block |
||
| 3185 | 3185 | { |
| 3186 | 3186 | $hex = \dechex($int); |
| 3187 | 3187 | |
| 3188 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
| 3188 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
| 3189 | 3189 | |
| 3190 | - return $prefix . $hex . ''; |
|
| 3190 | + return $prefix.$hex.''; |
|
| 3191 | 3191 | } |
| 3192 | 3192 | |
| 3193 | 3193 | /** |
@@ -3508,7 +3508,7 @@ discard block |
||
| 3508 | 3508 | */ |
| 3509 | 3509 | public static function is_binary($input, bool $strict = false): bool |
| 3510 | 3510 | { |
| 3511 | - $input = (string) $input; |
|
| 3511 | + $input = (string)$input; |
|
| 3512 | 3512 | if ($input === '') { |
| 3513 | 3513 | return false; |
| 3514 | 3514 | } |
@@ -3852,7 +3852,7 @@ discard block |
||
| 3852 | 3852 | public static function is_utf16($str, bool $check_if_string_is_binary = true) |
| 3853 | 3853 | { |
| 3854 | 3854 | // init |
| 3855 | - $str = (string) $str; |
|
| 3855 | + $str = (string)$str; |
|
| 3856 | 3856 | $str_chars = []; |
| 3857 | 3857 | |
| 3858 | 3858 | if ( |
@@ -3938,7 +3938,7 @@ discard block |
||
| 3938 | 3938 | public static function is_utf32($str, bool $check_if_string_is_binary = true) |
| 3939 | 3939 | { |
| 3940 | 3940 | // init |
| 3941 | - $str = (string) $str; |
|
| 3941 | + $str = (string)$str; |
|
| 3942 | 3942 | $str_chars = []; |
| 3943 | 3943 | |
| 3944 | 3944 | if ( |
@@ -4030,7 +4030,7 @@ discard block |
||
| 4030 | 4030 | return true; |
| 4031 | 4031 | } |
| 4032 | 4032 | |
| 4033 | - return self::is_utf8_string((string) $str, $strict); |
|
| 4033 | + return self::is_utf8_string((string)$str, $strict); |
|
| 4034 | 4034 | } |
| 4035 | 4035 | |
| 4036 | 4036 | /** |
@@ -4180,15 +4180,15 @@ discard block |
||
| 4180 | 4180 | $use_mb_functions = ($lang === null && !$try_to_keep_the_string_length); |
| 4181 | 4181 | |
| 4182 | 4182 | if ($encoding === 'UTF-8') { |
| 4183 | - $str_part_two = (string) \mb_substr($str, 1); |
|
| 4183 | + $str_part_two = (string)\mb_substr($str, 1); |
|
| 4184 | 4184 | |
| 4185 | 4185 | if ($use_mb_functions) { |
| 4186 | 4186 | $str_part_one = \mb_strtolower( |
| 4187 | - (string) \mb_substr($str, 0, 1) |
|
| 4187 | + (string)\mb_substr($str, 0, 1) |
|
| 4188 | 4188 | ); |
| 4189 | 4189 | } else { |
| 4190 | 4190 | $str_part_one = self::strtolower( |
| 4191 | - (string) \mb_substr($str, 0, 1), |
|
| 4191 | + (string)\mb_substr($str, 0, 1), |
|
| 4192 | 4192 | $encoding, |
| 4193 | 4193 | false, |
| 4194 | 4194 | $lang, |
@@ -4198,10 +4198,10 @@ discard block |
||
| 4198 | 4198 | } else { |
| 4199 | 4199 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4200 | 4200 | |
| 4201 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
| 4201 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
| 4202 | 4202 | |
| 4203 | 4203 | $str_part_one = self::strtolower( |
| 4204 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 4204 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 4205 | 4205 | $encoding, |
| 4206 | 4206 | false, |
| 4207 | 4207 | $lang, |
@@ -4209,7 +4209,7 @@ discard block |
||
| 4209 | 4209 | ); |
| 4210 | 4210 | } |
| 4211 | 4211 | |
| 4212 | - return $str_part_one . $str_part_two; |
|
| 4212 | + return $str_part_one.$str_part_two; |
|
| 4213 | 4213 | } |
| 4214 | 4214 | |
| 4215 | 4215 | /** |
@@ -4356,7 +4356,7 @@ discard block |
||
| 4356 | 4356 | } |
| 4357 | 4357 | |
| 4358 | 4358 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4359 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 4359 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 4360 | 4360 | } |
| 4361 | 4361 | |
| 4362 | 4362 | if ($chars) { |
@@ -4409,7 +4409,7 @@ discard block |
||
| 4409 | 4409 | { |
| 4410 | 4410 | $bytes = self::chr_size_list($str); |
| 4411 | 4411 | if ($bytes !== []) { |
| 4412 | - return (int) \max($bytes); |
|
| 4412 | + return (int)\max($bytes); |
|
| 4413 | 4413 | } |
| 4414 | 4414 | |
| 4415 | 4415 | return 0; |
@@ -4491,7 +4491,7 @@ discard block |
||
| 4491 | 4491 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
| 4492 | 4492 | |
| 4493 | 4493 | // init |
| 4494 | - $encoding = (string) $encoding; |
|
| 4494 | + $encoding = (string)$encoding; |
|
| 4495 | 4495 | |
| 4496 | 4496 | if (!$encoding) { |
| 4497 | 4497 | return $fallback; |
@@ -4553,7 +4553,7 @@ discard block |
||
| 4553 | 4553 | |
| 4554 | 4554 | $encoding_original = $encoding; |
| 4555 | 4555 | $encoding = \strtoupper($encoding); |
| 4556 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
| 4556 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
| 4557 | 4557 | |
| 4558 | 4558 | $equivalences = [ |
| 4559 | 4559 | 'ISO8859' => 'ISO-8859-1', |
@@ -4711,13 +4711,13 @@ discard block |
||
| 4711 | 4711 | static $CHAR_CACHE = []; |
| 4712 | 4712 | |
| 4713 | 4713 | // init |
| 4714 | - $chr = (string) $chr; |
|
| 4714 | + $chr = (string)$chr; |
|
| 4715 | 4715 | |
| 4716 | 4716 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
| 4717 | 4717 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4718 | 4718 | } |
| 4719 | 4719 | |
| 4720 | - $cache_key = $chr . '_' . $encoding; |
|
| 4720 | + $cache_key = $chr.'_'.$encoding; |
|
| 4721 | 4721 | if (isset($CHAR_CACHE[$cache_key])) { |
| 4722 | 4722 | return $CHAR_CACHE[$cache_key]; |
| 4723 | 4723 | } |
@@ -4752,7 +4752,7 @@ discard block |
||
| 4752 | 4752 | // |
| 4753 | 4753 | |
| 4754 | 4754 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 4755 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
| 4755 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
| 4756 | 4756 | /** @noinspection OffsetOperationsInspection */ |
| 4757 | 4757 | $code = $chr ? $chr[1] : 0; |
| 4758 | 4758 | |
@@ -4760,21 +4760,21 @@ discard block |
||
| 4760 | 4760 | if ($code >= 0xF0 && isset($chr[4])) { |
| 4761 | 4761 | /** @noinspection UnnecessaryCastingInspection */ |
| 4762 | 4762 | /** @noinspection OffsetOperationsInspection */ |
| 4763 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 4763 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 4764 | 4764 | } |
| 4765 | 4765 | |
| 4766 | 4766 | /** @noinspection OffsetOperationsInspection */ |
| 4767 | 4767 | if ($code >= 0xE0 && isset($chr[3])) { |
| 4768 | 4768 | /** @noinspection UnnecessaryCastingInspection */ |
| 4769 | 4769 | /** @noinspection OffsetOperationsInspection */ |
| 4770 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 4770 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 4771 | 4771 | } |
| 4772 | 4772 | |
| 4773 | 4773 | /** @noinspection OffsetOperationsInspection */ |
| 4774 | 4774 | if ($code >= 0xC0 && isset($chr[2])) { |
| 4775 | 4775 | /** @noinspection UnnecessaryCastingInspection */ |
| 4776 | 4776 | /** @noinspection OffsetOperationsInspection */ |
| 4777 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 4777 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 4778 | 4778 | } |
| 4779 | 4779 | |
| 4780 | 4780 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -4831,7 +4831,7 @@ discard block |
||
| 4831 | 4831 | public static function pcre_utf8_support(): bool |
| 4832 | 4832 | { |
| 4833 | 4833 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 4834 | - return (bool) @\preg_match('//u', ''); |
|
| 4834 | + return (bool)@\preg_match('//u', ''); |
|
| 4835 | 4835 | } |
| 4836 | 4836 | |
| 4837 | 4837 | /** |
@@ -4870,14 +4870,14 @@ discard block |
||
| 4870 | 4870 | * @psalm-suppress DocblockTypeContradiction |
| 4871 | 4871 | */ |
| 4872 | 4872 | if (!\is_numeric($step)) { |
| 4873 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
| 4873 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
| 4874 | 4874 | } |
| 4875 | 4875 | |
| 4876 | 4876 | /** |
| 4877 | 4877 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
| 4878 | 4878 | */ |
| 4879 | 4879 | if ($step <= 0) { |
| 4880 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
| 4880 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
| 4881 | 4881 | } |
| 4882 | 4882 | } |
| 4883 | 4883 | |
@@ -4889,14 +4889,14 @@ discard block |
||
| 4889 | 4889 | $is_xdigit = false; |
| 4890 | 4890 | |
| 4891 | 4891 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4892 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
| 4892 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
| 4893 | 4893 | $is_digit = true; |
| 4894 | - $start = (int) $var1; |
|
| 4894 | + $start = (int)$var1; |
|
| 4895 | 4895 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
| 4896 | 4896 | $is_xdigit = true; |
| 4897 | - $start = (int) self::hex_to_int($var1); |
|
| 4897 | + $start = (int)self::hex_to_int($var1); |
|
| 4898 | 4898 | } elseif (!$use_ctype && \is_numeric($var1)) { |
| 4899 | - $start = (int) $var1; |
|
| 4899 | + $start = (int)$var1; |
|
| 4900 | 4900 | } else { |
| 4901 | 4901 | $start = self::ord($var1); |
| 4902 | 4902 | } |
@@ -4906,11 +4906,11 @@ discard block |
||
| 4906 | 4906 | } |
| 4907 | 4907 | |
| 4908 | 4908 | if ($is_digit) { |
| 4909 | - $end = (int) $var2; |
|
| 4909 | + $end = (int)$var2; |
|
| 4910 | 4910 | } elseif ($is_xdigit) { |
| 4911 | - $end = (int) self::hex_to_int($var2); |
|
| 4911 | + $end = (int)self::hex_to_int($var2); |
|
| 4912 | 4912 | } elseif (!$use_ctype && \is_numeric($var2)) { |
| 4913 | - $end = (int) $var2; |
|
| 4913 | + $end = (int)$var2; |
|
| 4914 | 4914 | } else { |
| 4915 | 4915 | $end = self::ord($var2); |
| 4916 | 4916 | } |
@@ -4921,7 +4921,7 @@ discard block |
||
| 4921 | 4921 | |
| 4922 | 4922 | $array = []; |
| 4923 | 4923 | foreach (\range($start, $end, $step) as $i) { |
| 4924 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
| 4924 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
| 4925 | 4925 | } |
| 4926 | 4926 | |
| 4927 | 4927 | return $array; |
@@ -5031,8 +5031,8 @@ discard block |
||
| 5031 | 5031 | $delimiter = '/'; |
| 5032 | 5032 | } |
| 5033 | 5033 | |
| 5034 | - return (string) \preg_replace( |
|
| 5035 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
| 5034 | + return (string)\preg_replace( |
|
| 5035 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
| 5036 | 5036 | $replacement, |
| 5037 | 5037 | $str |
| 5038 | 5038 | ); |
@@ -5080,9 +5080,9 @@ discard block |
||
| 5080 | 5080 | return ''; |
| 5081 | 5081 | } |
| 5082 | 5082 | |
| 5083 | - $str_length -= (int) $bom_byte_length; |
|
| 5083 | + $str_length -= (int)$bom_byte_length; |
|
| 5084 | 5084 | |
| 5085 | - $str = (string) $str_tmp; |
|
| 5085 | + $str = (string)$str_tmp; |
|
| 5086 | 5086 | } |
| 5087 | 5087 | } |
| 5088 | 5088 | |
@@ -5111,7 +5111,7 @@ discard block |
||
| 5111 | 5111 | */ |
| 5112 | 5112 | if (\is_array($what)) { |
| 5113 | 5113 | foreach ($what as $item) { |
| 5114 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
| 5114 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
| 5115 | 5115 | } |
| 5116 | 5116 | } |
| 5117 | 5117 | |
@@ -5149,7 +5149,7 @@ discard block |
||
| 5149 | 5149 | */ |
| 5150 | 5150 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
| 5151 | 5151 | { |
| 5152 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 5152 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 5153 | 5153 | } |
| 5154 | 5154 | |
| 5155 | 5155 | /** |
@@ -5204,17 +5204,17 @@ discard block |
||
| 5204 | 5204 | ): string { |
| 5205 | 5205 | if ($substring && \strpos($str, $substring) === 0) { |
| 5206 | 5206 | if ($encoding === 'UTF-8') { |
| 5207 | - return (string) \mb_substr( |
|
| 5207 | + return (string)\mb_substr( |
|
| 5208 | 5208 | $str, |
| 5209 | - (int) \mb_strlen($substring) |
|
| 5209 | + (int)\mb_strlen($substring) |
|
| 5210 | 5210 | ); |
| 5211 | 5211 | } |
| 5212 | 5212 | |
| 5213 | 5213 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5214 | 5214 | |
| 5215 | - return (string) self::substr( |
|
| 5215 | + return (string)self::substr( |
|
| 5216 | 5216 | $str, |
| 5217 | - (int) self::strlen($substring, $encoding), |
|
| 5217 | + (int)self::strlen($substring, $encoding), |
|
| 5218 | 5218 | null, |
| 5219 | 5219 | $encoding |
| 5220 | 5220 | ); |
@@ -5242,19 +5242,19 @@ discard block |
||
| 5242 | 5242 | ): string { |
| 5243 | 5243 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
| 5244 | 5244 | if ($encoding === 'UTF-8') { |
| 5245 | - return (string) \mb_substr( |
|
| 5245 | + return (string)\mb_substr( |
|
| 5246 | 5246 | $str, |
| 5247 | 5247 | 0, |
| 5248 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
| 5248 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
| 5249 | 5249 | ); |
| 5250 | 5250 | } |
| 5251 | 5251 | |
| 5252 | 5252 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5253 | 5253 | |
| 5254 | - return (string) self::substr( |
|
| 5254 | + return (string)self::substr( |
|
| 5255 | 5255 | $str, |
| 5256 | 5256 | 0, |
| 5257 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
| 5257 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
| 5258 | 5258 | $encoding |
| 5259 | 5259 | ); |
| 5260 | 5260 | } |
@@ -5353,7 +5353,7 @@ discard block |
||
| 5353 | 5353 | $save = \mb_substitute_character(); |
| 5354 | 5354 | \mb_substitute_character($replacement_char_helper); |
| 5355 | 5355 | // the polyfill maybe return false, so cast to string |
| 5356 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 5356 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 5357 | 5357 | \mb_substitute_character($save); |
| 5358 | 5358 | } |
| 5359 | 5359 | |
@@ -5397,7 +5397,7 @@ discard block |
||
| 5397 | 5397 | } |
| 5398 | 5398 | |
| 5399 | 5399 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5400 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 5400 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 5401 | 5401 | } |
| 5402 | 5402 | |
| 5403 | 5403 | if ($chars) { |
@@ -5427,7 +5427,7 @@ discard block |
||
| 5427 | 5427 | $html .= '<pre>'; |
| 5428 | 5428 | /** @noinspection AlterInForeachInspection */ |
| 5429 | 5429 | foreach (self::$SUPPORT as $key => &$value) { |
| 5430 | - $html .= $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
| 5430 | + $html .= $key.' - '.\print_r($value, true)."\n<br>"; |
|
| 5431 | 5431 | } |
| 5432 | 5432 | $html .= '</pre>'; |
| 5433 | 5433 | |
@@ -5467,7 +5467,7 @@ discard block |
||
| 5467 | 5467 | return $char; |
| 5468 | 5468 | } |
| 5469 | 5469 | |
| 5470 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
| 5470 | + return '&#'.self::ord($char, $encoding).';'; |
|
| 5471 | 5471 | } |
| 5472 | 5472 | |
| 5473 | 5473 | /** |
@@ -5571,11 +5571,11 @@ discard block |
||
| 5571 | 5571 | $lang, |
| 5572 | 5572 | $try_to_keep_the_string_length |
| 5573 | 5573 | ); |
| 5574 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
| 5574 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
| 5575 | 5575 | |
| 5576 | 5576 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 5577 | 5577 | |
| 5578 | - $str = (string) \preg_replace_callback( |
|
| 5578 | + $str = (string)\preg_replace_callback( |
|
| 5579 | 5579 | '/[-_\\s]+(.)?/u', |
| 5580 | 5580 | /** |
| 5581 | 5581 | * @param array $match |
@@ -5584,7 +5584,7 @@ discard block |
||
| 5584 | 5584 | * |
| 5585 | 5585 | * @return string |
| 5586 | 5586 | */ |
| 5587 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
| 5587 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
| 5588 | 5588 | if (isset($match[1])) { |
| 5589 | 5589 | if ($use_mb_functions) { |
| 5590 | 5590 | if ($encoding === 'UTF-8') { |
@@ -5602,7 +5602,7 @@ discard block |
||
| 5602 | 5602 | $str |
| 5603 | 5603 | ); |
| 5604 | 5604 | |
| 5605 | - return (string) \preg_replace_callback( |
|
| 5605 | + return (string)\preg_replace_callback( |
|
| 5606 | 5606 | '/[\\p{N}]+(.)?/u', |
| 5607 | 5607 | /** |
| 5608 | 5608 | * @param array $match |
@@ -5611,7 +5611,7 @@ discard block |
||
| 5611 | 5611 | * |
| 5612 | 5612 | * @return string |
| 5613 | 5613 | */ |
| 5614 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
| 5614 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
| 5615 | 5615 | if ($use_mb_functions) { |
| 5616 | 5616 | if ($encoding === 'UTF-8') { |
| 5617 | 5617 | return \mb_strtoupper($match[0]); |
@@ -5803,7 +5803,7 @@ discard block |
||
| 5803 | 5803 | ): string { |
| 5804 | 5804 | if (self::$SUPPORT['mbstring'] === true) { |
| 5805 | 5805 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5806 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
| 5806 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
| 5807 | 5807 | |
| 5808 | 5808 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 5809 | 5809 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -5813,10 +5813,10 @@ discard block |
||
| 5813 | 5813 | } |
| 5814 | 5814 | |
| 5815 | 5815 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5816 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
| 5816 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
| 5817 | 5817 | } |
| 5818 | 5818 | |
| 5819 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
| 5819 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
| 5820 | 5820 | |
| 5821 | 5821 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 5822 | 5822 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -5825,7 +5825,7 @@ discard block |
||
| 5825 | 5825 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
| 5826 | 5826 | } |
| 5827 | 5827 | |
| 5828 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
| 5828 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
| 5829 | 5829 | } |
| 5830 | 5830 | |
| 5831 | 5831 | /** |
@@ -5842,7 +5842,7 @@ discard block |
||
| 5842 | 5842 | public static function str_detect_encoding($str) |
| 5843 | 5843 | { |
| 5844 | 5844 | // init |
| 5845 | - $str = (string) $str; |
|
| 5845 | + $str = (string)$str; |
|
| 5846 | 5846 | |
| 5847 | 5847 | // |
| 5848 | 5848 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5944,7 +5944,7 @@ discard block |
||
| 5944 | 5944 | foreach (self::$ENCODINGS as $encoding_tmp) { |
| 5945 | 5945 | // INFO: //IGNORE but still throw notice |
| 5946 | 5946 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 5947 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
| 5947 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
| 5948 | 5948 | return $encoding_tmp; |
| 5949 | 5949 | } |
| 5950 | 5950 | } |
@@ -6041,7 +6041,7 @@ discard block |
||
| 6041 | 6041 | return $str; |
| 6042 | 6042 | } |
| 6043 | 6043 | |
| 6044 | - return $substring . $str; |
|
| 6044 | + return $substring.$str; |
|
| 6045 | 6045 | } |
| 6046 | 6046 | |
| 6047 | 6047 | /** |
@@ -6332,27 +6332,27 @@ discard block |
||
| 6332 | 6332 | string $encoding = 'UTF-8' |
| 6333 | 6333 | ): string { |
| 6334 | 6334 | if ($encoding === 'UTF-8') { |
| 6335 | - $len = (int) \mb_strlen($str); |
|
| 6335 | + $len = (int)\mb_strlen($str); |
|
| 6336 | 6336 | if ($index > $len) { |
| 6337 | 6337 | return $str; |
| 6338 | 6338 | } |
| 6339 | 6339 | |
| 6340 | 6340 | /** @noinspection UnnecessaryCastingInspection */ |
| 6341 | - return (string) \mb_substr($str, 0, $index) . |
|
| 6342 | - $substring . |
|
| 6343 | - (string) \mb_substr($str, $index, $len); |
|
| 6341 | + return (string)\mb_substr($str, 0, $index). |
|
| 6342 | + $substring. |
|
| 6343 | + (string)\mb_substr($str, $index, $len); |
|
| 6344 | 6344 | } |
| 6345 | 6345 | |
| 6346 | 6346 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6347 | 6347 | |
| 6348 | - $len = (int) self::strlen($str, $encoding); |
|
| 6348 | + $len = (int)self::strlen($str, $encoding); |
|
| 6349 | 6349 | if ($index > $len) { |
| 6350 | 6350 | return $str; |
| 6351 | 6351 | } |
| 6352 | 6352 | |
| 6353 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
| 6354 | - $substring . |
|
| 6355 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
| 6353 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
| 6354 | + $substring. |
|
| 6355 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
| 6356 | 6356 | } |
| 6357 | 6357 | |
| 6358 | 6358 | /** |
@@ -6384,15 +6384,15 @@ discard block |
||
| 6384 | 6384 | */ |
| 6385 | 6385 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
| 6386 | 6386 | { |
| 6387 | - $search = (array) $search; |
|
| 6387 | + $search = (array)$search; |
|
| 6388 | 6388 | |
| 6389 | 6389 | /** @noinspection AlterInForeachInspection */ |
| 6390 | 6390 | foreach ($search as &$s) { |
| 6391 | - $s = (string) $s; |
|
| 6391 | + $s = (string)$s; |
|
| 6392 | 6392 | if ($s === '') { |
| 6393 | 6393 | $s = '/^(?<=.)$/'; |
| 6394 | 6394 | } else { |
| 6395 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
| 6395 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
| 6396 | 6396 | } |
| 6397 | 6397 | } |
| 6398 | 6398 | |
@@ -6426,11 +6426,11 @@ discard block |
||
| 6426 | 6426 | } |
| 6427 | 6427 | |
| 6428 | 6428 | if ($search === '') { |
| 6429 | - return $str . $replacement; |
|
| 6429 | + return $str.$replacement; |
|
| 6430 | 6430 | } |
| 6431 | 6431 | |
| 6432 | 6432 | if (\stripos($str, $search) === 0) { |
| 6433 | - return $replacement . \substr($str, \strlen($search)); |
|
| 6433 | + return $replacement.\substr($str, \strlen($search)); |
|
| 6434 | 6434 | } |
| 6435 | 6435 | |
| 6436 | 6436 | return $str; |
@@ -6461,11 +6461,11 @@ discard block |
||
| 6461 | 6461 | } |
| 6462 | 6462 | |
| 6463 | 6463 | if ($search === '') { |
| 6464 | - return $str . $replacement; |
|
| 6464 | + return $str.$replacement; |
|
| 6465 | 6465 | } |
| 6466 | 6466 | |
| 6467 | 6467 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 6468 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 6468 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 6469 | 6469 | } |
| 6470 | 6470 | |
| 6471 | 6471 | return $str; |
@@ -6551,15 +6551,15 @@ discard block |
||
| 6551 | 6551 | } |
| 6552 | 6552 | |
| 6553 | 6553 | if ($encoding === 'UTF-8') { |
| 6554 | - return (string) \mb_substr( |
|
| 6554 | + return (string)\mb_substr( |
|
| 6555 | 6555 | $str, |
| 6556 | - $offset + (int) \mb_strlen($separator) |
|
| 6556 | + $offset + (int)\mb_strlen($separator) |
|
| 6557 | 6557 | ); |
| 6558 | 6558 | } |
| 6559 | 6559 | |
| 6560 | - return (string) self::substr( |
|
| 6560 | + return (string)self::substr( |
|
| 6561 | 6561 | $str, |
| 6562 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6562 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6563 | 6563 | null, |
| 6564 | 6564 | $encoding |
| 6565 | 6565 | ); |
@@ -6591,15 +6591,15 @@ discard block |
||
| 6591 | 6591 | } |
| 6592 | 6592 | |
| 6593 | 6593 | if ($encoding === 'UTF-8') { |
| 6594 | - return (string) \mb_substr( |
|
| 6594 | + return (string)\mb_substr( |
|
| 6595 | 6595 | $str, |
| 6596 | - $offset + (int) self::strlen($separator) |
|
| 6596 | + $offset + (int)self::strlen($separator) |
|
| 6597 | 6597 | ); |
| 6598 | 6598 | } |
| 6599 | 6599 | |
| 6600 | - return (string) self::substr( |
|
| 6600 | + return (string)self::substr( |
|
| 6601 | 6601 | $str, |
| 6602 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6602 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6603 | 6603 | null, |
| 6604 | 6604 | $encoding |
| 6605 | 6605 | ); |
@@ -6631,10 +6631,10 @@ discard block |
||
| 6631 | 6631 | } |
| 6632 | 6632 | |
| 6633 | 6633 | if ($encoding === 'UTF-8') { |
| 6634 | - return (string) \mb_substr($str, 0, $offset); |
|
| 6634 | + return (string)\mb_substr($str, 0, $offset); |
|
| 6635 | 6635 | } |
| 6636 | 6636 | |
| 6637 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 6637 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 6638 | 6638 | } |
| 6639 | 6639 | |
| 6640 | 6640 | /** |
@@ -6663,7 +6663,7 @@ discard block |
||
| 6663 | 6663 | return ''; |
| 6664 | 6664 | } |
| 6665 | 6665 | |
| 6666 | - return (string) \mb_substr($str, 0, $offset); |
|
| 6666 | + return (string)\mb_substr($str, 0, $offset); |
|
| 6667 | 6667 | } |
| 6668 | 6668 | |
| 6669 | 6669 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6671,7 +6671,7 @@ discard block |
||
| 6671 | 6671 | return ''; |
| 6672 | 6672 | } |
| 6673 | 6673 | |
| 6674 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 6674 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 6675 | 6675 | } |
| 6676 | 6676 | |
| 6677 | 6677 | /** |
@@ -6773,12 +6773,12 @@ discard block |
||
| 6773 | 6773 | } |
| 6774 | 6774 | |
| 6775 | 6775 | if ($encoding === 'UTF-8') { |
| 6776 | - return (string) \mb_substr($str, -$n); |
|
| 6776 | + return (string)\mb_substr($str, -$n); |
|
| 6777 | 6777 | } |
| 6778 | 6778 | |
| 6779 | 6779 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6780 | 6780 | |
| 6781 | - return (string) self::substr($str, -$n, null, $encoding); |
|
| 6781 | + return (string)self::substr($str, -$n, null, $encoding); |
|
| 6782 | 6782 | } |
| 6783 | 6783 | |
| 6784 | 6784 | /** |
@@ -6804,21 +6804,21 @@ discard block |
||
| 6804 | 6804 | } |
| 6805 | 6805 | |
| 6806 | 6806 | if ($encoding === 'UTF-8') { |
| 6807 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 6807 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 6808 | 6808 | return $str; |
| 6809 | 6809 | } |
| 6810 | 6810 | |
| 6811 | 6811 | /** @noinspection UnnecessaryCastingInspection */ |
| 6812 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
| 6812 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
| 6813 | 6813 | } |
| 6814 | 6814 | |
| 6815 | 6815 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6816 | 6816 | |
| 6817 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 6817 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 6818 | 6818 | return $str; |
| 6819 | 6819 | } |
| 6820 | 6820 | |
| 6821 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
| 6821 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
| 6822 | 6822 | } |
| 6823 | 6823 | |
| 6824 | 6824 | /** |
@@ -6845,12 +6845,12 @@ discard block |
||
| 6845 | 6845 | |
| 6846 | 6846 | if ($encoding === 'UTF-8') { |
| 6847 | 6847 | /** @noinspection UnnecessaryCastingInspection */ |
| 6848 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 6848 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 6849 | 6849 | return $str; |
| 6850 | 6850 | } |
| 6851 | 6851 | |
| 6852 | 6852 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
| 6853 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
| 6853 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
| 6854 | 6854 | } |
| 6855 | 6855 | |
| 6856 | 6856 | $str = \mb_substr($str, 0, $length); |
@@ -6859,33 +6859,33 @@ discard block |
||
| 6859 | 6859 | $new_str = \implode(' ', $array); |
| 6860 | 6860 | |
| 6861 | 6861 | if ($new_str === '') { |
| 6862 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
| 6862 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
| 6863 | 6863 | } |
| 6864 | 6864 | } else { |
| 6865 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 6865 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 6866 | 6866 | return $str; |
| 6867 | 6867 | } |
| 6868 | 6868 | |
| 6869 | 6869 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
| 6870 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
| 6870 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
| 6871 | 6871 | } |
| 6872 | 6872 | |
| 6873 | 6873 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 6874 | 6874 | $str = self::substr($str, 0, $length, $encoding); |
| 6875 | 6875 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 6876 | 6876 | if ($str === false) { |
| 6877 | - return '' . $str_add_on; |
|
| 6877 | + return ''.$str_add_on; |
|
| 6878 | 6878 | } |
| 6879 | 6879 | |
| 6880 | 6880 | $array = \explode(' ', $str, -1); |
| 6881 | 6881 | $new_str = \implode(' ', $array); |
| 6882 | 6882 | |
| 6883 | 6883 | if ($new_str === '') { |
| 6884 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
| 6884 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
| 6885 | 6885 | } |
| 6886 | 6886 | } |
| 6887 | 6887 | |
| 6888 | - return $new_str . $str_add_on; |
|
| 6888 | + return $new_str.$str_add_on; |
|
| 6889 | 6889 | } |
| 6890 | 6890 | |
| 6891 | 6891 | /** |
@@ -6908,7 +6908,7 @@ discard block |
||
| 6908 | 6908 | $longest_common_prefix = ''; |
| 6909 | 6909 | |
| 6910 | 6910 | if ($encoding === 'UTF-8') { |
| 6911 | - $max_length = (int) \min( |
|
| 6911 | + $max_length = (int)\min( |
|
| 6912 | 6912 | \mb_strlen($str1), |
| 6913 | 6913 | \mb_strlen($str2) |
| 6914 | 6914 | ); |
@@ -6929,7 +6929,7 @@ discard block |
||
| 6929 | 6929 | } else { |
| 6930 | 6930 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6931 | 6931 | |
| 6932 | - $max_length = (int) \min( |
|
| 6932 | + $max_length = (int)\min( |
|
| 6933 | 6933 | self::strlen($str1, $encoding), |
| 6934 | 6934 | self::strlen($str2, $encoding) |
| 6935 | 6935 | ); |
@@ -6978,13 +6978,13 @@ discard block |
||
| 6978 | 6978 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
| 6979 | 6979 | |
| 6980 | 6980 | if ($encoding === 'UTF-8') { |
| 6981 | - $str_length = (int) \mb_strlen($str1); |
|
| 6982 | - $other_length = (int) \mb_strlen($str2); |
|
| 6981 | + $str_length = (int)\mb_strlen($str1); |
|
| 6982 | + $other_length = (int)\mb_strlen($str2); |
|
| 6983 | 6983 | } else { |
| 6984 | 6984 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6985 | 6985 | |
| 6986 | - $str_length = (int) self::strlen($str1, $encoding); |
|
| 6987 | - $other_length = (int) self::strlen($str2, $encoding); |
|
| 6986 | + $str_length = (int)self::strlen($str1, $encoding); |
|
| 6987 | + $other_length = (int)self::strlen($str2, $encoding); |
|
| 6988 | 6988 | } |
| 6989 | 6989 | |
| 6990 | 6990 | // Return if either string is empty |
@@ -7037,10 +7037,10 @@ discard block |
||
| 7037 | 7037 | } |
| 7038 | 7038 | |
| 7039 | 7039 | if ($encoding === 'UTF-8') { |
| 7040 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
| 7040 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
| 7041 | 7041 | } |
| 7042 | 7042 | |
| 7043 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
| 7043 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
| 7044 | 7044 | } |
| 7045 | 7045 | |
| 7046 | 7046 | /** |
@@ -7064,7 +7064,7 @@ discard block |
||
| 7064 | 7064 | } |
| 7065 | 7065 | |
| 7066 | 7066 | if ($encoding === 'UTF-8') { |
| 7067 | - $max_length = (int) \min( |
|
| 7067 | + $max_length = (int)\min( |
|
| 7068 | 7068 | \mb_strlen($str1, $encoding), |
| 7069 | 7069 | \mb_strlen($str2, $encoding) |
| 7070 | 7070 | ); |
@@ -7078,7 +7078,7 @@ discard block |
||
| 7078 | 7078 | && |
| 7079 | 7079 | $char === \mb_substr($str2, -$i, 1) |
| 7080 | 7080 | ) { |
| 7081 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
| 7081 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
| 7082 | 7082 | } else { |
| 7083 | 7083 | break; |
| 7084 | 7084 | } |
@@ -7086,7 +7086,7 @@ discard block |
||
| 7086 | 7086 | } else { |
| 7087 | 7087 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7088 | 7088 | |
| 7089 | - $max_length = (int) \min( |
|
| 7089 | + $max_length = (int)\min( |
|
| 7090 | 7090 | self::strlen($str1, $encoding), |
| 7091 | 7091 | self::strlen($str2, $encoding) |
| 7092 | 7092 | ); |
@@ -7100,7 +7100,7 @@ discard block |
||
| 7100 | 7100 | && |
| 7101 | 7101 | $char === self::substr($str2, -$i, 1, $encoding) |
| 7102 | 7102 | ) { |
| 7103 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
| 7103 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
| 7104 | 7104 | } else { |
| 7105 | 7105 | break; |
| 7106 | 7106 | } |
@@ -7122,7 +7122,7 @@ discard block |
||
| 7122 | 7122 | */ |
| 7123 | 7123 | public static function str_matches_pattern(string $str, string $pattern): bool |
| 7124 | 7124 | { |
| 7125 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
| 7125 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
| 7126 | 7126 | } |
| 7127 | 7127 | |
| 7128 | 7128 | /** |
@@ -7141,7 +7141,7 @@ discard block |
||
| 7141 | 7141 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
| 7142 | 7142 | { |
| 7143 | 7143 | // init |
| 7144 | - $length = (int) self::strlen($str, $encoding); |
|
| 7144 | + $length = (int)self::strlen($str, $encoding); |
|
| 7145 | 7145 | |
| 7146 | 7146 | if ($offset >= 0) { |
| 7147 | 7147 | return $length > $offset; |
@@ -7170,7 +7170,7 @@ discard block |
||
| 7170 | 7170 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
| 7171 | 7171 | { |
| 7172 | 7172 | // init |
| 7173 | - $length = (int) self::strlen($str); |
|
| 7173 | + $length = (int)self::strlen($str); |
|
| 7174 | 7174 | |
| 7175 | 7175 | if ( |
| 7176 | 7176 | ($index >= 0 && $length <= $index) |
@@ -7212,7 +7212,7 @@ discard block |
||
| 7212 | 7212 | return $str; |
| 7213 | 7213 | } |
| 7214 | 7214 | |
| 7215 | - if ($pad_type !== (int) $pad_type) { |
|
| 7215 | + if ($pad_type !== (int)$pad_type) { |
|
| 7216 | 7216 | if ($pad_type === 'left') { |
| 7217 | 7217 | $pad_type = \STR_PAD_LEFT; |
| 7218 | 7218 | } elseif ($pad_type === 'right') { |
@@ -7221,23 +7221,23 @@ discard block |
||
| 7221 | 7221 | $pad_type = \STR_PAD_BOTH; |
| 7222 | 7222 | } else { |
| 7223 | 7223 | throw new \InvalidArgumentException( |
| 7224 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
| 7224 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
| 7225 | 7225 | ); |
| 7226 | 7226 | } |
| 7227 | 7227 | } |
| 7228 | 7228 | |
| 7229 | 7229 | if ($encoding === 'UTF-8') { |
| 7230 | - $str_length = (int) \mb_strlen($str); |
|
| 7230 | + $str_length = (int)\mb_strlen($str); |
|
| 7231 | 7231 | |
| 7232 | 7232 | if ($pad_length >= $str_length) { |
| 7233 | 7233 | switch ($pad_type) { |
| 7234 | 7234 | case \STR_PAD_LEFT: |
| 7235 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 7235 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 7236 | 7236 | |
| 7237 | 7237 | $diff = ($pad_length - $str_length); |
| 7238 | 7238 | |
| 7239 | - $pre = (string) \mb_substr( |
|
| 7240 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7239 | + $pre = (string)\mb_substr( |
|
| 7240 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7241 | 7241 | 0, |
| 7242 | 7242 | $diff |
| 7243 | 7243 | ); |
@@ -7248,16 +7248,16 @@ discard block |
||
| 7248 | 7248 | case \STR_PAD_BOTH: |
| 7249 | 7249 | $diff = ($pad_length - $str_length); |
| 7250 | 7250 | |
| 7251 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 7251 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 7252 | 7252 | |
| 7253 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 7253 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 7254 | 7254 | |
| 7255 | - $pre = (string) \mb_substr( |
|
| 7255 | + $pre = (string)\mb_substr( |
|
| 7256 | 7256 | \str_repeat($pad_string, $ps_length_left), |
| 7257 | 7257 | 0, |
| 7258 | 7258 | $ps_length_left |
| 7259 | 7259 | ); |
| 7260 | - $post = (string) \mb_substr( |
|
| 7260 | + $post = (string)\mb_substr( |
|
| 7261 | 7261 | \str_repeat($pad_string, $ps_length_right), |
| 7262 | 7262 | 0, |
| 7263 | 7263 | $ps_length_right |
@@ -7267,19 +7267,19 @@ discard block |
||
| 7267 | 7267 | |
| 7268 | 7268 | case \STR_PAD_RIGHT: |
| 7269 | 7269 | default: |
| 7270 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 7270 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 7271 | 7271 | |
| 7272 | 7272 | $diff = ($pad_length - $str_length); |
| 7273 | 7273 | |
| 7274 | - $post = (string) \mb_substr( |
|
| 7275 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7274 | + $post = (string)\mb_substr( |
|
| 7275 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7276 | 7276 | 0, |
| 7277 | 7277 | $diff |
| 7278 | 7278 | ); |
| 7279 | 7279 | $pre = ''; |
| 7280 | 7280 | } |
| 7281 | 7281 | |
| 7282 | - return $pre . $str . $post; |
|
| 7282 | + return $pre.$str.$post; |
|
| 7283 | 7283 | } |
| 7284 | 7284 | |
| 7285 | 7285 | return $str; |
@@ -7287,17 +7287,17 @@ discard block |
||
| 7287 | 7287 | |
| 7288 | 7288 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7289 | 7289 | |
| 7290 | - $str_length = (int) self::strlen($str, $encoding); |
|
| 7290 | + $str_length = (int)self::strlen($str, $encoding); |
|
| 7291 | 7291 | |
| 7292 | 7292 | if ($pad_length >= $str_length) { |
| 7293 | 7293 | switch ($pad_type) { |
| 7294 | 7294 | case \STR_PAD_LEFT: |
| 7295 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 7295 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 7296 | 7296 | |
| 7297 | 7297 | $diff = ($pad_length - $str_length); |
| 7298 | 7298 | |
| 7299 | - $pre = (string) self::substr( |
|
| 7300 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7299 | + $pre = (string)self::substr( |
|
| 7300 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7301 | 7301 | 0, |
| 7302 | 7302 | $diff, |
| 7303 | 7303 | $encoding |
@@ -7309,17 +7309,17 @@ discard block |
||
| 7309 | 7309 | case \STR_PAD_BOTH: |
| 7310 | 7310 | $diff = ($pad_length - $str_length); |
| 7311 | 7311 | |
| 7312 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 7312 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 7313 | 7313 | |
| 7314 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 7314 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 7315 | 7315 | |
| 7316 | - $pre = (string) self::substr( |
|
| 7316 | + $pre = (string)self::substr( |
|
| 7317 | 7317 | \str_repeat($pad_string, $ps_length_left), |
| 7318 | 7318 | 0, |
| 7319 | 7319 | $ps_length_left, |
| 7320 | 7320 | $encoding |
| 7321 | 7321 | ); |
| 7322 | - $post = (string) self::substr( |
|
| 7322 | + $post = (string)self::substr( |
|
| 7323 | 7323 | \str_repeat($pad_string, $ps_length_right), |
| 7324 | 7324 | 0, |
| 7325 | 7325 | $ps_length_right, |
@@ -7330,12 +7330,12 @@ discard block |
||
| 7330 | 7330 | |
| 7331 | 7331 | case \STR_PAD_RIGHT: |
| 7332 | 7332 | default: |
| 7333 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 7333 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 7334 | 7334 | |
| 7335 | 7335 | $diff = ($pad_length - $str_length); |
| 7336 | 7336 | |
| 7337 | - $post = (string) self::substr( |
|
| 7338 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7337 | + $post = (string)self::substr( |
|
| 7338 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7339 | 7339 | 0, |
| 7340 | 7340 | $diff, |
| 7341 | 7341 | $encoding |
@@ -7343,7 +7343,7 @@ discard block |
||
| 7343 | 7343 | $pre = ''; |
| 7344 | 7344 | } |
| 7345 | 7345 | |
| 7346 | - return $pre . $str . $post; |
|
| 7346 | + return $pre.$str.$post; |
|
| 7347 | 7347 | } |
| 7348 | 7348 | |
| 7349 | 7349 | return $str; |
@@ -7540,11 +7540,11 @@ discard block |
||
| 7540 | 7540 | } |
| 7541 | 7541 | |
| 7542 | 7542 | if ($search === '') { |
| 7543 | - return $str . $replacement; |
|
| 7543 | + return $str.$replacement; |
|
| 7544 | 7544 | } |
| 7545 | 7545 | |
| 7546 | 7546 | if (\strpos($str, $search) === 0) { |
| 7547 | - return $replacement . \substr($str, \strlen($search)); |
|
| 7547 | + return $replacement.\substr($str, \strlen($search)); |
|
| 7548 | 7548 | } |
| 7549 | 7549 | |
| 7550 | 7550 | return $str; |
@@ -7578,11 +7578,11 @@ discard block |
||
| 7578 | 7578 | } |
| 7579 | 7579 | |
| 7580 | 7580 | if ($search === '') { |
| 7581 | - return $str . $replacement; |
|
| 7581 | + return $str.$replacement; |
|
| 7582 | 7582 | } |
| 7583 | 7583 | |
| 7584 | 7584 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 7585 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 7585 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 7586 | 7586 | } |
| 7587 | 7587 | |
| 7588 | 7588 | return $str; |
@@ -7616,7 +7616,7 @@ discard block |
||
| 7616 | 7616 | $subject, |
| 7617 | 7617 | $replace, |
| 7618 | 7618 | $pos, |
| 7619 | - (int) self::strlen($search) |
|
| 7619 | + (int)self::strlen($search) |
|
| 7620 | 7620 | ); |
| 7621 | 7621 | } |
| 7622 | 7622 | |
@@ -7650,7 +7650,7 @@ discard block |
||
| 7650 | 7650 | $subject, |
| 7651 | 7651 | $replace, |
| 7652 | 7652 | $pos, |
| 7653 | - (int) self::strlen($search) |
|
| 7653 | + (int)self::strlen($search) |
|
| 7654 | 7654 | ); |
| 7655 | 7655 | } |
| 7656 | 7656 | |
@@ -7671,7 +7671,7 @@ discard block |
||
| 7671 | 7671 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
| 7672 | 7672 | { |
| 7673 | 7673 | if ($encoding === 'UTF-8') { |
| 7674 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
| 7674 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
| 7675 | 7675 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 7676 | 7676 | \shuffle($indexes); |
| 7677 | 7677 | |
@@ -7687,7 +7687,7 @@ discard block |
||
| 7687 | 7687 | } else { |
| 7688 | 7688 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7689 | 7689 | |
| 7690 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
| 7690 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
| 7691 | 7691 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 7692 | 7692 | \shuffle($indexes); |
| 7693 | 7693 | |
@@ -7730,11 +7730,11 @@ discard block |
||
| 7730 | 7730 | ) { |
| 7731 | 7731 | if ($encoding === 'UTF-8') { |
| 7732 | 7732 | if ($end === null) { |
| 7733 | - $length = (int) \mb_strlen($str); |
|
| 7733 | + $length = (int)\mb_strlen($str); |
|
| 7734 | 7734 | } elseif ($end >= 0 && $end <= $start) { |
| 7735 | 7735 | return ''; |
| 7736 | 7736 | } elseif ($end < 0) { |
| 7737 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
| 7737 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
| 7738 | 7738 | } else { |
| 7739 | 7739 | $length = $end - $start; |
| 7740 | 7740 | } |
@@ -7745,11 +7745,11 @@ discard block |
||
| 7745 | 7745 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7746 | 7746 | |
| 7747 | 7747 | if ($end === null) { |
| 7748 | - $length = (int) self::strlen($str, $encoding); |
|
| 7748 | + $length = (int)self::strlen($str, $encoding); |
|
| 7749 | 7749 | } elseif ($end >= 0 && $end <= $start) { |
| 7750 | 7750 | return ''; |
| 7751 | 7751 | } elseif ($end < 0) { |
| 7752 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
| 7752 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
| 7753 | 7753 | } else { |
| 7754 | 7754 | $length = $end - $start; |
| 7755 | 7755 | } |
@@ -7784,7 +7784,7 @@ discard block |
||
| 7784 | 7784 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7785 | 7785 | } |
| 7786 | 7786 | |
| 7787 | - $str = (string) \preg_replace_callback( |
|
| 7787 | + $str = (string)\preg_replace_callback( |
|
| 7788 | 7788 | '/([\\p{N}|\\p{Lu}])/u', |
| 7789 | 7789 | /** |
| 7790 | 7790 | * @param string[] $matches |
@@ -7793,28 +7793,28 @@ discard block |
||
| 7793 | 7793 | * |
| 7794 | 7794 | * @return string |
| 7795 | 7795 | */ |
| 7796 | - static function (array $matches) use ($encoding): string { |
|
| 7796 | + static function(array $matches) use ($encoding): string { |
|
| 7797 | 7797 | $match = $matches[1]; |
| 7798 | - $match_int = (int) $match; |
|
| 7798 | + $match_int = (int)$match; |
|
| 7799 | 7799 | |
| 7800 | - if ((string) $match_int === $match) { |
|
| 7801 | - return '_' . $match . '_'; |
|
| 7800 | + if ((string)$match_int === $match) { |
|
| 7801 | + return '_'.$match.'_'; |
|
| 7802 | 7802 | } |
| 7803 | 7803 | |
| 7804 | 7804 | if ($encoding === 'UTF-8') { |
| 7805 | - return '_' . \mb_strtolower($match); |
|
| 7805 | + return '_'.\mb_strtolower($match); |
|
| 7806 | 7806 | } |
| 7807 | 7807 | |
| 7808 | - return '_' . self::strtolower($match, $encoding); |
|
| 7808 | + return '_'.self::strtolower($match, $encoding); |
|
| 7809 | 7809 | }, |
| 7810 | 7810 | $str |
| 7811 | 7811 | ); |
| 7812 | 7812 | |
| 7813 | - $str = (string) \preg_replace( |
|
| 7813 | + $str = (string)\preg_replace( |
|
| 7814 | 7814 | [ |
| 7815 | - '/\\s+/u', // convert spaces to "_" |
|
| 7815 | + '/\\s+/u', // convert spaces to "_" |
|
| 7816 | 7816 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
| 7817 | - '/_+/', // remove double "_" |
|
| 7817 | + '/_+/', // remove double "_" |
|
| 7818 | 7818 | ], |
| 7819 | 7819 | [ |
| 7820 | 7820 | '_', |
@@ -7936,7 +7936,7 @@ discard block |
||
| 7936 | 7936 | } |
| 7937 | 7937 | |
| 7938 | 7938 | // init |
| 7939 | - $input = (string) $input; |
|
| 7939 | + $input = (string)$input; |
|
| 7940 | 7940 | |
| 7941 | 7941 | if ($input === '') { |
| 7942 | 7942 | return []; |
@@ -7993,7 +7993,7 @@ discard block |
||
| 7993 | 7993 | ($input[$i] & "\xE0") === "\xC0" |
| 7994 | 7994 | ) { |
| 7995 | 7995 | if (($input[$i + 1] & "\xC0") === "\x80") { |
| 7996 | - $ret[] = $input[$i] . $input[$i + 1]; |
|
| 7996 | + $ret[] = $input[$i].$input[$i + 1]; |
|
| 7997 | 7997 | |
| 7998 | 7998 | ++$i; |
| 7999 | 7999 | } |
@@ -8007,7 +8007,7 @@ discard block |
||
| 8007 | 8007 | && |
| 8008 | 8008 | ($input[$i + 2] & "\xC0") === "\x80" |
| 8009 | 8009 | ) { |
| 8010 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2]; |
|
| 8010 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2]; |
|
| 8011 | 8011 | |
| 8012 | 8012 | $i += 2; |
| 8013 | 8013 | } |
@@ -8023,7 +8023,7 @@ discard block |
||
| 8023 | 8023 | && |
| 8024 | 8024 | ($input[$i + 3] & "\xC0") === "\x80" |
| 8025 | 8025 | ) { |
| 8026 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2] . $input[$i + 3]; |
|
| 8026 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2].$input[$i + 3]; |
|
| 8027 | 8027 | |
| 8028 | 8028 | $i += 3; |
| 8029 | 8029 | } |
@@ -8035,7 +8035,7 @@ discard block |
||
| 8035 | 8035 | $ret = \array_chunk($ret, $length); |
| 8036 | 8036 | |
| 8037 | 8037 | return \array_map( |
| 8038 | - static function (array &$item): string { |
|
| 8038 | + static function(array &$item): string { |
|
| 8039 | 8039 | return \implode('', $item); |
| 8040 | 8040 | }, |
| 8041 | 8041 | $ret |
@@ -8101,7 +8101,7 @@ discard block |
||
| 8101 | 8101 | $limit = -1; |
| 8102 | 8102 | } |
| 8103 | 8103 | |
| 8104 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
| 8104 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
| 8105 | 8105 | |
| 8106 | 8106 | if ($array === false) { |
| 8107 | 8107 | return []; |
@@ -8191,9 +8191,9 @@ discard block |
||
| 8191 | 8191 | return ''; |
| 8192 | 8192 | } |
| 8193 | 8193 | |
| 8194 | - return (string) \mb_substr( |
|
| 8194 | + return (string)\mb_substr( |
|
| 8195 | 8195 | $str, |
| 8196 | - $offset + (int) \mb_strlen($separator) |
|
| 8196 | + $offset + (int)\mb_strlen($separator) |
|
| 8197 | 8197 | ); |
| 8198 | 8198 | } |
| 8199 | 8199 | |
@@ -8202,9 +8202,9 @@ discard block |
||
| 8202 | 8202 | return ''; |
| 8203 | 8203 | } |
| 8204 | 8204 | |
| 8205 | - return (string) \mb_substr( |
|
| 8205 | + return (string)\mb_substr( |
|
| 8206 | 8206 | $str, |
| 8207 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 8207 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 8208 | 8208 | null, |
| 8209 | 8209 | $encoding |
| 8210 | 8210 | ); |
@@ -8233,9 +8233,9 @@ discard block |
||
| 8233 | 8233 | return ''; |
| 8234 | 8234 | } |
| 8235 | 8235 | |
| 8236 | - return (string) \mb_substr( |
|
| 8236 | + return (string)\mb_substr( |
|
| 8237 | 8237 | $str, |
| 8238 | - $offset + (int) \mb_strlen($separator) |
|
| 8238 | + $offset + (int)\mb_strlen($separator) |
|
| 8239 | 8239 | ); |
| 8240 | 8240 | } |
| 8241 | 8241 | |
@@ -8244,9 +8244,9 @@ discard block |
||
| 8244 | 8244 | return ''; |
| 8245 | 8245 | } |
| 8246 | 8246 | |
| 8247 | - return (string) self::substr( |
|
| 8247 | + return (string)self::substr( |
|
| 8248 | 8248 | $str, |
| 8249 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 8249 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 8250 | 8250 | null, |
| 8251 | 8251 | $encoding |
| 8252 | 8252 | ); |
@@ -8278,7 +8278,7 @@ discard block |
||
| 8278 | 8278 | return ''; |
| 8279 | 8279 | } |
| 8280 | 8280 | |
| 8281 | - return (string) \mb_substr( |
|
| 8281 | + return (string)\mb_substr( |
|
| 8282 | 8282 | $str, |
| 8283 | 8283 | 0, |
| 8284 | 8284 | $offset |
@@ -8290,7 +8290,7 @@ discard block |
||
| 8290 | 8290 | return ''; |
| 8291 | 8291 | } |
| 8292 | 8292 | |
| 8293 | - return (string) self::substr( |
|
| 8293 | + return (string)self::substr( |
|
| 8294 | 8294 | $str, |
| 8295 | 8295 | 0, |
| 8296 | 8296 | $offset, |
@@ -8321,7 +8321,7 @@ discard block |
||
| 8321 | 8321 | return ''; |
| 8322 | 8322 | } |
| 8323 | 8323 | |
| 8324 | - return (string) \mb_substr( |
|
| 8324 | + return (string)\mb_substr( |
|
| 8325 | 8325 | $str, |
| 8326 | 8326 | 0, |
| 8327 | 8327 | $offset |
@@ -8335,7 +8335,7 @@ discard block |
||
| 8335 | 8335 | |
| 8336 | 8336 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8337 | 8337 | |
| 8338 | - return (string) self::substr( |
|
| 8338 | + return (string)self::substr( |
|
| 8339 | 8339 | $str, |
| 8340 | 8340 | 0, |
| 8341 | 8341 | $offset, |
@@ -8450,7 +8450,7 @@ discard block |
||
| 8450 | 8450 | */ |
| 8451 | 8451 | public static function str_surround(string $str, string $substring): string |
| 8452 | 8452 | { |
| 8453 | - return $substring . $str . $substring; |
|
| 8453 | + return $substring.$str.$substring; |
|
| 8454 | 8454 | } |
| 8455 | 8455 | |
| 8456 | 8456 | /** |
@@ -8514,9 +8514,9 @@ discard block |
||
| 8514 | 8514 | $word_define_chars = ''; |
| 8515 | 8515 | } |
| 8516 | 8516 | |
| 8517 | - $str = (string) \preg_replace_callback( |
|
| 8518 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
| 8519 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
| 8517 | + $str = (string)\preg_replace_callback( |
|
| 8518 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
| 8519 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
| 8520 | 8520 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
| 8521 | 8521 | return $match[0]; |
| 8522 | 8522 | } |
@@ -8616,16 +8616,16 @@ discard block |
||
| 8616 | 8616 | |
| 8617 | 8617 | // the main substitutions |
| 8618 | 8618 | /** @noinspection RegExpDuplicateAlternationBranch - false-positive - https://youtrack.jetbrains.com/issue/WI-51002 */ |
| 8619 | - $str = (string) \preg_replace_callback( |
|
| 8619 | + $str = (string)\preg_replace_callback( |
|
| 8620 | 8620 | '~\\b (_*) (?: # 1. Leading underscore and |
| 8621 | 8621 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
| 8622 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
| 8622 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
| 8623 | 8623 | | |
| 8624 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
| 8624 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
| 8625 | 8625 | | |
| 8626 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
| 8626 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
| 8627 | 8627 | | |
| 8628 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
| 8628 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
| 8629 | 8629 | ) (_*) \\b # 6. With trailing underscore |
| 8630 | 8630 | ~ux', |
| 8631 | 8631 | /** |
@@ -8635,7 +8635,7 @@ discard block |
||
| 8635 | 8635 | * |
| 8636 | 8636 | * @return string |
| 8637 | 8637 | */ |
| 8638 | - static function (array $matches) use ($encoding): string { |
|
| 8638 | + static function(array $matches) use ($encoding): string { |
|
| 8639 | 8639 | // preserve leading underscore |
| 8640 | 8640 | $str = $matches[1]; |
| 8641 | 8641 | if ($matches[2]) { |
@@ -8660,11 +8660,11 @@ discard block |
||
| 8660 | 8660 | ); |
| 8661 | 8661 | |
| 8662 | 8662 | // Exceptions for small words: capitalize at start of title... |
| 8663 | - $str = (string) \preg_replace_callback( |
|
| 8663 | + $str = (string)\preg_replace_callback( |
|
| 8664 | 8664 | '~( \\A [[:punct:]]* # start of title... |
| 8665 | 8665 | | [:.;?!][ ]+ # or of subsentence... |
| 8666 | 8666 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
| 8667 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
| 8667 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
| 8668 | 8668 | ~uxi', |
| 8669 | 8669 | /** |
| 8670 | 8670 | * @param string[] $matches |
@@ -8673,15 +8673,15 @@ discard block |
||
| 8673 | 8673 | * |
| 8674 | 8674 | * @return string |
| 8675 | 8675 | */ |
| 8676 | - static function (array $matches) use ($encoding): string { |
|
| 8677 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
| 8676 | + static function(array $matches) use ($encoding): string { |
|
| 8677 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
| 8678 | 8678 | }, |
| 8679 | 8679 | $str |
| 8680 | 8680 | ); |
| 8681 | 8681 | |
| 8682 | 8682 | // ...and end of title |
| 8683 | - $str = (string) \preg_replace_callback( |
|
| 8684 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
| 8683 | + $str = (string)\preg_replace_callback( |
|
| 8684 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
| 8685 | 8685 | (?= [[:punct:]]* \Z # ...at the end of the title... |
| 8686 | 8686 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
| 8687 | 8687 | ~uxi', |
@@ -8692,7 +8692,7 @@ discard block |
||
| 8692 | 8692 | * |
| 8693 | 8693 | * @return string |
| 8694 | 8694 | */ |
| 8695 | - static function (array $matches) use ($encoding): string { |
|
| 8695 | + static function(array $matches) use ($encoding): string { |
|
| 8696 | 8696 | return static::ucfirst($matches[1], $encoding); |
| 8697 | 8697 | }, |
| 8698 | 8698 | $str |
@@ -8700,10 +8700,10 @@ discard block |
||
| 8700 | 8700 | |
| 8701 | 8701 | // Exceptions for small words in hyphenated compound words. |
| 8702 | 8702 | // e.g. "in-flight" -> In-Flight |
| 8703 | - $str = (string) \preg_replace_callback( |
|
| 8703 | + $str = (string)\preg_replace_callback( |
|
| 8704 | 8704 | '~\\b |
| 8705 | 8705 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
| 8706 | - ( ' . $small_words_rx . ' ) |
|
| 8706 | + ( ' . $small_words_rx.' ) |
|
| 8707 | 8707 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
| 8708 | 8708 | ~uxi', |
| 8709 | 8709 | /** |
@@ -8713,18 +8713,18 @@ discard block |
||
| 8713 | 8713 | * |
| 8714 | 8714 | * @return string |
| 8715 | 8715 | */ |
| 8716 | - static function (array $matches) use ($encoding): string { |
|
| 8716 | + static function(array $matches) use ($encoding): string { |
|
| 8717 | 8717 | return static::ucfirst($matches[1], $encoding); |
| 8718 | 8718 | }, |
| 8719 | 8719 | $str |
| 8720 | 8720 | ); |
| 8721 | 8721 | |
| 8722 | 8722 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
| 8723 | - $str = (string) \preg_replace_callback( |
|
| 8723 | + $str = (string)\preg_replace_callback( |
|
| 8724 | 8724 | '~\\b |
| 8725 | 8725 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
| 8726 | 8726 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
| 8727 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
| 8727 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
| 8728 | 8728 | (?! - ) # Negative lookahead for another - |
| 8729 | 8729 | ~uxi', |
| 8730 | 8730 | /** |
@@ -8734,8 +8734,8 @@ discard block |
||
| 8734 | 8734 | * |
| 8735 | 8735 | * @return string |
| 8736 | 8736 | */ |
| 8737 | - static function (array $matches) use ($encoding): string { |
|
| 8738 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
| 8737 | + static function(array $matches) use ($encoding): string { |
|
| 8738 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
| 8739 | 8739 | }, |
| 8740 | 8740 | $str |
| 8741 | 8741 | ); |
@@ -8850,7 +8850,7 @@ discard block |
||
| 8850 | 8850 | ); |
| 8851 | 8851 | |
| 8852 | 8852 | foreach ($tmp_return as &$item) { |
| 8853 | - $item = (string) $item; |
|
| 8853 | + $item = (string)$item; |
|
| 8854 | 8854 | } |
| 8855 | 8855 | |
| 8856 | 8856 | return $tmp_return; |
@@ -8904,39 +8904,39 @@ discard block |
||
| 8904 | 8904 | } |
| 8905 | 8905 | |
| 8906 | 8906 | if ($encoding === 'UTF-8') { |
| 8907 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 8907 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 8908 | 8908 | return $str; |
| 8909 | 8909 | } |
| 8910 | 8910 | |
| 8911 | 8911 | if ($substring !== '') { |
| 8912 | - $length -= (int) \mb_strlen($substring); |
|
| 8912 | + $length -= (int)\mb_strlen($substring); |
|
| 8913 | 8913 | |
| 8914 | 8914 | /** @noinspection UnnecessaryCastingInspection */ |
| 8915 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
| 8915 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
| 8916 | 8916 | } |
| 8917 | 8917 | |
| 8918 | 8918 | /** @noinspection UnnecessaryCastingInspection */ |
| 8919 | - return (string) \mb_substr($str, 0, $length); |
|
| 8919 | + return (string)\mb_substr($str, 0, $length); |
|
| 8920 | 8920 | } |
| 8921 | 8921 | |
| 8922 | 8922 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8923 | 8923 | |
| 8924 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 8924 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 8925 | 8925 | return $str; |
| 8926 | 8926 | } |
| 8927 | 8927 | |
| 8928 | 8928 | if ($substring !== '') { |
| 8929 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 8929 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 8930 | 8930 | } |
| 8931 | 8931 | |
| 8932 | 8932 | return ( |
| 8933 | - (string) self::substr( |
|
| 8933 | + (string)self::substr( |
|
| 8934 | 8934 | $str, |
| 8935 | 8935 | 0, |
| 8936 | 8936 | $length, |
| 8937 | 8937 | $encoding |
| 8938 | 8938 | ) |
| 8939 | - ) . $substring; |
|
| 8939 | + ).$substring; |
|
| 8940 | 8940 | } |
| 8941 | 8941 | |
| 8942 | 8942 | /** |
@@ -8970,12 +8970,12 @@ discard block |
||
| 8970 | 8970 | } |
| 8971 | 8971 | |
| 8972 | 8972 | if ($encoding === 'UTF-8') { |
| 8973 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 8973 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 8974 | 8974 | return $str; |
| 8975 | 8975 | } |
| 8976 | 8976 | |
| 8977 | 8977 | // need to further trim the string so we can append the substring |
| 8978 | - $length -= (int) \mb_strlen($substring); |
|
| 8978 | + $length -= (int)\mb_strlen($substring); |
|
| 8979 | 8979 | if ($length <= 0) { |
| 8980 | 8980 | return $substring; |
| 8981 | 8981 | } |
@@ -9001,18 +9001,18 @@ discard block |
||
| 9001 | 9001 | !$ignore_do_not_split_words_for_one_word |
| 9002 | 9002 | ) |
| 9003 | 9003 | ) { |
| 9004 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
| 9004 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
| 9005 | 9005 | } |
| 9006 | 9006 | } |
| 9007 | 9007 | } else { |
| 9008 | 9008 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 9009 | 9009 | |
| 9010 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 9010 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 9011 | 9011 | return $str; |
| 9012 | 9012 | } |
| 9013 | 9013 | |
| 9014 | 9014 | // need to further trim the string so we can append the substring |
| 9015 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 9015 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 9016 | 9016 | if ($length <= 0) { |
| 9017 | 9017 | return $substring; |
| 9018 | 9018 | } |
@@ -9038,12 +9038,12 @@ discard block |
||
| 9038 | 9038 | !$ignore_do_not_split_words_for_one_word |
| 9039 | 9039 | ) |
| 9040 | 9040 | ) { |
| 9041 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
| 9041 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
| 9042 | 9042 | } |
| 9043 | 9043 | } |
| 9044 | 9044 | } |
| 9045 | 9045 | |
| 9046 | - return $truncated . $substring; |
|
| 9046 | + return $truncated.$substring; |
|
| 9047 | 9047 | } |
| 9048 | 9048 | |
| 9049 | 9049 | /** |
@@ -9153,13 +9153,13 @@ discard block |
||
| 9153 | 9153 | } |
| 9154 | 9154 | } elseif ($format === 2) { |
| 9155 | 9155 | $number_of_words = []; |
| 9156 | - $offset = (int) self::strlen($str_parts[0]); |
|
| 9156 | + $offset = (int)self::strlen($str_parts[0]); |
|
| 9157 | 9157 | for ($i = 1; $i < $len; $i += 2) { |
| 9158 | 9158 | $number_of_words[$offset] = $str_parts[$i]; |
| 9159 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
| 9159 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
| 9160 | 9160 | } |
| 9161 | 9161 | } else { |
| 9162 | - $number_of_words = (int) (($len - 1) / 2); |
|
| 9162 | + $number_of_words = (int)(($len - 1) / 2); |
|
| 9163 | 9163 | } |
| 9164 | 9164 | |
| 9165 | 9165 | return $number_of_words; |
@@ -9288,21 +9288,21 @@ discard block |
||
| 9288 | 9288 | } |
| 9289 | 9289 | |
| 9290 | 9290 | if ($char_list === '') { |
| 9291 | - return (int) self::strlen($str, $encoding); |
|
| 9291 | + return (int)self::strlen($str, $encoding); |
|
| 9292 | 9292 | } |
| 9293 | 9293 | |
| 9294 | 9294 | if ($offset !== null || $length !== null) { |
| 9295 | 9295 | if ($encoding === 'UTF-8') { |
| 9296 | 9296 | if ($length === null) { |
| 9297 | 9297 | /** @noinspection UnnecessaryCastingInspection */ |
| 9298 | - $str_tmp = \mb_substr($str, (int) $offset); |
|
| 9298 | + $str_tmp = \mb_substr($str, (int)$offset); |
|
| 9299 | 9299 | } else { |
| 9300 | 9300 | /** @noinspection UnnecessaryCastingInspection */ |
| 9301 | - $str_tmp = \mb_substr($str, (int) $offset, $length); |
|
| 9301 | + $str_tmp = \mb_substr($str, (int)$offset, $length); |
|
| 9302 | 9302 | } |
| 9303 | 9303 | } else { |
| 9304 | 9304 | /** @noinspection UnnecessaryCastingInspection */ |
| 9305 | - $str_tmp = self::substr($str, (int) $offset, $length, $encoding); |
|
| 9305 | + $str_tmp = self::substr($str, (int)$offset, $length, $encoding); |
|
| 9306 | 9306 | } |
| 9307 | 9307 | |
| 9308 | 9308 | if ($str_tmp === false) { |
@@ -9318,7 +9318,7 @@ discard block |
||
| 9318 | 9318 | } |
| 9319 | 9319 | |
| 9320 | 9320 | $matches = []; |
| 9321 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
| 9321 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
| 9322 | 9322 | $return = self::strlen($matches[1], $encoding); |
| 9323 | 9323 | if ($return === false) { |
| 9324 | 9324 | return 0; |
@@ -9327,7 +9327,7 @@ discard block |
||
| 9327 | 9327 | return $return; |
| 9328 | 9328 | } |
| 9329 | 9329 | |
| 9330 | - return (int) self::strlen($str, $encoding); |
|
| 9330 | + return (int)self::strlen($str, $encoding); |
|
| 9331 | 9331 | } |
| 9332 | 9332 | |
| 9333 | 9333 | /** |
@@ -9382,7 +9382,7 @@ discard block |
||
| 9382 | 9382 | |
| 9383 | 9383 | $str = ''; |
| 9384 | 9384 | foreach ($array as $strPart) { |
| 9385 | - $str .= '&#' . (int) $strPart . ';'; |
|
| 9385 | + $str .= '&#'.(int)$strPart.';'; |
|
| 9386 | 9386 | } |
| 9387 | 9387 | |
| 9388 | 9388 | return self::html_entity_decode($str, \ENT_QUOTES | \ENT_HTML5); |
@@ -9471,7 +9471,7 @@ discard block |
||
| 9471 | 9471 | return ''; |
| 9472 | 9472 | } |
| 9473 | 9473 | |
| 9474 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
| 9474 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
| 9475 | 9475 | } |
| 9476 | 9476 | |
| 9477 | 9477 | /** |
@@ -9538,7 +9538,7 @@ discard block |
||
| 9538 | 9538 | // fallback for ascii only |
| 9539 | 9539 | // |
| 9540 | 9540 | |
| 9541 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 9541 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 9542 | 9542 | return \stripos($haystack, $needle, $offset); |
| 9543 | 9543 | } |
| 9544 | 9544 | |
@@ -9611,7 +9611,7 @@ discard block |
||
| 9611 | 9611 | /** |
| 9612 | 9612 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 9613 | 9613 | */ |
| 9614 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9614 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9615 | 9615 | } |
| 9616 | 9616 | |
| 9617 | 9617 | if ( |
@@ -9625,11 +9625,11 @@ discard block |
||
| 9625 | 9625 | } |
| 9626 | 9626 | } |
| 9627 | 9627 | |
| 9628 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
| 9628 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
| 9629 | 9629 | return \stristr($haystack, $needle, $before_needle); |
| 9630 | 9630 | } |
| 9631 | 9631 | |
| 9632 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
| 9632 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
| 9633 | 9633 | |
| 9634 | 9634 | if (!isset($match[1])) { |
| 9635 | 9635 | return false; |
@@ -9639,7 +9639,7 @@ discard block |
||
| 9639 | 9639 | return $match[1]; |
| 9640 | 9640 | } |
| 9641 | 9641 | |
| 9642 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
| 9642 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
| 9643 | 9643 | } |
| 9644 | 9644 | |
| 9645 | 9645 | /** |
@@ -9716,7 +9716,7 @@ discard block |
||
| 9716 | 9716 | /** |
| 9717 | 9717 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 9718 | 9718 | */ |
| 9719 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9719 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9720 | 9720 | } |
| 9721 | 9721 | |
| 9722 | 9722 | // |
@@ -9838,8 +9838,8 @@ discard block |
||
| 9838 | 9838 | } |
| 9839 | 9839 | |
| 9840 | 9840 | return \strnatcmp( |
| 9841 | - (string) self::strtonatfold($str1), |
|
| 9842 | - (string) self::strtonatfold($str2) |
|
| 9841 | + (string)self::strtonatfold($str1), |
|
| 9842 | + (string)self::strtonatfold($str2) |
|
| 9843 | 9843 | ); |
| 9844 | 9844 | } |
| 9845 | 9845 | |
@@ -9901,11 +9901,11 @@ discard block |
||
| 9901 | 9901 | } |
| 9902 | 9902 | |
| 9903 | 9903 | if ($encoding === 'UTF-8') { |
| 9904 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
| 9905 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
| 9904 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
| 9905 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
| 9906 | 9906 | } else { |
| 9907 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
| 9908 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
| 9907 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
| 9908 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
| 9909 | 9909 | } |
| 9910 | 9910 | |
| 9911 | 9911 | return self::strcmp($str1, $str2); |
@@ -9930,8 +9930,8 @@ discard block |
||
| 9930 | 9930 | return false; |
| 9931 | 9931 | } |
| 9932 | 9932 | |
| 9933 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
| 9934 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
| 9933 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
| 9934 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
| 9935 | 9935 | } |
| 9936 | 9936 | |
| 9937 | 9937 | return false; |
@@ -9966,10 +9966,10 @@ discard block |
||
| 9966 | 9966 | } |
| 9967 | 9967 | |
| 9968 | 9968 | // iconv and mbstring do not support integer $needle |
| 9969 | - if ((int) $needle === $needle) { |
|
| 9970 | - $needle = (string) self::chr($needle); |
|
| 9969 | + if ((int)$needle === $needle) { |
|
| 9970 | + $needle = (string)self::chr($needle); |
|
| 9971 | 9971 | } |
| 9972 | - $needle = (string) $needle; |
|
| 9972 | + $needle = (string)$needle; |
|
| 9973 | 9973 | |
| 9974 | 9974 | if ($needle === '') { |
| 9975 | 9975 | return false; |
@@ -10019,7 +10019,7 @@ discard block |
||
| 10019 | 10019 | /** |
| 10020 | 10020 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10021 | 10021 | */ |
| 10022 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10022 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10023 | 10023 | } |
| 10024 | 10024 | |
| 10025 | 10025 | // |
@@ -10060,7 +10060,7 @@ discard block |
||
| 10060 | 10060 | // fallback for ascii only |
| 10061 | 10061 | // |
| 10062 | 10062 | |
| 10063 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10063 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10064 | 10064 | return \strpos($haystack, $needle, $offset); |
| 10065 | 10065 | } |
| 10066 | 10066 | |
@@ -10072,7 +10072,7 @@ discard block |
||
| 10072 | 10072 | if ($haystack_tmp === false) { |
| 10073 | 10073 | $haystack_tmp = ''; |
| 10074 | 10074 | } |
| 10075 | - $haystack = (string) $haystack_tmp; |
|
| 10075 | + $haystack = (string)$haystack_tmp; |
|
| 10076 | 10076 | |
| 10077 | 10077 | if ($offset < 0) { |
| 10078 | 10078 | $offset = 0; |
@@ -10084,7 +10084,7 @@ discard block |
||
| 10084 | 10084 | } |
| 10085 | 10085 | |
| 10086 | 10086 | if ($pos) { |
| 10087 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 10087 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 10088 | 10088 | } |
| 10089 | 10089 | |
| 10090 | 10090 | return $offset + 0; |
@@ -10237,7 +10237,7 @@ discard block |
||
| 10237 | 10237 | /** |
| 10238 | 10238 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10239 | 10239 | */ |
| 10240 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10240 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10241 | 10241 | } |
| 10242 | 10242 | |
| 10243 | 10243 | // |
@@ -10249,7 +10249,7 @@ discard block |
||
| 10249 | 10249 | if ($needle_tmp === false) { |
| 10250 | 10250 | return false; |
| 10251 | 10251 | } |
| 10252 | - $needle = (string) $needle_tmp; |
|
| 10252 | + $needle = (string)$needle_tmp; |
|
| 10253 | 10253 | |
| 10254 | 10254 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
| 10255 | 10255 | if ($pos === false) { |
@@ -10271,7 +10271,7 @@ discard block |
||
| 10271 | 10271 | if ($needle_tmp === false) { |
| 10272 | 10272 | return false; |
| 10273 | 10273 | } |
| 10274 | - $needle = (string) $needle_tmp; |
|
| 10274 | + $needle = (string)$needle_tmp; |
|
| 10275 | 10275 | |
| 10276 | 10276 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
| 10277 | 10277 | if ($pos === false) { |
@@ -10310,7 +10310,7 @@ discard block |
||
| 10310 | 10310 | if ($encoding === 'UTF-8') { |
| 10311 | 10311 | if (self::$SUPPORT['intl'] === true) { |
| 10312 | 10312 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
| 10313 | - $i = (int) \grapheme_strlen($str); |
|
| 10313 | + $i = (int)\grapheme_strlen($str); |
|
| 10314 | 10314 | while ($i--) { |
| 10315 | 10315 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
| 10316 | 10316 | if ($reversed_tmp !== false) { |
@@ -10318,7 +10318,7 @@ discard block |
||
| 10318 | 10318 | } |
| 10319 | 10319 | } |
| 10320 | 10320 | } else { |
| 10321 | - $i = (int) \mb_strlen($str); |
|
| 10321 | + $i = (int)\mb_strlen($str); |
|
| 10322 | 10322 | while ($i--) { |
| 10323 | 10323 | $reversed_tmp = \mb_substr($str, $i, 1); |
| 10324 | 10324 | if ($reversed_tmp !== false) { |
@@ -10329,7 +10329,7 @@ discard block |
||
| 10329 | 10329 | } else { |
| 10330 | 10330 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 10331 | 10331 | |
| 10332 | - $i = (int) self::strlen($str, $encoding); |
|
| 10332 | + $i = (int)self::strlen($str, $encoding); |
|
| 10333 | 10333 | while ($i--) { |
| 10334 | 10334 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
| 10335 | 10335 | if ($reversed_tmp !== false) { |
@@ -10406,7 +10406,7 @@ discard block |
||
| 10406 | 10406 | if ($needle_tmp === false) { |
| 10407 | 10407 | return false; |
| 10408 | 10408 | } |
| 10409 | - $needle = (string) $needle_tmp; |
|
| 10409 | + $needle = (string)$needle_tmp; |
|
| 10410 | 10410 | |
| 10411 | 10411 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
| 10412 | 10412 | if ($pos === false) { |
@@ -10447,10 +10447,10 @@ discard block |
||
| 10447 | 10447 | } |
| 10448 | 10448 | |
| 10449 | 10449 | // iconv and mbstring do not support integer $needle |
| 10450 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 10451 | - $needle = (string) self::chr($needle); |
|
| 10450 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 10451 | + $needle = (string)self::chr($needle); |
|
| 10452 | 10452 | } |
| 10453 | - $needle = (string) $needle; |
|
| 10453 | + $needle = (string)$needle; |
|
| 10454 | 10454 | |
| 10455 | 10455 | if ($needle === '') { |
| 10456 | 10456 | return false; |
@@ -10498,7 +10498,7 @@ discard block |
||
| 10498 | 10498 | /** |
| 10499 | 10499 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10500 | 10500 | */ |
| 10501 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10501 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10502 | 10502 | } |
| 10503 | 10503 | |
| 10504 | 10504 | // |
@@ -10522,7 +10522,7 @@ discard block |
||
| 10522 | 10522 | // fallback for ascii only |
| 10523 | 10523 | // |
| 10524 | 10524 | |
| 10525 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10525 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10526 | 10526 | return \strripos($haystack, $needle, $offset); |
| 10527 | 10527 | } |
| 10528 | 10528 | |
@@ -10603,10 +10603,10 @@ discard block |
||
| 10603 | 10603 | } |
| 10604 | 10604 | |
| 10605 | 10605 | // iconv and mbstring do not support integer $needle |
| 10606 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 10607 | - $needle = (string) self::chr($needle); |
|
| 10606 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 10607 | + $needle = (string)self::chr($needle); |
|
| 10608 | 10608 | } |
| 10609 | - $needle = (string) $needle; |
|
| 10609 | + $needle = (string)$needle; |
|
| 10610 | 10610 | |
| 10611 | 10611 | if ($needle === '') { |
| 10612 | 10612 | return false; |
@@ -10654,7 +10654,7 @@ discard block |
||
| 10654 | 10654 | /** |
| 10655 | 10655 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10656 | 10656 | */ |
| 10657 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10657 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10658 | 10658 | } |
| 10659 | 10659 | |
| 10660 | 10660 | // |
@@ -10678,7 +10678,7 @@ discard block |
||
| 10678 | 10678 | // fallback for ascii only |
| 10679 | 10679 | // |
| 10680 | 10680 | |
| 10681 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10681 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10682 | 10682 | return \strrpos($haystack, $needle, $offset); |
| 10683 | 10683 | } |
| 10684 | 10684 | |
@@ -10698,7 +10698,7 @@ discard block |
||
| 10698 | 10698 | if ($haystack_tmp === false) { |
| 10699 | 10699 | $haystack_tmp = ''; |
| 10700 | 10700 | } |
| 10701 | - $haystack = (string) $haystack_tmp; |
|
| 10701 | + $haystack = (string)$haystack_tmp; |
|
| 10702 | 10702 | } |
| 10703 | 10703 | |
| 10704 | 10704 | $pos = \strrpos($haystack, $needle); |
@@ -10712,7 +10712,7 @@ discard block |
||
| 10712 | 10712 | return false; |
| 10713 | 10713 | } |
| 10714 | 10714 | |
| 10715 | - return $offset + (int) self::strlen($str_tmp); |
|
| 10715 | + return $offset + (int)self::strlen($str_tmp); |
|
| 10716 | 10716 | } |
| 10717 | 10717 | |
| 10718 | 10718 | /** |
@@ -10778,12 +10778,12 @@ discard block |
||
| 10778 | 10778 | if ($offset || $length !== null) { |
| 10779 | 10779 | if ($encoding === 'UTF-8') { |
| 10780 | 10780 | if ($length === null) { |
| 10781 | - $str = (string) \mb_substr($str, $offset); |
|
| 10781 | + $str = (string)\mb_substr($str, $offset); |
|
| 10782 | 10782 | } else { |
| 10783 | - $str = (string) \mb_substr($str, $offset, $length); |
|
| 10783 | + $str = (string)\mb_substr($str, $offset, $length); |
|
| 10784 | 10784 | } |
| 10785 | 10785 | } else { |
| 10786 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
| 10786 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
| 10787 | 10787 | } |
| 10788 | 10788 | } |
| 10789 | 10789 | |
@@ -10793,7 +10793,7 @@ discard block |
||
| 10793 | 10793 | |
| 10794 | 10794 | $matches = []; |
| 10795 | 10795 | |
| 10796 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
| 10796 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
| 10797 | 10797 | } |
| 10798 | 10798 | |
| 10799 | 10799 | /** |
@@ -10867,7 +10867,7 @@ discard block |
||
| 10867 | 10867 | /** |
| 10868 | 10868 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10869 | 10869 | */ |
| 10870 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10870 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10871 | 10871 | } |
| 10872 | 10872 | |
| 10873 | 10873 | // |
@@ -10889,7 +10889,7 @@ discard block |
||
| 10889 | 10889 | // fallback for ascii only |
| 10890 | 10890 | // |
| 10891 | 10891 | |
| 10892 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10892 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10893 | 10893 | return \strstr($haystack, $needle, $before_needle); |
| 10894 | 10894 | } |
| 10895 | 10895 | |
@@ -10897,7 +10897,7 @@ discard block |
||
| 10897 | 10897 | // fallback via vanilla php |
| 10898 | 10898 | // |
| 10899 | 10899 | |
| 10900 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
| 10900 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
| 10901 | 10901 | |
| 10902 | 10902 | if (!isset($match[1])) { |
| 10903 | 10903 | return false; |
@@ -10907,7 +10907,7 @@ discard block |
||
| 10907 | 10907 | return $match[1]; |
| 10908 | 10908 | } |
| 10909 | 10909 | |
| 10910 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
| 10910 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
| 10911 | 10911 | } |
| 10912 | 10912 | |
| 10913 | 10913 | /** |
@@ -11033,7 +11033,7 @@ discard block |
||
| 11033 | 11033 | bool $try_to_keep_the_string_length = false |
| 11034 | 11034 | ): string { |
| 11035 | 11035 | // init |
| 11036 | - $str = (string) $str; |
|
| 11036 | + $str = (string)$str; |
|
| 11037 | 11037 | |
| 11038 | 11038 | if ($str === '') { |
| 11039 | 11039 | return ''; |
@@ -11062,25 +11062,25 @@ discard block |
||
| 11062 | 11062 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 11063 | 11063 | } |
| 11064 | 11064 | |
| 11065 | - $language_code = $lang . '-Lower'; |
|
| 11065 | + $language_code = $lang.'-Lower'; |
|
| 11066 | 11066 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 11067 | 11067 | /** |
| 11068 | 11068 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11069 | 11069 | */ |
| 11070 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
| 11070 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
| 11071 | 11071 | |
| 11072 | 11072 | $language_code = 'Any-Lower'; |
| 11073 | 11073 | } |
| 11074 | 11074 | |
| 11075 | 11075 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 11076 | 11076 | /** @noinspection UnnecessaryCastingInspection */ |
| 11077 | - return (string) \transliterator_transliterate($language_code, $str); |
|
| 11077 | + return (string)\transliterator_transliterate($language_code, $str); |
|
| 11078 | 11078 | } |
| 11079 | 11079 | |
| 11080 | 11080 | /** |
| 11081 | 11081 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11082 | 11082 | */ |
| 11083 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
| 11083 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
| 11084 | 11084 | } |
| 11085 | 11085 | |
| 11086 | 11086 | // always fallback via symfony polyfill |
@@ -11113,7 +11113,7 @@ discard block |
||
| 11113 | 11113 | bool $try_to_keep_the_string_length = false |
| 11114 | 11114 | ): string { |
| 11115 | 11115 | // init |
| 11116 | - $str = (string) $str; |
|
| 11116 | + $str = (string)$str; |
|
| 11117 | 11117 | |
| 11118 | 11118 | if ($str === '') { |
| 11119 | 11119 | return ''; |
@@ -11142,25 +11142,25 @@ discard block |
||
| 11142 | 11142 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 11143 | 11143 | } |
| 11144 | 11144 | |
| 11145 | - $language_code = $lang . '-Upper'; |
|
| 11145 | + $language_code = $lang.'-Upper'; |
|
| 11146 | 11146 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 11147 | 11147 | /** |
| 11148 | 11148 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11149 | 11149 | */ |
| 11150 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
| 11150 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
| 11151 | 11151 | |
| 11152 | 11152 | $language_code = 'Any-Upper'; |
| 11153 | 11153 | } |
| 11154 | 11154 | |
| 11155 | 11155 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 11156 | 11156 | /** @noinspection UnnecessaryCastingInspection */ |
| 11157 | - return (string) \transliterator_transliterate($language_code, $str); |
|
| 11157 | + return (string)\transliterator_transliterate($language_code, $str); |
|
| 11158 | 11158 | } |
| 11159 | 11159 | |
| 11160 | 11160 | /** |
| 11161 | 11161 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11162 | 11162 | */ |
| 11163 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
| 11163 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
| 11164 | 11164 | } |
| 11165 | 11165 | |
| 11166 | 11166 | // always fallback via symfony polyfill |
@@ -11229,7 +11229,7 @@ discard block |
||
| 11229 | 11229 | $from = \array_combine($from, $to); |
| 11230 | 11230 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 11231 | 11231 | if ($from === false) { |
| 11232 | - 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) . ')'); |
|
| 11232 | + 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).')'); |
|
| 11233 | 11233 | } |
| 11234 | 11234 | } |
| 11235 | 11235 | |
@@ -11291,9 +11291,9 @@ discard block |
||
| 11291 | 11291 | } |
| 11292 | 11292 | |
| 11293 | 11293 | $wide = 0; |
| 11294 | - $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); |
|
| 11294 | + $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); |
|
| 11295 | 11295 | |
| 11296 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
| 11296 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
| 11297 | 11297 | } |
| 11298 | 11298 | |
| 11299 | 11299 | /** |
@@ -11391,9 +11391,9 @@ discard block |
||
| 11391 | 11391 | } |
| 11392 | 11392 | |
| 11393 | 11393 | if ($length === null) { |
| 11394 | - $length = (int) $str_length; |
|
| 11394 | + $length = (int)$str_length; |
|
| 11395 | 11395 | } else { |
| 11396 | - $length = (int) $length; |
|
| 11396 | + $length = (int)$length; |
|
| 11397 | 11397 | } |
| 11398 | 11398 | |
| 11399 | 11399 | if ( |
@@ -11404,7 +11404,7 @@ discard block |
||
| 11404 | 11404 | /** |
| 11405 | 11405 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11406 | 11406 | */ |
| 11407 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11407 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11408 | 11408 | } |
| 11409 | 11409 | |
| 11410 | 11410 | // |
@@ -11494,16 +11494,16 @@ discard block |
||
| 11494 | 11494 | ) { |
| 11495 | 11495 | if ($encoding === 'UTF-8') { |
| 11496 | 11496 | if ($length === null) { |
| 11497 | - $str1 = (string) \mb_substr($str1, $offset); |
|
| 11497 | + $str1 = (string)\mb_substr($str1, $offset); |
|
| 11498 | 11498 | } else { |
| 11499 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
| 11499 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
| 11500 | 11500 | } |
| 11501 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
| 11501 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
| 11502 | 11502 | } else { |
| 11503 | 11503 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 11504 | 11504 | |
| 11505 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
| 11506 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
| 11505 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
| 11506 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
| 11507 | 11507 | } |
| 11508 | 11508 | } |
| 11509 | 11509 | |
@@ -11568,13 +11568,13 @@ discard block |
||
| 11568 | 11568 | if ($length_tmp === false) { |
| 11569 | 11569 | return false; |
| 11570 | 11570 | } |
| 11571 | - $length = (int) $length_tmp; |
|
| 11571 | + $length = (int)$length_tmp; |
|
| 11572 | 11572 | } |
| 11573 | 11573 | |
| 11574 | 11574 | if ($encoding === 'UTF-8') { |
| 11575 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
| 11575 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
| 11576 | 11576 | } else { |
| 11577 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
| 11577 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
| 11578 | 11578 | } |
| 11579 | 11579 | } |
| 11580 | 11580 | |
@@ -11586,7 +11586,7 @@ discard block |
||
| 11586 | 11586 | /** |
| 11587 | 11587 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11588 | 11588 | */ |
| 11589 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11589 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11590 | 11590 | } |
| 11591 | 11591 | |
| 11592 | 11592 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -11597,7 +11597,7 @@ discard block |
||
| 11597 | 11597 | return \mb_substr_count($haystack, $needle, $encoding); |
| 11598 | 11598 | } |
| 11599 | 11599 | |
| 11600 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 11600 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 11601 | 11601 | |
| 11602 | 11602 | return \count($matches); |
| 11603 | 11603 | } |
@@ -11647,7 +11647,7 @@ discard block |
||
| 11647 | 11647 | if ($length_tmp === false) { |
| 11648 | 11648 | return false; |
| 11649 | 11649 | } |
| 11650 | - $length = (int) $length_tmp; |
|
| 11650 | + $length = (int)$length_tmp; |
|
| 11651 | 11651 | } |
| 11652 | 11652 | |
| 11653 | 11653 | if ( |
@@ -11669,7 +11669,7 @@ discard block |
||
| 11669 | 11669 | if ($haystack_tmp === false) { |
| 11670 | 11670 | $haystack_tmp = ''; |
| 11671 | 11671 | } |
| 11672 | - $haystack = (string) $haystack_tmp; |
|
| 11672 | + $haystack = (string)$haystack_tmp; |
|
| 11673 | 11673 | } |
| 11674 | 11674 | |
| 11675 | 11675 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -11710,10 +11710,10 @@ discard block |
||
| 11710 | 11710 | |
| 11711 | 11711 | if ($encoding === 'UTF-8') { |
| 11712 | 11712 | if ($case_sensitive) { |
| 11713 | - return (int) \mb_substr_count($str, $substring); |
|
| 11713 | + return (int)\mb_substr_count($str, $substring); |
|
| 11714 | 11714 | } |
| 11715 | 11715 | |
| 11716 | - return (int) \mb_substr_count( |
|
| 11716 | + return (int)\mb_substr_count( |
|
| 11717 | 11717 | \mb_strtoupper($str), |
| 11718 | 11718 | \mb_strtoupper($substring) |
| 11719 | 11719 | ); |
@@ -11722,10 +11722,10 @@ discard block |
||
| 11722 | 11722 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 11723 | 11723 | |
| 11724 | 11724 | if ($case_sensitive) { |
| 11725 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
| 11725 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
| 11726 | 11726 | } |
| 11727 | 11727 | |
| 11728 | - return (int) \mb_substr_count( |
|
| 11728 | + return (int)\mb_substr_count( |
|
| 11729 | 11729 | self::strtocasefold($str, true, false, $encoding, null, false), |
| 11730 | 11730 | self::strtocasefold($substring, true, false, $encoding, null, false), |
| 11731 | 11731 | $encoding |
@@ -11754,7 +11754,7 @@ discard block |
||
| 11754 | 11754 | } |
| 11755 | 11755 | |
| 11756 | 11756 | if (self::str_istarts_with($haystack, $needle)) { |
| 11757 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 11757 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 11758 | 11758 | } |
| 11759 | 11759 | |
| 11760 | 11760 | return $haystack; |
@@ -11816,7 +11816,7 @@ discard block |
||
| 11816 | 11816 | } |
| 11817 | 11817 | |
| 11818 | 11818 | if (self::str_iends_with($haystack, $needle)) { |
| 11819 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
| 11819 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
| 11820 | 11820 | } |
| 11821 | 11821 | |
| 11822 | 11822 | return $haystack; |
@@ -11844,7 +11844,7 @@ discard block |
||
| 11844 | 11844 | } |
| 11845 | 11845 | |
| 11846 | 11846 | if (self::str_starts_with($haystack, $needle)) { |
| 11847 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 11847 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 11848 | 11848 | } |
| 11849 | 11849 | |
| 11850 | 11850 | return $haystack; |
@@ -11899,7 +11899,7 @@ discard block |
||
| 11899 | 11899 | if (\is_array($offset)) { |
| 11900 | 11900 | $offset = \array_slice($offset, 0, $num); |
| 11901 | 11901 | foreach ($offset as &$value_tmp) { |
| 11902 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
| 11902 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
| 11903 | 11903 | } |
| 11904 | 11904 | unset($value_tmp); |
| 11905 | 11905 | } else { |
@@ -11912,7 +11912,7 @@ discard block |
||
| 11912 | 11912 | } elseif (\is_array($length)) { |
| 11913 | 11913 | $length = \array_slice($length, 0, $num); |
| 11914 | 11914 | foreach ($length as &$value_tmp_V2) { |
| 11915 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
| 11915 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
| 11916 | 11916 | } |
| 11917 | 11917 | unset($value_tmp_V2); |
| 11918 | 11918 | } else { |
@@ -11932,8 +11932,8 @@ discard block |
||
| 11932 | 11932 | } |
| 11933 | 11933 | |
| 11934 | 11934 | // init |
| 11935 | - $str = (string) $str; |
|
| 11936 | - $replacement = (string) $replacement; |
|
| 11935 | + $str = (string)$str; |
|
| 11936 | + $replacement = (string)$replacement; |
|
| 11937 | 11937 | |
| 11938 | 11938 | if (\is_array($length)) { |
| 11939 | 11939 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -11948,16 +11948,16 @@ discard block |
||
| 11948 | 11948 | } |
| 11949 | 11949 | |
| 11950 | 11950 | if (self::$SUPPORT['mbstring'] === true) { |
| 11951 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 11951 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 11952 | 11952 | |
| 11953 | 11953 | if ($offset < 0) { |
| 11954 | - $offset = (int) \max(0, $string_length + $offset); |
|
| 11954 | + $offset = (int)\max(0, $string_length + $offset); |
|
| 11955 | 11955 | } elseif ($offset > $string_length) { |
| 11956 | 11956 | $offset = $string_length; |
| 11957 | 11957 | } |
| 11958 | 11958 | |
| 11959 | 11959 | if ($length !== null && $length < 0) { |
| 11960 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
| 11960 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
| 11961 | 11961 | } elseif ($length === null || $length > $string_length) { |
| 11962 | 11962 | $length = $string_length; |
| 11963 | 11963 | } |
@@ -11968,9 +11968,9 @@ discard block |
||
| 11968 | 11968 | } |
| 11969 | 11969 | |
| 11970 | 11970 | /** @noinspection AdditionOperationOnArraysInspection */ |
| 11971 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
| 11972 | - $replacement . |
|
| 11973 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 11971 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
| 11972 | + $replacement. |
|
| 11973 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 11974 | 11974 | } |
| 11975 | 11975 | |
| 11976 | 11976 | // |
@@ -11979,8 +11979,7 @@ discard block |
||
| 11979 | 11979 | |
| 11980 | 11980 | if (ASCII::is_ascii($str)) { |
| 11981 | 11981 | return ($length === null) ? |
| 11982 | - \substr_replace($str, $replacement, $offset) : |
|
| 11983 | - \substr_replace($str, $replacement, $offset, $length); |
|
| 11982 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
| 11984 | 11983 | } |
| 11985 | 11984 | |
| 11986 | 11985 | // |
@@ -11996,7 +11995,7 @@ discard block |
||
| 11996 | 11995 | // e.g.: non mbstring support + invalid chars |
| 11997 | 11996 | return ''; |
| 11998 | 11997 | } |
| 11999 | - $length = (int) $length_tmp; |
|
| 11998 | + $length = (int)$length_tmp; |
|
| 12000 | 11999 | } |
| 12001 | 12000 | |
| 12002 | 12001 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -12034,14 +12033,14 @@ discard block |
||
| 12034 | 12033 | && |
| 12035 | 12034 | \substr($haystack, -\strlen($needle)) === $needle |
| 12036 | 12035 | ) { |
| 12037 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
| 12036 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
| 12038 | 12037 | } |
| 12039 | 12038 | |
| 12040 | 12039 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
| 12041 | - return (string) self::substr( |
|
| 12040 | + return (string)self::substr( |
|
| 12042 | 12041 | $haystack, |
| 12043 | 12042 | 0, |
| 12044 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
| 12043 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
| 12045 | 12044 | $encoding |
| 12046 | 12045 | ); |
| 12047 | 12046 | } |
@@ -12074,10 +12073,10 @@ discard block |
||
| 12074 | 12073 | } |
| 12075 | 12074 | |
| 12076 | 12075 | if ($encoding === 'UTF-8') { |
| 12077 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 12076 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 12078 | 12077 | } |
| 12079 | 12078 | |
| 12080 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 12079 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 12081 | 12080 | } |
| 12082 | 12081 | |
| 12083 | 12082 | /** |
@@ -12285,7 +12284,7 @@ discard block |
||
| 12285 | 12284 | public static function to_boolean($str): bool |
| 12286 | 12285 | { |
| 12287 | 12286 | // init |
| 12288 | - $str = (string) $str; |
|
| 12287 | + $str = (string)$str; |
|
| 12289 | 12288 | |
| 12290 | 12289 | if ($str === '') { |
| 12291 | 12290 | return false; |
@@ -12313,10 +12312,10 @@ discard block |
||
| 12313 | 12312 | } |
| 12314 | 12313 | |
| 12315 | 12314 | if (\is_numeric($str)) { |
| 12316 | - return ((float) $str + 0) > 0; |
|
| 12315 | + return ((float)$str + 0) > 0; |
|
| 12317 | 12316 | } |
| 12318 | 12317 | |
| 12319 | - return (bool) \trim($str); |
|
| 12318 | + return (bool)\trim($str); |
|
| 12320 | 12319 | } |
| 12321 | 12320 | |
| 12322 | 12321 | /** |
@@ -12362,7 +12361,7 @@ discard block |
||
| 12362 | 12361 | return $str; |
| 12363 | 12362 | } |
| 12364 | 12363 | |
| 12365 | - $str = (string) $str; |
|
| 12364 | + $str = (string)$str; |
|
| 12366 | 12365 | if ($str === '') { |
| 12367 | 12366 | return ''; |
| 12368 | 12367 | } |
@@ -12417,7 +12416,7 @@ discard block |
||
| 12417 | 12416 | return $str; |
| 12418 | 12417 | } |
| 12419 | 12418 | |
| 12420 | - $str = (string) $str; |
|
| 12419 | + $str = (string)$str; |
|
| 12421 | 12420 | if ($str === '') { |
| 12422 | 12421 | return $str; |
| 12423 | 12422 | } |
@@ -12435,7 +12434,7 @@ discard block |
||
| 12435 | 12434 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
| 12436 | 12435 | |
| 12437 | 12436 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 12438 | - $buf .= $c1 . $c2; |
|
| 12437 | + $buf .= $c1.$c2; |
|
| 12439 | 12438 | ++$i; |
| 12440 | 12439 | } else { // not valid UTF8 - convert it |
| 12441 | 12440 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12446,7 +12445,7 @@ discard block |
||
| 12446 | 12445 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
| 12447 | 12446 | |
| 12448 | 12447 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 12449 | - $buf .= $c1 . $c2 . $c3; |
|
| 12448 | + $buf .= $c1.$c2.$c3; |
|
| 12450 | 12449 | $i += 2; |
| 12451 | 12450 | } else { // not valid UTF8 - convert it |
| 12452 | 12451 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12458,7 +12457,7 @@ discard block |
||
| 12458 | 12457 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
| 12459 | 12458 | |
| 12460 | 12459 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 12461 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
| 12460 | + $buf .= $c1.$c2.$c3.$c4; |
|
| 12462 | 12461 | $i += 3; |
| 12463 | 12462 | } else { // not valid UTF8 - convert it |
| 12464 | 12463 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12486,13 +12485,13 @@ discard block |
||
| 12486 | 12485 | * |
| 12487 | 12486 | * @return string |
| 12488 | 12487 | */ |
| 12489 | - static function (array $matches): string { |
|
| 12488 | + static function(array $matches): string { |
|
| 12490 | 12489 | if (isset($matches[3])) { |
| 12491 | - $cp = (int) \hexdec($matches[3]); |
|
| 12490 | + $cp = (int)\hexdec($matches[3]); |
|
| 12492 | 12491 | } else { |
| 12493 | 12492 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
| 12494 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
| 12495 | - + (int) \hexdec($matches[2]) |
|
| 12493 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
| 12494 | + + (int)\hexdec($matches[2]) |
|
| 12496 | 12495 | + 0x10000 |
| 12497 | 12496 | - (0xD800 << 10) |
| 12498 | 12497 | - 0xDC00; |
@@ -12503,12 +12502,12 @@ discard block |
||
| 12503 | 12502 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
| 12504 | 12503 | |
| 12505 | 12504 | if ($cp < 0x80) { |
| 12506 | - return (string) self::chr($cp); |
|
| 12505 | + return (string)self::chr($cp); |
|
| 12507 | 12506 | } |
| 12508 | 12507 | |
| 12509 | 12508 | if ($cp < 0xA0) { |
| 12510 | 12509 | /** @noinspection UnnecessaryCastingInspection */ |
| 12511 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
| 12510 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
| 12512 | 12511 | } |
| 12513 | 12512 | |
| 12514 | 12513 | return self::decimal_to_chr($cp); |
@@ -12541,7 +12540,7 @@ discard block |
||
| 12541 | 12540 | public static function to_int(string $str) |
| 12542 | 12541 | { |
| 12543 | 12542 | if (\is_numeric($str)) { |
| 12544 | - return (int) $str; |
|
| 12543 | + return (int)$str; |
|
| 12545 | 12544 | } |
| 12546 | 12545 | |
| 12547 | 12546 | return null; |
@@ -12572,7 +12571,7 @@ discard block |
||
| 12572 | 12571 | || |
| 12573 | 12572 | $input_type === 'double' |
| 12574 | 12573 | ) { |
| 12575 | - return (string) $input; |
|
| 12574 | + return (string)$input; |
|
| 12576 | 12575 | } |
| 12577 | 12576 | |
| 12578 | 12577 | if ( |
@@ -12580,7 +12579,7 @@ discard block |
||
| 12580 | 12579 | && |
| 12581 | 12580 | \method_exists($input, '__toString') |
| 12582 | 12581 | ) { |
| 12583 | - return (string) $input; |
|
| 12582 | + return (string)$input; |
|
| 12584 | 12583 | } |
| 12585 | 12584 | |
| 12586 | 12585 | return null; |
@@ -12618,7 +12617,7 @@ discard block |
||
| 12618 | 12617 | } |
| 12619 | 12618 | |
| 12620 | 12619 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 12621 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 12620 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 12622 | 12621 | } |
| 12623 | 12622 | |
| 12624 | 12623 | if ($chars) { |
@@ -12667,15 +12666,15 @@ discard block |
||
| 12667 | 12666 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 12668 | 12667 | |
| 12669 | 12668 | if ($encoding === 'UTF-8') { |
| 12670 | - $str_part_two = (string) \mb_substr($str, 1); |
|
| 12669 | + $str_part_two = (string)\mb_substr($str, 1); |
|
| 12671 | 12670 | |
| 12672 | 12671 | if ($use_mb_functions) { |
| 12673 | 12672 | $str_part_one = \mb_strtoupper( |
| 12674 | - (string) \mb_substr($str, 0, 1) |
|
| 12673 | + (string)\mb_substr($str, 0, 1) |
|
| 12675 | 12674 | ); |
| 12676 | 12675 | } else { |
| 12677 | 12676 | $str_part_one = self::strtoupper( |
| 12678 | - (string) \mb_substr($str, 0, 1), |
|
| 12677 | + (string)\mb_substr($str, 0, 1), |
|
| 12679 | 12678 | $encoding, |
| 12680 | 12679 | false, |
| 12681 | 12680 | $lang, |
@@ -12685,16 +12684,16 @@ discard block |
||
| 12685 | 12684 | } else { |
| 12686 | 12685 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 12687 | 12686 | |
| 12688 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
| 12687 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
| 12689 | 12688 | |
| 12690 | 12689 | if ($use_mb_functions) { |
| 12691 | 12690 | $str_part_one = \mb_strtoupper( |
| 12692 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
| 12691 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
| 12693 | 12692 | $encoding |
| 12694 | 12693 | ); |
| 12695 | 12694 | } else { |
| 12696 | 12695 | $str_part_one = self::strtoupper( |
| 12697 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 12696 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 12698 | 12697 | $encoding, |
| 12699 | 12698 | false, |
| 12700 | 12699 | $lang, |
@@ -12703,7 +12702,7 @@ discard block |
||
| 12703 | 12702 | } |
| 12704 | 12703 | } |
| 12705 | 12704 | |
| 12706 | - return $str_part_one . $str_part_two; |
|
| 12705 | + return $str_part_one.$str_part_two; |
|
| 12707 | 12706 | } |
| 12708 | 12707 | |
| 12709 | 12708 | /** |
@@ -12762,7 +12761,7 @@ discard block |
||
| 12762 | 12761 | $str = self::clean($str); |
| 12763 | 12762 | } |
| 12764 | 12763 | |
| 12765 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
| 12764 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
| 12766 | 12765 | |
| 12767 | 12766 | if ( |
| 12768 | 12767 | $use_php_default_functions |
@@ -13175,7 +13174,7 @@ discard block |
||
| 13175 | 13174 | if ( |
| 13176 | 13175 | $keep_utf8_chars |
| 13177 | 13176 | && |
| 13178 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
| 13177 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
| 13179 | 13178 | ) { |
| 13180 | 13179 | return $str_backup; |
| 13181 | 13180 | } |
@@ -13262,17 +13261,17 @@ discard block |
||
| 13262 | 13261 | return ''; |
| 13263 | 13262 | } |
| 13264 | 13263 | |
| 13265 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
| 13264 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
| 13266 | 13265 | |
| 13267 | 13266 | if ( |
| 13268 | 13267 | !isset($matches[0]) |
| 13269 | 13268 | || |
| 13270 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
| 13269 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
| 13271 | 13270 | ) { |
| 13272 | 13271 | return $str; |
| 13273 | 13272 | } |
| 13274 | 13273 | |
| 13275 | - return \rtrim($matches[0]) . $str_add_on; |
|
| 13274 | + return \rtrim($matches[0]).$str_add_on; |
|
| 13276 | 13275 | } |
| 13277 | 13276 | |
| 13278 | 13277 | /** |
@@ -13361,7 +13360,7 @@ discard block |
||
| 13361 | 13360 | } |
| 13362 | 13361 | } |
| 13363 | 13362 | |
| 13364 | - return $str_return . \implode('', $chars); |
|
| 13363 | + return $str_return.\implode('', $chars); |
|
| 13365 | 13364 | } |
| 13366 | 13365 | |
| 13367 | 13366 | /** |
@@ -13415,7 +13414,7 @@ discard block |
||
| 13415 | 13414 | $final_break = ''; |
| 13416 | 13415 | } |
| 13417 | 13416 | |
| 13418 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
| 13417 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
| 13419 | 13418 | } |
| 13420 | 13419 | |
| 13421 | 13420 | /** |
@@ -13651,7 +13650,7 @@ discard block |
||
| 13651 | 13650 | /** @noinspection PhpIncludeInspection */ |
| 13652 | 13651 | /** @noinspection UsingInclusionReturnValueInspection */ |
| 13653 | 13652 | /** @psalm-suppress UnresolvableInclude */ |
| 13654 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
| 13653 | + return include __DIR__.'/data/'.$file.'.php'; |
|
| 13655 | 13654 | } |
| 13656 | 13655 | |
| 13657 | 13656 | /** |
@@ -13671,7 +13670,7 @@ discard block |
||
| 13671 | 13670 | */ |
| 13672 | 13671 | \uksort( |
| 13673 | 13672 | self::$EMOJI, |
| 13674 | - static function (string $a, string $b): int { |
|
| 13673 | + static function(string $a, string $b): int { |
|
| 13675 | 13674 | return \strlen($b) <=> \strlen($a); |
| 13676 | 13675 | } |
| 13677 | 13676 | ); |
@@ -13681,7 +13680,7 @@ discard block |
||
| 13681 | 13680 | |
| 13682 | 13681 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
| 13683 | 13682 | $tmp_key = \crc32($key); |
| 13684 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
| 13683 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
| 13685 | 13684 | } |
| 13686 | 13685 | |
| 13687 | 13686 | return true; |
@@ -13709,7 +13708,7 @@ discard block |
||
| 13709 | 13708 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 13710 | 13709 | return \defined('MB_OVERLOAD_STRING') |
| 13711 | 13710 | && |
| 13712 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 13711 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 13713 | 13712 | } |
| 13714 | 13713 | |
| 13715 | 13714 | /** |
@@ -13775,7 +13774,7 @@ discard block |
||
| 13775 | 13774 | */ |
| 13776 | 13775 | static $RX_CLASS_CACHE = []; |
| 13777 | 13776 | |
| 13778 | - $cache_key = $s . '_' . $class; |
|
| 13777 | + $cache_key = $s.'_'.$class; |
|
| 13779 | 13778 | |
| 13780 | 13779 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
| 13781 | 13780 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -13788,7 +13787,7 @@ discard block |
||
| 13788 | 13787 | foreach (self::str_split($s) as &$s) { |
| 13789 | 13788 | /** @var string $s */ |
| 13790 | 13789 | if ($s === '-') { |
| 13791 | - $class_array[0] = '-' . $class_array[0]; |
|
| 13790 | + $class_array[0] = '-'.$class_array[0]; |
|
| 13792 | 13791 | } elseif (!isset($s[2])) { |
| 13793 | 13792 | $class_array[0] .= \preg_quote($s, '/'); |
| 13794 | 13793 | } elseif (self::strlen($s) === 1) { |
@@ -13799,13 +13798,13 @@ discard block |
||
| 13799 | 13798 | } |
| 13800 | 13799 | |
| 13801 | 13800 | if ($class_array[0]) { |
| 13802 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
| 13801 | + $class_array[0] = '['.$class_array[0].']'; |
|
| 13803 | 13802 | } |
| 13804 | 13803 | |
| 13805 | 13804 | if (\count($class_array) === 1) { |
| 13806 | 13805 | $return = $class_array[0]; |
| 13807 | 13806 | } else { |
| 13808 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
| 13807 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
| 13809 | 13808 | } |
| 13810 | 13809 | |
| 13811 | 13810 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -13886,7 +13885,7 @@ discard block |
||
| 13886 | 13885 | |
| 13887 | 13886 | if ($delimiter === '-') { |
| 13888 | 13887 | /** @noinspection AlterInForeachInspection */ |
| 13889 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
| 13888 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
| 13890 | 13889 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
| 13891 | 13890 | $continue = true; |
| 13892 | 13891 | |
@@ -13896,7 +13895,7 @@ discard block |
||
| 13896 | 13895 | } |
| 13897 | 13896 | |
| 13898 | 13897 | /** @noinspection AlterInForeachInspection */ |
| 13899 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
| 13898 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
| 13900 | 13899 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
| 13901 | 13900 | $continue = true; |
| 13902 | 13901 | |
@@ -13966,8 +13965,8 @@ discard block |
||
| 13966 | 13965 | } else { |
| 13967 | 13966 | /** @noinspection OffsetOperationsInspection */ |
| 13968 | 13967 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
| 13969 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
| 13970 | - $buf .= $cc1 . $cc2; |
|
| 13968 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
| 13969 | + $buf .= $cc1.$cc2; |
|
| 13971 | 13970 | } |
| 13972 | 13971 | |
| 13973 | 13972 | return $buf; |
@@ -13986,7 +13985,7 @@ discard block |
||
| 13986 | 13985 | { |
| 13987 | 13986 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
| 13988 | 13987 | if (\preg_match($pattern, $str)) { |
| 13989 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
| 13988 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
| 13990 | 13989 | } |
| 13991 | 13990 | |
| 13992 | 13991 | return $str; |