@@ -247,10 +247,10 @@ discard block |
||
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | if ($encoding === 'UTF-8') { |
| 250 | - return (string) \mb_substr($str, $pos, 1); |
|
| 250 | + return (string)\mb_substr($str, $pos, 1); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
| 253 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | /** |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | public static function add_bom_to_string(string $str): string |
| 269 | 269 | { |
| 270 | 270 | if (!self::string_has_bom($str)) { |
| 271 | - $str = self::bom() . $str; |
|
| 271 | + $str = self::bom().$str; |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | return $str; |
@@ -303,8 +303,8 @@ discard block |
||
| 303 | 303 | $return = []; |
| 304 | 304 | foreach ($array as $key => &$value) { |
| 305 | 305 | $key = $case === \CASE_LOWER |
| 306 | - ? self::strtolower((string) $key, $encoding) |
|
| 307 | - : self::strtoupper((string) $key, $encoding); |
|
| 306 | + ? self::strtolower((string)$key, $encoding) |
|
| 307 | + : self::strtoupper((string)$key, $encoding); |
|
| 308 | 308 | |
| 309 | 309 | $return[$key] = $value; |
| 310 | 310 | } |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | return ''; |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
| 343 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
| 344 | 344 | $end_position = \mb_strpos($str, $end, $substr_index); |
| 345 | 345 | if ( |
| 346 | 346 | $end_position === false |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | return ''; |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
| 353 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | return ''; |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
| 363 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
| 364 | 364 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
| 365 | 365 | if ( |
| 366 | 366 | $end_position === false |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | return ''; |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - return (string) self::substr( |
|
| 373 | + return (string)self::substr( |
|
| 374 | 374 | $str, |
| 375 | 375 | $substr_index, |
| 376 | 376 | $end_position - $substr_index, |
@@ -448,10 +448,10 @@ discard block |
||
| 448 | 448 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
| 449 | 449 | { |
| 450 | 450 | if ($encoding === 'UTF-8') { |
| 451 | - return (string) \mb_substr($str, $index, 1); |
|
| 451 | + return (string)\mb_substr($str, $index, 1); |
|
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - return (string) self::substr($str, $index, 1, $encoding); |
|
| 454 | + return (string)self::substr($str, $index, 1, $encoding); |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | /** |
@@ -565,14 +565,14 @@ discard block |
||
| 565 | 565 | /** |
| 566 | 566 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 567 | 567 | */ |
| 568 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 568 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | if ($code_point <= 0) { |
| 572 | 572 | return null; |
| 573 | 573 | } |
| 574 | 574 | |
| 575 | - $cache_key = $code_point . '_' . $encoding; |
|
| 575 | + $cache_key = $code_point.'_'.$encoding; |
|
| 576 | 576 | if (isset($CHAR_CACHE[$cache_key])) { |
| 577 | 577 | return $CHAR_CACHE[$cache_key]; |
| 578 | 578 | } |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | self::$CHR = self::getData('chr'); |
| 619 | 619 | } |
| 620 | 620 | |
| 621 | - $code_point = (int) $code_point; |
|
| 621 | + $code_point = (int)$code_point; |
|
| 622 | 622 | if ($code_point <= 0x7F) { |
| 623 | 623 | /** |
| 624 | 624 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -628,22 +628,22 @@ discard block |
||
| 628 | 628 | /** |
| 629 | 629 | * @psalm-suppress PossiblyNullArrayAccess |
| 630 | 630 | */ |
| 631 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
| 631 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
| 632 | 632 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 633 | 633 | } elseif ($code_point <= 0xFFFF) { |
| 634 | 634 | /** |
| 635 | 635 | * @psalm-suppress PossiblyNullArrayAccess |
| 636 | 636 | */ |
| 637 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
| 638 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 637 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
| 638 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 639 | 639 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 640 | 640 | } else { |
| 641 | 641 | /** |
| 642 | 642 | * @psalm-suppress PossiblyNullArrayAccess |
| 643 | 643 | */ |
| 644 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
| 645 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 646 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 644 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
| 645 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
| 646 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 647 | 647 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 648 | 648 | } |
| 649 | 649 | |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | |
| 697 | 697 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
| 698 | 698 | return \array_map( |
| 699 | - static function (string $data): int { |
|
| 699 | + static function(string $data): int { |
|
| 700 | 700 | // "mb_" is available if overload is used, so use it ... |
| 701 | 701 | return \mb_strlen($data, 'CP850'); // 8-BIT |
| 702 | 702 | }, |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | $char = ''; |
| 778 | 778 | } |
| 779 | 779 | |
| 780 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
| 780 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
| 781 | 781 | } |
| 782 | 782 | |
| 783 | 783 | /** |
@@ -870,7 +870,7 @@ discard block |
||
| 870 | 870 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
| 871 | 871 | /x'; |
| 872 | 872 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
| 873 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
| 873 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
| 874 | 874 | |
| 875 | 875 | if ($replace_diamond_question_mark) { |
| 876 | 876 | $str = self::replace_diamond_question_mark($str); |
@@ -907,7 +907,7 @@ discard block |
||
| 907 | 907 | public static function cleanup($str): string |
| 908 | 908 | { |
| 909 | 909 | // init |
| 910 | - $str = (string) $str; |
|
| 910 | + $str = (string)$str; |
|
| 911 | 911 | |
| 912 | 912 | if ($str === '') { |
| 913 | 913 | return ''; |
@@ -1003,7 +1003,7 @@ discard block |
||
| 1003 | 1003 | { |
| 1004 | 1004 | if (self::$SUPPORT['mbstring'] === true) { |
| 1005 | 1005 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 1006 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 1006 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 1007 | 1007 | } |
| 1008 | 1008 | |
| 1009 | 1009 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -1102,9 +1102,9 @@ discard block |
||
| 1102 | 1102 | // - 0-9 (U+0061 - U+007A) |
| 1103 | 1103 | // - ISO 10646 characters U+00A1 and higher |
| 1104 | 1104 | // We strip out any character not in the above list. |
| 1105 | - $str = (string) \preg_replace('/[^\x{002D}\x{0030}-\x{0039}\x{0041}-\x{005A}\x{005F}\x{0061}-\x{007A}\x{00A1}-\x{FFFF}]/u', '', $str); |
|
| 1105 | + $str = (string)\preg_replace('/[^\x{002D}\x{0030}-\x{0039}\x{0041}-\x{005A}\x{005F}\x{0061}-\x{007A}\x{00A1}-\x{FFFF}]/u', '', $str); |
|
| 1106 | 1106 | // Identifiers cannot start with a digit, two hyphens, or a hyphen followed by a digit. |
| 1107 | - $str = (string) \preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
| 1107 | + $str = (string)\preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
| 1108 | 1108 | |
| 1109 | 1109 | return \trim($str, '-'); |
| 1110 | 1110 | } |
@@ -1120,7 +1120,7 @@ discard block |
||
| 1120 | 1120 | */ |
| 1121 | 1121 | public static function css_stripe_media_queries(string $str): string |
| 1122 | 1122 | { |
| 1123 | - return (string) \preg_replace( |
|
| 1123 | + return (string)\preg_replace( |
|
| 1124 | 1124 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
| 1125 | 1125 | '', |
| 1126 | 1126 | $str |
@@ -1151,7 +1151,7 @@ discard block |
||
| 1151 | 1151 | */ |
| 1152 | 1152 | public static function decimal_to_chr($int): string |
| 1153 | 1153 | { |
| 1154 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
| 1154 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
| 1155 | 1155 | } |
| 1156 | 1156 | |
| 1157 | 1157 | /** |
@@ -1201,7 +1201,7 @@ discard block |
||
| 1201 | 1201 | $flagOffset = 0x1F1E6; |
| 1202 | 1202 | $asciiOffset = 0x41; |
| 1203 | 1203 | |
| 1204 | - return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? '') . |
|
| 1204 | + return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? ''). |
|
| 1205 | 1205 | (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
| 1206 | 1206 | } |
| 1207 | 1207 | |
@@ -1224,16 +1224,16 @@ discard block |
||
| 1224 | 1224 | self::initEmojiData(); |
| 1225 | 1225 | |
| 1226 | 1226 | if ($use_reversible_string_mappings) { |
| 1227 | - return (string) \str_replace( |
|
| 1228 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1229 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1227 | + return (string)\str_replace( |
|
| 1228 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1229 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1230 | 1230 | $str |
| 1231 | 1231 | ); |
| 1232 | 1232 | } |
| 1233 | 1233 | |
| 1234 | - return (string) \str_replace( |
|
| 1235 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 1236 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1234 | + return (string)\str_replace( |
|
| 1235 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 1236 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1237 | 1237 | $str |
| 1238 | 1238 | ); |
| 1239 | 1239 | } |
@@ -1257,16 +1257,16 @@ discard block |
||
| 1257 | 1257 | self::initEmojiData(); |
| 1258 | 1258 | |
| 1259 | 1259 | if ($use_reversible_string_mappings) { |
| 1260 | - return (string) \str_replace( |
|
| 1261 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1262 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1260 | + return (string)\str_replace( |
|
| 1261 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1262 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1263 | 1263 | $str |
| 1264 | 1264 | ); |
| 1265 | 1265 | } |
| 1266 | 1266 | |
| 1267 | - return (string) \str_replace( |
|
| 1268 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1269 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 1267 | + return (string)\str_replace( |
|
| 1268 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1269 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 1270 | 1270 | $str |
| 1271 | 1271 | ); |
| 1272 | 1272 | } |
@@ -1322,7 +1322,7 @@ discard block |
||
| 1322 | 1322 | if ($to_encoding === 'JSON') { |
| 1323 | 1323 | $return = self::json_encode($str); |
| 1324 | 1324 | if ($return === false) { |
| 1325 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
| 1325 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
| 1326 | 1326 | } |
| 1327 | 1327 | |
| 1328 | 1328 | return $return; |
@@ -1412,7 +1412,7 @@ discard block |
||
| 1412 | 1412 | /** |
| 1413 | 1413 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 1414 | 1414 | */ |
| 1415 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
| 1415 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
| 1416 | 1416 | } |
| 1417 | 1417 | |
| 1418 | 1418 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1512,31 +1512,31 @@ discard block |
||
| 1512 | 1512 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
| 1513 | 1513 | |
| 1514 | 1514 | if ($length === null) { |
| 1515 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2); |
|
| 1515 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2); |
|
| 1516 | 1516 | } |
| 1517 | 1517 | |
| 1518 | 1518 | if ($search === '') { |
| 1519 | 1519 | if ($encoding === 'UTF-8') { |
| 1520 | 1520 | if ($length > 0) { |
| 1521 | - $string_length = (int) \mb_strlen($str); |
|
| 1521 | + $string_length = (int)\mb_strlen($str); |
|
| 1522 | 1522 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
| 1523 | 1523 | } else { |
| 1524 | 1524 | $end = 0; |
| 1525 | 1525 | } |
| 1526 | 1526 | |
| 1527 | - $pos = (int) \min( |
|
| 1527 | + $pos = (int)\min( |
|
| 1528 | 1528 | \mb_strpos($str, ' ', $end), |
| 1529 | 1529 | \mb_strpos($str, '.', $end) |
| 1530 | 1530 | ); |
| 1531 | 1531 | } else { |
| 1532 | 1532 | if ($length > 0) { |
| 1533 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 1533 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 1534 | 1534 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
| 1535 | 1535 | } else { |
| 1536 | 1536 | $end = 0; |
| 1537 | 1537 | } |
| 1538 | 1538 | |
| 1539 | - $pos = (int) \min( |
|
| 1539 | + $pos = (int)\min( |
|
| 1540 | 1540 | self::strpos($str, ' ', $end, $encoding), |
| 1541 | 1541 | self::strpos($str, '.', $end, $encoding) |
| 1542 | 1542 | ); |
@@ -1553,18 +1553,18 @@ discard block |
||
| 1553 | 1553 | return ''; |
| 1554 | 1554 | } |
| 1555 | 1555 | |
| 1556 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1556 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1557 | 1557 | } |
| 1558 | 1558 | |
| 1559 | 1559 | return $str; |
| 1560 | 1560 | } |
| 1561 | 1561 | |
| 1562 | 1562 | if ($encoding === 'UTF-8') { |
| 1563 | - $word_position = (int) \mb_stripos($str, $search); |
|
| 1564 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
| 1563 | + $word_position = (int)\mb_stripos($str, $search); |
|
| 1564 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
| 1565 | 1565 | } else { |
| 1566 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
| 1567 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
| 1566 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
| 1567 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
| 1568 | 1568 | } |
| 1569 | 1569 | |
| 1570 | 1570 | $pos_start = 0; |
@@ -1576,12 +1576,12 @@ discard block |
||
| 1576 | 1576 | } |
| 1577 | 1577 | if ($half_text !== false) { |
| 1578 | 1578 | if ($encoding === 'UTF-8') { |
| 1579 | - $pos_start = (int) \max( |
|
| 1579 | + $pos_start = (int)\max( |
|
| 1580 | 1580 | \mb_strrpos($half_text, ' '), |
| 1581 | 1581 | \mb_strrpos($half_text, '.') |
| 1582 | 1582 | ); |
| 1583 | 1583 | } else { |
| 1584 | - $pos_start = (int) \max( |
|
| 1584 | + $pos_start = (int)\max( |
|
| 1585 | 1585 | self::strrpos($half_text, ' ', 0, $encoding), |
| 1586 | 1586 | self::strrpos($half_text, '.', 0, $encoding) |
| 1587 | 1587 | ); |
@@ -1591,19 +1591,19 @@ discard block |
||
| 1591 | 1591 | |
| 1592 | 1592 | if ($word_position && $half_side > 0) { |
| 1593 | 1593 | $offset = $pos_start + $length - 1; |
| 1594 | - $real_length = (int) self::strlen($str, $encoding); |
|
| 1594 | + $real_length = (int)self::strlen($str, $encoding); |
|
| 1595 | 1595 | |
| 1596 | 1596 | if ($offset > $real_length) { |
| 1597 | 1597 | $offset = $real_length; |
| 1598 | 1598 | } |
| 1599 | 1599 | |
| 1600 | 1600 | if ($encoding === 'UTF-8') { |
| 1601 | - $pos_end = (int) \min( |
|
| 1601 | + $pos_end = (int)\min( |
|
| 1602 | 1602 | \mb_strpos($str, ' ', $offset), |
| 1603 | 1603 | \mb_strpos($str, '.', $offset) |
| 1604 | 1604 | ) - $pos_start; |
| 1605 | 1605 | } else { |
| 1606 | - $pos_end = (int) \min( |
|
| 1606 | + $pos_end = (int)\min( |
|
| 1607 | 1607 | self::strpos($str, ' ', $offset, $encoding), |
| 1608 | 1608 | self::strpos($str, '.', $offset, $encoding) |
| 1609 | 1609 | ) - $pos_start; |
@@ -1611,12 +1611,12 @@ discard block |
||
| 1611 | 1611 | |
| 1612 | 1612 | if (!$pos_end || $pos_end <= 0) { |
| 1613 | 1613 | if ($encoding === 'UTF-8') { |
| 1614 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
| 1614 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
| 1615 | 1615 | } else { |
| 1616 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
| 1616 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
| 1617 | 1617 | } |
| 1618 | 1618 | if ($str_sub !== false) { |
| 1619 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
| 1619 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
| 1620 | 1620 | } else { |
| 1621 | 1621 | $extract = ''; |
| 1622 | 1622 | } |
@@ -1627,26 +1627,26 @@ discard block |
||
| 1627 | 1627 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
| 1628 | 1628 | } |
| 1629 | 1629 | if ($str_sub !== false) { |
| 1630 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1630 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1631 | 1631 | } else { |
| 1632 | 1632 | $extract = ''; |
| 1633 | 1633 | } |
| 1634 | 1634 | } |
| 1635 | 1635 | } else { |
| 1636 | 1636 | $offset = $length - 1; |
| 1637 | - $true_length = (int) self::strlen($str, $encoding); |
|
| 1637 | + $true_length = (int)self::strlen($str, $encoding); |
|
| 1638 | 1638 | |
| 1639 | 1639 | if ($offset > $true_length) { |
| 1640 | 1640 | $offset = $true_length; |
| 1641 | 1641 | } |
| 1642 | 1642 | |
| 1643 | 1643 | if ($encoding === 'UTF-8') { |
| 1644 | - $pos_end = (int) \min( |
|
| 1644 | + $pos_end = (int)\min( |
|
| 1645 | 1645 | \mb_strpos($str, ' ', $offset), |
| 1646 | 1646 | \mb_strpos($str, '.', $offset) |
| 1647 | 1647 | ); |
| 1648 | 1648 | } else { |
| 1649 | - $pos_end = (int) \min( |
|
| 1649 | + $pos_end = (int)\min( |
|
| 1650 | 1650 | self::strpos($str, ' ', $offset, $encoding), |
| 1651 | 1651 | self::strpos($str, '.', $offset, $encoding) |
| 1652 | 1652 | ); |
@@ -1659,7 +1659,7 @@ discard block |
||
| 1659 | 1659 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
| 1660 | 1660 | } |
| 1661 | 1661 | if ($str_sub !== false) { |
| 1662 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1662 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1663 | 1663 | } else { |
| 1664 | 1664 | $extract = ''; |
| 1665 | 1665 | } |
@@ -1788,7 +1788,7 @@ discard block |
||
| 1788 | 1788 | { |
| 1789 | 1789 | $file_content = \file_get_contents($file_path); |
| 1790 | 1790 | if ($file_content === false) { |
| 1791 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
| 1791 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
| 1792 | 1792 | } |
| 1793 | 1793 | |
| 1794 | 1794 | return self::string_has_bom($file_content); |
@@ -1848,7 +1848,7 @@ discard block |
||
| 1848 | 1848 | ) { |
| 1849 | 1849 | // Prevent leading combining chars |
| 1850 | 1850 | // for NFC-safe concatenations. |
| 1851 | - $var = $leading_combining . $var; |
|
| 1851 | + $var = $leading_combining.$var; |
|
| 1852 | 1852 | } |
| 1853 | 1853 | } |
| 1854 | 1854 | |
@@ -2133,10 +2133,10 @@ discard block |
||
| 2133 | 2133 | } |
| 2134 | 2134 | |
| 2135 | 2135 | if ($encoding === 'UTF-8') { |
| 2136 | - return (string) \mb_substr($str, 0, $n); |
|
| 2136 | + return (string)\mb_substr($str, 0, $n); |
|
| 2137 | 2137 | } |
| 2138 | 2138 | |
| 2139 | - return (string) self::substr($str, 0, $n, $encoding); |
|
| 2139 | + return (string)self::substr($str, 0, $n, $encoding); |
|
| 2140 | 2140 | } |
| 2141 | 2141 | |
| 2142 | 2142 | /** |
@@ -2152,7 +2152,7 @@ discard block |
||
| 2152 | 2152 | */ |
| 2153 | 2153 | public static function fits_inside(string $str, int $box_size): bool |
| 2154 | 2154 | { |
| 2155 | - return (int) self::strlen($str) <= $box_size; |
|
| 2155 | + return (int)self::strlen($str) <= $box_size; |
|
| 2156 | 2156 | } |
| 2157 | 2157 | |
| 2158 | 2158 | /** |
@@ -2231,7 +2231,7 @@ discard block |
||
| 2231 | 2231 | return $str; |
| 2232 | 2232 | } |
| 2233 | 2233 | |
| 2234 | - $str = (string) $str; |
|
| 2234 | + $str = (string)$str; |
|
| 2235 | 2235 | $last = ''; |
| 2236 | 2236 | while ($last !== $str) { |
| 2237 | 2237 | $last = $str; |
@@ -2438,7 +2438,7 @@ discard block |
||
| 2438 | 2438 | return $fallback; |
| 2439 | 2439 | } |
| 2440 | 2440 | /** @noinspection OffsetOperationsInspection */ |
| 2441 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
| 2441 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
| 2442 | 2442 | |
| 2443 | 2443 | // DEBUG |
| 2444 | 2444 | //var_dump($type_code); |
@@ -2496,7 +2496,7 @@ discard block |
||
| 2496 | 2496 | // |
| 2497 | 2497 | |
| 2498 | 2498 | if ($encoding === 'UTF-8') { |
| 2499 | - $max_length = (int) \mb_strlen($possible_chars); |
|
| 2499 | + $max_length = (int)\mb_strlen($possible_chars); |
|
| 2500 | 2500 | if ($max_length === 0) { |
| 2501 | 2501 | return ''; |
| 2502 | 2502 | } |
@@ -2517,7 +2517,7 @@ discard block |
||
| 2517 | 2517 | } else { |
| 2518 | 2518 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 2519 | 2519 | |
| 2520 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
| 2520 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
| 2521 | 2521 | if ($max_length === 0) { |
| 2522 | 2522 | return ''; |
| 2523 | 2523 | } |
@@ -2555,16 +2555,16 @@ discard block |
||
| 2555 | 2555 | $rand_int = \mt_rand(0, \mt_getrandmax()); |
| 2556 | 2556 | } |
| 2557 | 2557 | |
| 2558 | - $unique_helper = $rand_int . |
|
| 2559 | - \session_id() . |
|
| 2560 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2561 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2558 | + $unique_helper = $rand_int. |
|
| 2559 | + \session_id(). |
|
| 2560 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
| 2561 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
| 2562 | 2562 | $extra_entropy; |
| 2563 | 2563 | |
| 2564 | 2564 | $unique_string = \uniqid($unique_helper, true); |
| 2565 | 2565 | |
| 2566 | 2566 | if ($use_md5) { |
| 2567 | - $unique_string = \md5($unique_string . $unique_helper); |
|
| 2567 | + $unique_string = \md5($unique_string.$unique_helper); |
|
| 2568 | 2568 | } |
| 2569 | 2569 | |
| 2570 | 2570 | return $unique_string; |
@@ -2676,7 +2676,7 @@ discard block |
||
| 2676 | 2676 | public static function hex_to_int($hexdec) |
| 2677 | 2677 | { |
| 2678 | 2678 | // init |
| 2679 | - $hexdec = (string) $hexdec; |
|
| 2679 | + $hexdec = (string)$hexdec; |
|
| 2680 | 2680 | |
| 2681 | 2681 | if ($hexdec === '') { |
| 2682 | 2682 | return false; |
@@ -2773,7 +2773,7 @@ discard block |
||
| 2773 | 2773 | return \implode( |
| 2774 | 2774 | '', |
| 2775 | 2775 | \array_map( |
| 2776 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
| 2776 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
| 2777 | 2777 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
| 2778 | 2778 | }, |
| 2779 | 2779 | self::str_split($str) |
@@ -2885,7 +2885,7 @@ discard block |
||
| 2885 | 2885 | /** |
| 2886 | 2886 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 2887 | 2887 | */ |
| 2888 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 2888 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 2889 | 2889 | } |
| 2890 | 2890 | |
| 2891 | 2891 | do { |
@@ -2894,7 +2894,7 @@ discard block |
||
| 2894 | 2894 | if (\strpos($str, '&') !== false) { |
| 2895 | 2895 | if (\strpos($str, '&#') !== false) { |
| 2896 | 2896 | // decode also numeric & UTF16 two byte entities |
| 2897 | - $str = (string) \preg_replace( |
|
| 2897 | + $str = (string)\preg_replace( |
|
| 2898 | 2898 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
| 2899 | 2899 | '$1;', |
| 2900 | 2900 | $str |
@@ -2944,7 +2944,7 @@ discard block |
||
| 2944 | 2944 | */ |
| 2945 | 2945 | public static function html_stripe_empty_tags(string $str): string |
| 2946 | 2946 | { |
| 2947 | - return (string) \preg_replace( |
|
| 2947 | + return (string)\preg_replace( |
|
| 2948 | 2948 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
| 2949 | 2949 | '', |
| 2950 | 2950 | $str |
@@ -3264,9 +3264,9 @@ discard block |
||
| 3264 | 3264 | { |
| 3265 | 3265 | $hex = \dechex($int); |
| 3266 | 3266 | |
| 3267 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
| 3267 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
| 3268 | 3268 | |
| 3269 | - return $prefix . $hex . ''; |
|
| 3269 | + return $prefix.$hex.''; |
|
| 3270 | 3270 | } |
| 3271 | 3271 | |
| 3272 | 3272 | /** |
@@ -3587,7 +3587,7 @@ discard block |
||
| 3587 | 3587 | */ |
| 3588 | 3588 | public static function is_binary($input, bool $strict = false): bool |
| 3589 | 3589 | { |
| 3590 | - $input = (string) $input; |
|
| 3590 | + $input = (string)$input; |
|
| 3591 | 3591 | if ($input === '') { |
| 3592 | 3592 | return false; |
| 3593 | 3593 | } |
@@ -3931,7 +3931,7 @@ discard block |
||
| 3931 | 3931 | public static function is_utf16($str, bool $check_if_string_is_binary = true) |
| 3932 | 3932 | { |
| 3933 | 3933 | // init |
| 3934 | - $str = (string) $str; |
|
| 3934 | + $str = (string)$str; |
|
| 3935 | 3935 | $str_chars = []; |
| 3936 | 3936 | |
| 3937 | 3937 | if ( |
@@ -4017,7 +4017,7 @@ discard block |
||
| 4017 | 4017 | public static function is_utf32($str, bool $check_if_string_is_binary = true) |
| 4018 | 4018 | { |
| 4019 | 4019 | // init |
| 4020 | - $str = (string) $str; |
|
| 4020 | + $str = (string)$str; |
|
| 4021 | 4021 | $str_chars = []; |
| 4022 | 4022 | |
| 4023 | 4023 | if ( |
@@ -4109,7 +4109,7 @@ discard block |
||
| 4109 | 4109 | return true; |
| 4110 | 4110 | } |
| 4111 | 4111 | |
| 4112 | - return self::is_utf8_string((string) $str, $strict); |
|
| 4112 | + return self::is_utf8_string((string)$str, $strict); |
|
| 4113 | 4113 | } |
| 4114 | 4114 | |
| 4115 | 4115 | /** |
@@ -4259,15 +4259,15 @@ discard block |
||
| 4259 | 4259 | $use_mb_functions = ($lang === null && !$try_to_keep_the_string_length); |
| 4260 | 4260 | |
| 4261 | 4261 | if ($encoding === 'UTF-8') { |
| 4262 | - $str_part_two = (string) \mb_substr($str, 1); |
|
| 4262 | + $str_part_two = (string)\mb_substr($str, 1); |
|
| 4263 | 4263 | |
| 4264 | 4264 | if ($use_mb_functions) { |
| 4265 | 4265 | $str_part_one = \mb_strtolower( |
| 4266 | - (string) \mb_substr($str, 0, 1) |
|
| 4266 | + (string)\mb_substr($str, 0, 1) |
|
| 4267 | 4267 | ); |
| 4268 | 4268 | } else { |
| 4269 | 4269 | $str_part_one = self::strtolower( |
| 4270 | - (string) \mb_substr($str, 0, 1), |
|
| 4270 | + (string)\mb_substr($str, 0, 1), |
|
| 4271 | 4271 | $encoding, |
| 4272 | 4272 | false, |
| 4273 | 4273 | $lang, |
@@ -4277,10 +4277,10 @@ discard block |
||
| 4277 | 4277 | } else { |
| 4278 | 4278 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4279 | 4279 | |
| 4280 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
| 4280 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
| 4281 | 4281 | |
| 4282 | 4282 | $str_part_one = self::strtolower( |
| 4283 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 4283 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 4284 | 4284 | $encoding, |
| 4285 | 4285 | false, |
| 4286 | 4286 | $lang, |
@@ -4288,7 +4288,7 @@ discard block |
||
| 4288 | 4288 | ); |
| 4289 | 4289 | } |
| 4290 | 4290 | |
| 4291 | - return $str_part_one . $str_part_two; |
|
| 4291 | + return $str_part_one.$str_part_two; |
|
| 4292 | 4292 | } |
| 4293 | 4293 | |
| 4294 | 4294 | /** |
@@ -4435,7 +4435,7 @@ discard block |
||
| 4435 | 4435 | } |
| 4436 | 4436 | |
| 4437 | 4437 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4438 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 4438 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 4439 | 4439 | } |
| 4440 | 4440 | |
| 4441 | 4441 | if ($chars) { |
@@ -4488,7 +4488,7 @@ discard block |
||
| 4488 | 4488 | { |
| 4489 | 4489 | $bytes = self::chr_size_list($str); |
| 4490 | 4490 | if ($bytes !== []) { |
| 4491 | - return (int) \max($bytes); |
|
| 4491 | + return (int)\max($bytes); |
|
| 4492 | 4492 | } |
| 4493 | 4493 | |
| 4494 | 4494 | return 0; |
@@ -4570,7 +4570,7 @@ discard block |
||
| 4570 | 4570 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
| 4571 | 4571 | |
| 4572 | 4572 | // init |
| 4573 | - $encoding = (string) $encoding; |
|
| 4573 | + $encoding = (string)$encoding; |
|
| 4574 | 4574 | |
| 4575 | 4575 | if (!$encoding) { |
| 4576 | 4576 | return $fallback; |
@@ -4632,7 +4632,7 @@ discard block |
||
| 4632 | 4632 | |
| 4633 | 4633 | $encoding_original = $encoding; |
| 4634 | 4634 | $encoding = \strtoupper($encoding); |
| 4635 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
| 4635 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
| 4636 | 4636 | |
| 4637 | 4637 | $equivalences = [ |
| 4638 | 4638 | 'ISO8859' => 'ISO-8859-1', |
@@ -4790,13 +4790,13 @@ discard block |
||
| 4790 | 4790 | static $CHAR_CACHE = []; |
| 4791 | 4791 | |
| 4792 | 4792 | // init |
| 4793 | - $chr = (string) $chr; |
|
| 4793 | + $chr = (string)$chr; |
|
| 4794 | 4794 | |
| 4795 | 4795 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
| 4796 | 4796 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4797 | 4797 | } |
| 4798 | 4798 | |
| 4799 | - $cache_key = $chr . '_' . $encoding; |
|
| 4799 | + $cache_key = $chr.'_'.$encoding; |
|
| 4800 | 4800 | if (isset($CHAR_CACHE[$cache_key])) { |
| 4801 | 4801 | return $CHAR_CACHE[$cache_key]; |
| 4802 | 4802 | } |
@@ -4831,7 +4831,7 @@ discard block |
||
| 4831 | 4831 | // |
| 4832 | 4832 | |
| 4833 | 4833 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 4834 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
| 4834 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
| 4835 | 4835 | /** @noinspection OffsetOperationsInspection */ |
| 4836 | 4836 | $code = $chr ? $chr[1] : 0; |
| 4837 | 4837 | |
@@ -4839,21 +4839,21 @@ discard block |
||
| 4839 | 4839 | if ($code >= 0xF0 && isset($chr[4])) { |
| 4840 | 4840 | /** @noinspection UnnecessaryCastingInspection */ |
| 4841 | 4841 | /** @noinspection OffsetOperationsInspection */ |
| 4842 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 4842 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 4843 | 4843 | } |
| 4844 | 4844 | |
| 4845 | 4845 | /** @noinspection OffsetOperationsInspection */ |
| 4846 | 4846 | if ($code >= 0xE0 && isset($chr[3])) { |
| 4847 | 4847 | /** @noinspection UnnecessaryCastingInspection */ |
| 4848 | 4848 | /** @noinspection OffsetOperationsInspection */ |
| 4849 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 4849 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 4850 | 4850 | } |
| 4851 | 4851 | |
| 4852 | 4852 | /** @noinspection OffsetOperationsInspection */ |
| 4853 | 4853 | if ($code >= 0xC0 && isset($chr[2])) { |
| 4854 | 4854 | /** @noinspection UnnecessaryCastingInspection */ |
| 4855 | 4855 | /** @noinspection OffsetOperationsInspection */ |
| 4856 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 4856 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 4857 | 4857 | } |
| 4858 | 4858 | |
| 4859 | 4859 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -4910,7 +4910,7 @@ discard block |
||
| 4910 | 4910 | public static function pcre_utf8_support(): bool |
| 4911 | 4911 | { |
| 4912 | 4912 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 4913 | - return (bool) @\preg_match('//u', ''); |
|
| 4913 | + return (bool)@\preg_match('//u', ''); |
|
| 4914 | 4914 | } |
| 4915 | 4915 | |
| 4916 | 4916 | /** |
@@ -4949,14 +4949,14 @@ discard block |
||
| 4949 | 4949 | * @psalm-suppress DocblockTypeContradiction |
| 4950 | 4950 | */ |
| 4951 | 4951 | if (!\is_numeric($step)) { |
| 4952 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
| 4952 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
| 4953 | 4953 | } |
| 4954 | 4954 | |
| 4955 | 4955 | /** |
| 4956 | 4956 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
| 4957 | 4957 | */ |
| 4958 | 4958 | if ($step <= 0) { |
| 4959 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
| 4959 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
| 4960 | 4960 | } |
| 4961 | 4961 | } |
| 4962 | 4962 | |
@@ -4968,14 +4968,14 @@ discard block |
||
| 4968 | 4968 | $is_xdigit = false; |
| 4969 | 4969 | |
| 4970 | 4970 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4971 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
| 4971 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
| 4972 | 4972 | $is_digit = true; |
| 4973 | - $start = (int) $var1; |
|
| 4973 | + $start = (int)$var1; |
|
| 4974 | 4974 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
| 4975 | 4975 | $is_xdigit = true; |
| 4976 | - $start = (int) self::hex_to_int($var1); |
|
| 4976 | + $start = (int)self::hex_to_int($var1); |
|
| 4977 | 4977 | } elseif (!$use_ctype && \is_numeric($var1)) { |
| 4978 | - $start = (int) $var1; |
|
| 4978 | + $start = (int)$var1; |
|
| 4979 | 4979 | } else { |
| 4980 | 4980 | $start = self::ord($var1); |
| 4981 | 4981 | } |
@@ -4985,11 +4985,11 @@ discard block |
||
| 4985 | 4985 | } |
| 4986 | 4986 | |
| 4987 | 4987 | if ($is_digit) { |
| 4988 | - $end = (int) $var2; |
|
| 4988 | + $end = (int)$var2; |
|
| 4989 | 4989 | } elseif ($is_xdigit) { |
| 4990 | - $end = (int) self::hex_to_int($var2); |
|
| 4990 | + $end = (int)self::hex_to_int($var2); |
|
| 4991 | 4991 | } elseif (!$use_ctype && \is_numeric($var2)) { |
| 4992 | - $end = (int) $var2; |
|
| 4992 | + $end = (int)$var2; |
|
| 4993 | 4993 | } else { |
| 4994 | 4994 | $end = self::ord($var2); |
| 4995 | 4995 | } |
@@ -5000,7 +5000,7 @@ discard block |
||
| 5000 | 5000 | |
| 5001 | 5001 | $array = []; |
| 5002 | 5002 | foreach (\range($start, $end, $step) as $i) { |
| 5003 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
| 5003 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
| 5004 | 5004 | } |
| 5005 | 5005 | |
| 5006 | 5006 | return $array; |
@@ -5110,8 +5110,8 @@ discard block |
||
| 5110 | 5110 | $delimiter = '/'; |
| 5111 | 5111 | } |
| 5112 | 5112 | |
| 5113 | - return (string) \preg_replace( |
|
| 5114 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
| 5113 | + return (string)\preg_replace( |
|
| 5114 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
| 5115 | 5115 | $replacement, |
| 5116 | 5116 | $str |
| 5117 | 5117 | ); |
@@ -5159,9 +5159,9 @@ discard block |
||
| 5159 | 5159 | return ''; |
| 5160 | 5160 | } |
| 5161 | 5161 | |
| 5162 | - $str_length -= (int) $bom_byte_length; |
|
| 5162 | + $str_length -= (int)$bom_byte_length; |
|
| 5163 | 5163 | |
| 5164 | - $str = (string) $str_tmp; |
|
| 5164 | + $str = (string)$str_tmp; |
|
| 5165 | 5165 | } |
| 5166 | 5166 | } |
| 5167 | 5167 | |
@@ -5190,7 +5190,7 @@ discard block |
||
| 5190 | 5190 | */ |
| 5191 | 5191 | if (\is_array($what)) { |
| 5192 | 5192 | foreach ($what as $item) { |
| 5193 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
| 5193 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
| 5194 | 5194 | } |
| 5195 | 5195 | } |
| 5196 | 5196 | |
@@ -5228,7 +5228,7 @@ discard block |
||
| 5228 | 5228 | */ |
| 5229 | 5229 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
| 5230 | 5230 | { |
| 5231 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 5231 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 5232 | 5232 | } |
| 5233 | 5233 | |
| 5234 | 5234 | /** |
@@ -5283,17 +5283,17 @@ discard block |
||
| 5283 | 5283 | ): string { |
| 5284 | 5284 | if ($substring && \strpos($str, $substring) === 0) { |
| 5285 | 5285 | if ($encoding === 'UTF-8') { |
| 5286 | - return (string) \mb_substr( |
|
| 5286 | + return (string)\mb_substr( |
|
| 5287 | 5287 | $str, |
| 5288 | - (int) \mb_strlen($substring) |
|
| 5288 | + (int)\mb_strlen($substring) |
|
| 5289 | 5289 | ); |
| 5290 | 5290 | } |
| 5291 | 5291 | |
| 5292 | 5292 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5293 | 5293 | |
| 5294 | - return (string) self::substr( |
|
| 5294 | + return (string)self::substr( |
|
| 5295 | 5295 | $str, |
| 5296 | - (int) self::strlen($substring, $encoding), |
|
| 5296 | + (int)self::strlen($substring, $encoding), |
|
| 5297 | 5297 | null, |
| 5298 | 5298 | $encoding |
| 5299 | 5299 | ); |
@@ -5321,19 +5321,19 @@ discard block |
||
| 5321 | 5321 | ): string { |
| 5322 | 5322 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
| 5323 | 5323 | if ($encoding === 'UTF-8') { |
| 5324 | - return (string) \mb_substr( |
|
| 5324 | + return (string)\mb_substr( |
|
| 5325 | 5325 | $str, |
| 5326 | 5326 | 0, |
| 5327 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
| 5327 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
| 5328 | 5328 | ); |
| 5329 | 5329 | } |
| 5330 | 5330 | |
| 5331 | 5331 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5332 | 5332 | |
| 5333 | - return (string) self::substr( |
|
| 5333 | + return (string)self::substr( |
|
| 5334 | 5334 | $str, |
| 5335 | 5335 | 0, |
| 5336 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
| 5336 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
| 5337 | 5337 | $encoding |
| 5338 | 5338 | ); |
| 5339 | 5339 | } |
@@ -5433,7 +5433,7 @@ discard block |
||
| 5433 | 5433 | /** @noinspection PhpUsageOfSilenceOperatorInspection - ignore "Unknown character" warnings, it's working anyway */ |
| 5434 | 5434 | @\mb_substitute_character($replacement_char_helper); |
| 5435 | 5435 | // the polyfill maybe return false, so cast to string |
| 5436 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 5436 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 5437 | 5437 | \mb_substitute_character($save); |
| 5438 | 5438 | } |
| 5439 | 5439 | |
@@ -5477,7 +5477,7 @@ discard block |
||
| 5477 | 5477 | } |
| 5478 | 5478 | |
| 5479 | 5479 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5480 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 5480 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 5481 | 5481 | } |
| 5482 | 5482 | |
| 5483 | 5483 | if ($chars) { |
@@ -5507,7 +5507,7 @@ discard block |
||
| 5507 | 5507 | $html .= '<pre>'; |
| 5508 | 5508 | /** @noinspection AlterInForeachInspection */ |
| 5509 | 5509 | foreach (self::$SUPPORT as $key => &$value) { |
| 5510 | - $html .= $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
| 5510 | + $html .= $key.' - '.\print_r($value, true)."\n<br>"; |
|
| 5511 | 5511 | } |
| 5512 | 5512 | $html .= '</pre>'; |
| 5513 | 5513 | |
@@ -5547,7 +5547,7 @@ discard block |
||
| 5547 | 5547 | return $char; |
| 5548 | 5548 | } |
| 5549 | 5549 | |
| 5550 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
| 5550 | + return '&#'.self::ord($char, $encoding).';'; |
|
| 5551 | 5551 | } |
| 5552 | 5552 | |
| 5553 | 5553 | /** |
@@ -5651,11 +5651,11 @@ discard block |
||
| 5651 | 5651 | $lang, |
| 5652 | 5652 | $try_to_keep_the_string_length |
| 5653 | 5653 | ); |
| 5654 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
| 5654 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
| 5655 | 5655 | |
| 5656 | 5656 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 5657 | 5657 | |
| 5658 | - $str = (string) \preg_replace_callback( |
|
| 5658 | + $str = (string)\preg_replace_callback( |
|
| 5659 | 5659 | '/[-_\\s]+(.)?/u', |
| 5660 | 5660 | /** |
| 5661 | 5661 | * @param array $match |
@@ -5664,7 +5664,7 @@ discard block |
||
| 5664 | 5664 | * |
| 5665 | 5665 | * @return string |
| 5666 | 5666 | */ |
| 5667 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
| 5667 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
| 5668 | 5668 | if (isset($match[1])) { |
| 5669 | 5669 | if ($use_mb_functions) { |
| 5670 | 5670 | if ($encoding === 'UTF-8') { |
@@ -5682,7 +5682,7 @@ discard block |
||
| 5682 | 5682 | $str |
| 5683 | 5683 | ); |
| 5684 | 5684 | |
| 5685 | - return (string) \preg_replace_callback( |
|
| 5685 | + return (string)\preg_replace_callback( |
|
| 5686 | 5686 | '/[\\p{N}]+(.)?/u', |
| 5687 | 5687 | /** |
| 5688 | 5688 | * @param array $match |
@@ -5691,7 +5691,7 @@ discard block |
||
| 5691 | 5691 | * |
| 5692 | 5692 | * @return string |
| 5693 | 5693 | */ |
| 5694 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
| 5694 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
| 5695 | 5695 | if ($use_mb_functions) { |
| 5696 | 5696 | if ($encoding === 'UTF-8') { |
| 5697 | 5697 | return \mb_strtoupper($match[0]); |
@@ -5883,7 +5883,7 @@ discard block |
||
| 5883 | 5883 | ): string { |
| 5884 | 5884 | if (self::$SUPPORT['mbstring'] === true) { |
| 5885 | 5885 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5886 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
| 5886 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
| 5887 | 5887 | |
| 5888 | 5888 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 5889 | 5889 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -5893,10 +5893,10 @@ discard block |
||
| 5893 | 5893 | } |
| 5894 | 5894 | |
| 5895 | 5895 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5896 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
| 5896 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
| 5897 | 5897 | } |
| 5898 | 5898 | |
| 5899 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
| 5899 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
| 5900 | 5900 | |
| 5901 | 5901 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 5902 | 5902 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -5905,7 +5905,7 @@ discard block |
||
| 5905 | 5905 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
| 5906 | 5906 | } |
| 5907 | 5907 | |
| 5908 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
| 5908 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
| 5909 | 5909 | } |
| 5910 | 5910 | |
| 5911 | 5911 | /** |
@@ -5922,7 +5922,7 @@ discard block |
||
| 5922 | 5922 | public static function str_detect_encoding($str) |
| 5923 | 5923 | { |
| 5924 | 5924 | // init |
| 5925 | - $str = (string) $str; |
|
| 5925 | + $str = (string)$str; |
|
| 5926 | 5926 | |
| 5927 | 5927 | // |
| 5928 | 5928 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -6024,7 +6024,7 @@ discard block |
||
| 6024 | 6024 | foreach (self::$ENCODINGS as $encoding_tmp) { |
| 6025 | 6025 | // INFO: //IGNORE but still throw notice |
| 6026 | 6026 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 6027 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
| 6027 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
| 6028 | 6028 | return $encoding_tmp; |
| 6029 | 6029 | } |
| 6030 | 6030 | } |
@@ -6121,7 +6121,7 @@ discard block |
||
| 6121 | 6121 | return $str; |
| 6122 | 6122 | } |
| 6123 | 6123 | |
| 6124 | - return $substring . $str; |
|
| 6124 | + return $substring.$str; |
|
| 6125 | 6125 | } |
| 6126 | 6126 | |
| 6127 | 6127 | /** |
@@ -6412,27 +6412,27 @@ discard block |
||
| 6412 | 6412 | string $encoding = 'UTF-8' |
| 6413 | 6413 | ): string { |
| 6414 | 6414 | if ($encoding === 'UTF-8') { |
| 6415 | - $len = (int) \mb_strlen($str); |
|
| 6415 | + $len = (int)\mb_strlen($str); |
|
| 6416 | 6416 | if ($index > $len) { |
| 6417 | 6417 | return $str; |
| 6418 | 6418 | } |
| 6419 | 6419 | |
| 6420 | 6420 | /** @noinspection UnnecessaryCastingInspection */ |
| 6421 | - return (string) \mb_substr($str, 0, $index) . |
|
| 6422 | - $substring . |
|
| 6423 | - (string) \mb_substr($str, $index, $len); |
|
| 6421 | + return (string)\mb_substr($str, 0, $index). |
|
| 6422 | + $substring. |
|
| 6423 | + (string)\mb_substr($str, $index, $len); |
|
| 6424 | 6424 | } |
| 6425 | 6425 | |
| 6426 | 6426 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6427 | 6427 | |
| 6428 | - $len = (int) self::strlen($str, $encoding); |
|
| 6428 | + $len = (int)self::strlen($str, $encoding); |
|
| 6429 | 6429 | if ($index > $len) { |
| 6430 | 6430 | return $str; |
| 6431 | 6431 | } |
| 6432 | 6432 | |
| 6433 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
| 6434 | - $substring . |
|
| 6435 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
| 6433 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
| 6434 | + $substring. |
|
| 6435 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
| 6436 | 6436 | } |
| 6437 | 6437 | |
| 6438 | 6438 | /** |
@@ -6463,15 +6463,15 @@ discard block |
||
| 6463 | 6463 | */ |
| 6464 | 6464 | public static function str_ireplace($search, $replacement, $subject, &$count = null) |
| 6465 | 6465 | { |
| 6466 | - $search = (array) $search; |
|
| 6466 | + $search = (array)$search; |
|
| 6467 | 6467 | |
| 6468 | 6468 | /** @noinspection AlterInForeachInspection */ |
| 6469 | 6469 | foreach ($search as &$s) { |
| 6470 | - $s = (string) $s; |
|
| 6470 | + $s = (string)$s; |
|
| 6471 | 6471 | if ($s === '') { |
| 6472 | 6472 | $s = '/^(?<=.)$/'; |
| 6473 | 6473 | } else { |
| 6474 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
| 6474 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
| 6475 | 6475 | } |
| 6476 | 6476 | } |
| 6477 | 6477 | |
@@ -6507,11 +6507,11 @@ discard block |
||
| 6507 | 6507 | } |
| 6508 | 6508 | |
| 6509 | 6509 | if ($search === '') { |
| 6510 | - return $str . $replacement; |
|
| 6510 | + return $str.$replacement; |
|
| 6511 | 6511 | } |
| 6512 | 6512 | |
| 6513 | 6513 | if (\stripos($str, $search) === 0) { |
| 6514 | - return $replacement . \substr($str, \strlen($search)); |
|
| 6514 | + return $replacement.\substr($str, \strlen($search)); |
|
| 6515 | 6515 | } |
| 6516 | 6516 | |
| 6517 | 6517 | return $str; |
@@ -6542,11 +6542,11 @@ discard block |
||
| 6542 | 6542 | } |
| 6543 | 6543 | |
| 6544 | 6544 | if ($search === '') { |
| 6545 | - return $str . $replacement; |
|
| 6545 | + return $str.$replacement; |
|
| 6546 | 6546 | } |
| 6547 | 6547 | |
| 6548 | 6548 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 6549 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 6549 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 6550 | 6550 | } |
| 6551 | 6551 | |
| 6552 | 6552 | return $str; |
@@ -6632,15 +6632,15 @@ discard block |
||
| 6632 | 6632 | } |
| 6633 | 6633 | |
| 6634 | 6634 | if ($encoding === 'UTF-8') { |
| 6635 | - return (string) \mb_substr( |
|
| 6635 | + return (string)\mb_substr( |
|
| 6636 | 6636 | $str, |
| 6637 | - $offset + (int) \mb_strlen($separator) |
|
| 6637 | + $offset + (int)\mb_strlen($separator) |
|
| 6638 | 6638 | ); |
| 6639 | 6639 | } |
| 6640 | 6640 | |
| 6641 | - return (string) self::substr( |
|
| 6641 | + return (string)self::substr( |
|
| 6642 | 6642 | $str, |
| 6643 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6643 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6644 | 6644 | null, |
| 6645 | 6645 | $encoding |
| 6646 | 6646 | ); |
@@ -6672,15 +6672,15 @@ discard block |
||
| 6672 | 6672 | } |
| 6673 | 6673 | |
| 6674 | 6674 | if ($encoding === 'UTF-8') { |
| 6675 | - return (string) \mb_substr( |
|
| 6675 | + return (string)\mb_substr( |
|
| 6676 | 6676 | $str, |
| 6677 | - $offset + (int) self::strlen($separator) |
|
| 6677 | + $offset + (int)self::strlen($separator) |
|
| 6678 | 6678 | ); |
| 6679 | 6679 | } |
| 6680 | 6680 | |
| 6681 | - return (string) self::substr( |
|
| 6681 | + return (string)self::substr( |
|
| 6682 | 6682 | $str, |
| 6683 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6683 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6684 | 6684 | null, |
| 6685 | 6685 | $encoding |
| 6686 | 6686 | ); |
@@ -6712,10 +6712,10 @@ discard block |
||
| 6712 | 6712 | } |
| 6713 | 6713 | |
| 6714 | 6714 | if ($encoding === 'UTF-8') { |
| 6715 | - return (string) \mb_substr($str, 0, $offset); |
|
| 6715 | + return (string)\mb_substr($str, 0, $offset); |
|
| 6716 | 6716 | } |
| 6717 | 6717 | |
| 6718 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 6718 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 6719 | 6719 | } |
| 6720 | 6720 | |
| 6721 | 6721 | /** |
@@ -6744,7 +6744,7 @@ discard block |
||
| 6744 | 6744 | return ''; |
| 6745 | 6745 | } |
| 6746 | 6746 | |
| 6747 | - return (string) \mb_substr($str, 0, $offset); |
|
| 6747 | + return (string)\mb_substr($str, 0, $offset); |
|
| 6748 | 6748 | } |
| 6749 | 6749 | |
| 6750 | 6750 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6752,7 +6752,7 @@ discard block |
||
| 6752 | 6752 | return ''; |
| 6753 | 6753 | } |
| 6754 | 6754 | |
| 6755 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 6755 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 6756 | 6756 | } |
| 6757 | 6757 | |
| 6758 | 6758 | /** |
@@ -6854,12 +6854,12 @@ discard block |
||
| 6854 | 6854 | } |
| 6855 | 6855 | |
| 6856 | 6856 | if ($encoding === 'UTF-8') { |
| 6857 | - return (string) \mb_substr($str, -$n); |
|
| 6857 | + return (string)\mb_substr($str, -$n); |
|
| 6858 | 6858 | } |
| 6859 | 6859 | |
| 6860 | 6860 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6861 | 6861 | |
| 6862 | - return (string) self::substr($str, -$n, null, $encoding); |
|
| 6862 | + return (string)self::substr($str, -$n, null, $encoding); |
|
| 6863 | 6863 | } |
| 6864 | 6864 | |
| 6865 | 6865 | /** |
@@ -6885,21 +6885,21 @@ discard block |
||
| 6885 | 6885 | } |
| 6886 | 6886 | |
| 6887 | 6887 | if ($encoding === 'UTF-8') { |
| 6888 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 6888 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 6889 | 6889 | return $str; |
| 6890 | 6890 | } |
| 6891 | 6891 | |
| 6892 | 6892 | /** @noinspection UnnecessaryCastingInspection */ |
| 6893 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
| 6893 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
| 6894 | 6894 | } |
| 6895 | 6895 | |
| 6896 | 6896 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6897 | 6897 | |
| 6898 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 6898 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 6899 | 6899 | return $str; |
| 6900 | 6900 | } |
| 6901 | 6901 | |
| 6902 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
| 6902 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
| 6903 | 6903 | } |
| 6904 | 6904 | |
| 6905 | 6905 | /** |
@@ -6926,12 +6926,12 @@ discard block |
||
| 6926 | 6926 | |
| 6927 | 6927 | if ($encoding === 'UTF-8') { |
| 6928 | 6928 | /** @noinspection UnnecessaryCastingInspection */ |
| 6929 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 6929 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 6930 | 6930 | return $str; |
| 6931 | 6931 | } |
| 6932 | 6932 | |
| 6933 | 6933 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
| 6934 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
| 6934 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
| 6935 | 6935 | } |
| 6936 | 6936 | |
| 6937 | 6937 | $str = \mb_substr($str, 0, $length); |
@@ -6940,33 +6940,33 @@ discard block |
||
| 6940 | 6940 | $new_str = \implode(' ', $array); |
| 6941 | 6941 | |
| 6942 | 6942 | if ($new_str === '') { |
| 6943 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
| 6943 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
| 6944 | 6944 | } |
| 6945 | 6945 | } else { |
| 6946 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 6946 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 6947 | 6947 | return $str; |
| 6948 | 6948 | } |
| 6949 | 6949 | |
| 6950 | 6950 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
| 6951 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
| 6951 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
| 6952 | 6952 | } |
| 6953 | 6953 | |
| 6954 | 6954 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 6955 | 6955 | $str = self::substr($str, 0, $length, $encoding); |
| 6956 | 6956 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 6957 | 6957 | if ($str === false) { |
| 6958 | - return '' . $str_add_on; |
|
| 6958 | + return ''.$str_add_on; |
|
| 6959 | 6959 | } |
| 6960 | 6960 | |
| 6961 | 6961 | $array = \explode(' ', $str, -1); |
| 6962 | 6962 | $new_str = \implode(' ', $array); |
| 6963 | 6963 | |
| 6964 | 6964 | if ($new_str === '') { |
| 6965 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
| 6965 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
| 6966 | 6966 | } |
| 6967 | 6967 | } |
| 6968 | 6968 | |
| 6969 | - return $new_str . $str_add_on; |
|
| 6969 | + return $new_str.$str_add_on; |
|
| 6970 | 6970 | } |
| 6971 | 6971 | |
| 6972 | 6972 | /** |
@@ -6989,7 +6989,7 @@ discard block |
||
| 6989 | 6989 | $longest_common_prefix = ''; |
| 6990 | 6990 | |
| 6991 | 6991 | if ($encoding === 'UTF-8') { |
| 6992 | - $max_length = (int) \min( |
|
| 6992 | + $max_length = (int)\min( |
|
| 6993 | 6993 | \mb_strlen($str1), |
| 6994 | 6994 | \mb_strlen($str2) |
| 6995 | 6995 | ); |
@@ -7010,7 +7010,7 @@ discard block |
||
| 7010 | 7010 | } else { |
| 7011 | 7011 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7012 | 7012 | |
| 7013 | - $max_length = (int) \min( |
|
| 7013 | + $max_length = (int)\min( |
|
| 7014 | 7014 | self::strlen($str1, $encoding), |
| 7015 | 7015 | self::strlen($str2, $encoding) |
| 7016 | 7016 | ); |
@@ -7059,13 +7059,13 @@ discard block |
||
| 7059 | 7059 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
| 7060 | 7060 | |
| 7061 | 7061 | if ($encoding === 'UTF-8') { |
| 7062 | - $str_length = (int) \mb_strlen($str1); |
|
| 7063 | - $other_length = (int) \mb_strlen($str2); |
|
| 7062 | + $str_length = (int)\mb_strlen($str1); |
|
| 7063 | + $other_length = (int)\mb_strlen($str2); |
|
| 7064 | 7064 | } else { |
| 7065 | 7065 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7066 | 7066 | |
| 7067 | - $str_length = (int) self::strlen($str1, $encoding); |
|
| 7068 | - $other_length = (int) self::strlen($str2, $encoding); |
|
| 7067 | + $str_length = (int)self::strlen($str1, $encoding); |
|
| 7068 | + $other_length = (int)self::strlen($str2, $encoding); |
|
| 7069 | 7069 | } |
| 7070 | 7070 | |
| 7071 | 7071 | // Return if either string is empty |
@@ -7118,10 +7118,10 @@ discard block |
||
| 7118 | 7118 | } |
| 7119 | 7119 | |
| 7120 | 7120 | if ($encoding === 'UTF-8') { |
| 7121 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
| 7121 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
| 7122 | 7122 | } |
| 7123 | 7123 | |
| 7124 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
| 7124 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
| 7125 | 7125 | } |
| 7126 | 7126 | |
| 7127 | 7127 | /** |
@@ -7145,7 +7145,7 @@ discard block |
||
| 7145 | 7145 | } |
| 7146 | 7146 | |
| 7147 | 7147 | if ($encoding === 'UTF-8') { |
| 7148 | - $max_length = (int) \min( |
|
| 7148 | + $max_length = (int)\min( |
|
| 7149 | 7149 | \mb_strlen($str1, $encoding), |
| 7150 | 7150 | \mb_strlen($str2, $encoding) |
| 7151 | 7151 | ); |
@@ -7159,7 +7159,7 @@ discard block |
||
| 7159 | 7159 | && |
| 7160 | 7160 | $char === \mb_substr($str2, -$i, 1) |
| 7161 | 7161 | ) { |
| 7162 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
| 7162 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
| 7163 | 7163 | } else { |
| 7164 | 7164 | break; |
| 7165 | 7165 | } |
@@ -7167,7 +7167,7 @@ discard block |
||
| 7167 | 7167 | } else { |
| 7168 | 7168 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7169 | 7169 | |
| 7170 | - $max_length = (int) \min( |
|
| 7170 | + $max_length = (int)\min( |
|
| 7171 | 7171 | self::strlen($str1, $encoding), |
| 7172 | 7172 | self::strlen($str2, $encoding) |
| 7173 | 7173 | ); |
@@ -7181,7 +7181,7 @@ discard block |
||
| 7181 | 7181 | && |
| 7182 | 7182 | $char === self::substr($str2, -$i, 1, $encoding) |
| 7183 | 7183 | ) { |
| 7184 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
| 7184 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
| 7185 | 7185 | } else { |
| 7186 | 7186 | break; |
| 7187 | 7187 | } |
@@ -7203,7 +7203,7 @@ discard block |
||
| 7203 | 7203 | */ |
| 7204 | 7204 | public static function str_matches_pattern(string $str, string $pattern): bool |
| 7205 | 7205 | { |
| 7206 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
| 7206 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
| 7207 | 7207 | } |
| 7208 | 7208 | |
| 7209 | 7209 | /** |
@@ -7222,7 +7222,7 @@ discard block |
||
| 7222 | 7222 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
| 7223 | 7223 | { |
| 7224 | 7224 | // init |
| 7225 | - $length = (int) self::strlen($str, $encoding); |
|
| 7225 | + $length = (int)self::strlen($str, $encoding); |
|
| 7226 | 7226 | |
| 7227 | 7227 | if ($offset >= 0) { |
| 7228 | 7228 | return $length > $offset; |
@@ -7251,7 +7251,7 @@ discard block |
||
| 7251 | 7251 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
| 7252 | 7252 | { |
| 7253 | 7253 | // init |
| 7254 | - $length = (int) self::strlen($str); |
|
| 7254 | + $length = (int)self::strlen($str); |
|
| 7255 | 7255 | |
| 7256 | 7256 | if ( |
| 7257 | 7257 | ($index >= 0 && $length <= $index) |
@@ -7293,7 +7293,7 @@ discard block |
||
| 7293 | 7293 | return $str; |
| 7294 | 7294 | } |
| 7295 | 7295 | |
| 7296 | - if ($pad_type !== (int) $pad_type) { |
|
| 7296 | + if ($pad_type !== (int)$pad_type) { |
|
| 7297 | 7297 | if ($pad_type === 'left') { |
| 7298 | 7298 | $pad_type = \STR_PAD_LEFT; |
| 7299 | 7299 | } elseif ($pad_type === 'right') { |
@@ -7302,23 +7302,23 @@ discard block |
||
| 7302 | 7302 | $pad_type = \STR_PAD_BOTH; |
| 7303 | 7303 | } else { |
| 7304 | 7304 | throw new \InvalidArgumentException( |
| 7305 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
| 7305 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
| 7306 | 7306 | ); |
| 7307 | 7307 | } |
| 7308 | 7308 | } |
| 7309 | 7309 | |
| 7310 | 7310 | if ($encoding === 'UTF-8') { |
| 7311 | - $str_length = (int) \mb_strlen($str); |
|
| 7311 | + $str_length = (int)\mb_strlen($str); |
|
| 7312 | 7312 | |
| 7313 | 7313 | if ($pad_length >= $str_length) { |
| 7314 | 7314 | switch ($pad_type) { |
| 7315 | 7315 | case \STR_PAD_LEFT: |
| 7316 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 7316 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 7317 | 7317 | |
| 7318 | 7318 | $diff = ($pad_length - $str_length); |
| 7319 | 7319 | |
| 7320 | - $pre = (string) \mb_substr( |
|
| 7321 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7320 | + $pre = (string)\mb_substr( |
|
| 7321 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7322 | 7322 | 0, |
| 7323 | 7323 | $diff |
| 7324 | 7324 | ); |
@@ -7329,16 +7329,16 @@ discard block |
||
| 7329 | 7329 | case \STR_PAD_BOTH: |
| 7330 | 7330 | $diff = ($pad_length - $str_length); |
| 7331 | 7331 | |
| 7332 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 7332 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 7333 | 7333 | |
| 7334 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 7334 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 7335 | 7335 | |
| 7336 | - $pre = (string) \mb_substr( |
|
| 7336 | + $pre = (string)\mb_substr( |
|
| 7337 | 7337 | \str_repeat($pad_string, $ps_length_left), |
| 7338 | 7338 | 0, |
| 7339 | 7339 | $ps_length_left |
| 7340 | 7340 | ); |
| 7341 | - $post = (string) \mb_substr( |
|
| 7341 | + $post = (string)\mb_substr( |
|
| 7342 | 7342 | \str_repeat($pad_string, $ps_length_right), |
| 7343 | 7343 | 0, |
| 7344 | 7344 | $ps_length_right |
@@ -7348,19 +7348,19 @@ discard block |
||
| 7348 | 7348 | |
| 7349 | 7349 | case \STR_PAD_RIGHT: |
| 7350 | 7350 | default: |
| 7351 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 7351 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 7352 | 7352 | |
| 7353 | 7353 | $diff = ($pad_length - $str_length); |
| 7354 | 7354 | |
| 7355 | - $post = (string) \mb_substr( |
|
| 7356 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7355 | + $post = (string)\mb_substr( |
|
| 7356 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7357 | 7357 | 0, |
| 7358 | 7358 | $diff |
| 7359 | 7359 | ); |
| 7360 | 7360 | $pre = ''; |
| 7361 | 7361 | } |
| 7362 | 7362 | |
| 7363 | - return $pre . $str . $post; |
|
| 7363 | + return $pre.$str.$post; |
|
| 7364 | 7364 | } |
| 7365 | 7365 | |
| 7366 | 7366 | return $str; |
@@ -7368,17 +7368,17 @@ discard block |
||
| 7368 | 7368 | |
| 7369 | 7369 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7370 | 7370 | |
| 7371 | - $str_length = (int) self::strlen($str, $encoding); |
|
| 7371 | + $str_length = (int)self::strlen($str, $encoding); |
|
| 7372 | 7372 | |
| 7373 | 7373 | if ($pad_length >= $str_length) { |
| 7374 | 7374 | switch ($pad_type) { |
| 7375 | 7375 | case \STR_PAD_LEFT: |
| 7376 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 7376 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 7377 | 7377 | |
| 7378 | 7378 | $diff = ($pad_length - $str_length); |
| 7379 | 7379 | |
| 7380 | - $pre = (string) self::substr( |
|
| 7381 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7380 | + $pre = (string)self::substr( |
|
| 7381 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7382 | 7382 | 0, |
| 7383 | 7383 | $diff, |
| 7384 | 7384 | $encoding |
@@ -7390,17 +7390,17 @@ discard block |
||
| 7390 | 7390 | case \STR_PAD_BOTH: |
| 7391 | 7391 | $diff = ($pad_length - $str_length); |
| 7392 | 7392 | |
| 7393 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 7393 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 7394 | 7394 | |
| 7395 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 7395 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 7396 | 7396 | |
| 7397 | - $pre = (string) self::substr( |
|
| 7397 | + $pre = (string)self::substr( |
|
| 7398 | 7398 | \str_repeat($pad_string, $ps_length_left), |
| 7399 | 7399 | 0, |
| 7400 | 7400 | $ps_length_left, |
| 7401 | 7401 | $encoding |
| 7402 | 7402 | ); |
| 7403 | - $post = (string) self::substr( |
|
| 7403 | + $post = (string)self::substr( |
|
| 7404 | 7404 | \str_repeat($pad_string, $ps_length_right), |
| 7405 | 7405 | 0, |
| 7406 | 7406 | $ps_length_right, |
@@ -7411,12 +7411,12 @@ discard block |
||
| 7411 | 7411 | |
| 7412 | 7412 | case \STR_PAD_RIGHT: |
| 7413 | 7413 | default: |
| 7414 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 7414 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 7415 | 7415 | |
| 7416 | 7416 | $diff = ($pad_length - $str_length); |
| 7417 | 7417 | |
| 7418 | - $post = (string) self::substr( |
|
| 7419 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7418 | + $post = (string)self::substr( |
|
| 7419 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7420 | 7420 | 0, |
| 7421 | 7421 | $diff, |
| 7422 | 7422 | $encoding |
@@ -7424,7 +7424,7 @@ discard block |
||
| 7424 | 7424 | $pre = ''; |
| 7425 | 7425 | } |
| 7426 | 7426 | |
| 7427 | - return $pre . $str . $post; |
|
| 7427 | + return $pre.$str.$post; |
|
| 7428 | 7428 | } |
| 7429 | 7429 | |
| 7430 | 7430 | return $str; |
@@ -7621,11 +7621,11 @@ discard block |
||
| 7621 | 7621 | } |
| 7622 | 7622 | |
| 7623 | 7623 | if ($search === '') { |
| 7624 | - return $str . $replacement; |
|
| 7624 | + return $str.$replacement; |
|
| 7625 | 7625 | } |
| 7626 | 7626 | |
| 7627 | 7627 | if (\strpos($str, $search) === 0) { |
| 7628 | - return $replacement . \substr($str, \strlen($search)); |
|
| 7628 | + return $replacement.\substr($str, \strlen($search)); |
|
| 7629 | 7629 | } |
| 7630 | 7630 | |
| 7631 | 7631 | return $str; |
@@ -7659,11 +7659,11 @@ discard block |
||
| 7659 | 7659 | } |
| 7660 | 7660 | |
| 7661 | 7661 | if ($search === '') { |
| 7662 | - return $str . $replacement; |
|
| 7662 | + return $str.$replacement; |
|
| 7663 | 7663 | } |
| 7664 | 7664 | |
| 7665 | 7665 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 7666 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 7666 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 7667 | 7667 | } |
| 7668 | 7668 | |
| 7669 | 7669 | return $str; |
@@ -7697,7 +7697,7 @@ discard block |
||
| 7697 | 7697 | $subject, |
| 7698 | 7698 | $replace, |
| 7699 | 7699 | $pos, |
| 7700 | - (int) self::strlen($search) |
|
| 7700 | + (int)self::strlen($search) |
|
| 7701 | 7701 | ); |
| 7702 | 7702 | } |
| 7703 | 7703 | |
@@ -7731,7 +7731,7 @@ discard block |
||
| 7731 | 7731 | $subject, |
| 7732 | 7732 | $replace, |
| 7733 | 7733 | $pos, |
| 7734 | - (int) self::strlen($search) |
|
| 7734 | + (int)self::strlen($search) |
|
| 7735 | 7735 | ); |
| 7736 | 7736 | } |
| 7737 | 7737 | |
@@ -7752,7 +7752,7 @@ discard block |
||
| 7752 | 7752 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
| 7753 | 7753 | { |
| 7754 | 7754 | if ($encoding === 'UTF-8') { |
| 7755 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
| 7755 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
| 7756 | 7756 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 7757 | 7757 | \shuffle($indexes); |
| 7758 | 7758 | |
@@ -7768,7 +7768,7 @@ discard block |
||
| 7768 | 7768 | } else { |
| 7769 | 7769 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7770 | 7770 | |
| 7771 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
| 7771 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
| 7772 | 7772 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 7773 | 7773 | \shuffle($indexes); |
| 7774 | 7774 | |
@@ -7811,11 +7811,11 @@ discard block |
||
| 7811 | 7811 | ) { |
| 7812 | 7812 | if ($encoding === 'UTF-8') { |
| 7813 | 7813 | if ($end === null) { |
| 7814 | - $length = (int) \mb_strlen($str); |
|
| 7814 | + $length = (int)\mb_strlen($str); |
|
| 7815 | 7815 | } elseif ($end >= 0 && $end <= $start) { |
| 7816 | 7816 | return ''; |
| 7817 | 7817 | } elseif ($end < 0) { |
| 7818 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
| 7818 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
| 7819 | 7819 | } else { |
| 7820 | 7820 | $length = $end - $start; |
| 7821 | 7821 | } |
@@ -7826,11 +7826,11 @@ discard block |
||
| 7826 | 7826 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7827 | 7827 | |
| 7828 | 7828 | if ($end === null) { |
| 7829 | - $length = (int) self::strlen($str, $encoding); |
|
| 7829 | + $length = (int)self::strlen($str, $encoding); |
|
| 7830 | 7830 | } elseif ($end >= 0 && $end <= $start) { |
| 7831 | 7831 | return ''; |
| 7832 | 7832 | } elseif ($end < 0) { |
| 7833 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
| 7833 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
| 7834 | 7834 | } else { |
| 7835 | 7835 | $length = $end - $start; |
| 7836 | 7836 | } |
@@ -7865,7 +7865,7 @@ discard block |
||
| 7865 | 7865 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7866 | 7866 | } |
| 7867 | 7867 | |
| 7868 | - $str = (string) \preg_replace_callback( |
|
| 7868 | + $str = (string)\preg_replace_callback( |
|
| 7869 | 7869 | '/([\\p{N}|\\p{Lu}])/u', |
| 7870 | 7870 | /** |
| 7871 | 7871 | * @param string[] $matches |
@@ -7874,28 +7874,28 @@ discard block |
||
| 7874 | 7874 | * |
| 7875 | 7875 | * @return string |
| 7876 | 7876 | */ |
| 7877 | - static function (array $matches) use ($encoding): string { |
|
| 7877 | + static function(array $matches) use ($encoding): string { |
|
| 7878 | 7878 | $match = $matches[1]; |
| 7879 | - $match_int = (int) $match; |
|
| 7879 | + $match_int = (int)$match; |
|
| 7880 | 7880 | |
| 7881 | - if ((string) $match_int === $match) { |
|
| 7882 | - return '_' . $match . '_'; |
|
| 7881 | + if ((string)$match_int === $match) { |
|
| 7882 | + return '_'.$match.'_'; |
|
| 7883 | 7883 | } |
| 7884 | 7884 | |
| 7885 | 7885 | if ($encoding === 'UTF-8') { |
| 7886 | - return '_' . \mb_strtolower($match); |
|
| 7886 | + return '_'.\mb_strtolower($match); |
|
| 7887 | 7887 | } |
| 7888 | 7888 | |
| 7889 | - return '_' . self::strtolower($match, $encoding); |
|
| 7889 | + return '_'.self::strtolower($match, $encoding); |
|
| 7890 | 7890 | }, |
| 7891 | 7891 | $str |
| 7892 | 7892 | ); |
| 7893 | 7893 | |
| 7894 | - $str = (string) \preg_replace( |
|
| 7894 | + $str = (string)\preg_replace( |
|
| 7895 | 7895 | [ |
| 7896 | - '/\\s+/u', // convert spaces to "_" |
|
| 7896 | + '/\\s+/u', // convert spaces to "_" |
|
| 7897 | 7897 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
| 7898 | - '/_+/', // remove double "_" |
|
| 7898 | + '/_+/', // remove double "_" |
|
| 7899 | 7899 | ], |
| 7900 | 7900 | [ |
| 7901 | 7901 | '_', |
@@ -8018,7 +8018,7 @@ discard block |
||
| 8018 | 8018 | } |
| 8019 | 8019 | |
| 8020 | 8020 | // init |
| 8021 | - $input = (string) $input; |
|
| 8021 | + $input = (string)$input; |
|
| 8022 | 8022 | |
| 8023 | 8023 | if ($input === '') { |
| 8024 | 8024 | return []; |
@@ -8075,7 +8075,7 @@ discard block |
||
| 8075 | 8075 | ($input[$i] & "\xE0") === "\xC0" |
| 8076 | 8076 | ) { |
| 8077 | 8077 | if (($input[$i + 1] & "\xC0") === "\x80") { |
| 8078 | - $ret[] = $input[$i] . $input[$i + 1]; |
|
| 8078 | + $ret[] = $input[$i].$input[$i + 1]; |
|
| 8079 | 8079 | |
| 8080 | 8080 | ++$i; |
| 8081 | 8081 | } |
@@ -8089,7 +8089,7 @@ discard block |
||
| 8089 | 8089 | && |
| 8090 | 8090 | ($input[$i + 2] & "\xC0") === "\x80" |
| 8091 | 8091 | ) { |
| 8092 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2]; |
|
| 8092 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2]; |
|
| 8093 | 8093 | |
| 8094 | 8094 | $i += 2; |
| 8095 | 8095 | } |
@@ -8105,7 +8105,7 @@ discard block |
||
| 8105 | 8105 | && |
| 8106 | 8106 | ($input[$i + 3] & "\xC0") === "\x80" |
| 8107 | 8107 | ) { |
| 8108 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2] . $input[$i + 3]; |
|
| 8108 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2].$input[$i + 3]; |
|
| 8109 | 8109 | |
| 8110 | 8110 | $i += 3; |
| 8111 | 8111 | } |
@@ -8117,7 +8117,7 @@ discard block |
||
| 8117 | 8117 | $ret = \array_chunk($ret, $length); |
| 8118 | 8118 | |
| 8119 | 8119 | return \array_map( |
| 8120 | - static function (array &$item): string { |
|
| 8120 | + static function(array &$item): string { |
|
| 8121 | 8121 | return \implode('', $item); |
| 8122 | 8122 | }, |
| 8123 | 8123 | $ret |
@@ -8183,7 +8183,7 @@ discard block |
||
| 8183 | 8183 | $limit = -1; |
| 8184 | 8184 | } |
| 8185 | 8185 | |
| 8186 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
| 8186 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
| 8187 | 8187 | |
| 8188 | 8188 | if ($array === false) { |
| 8189 | 8189 | return []; |
@@ -8273,9 +8273,9 @@ discard block |
||
| 8273 | 8273 | return ''; |
| 8274 | 8274 | } |
| 8275 | 8275 | |
| 8276 | - return (string) \mb_substr( |
|
| 8276 | + return (string)\mb_substr( |
|
| 8277 | 8277 | $str, |
| 8278 | - $offset + (int) \mb_strlen($separator) |
|
| 8278 | + $offset + (int)\mb_strlen($separator) |
|
| 8279 | 8279 | ); |
| 8280 | 8280 | } |
| 8281 | 8281 | |
@@ -8284,9 +8284,9 @@ discard block |
||
| 8284 | 8284 | return ''; |
| 8285 | 8285 | } |
| 8286 | 8286 | |
| 8287 | - return (string) \mb_substr( |
|
| 8287 | + return (string)\mb_substr( |
|
| 8288 | 8288 | $str, |
| 8289 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 8289 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 8290 | 8290 | null, |
| 8291 | 8291 | $encoding |
| 8292 | 8292 | ); |
@@ -8315,9 +8315,9 @@ discard block |
||
| 8315 | 8315 | return ''; |
| 8316 | 8316 | } |
| 8317 | 8317 | |
| 8318 | - return (string) \mb_substr( |
|
| 8318 | + return (string)\mb_substr( |
|
| 8319 | 8319 | $str, |
| 8320 | - $offset + (int) \mb_strlen($separator) |
|
| 8320 | + $offset + (int)\mb_strlen($separator) |
|
| 8321 | 8321 | ); |
| 8322 | 8322 | } |
| 8323 | 8323 | |
@@ -8326,9 +8326,9 @@ discard block |
||
| 8326 | 8326 | return ''; |
| 8327 | 8327 | } |
| 8328 | 8328 | |
| 8329 | - return (string) self::substr( |
|
| 8329 | + return (string)self::substr( |
|
| 8330 | 8330 | $str, |
| 8331 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 8331 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 8332 | 8332 | null, |
| 8333 | 8333 | $encoding |
| 8334 | 8334 | ); |
@@ -8360,7 +8360,7 @@ discard block |
||
| 8360 | 8360 | return ''; |
| 8361 | 8361 | } |
| 8362 | 8362 | |
| 8363 | - return (string) \mb_substr( |
|
| 8363 | + return (string)\mb_substr( |
|
| 8364 | 8364 | $str, |
| 8365 | 8365 | 0, |
| 8366 | 8366 | $offset |
@@ -8372,7 +8372,7 @@ discard block |
||
| 8372 | 8372 | return ''; |
| 8373 | 8373 | } |
| 8374 | 8374 | |
| 8375 | - return (string) self::substr( |
|
| 8375 | + return (string)self::substr( |
|
| 8376 | 8376 | $str, |
| 8377 | 8377 | 0, |
| 8378 | 8378 | $offset, |
@@ -8403,7 +8403,7 @@ discard block |
||
| 8403 | 8403 | return ''; |
| 8404 | 8404 | } |
| 8405 | 8405 | |
| 8406 | - return (string) \mb_substr( |
|
| 8406 | + return (string)\mb_substr( |
|
| 8407 | 8407 | $str, |
| 8408 | 8408 | 0, |
| 8409 | 8409 | $offset |
@@ -8417,7 +8417,7 @@ discard block |
||
| 8417 | 8417 | |
| 8418 | 8418 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8419 | 8419 | |
| 8420 | - return (string) self::substr( |
|
| 8420 | + return (string)self::substr( |
|
| 8421 | 8421 | $str, |
| 8422 | 8422 | 0, |
| 8423 | 8423 | $offset, |
@@ -8532,7 +8532,7 @@ discard block |
||
| 8532 | 8532 | */ |
| 8533 | 8533 | public static function str_surround(string $str, string $substring): string |
| 8534 | 8534 | { |
| 8535 | - return $substring . $str . $substring; |
|
| 8535 | + return $substring.$str.$substring; |
|
| 8536 | 8536 | } |
| 8537 | 8537 | |
| 8538 | 8538 | /** |
@@ -8596,9 +8596,9 @@ discard block |
||
| 8596 | 8596 | $word_define_chars = ''; |
| 8597 | 8597 | } |
| 8598 | 8598 | |
| 8599 | - $str = (string) \preg_replace_callback( |
|
| 8600 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
| 8601 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
| 8599 | + $str = (string)\preg_replace_callback( |
|
| 8600 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
| 8601 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
| 8602 | 8602 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
| 8603 | 8603 | return $match[0]; |
| 8604 | 8604 | } |
@@ -8698,16 +8698,16 @@ discard block |
||
| 8698 | 8698 | |
| 8699 | 8699 | // the main substitutions |
| 8700 | 8700 | /** @noinspection RegExpDuplicateAlternationBranch - false-positive - https://youtrack.jetbrains.com/issue/WI-51002 */ |
| 8701 | - $str = (string) \preg_replace_callback( |
|
| 8701 | + $str = (string)\preg_replace_callback( |
|
| 8702 | 8702 | '~\\b (_*) (?: # 1. Leading underscore and |
| 8703 | 8703 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
| 8704 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
| 8704 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
| 8705 | 8705 | | |
| 8706 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
| 8706 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
| 8707 | 8707 | | |
| 8708 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
| 8708 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
| 8709 | 8709 | | |
| 8710 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
| 8710 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
| 8711 | 8711 | ) (_*) \\b # 6. With trailing underscore |
| 8712 | 8712 | ~ux', |
| 8713 | 8713 | /** |
@@ -8717,7 +8717,7 @@ discard block |
||
| 8717 | 8717 | * |
| 8718 | 8718 | * @return string |
| 8719 | 8719 | */ |
| 8720 | - static function (array $matches) use ($encoding): string { |
|
| 8720 | + static function(array $matches) use ($encoding): string { |
|
| 8721 | 8721 | // preserve leading underscore |
| 8722 | 8722 | $str = $matches[1]; |
| 8723 | 8723 | if ($matches[2]) { |
@@ -8742,11 +8742,11 @@ discard block |
||
| 8742 | 8742 | ); |
| 8743 | 8743 | |
| 8744 | 8744 | // Exceptions for small words: capitalize at start of title... |
| 8745 | - $str = (string) \preg_replace_callback( |
|
| 8745 | + $str = (string)\preg_replace_callback( |
|
| 8746 | 8746 | '~( \\A [[:punct:]]* # start of title... |
| 8747 | 8747 | | [:.;?!][ ]+ # or of subsentence... |
| 8748 | 8748 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
| 8749 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
| 8749 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
| 8750 | 8750 | ~uxi', |
| 8751 | 8751 | /** |
| 8752 | 8752 | * @param string[] $matches |
@@ -8755,15 +8755,15 @@ discard block |
||
| 8755 | 8755 | * |
| 8756 | 8756 | * @return string |
| 8757 | 8757 | */ |
| 8758 | - static function (array $matches) use ($encoding): string { |
|
| 8759 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
| 8758 | + static function(array $matches) use ($encoding): string { |
|
| 8759 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
| 8760 | 8760 | }, |
| 8761 | 8761 | $str |
| 8762 | 8762 | ); |
| 8763 | 8763 | |
| 8764 | 8764 | // ...and end of title |
| 8765 | - $str = (string) \preg_replace_callback( |
|
| 8766 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
| 8765 | + $str = (string)\preg_replace_callback( |
|
| 8766 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
| 8767 | 8767 | (?= [[:punct:]]* \Z # ...at the end of the title... |
| 8768 | 8768 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
| 8769 | 8769 | ~uxi', |
@@ -8774,7 +8774,7 @@ discard block |
||
| 8774 | 8774 | * |
| 8775 | 8775 | * @return string |
| 8776 | 8776 | */ |
| 8777 | - static function (array $matches) use ($encoding): string { |
|
| 8777 | + static function(array $matches) use ($encoding): string { |
|
| 8778 | 8778 | return static::ucfirst($matches[1], $encoding); |
| 8779 | 8779 | }, |
| 8780 | 8780 | $str |
@@ -8782,10 +8782,10 @@ discard block |
||
| 8782 | 8782 | |
| 8783 | 8783 | // Exceptions for small words in hyphenated compound words. |
| 8784 | 8784 | // e.g. "in-flight" -> In-Flight |
| 8785 | - $str = (string) \preg_replace_callback( |
|
| 8785 | + $str = (string)\preg_replace_callback( |
|
| 8786 | 8786 | '~\\b |
| 8787 | 8787 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
| 8788 | - ( ' . $small_words_rx . ' ) |
|
| 8788 | + ( ' . $small_words_rx.' ) |
|
| 8789 | 8789 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
| 8790 | 8790 | ~uxi', |
| 8791 | 8791 | /** |
@@ -8795,18 +8795,18 @@ discard block |
||
| 8795 | 8795 | * |
| 8796 | 8796 | * @return string |
| 8797 | 8797 | */ |
| 8798 | - static function (array $matches) use ($encoding): string { |
|
| 8798 | + static function(array $matches) use ($encoding): string { |
|
| 8799 | 8799 | return static::ucfirst($matches[1], $encoding); |
| 8800 | 8800 | }, |
| 8801 | 8801 | $str |
| 8802 | 8802 | ); |
| 8803 | 8803 | |
| 8804 | 8804 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
| 8805 | - $str = (string) \preg_replace_callback( |
|
| 8805 | + $str = (string)\preg_replace_callback( |
|
| 8806 | 8806 | '~\\b |
| 8807 | 8807 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
| 8808 | 8808 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
| 8809 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
| 8809 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
| 8810 | 8810 | (?! - ) # Negative lookahead for another - |
| 8811 | 8811 | ~uxi', |
| 8812 | 8812 | /** |
@@ -8816,8 +8816,8 @@ discard block |
||
| 8816 | 8816 | * |
| 8817 | 8817 | * @return string |
| 8818 | 8818 | */ |
| 8819 | - static function (array $matches) use ($encoding): string { |
|
| 8820 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
| 8819 | + static function(array $matches) use ($encoding): string { |
|
| 8820 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
| 8821 | 8821 | }, |
| 8822 | 8822 | $str |
| 8823 | 8823 | ); |
@@ -8932,7 +8932,7 @@ discard block |
||
| 8932 | 8932 | ); |
| 8933 | 8933 | |
| 8934 | 8934 | foreach ($tmp_return as &$item) { |
| 8935 | - $item = (string) $item; |
|
| 8935 | + $item = (string)$item; |
|
| 8936 | 8936 | } |
| 8937 | 8937 | |
| 8938 | 8938 | return $tmp_return; |
@@ -8986,39 +8986,39 @@ discard block |
||
| 8986 | 8986 | } |
| 8987 | 8987 | |
| 8988 | 8988 | if ($encoding === 'UTF-8') { |
| 8989 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 8989 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 8990 | 8990 | return $str; |
| 8991 | 8991 | } |
| 8992 | 8992 | |
| 8993 | 8993 | if ($substring !== '') { |
| 8994 | - $length -= (int) \mb_strlen($substring); |
|
| 8994 | + $length -= (int)\mb_strlen($substring); |
|
| 8995 | 8995 | |
| 8996 | 8996 | /** @noinspection UnnecessaryCastingInspection */ |
| 8997 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
| 8997 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
| 8998 | 8998 | } |
| 8999 | 8999 | |
| 9000 | 9000 | /** @noinspection UnnecessaryCastingInspection */ |
| 9001 | - return (string) \mb_substr($str, 0, $length); |
|
| 9001 | + return (string)\mb_substr($str, 0, $length); |
|
| 9002 | 9002 | } |
| 9003 | 9003 | |
| 9004 | 9004 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 9005 | 9005 | |
| 9006 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 9006 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 9007 | 9007 | return $str; |
| 9008 | 9008 | } |
| 9009 | 9009 | |
| 9010 | 9010 | if ($substring !== '') { |
| 9011 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 9011 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 9012 | 9012 | } |
| 9013 | 9013 | |
| 9014 | 9014 | return ( |
| 9015 | - (string) self::substr( |
|
| 9015 | + (string)self::substr( |
|
| 9016 | 9016 | $str, |
| 9017 | 9017 | 0, |
| 9018 | 9018 | $length, |
| 9019 | 9019 | $encoding |
| 9020 | 9020 | ) |
| 9021 | - ) . $substring; |
|
| 9021 | + ).$substring; |
|
| 9022 | 9022 | } |
| 9023 | 9023 | |
| 9024 | 9024 | /** |
@@ -9052,12 +9052,12 @@ discard block |
||
| 9052 | 9052 | } |
| 9053 | 9053 | |
| 9054 | 9054 | if ($encoding === 'UTF-8') { |
| 9055 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 9055 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 9056 | 9056 | return $str; |
| 9057 | 9057 | } |
| 9058 | 9058 | |
| 9059 | 9059 | // need to further trim the string so we can append the substring |
| 9060 | - $length -= (int) \mb_strlen($substring); |
|
| 9060 | + $length -= (int)\mb_strlen($substring); |
|
| 9061 | 9061 | if ($length <= 0) { |
| 9062 | 9062 | return $substring; |
| 9063 | 9063 | } |
@@ -9083,18 +9083,18 @@ discard block |
||
| 9083 | 9083 | !$ignore_do_not_split_words_for_one_word |
| 9084 | 9084 | ) |
| 9085 | 9085 | ) { |
| 9086 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
| 9086 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
| 9087 | 9087 | } |
| 9088 | 9088 | } |
| 9089 | 9089 | } else { |
| 9090 | 9090 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 9091 | 9091 | |
| 9092 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 9092 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 9093 | 9093 | return $str; |
| 9094 | 9094 | } |
| 9095 | 9095 | |
| 9096 | 9096 | // need to further trim the string so we can append the substring |
| 9097 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 9097 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 9098 | 9098 | if ($length <= 0) { |
| 9099 | 9099 | return $substring; |
| 9100 | 9100 | } |
@@ -9120,12 +9120,12 @@ discard block |
||
| 9120 | 9120 | !$ignore_do_not_split_words_for_one_word |
| 9121 | 9121 | ) |
| 9122 | 9122 | ) { |
| 9123 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
| 9123 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
| 9124 | 9124 | } |
| 9125 | 9125 | } |
| 9126 | 9126 | } |
| 9127 | 9127 | |
| 9128 | - return $truncated . $substring; |
|
| 9128 | + return $truncated.$substring; |
|
| 9129 | 9129 | } |
| 9130 | 9130 | |
| 9131 | 9131 | /** |
@@ -9235,13 +9235,13 @@ discard block |
||
| 9235 | 9235 | } |
| 9236 | 9236 | } elseif ($format === 2) { |
| 9237 | 9237 | $number_of_words = []; |
| 9238 | - $offset = (int) self::strlen($str_parts[0]); |
|
| 9238 | + $offset = (int)self::strlen($str_parts[0]); |
|
| 9239 | 9239 | for ($i = 1; $i < $len; $i += 2) { |
| 9240 | 9240 | $number_of_words[$offset] = $str_parts[$i]; |
| 9241 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
| 9241 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
| 9242 | 9242 | } |
| 9243 | 9243 | } else { |
| 9244 | - $number_of_words = (int) (($len - 1) / 2); |
|
| 9244 | + $number_of_words = (int)(($len - 1) / 2); |
|
| 9245 | 9245 | } |
| 9246 | 9246 | |
| 9247 | 9247 | return $number_of_words; |
@@ -9370,21 +9370,21 @@ discard block |
||
| 9370 | 9370 | } |
| 9371 | 9371 | |
| 9372 | 9372 | if ($char_list === '') { |
| 9373 | - return (int) self::strlen($str, $encoding); |
|
| 9373 | + return (int)self::strlen($str, $encoding); |
|
| 9374 | 9374 | } |
| 9375 | 9375 | |
| 9376 | 9376 | if ($offset !== null || $length !== null) { |
| 9377 | 9377 | if ($encoding === 'UTF-8') { |
| 9378 | 9378 | if ($length === null) { |
| 9379 | 9379 | /** @noinspection UnnecessaryCastingInspection */ |
| 9380 | - $str_tmp = \mb_substr($str, (int) $offset); |
|
| 9380 | + $str_tmp = \mb_substr($str, (int)$offset); |
|
| 9381 | 9381 | } else { |
| 9382 | 9382 | /** @noinspection UnnecessaryCastingInspection */ |
| 9383 | - $str_tmp = \mb_substr($str, (int) $offset, $length); |
|
| 9383 | + $str_tmp = \mb_substr($str, (int)$offset, $length); |
|
| 9384 | 9384 | } |
| 9385 | 9385 | } else { |
| 9386 | 9386 | /** @noinspection UnnecessaryCastingInspection */ |
| 9387 | - $str_tmp = self::substr($str, (int) $offset, $length, $encoding); |
|
| 9387 | + $str_tmp = self::substr($str, (int)$offset, $length, $encoding); |
|
| 9388 | 9388 | } |
| 9389 | 9389 | |
| 9390 | 9390 | if ($str_tmp === false) { |
@@ -9400,7 +9400,7 @@ discard block |
||
| 9400 | 9400 | } |
| 9401 | 9401 | |
| 9402 | 9402 | $matches = []; |
| 9403 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
| 9403 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
| 9404 | 9404 | $return = self::strlen($matches[1], $encoding); |
| 9405 | 9405 | if ($return === false) { |
| 9406 | 9406 | return 0; |
@@ -9409,7 +9409,7 @@ discard block |
||
| 9409 | 9409 | return $return; |
| 9410 | 9410 | } |
| 9411 | 9411 | |
| 9412 | - return (int) self::strlen($str, $encoding); |
|
| 9412 | + return (int)self::strlen($str, $encoding); |
|
| 9413 | 9413 | } |
| 9414 | 9414 | |
| 9415 | 9415 | /** |
@@ -9464,7 +9464,7 @@ discard block |
||
| 9464 | 9464 | |
| 9465 | 9465 | $str = ''; |
| 9466 | 9466 | foreach ($array as $strPart) { |
| 9467 | - $str .= '&#' . (int) $strPart . ';'; |
|
| 9467 | + $str .= '&#'.(int)$strPart.';'; |
|
| 9468 | 9468 | } |
| 9469 | 9469 | |
| 9470 | 9470 | return self::html_entity_decode($str, \ENT_QUOTES | \ENT_HTML5); |
@@ -9553,7 +9553,7 @@ discard block |
||
| 9553 | 9553 | return ''; |
| 9554 | 9554 | } |
| 9555 | 9555 | |
| 9556 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
| 9556 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
| 9557 | 9557 | } |
| 9558 | 9558 | |
| 9559 | 9559 | /** |
@@ -9620,7 +9620,7 @@ discard block |
||
| 9620 | 9620 | // fallback for ascii only |
| 9621 | 9621 | // |
| 9622 | 9622 | |
| 9623 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 9623 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 9624 | 9624 | return \stripos($haystack, $needle, $offset); |
| 9625 | 9625 | } |
| 9626 | 9626 | |
@@ -9693,7 +9693,7 @@ discard block |
||
| 9693 | 9693 | /** |
| 9694 | 9694 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 9695 | 9695 | */ |
| 9696 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9696 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9697 | 9697 | } |
| 9698 | 9698 | |
| 9699 | 9699 | if ( |
@@ -9707,11 +9707,11 @@ discard block |
||
| 9707 | 9707 | } |
| 9708 | 9708 | } |
| 9709 | 9709 | |
| 9710 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
| 9710 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
| 9711 | 9711 | return \stristr($haystack, $needle, $before_needle); |
| 9712 | 9712 | } |
| 9713 | 9713 | |
| 9714 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
| 9714 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
| 9715 | 9715 | |
| 9716 | 9716 | if (!isset($match[1])) { |
| 9717 | 9717 | return false; |
@@ -9721,7 +9721,7 @@ discard block |
||
| 9721 | 9721 | return $match[1]; |
| 9722 | 9722 | } |
| 9723 | 9723 | |
| 9724 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
| 9724 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
| 9725 | 9725 | } |
| 9726 | 9726 | |
| 9727 | 9727 | /** |
@@ -9800,7 +9800,7 @@ discard block |
||
| 9800 | 9800 | /** |
| 9801 | 9801 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 9802 | 9802 | */ |
| 9803 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9803 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9804 | 9804 | } |
| 9805 | 9805 | |
| 9806 | 9806 | // |
@@ -9922,8 +9922,8 @@ discard block |
||
| 9922 | 9922 | } |
| 9923 | 9923 | |
| 9924 | 9924 | return \strnatcmp( |
| 9925 | - (string) self::strtonatfold($str1), |
|
| 9926 | - (string) self::strtonatfold($str2) |
|
| 9925 | + (string)self::strtonatfold($str1), |
|
| 9926 | + (string)self::strtonatfold($str2) |
|
| 9927 | 9927 | ); |
| 9928 | 9928 | } |
| 9929 | 9929 | |
@@ -9985,11 +9985,11 @@ discard block |
||
| 9985 | 9985 | } |
| 9986 | 9986 | |
| 9987 | 9987 | if ($encoding === 'UTF-8') { |
| 9988 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
| 9989 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
| 9988 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
| 9989 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
| 9990 | 9990 | } else { |
| 9991 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
| 9992 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
| 9991 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
| 9992 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
| 9993 | 9993 | } |
| 9994 | 9994 | |
| 9995 | 9995 | return self::strcmp($str1, $str2); |
@@ -10014,8 +10014,8 @@ discard block |
||
| 10014 | 10014 | return false; |
| 10015 | 10015 | } |
| 10016 | 10016 | |
| 10017 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
| 10018 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
| 10017 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
| 10018 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
| 10019 | 10019 | } |
| 10020 | 10020 | |
| 10021 | 10021 | return false; |
@@ -10050,10 +10050,10 @@ discard block |
||
| 10050 | 10050 | } |
| 10051 | 10051 | |
| 10052 | 10052 | // iconv and mbstring do not support integer $needle |
| 10053 | - if ((int) $needle === $needle) { |
|
| 10054 | - $needle = (string) self::chr($needle); |
|
| 10053 | + if ((int)$needle === $needle) { |
|
| 10054 | + $needle = (string)self::chr($needle); |
|
| 10055 | 10055 | } |
| 10056 | - $needle = (string) $needle; |
|
| 10056 | + $needle = (string)$needle; |
|
| 10057 | 10057 | |
| 10058 | 10058 | if ($needle === '') { |
| 10059 | 10059 | return false; |
@@ -10105,7 +10105,7 @@ discard block |
||
| 10105 | 10105 | /** |
| 10106 | 10106 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10107 | 10107 | */ |
| 10108 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10108 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10109 | 10109 | } |
| 10110 | 10110 | |
| 10111 | 10111 | // |
@@ -10146,7 +10146,7 @@ discard block |
||
| 10146 | 10146 | // fallback for ascii only |
| 10147 | 10147 | // |
| 10148 | 10148 | |
| 10149 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10149 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10150 | 10150 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Offset not contained in string */ |
| 10151 | 10151 | return @\strpos($haystack, $needle, $offset); |
| 10152 | 10152 | } |
@@ -10159,7 +10159,7 @@ discard block |
||
| 10159 | 10159 | if ($haystack_tmp === false) { |
| 10160 | 10160 | $haystack_tmp = ''; |
| 10161 | 10161 | } |
| 10162 | - $haystack = (string) $haystack_tmp; |
|
| 10162 | + $haystack = (string)$haystack_tmp; |
|
| 10163 | 10163 | |
| 10164 | 10164 | if ($offset < 0) { |
| 10165 | 10165 | $offset = 0; |
@@ -10171,7 +10171,7 @@ discard block |
||
| 10171 | 10171 | } |
| 10172 | 10172 | |
| 10173 | 10173 | if ($pos) { |
| 10174 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 10174 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 10175 | 10175 | } |
| 10176 | 10176 | |
| 10177 | 10177 | return $offset + 0; |
@@ -10324,7 +10324,7 @@ discard block |
||
| 10324 | 10324 | /** |
| 10325 | 10325 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10326 | 10326 | */ |
| 10327 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10327 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10328 | 10328 | } |
| 10329 | 10329 | |
| 10330 | 10330 | // |
@@ -10336,7 +10336,7 @@ discard block |
||
| 10336 | 10336 | if ($needle_tmp === false) { |
| 10337 | 10337 | return false; |
| 10338 | 10338 | } |
| 10339 | - $needle = (string) $needle_tmp; |
|
| 10339 | + $needle = (string)$needle_tmp; |
|
| 10340 | 10340 | |
| 10341 | 10341 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
| 10342 | 10342 | if ($pos === false) { |
@@ -10358,7 +10358,7 @@ discard block |
||
| 10358 | 10358 | if ($needle_tmp === false) { |
| 10359 | 10359 | return false; |
| 10360 | 10360 | } |
| 10361 | - $needle = (string) $needle_tmp; |
|
| 10361 | + $needle = (string)$needle_tmp; |
|
| 10362 | 10362 | |
| 10363 | 10363 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
| 10364 | 10364 | if ($pos === false) { |
@@ -10397,7 +10397,7 @@ discard block |
||
| 10397 | 10397 | if ($encoding === 'UTF-8') { |
| 10398 | 10398 | if (self::$SUPPORT['intl'] === true) { |
| 10399 | 10399 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
| 10400 | - $i = (int) \grapheme_strlen($str); |
|
| 10400 | + $i = (int)\grapheme_strlen($str); |
|
| 10401 | 10401 | while ($i--) { |
| 10402 | 10402 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
| 10403 | 10403 | if ($reversed_tmp !== false) { |
@@ -10405,7 +10405,7 @@ discard block |
||
| 10405 | 10405 | } |
| 10406 | 10406 | } |
| 10407 | 10407 | } else { |
| 10408 | - $i = (int) \mb_strlen($str); |
|
| 10408 | + $i = (int)\mb_strlen($str); |
|
| 10409 | 10409 | while ($i--) { |
| 10410 | 10410 | $reversed_tmp = \mb_substr($str, $i, 1); |
| 10411 | 10411 | if ($reversed_tmp !== false) { |
@@ -10416,7 +10416,7 @@ discard block |
||
| 10416 | 10416 | } else { |
| 10417 | 10417 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 10418 | 10418 | |
| 10419 | - $i = (int) self::strlen($str, $encoding); |
|
| 10419 | + $i = (int)self::strlen($str, $encoding); |
|
| 10420 | 10420 | while ($i--) { |
| 10421 | 10421 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
| 10422 | 10422 | if ($reversed_tmp !== false) { |
@@ -10493,7 +10493,7 @@ discard block |
||
| 10493 | 10493 | if ($needle_tmp === false) { |
| 10494 | 10494 | return false; |
| 10495 | 10495 | } |
| 10496 | - $needle = (string) $needle_tmp; |
|
| 10496 | + $needle = (string)$needle_tmp; |
|
| 10497 | 10497 | |
| 10498 | 10498 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
| 10499 | 10499 | if ($pos === false) { |
@@ -10534,10 +10534,10 @@ discard block |
||
| 10534 | 10534 | } |
| 10535 | 10535 | |
| 10536 | 10536 | // iconv and mbstring do not support integer $needle |
| 10537 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 10538 | - $needle = (string) self::chr($needle); |
|
| 10537 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 10538 | + $needle = (string)self::chr($needle); |
|
| 10539 | 10539 | } |
| 10540 | - $needle = (string) $needle; |
|
| 10540 | + $needle = (string)$needle; |
|
| 10541 | 10541 | |
| 10542 | 10542 | if ($needle === '') { |
| 10543 | 10543 | return false; |
@@ -10585,7 +10585,7 @@ discard block |
||
| 10585 | 10585 | /** |
| 10586 | 10586 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10587 | 10587 | */ |
| 10588 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10588 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10589 | 10589 | } |
| 10590 | 10590 | |
| 10591 | 10591 | // |
@@ -10609,7 +10609,7 @@ discard block |
||
| 10609 | 10609 | // fallback for ascii only |
| 10610 | 10610 | // |
| 10611 | 10611 | |
| 10612 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10612 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10613 | 10613 | return \strripos($haystack, $needle, $offset); |
| 10614 | 10614 | } |
| 10615 | 10615 | |
@@ -10690,10 +10690,10 @@ discard block |
||
| 10690 | 10690 | } |
| 10691 | 10691 | |
| 10692 | 10692 | // iconv and mbstring do not support integer $needle |
| 10693 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 10694 | - $needle = (string) self::chr($needle); |
|
| 10693 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 10694 | + $needle = (string)self::chr($needle); |
|
| 10695 | 10695 | } |
| 10696 | - $needle = (string) $needle; |
|
| 10696 | + $needle = (string)$needle; |
|
| 10697 | 10697 | |
| 10698 | 10698 | if ($needle === '') { |
| 10699 | 10699 | return false; |
@@ -10741,7 +10741,7 @@ discard block |
||
| 10741 | 10741 | /** |
| 10742 | 10742 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10743 | 10743 | */ |
| 10744 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10744 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10745 | 10745 | } |
| 10746 | 10746 | |
| 10747 | 10747 | // |
@@ -10765,7 +10765,7 @@ discard block |
||
| 10765 | 10765 | // fallback for ascii only |
| 10766 | 10766 | // |
| 10767 | 10767 | |
| 10768 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10768 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10769 | 10769 | return \strrpos($haystack, $needle, $offset); |
| 10770 | 10770 | } |
| 10771 | 10771 | |
@@ -10785,7 +10785,7 @@ discard block |
||
| 10785 | 10785 | if ($haystack_tmp === false) { |
| 10786 | 10786 | $haystack_tmp = ''; |
| 10787 | 10787 | } |
| 10788 | - $haystack = (string) $haystack_tmp; |
|
| 10788 | + $haystack = (string)$haystack_tmp; |
|
| 10789 | 10789 | } |
| 10790 | 10790 | |
| 10791 | 10791 | $pos = \strrpos($haystack, $needle); |
@@ -10799,7 +10799,7 @@ discard block |
||
| 10799 | 10799 | return false; |
| 10800 | 10800 | } |
| 10801 | 10801 | |
| 10802 | - return $offset + (int) self::strlen($str_tmp); |
|
| 10802 | + return $offset + (int)self::strlen($str_tmp); |
|
| 10803 | 10803 | } |
| 10804 | 10804 | |
| 10805 | 10805 | /** |
@@ -10865,12 +10865,12 @@ discard block |
||
| 10865 | 10865 | if ($offset || $length !== null) { |
| 10866 | 10866 | if ($encoding === 'UTF-8') { |
| 10867 | 10867 | if ($length === null) { |
| 10868 | - $str = (string) \mb_substr($str, $offset); |
|
| 10868 | + $str = (string)\mb_substr($str, $offset); |
|
| 10869 | 10869 | } else { |
| 10870 | - $str = (string) \mb_substr($str, $offset, $length); |
|
| 10870 | + $str = (string)\mb_substr($str, $offset, $length); |
|
| 10871 | 10871 | } |
| 10872 | 10872 | } else { |
| 10873 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
| 10873 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
| 10874 | 10874 | } |
| 10875 | 10875 | } |
| 10876 | 10876 | |
@@ -10880,7 +10880,7 @@ discard block |
||
| 10880 | 10880 | |
| 10881 | 10881 | $matches = []; |
| 10882 | 10882 | |
| 10883 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
| 10883 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
| 10884 | 10884 | } |
| 10885 | 10885 | |
| 10886 | 10886 | /** |
@@ -10954,7 +10954,7 @@ discard block |
||
| 10954 | 10954 | /** |
| 10955 | 10955 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10956 | 10956 | */ |
| 10957 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10957 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10958 | 10958 | } |
| 10959 | 10959 | |
| 10960 | 10960 | // |
@@ -10976,7 +10976,7 @@ discard block |
||
| 10976 | 10976 | // fallback for ascii only |
| 10977 | 10977 | // |
| 10978 | 10978 | |
| 10979 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10979 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10980 | 10980 | return \strstr($haystack, $needle, $before_needle); |
| 10981 | 10981 | } |
| 10982 | 10982 | |
@@ -10984,7 +10984,7 @@ discard block |
||
| 10984 | 10984 | // fallback via vanilla php |
| 10985 | 10985 | // |
| 10986 | 10986 | |
| 10987 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
| 10987 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
| 10988 | 10988 | |
| 10989 | 10989 | if (!isset($match[1])) { |
| 10990 | 10990 | return false; |
@@ -10994,7 +10994,7 @@ discard block |
||
| 10994 | 10994 | return $match[1]; |
| 10995 | 10995 | } |
| 10996 | 10996 | |
| 10997 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
| 10997 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
| 10998 | 10998 | } |
| 10999 | 10999 | |
| 11000 | 11000 | /** |
@@ -11120,7 +11120,7 @@ discard block |
||
| 11120 | 11120 | bool $try_to_keep_the_string_length = false |
| 11121 | 11121 | ): string { |
| 11122 | 11122 | // init |
| 11123 | - $str = (string) $str; |
|
| 11123 | + $str = (string)$str; |
|
| 11124 | 11124 | |
| 11125 | 11125 | if ($str === '') { |
| 11126 | 11126 | return ''; |
@@ -11149,25 +11149,25 @@ discard block |
||
| 11149 | 11149 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 11150 | 11150 | } |
| 11151 | 11151 | |
| 11152 | - $language_code = $lang . '-Lower'; |
|
| 11152 | + $language_code = $lang.'-Lower'; |
|
| 11153 | 11153 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 11154 | 11154 | /** |
| 11155 | 11155 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11156 | 11156 | */ |
| 11157 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
| 11157 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
| 11158 | 11158 | |
| 11159 | 11159 | $language_code = 'Any-Lower'; |
| 11160 | 11160 | } |
| 11161 | 11161 | |
| 11162 | 11162 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 11163 | 11163 | /** @noinspection UnnecessaryCastingInspection */ |
| 11164 | - return (string) \transliterator_transliterate($language_code, $str); |
|
| 11164 | + return (string)\transliterator_transliterate($language_code, $str); |
|
| 11165 | 11165 | } |
| 11166 | 11166 | |
| 11167 | 11167 | /** |
| 11168 | 11168 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11169 | 11169 | */ |
| 11170 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
| 11170 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
| 11171 | 11171 | } |
| 11172 | 11172 | |
| 11173 | 11173 | // always fallback via symfony polyfill |
@@ -11200,7 +11200,7 @@ discard block |
||
| 11200 | 11200 | bool $try_to_keep_the_string_length = false |
| 11201 | 11201 | ): string { |
| 11202 | 11202 | // init |
| 11203 | - $str = (string) $str; |
|
| 11203 | + $str = (string)$str; |
|
| 11204 | 11204 | |
| 11205 | 11205 | if ($str === '') { |
| 11206 | 11206 | return ''; |
@@ -11229,25 +11229,25 @@ discard block |
||
| 11229 | 11229 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 11230 | 11230 | } |
| 11231 | 11231 | |
| 11232 | - $language_code = $lang . '-Upper'; |
|
| 11232 | + $language_code = $lang.'-Upper'; |
|
| 11233 | 11233 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 11234 | 11234 | /** |
| 11235 | 11235 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11236 | 11236 | */ |
| 11237 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
| 11237 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
| 11238 | 11238 | |
| 11239 | 11239 | $language_code = 'Any-Upper'; |
| 11240 | 11240 | } |
| 11241 | 11241 | |
| 11242 | 11242 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 11243 | 11243 | /** @noinspection UnnecessaryCastingInspection */ |
| 11244 | - return (string) \transliterator_transliterate($language_code, $str); |
|
| 11244 | + return (string)\transliterator_transliterate($language_code, $str); |
|
| 11245 | 11245 | } |
| 11246 | 11246 | |
| 11247 | 11247 | /** |
| 11248 | 11248 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11249 | 11249 | */ |
| 11250 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
| 11250 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
| 11251 | 11251 | } |
| 11252 | 11252 | |
| 11253 | 11253 | // always fallback via symfony polyfill |
@@ -11316,7 +11316,7 @@ discard block |
||
| 11316 | 11316 | $from = \array_combine($from, $to); |
| 11317 | 11317 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 11318 | 11318 | if ($from === false) { |
| 11319 | - 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) . ')'); |
|
| 11319 | + 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).')'); |
|
| 11320 | 11320 | } |
| 11321 | 11321 | } |
| 11322 | 11322 | |
@@ -11378,9 +11378,9 @@ discard block |
||
| 11378 | 11378 | } |
| 11379 | 11379 | |
| 11380 | 11380 | $wide = 0; |
| 11381 | - $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); |
|
| 11381 | + $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); |
|
| 11382 | 11382 | |
| 11383 | - return ($wide << 1) + (int) self::strlen($str); |
|
| 11383 | + return ($wide << 1) + (int)self::strlen($str); |
|
| 11384 | 11384 | } |
| 11385 | 11385 | |
| 11386 | 11386 | /** |
@@ -11478,9 +11478,9 @@ discard block |
||
| 11478 | 11478 | } |
| 11479 | 11479 | |
| 11480 | 11480 | if ($length === null) { |
| 11481 | - $length = (int) $str_length; |
|
| 11481 | + $length = (int)$str_length; |
|
| 11482 | 11482 | } else { |
| 11483 | - $length = (int) $length; |
|
| 11483 | + $length = (int)$length; |
|
| 11484 | 11484 | } |
| 11485 | 11485 | |
| 11486 | 11486 | if ( |
@@ -11491,7 +11491,7 @@ discard block |
||
| 11491 | 11491 | /** |
| 11492 | 11492 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11493 | 11493 | */ |
| 11494 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11494 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11495 | 11495 | } |
| 11496 | 11496 | |
| 11497 | 11497 | // |
@@ -11581,16 +11581,16 @@ discard block |
||
| 11581 | 11581 | ) { |
| 11582 | 11582 | if ($encoding === 'UTF-8') { |
| 11583 | 11583 | if ($length === null) { |
| 11584 | - $str1 = (string) \mb_substr($str1, $offset); |
|
| 11584 | + $str1 = (string)\mb_substr($str1, $offset); |
|
| 11585 | 11585 | } else { |
| 11586 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
| 11586 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
| 11587 | 11587 | } |
| 11588 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
| 11588 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
| 11589 | 11589 | } else { |
| 11590 | 11590 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 11591 | 11591 | |
| 11592 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
| 11593 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
| 11592 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
| 11593 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
| 11594 | 11594 | } |
| 11595 | 11595 | } |
| 11596 | 11596 | |
@@ -11655,13 +11655,13 @@ discard block |
||
| 11655 | 11655 | if ($length_tmp === false) { |
| 11656 | 11656 | return false; |
| 11657 | 11657 | } |
| 11658 | - $length = (int) $length_tmp; |
|
| 11658 | + $length = (int)$length_tmp; |
|
| 11659 | 11659 | } |
| 11660 | 11660 | |
| 11661 | 11661 | if ($encoding === 'UTF-8') { |
| 11662 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
| 11662 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
| 11663 | 11663 | } else { |
| 11664 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
| 11664 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
| 11665 | 11665 | } |
| 11666 | 11666 | } |
| 11667 | 11667 | |
@@ -11673,7 +11673,7 @@ discard block |
||
| 11673 | 11673 | /** |
| 11674 | 11674 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11675 | 11675 | */ |
| 11676 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11676 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11677 | 11677 | } |
| 11678 | 11678 | |
| 11679 | 11679 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -11684,7 +11684,7 @@ discard block |
||
| 11684 | 11684 | return \mb_substr_count($haystack, $needle, $encoding); |
| 11685 | 11685 | } |
| 11686 | 11686 | |
| 11687 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 11687 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 11688 | 11688 | |
| 11689 | 11689 | return \count($matches); |
| 11690 | 11690 | } |
@@ -11734,7 +11734,7 @@ discard block |
||
| 11734 | 11734 | if ($length_tmp === false) { |
| 11735 | 11735 | return false; |
| 11736 | 11736 | } |
| 11737 | - $length = (int) $length_tmp; |
|
| 11737 | + $length = (int)$length_tmp; |
|
| 11738 | 11738 | } |
| 11739 | 11739 | |
| 11740 | 11740 | if ( |
@@ -11756,7 +11756,7 @@ discard block |
||
| 11756 | 11756 | if ($haystack_tmp === false) { |
| 11757 | 11757 | $haystack_tmp = ''; |
| 11758 | 11758 | } |
| 11759 | - $haystack = (string) $haystack_tmp; |
|
| 11759 | + $haystack = (string)$haystack_tmp; |
|
| 11760 | 11760 | } |
| 11761 | 11761 | |
| 11762 | 11762 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -11797,10 +11797,10 @@ discard block |
||
| 11797 | 11797 | |
| 11798 | 11798 | if ($encoding === 'UTF-8') { |
| 11799 | 11799 | if ($case_sensitive) { |
| 11800 | - return (int) \mb_substr_count($str, $substring); |
|
| 11800 | + return (int)\mb_substr_count($str, $substring); |
|
| 11801 | 11801 | } |
| 11802 | 11802 | |
| 11803 | - return (int) \mb_substr_count( |
|
| 11803 | + return (int)\mb_substr_count( |
|
| 11804 | 11804 | \mb_strtoupper($str), |
| 11805 | 11805 | \mb_strtoupper($substring) |
| 11806 | 11806 | ); |
@@ -11809,10 +11809,10 @@ discard block |
||
| 11809 | 11809 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 11810 | 11810 | |
| 11811 | 11811 | if ($case_sensitive) { |
| 11812 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
| 11812 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
| 11813 | 11813 | } |
| 11814 | 11814 | |
| 11815 | - return (int) \mb_substr_count( |
|
| 11815 | + return (int)\mb_substr_count( |
|
| 11816 | 11816 | self::strtocasefold($str, true, false, $encoding, null, false), |
| 11817 | 11817 | self::strtocasefold($substring, true, false, $encoding, null, false), |
| 11818 | 11818 | $encoding |
@@ -11841,7 +11841,7 @@ discard block |
||
| 11841 | 11841 | } |
| 11842 | 11842 | |
| 11843 | 11843 | if (self::str_istarts_with($haystack, $needle)) { |
| 11844 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 11844 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 11845 | 11845 | } |
| 11846 | 11846 | |
| 11847 | 11847 | return $haystack; |
@@ -11903,7 +11903,7 @@ discard block |
||
| 11903 | 11903 | } |
| 11904 | 11904 | |
| 11905 | 11905 | if (self::str_iends_with($haystack, $needle)) { |
| 11906 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
| 11906 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
| 11907 | 11907 | } |
| 11908 | 11908 | |
| 11909 | 11909 | return $haystack; |
@@ -11931,7 +11931,7 @@ discard block |
||
| 11931 | 11931 | } |
| 11932 | 11932 | |
| 11933 | 11933 | if (self::str_starts_with($haystack, $needle)) { |
| 11934 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 11934 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 11935 | 11935 | } |
| 11936 | 11936 | |
| 11937 | 11937 | return $haystack; |
@@ -11986,7 +11986,7 @@ discard block |
||
| 11986 | 11986 | if (\is_array($offset)) { |
| 11987 | 11987 | $offset = \array_slice($offset, 0, $num); |
| 11988 | 11988 | foreach ($offset as &$value_tmp) { |
| 11989 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
| 11989 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
| 11990 | 11990 | } |
| 11991 | 11991 | unset($value_tmp); |
| 11992 | 11992 | } else { |
@@ -11999,7 +11999,7 @@ discard block |
||
| 11999 | 11999 | } elseif (\is_array($length)) { |
| 12000 | 12000 | $length = \array_slice($length, 0, $num); |
| 12001 | 12001 | foreach ($length as &$value_tmp_V2) { |
| 12002 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
| 12002 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
| 12003 | 12003 | } |
| 12004 | 12004 | unset($value_tmp_V2); |
| 12005 | 12005 | } else { |
@@ -12019,8 +12019,8 @@ discard block |
||
| 12019 | 12019 | } |
| 12020 | 12020 | |
| 12021 | 12021 | // init |
| 12022 | - $str = (string) $str; |
|
| 12023 | - $replacement = (string) $replacement; |
|
| 12022 | + $str = (string)$str; |
|
| 12023 | + $replacement = (string)$replacement; |
|
| 12024 | 12024 | |
| 12025 | 12025 | if (\is_array($length)) { |
| 12026 | 12026 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -12035,16 +12035,16 @@ discard block |
||
| 12035 | 12035 | } |
| 12036 | 12036 | |
| 12037 | 12037 | if (self::$SUPPORT['mbstring'] === true) { |
| 12038 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 12038 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 12039 | 12039 | |
| 12040 | 12040 | if ($offset < 0) { |
| 12041 | - $offset = (int) \max(0, $string_length + $offset); |
|
| 12041 | + $offset = (int)\max(0, $string_length + $offset); |
|
| 12042 | 12042 | } elseif ($offset > $string_length) { |
| 12043 | 12043 | $offset = $string_length; |
| 12044 | 12044 | } |
| 12045 | 12045 | |
| 12046 | 12046 | if ($length !== null && $length < 0) { |
| 12047 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
| 12047 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
| 12048 | 12048 | } elseif ($length === null || $length > $string_length) { |
| 12049 | 12049 | $length = $string_length; |
| 12050 | 12050 | } |
@@ -12055,9 +12055,9 @@ discard block |
||
| 12055 | 12055 | } |
| 12056 | 12056 | |
| 12057 | 12057 | /** @noinspection AdditionOperationOnArraysInspection */ |
| 12058 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
| 12059 | - $replacement . |
|
| 12060 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 12058 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
| 12059 | + $replacement. |
|
| 12060 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 12061 | 12061 | } |
| 12062 | 12062 | |
| 12063 | 12063 | // |
@@ -12066,8 +12066,7 @@ discard block |
||
| 12066 | 12066 | |
| 12067 | 12067 | if (ASCII::is_ascii($str)) { |
| 12068 | 12068 | return ($length === null) ? |
| 12069 | - \substr_replace($str, $replacement, $offset) : |
|
| 12070 | - \substr_replace($str, $replacement, $offset, $length); |
|
| 12069 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
| 12071 | 12070 | } |
| 12072 | 12071 | |
| 12073 | 12072 | // |
@@ -12083,7 +12082,7 @@ discard block |
||
| 12083 | 12082 | // e.g.: non mbstring support + invalid chars |
| 12084 | 12083 | return ''; |
| 12085 | 12084 | } |
| 12086 | - $length = (int) $length_tmp; |
|
| 12085 | + $length = (int)$length_tmp; |
|
| 12087 | 12086 | } |
| 12088 | 12087 | |
| 12089 | 12088 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -12121,14 +12120,14 @@ discard block |
||
| 12121 | 12120 | && |
| 12122 | 12121 | \substr($haystack, -\strlen($needle)) === $needle |
| 12123 | 12122 | ) { |
| 12124 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
| 12123 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
| 12125 | 12124 | } |
| 12126 | 12125 | |
| 12127 | 12126 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
| 12128 | - return (string) self::substr( |
|
| 12127 | + return (string)self::substr( |
|
| 12129 | 12128 | $haystack, |
| 12130 | 12129 | 0, |
| 12131 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
| 12130 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
| 12132 | 12131 | $encoding |
| 12133 | 12132 | ); |
| 12134 | 12133 | } |
@@ -12161,10 +12160,10 @@ discard block |
||
| 12161 | 12160 | } |
| 12162 | 12161 | |
| 12163 | 12162 | if ($encoding === 'UTF-8') { |
| 12164 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 12163 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 12165 | 12164 | } |
| 12166 | 12165 | |
| 12167 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 12166 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 12168 | 12167 | } |
| 12169 | 12168 | |
| 12170 | 12169 | /** |
@@ -12372,7 +12371,7 @@ discard block |
||
| 12372 | 12371 | public static function to_boolean($str): bool |
| 12373 | 12372 | { |
| 12374 | 12373 | // init |
| 12375 | - $str = (string) $str; |
|
| 12374 | + $str = (string)$str; |
|
| 12376 | 12375 | |
| 12377 | 12376 | if ($str === '') { |
| 12378 | 12377 | return false; |
@@ -12400,10 +12399,10 @@ discard block |
||
| 12400 | 12399 | } |
| 12401 | 12400 | |
| 12402 | 12401 | if (\is_numeric($str)) { |
| 12403 | - return ((float) $str + 0) > 0; |
|
| 12402 | + return ((float)$str + 0) > 0; |
|
| 12404 | 12403 | } |
| 12405 | 12404 | |
| 12406 | - return (bool) \trim($str); |
|
| 12405 | + return (bool)\trim($str); |
|
| 12407 | 12406 | } |
| 12408 | 12407 | |
| 12409 | 12408 | /** |
@@ -12449,7 +12448,7 @@ discard block |
||
| 12449 | 12448 | return $str; |
| 12450 | 12449 | } |
| 12451 | 12450 | |
| 12452 | - $str = (string) $str; |
|
| 12451 | + $str = (string)$str; |
|
| 12453 | 12452 | if ($str === '') { |
| 12454 | 12453 | return ''; |
| 12455 | 12454 | } |
@@ -12504,7 +12503,7 @@ discard block |
||
| 12504 | 12503 | return $str; |
| 12505 | 12504 | } |
| 12506 | 12505 | |
| 12507 | - $str = (string) $str; |
|
| 12506 | + $str = (string)$str; |
|
| 12508 | 12507 | if ($str === '') { |
| 12509 | 12508 | return $str; |
| 12510 | 12509 | } |
@@ -12522,7 +12521,7 @@ discard block |
||
| 12522 | 12521 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
| 12523 | 12522 | |
| 12524 | 12523 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 12525 | - $buf .= $c1 . $c2; |
|
| 12524 | + $buf .= $c1.$c2; |
|
| 12526 | 12525 | ++$i; |
| 12527 | 12526 | } else { // not valid UTF8 - convert it |
| 12528 | 12527 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12533,7 +12532,7 @@ discard block |
||
| 12533 | 12532 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
| 12534 | 12533 | |
| 12535 | 12534 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 12536 | - $buf .= $c1 . $c2 . $c3; |
|
| 12535 | + $buf .= $c1.$c2.$c3; |
|
| 12537 | 12536 | $i += 2; |
| 12538 | 12537 | } else { // not valid UTF8 - convert it |
| 12539 | 12538 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12545,7 +12544,7 @@ discard block |
||
| 12545 | 12544 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
| 12546 | 12545 | |
| 12547 | 12546 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 12548 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
| 12547 | + $buf .= $c1.$c2.$c3.$c4; |
|
| 12549 | 12548 | $i += 3; |
| 12550 | 12549 | } else { // not valid UTF8 - convert it |
| 12551 | 12550 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12573,13 +12572,13 @@ discard block |
||
| 12573 | 12572 | * |
| 12574 | 12573 | * @return string |
| 12575 | 12574 | */ |
| 12576 | - static function (array $matches): string { |
|
| 12575 | + static function(array $matches): string { |
|
| 12577 | 12576 | if (isset($matches[3])) { |
| 12578 | - $cp = (int) \hexdec($matches[3]); |
|
| 12577 | + $cp = (int)\hexdec($matches[3]); |
|
| 12579 | 12578 | } else { |
| 12580 | 12579 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
| 12581 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
| 12582 | - + (int) \hexdec($matches[2]) |
|
| 12580 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
| 12581 | + + (int)\hexdec($matches[2]) |
|
| 12583 | 12582 | + 0x10000 |
| 12584 | 12583 | - (0xD800 << 10) |
| 12585 | 12584 | - 0xDC00; |
@@ -12590,12 +12589,12 @@ discard block |
||
| 12590 | 12589 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
| 12591 | 12590 | |
| 12592 | 12591 | if ($cp < 0x80) { |
| 12593 | - return (string) self::chr($cp); |
|
| 12592 | + return (string)self::chr($cp); |
|
| 12594 | 12593 | } |
| 12595 | 12594 | |
| 12596 | 12595 | if ($cp < 0xA0) { |
| 12597 | 12596 | /** @noinspection UnnecessaryCastingInspection */ |
| 12598 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
| 12597 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
| 12599 | 12598 | } |
| 12600 | 12599 | |
| 12601 | 12600 | return self::decimal_to_chr($cp); |
@@ -12628,7 +12627,7 @@ discard block |
||
| 12628 | 12627 | public static function to_int(string $str) |
| 12629 | 12628 | { |
| 12630 | 12629 | if (\is_numeric($str)) { |
| 12631 | - return (int) $str; |
|
| 12630 | + return (int)$str; |
|
| 12632 | 12631 | } |
| 12633 | 12632 | |
| 12634 | 12633 | return null; |
@@ -12659,7 +12658,7 @@ discard block |
||
| 12659 | 12658 | || |
| 12660 | 12659 | $input_type === 'double' |
| 12661 | 12660 | ) { |
| 12662 | - return (string) $input; |
|
| 12661 | + return (string)$input; |
|
| 12663 | 12662 | } |
| 12664 | 12663 | |
| 12665 | 12664 | if ( |
@@ -12667,7 +12666,7 @@ discard block |
||
| 12667 | 12666 | && |
| 12668 | 12667 | \method_exists($input, '__toString') |
| 12669 | 12668 | ) { |
| 12670 | - return (string) $input; |
|
| 12669 | + return (string)$input; |
|
| 12671 | 12670 | } |
| 12672 | 12671 | |
| 12673 | 12672 | return null; |
@@ -12705,7 +12704,7 @@ discard block |
||
| 12705 | 12704 | } |
| 12706 | 12705 | |
| 12707 | 12706 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 12708 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 12707 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 12709 | 12708 | } |
| 12710 | 12709 | |
| 12711 | 12710 | if ($chars) { |
@@ -12754,15 +12753,15 @@ discard block |
||
| 12754 | 12753 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 12755 | 12754 | |
| 12756 | 12755 | if ($encoding === 'UTF-8') { |
| 12757 | - $str_part_two = (string) \mb_substr($str, 1); |
|
| 12756 | + $str_part_two = (string)\mb_substr($str, 1); |
|
| 12758 | 12757 | |
| 12759 | 12758 | if ($use_mb_functions) { |
| 12760 | 12759 | $str_part_one = \mb_strtoupper( |
| 12761 | - (string) \mb_substr($str, 0, 1) |
|
| 12760 | + (string)\mb_substr($str, 0, 1) |
|
| 12762 | 12761 | ); |
| 12763 | 12762 | } else { |
| 12764 | 12763 | $str_part_one = self::strtoupper( |
| 12765 | - (string) \mb_substr($str, 0, 1), |
|
| 12764 | + (string)\mb_substr($str, 0, 1), |
|
| 12766 | 12765 | $encoding, |
| 12767 | 12766 | false, |
| 12768 | 12767 | $lang, |
@@ -12772,16 +12771,16 @@ discard block |
||
| 12772 | 12771 | } else { |
| 12773 | 12772 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 12774 | 12773 | |
| 12775 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
| 12774 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
| 12776 | 12775 | |
| 12777 | 12776 | if ($use_mb_functions) { |
| 12778 | 12777 | $str_part_one = \mb_strtoupper( |
| 12779 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
| 12778 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
| 12780 | 12779 | $encoding |
| 12781 | 12780 | ); |
| 12782 | 12781 | } else { |
| 12783 | 12782 | $str_part_one = self::strtoupper( |
| 12784 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 12783 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 12785 | 12784 | $encoding, |
| 12786 | 12785 | false, |
| 12787 | 12786 | $lang, |
@@ -12790,7 +12789,7 @@ discard block |
||
| 12790 | 12789 | } |
| 12791 | 12790 | } |
| 12792 | 12791 | |
| 12793 | - return $str_part_one . $str_part_two; |
|
| 12792 | + return $str_part_one.$str_part_two; |
|
| 12794 | 12793 | } |
| 12795 | 12794 | |
| 12796 | 12795 | /** |
@@ -12849,7 +12848,7 @@ discard block |
||
| 12849 | 12848 | $str = self::clean($str); |
| 12850 | 12849 | } |
| 12851 | 12850 | |
| 12852 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
| 12851 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
| 12853 | 12852 | |
| 12854 | 12853 | if ( |
| 12855 | 12854 | $use_php_default_functions |
@@ -13262,7 +13261,7 @@ discard block |
||
| 13262 | 13261 | if ( |
| 13263 | 13262 | $keep_utf8_chars |
| 13264 | 13263 | && |
| 13265 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
| 13264 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
| 13266 | 13265 | ) { |
| 13267 | 13266 | return $str_backup; |
| 13268 | 13267 | } |
@@ -13349,17 +13348,17 @@ discard block |
||
| 13349 | 13348 | return ''; |
| 13350 | 13349 | } |
| 13351 | 13350 | |
| 13352 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
| 13351 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
| 13353 | 13352 | |
| 13354 | 13353 | if ( |
| 13355 | 13354 | !isset($matches[0]) |
| 13356 | 13355 | || |
| 13357 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
| 13356 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
| 13358 | 13357 | ) { |
| 13359 | 13358 | return $str; |
| 13360 | 13359 | } |
| 13361 | 13360 | |
| 13362 | - return \rtrim($matches[0]) . $str_add_on; |
|
| 13361 | + return \rtrim($matches[0]).$str_add_on; |
|
| 13363 | 13362 | } |
| 13364 | 13363 | |
| 13365 | 13364 | /** |
@@ -13452,7 +13451,7 @@ discard block |
||
| 13452 | 13451 | } |
| 13453 | 13452 | } |
| 13454 | 13453 | |
| 13455 | - return $str_return . \implode('', $charsArray); |
|
| 13454 | + return $str_return.\implode('', $charsArray); |
|
| 13456 | 13455 | } |
| 13457 | 13456 | |
| 13458 | 13457 | /** |
@@ -13506,7 +13505,7 @@ discard block |
||
| 13506 | 13505 | $final_break = ''; |
| 13507 | 13506 | } |
| 13508 | 13507 | |
| 13509 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
| 13508 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
| 13510 | 13509 | } |
| 13511 | 13510 | |
| 13512 | 13511 | /** |
@@ -13742,7 +13741,7 @@ discard block |
||
| 13742 | 13741 | /** @noinspection PhpIncludeInspection */ |
| 13743 | 13742 | /** @noinspection UsingInclusionReturnValueInspection */ |
| 13744 | 13743 | /** @psalm-suppress UnresolvableInclude */ |
| 13745 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
| 13744 | + return include __DIR__.'/data/'.$file.'.php'; |
|
| 13746 | 13745 | } |
| 13747 | 13746 | |
| 13748 | 13747 | /** |
@@ -13762,7 +13761,7 @@ discard block |
||
| 13762 | 13761 | */ |
| 13763 | 13762 | \uksort( |
| 13764 | 13763 | self::$EMOJI, |
| 13765 | - static function (string $a, string $b): int { |
|
| 13764 | + static function(string $a, string $b): int { |
|
| 13766 | 13765 | return \strlen($b) <=> \strlen($a); |
| 13767 | 13766 | } |
| 13768 | 13767 | ); |
@@ -13772,7 +13771,7 @@ discard block |
||
| 13772 | 13771 | |
| 13773 | 13772 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
| 13774 | 13773 | $tmp_key = \crc32($key); |
| 13775 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
| 13774 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
| 13776 | 13775 | } |
| 13777 | 13776 | |
| 13778 | 13777 | return true; |
@@ -13800,7 +13799,7 @@ discard block |
||
| 13800 | 13799 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 13801 | 13800 | return \defined('MB_OVERLOAD_STRING') |
| 13802 | 13801 | && |
| 13803 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 13802 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 13804 | 13803 | } |
| 13805 | 13804 | |
| 13806 | 13805 | /** |
@@ -13866,7 +13865,7 @@ discard block |
||
| 13866 | 13865 | */ |
| 13867 | 13866 | static $RX_CLASS_CACHE = []; |
| 13868 | 13867 | |
| 13869 | - $cache_key = $s . '_' . $class; |
|
| 13868 | + $cache_key = $s.'_'.$class; |
|
| 13870 | 13869 | |
| 13871 | 13870 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
| 13872 | 13871 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -13879,7 +13878,7 @@ discard block |
||
| 13879 | 13878 | /** @noinspection AlterInForeachInspection */ |
| 13880 | 13879 | foreach (self::str_split($s) as &$s) { |
| 13881 | 13880 | if ($s === '-') { |
| 13882 | - $class_array[0] = '-' . $class_array[0]; |
|
| 13881 | + $class_array[0] = '-'.$class_array[0]; |
|
| 13883 | 13882 | } elseif (!isset($s[2])) { |
| 13884 | 13883 | $class_array[0] .= \preg_quote($s, '/'); |
| 13885 | 13884 | } elseif (self::strlen($s) === 1) { |
@@ -13890,13 +13889,13 @@ discard block |
||
| 13890 | 13889 | } |
| 13891 | 13890 | |
| 13892 | 13891 | if ($class_array[0]) { |
| 13893 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
| 13892 | + $class_array[0] = '['.$class_array[0].']'; |
|
| 13894 | 13893 | } |
| 13895 | 13894 | |
| 13896 | 13895 | if (\count($class_array) === 1) { |
| 13897 | 13896 | $return = $class_array[0]; |
| 13898 | 13897 | } else { |
| 13899 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
| 13898 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
| 13900 | 13899 | } |
| 13901 | 13900 | |
| 13902 | 13901 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -13977,7 +13976,7 @@ discard block |
||
| 13977 | 13976 | |
| 13978 | 13977 | if ($delimiter === '-') { |
| 13979 | 13978 | /** @noinspection AlterInForeachInspection */ |
| 13980 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
| 13979 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
| 13981 | 13980 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
| 13982 | 13981 | $continue = true; |
| 13983 | 13982 | |
@@ -13987,7 +13986,7 @@ discard block |
||
| 13987 | 13986 | } |
| 13988 | 13987 | |
| 13989 | 13988 | /** @noinspection AlterInForeachInspection */ |
| 13990 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
| 13989 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
| 13991 | 13990 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
| 13992 | 13991 | $continue = true; |
| 13993 | 13992 | |
@@ -14057,8 +14056,8 @@ discard block |
||
| 14057 | 14056 | } else { |
| 14058 | 14057 | /** @noinspection OffsetOperationsInspection */ |
| 14059 | 14058 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
| 14060 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
| 14061 | - $buf .= $cc1 . $cc2; |
|
| 14059 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
| 14060 | + $buf .= $cc1.$cc2; |
|
| 14062 | 14061 | } |
| 14063 | 14062 | |
| 14064 | 14063 | return $buf; |
@@ -14077,7 +14076,7 @@ discard block |
||
| 14077 | 14076 | { |
| 14078 | 14077 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
| 14079 | 14078 | if (\preg_match($pattern, $str)) { |
| 14080 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
| 14079 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
| 14081 | 14080 | } |
| 14082 | 14081 | |
| 14083 | 14082 | return $str; |