@@ -263,10 +263,10 @@ discard block |
||
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | if ($encoding === 'UTF-8') { |
| 266 | - return (string) \mb_substr($str, $pos, 1); |
|
| 266 | + return (string)\mb_substr($str, $pos, 1); |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
| 269 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | /** |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | public static function add_bom_to_string(string $str): string |
| 287 | 287 | { |
| 288 | 288 | if (!self::string_has_bom($str)) { |
| 289 | - $str = self::bom() . $str; |
|
| 289 | + $str = self::bom().$str; |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | return $str; |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | return ''; |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
| 361 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
| 362 | 362 | $end_position = \mb_strpos($str, $end, $substr_index); |
| 363 | 363 | if ( |
| 364 | 364 | $end_position === false |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | return ''; |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
| 371 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | return ''; |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
| 381 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
| 382 | 382 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
| 383 | 383 | if ( |
| 384 | 384 | $end_position === false |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | return ''; |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | - return (string) self::substr( |
|
| 391 | + return (string)self::substr( |
|
| 392 | 392 | $str, |
| 393 | 393 | $substr_index, |
| 394 | 394 | $end_position - $substr_index, |
@@ -472,10 +472,10 @@ discard block |
||
| 472 | 472 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
| 473 | 473 | { |
| 474 | 474 | if ($encoding === 'UTF-8') { |
| 475 | - return (string) \mb_substr($str, $index, 1); |
|
| 475 | + return (string)\mb_substr($str, $index, 1); |
|
| 476 | 476 | } |
| 477 | 477 | |
| 478 | - return (string) self::substr($str, $index, 1, $encoding); |
|
| 478 | + return (string)self::substr($str, $index, 1, $encoding); |
|
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | /** |
@@ -590,14 +590,14 @@ discard block |
||
| 590 | 590 | /** |
| 591 | 591 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 592 | 592 | */ |
| 593 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 593 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 594 | 594 | } |
| 595 | 595 | |
| 596 | 596 | if (!\is_int($code_point) || $code_point <= 0) { |
| 597 | 597 | return null; |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | - $cache_key = $code_point . '_' . $encoding; |
|
| 600 | + $cache_key = $code_point.'_'.$encoding; |
|
| 601 | 601 | if (isset($CHAR_CACHE[$cache_key])) { |
| 602 | 602 | return $CHAR_CACHE[$cache_key]; |
| 603 | 603 | } |
@@ -642,27 +642,27 @@ discard block |
||
| 642 | 642 | self::$CHR = self::getData('chr'); |
| 643 | 643 | } |
| 644 | 644 | |
| 645 | - $code_point = (int) $code_point; |
|
| 645 | + $code_point = (int)$code_point; |
|
| 646 | 646 | if ($code_point <= 0x7FF) { |
| 647 | 647 | /** |
| 648 | 648 | * @psalm-suppress PossiblyNullArrayAccess |
| 649 | 649 | */ |
| 650 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
| 650 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
| 651 | 651 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 652 | 652 | } elseif ($code_point <= 0xFFFF) { |
| 653 | 653 | /** |
| 654 | 654 | * @psalm-suppress PossiblyNullArrayAccess |
| 655 | 655 | */ |
| 656 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
| 657 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 656 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
| 657 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 658 | 658 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 659 | 659 | } else { |
| 660 | 660 | /** |
| 661 | 661 | * @psalm-suppress PossiblyNullArrayAccess |
| 662 | 662 | */ |
| 663 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
| 664 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 665 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 663 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
| 664 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
| 665 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 666 | 666 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 667 | 667 | } |
| 668 | 668 | |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | |
| 720 | 720 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
| 721 | 721 | return \array_map( |
| 722 | - static function (string $data): int { |
|
| 722 | + static function(string $data): int { |
|
| 723 | 723 | // "mb_" is available if overload is used, so use it ... |
| 724 | 724 | return \mb_strlen($data, 'CP850'); // 8-BIT |
| 725 | 725 | }, |
@@ -806,7 +806,7 @@ discard block |
||
| 806 | 806 | $char = ''; |
| 807 | 807 | } |
| 808 | 808 | |
| 809 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
| 809 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
| 810 | 810 | } |
| 811 | 811 | |
| 812 | 812 | /** |
@@ -883,7 +883,7 @@ discard block |
||
| 883 | 883 | | ( [\x80-\xBF] ) # invalid byte in range 10000000 - 10111111 |
| 884 | 884 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
| 885 | 885 | /x'; |
| 886 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
| 886 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
| 887 | 887 | |
| 888 | 888 | if ($replace_diamond_question_mark) { |
| 889 | 889 | $str = self::replace_diamond_question_mark($str); |
@@ -922,7 +922,7 @@ discard block |
||
| 922 | 922 | public static function cleanup($str): string |
| 923 | 923 | { |
| 924 | 924 | // init |
| 925 | - $str = (string) $str; |
|
| 925 | + $str = (string)$str; |
|
| 926 | 926 | |
| 927 | 927 | if ($str === '') { |
| 928 | 928 | return ''; |
@@ -1023,7 +1023,7 @@ discard block |
||
| 1023 | 1023 | public static function collapse_whitespace(string $str): string |
| 1024 | 1024 | { |
| 1025 | 1025 | if (self::$SUPPORT['mbstring'] === true) { |
| 1026 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 1026 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 1027 | 1027 | } |
| 1028 | 1028 | |
| 1029 | 1029 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -1127,9 +1127,9 @@ discard block |
||
| 1127 | 1127 | // - 0-9 (U+0061 - U+007A) |
| 1128 | 1128 | // - ISO 10646 characters U+00A1 and higher |
| 1129 | 1129 | // We strip out any character not in the above list. |
| 1130 | - $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); |
|
| 1130 | + $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); |
|
| 1131 | 1131 | // Identifiers cannot start with a digit, two hyphens, or a hyphen followed by a digit. |
| 1132 | - $str = (string) \preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
| 1132 | + $str = (string)\preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
| 1133 | 1133 | |
| 1134 | 1134 | return \trim($str, '-'); |
| 1135 | 1135 | } |
@@ -1145,7 +1145,7 @@ discard block |
||
| 1145 | 1145 | */ |
| 1146 | 1146 | public static function css_stripe_media_queries(string $str): string |
| 1147 | 1147 | { |
| 1148 | - return (string) \preg_replace( |
|
| 1148 | + return (string)\preg_replace( |
|
| 1149 | 1149 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
| 1150 | 1150 | '', |
| 1151 | 1151 | $str |
@@ -1186,7 +1186,7 @@ discard block |
||
| 1186 | 1186 | { |
| 1187 | 1187 | // We cannot use html_entity_decode() here, as it will not return |
| 1188 | 1188 | // characters for many values < 160. |
| 1189 | - return mb_convert_encoding('&#' . $int . ';', 'UTF-8', 'HTML-ENTITIES'); |
|
| 1189 | + return mb_convert_encoding('&#'.$int.';', 'UTF-8', 'HTML-ENTITIES'); |
|
| 1190 | 1190 | } |
| 1191 | 1191 | |
| 1192 | 1192 | /** |
@@ -1236,7 +1236,7 @@ discard block |
||
| 1236 | 1236 | $flagOffset = 0x1F1E6; |
| 1237 | 1237 | $asciiOffset = 0x41; |
| 1238 | 1238 | |
| 1239 | - return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? '') . |
|
| 1239 | + return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? ''). |
|
| 1240 | 1240 | (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
| 1241 | 1241 | } |
| 1242 | 1242 | |
@@ -1270,16 +1270,16 @@ discard block |
||
| 1270 | 1270 | } |
| 1271 | 1271 | |
| 1272 | 1272 | if ($use_reversible_string_mappings) { |
| 1273 | - return (string) \str_replace( |
|
| 1274 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1275 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1273 | + return (string)\str_replace( |
|
| 1274 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1275 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1276 | 1276 | $str |
| 1277 | 1277 | ); |
| 1278 | 1278 | } |
| 1279 | 1279 | |
| 1280 | - return (string) \str_replace( |
|
| 1281 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 1282 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1280 | + return (string)\str_replace( |
|
| 1281 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 1282 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1283 | 1283 | $str |
| 1284 | 1284 | ); |
| 1285 | 1285 | } |
@@ -1314,16 +1314,16 @@ discard block |
||
| 1314 | 1314 | } |
| 1315 | 1315 | |
| 1316 | 1316 | if ($use_reversible_string_mappings) { |
| 1317 | - return (string) \str_replace( |
|
| 1318 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1319 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1317 | + return (string)\str_replace( |
|
| 1318 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1319 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1320 | 1320 | $str |
| 1321 | 1321 | ); |
| 1322 | 1322 | } |
| 1323 | 1323 | |
| 1324 | - return (string) \str_replace( |
|
| 1325 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1326 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 1324 | + return (string)\str_replace( |
|
| 1325 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1326 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 1327 | 1327 | $str |
| 1328 | 1328 | ); |
| 1329 | 1329 | } |
@@ -1389,7 +1389,7 @@ discard block |
||
| 1389 | 1389 | if ($to_encoding === 'JSON') { |
| 1390 | 1390 | $return = self::json_encode($str); |
| 1391 | 1391 | if ($return === false) { |
| 1392 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
| 1392 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
| 1393 | 1393 | } |
| 1394 | 1394 | |
| 1395 | 1395 | return $return; |
@@ -1478,7 +1478,7 @@ discard block |
||
| 1478 | 1478 | /** |
| 1479 | 1479 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 1480 | 1480 | */ |
| 1481 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
| 1481 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
| 1482 | 1482 | } |
| 1483 | 1483 | |
| 1484 | 1484 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1579,31 +1579,31 @@ discard block |
||
| 1579 | 1579 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
| 1580 | 1580 | |
| 1581 | 1581 | if ($length === null) { |
| 1582 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2); |
|
| 1582 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2); |
|
| 1583 | 1583 | } |
| 1584 | 1584 | |
| 1585 | 1585 | if ($search === '') { |
| 1586 | 1586 | if ($encoding === 'UTF-8') { |
| 1587 | 1587 | if ($length > 0) { |
| 1588 | - $string_length = (int) \mb_strlen($str); |
|
| 1588 | + $string_length = (int)\mb_strlen($str); |
|
| 1589 | 1589 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
| 1590 | 1590 | } else { |
| 1591 | 1591 | $end = 0; |
| 1592 | 1592 | } |
| 1593 | 1593 | |
| 1594 | - $pos = (int) \min( |
|
| 1594 | + $pos = (int)\min( |
|
| 1595 | 1595 | \mb_strpos($str, ' ', $end), |
| 1596 | 1596 | \mb_strpos($str, '.', $end) |
| 1597 | 1597 | ); |
| 1598 | 1598 | } else { |
| 1599 | 1599 | if ($length > 0) { |
| 1600 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 1600 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 1601 | 1601 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
| 1602 | 1602 | } else { |
| 1603 | 1603 | $end = 0; |
| 1604 | 1604 | } |
| 1605 | 1605 | |
| 1606 | - $pos = (int) \min( |
|
| 1606 | + $pos = (int)\min( |
|
| 1607 | 1607 | self::strpos($str, ' ', $end, $encoding), |
| 1608 | 1608 | self::strpos($str, '.', $end, $encoding) |
| 1609 | 1609 | ); |
@@ -1620,18 +1620,18 @@ discard block |
||
| 1620 | 1620 | return ''; |
| 1621 | 1621 | } |
| 1622 | 1622 | |
| 1623 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1623 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1624 | 1624 | } |
| 1625 | 1625 | |
| 1626 | 1626 | return $str; |
| 1627 | 1627 | } |
| 1628 | 1628 | |
| 1629 | 1629 | if ($encoding === 'UTF-8') { |
| 1630 | - $word_position = (int) \mb_stripos($str, $search); |
|
| 1631 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
| 1630 | + $word_position = (int)\mb_stripos($str, $search); |
|
| 1631 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
| 1632 | 1632 | } else { |
| 1633 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
| 1634 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
| 1633 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
| 1634 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
| 1635 | 1635 | } |
| 1636 | 1636 | |
| 1637 | 1637 | $pos_start = 0; |
@@ -1643,12 +1643,12 @@ discard block |
||
| 1643 | 1643 | } |
| 1644 | 1644 | if ($half_text !== false) { |
| 1645 | 1645 | if ($encoding === 'UTF-8') { |
| 1646 | - $pos_start = (int) \max( |
|
| 1646 | + $pos_start = (int)\max( |
|
| 1647 | 1647 | \mb_strrpos($half_text, ' '), |
| 1648 | 1648 | \mb_strrpos($half_text, '.') |
| 1649 | 1649 | ); |
| 1650 | 1650 | } else { |
| 1651 | - $pos_start = (int) \max( |
|
| 1651 | + $pos_start = (int)\max( |
|
| 1652 | 1652 | self::strrpos($half_text, ' ', 0, $encoding), |
| 1653 | 1653 | self::strrpos($half_text, '.', 0, $encoding) |
| 1654 | 1654 | ); |
@@ -1658,19 +1658,19 @@ discard block |
||
| 1658 | 1658 | |
| 1659 | 1659 | if ($word_position && $half_side > 0) { |
| 1660 | 1660 | $offset = $pos_start + $length - 1; |
| 1661 | - $real_length = (int) self::strlen($str, $encoding); |
|
| 1661 | + $real_length = (int)self::strlen($str, $encoding); |
|
| 1662 | 1662 | |
| 1663 | 1663 | if ($offset > $real_length) { |
| 1664 | 1664 | $offset = $real_length; |
| 1665 | 1665 | } |
| 1666 | 1666 | |
| 1667 | 1667 | if ($encoding === 'UTF-8') { |
| 1668 | - $pos_end = (int) \min( |
|
| 1668 | + $pos_end = (int)\min( |
|
| 1669 | 1669 | \mb_strpos($str, ' ', $offset), |
| 1670 | 1670 | \mb_strpos($str, '.', $offset) |
| 1671 | 1671 | ) - $pos_start; |
| 1672 | 1672 | } else { |
| 1673 | - $pos_end = (int) \min( |
|
| 1673 | + $pos_end = (int)\min( |
|
| 1674 | 1674 | self::strpos($str, ' ', $offset, $encoding), |
| 1675 | 1675 | self::strpos($str, '.', $offset, $encoding) |
| 1676 | 1676 | ) - $pos_start; |
@@ -1678,12 +1678,12 @@ discard block |
||
| 1678 | 1678 | |
| 1679 | 1679 | if (!$pos_end || $pos_end <= 0) { |
| 1680 | 1680 | if ($encoding === 'UTF-8') { |
| 1681 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
| 1681 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
| 1682 | 1682 | } else { |
| 1683 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
| 1683 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
| 1684 | 1684 | } |
| 1685 | 1685 | if ($str_sub !== false) { |
| 1686 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
| 1686 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
| 1687 | 1687 | } else { |
| 1688 | 1688 | $extract = ''; |
| 1689 | 1689 | } |
@@ -1694,26 +1694,26 @@ discard block |
||
| 1694 | 1694 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
| 1695 | 1695 | } |
| 1696 | 1696 | if ($str_sub !== false) { |
| 1697 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1697 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1698 | 1698 | } else { |
| 1699 | 1699 | $extract = ''; |
| 1700 | 1700 | } |
| 1701 | 1701 | } |
| 1702 | 1702 | } else { |
| 1703 | 1703 | $offset = $length - 1; |
| 1704 | - $true_length = (int) self::strlen($str, $encoding); |
|
| 1704 | + $true_length = (int)self::strlen($str, $encoding); |
|
| 1705 | 1705 | |
| 1706 | 1706 | if ($offset > $true_length) { |
| 1707 | 1707 | $offset = $true_length; |
| 1708 | 1708 | } |
| 1709 | 1709 | |
| 1710 | 1710 | if ($encoding === 'UTF-8') { |
| 1711 | - $pos_end = (int) \min( |
|
| 1711 | + $pos_end = (int)\min( |
|
| 1712 | 1712 | \mb_strpos($str, ' ', $offset), |
| 1713 | 1713 | \mb_strpos($str, '.', $offset) |
| 1714 | 1714 | ); |
| 1715 | 1715 | } else { |
| 1716 | - $pos_end = (int) \min( |
|
| 1716 | + $pos_end = (int)\min( |
|
| 1717 | 1717 | self::strpos($str, ' ', $offset, $encoding), |
| 1718 | 1718 | self::strpos($str, '.', $offset, $encoding) |
| 1719 | 1719 | ); |
@@ -1726,7 +1726,7 @@ discard block |
||
| 1726 | 1726 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
| 1727 | 1727 | } |
| 1728 | 1728 | if ($str_sub !== false) { |
| 1729 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1729 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1730 | 1730 | } else { |
| 1731 | 1731 | $extract = ''; |
| 1732 | 1732 | } |
@@ -1857,7 +1857,7 @@ discard block |
||
| 1857 | 1857 | { |
| 1858 | 1858 | $file_content = \file_get_contents($file_path); |
| 1859 | 1859 | if ($file_content === false) { |
| 1860 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
| 1860 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
| 1861 | 1861 | } |
| 1862 | 1862 | |
| 1863 | 1863 | return self::string_has_bom($file_content); |
@@ -1925,7 +1925,7 @@ discard block |
||
| 1925 | 1925 | ) { |
| 1926 | 1926 | // Prevent leading combining chars |
| 1927 | 1927 | // for NFC-safe concatenations. |
| 1928 | - $var = $leading_combining . $var; |
|
| 1928 | + $var = $leading_combining.$var; |
|
| 1929 | 1929 | } |
| 1930 | 1930 | } |
| 1931 | 1931 | |
@@ -2246,10 +2246,10 @@ discard block |
||
| 2246 | 2246 | } |
| 2247 | 2247 | |
| 2248 | 2248 | if ($encoding === 'UTF-8') { |
| 2249 | - return (string) \mb_substr($str, 0, $n); |
|
| 2249 | + return (string)\mb_substr($str, 0, $n); |
|
| 2250 | 2250 | } |
| 2251 | 2251 | |
| 2252 | - return (string) self::substr($str, 0, $n, $encoding); |
|
| 2252 | + return (string)self::substr($str, 0, $n, $encoding); |
|
| 2253 | 2253 | } |
| 2254 | 2254 | |
| 2255 | 2255 | /** |
@@ -2267,7 +2267,7 @@ discard block |
||
| 2267 | 2267 | */ |
| 2268 | 2268 | public static function fits_inside(string $str, int $box_size): bool |
| 2269 | 2269 | { |
| 2270 | - return (int) self::strlen($str) <= $box_size; |
|
| 2270 | + return (int)self::strlen($str) <= $box_size; |
|
| 2271 | 2271 | } |
| 2272 | 2272 | |
| 2273 | 2273 | /** |
@@ -2352,7 +2352,7 @@ discard block |
||
| 2352 | 2352 | return $str; |
| 2353 | 2353 | } |
| 2354 | 2354 | |
| 2355 | - $str = (string) $str; |
|
| 2355 | + $str = (string)$str; |
|
| 2356 | 2356 | $last = ''; |
| 2357 | 2357 | while ($last !== $str) { |
| 2358 | 2358 | $last = $str; |
@@ -2555,7 +2555,7 @@ discard block |
||
| 2555 | 2555 | if ($str_info === false) { |
| 2556 | 2556 | return $fallback; |
| 2557 | 2557 | } |
| 2558 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
| 2558 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
| 2559 | 2559 | |
| 2560 | 2560 | // DEBUG |
| 2561 | 2561 | //var_dump($type_code); |
@@ -2613,7 +2613,7 @@ discard block |
||
| 2613 | 2613 | // |
| 2614 | 2614 | |
| 2615 | 2615 | if ($encoding === 'UTF-8') { |
| 2616 | - $max_length = (int) \mb_strlen($possible_chars); |
|
| 2616 | + $max_length = (int)\mb_strlen($possible_chars); |
|
| 2617 | 2617 | if ($max_length === 0) { |
| 2618 | 2618 | return ''; |
| 2619 | 2619 | } |
@@ -2633,7 +2633,7 @@ discard block |
||
| 2633 | 2633 | } else { |
| 2634 | 2634 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 2635 | 2635 | |
| 2636 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
| 2636 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
| 2637 | 2637 | if ($max_length === 0) { |
| 2638 | 2638 | return ''; |
| 2639 | 2639 | } |
@@ -2669,16 +2669,16 @@ discard block |
||
| 2669 | 2669 | $rand_int = \mt_rand(0, \mt_getrandmax()); |
| 2670 | 2670 | } |
| 2671 | 2671 | |
| 2672 | - $unique_helper = $rand_int . |
|
| 2673 | - \session_id() . |
|
| 2674 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2675 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2672 | + $unique_helper = $rand_int. |
|
| 2673 | + \session_id(). |
|
| 2674 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
| 2675 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
| 2676 | 2676 | $extra_entropy; |
| 2677 | 2677 | |
| 2678 | 2678 | $unique_string = \uniqid($unique_helper, true); |
| 2679 | 2679 | |
| 2680 | 2680 | if ($use_md5) { |
| 2681 | - $unique_string = \md5($unique_string . $unique_helper); |
|
| 2681 | + $unique_string = \md5($unique_string.$unique_helper); |
|
| 2682 | 2682 | } |
| 2683 | 2683 | |
| 2684 | 2684 | return $unique_string; |
@@ -2757,7 +2757,7 @@ discard block |
||
| 2757 | 2757 | public static function hex_to_chr(string $hexdec) |
| 2758 | 2758 | { |
| 2759 | 2759 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Invalid characters passed for attempted conversion, these have been ignored */ |
| 2760 | - return self::decimal_to_chr((int) @\hexdec($hexdec)); |
|
| 2760 | + return self::decimal_to_chr((int)@\hexdec($hexdec)); |
|
| 2761 | 2761 | } |
| 2762 | 2762 | |
| 2763 | 2763 | /** |
@@ -2777,7 +2777,7 @@ discard block |
||
| 2777 | 2777 | public static function hex_to_int($hexdec) |
| 2778 | 2778 | { |
| 2779 | 2779 | // init |
| 2780 | - $hexdec = (string) $hexdec; |
|
| 2780 | + $hexdec = (string)$hexdec; |
|
| 2781 | 2781 | |
| 2782 | 2782 | if ($hexdec === '') { |
| 2783 | 2783 | return false; |
@@ -2855,7 +2855,7 @@ discard block |
||
| 2855 | 2855 | return \implode( |
| 2856 | 2856 | '', |
| 2857 | 2857 | \array_map( |
| 2858 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
| 2858 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
| 2859 | 2859 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
| 2860 | 2860 | }, |
| 2861 | 2861 | self::str_split($str) |
@@ -2969,7 +2969,7 @@ discard block |
||
| 2969 | 2969 | /** |
| 2970 | 2970 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 2971 | 2971 | */ |
| 2972 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 2972 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 2973 | 2973 | } |
| 2974 | 2974 | |
| 2975 | 2975 | do { |
@@ -2978,7 +2978,7 @@ discard block |
||
| 2978 | 2978 | if (\strpos($str, '&') !== false) { |
| 2979 | 2979 | if (\strpos($str, '&#') !== false) { |
| 2980 | 2980 | // decode also numeric & UTF16 two byte entities |
| 2981 | - $str = (string) \preg_replace( |
|
| 2981 | + $str = (string)\preg_replace( |
|
| 2982 | 2982 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
| 2983 | 2983 | '$1;', |
| 2984 | 2984 | $str |
@@ -3028,7 +3028,7 @@ discard block |
||
| 3028 | 3028 | */ |
| 3029 | 3029 | public static function html_stripe_empty_tags(string $str): string |
| 3030 | 3030 | { |
| 3031 | - return (string) \preg_replace( |
|
| 3031 | + return (string)\preg_replace( |
|
| 3032 | 3032 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
| 3033 | 3033 | '', |
| 3034 | 3034 | $str |
@@ -3339,9 +3339,9 @@ discard block |
||
| 3339 | 3339 | { |
| 3340 | 3340 | $hex = \dechex($int); |
| 3341 | 3341 | |
| 3342 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
| 3342 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
| 3343 | 3343 | |
| 3344 | - return $prefix . $hex . ''; |
|
| 3344 | + return $prefix.$hex.''; |
|
| 3345 | 3345 | } |
| 3346 | 3346 | |
| 3347 | 3347 | /** |
@@ -3509,7 +3509,7 @@ discard block |
||
| 3509 | 3509 | */ |
| 3510 | 3510 | public static function is_binary($input, bool $strict = false): bool |
| 3511 | 3511 | { |
| 3512 | - $input = (string) $input; |
|
| 3512 | + $input = (string)$input; |
|
| 3513 | 3513 | if ($input === '') { |
| 3514 | 3514 | return false; |
| 3515 | 3515 | } |
@@ -3861,7 +3861,7 @@ discard block |
||
| 3861 | 3861 | public static function is_utf16($str, bool $check_if_string_is_binary = true) |
| 3862 | 3862 | { |
| 3863 | 3863 | // init |
| 3864 | - $str = (string) $str; |
|
| 3864 | + $str = (string)$str; |
|
| 3865 | 3865 | $str_chars = []; |
| 3866 | 3866 | |
| 3867 | 3867 | // fix for the "binary"-check |
@@ -3960,7 +3960,7 @@ discard block |
||
| 3960 | 3960 | public static function is_utf32($str, bool $check_if_string_is_binary = true) |
| 3961 | 3961 | { |
| 3962 | 3962 | // init |
| 3963 | - $str = (string) $str; |
|
| 3963 | + $str = (string)$str; |
|
| 3964 | 3964 | $str_chars = []; |
| 3965 | 3965 | |
| 3966 | 3966 | if ( |
@@ -4058,7 +4058,7 @@ discard block |
||
| 4058 | 4058 | return true; |
| 4059 | 4059 | } |
| 4060 | 4060 | |
| 4061 | - return self::is_utf8_string((string) $str, $strict); |
|
| 4061 | + return self::is_utf8_string((string)$str, $strict); |
|
| 4062 | 4062 | } |
| 4063 | 4063 | |
| 4064 | 4064 | /** |
@@ -4214,15 +4214,15 @@ discard block |
||
| 4214 | 4214 | $use_mb_functions = ($lang === null && !$try_to_keep_the_string_length); |
| 4215 | 4215 | |
| 4216 | 4216 | if ($encoding === 'UTF-8') { |
| 4217 | - $str_part_two = (string) \mb_substr($str, 1); |
|
| 4217 | + $str_part_two = (string)\mb_substr($str, 1); |
|
| 4218 | 4218 | |
| 4219 | 4219 | if ($use_mb_functions) { |
| 4220 | 4220 | $str_part_one = \mb_strtolower( |
| 4221 | - (string) \mb_substr($str, 0, 1) |
|
| 4221 | + (string)\mb_substr($str, 0, 1) |
|
| 4222 | 4222 | ); |
| 4223 | 4223 | } else { |
| 4224 | 4224 | $str_part_one = self::strtolower( |
| 4225 | - (string) \mb_substr($str, 0, 1), |
|
| 4225 | + (string)\mb_substr($str, 0, 1), |
|
| 4226 | 4226 | $encoding, |
| 4227 | 4227 | false, |
| 4228 | 4228 | $lang, |
@@ -4232,10 +4232,10 @@ discard block |
||
| 4232 | 4232 | } else { |
| 4233 | 4233 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4234 | 4234 | |
| 4235 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
| 4235 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
| 4236 | 4236 | |
| 4237 | 4237 | $str_part_one = self::strtolower( |
| 4238 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 4238 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 4239 | 4239 | $encoding, |
| 4240 | 4240 | false, |
| 4241 | 4241 | $lang, |
@@ -4243,7 +4243,7 @@ discard block |
||
| 4243 | 4243 | ); |
| 4244 | 4244 | } |
| 4245 | 4245 | |
| 4246 | - return $str_part_one . $str_part_two; |
|
| 4246 | + return $str_part_one.$str_part_two; |
|
| 4247 | 4247 | } |
| 4248 | 4248 | |
| 4249 | 4249 | /** |
@@ -4327,7 +4327,7 @@ discard block |
||
| 4327 | 4327 | $pattern = '^[\\s]+'; |
| 4328 | 4328 | } |
| 4329 | 4329 | |
| 4330 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 4330 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 4331 | 4331 | } |
| 4332 | 4332 | |
| 4333 | 4333 | if ($chars !== null) { |
@@ -4364,7 +4364,7 @@ discard block |
||
| 4364 | 4364 | |
| 4365 | 4365 | $codepoint_max = \max($codepoints); |
| 4366 | 4366 | |
| 4367 | - return self::chr((int) $codepoint_max); |
|
| 4367 | + return self::chr((int)$codepoint_max); |
|
| 4368 | 4368 | } |
| 4369 | 4369 | |
| 4370 | 4370 | /** |
@@ -4384,7 +4384,7 @@ discard block |
||
| 4384 | 4384 | { |
| 4385 | 4385 | $bytes = self::chr_size_list($str); |
| 4386 | 4386 | if ($bytes !== []) { |
| 4387 | - return (int) \max($bytes); |
|
| 4387 | + return (int)\max($bytes); |
|
| 4388 | 4388 | } |
| 4389 | 4389 | |
| 4390 | 4390 | return 0; |
@@ -4430,7 +4430,7 @@ discard block |
||
| 4430 | 4430 | |
| 4431 | 4431 | $codepoint_min = \min($codepoints); |
| 4432 | 4432 | |
| 4433 | - return self::chr((int) $codepoint_min); |
|
| 4433 | + return self::chr((int)$codepoint_min); |
|
| 4434 | 4434 | } |
| 4435 | 4435 | |
| 4436 | 4436 | /** |
@@ -4460,7 +4460,7 @@ discard block |
||
| 4460 | 4460 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
| 4461 | 4461 | |
| 4462 | 4462 | // init |
| 4463 | - $encoding = (string) $encoding; |
|
| 4463 | + $encoding = (string)$encoding; |
|
| 4464 | 4464 | |
| 4465 | 4465 | if (!$encoding) { |
| 4466 | 4466 | return $fallback; |
@@ -4522,7 +4522,7 @@ discard block |
||
| 4522 | 4522 | |
| 4523 | 4523 | $encoding_original = $encoding; |
| 4524 | 4524 | $encoding = \strtoupper($encoding); |
| 4525 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
| 4525 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
| 4526 | 4526 | |
| 4527 | 4527 | $equivalences = [ |
| 4528 | 4528 | 'ISO8859' => 'ISO-8859-1', |
@@ -4689,13 +4689,13 @@ discard block |
||
| 4689 | 4689 | static $CHAR_CACHE = []; |
| 4690 | 4690 | |
| 4691 | 4691 | // init |
| 4692 | - $chr = (string) $chr; |
|
| 4692 | + $chr = (string)$chr; |
|
| 4693 | 4693 | |
| 4694 | 4694 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
| 4695 | 4695 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4696 | 4696 | } |
| 4697 | 4697 | |
| 4698 | - $cache_key = $chr . '_' . $encoding; |
|
| 4698 | + $cache_key = $chr.'_'.$encoding; |
|
| 4699 | 4699 | if (isset($CHAR_CACHE[$cache_key])) { |
| 4700 | 4700 | return $CHAR_CACHE[$cache_key]; |
| 4701 | 4701 | } |
@@ -4728,7 +4728,7 @@ discard block |
||
| 4728 | 4728 | // fallback via vanilla php |
| 4729 | 4729 | // |
| 4730 | 4730 | |
| 4731 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
| 4731 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
| 4732 | 4732 | /** @noinspection PhpSillyAssignmentInspection - hack for phpstan */ |
| 4733 | 4733 | /** @var int[] $chr - "unpack": only false if the format string contains errors */ |
| 4734 | 4734 | $chr = $chr; |
@@ -4805,7 +4805,7 @@ discard block |
||
| 4805 | 4805 | public static function pcre_utf8_support(): bool |
| 4806 | 4806 | { |
| 4807 | 4807 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 4808 | - return (bool) @\preg_match('//u', ''); |
|
| 4808 | + return (bool)@\preg_match('//u', ''); |
|
| 4809 | 4809 | } |
| 4810 | 4810 | |
| 4811 | 4811 | /** |
@@ -4846,14 +4846,14 @@ discard block |
||
| 4846 | 4846 | * @psalm-suppress DocblockTypeContradiction |
| 4847 | 4847 | */ |
| 4848 | 4848 | if (!\is_numeric($step)) { |
| 4849 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
| 4849 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
| 4850 | 4850 | } |
| 4851 | 4851 | |
| 4852 | 4852 | /** |
| 4853 | 4853 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
| 4854 | 4854 | */ |
| 4855 | 4855 | if ($step <= 0) { |
| 4856 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
| 4856 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
| 4857 | 4857 | } |
| 4858 | 4858 | } |
| 4859 | 4859 | |
@@ -4864,16 +4864,16 @@ discard block |
||
| 4864 | 4864 | $is_digit = false; |
| 4865 | 4865 | $is_xdigit = false; |
| 4866 | 4866 | |
| 4867 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
| 4867 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
| 4868 | 4868 | $is_digit = true; |
| 4869 | - $start = (int) $var1; |
|
| 4869 | + $start = (int)$var1; |
|
| 4870 | 4870 | } elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
| 4871 | 4871 | $is_xdigit = true; |
| 4872 | - $start = (int) self::hex_to_int((string) $var1); |
|
| 4872 | + $start = (int)self::hex_to_int((string)$var1); |
|
| 4873 | 4873 | } elseif (!$use_ctype && \is_numeric($var1)) { |
| 4874 | - $start = (int) $var1; |
|
| 4874 | + $start = (int)$var1; |
|
| 4875 | 4875 | } else { |
| 4876 | - $start = self::ord((string) $var1); |
|
| 4876 | + $start = self::ord((string)$var1); |
|
| 4877 | 4877 | } |
| 4878 | 4878 | |
| 4879 | 4879 | if (!$start) { |
@@ -4881,13 +4881,13 @@ discard block |
||
| 4881 | 4881 | } |
| 4882 | 4882 | |
| 4883 | 4883 | if ($is_digit) { |
| 4884 | - $end = (int) $var2; |
|
| 4884 | + $end = (int)$var2; |
|
| 4885 | 4885 | } elseif ($is_xdigit) { |
| 4886 | - $end = (int) self::hex_to_int((string) $var2); |
|
| 4886 | + $end = (int)self::hex_to_int((string)$var2); |
|
| 4887 | 4887 | } elseif (!$use_ctype && \is_numeric($var2)) { |
| 4888 | - $end = (int) $var2; |
|
| 4888 | + $end = (int)$var2; |
|
| 4889 | 4889 | } else { |
| 4890 | - $end = self::ord((string) $var2); |
|
| 4890 | + $end = self::ord((string)$var2); |
|
| 4891 | 4891 | } |
| 4892 | 4892 | |
| 4893 | 4893 | if (!$end) { |
@@ -4896,7 +4896,7 @@ discard block |
||
| 4896 | 4896 | |
| 4897 | 4897 | $array = []; |
| 4898 | 4898 | foreach (\range($start, $end, $step) as $i) { |
| 4899 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
| 4899 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
| 4900 | 4900 | } |
| 4901 | 4901 | |
| 4902 | 4902 | return $array; |
@@ -4992,8 +4992,8 @@ discard block |
||
| 4992 | 4992 | $delimiter = '/'; |
| 4993 | 4993 | } |
| 4994 | 4994 | |
| 4995 | - return (string) \preg_replace( |
|
| 4996 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
| 4995 | + return (string)\preg_replace( |
|
| 4996 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
| 4997 | 4997 | $replacement, |
| 4998 | 4998 | $str |
| 4999 | 4999 | ); |
@@ -5028,7 +5028,7 @@ discard block |
||
| 5028 | 5028 | |
| 5029 | 5029 | $str_length -= $bom_byte_length; |
| 5030 | 5030 | |
| 5031 | - $str = (string) $str_tmp; |
|
| 5031 | + $str = (string)$str_tmp; |
|
| 5032 | 5032 | } |
| 5033 | 5033 | } |
| 5034 | 5034 | |
@@ -5059,7 +5059,7 @@ discard block |
||
| 5059 | 5059 | */ |
| 5060 | 5060 | if (\is_array($what)) { |
| 5061 | 5061 | foreach ($what as $item) { |
| 5062 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
| 5062 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
| 5063 | 5063 | } |
| 5064 | 5064 | } |
| 5065 | 5065 | |
@@ -5097,7 +5097,7 @@ discard block |
||
| 5097 | 5097 | */ |
| 5098 | 5098 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
| 5099 | 5099 | { |
| 5100 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 5100 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 5101 | 5101 | } |
| 5102 | 5102 | |
| 5103 | 5103 | /** |
@@ -5161,17 +5161,17 @@ discard block |
||
| 5161 | 5161 | \strpos($str, $substring) === 0 |
| 5162 | 5162 | ) { |
| 5163 | 5163 | if ($encoding === 'UTF-8') { |
| 5164 | - return (string) \mb_substr( |
|
| 5164 | + return (string)\mb_substr( |
|
| 5165 | 5165 | $str, |
| 5166 | - (int) \mb_strlen($substring) |
|
| 5166 | + (int)\mb_strlen($substring) |
|
| 5167 | 5167 | ); |
| 5168 | 5168 | } |
| 5169 | 5169 | |
| 5170 | 5170 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5171 | 5171 | |
| 5172 | - return (string) self::substr( |
|
| 5172 | + return (string)self::substr( |
|
| 5173 | 5173 | $str, |
| 5174 | - (int) self::strlen($substring, $encoding), |
|
| 5174 | + (int)self::strlen($substring, $encoding), |
|
| 5175 | 5175 | null, |
| 5176 | 5176 | $encoding |
| 5177 | 5177 | ); |
@@ -5199,19 +5199,19 @@ discard block |
||
| 5199 | 5199 | ): string { |
| 5200 | 5200 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
| 5201 | 5201 | if ($encoding === 'UTF-8') { |
| 5202 | - return (string) \mb_substr( |
|
| 5202 | + return (string)\mb_substr( |
|
| 5203 | 5203 | $str, |
| 5204 | 5204 | 0, |
| 5205 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
| 5205 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
| 5206 | 5206 | ); |
| 5207 | 5207 | } |
| 5208 | 5208 | |
| 5209 | 5209 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5210 | 5210 | |
| 5211 | - return (string) self::substr( |
|
| 5211 | + return (string)self::substr( |
|
| 5212 | 5212 | $str, |
| 5213 | 5213 | 0, |
| 5214 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
| 5214 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
| 5215 | 5215 | $encoding |
| 5216 | 5216 | ); |
| 5217 | 5217 | } |
@@ -5314,7 +5314,7 @@ discard block |
||
| 5314 | 5314 | /** @noinspection PhpUsageOfSilenceOperatorInspection - ignore "Unknown character" warnings, it's working anyway */ |
| 5315 | 5315 | @\mb_substitute_character($replacement_char_helper); |
| 5316 | 5316 | // the polyfill maybe return false, so cast to string |
| 5317 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 5317 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 5318 | 5318 | \mb_substitute_character($save); |
| 5319 | 5319 | } |
| 5320 | 5320 | |
@@ -5359,7 +5359,7 @@ discard block |
||
| 5359 | 5359 | $pattern = '[\\s]+$'; |
| 5360 | 5360 | } |
| 5361 | 5361 | |
| 5362 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 5362 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 5363 | 5363 | } |
| 5364 | 5364 | |
| 5365 | 5365 | if ($chars !== null) { |
@@ -5388,7 +5388,7 @@ discard block |
||
| 5388 | 5388 | |
| 5389 | 5389 | $html .= '<pre>'; |
| 5390 | 5390 | foreach (self::$SUPPORT as $key => &$value) { |
| 5391 | - $html .= $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
| 5391 | + $html .= $key.' - '.\print_r($value, true)."\n<br>"; |
|
| 5392 | 5392 | } |
| 5393 | 5393 | $html .= '</pre>'; |
| 5394 | 5394 | |
@@ -5430,7 +5430,7 @@ discard block |
||
| 5430 | 5430 | return $char; |
| 5431 | 5431 | } |
| 5432 | 5432 | |
| 5433 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
| 5433 | + return '&#'.self::ord($char, $encoding).';'; |
|
| 5434 | 5434 | } |
| 5435 | 5435 | |
| 5436 | 5436 | /** |
@@ -5493,11 +5493,11 @@ discard block |
||
| 5493 | 5493 | $lang, |
| 5494 | 5494 | $try_to_keep_the_string_length |
| 5495 | 5495 | ); |
| 5496 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
| 5496 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
| 5497 | 5497 | |
| 5498 | 5498 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 5499 | 5499 | |
| 5500 | - $str = (string) \preg_replace_callback( |
|
| 5500 | + $str = (string)\preg_replace_callback( |
|
| 5501 | 5501 | '/[-_\\s]+(.)?/u', |
| 5502 | 5502 | /** |
| 5503 | 5503 | * @param array $match |
@@ -5506,7 +5506,7 @@ discard block |
||
| 5506 | 5506 | * |
| 5507 | 5507 | * @return string |
| 5508 | 5508 | */ |
| 5509 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
| 5509 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
| 5510 | 5510 | if (isset($match[1])) { |
| 5511 | 5511 | if ($use_mb_functions) { |
| 5512 | 5512 | if ($encoding === 'UTF-8') { |
@@ -5524,7 +5524,7 @@ discard block |
||
| 5524 | 5524 | $str |
| 5525 | 5525 | ); |
| 5526 | 5526 | |
| 5527 | - return (string) \preg_replace_callback( |
|
| 5527 | + return (string)\preg_replace_callback( |
|
| 5528 | 5528 | '/[\\p{N}]+(.)?/u', |
| 5529 | 5529 | /** |
| 5530 | 5530 | * @param array $match |
@@ -5533,7 +5533,7 @@ discard block |
||
| 5533 | 5533 | * |
| 5534 | 5534 | * @return string |
| 5535 | 5535 | */ |
| 5536 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
| 5536 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
| 5537 | 5537 | if ($use_mb_functions) { |
| 5538 | 5538 | if ($encoding === 'UTF-8') { |
| 5539 | 5539 | return \mb_strtoupper($match[0]); |
@@ -5728,7 +5728,7 @@ discard block |
||
| 5728 | 5728 | bool $try_to_keep_the_string_length = false |
| 5729 | 5729 | ): string { |
| 5730 | 5730 | if (self::$SUPPORT['mbstring'] === true) { |
| 5731 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
| 5731 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
| 5732 | 5732 | |
| 5733 | 5733 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 5734 | 5734 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -5737,10 +5737,10 @@ discard block |
||
| 5737 | 5737 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
| 5738 | 5738 | } |
| 5739 | 5739 | |
| 5740 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
| 5740 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
| 5741 | 5741 | } |
| 5742 | 5742 | |
| 5743 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
| 5743 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
| 5744 | 5744 | |
| 5745 | 5745 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 5746 | 5746 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -5749,7 +5749,7 @@ discard block |
||
| 5749 | 5749 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
| 5750 | 5750 | } |
| 5751 | 5751 | |
| 5752 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
| 5752 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
| 5753 | 5753 | } |
| 5754 | 5754 | |
| 5755 | 5755 | /** |
@@ -5773,7 +5773,7 @@ discard block |
||
| 5773 | 5773 | public static function str_detect_encoding($str) |
| 5774 | 5774 | { |
| 5775 | 5775 | // init |
| 5776 | - $str = (string) $str; |
|
| 5776 | + $str = (string)$str; |
|
| 5777 | 5777 | |
| 5778 | 5778 | // |
| 5779 | 5779 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5875,7 +5875,7 @@ discard block |
||
| 5875 | 5875 | foreach (self::$ENCODINGS as $encoding_tmp) { |
| 5876 | 5876 | // INFO: //IGNORE but still throw notice |
| 5877 | 5877 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 5878 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
| 5878 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
| 5879 | 5879 | return $encoding_tmp; |
| 5880 | 5880 | } |
| 5881 | 5881 | } |
@@ -5965,7 +5965,7 @@ discard block |
||
| 5965 | 5965 | return $str; |
| 5966 | 5966 | } |
| 5967 | 5967 | |
| 5968 | - return $substring . $str; |
|
| 5968 | + return $substring.$str; |
|
| 5969 | 5969 | } |
| 5970 | 5970 | |
| 5971 | 5971 | /** |
@@ -6095,27 +6095,27 @@ discard block |
||
| 6095 | 6095 | string $encoding = 'UTF-8' |
| 6096 | 6096 | ): string { |
| 6097 | 6097 | if ($encoding === 'UTF-8') { |
| 6098 | - $len = (int) \mb_strlen($str); |
|
| 6098 | + $len = (int)\mb_strlen($str); |
|
| 6099 | 6099 | if ($index > $len) { |
| 6100 | 6100 | return $str; |
| 6101 | 6101 | } |
| 6102 | 6102 | |
| 6103 | 6103 | /** @noinspection UnnecessaryCastingInspection */ |
| 6104 | - return (string) \mb_substr($str, 0, $index) . |
|
| 6105 | - $substring . |
|
| 6106 | - (string) \mb_substr($str, $index, $len); |
|
| 6104 | + return (string)\mb_substr($str, 0, $index). |
|
| 6105 | + $substring. |
|
| 6106 | + (string)\mb_substr($str, $index, $len); |
|
| 6107 | 6107 | } |
| 6108 | 6108 | |
| 6109 | 6109 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6110 | 6110 | |
| 6111 | - $len = (int) self::strlen($str, $encoding); |
|
| 6111 | + $len = (int)self::strlen($str, $encoding); |
|
| 6112 | 6112 | if ($index > $len) { |
| 6113 | 6113 | return $str; |
| 6114 | 6114 | } |
| 6115 | 6115 | |
| 6116 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
| 6117 | - $substring . |
|
| 6118 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
| 6116 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
| 6117 | + $substring. |
|
| 6118 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
| 6119 | 6119 | } |
| 6120 | 6120 | |
| 6121 | 6121 | /** |
@@ -6155,15 +6155,15 @@ discard block |
||
| 6155 | 6155 | */ |
| 6156 | 6156 | public static function str_ireplace($search, $replacement, $subject, &$count = null) |
| 6157 | 6157 | { |
| 6158 | - $search = (array) $search; |
|
| 6158 | + $search = (array)$search; |
|
| 6159 | 6159 | |
| 6160 | 6160 | /** @noinspection AlterInForeachInspection */ |
| 6161 | 6161 | foreach ($search as &$s) { |
| 6162 | - $s = (string) $s; |
|
| 6162 | + $s = (string)$s; |
|
| 6163 | 6163 | if ($s === '') { |
| 6164 | 6164 | $s = '/^(?<=.)$/'; |
| 6165 | 6165 | } else { |
| 6166 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
| 6166 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
| 6167 | 6167 | } |
| 6168 | 6168 | } |
| 6169 | 6169 | |
@@ -6211,12 +6211,12 @@ discard block |
||
| 6211 | 6211 | } |
| 6212 | 6212 | |
| 6213 | 6213 | if ($search === '') { |
| 6214 | - return $str . $replacement; |
|
| 6214 | + return $str.$replacement; |
|
| 6215 | 6215 | } |
| 6216 | 6216 | |
| 6217 | 6217 | $searchLength = \strlen($search); |
| 6218 | 6218 | if (\strncasecmp($str, $search, $searchLength) === 0) { |
| 6219 | - return $replacement . \substr($str, $searchLength); |
|
| 6219 | + return $replacement.\substr($str, $searchLength); |
|
| 6220 | 6220 | } |
| 6221 | 6221 | |
| 6222 | 6222 | return $str; |
@@ -6247,11 +6247,11 @@ discard block |
||
| 6247 | 6247 | } |
| 6248 | 6248 | |
| 6249 | 6249 | if ($search === '') { |
| 6250 | - return $str . $replacement; |
|
| 6250 | + return $str.$replacement; |
|
| 6251 | 6251 | } |
| 6252 | 6252 | |
| 6253 | 6253 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 6254 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 6254 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 6255 | 6255 | } |
| 6256 | 6256 | |
| 6257 | 6257 | return $str; |
@@ -6343,15 +6343,15 @@ discard block |
||
| 6343 | 6343 | } |
| 6344 | 6344 | |
| 6345 | 6345 | if ($encoding === 'UTF-8') { |
| 6346 | - return (string) \mb_substr( |
|
| 6346 | + return (string)\mb_substr( |
|
| 6347 | 6347 | $str, |
| 6348 | - $offset + (int) \mb_strlen($separator) |
|
| 6348 | + $offset + (int)\mb_strlen($separator) |
|
| 6349 | 6349 | ); |
| 6350 | 6350 | } |
| 6351 | 6351 | |
| 6352 | - return (string) self::substr( |
|
| 6352 | + return (string)self::substr( |
|
| 6353 | 6353 | $str, |
| 6354 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6354 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6355 | 6355 | null, |
| 6356 | 6356 | $encoding |
| 6357 | 6357 | ); |
@@ -6383,15 +6383,15 @@ discard block |
||
| 6383 | 6383 | } |
| 6384 | 6384 | |
| 6385 | 6385 | if ($encoding === 'UTF-8') { |
| 6386 | - return (string) \mb_substr( |
|
| 6386 | + return (string)\mb_substr( |
|
| 6387 | 6387 | $str, |
| 6388 | - $offset + (int) self::strlen($separator) |
|
| 6388 | + $offset + (int)self::strlen($separator) |
|
| 6389 | 6389 | ); |
| 6390 | 6390 | } |
| 6391 | 6391 | |
| 6392 | - return (string) self::substr( |
|
| 6392 | + return (string)self::substr( |
|
| 6393 | 6393 | $str, |
| 6394 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6394 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6395 | 6395 | null, |
| 6396 | 6396 | $encoding |
| 6397 | 6397 | ); |
@@ -6423,10 +6423,10 @@ discard block |
||
| 6423 | 6423 | } |
| 6424 | 6424 | |
| 6425 | 6425 | if ($encoding === 'UTF-8') { |
| 6426 | - return (string) \mb_substr($str, 0, $offset); |
|
| 6426 | + return (string)\mb_substr($str, 0, $offset); |
|
| 6427 | 6427 | } |
| 6428 | 6428 | |
| 6429 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 6429 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 6430 | 6430 | } |
| 6431 | 6431 | |
| 6432 | 6432 | /** |
@@ -6455,7 +6455,7 @@ discard block |
||
| 6455 | 6455 | return ''; |
| 6456 | 6456 | } |
| 6457 | 6457 | |
| 6458 | - return (string) \mb_substr($str, 0, $offset); |
|
| 6458 | + return (string)\mb_substr($str, 0, $offset); |
|
| 6459 | 6459 | } |
| 6460 | 6460 | |
| 6461 | 6461 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6463,7 +6463,7 @@ discard block |
||
| 6463 | 6463 | return ''; |
| 6464 | 6464 | } |
| 6465 | 6465 | |
| 6466 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 6466 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 6467 | 6467 | } |
| 6468 | 6468 | |
| 6469 | 6469 | /** |
@@ -6565,12 +6565,12 @@ discard block |
||
| 6565 | 6565 | } |
| 6566 | 6566 | |
| 6567 | 6567 | if ($encoding === 'UTF-8') { |
| 6568 | - return (string) \mb_substr($str, -$n); |
|
| 6568 | + return (string)\mb_substr($str, -$n); |
|
| 6569 | 6569 | } |
| 6570 | 6570 | |
| 6571 | 6571 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6572 | 6572 | |
| 6573 | - return (string) self::substr($str, -$n, null, $encoding); |
|
| 6573 | + return (string)self::substr($str, -$n, null, $encoding); |
|
| 6574 | 6574 | } |
| 6575 | 6575 | |
| 6576 | 6576 | /** |
@@ -6596,21 +6596,21 @@ discard block |
||
| 6596 | 6596 | } |
| 6597 | 6597 | |
| 6598 | 6598 | if ($encoding === 'UTF-8') { |
| 6599 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 6599 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 6600 | 6600 | return $str; |
| 6601 | 6601 | } |
| 6602 | 6602 | |
| 6603 | 6603 | /** @noinspection UnnecessaryCastingInspection */ |
| 6604 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
| 6604 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
| 6605 | 6605 | } |
| 6606 | 6606 | |
| 6607 | 6607 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6608 | 6608 | |
| 6609 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 6609 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 6610 | 6610 | return $str; |
| 6611 | 6611 | } |
| 6612 | 6612 | |
| 6613 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
| 6613 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
| 6614 | 6614 | } |
| 6615 | 6615 | |
| 6616 | 6616 | /** |
@@ -6638,12 +6638,12 @@ discard block |
||
| 6638 | 6638 | } |
| 6639 | 6639 | |
| 6640 | 6640 | if ($encoding === 'UTF-8') { |
| 6641 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 6641 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 6642 | 6642 | return $str; |
| 6643 | 6643 | } |
| 6644 | 6644 | |
| 6645 | 6645 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
| 6646 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
| 6646 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
| 6647 | 6647 | } |
| 6648 | 6648 | |
| 6649 | 6649 | $str = \mb_substr($str, 0, $length); |
@@ -6652,32 +6652,32 @@ discard block |
||
| 6652 | 6652 | $new_str = \implode(' ', $array); |
| 6653 | 6653 | |
| 6654 | 6654 | if ($new_str === '') { |
| 6655 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
| 6655 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
| 6656 | 6656 | } |
| 6657 | 6657 | } else { |
| 6658 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 6658 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 6659 | 6659 | return $str; |
| 6660 | 6660 | } |
| 6661 | 6661 | |
| 6662 | 6662 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
| 6663 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
| 6663 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
| 6664 | 6664 | } |
| 6665 | 6665 | |
| 6666 | 6666 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 6667 | 6667 | $str = self::substr($str, 0, $length, $encoding); |
| 6668 | 6668 | if ($str === false) { |
| 6669 | - return '' . $str_add_on; |
|
| 6669 | + return ''.$str_add_on; |
|
| 6670 | 6670 | } |
| 6671 | 6671 | |
| 6672 | 6672 | $array = \explode(' ', $str, -1); |
| 6673 | 6673 | $new_str = \implode(' ', $array); |
| 6674 | 6674 | |
| 6675 | 6675 | if ($new_str === '') { |
| 6676 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
| 6676 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
| 6677 | 6677 | } |
| 6678 | 6678 | } |
| 6679 | 6679 | |
| 6680 | - return $new_str . $str_add_on; |
|
| 6680 | + return $new_str.$str_add_on; |
|
| 6681 | 6681 | } |
| 6682 | 6682 | |
| 6683 | 6683 | /** |
@@ -6700,7 +6700,7 @@ discard block |
||
| 6700 | 6700 | $longest_common_prefix = ''; |
| 6701 | 6701 | |
| 6702 | 6702 | if ($encoding === 'UTF-8') { |
| 6703 | - $max_length = (int) \min( |
|
| 6703 | + $max_length = (int)\min( |
|
| 6704 | 6704 | \mb_strlen($str1), |
| 6705 | 6705 | \mb_strlen($str2) |
| 6706 | 6706 | ); |
@@ -6721,7 +6721,7 @@ discard block |
||
| 6721 | 6721 | } else { |
| 6722 | 6722 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6723 | 6723 | |
| 6724 | - $max_length = (int) \min( |
|
| 6724 | + $max_length = (int)\min( |
|
| 6725 | 6725 | self::strlen($str1, $encoding), |
| 6726 | 6726 | self::strlen($str2, $encoding) |
| 6727 | 6727 | ); |
@@ -6770,13 +6770,13 @@ discard block |
||
| 6770 | 6770 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
| 6771 | 6771 | |
| 6772 | 6772 | if ($encoding === 'UTF-8') { |
| 6773 | - $str_length = (int) \mb_strlen($str1); |
|
| 6774 | - $other_length = (int) \mb_strlen($str2); |
|
| 6773 | + $str_length = (int)\mb_strlen($str1); |
|
| 6774 | + $other_length = (int)\mb_strlen($str2); |
|
| 6775 | 6775 | } else { |
| 6776 | 6776 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6777 | 6777 | |
| 6778 | - $str_length = (int) self::strlen($str1, $encoding); |
|
| 6779 | - $other_length = (int) self::strlen($str2, $encoding); |
|
| 6778 | + $str_length = (int)self::strlen($str1, $encoding); |
|
| 6779 | + $other_length = (int)self::strlen($str2, $encoding); |
|
| 6780 | 6780 | } |
| 6781 | 6781 | |
| 6782 | 6782 | // Return if either string is empty |
@@ -6829,10 +6829,10 @@ discard block |
||
| 6829 | 6829 | } |
| 6830 | 6830 | |
| 6831 | 6831 | if ($encoding === 'UTF-8') { |
| 6832 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
| 6832 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
| 6833 | 6833 | } |
| 6834 | 6834 | |
| 6835 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
| 6835 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
| 6836 | 6836 | } |
| 6837 | 6837 | |
| 6838 | 6838 | /** |
@@ -6856,7 +6856,7 @@ discard block |
||
| 6856 | 6856 | } |
| 6857 | 6857 | |
| 6858 | 6858 | if ($encoding === 'UTF-8') { |
| 6859 | - $max_length = (int) \min( |
|
| 6859 | + $max_length = (int)\min( |
|
| 6860 | 6860 | \mb_strlen($str1, $encoding), |
| 6861 | 6861 | \mb_strlen($str2, $encoding) |
| 6862 | 6862 | ); |
@@ -6870,7 +6870,7 @@ discard block |
||
| 6870 | 6870 | && |
| 6871 | 6871 | $char === \mb_substr($str2, -$i, 1) |
| 6872 | 6872 | ) { |
| 6873 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
| 6873 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
| 6874 | 6874 | } else { |
| 6875 | 6875 | break; |
| 6876 | 6876 | } |
@@ -6878,7 +6878,7 @@ discard block |
||
| 6878 | 6878 | } else { |
| 6879 | 6879 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6880 | 6880 | |
| 6881 | - $max_length = (int) \min( |
|
| 6881 | + $max_length = (int)\min( |
|
| 6882 | 6882 | self::strlen($str1, $encoding), |
| 6883 | 6883 | self::strlen($str2, $encoding) |
| 6884 | 6884 | ); |
@@ -6892,7 +6892,7 @@ discard block |
||
| 6892 | 6892 | && |
| 6893 | 6893 | $char === self::substr($str2, -$i, 1, $encoding) |
| 6894 | 6894 | ) { |
| 6895 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
| 6895 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
| 6896 | 6896 | } else { |
| 6897 | 6897 | break; |
| 6898 | 6898 | } |
@@ -6915,7 +6915,7 @@ discard block |
||
| 6915 | 6915 | */ |
| 6916 | 6916 | public static function str_matches_pattern(string $str, string $pattern): bool |
| 6917 | 6917 | { |
| 6918 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
| 6918 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
| 6919 | 6919 | } |
| 6920 | 6920 | |
| 6921 | 6921 | /** |
@@ -6935,7 +6935,7 @@ discard block |
||
| 6935 | 6935 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
| 6936 | 6936 | { |
| 6937 | 6937 | // init |
| 6938 | - $length = (int) self::strlen($str, $encoding); |
|
| 6938 | + $length = (int)self::strlen($str, $encoding); |
|
| 6939 | 6939 | |
| 6940 | 6940 | if ($offset >= 0) { |
| 6941 | 6941 | return $length > $offset; |
@@ -6964,7 +6964,7 @@ discard block |
||
| 6964 | 6964 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
| 6965 | 6965 | { |
| 6966 | 6966 | // init |
| 6967 | - $length = (int) self::strlen($str); |
|
| 6967 | + $length = (int)self::strlen($str); |
|
| 6968 | 6968 | |
| 6969 | 6969 | if ( |
| 6970 | 6970 | ($index >= 0 && $length <= $index) |
@@ -7008,7 +7008,7 @@ discard block |
||
| 7008 | 7008 | return $str; |
| 7009 | 7009 | } |
| 7010 | 7010 | |
| 7011 | - if ($pad_type !== (int) $pad_type) { |
|
| 7011 | + if ($pad_type !== (int)$pad_type) { |
|
| 7012 | 7012 | if ($pad_type === 'left') { |
| 7013 | 7013 | $pad_type = \STR_PAD_LEFT; |
| 7014 | 7014 | } elseif ($pad_type === 'right') { |
@@ -7017,23 +7017,23 @@ discard block |
||
| 7017 | 7017 | $pad_type = \STR_PAD_BOTH; |
| 7018 | 7018 | } else { |
| 7019 | 7019 | throw new \InvalidArgumentException( |
| 7020 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
| 7020 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
| 7021 | 7021 | ); |
| 7022 | 7022 | } |
| 7023 | 7023 | } |
| 7024 | 7024 | |
| 7025 | 7025 | if ($encoding === 'UTF-8') { |
| 7026 | - $str_length = (int) \mb_strlen($str); |
|
| 7026 | + $str_length = (int)\mb_strlen($str); |
|
| 7027 | 7027 | |
| 7028 | 7028 | if ($pad_length >= $str_length) { |
| 7029 | 7029 | switch ($pad_type) { |
| 7030 | 7030 | case \STR_PAD_LEFT: |
| 7031 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 7031 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 7032 | 7032 | |
| 7033 | 7033 | $diff = ($pad_length - $str_length); |
| 7034 | 7034 | |
| 7035 | - $pre = (string) \mb_substr( |
|
| 7036 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7035 | + $pre = (string)\mb_substr( |
|
| 7036 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7037 | 7037 | 0, |
| 7038 | 7038 | $diff |
| 7039 | 7039 | ); |
@@ -7044,16 +7044,16 @@ discard block |
||
| 7044 | 7044 | case \STR_PAD_BOTH: |
| 7045 | 7045 | $diff = ($pad_length - $str_length); |
| 7046 | 7046 | |
| 7047 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 7047 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 7048 | 7048 | |
| 7049 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 7049 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 7050 | 7050 | |
| 7051 | - $pre = (string) \mb_substr( |
|
| 7051 | + $pre = (string)\mb_substr( |
|
| 7052 | 7052 | \str_repeat($pad_string, $ps_length_left), |
| 7053 | 7053 | 0, |
| 7054 | 7054 | $ps_length_left |
| 7055 | 7055 | ); |
| 7056 | - $post = (string) \mb_substr( |
|
| 7056 | + $post = (string)\mb_substr( |
|
| 7057 | 7057 | \str_repeat($pad_string, $ps_length_right), |
| 7058 | 7058 | 0, |
| 7059 | 7059 | $ps_length_right |
@@ -7063,19 +7063,19 @@ discard block |
||
| 7063 | 7063 | |
| 7064 | 7064 | case \STR_PAD_RIGHT: |
| 7065 | 7065 | default: |
| 7066 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 7066 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 7067 | 7067 | |
| 7068 | 7068 | $diff = ($pad_length - $str_length); |
| 7069 | 7069 | |
| 7070 | - $post = (string) \mb_substr( |
|
| 7071 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7070 | + $post = (string)\mb_substr( |
|
| 7071 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7072 | 7072 | 0, |
| 7073 | 7073 | $diff |
| 7074 | 7074 | ); |
| 7075 | 7075 | $pre = ''; |
| 7076 | 7076 | } |
| 7077 | 7077 | |
| 7078 | - return $pre . $str . $post; |
|
| 7078 | + return $pre.$str.$post; |
|
| 7079 | 7079 | } |
| 7080 | 7080 | |
| 7081 | 7081 | return $str; |
@@ -7083,17 +7083,17 @@ discard block |
||
| 7083 | 7083 | |
| 7084 | 7084 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7085 | 7085 | |
| 7086 | - $str_length = (int) self::strlen($str, $encoding); |
|
| 7086 | + $str_length = (int)self::strlen($str, $encoding); |
|
| 7087 | 7087 | |
| 7088 | 7088 | if ($pad_length >= $str_length) { |
| 7089 | 7089 | switch ($pad_type) { |
| 7090 | 7090 | case \STR_PAD_LEFT: |
| 7091 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 7091 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 7092 | 7092 | |
| 7093 | 7093 | $diff = ($pad_length - $str_length); |
| 7094 | 7094 | |
| 7095 | - $pre = (string) self::substr( |
|
| 7096 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7095 | + $pre = (string)self::substr( |
|
| 7096 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7097 | 7097 | 0, |
| 7098 | 7098 | $diff, |
| 7099 | 7099 | $encoding |
@@ -7105,17 +7105,17 @@ discard block |
||
| 7105 | 7105 | case \STR_PAD_BOTH: |
| 7106 | 7106 | $diff = ($pad_length - $str_length); |
| 7107 | 7107 | |
| 7108 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 7108 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 7109 | 7109 | |
| 7110 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 7110 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 7111 | 7111 | |
| 7112 | - $pre = (string) self::substr( |
|
| 7112 | + $pre = (string)self::substr( |
|
| 7113 | 7113 | \str_repeat($pad_string, $ps_length_left), |
| 7114 | 7114 | 0, |
| 7115 | 7115 | $ps_length_left, |
| 7116 | 7116 | $encoding |
| 7117 | 7117 | ); |
| 7118 | - $post = (string) self::substr( |
|
| 7118 | + $post = (string)self::substr( |
|
| 7119 | 7119 | \str_repeat($pad_string, $ps_length_right), |
| 7120 | 7120 | 0, |
| 7121 | 7121 | $ps_length_right, |
@@ -7126,12 +7126,12 @@ discard block |
||
| 7126 | 7126 | |
| 7127 | 7127 | case \STR_PAD_RIGHT: |
| 7128 | 7128 | default: |
| 7129 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 7129 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 7130 | 7130 | |
| 7131 | 7131 | $diff = ($pad_length - $str_length); |
| 7132 | 7132 | |
| 7133 | - $post = (string) self::substr( |
|
| 7134 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7133 | + $post = (string)self::substr( |
|
| 7134 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7135 | 7135 | 0, |
| 7136 | 7136 | $diff, |
| 7137 | 7137 | $encoding |
@@ -7139,7 +7139,7 @@ discard block |
||
| 7139 | 7139 | $pre = ''; |
| 7140 | 7140 | } |
| 7141 | 7141 | |
| 7142 | - return $pre . $str . $post; |
|
| 7142 | + return $pre.$str.$post; |
|
| 7143 | 7143 | } |
| 7144 | 7144 | |
| 7145 | 7145 | return $str; |
@@ -7350,12 +7350,12 @@ discard block |
||
| 7350 | 7350 | } |
| 7351 | 7351 | |
| 7352 | 7352 | if ($search === '') { |
| 7353 | - return $str . $replacement; |
|
| 7353 | + return $str.$replacement; |
|
| 7354 | 7354 | } |
| 7355 | 7355 | |
| 7356 | 7356 | $searchLength = \strlen($search); |
| 7357 | 7357 | if (\strncmp($str, $search, $searchLength) === 0) { |
| 7358 | - return $replacement . \substr($str, $searchLength); |
|
| 7358 | + return $replacement.\substr($str, $searchLength); |
|
| 7359 | 7359 | } |
| 7360 | 7360 | |
| 7361 | 7361 | return $str; |
@@ -7389,11 +7389,11 @@ discard block |
||
| 7389 | 7389 | } |
| 7390 | 7390 | |
| 7391 | 7391 | if ($search === '') { |
| 7392 | - return $str . $replacement; |
|
| 7392 | + return $str.$replacement; |
|
| 7393 | 7393 | } |
| 7394 | 7394 | |
| 7395 | 7395 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 7396 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 7396 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 7397 | 7397 | } |
| 7398 | 7398 | |
| 7399 | 7399 | return $str; |
@@ -7427,7 +7427,7 @@ discard block |
||
| 7427 | 7427 | $subject, |
| 7428 | 7428 | $replace, |
| 7429 | 7429 | $pos, |
| 7430 | - (int) self::strlen($search) |
|
| 7430 | + (int)self::strlen($search) |
|
| 7431 | 7431 | ); |
| 7432 | 7432 | } |
| 7433 | 7433 | |
@@ -7461,7 +7461,7 @@ discard block |
||
| 7461 | 7461 | $subject, |
| 7462 | 7462 | $replace, |
| 7463 | 7463 | $pos, |
| 7464 | - (int) self::strlen($search) |
|
| 7464 | + (int)self::strlen($search) |
|
| 7465 | 7465 | ); |
| 7466 | 7466 | } |
| 7467 | 7467 | |
@@ -7484,7 +7484,7 @@ discard block |
||
| 7484 | 7484 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
| 7485 | 7485 | { |
| 7486 | 7486 | if ($encoding === 'UTF-8') { |
| 7487 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
| 7487 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
| 7488 | 7488 | \shuffle($indexes); |
| 7489 | 7489 | |
| 7490 | 7490 | // init |
@@ -7499,7 +7499,7 @@ discard block |
||
| 7499 | 7499 | } else { |
| 7500 | 7500 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7501 | 7501 | |
| 7502 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
| 7502 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
| 7503 | 7503 | \shuffle($indexes); |
| 7504 | 7504 | |
| 7505 | 7505 | // init |
@@ -7541,11 +7541,11 @@ discard block |
||
| 7541 | 7541 | ) { |
| 7542 | 7542 | if ($encoding === 'UTF-8') { |
| 7543 | 7543 | if ($end === null) { |
| 7544 | - $length = (int) \mb_strlen($str); |
|
| 7544 | + $length = (int)\mb_strlen($str); |
|
| 7545 | 7545 | } elseif ($end >= 0 && $end <= $start) { |
| 7546 | 7546 | return ''; |
| 7547 | 7547 | } elseif ($end < 0) { |
| 7548 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
| 7548 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
| 7549 | 7549 | } else { |
| 7550 | 7550 | $length = $end - $start; |
| 7551 | 7551 | } |
@@ -7556,11 +7556,11 @@ discard block |
||
| 7556 | 7556 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7557 | 7557 | |
| 7558 | 7558 | if ($end === null) { |
| 7559 | - $length = (int) self::strlen($str, $encoding); |
|
| 7559 | + $length = (int)self::strlen($str, $encoding); |
|
| 7560 | 7560 | } elseif ($end >= 0 && $end <= $start) { |
| 7561 | 7561 | return ''; |
| 7562 | 7562 | } elseif ($end < 0) { |
| 7563 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
| 7563 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
| 7564 | 7564 | } else { |
| 7565 | 7565 | $length = $end - $start; |
| 7566 | 7566 | } |
@@ -7595,7 +7595,7 @@ discard block |
||
| 7595 | 7595 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7596 | 7596 | } |
| 7597 | 7597 | |
| 7598 | - $str = (string) \preg_replace_callback( |
|
| 7598 | + $str = (string)\preg_replace_callback( |
|
| 7599 | 7599 | '/([\\p{N}|\\p{Lu}])/u', |
| 7600 | 7600 | /** |
| 7601 | 7601 | * @param string[] $matches |
@@ -7604,28 +7604,28 @@ discard block |
||
| 7604 | 7604 | * |
| 7605 | 7605 | * @return string |
| 7606 | 7606 | */ |
| 7607 | - static function (array $matches) use ($encoding): string { |
|
| 7607 | + static function(array $matches) use ($encoding): string { |
|
| 7608 | 7608 | $match = $matches[1]; |
| 7609 | - $match_int = (int) $match; |
|
| 7609 | + $match_int = (int)$match; |
|
| 7610 | 7610 | |
| 7611 | - if ((string) $match_int === $match) { |
|
| 7612 | - return '_' . $match . '_'; |
|
| 7611 | + if ((string)$match_int === $match) { |
|
| 7612 | + return '_'.$match.'_'; |
|
| 7613 | 7613 | } |
| 7614 | 7614 | |
| 7615 | 7615 | if ($encoding === 'UTF-8') { |
| 7616 | - return '_' . \mb_strtolower($match); |
|
| 7616 | + return '_'.\mb_strtolower($match); |
|
| 7617 | 7617 | } |
| 7618 | 7618 | |
| 7619 | - return '_' . self::strtolower($match, $encoding); |
|
| 7619 | + return '_'.self::strtolower($match, $encoding); |
|
| 7620 | 7620 | }, |
| 7621 | 7621 | $str |
| 7622 | 7622 | ); |
| 7623 | 7623 | |
| 7624 | - $str = (string) \preg_replace( |
|
| 7624 | + $str = (string)\preg_replace( |
|
| 7625 | 7625 | [ |
| 7626 | - '/\\s+/u', // convert spaces to "_" |
|
| 7626 | + '/\\s+/u', // convert spaces to "_" |
|
| 7627 | 7627 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
| 7628 | - '/_+/', // remove double "_" |
|
| 7628 | + '/_+/', // remove double "_" |
|
| 7629 | 7629 | ], |
| 7630 | 7630 | [ |
| 7631 | 7631 | '_', |
@@ -7753,7 +7753,7 @@ discard block |
||
| 7753 | 7753 | } |
| 7754 | 7754 | |
| 7755 | 7755 | // init |
| 7756 | - $input = (string) $input; |
|
| 7756 | + $input = (string)$input; |
|
| 7757 | 7757 | |
| 7758 | 7758 | if ($input === '') { |
| 7759 | 7759 | return []; |
@@ -7809,7 +7809,7 @@ discard block |
||
| 7809 | 7809 | ($input[$i] & "\xE0") === "\xC0" |
| 7810 | 7810 | ) { |
| 7811 | 7811 | if (($input[$i + 1] & "\xC0") === "\x80") { |
| 7812 | - $ret[] = $input[$i] . $input[$i + 1]; |
|
| 7812 | + $ret[] = $input[$i].$input[$i + 1]; |
|
| 7813 | 7813 | |
| 7814 | 7814 | ++$i; |
| 7815 | 7815 | } |
@@ -7823,7 +7823,7 @@ discard block |
||
| 7823 | 7823 | && |
| 7824 | 7824 | ($input[$i + 2] & "\xC0") === "\x80" |
| 7825 | 7825 | ) { |
| 7826 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2]; |
|
| 7826 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2]; |
|
| 7827 | 7827 | |
| 7828 | 7828 | $i += 2; |
| 7829 | 7829 | } |
@@ -7839,7 +7839,7 @@ discard block |
||
| 7839 | 7839 | && |
| 7840 | 7840 | ($input[$i + 3] & "\xC0") === "\x80" |
| 7841 | 7841 | ) { |
| 7842 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2] . $input[$i + 3]; |
|
| 7842 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2].$input[$i + 3]; |
|
| 7843 | 7843 | |
| 7844 | 7844 | $i += 3; |
| 7845 | 7845 | } |
@@ -7849,7 +7849,7 @@ discard block |
||
| 7849 | 7849 | |
| 7850 | 7850 | if ($length > 1) { |
| 7851 | 7851 | return \array_map( |
| 7852 | - static function (array $item): string { |
|
| 7852 | + static function(array $item): string { |
|
| 7853 | 7853 | return \implode('', $item); |
| 7854 | 7854 | }, |
| 7855 | 7855 | \array_chunk($ret, $length) |
@@ -7921,7 +7921,7 @@ discard block |
||
| 7921 | 7921 | $limit = -1; |
| 7922 | 7922 | } |
| 7923 | 7923 | |
| 7924 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
| 7924 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
| 7925 | 7925 | if ($array === false) { |
| 7926 | 7926 | return []; |
| 7927 | 7927 | } |
@@ -8021,9 +8021,9 @@ discard block |
||
| 8021 | 8021 | return ''; |
| 8022 | 8022 | } |
| 8023 | 8023 | |
| 8024 | - return (string) \mb_substr( |
|
| 8024 | + return (string)\mb_substr( |
|
| 8025 | 8025 | $str, |
| 8026 | - $offset + (int) \mb_strlen($separator) |
|
| 8026 | + $offset + (int)\mb_strlen($separator) |
|
| 8027 | 8027 | ); |
| 8028 | 8028 | } |
| 8029 | 8029 | |
@@ -8032,9 +8032,9 @@ discard block |
||
| 8032 | 8032 | return ''; |
| 8033 | 8033 | } |
| 8034 | 8034 | |
| 8035 | - return (string) \mb_substr( |
|
| 8035 | + return (string)\mb_substr( |
|
| 8036 | 8036 | $str, |
| 8037 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 8037 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 8038 | 8038 | null, |
| 8039 | 8039 | $encoding |
| 8040 | 8040 | ); |
@@ -8066,9 +8066,9 @@ discard block |
||
| 8066 | 8066 | return ''; |
| 8067 | 8067 | } |
| 8068 | 8068 | |
| 8069 | - return (string) \mb_substr( |
|
| 8069 | + return (string)\mb_substr( |
|
| 8070 | 8070 | $str, |
| 8071 | - $offset + (int) \mb_strlen($separator) |
|
| 8071 | + $offset + (int)\mb_strlen($separator) |
|
| 8072 | 8072 | ); |
| 8073 | 8073 | } |
| 8074 | 8074 | |
@@ -8077,9 +8077,9 @@ discard block |
||
| 8077 | 8077 | return ''; |
| 8078 | 8078 | } |
| 8079 | 8079 | |
| 8080 | - return (string) self::substr( |
|
| 8080 | + return (string)self::substr( |
|
| 8081 | 8081 | $str, |
| 8082 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 8082 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 8083 | 8083 | null, |
| 8084 | 8084 | $encoding |
| 8085 | 8085 | ); |
@@ -8111,7 +8111,7 @@ discard block |
||
| 8111 | 8111 | return ''; |
| 8112 | 8112 | } |
| 8113 | 8113 | |
| 8114 | - return (string) \mb_substr( |
|
| 8114 | + return (string)\mb_substr( |
|
| 8115 | 8115 | $str, |
| 8116 | 8116 | 0, |
| 8117 | 8117 | $offset |
@@ -8123,7 +8123,7 @@ discard block |
||
| 8123 | 8123 | return ''; |
| 8124 | 8124 | } |
| 8125 | 8125 | |
| 8126 | - return (string) self::substr( |
|
| 8126 | + return (string)self::substr( |
|
| 8127 | 8127 | $str, |
| 8128 | 8128 | 0, |
| 8129 | 8129 | $offset, |
@@ -8154,7 +8154,7 @@ discard block |
||
| 8154 | 8154 | return ''; |
| 8155 | 8155 | } |
| 8156 | 8156 | |
| 8157 | - return (string) \mb_substr( |
|
| 8157 | + return (string)\mb_substr( |
|
| 8158 | 8158 | $str, |
| 8159 | 8159 | 0, |
| 8160 | 8160 | $offset |
@@ -8168,7 +8168,7 @@ discard block |
||
| 8168 | 8168 | |
| 8169 | 8169 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8170 | 8170 | |
| 8171 | - return (string) self::substr( |
|
| 8171 | + return (string)self::substr( |
|
| 8172 | 8172 | $str, |
| 8173 | 8173 | 0, |
| 8174 | 8174 | $offset, |
@@ -8283,7 +8283,7 @@ discard block |
||
| 8283 | 8283 | */ |
| 8284 | 8284 | public static function str_surround(string $str, string $substring): string |
| 8285 | 8285 | { |
| 8286 | - return $substring . $str . $substring; |
|
| 8286 | + return $substring.$str.$substring; |
|
| 8287 | 8287 | } |
| 8288 | 8288 | |
| 8289 | 8289 | /** |
@@ -8345,9 +8345,9 @@ discard block |
||
| 8345 | 8345 | $word_define_chars = ''; |
| 8346 | 8346 | } |
| 8347 | 8347 | |
| 8348 | - $str = (string) \preg_replace_callback( |
|
| 8349 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
| 8350 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
| 8348 | + $str = (string)\preg_replace_callback( |
|
| 8349 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
| 8350 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
| 8351 | 8351 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
| 8352 | 8352 | return $match[0]; |
| 8353 | 8353 | } |
@@ -8513,16 +8513,16 @@ discard block |
||
| 8513 | 8513 | } |
| 8514 | 8514 | |
| 8515 | 8515 | // the main substitutions |
| 8516 | - $str = (string) \preg_replace_callback( |
|
| 8516 | + $str = (string)\preg_replace_callback( |
|
| 8517 | 8517 | '~\\b (_*) (?: # 1. Leading underscore and |
| 8518 | 8518 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
| 8519 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
| 8519 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
| 8520 | 8520 | | |
| 8521 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
| 8521 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
| 8522 | 8522 | | |
| 8523 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
| 8523 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
| 8524 | 8524 | | |
| 8525 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
| 8525 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
| 8526 | 8526 | ) (_*) \\b # 6. With trailing underscore |
| 8527 | 8527 | ~ux', |
| 8528 | 8528 | /** |
@@ -8532,7 +8532,7 @@ discard block |
||
| 8532 | 8532 | * |
| 8533 | 8533 | * @return string |
| 8534 | 8534 | */ |
| 8535 | - static function (array $matches) use ($encoding): string { |
|
| 8535 | + static function(array $matches) use ($encoding): string { |
|
| 8536 | 8536 | // preserve leading underscore |
| 8537 | 8537 | $str = $matches[1]; |
| 8538 | 8538 | if ($matches[2]) { |
@@ -8557,11 +8557,11 @@ discard block |
||
| 8557 | 8557 | ); |
| 8558 | 8558 | |
| 8559 | 8559 | // Exceptions for small words: capitalize at start of title... |
| 8560 | - $str = (string) \preg_replace_callback( |
|
| 8560 | + $str = (string)\preg_replace_callback( |
|
| 8561 | 8561 | '~( \\A [[:punct:]]* # start of title... |
| 8562 | 8562 | | [:.;?!][ ]+ # or of subsentence... |
| 8563 | 8563 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
| 8564 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
| 8564 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
| 8565 | 8565 | ~uxi', |
| 8566 | 8566 | /** |
| 8567 | 8567 | * @param string[] $matches |
@@ -8570,15 +8570,15 @@ discard block |
||
| 8570 | 8570 | * |
| 8571 | 8571 | * @return string |
| 8572 | 8572 | */ |
| 8573 | - static function (array $matches) use ($encoding): string { |
|
| 8574 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
| 8573 | + static function(array $matches) use ($encoding): string { |
|
| 8574 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
| 8575 | 8575 | }, |
| 8576 | 8576 | $str |
| 8577 | 8577 | ); |
| 8578 | 8578 | |
| 8579 | 8579 | // ...and end of title |
| 8580 | - $str = (string) \preg_replace_callback( |
|
| 8581 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
| 8580 | + $str = (string)\preg_replace_callback( |
|
| 8581 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
| 8582 | 8582 | (?= [[:punct:]]* \Z # ...at the end of the title... |
| 8583 | 8583 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
| 8584 | 8584 | ~uxi', |
@@ -8589,7 +8589,7 @@ discard block |
||
| 8589 | 8589 | * |
| 8590 | 8590 | * @return string |
| 8591 | 8591 | */ |
| 8592 | - static function (array $matches) use ($encoding): string { |
|
| 8592 | + static function(array $matches) use ($encoding): string { |
|
| 8593 | 8593 | return static::ucfirst($matches[1], $encoding); |
| 8594 | 8594 | }, |
| 8595 | 8595 | $str |
@@ -8597,10 +8597,10 @@ discard block |
||
| 8597 | 8597 | |
| 8598 | 8598 | // Exceptions for small words in hyphenated compound words. |
| 8599 | 8599 | // e.g. "in-flight" -> In-Flight |
| 8600 | - $str = (string) \preg_replace_callback( |
|
| 8600 | + $str = (string)\preg_replace_callback( |
|
| 8601 | 8601 | '~\\b |
| 8602 | 8602 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
| 8603 | - ( ' . $small_words_rx . ' ) |
|
| 8603 | + ( ' . $small_words_rx.' ) |
|
| 8604 | 8604 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
| 8605 | 8605 | ~uxi', |
| 8606 | 8606 | /** |
@@ -8610,18 +8610,18 @@ discard block |
||
| 8610 | 8610 | * |
| 8611 | 8611 | * @return string |
| 8612 | 8612 | */ |
| 8613 | - static function (array $matches) use ($encoding): string { |
|
| 8613 | + static function(array $matches) use ($encoding): string { |
|
| 8614 | 8614 | return static::ucfirst($matches[1], $encoding); |
| 8615 | 8615 | }, |
| 8616 | 8616 | $str |
| 8617 | 8617 | ); |
| 8618 | 8618 | |
| 8619 | 8619 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
| 8620 | - $str = (string) \preg_replace_callback( |
|
| 8620 | + $str = (string)\preg_replace_callback( |
|
| 8621 | 8621 | '~\\b |
| 8622 | 8622 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
| 8623 | 8623 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
| 8624 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
| 8624 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
| 8625 | 8625 | (?! - ) # Negative lookahead for another - |
| 8626 | 8626 | ~uxi', |
| 8627 | 8627 | /** |
@@ -8631,8 +8631,8 @@ discard block |
||
| 8631 | 8631 | * |
| 8632 | 8632 | * @return string |
| 8633 | 8633 | */ |
| 8634 | - static function (array $matches) use ($encoding): string { |
|
| 8635 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
| 8634 | + static function(array $matches) use ($encoding): string { |
|
| 8635 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
| 8636 | 8636 | }, |
| 8637 | 8637 | $str |
| 8638 | 8638 | ); |
@@ -8750,7 +8750,7 @@ discard block |
||
| 8750 | 8750 | ); |
| 8751 | 8751 | |
| 8752 | 8752 | foreach ($tmp_return as &$item) { |
| 8753 | - $item = (string) $item; |
|
| 8753 | + $item = (string)$item; |
|
| 8754 | 8754 | } |
| 8755 | 8755 | |
| 8756 | 8756 | return $tmp_return; |
@@ -8782,38 +8782,38 @@ discard block |
||
| 8782 | 8782 | } |
| 8783 | 8783 | |
| 8784 | 8784 | if ($encoding === 'UTF-8') { |
| 8785 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 8785 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 8786 | 8786 | return $str; |
| 8787 | 8787 | } |
| 8788 | 8788 | |
| 8789 | 8789 | if ($substring !== '') { |
| 8790 | - $length -= (int) \mb_strlen($substring); |
|
| 8790 | + $length -= (int)\mb_strlen($substring); |
|
| 8791 | 8791 | |
| 8792 | 8792 | /** @noinspection UnnecessaryCastingInspection */ |
| 8793 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
| 8793 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
| 8794 | 8794 | } |
| 8795 | 8795 | |
| 8796 | - return (string) \mb_substr($str, 0, $length); |
|
| 8796 | + return (string)\mb_substr($str, 0, $length); |
|
| 8797 | 8797 | } |
| 8798 | 8798 | |
| 8799 | 8799 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8800 | 8800 | |
| 8801 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 8801 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 8802 | 8802 | return $str; |
| 8803 | 8803 | } |
| 8804 | 8804 | |
| 8805 | 8805 | if ($substring !== '') { |
| 8806 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 8806 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 8807 | 8807 | } |
| 8808 | 8808 | |
| 8809 | 8809 | return ( |
| 8810 | - (string) self::substr( |
|
| 8810 | + (string)self::substr( |
|
| 8811 | 8811 | $str, |
| 8812 | 8812 | 0, |
| 8813 | 8813 | $length, |
| 8814 | 8814 | $encoding |
| 8815 | 8815 | ) |
| 8816 | - ) . $substring; |
|
| 8816 | + ).$substring; |
|
| 8817 | 8817 | } |
| 8818 | 8818 | |
| 8819 | 8819 | /** |
@@ -8847,12 +8847,12 @@ discard block |
||
| 8847 | 8847 | } |
| 8848 | 8848 | |
| 8849 | 8849 | if ($encoding === 'UTF-8') { |
| 8850 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 8850 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 8851 | 8851 | return $str; |
| 8852 | 8852 | } |
| 8853 | 8853 | |
| 8854 | 8854 | // need to further trim the string so we can append the substring |
| 8855 | - $length -= (int) \mb_strlen($substring); |
|
| 8855 | + $length -= (int)\mb_strlen($substring); |
|
| 8856 | 8856 | if ($length <= 0) { |
| 8857 | 8857 | return $substring; |
| 8858 | 8858 | } |
@@ -8878,18 +8878,18 @@ discard block |
||
| 8878 | 8878 | !$ignore_do_not_split_words_for_one_word |
| 8879 | 8879 | ) |
| 8880 | 8880 | ) { |
| 8881 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
| 8881 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
| 8882 | 8882 | } |
| 8883 | 8883 | } |
| 8884 | 8884 | } else { |
| 8885 | 8885 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8886 | 8886 | |
| 8887 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 8887 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 8888 | 8888 | return $str; |
| 8889 | 8889 | } |
| 8890 | 8890 | |
| 8891 | 8891 | // need to further trim the string so we can append the substring |
| 8892 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 8892 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 8893 | 8893 | if ($length <= 0) { |
| 8894 | 8894 | return $substring; |
| 8895 | 8895 | } |
@@ -8915,12 +8915,12 @@ discard block |
||
| 8915 | 8915 | !$ignore_do_not_split_words_for_one_word |
| 8916 | 8916 | ) |
| 8917 | 8917 | ) { |
| 8918 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
| 8918 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
| 8919 | 8919 | } |
| 8920 | 8920 | } |
| 8921 | 8921 | } |
| 8922 | 8922 | |
| 8923 | - return $truncated . $substring; |
|
| 8923 | + return $truncated.$substring; |
|
| 8924 | 8924 | } |
| 8925 | 8925 | |
| 8926 | 8926 | /** |
@@ -9015,13 +9015,13 @@ discard block |
||
| 9015 | 9015 | } |
| 9016 | 9016 | } elseif ($format === 2) { |
| 9017 | 9017 | $number_of_words = []; |
| 9018 | - $offset = (int) self::strlen($str_parts[0]); |
|
| 9018 | + $offset = (int)self::strlen($str_parts[0]); |
|
| 9019 | 9019 | for ($i = 1; $i < $len; $i += 2) { |
| 9020 | 9020 | $number_of_words[$offset] = $str_parts[$i]; |
| 9021 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
| 9021 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
| 9022 | 9022 | } |
| 9023 | 9023 | } else { |
| 9024 | - $number_of_words = (int) (($len - 1) / 2); |
|
| 9024 | + $number_of_words = (int)(($len - 1) / 2); |
|
| 9025 | 9025 | } |
| 9026 | 9026 | |
| 9027 | 9027 | return $number_of_words; |
@@ -9124,7 +9124,7 @@ discard block |
||
| 9124 | 9124 | } |
| 9125 | 9125 | |
| 9126 | 9126 | if ($char_list === '') { |
| 9127 | - return (int) self::strlen($str, $encoding); |
|
| 9127 | + return (int)self::strlen($str, $encoding); |
|
| 9128 | 9128 | } |
| 9129 | 9129 | |
| 9130 | 9130 | if ($offset || $length !== null) { |
@@ -9150,7 +9150,7 @@ discard block |
||
| 9150 | 9150 | } |
| 9151 | 9151 | |
| 9152 | 9152 | $matches = []; |
| 9153 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
| 9153 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
| 9154 | 9154 | $return = self::strlen($matches[1], $encoding); |
| 9155 | 9155 | if ($return === false) { |
| 9156 | 9156 | return 0; |
@@ -9159,7 +9159,7 @@ discard block |
||
| 9159 | 9159 | return $return; |
| 9160 | 9160 | } |
| 9161 | 9161 | |
| 9162 | - return (int) self::strlen($str, $encoding); |
|
| 9162 | + return (int)self::strlen($str, $encoding); |
|
| 9163 | 9163 | } |
| 9164 | 9164 | |
| 9165 | 9165 | /** |
@@ -9190,7 +9190,7 @@ discard block |
||
| 9190 | 9190 | |
| 9191 | 9191 | $str = ''; |
| 9192 | 9192 | foreach ($intOrHex as $strPart) { |
| 9193 | - $str .= '&#' . (int) $strPart . ';'; |
|
| 9193 | + $str .= '&#'.(int)$strPart.';'; |
|
| 9194 | 9194 | } |
| 9195 | 9195 | |
| 9196 | 9196 | // We cannot use html_entity_decode() here, as it will not return |
@@ -9288,7 +9288,7 @@ discard block |
||
| 9288 | 9288 | return ''; |
| 9289 | 9289 | } |
| 9290 | 9290 | |
| 9291 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
| 9291 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
| 9292 | 9292 | } |
| 9293 | 9293 | |
| 9294 | 9294 | /** |
@@ -9367,7 +9367,7 @@ discard block |
||
| 9367 | 9367 | // fallback for ascii only |
| 9368 | 9368 | // |
| 9369 | 9369 | |
| 9370 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 9370 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 9371 | 9371 | return \stripos($haystack, $needle, $offset); |
| 9372 | 9372 | } |
| 9373 | 9373 | |
@@ -9456,7 +9456,7 @@ discard block |
||
| 9456 | 9456 | /** |
| 9457 | 9457 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 9458 | 9458 | */ |
| 9459 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9459 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9460 | 9460 | } |
| 9461 | 9461 | |
| 9462 | 9462 | if ( |
@@ -9470,11 +9470,11 @@ discard block |
||
| 9470 | 9470 | } |
| 9471 | 9471 | } |
| 9472 | 9472 | |
| 9473 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
| 9473 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
| 9474 | 9474 | return \stristr($haystack, $needle, $before_needle); |
| 9475 | 9475 | } |
| 9476 | 9476 | |
| 9477 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
| 9477 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
| 9478 | 9478 | |
| 9479 | 9479 | if (!isset($match[1])) { |
| 9480 | 9480 | return false; |
@@ -9484,7 +9484,7 @@ discard block |
||
| 9484 | 9484 | return $match[1]; |
| 9485 | 9485 | } |
| 9486 | 9486 | |
| 9487 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
| 9487 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
| 9488 | 9488 | } |
| 9489 | 9489 | |
| 9490 | 9490 | /** |
@@ -9567,7 +9567,7 @@ discard block |
||
| 9567 | 9567 | /** |
| 9568 | 9568 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 9569 | 9569 | */ |
| 9570 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9570 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9571 | 9571 | } |
| 9572 | 9572 | |
| 9573 | 9573 | // |
@@ -9705,8 +9705,8 @@ discard block |
||
| 9705 | 9705 | } |
| 9706 | 9706 | |
| 9707 | 9707 | return \strnatcmp( |
| 9708 | - (string) self::strtonatfold($str1), |
|
| 9709 | - (string) self::strtonatfold($str2) |
|
| 9708 | + (string)self::strtonatfold($str1), |
|
| 9709 | + (string)self::strtonatfold($str2) |
|
| 9710 | 9710 | ); |
| 9711 | 9711 | } |
| 9712 | 9712 | |
@@ -9776,11 +9776,11 @@ discard block |
||
| 9776 | 9776 | } |
| 9777 | 9777 | |
| 9778 | 9778 | if ($encoding === 'UTF-8') { |
| 9779 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
| 9780 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
| 9779 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
| 9780 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
| 9781 | 9781 | } else { |
| 9782 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
| 9783 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
| 9782 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
| 9783 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
| 9784 | 9784 | } |
| 9785 | 9785 | |
| 9786 | 9786 | return self::strcmp($str1, $str2); |
@@ -9807,8 +9807,8 @@ discard block |
||
| 9807 | 9807 | return false; |
| 9808 | 9808 | } |
| 9809 | 9809 | |
| 9810 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
| 9811 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
| 9810 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
| 9811 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
| 9812 | 9812 | } |
| 9813 | 9813 | |
| 9814 | 9814 | return false; |
@@ -9853,10 +9853,10 @@ discard block |
||
| 9853 | 9853 | } |
| 9854 | 9854 | |
| 9855 | 9855 | // iconv and mbstring do not support integer $needle |
| 9856 | - if ((int) $needle === $needle) { |
|
| 9857 | - $needle = (string) self::chr($needle); |
|
| 9856 | + if ((int)$needle === $needle) { |
|
| 9857 | + $needle = (string)self::chr($needle); |
|
| 9858 | 9858 | } |
| 9859 | - $needle = (string) $needle; |
|
| 9859 | + $needle = (string)$needle; |
|
| 9860 | 9860 | |
| 9861 | 9861 | if ($haystack === '') { |
| 9862 | 9862 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -9916,7 +9916,7 @@ discard block |
||
| 9916 | 9916 | /** |
| 9917 | 9917 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 9918 | 9918 | */ |
| 9919 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9919 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9920 | 9920 | } |
| 9921 | 9921 | |
| 9922 | 9922 | // |
@@ -9957,7 +9957,7 @@ discard block |
||
| 9957 | 9957 | // fallback for ascii only |
| 9958 | 9958 | // |
| 9959 | 9959 | |
| 9960 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 9960 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 9961 | 9961 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Offset not contained in string */ |
| 9962 | 9962 | return @\strpos($haystack, $needle, $offset); |
| 9963 | 9963 | } |
@@ -9970,7 +9970,7 @@ discard block |
||
| 9970 | 9970 | if ($haystack_tmp === false) { |
| 9971 | 9971 | $haystack_tmp = ''; |
| 9972 | 9972 | } |
| 9973 | - $haystack = (string) $haystack_tmp; |
|
| 9973 | + $haystack = (string)$haystack_tmp; |
|
| 9974 | 9974 | |
| 9975 | 9975 | if ($offset < 0) { |
| 9976 | 9976 | $offset = 0; |
@@ -9982,7 +9982,7 @@ discard block |
||
| 9982 | 9982 | } |
| 9983 | 9983 | |
| 9984 | 9984 | if ($pos) { |
| 9985 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 9985 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 9986 | 9986 | } |
| 9987 | 9987 | |
| 9988 | 9988 | return $offset + 0; |
@@ -10137,7 +10137,7 @@ discard block |
||
| 10137 | 10137 | /** |
| 10138 | 10138 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10139 | 10139 | */ |
| 10140 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10140 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10141 | 10141 | } |
| 10142 | 10142 | |
| 10143 | 10143 | // |
@@ -10212,7 +10212,7 @@ discard block |
||
| 10212 | 10212 | if ($encoding === 'UTF-8') { |
| 10213 | 10213 | if (self::$SUPPORT['intl'] === true) { |
| 10214 | 10214 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
| 10215 | - $i = (int) \grapheme_strlen($str); |
|
| 10215 | + $i = (int)\grapheme_strlen($str); |
|
| 10216 | 10216 | while ($i--) { |
| 10217 | 10217 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
| 10218 | 10218 | if ($reversed_tmp !== false) { |
@@ -10220,7 +10220,7 @@ discard block |
||
| 10220 | 10220 | } |
| 10221 | 10221 | } |
| 10222 | 10222 | } else { |
| 10223 | - $i = (int) \mb_strlen($str); |
|
| 10223 | + $i = (int)\mb_strlen($str); |
|
| 10224 | 10224 | while ($i--) { |
| 10225 | 10225 | $reversed_tmp = \mb_substr($str, $i, 1); |
| 10226 | 10226 | if ($reversed_tmp !== false) { |
@@ -10231,7 +10231,7 @@ discard block |
||
| 10231 | 10231 | } else { |
| 10232 | 10232 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 10233 | 10233 | |
| 10234 | - $i = (int) self::strlen($str, $encoding); |
|
| 10234 | + $i = (int)self::strlen($str, $encoding); |
|
| 10235 | 10235 | while ($i--) { |
| 10236 | 10236 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
| 10237 | 10237 | if ($reversed_tmp !== false) { |
@@ -10359,10 +10359,10 @@ discard block |
||
| 10359 | 10359 | } |
| 10360 | 10360 | |
| 10361 | 10361 | // iconv and mbstring do not support integer $needle |
| 10362 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 10363 | - $needle = (string) self::chr($needle); |
|
| 10362 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 10363 | + $needle = (string)self::chr($needle); |
|
| 10364 | 10364 | } |
| 10365 | - $needle = (string) $needle; |
|
| 10365 | + $needle = (string)$needle; |
|
| 10366 | 10366 | |
| 10367 | 10367 | if ($haystack === '') { |
| 10368 | 10368 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -10418,7 +10418,7 @@ discard block |
||
| 10418 | 10418 | /** |
| 10419 | 10419 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10420 | 10420 | */ |
| 10421 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10421 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10422 | 10422 | } |
| 10423 | 10423 | |
| 10424 | 10424 | // |
@@ -10442,7 +10442,7 @@ discard block |
||
| 10442 | 10442 | // fallback for ascii only |
| 10443 | 10443 | // |
| 10444 | 10444 | |
| 10445 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10445 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10446 | 10446 | return \strripos($haystack, $needle, $offset); |
| 10447 | 10447 | } |
| 10448 | 10448 | |
@@ -10531,10 +10531,10 @@ discard block |
||
| 10531 | 10531 | } |
| 10532 | 10532 | |
| 10533 | 10533 | // iconv and mbstring do not support integer $needle |
| 10534 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 10535 | - $needle = (string) self::chr($needle); |
|
| 10534 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 10535 | + $needle = (string)self::chr($needle); |
|
| 10536 | 10536 | } |
| 10537 | - $needle = (string) $needle; |
|
| 10537 | + $needle = (string)$needle; |
|
| 10538 | 10538 | |
| 10539 | 10539 | if ($haystack === '') { |
| 10540 | 10540 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -10590,7 +10590,7 @@ discard block |
||
| 10590 | 10590 | /** |
| 10591 | 10591 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10592 | 10592 | */ |
| 10593 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10593 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10594 | 10594 | } |
| 10595 | 10595 | |
| 10596 | 10596 | // |
@@ -10614,7 +10614,7 @@ discard block |
||
| 10614 | 10614 | // fallback for ascii only |
| 10615 | 10615 | // |
| 10616 | 10616 | |
| 10617 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10617 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10618 | 10618 | return \strrpos($haystack, $needle, $offset); |
| 10619 | 10619 | } |
| 10620 | 10620 | |
@@ -10634,7 +10634,7 @@ discard block |
||
| 10634 | 10634 | if ($haystack_tmp === false) { |
| 10635 | 10635 | $haystack_tmp = ''; |
| 10636 | 10636 | } |
| 10637 | - $haystack = (string) $haystack_tmp; |
|
| 10637 | + $haystack = (string)$haystack_tmp; |
|
| 10638 | 10638 | } |
| 10639 | 10639 | |
| 10640 | 10640 | $pos = \strrpos($haystack, $needle); |
@@ -10648,7 +10648,7 @@ discard block |
||
| 10648 | 10648 | return false; |
| 10649 | 10649 | } |
| 10650 | 10650 | |
| 10651 | - return $offset + (int) self::strlen($str_tmp); |
|
| 10651 | + return $offset + (int)self::strlen($str_tmp); |
|
| 10652 | 10652 | } |
| 10653 | 10653 | |
| 10654 | 10654 | /** |
@@ -10716,12 +10716,12 @@ discard block |
||
| 10716 | 10716 | if ($offset || $length !== null) { |
| 10717 | 10717 | if ($encoding === 'UTF-8') { |
| 10718 | 10718 | if ($length === null) { |
| 10719 | - $str = (string) \mb_substr($str, $offset); |
|
| 10719 | + $str = (string)\mb_substr($str, $offset); |
|
| 10720 | 10720 | } else { |
| 10721 | - $str = (string) \mb_substr($str, $offset, $length); |
|
| 10721 | + $str = (string)\mb_substr($str, $offset, $length); |
|
| 10722 | 10722 | } |
| 10723 | 10723 | } else { |
| 10724 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
| 10724 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
| 10725 | 10725 | } |
| 10726 | 10726 | } |
| 10727 | 10727 | |
@@ -10731,7 +10731,7 @@ discard block |
||
| 10731 | 10731 | |
| 10732 | 10732 | $matches = []; |
| 10733 | 10733 | |
| 10734 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
| 10734 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
| 10735 | 10735 | } |
| 10736 | 10736 | |
| 10737 | 10737 | /** |
@@ -10825,7 +10825,7 @@ discard block |
||
| 10825 | 10825 | /** |
| 10826 | 10826 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10827 | 10827 | */ |
| 10828 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10828 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10829 | 10829 | } |
| 10830 | 10830 | |
| 10831 | 10831 | // |
@@ -10847,7 +10847,7 @@ discard block |
||
| 10847 | 10847 | // fallback for ascii only |
| 10848 | 10848 | // |
| 10849 | 10849 | |
| 10850 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10850 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10851 | 10851 | return \strstr($haystack, $needle, $before_needle); |
| 10852 | 10852 | } |
| 10853 | 10853 | |
@@ -10855,7 +10855,7 @@ discard block |
||
| 10855 | 10855 | // fallback via vanilla php |
| 10856 | 10856 | // |
| 10857 | 10857 | |
| 10858 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
| 10858 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
| 10859 | 10859 | |
| 10860 | 10860 | if (!isset($match[1])) { |
| 10861 | 10861 | return false; |
@@ -10865,7 +10865,7 @@ discard block |
||
| 10865 | 10865 | return $match[1]; |
| 10866 | 10866 | } |
| 10867 | 10867 | |
| 10868 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
| 10868 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
| 10869 | 10869 | } |
| 10870 | 10870 | |
| 10871 | 10871 | /** |
@@ -10995,7 +10995,7 @@ discard block |
||
| 10995 | 10995 | bool $try_to_keep_the_string_length = false |
| 10996 | 10996 | ): string { |
| 10997 | 10997 | // init |
| 10998 | - $str = (string) $str; |
|
| 10998 | + $str = (string)$str; |
|
| 10999 | 10999 | |
| 11000 | 11000 | if ($str === '') { |
| 11001 | 11001 | return ''; |
@@ -11024,23 +11024,23 @@ discard block |
||
| 11024 | 11024 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 11025 | 11025 | } |
| 11026 | 11026 | |
| 11027 | - $language_code = $lang . '-Lower'; |
|
| 11027 | + $language_code = $lang.'-Lower'; |
|
| 11028 | 11028 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 11029 | 11029 | /** |
| 11030 | 11030 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11031 | 11031 | */ |
| 11032 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
| 11032 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
| 11033 | 11033 | |
| 11034 | 11034 | $language_code = 'Any-Lower'; |
| 11035 | 11035 | } |
| 11036 | 11036 | |
| 11037 | - return (string) \transliterator_transliterate($language_code, $str); |
|
| 11037 | + return (string)\transliterator_transliterate($language_code, $str); |
|
| 11038 | 11038 | } |
| 11039 | 11039 | |
| 11040 | 11040 | /** |
| 11041 | 11041 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11042 | 11042 | */ |
| 11043 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
| 11043 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
| 11044 | 11044 | } |
| 11045 | 11045 | |
| 11046 | 11046 | // always fallback via symfony polyfill |
@@ -11075,7 +11075,7 @@ discard block |
||
| 11075 | 11075 | bool $try_to_keep_the_string_length = false |
| 11076 | 11076 | ): string { |
| 11077 | 11077 | // init |
| 11078 | - $str = (string) $str; |
|
| 11078 | + $str = (string)$str; |
|
| 11079 | 11079 | |
| 11080 | 11080 | if ($str === '') { |
| 11081 | 11081 | return ''; |
@@ -11104,23 +11104,23 @@ discard block |
||
| 11104 | 11104 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 11105 | 11105 | } |
| 11106 | 11106 | |
| 11107 | - $language_code = $lang . '-Upper'; |
|
| 11107 | + $language_code = $lang.'-Upper'; |
|
| 11108 | 11108 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 11109 | 11109 | /** |
| 11110 | 11110 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11111 | 11111 | */ |
| 11112 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
| 11112 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
| 11113 | 11113 | |
| 11114 | 11114 | $language_code = 'Any-Upper'; |
| 11115 | 11115 | } |
| 11116 | 11116 | |
| 11117 | - return (string) \transliterator_transliterate($language_code, $str); |
|
| 11117 | + return (string)\transliterator_transliterate($language_code, $str); |
|
| 11118 | 11118 | } |
| 11119 | 11119 | |
| 11120 | 11120 | /** |
| 11121 | 11121 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11122 | 11122 | */ |
| 11123 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
| 11123 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
| 11124 | 11124 | } |
| 11125 | 11125 | |
| 11126 | 11126 | // always fallback via symfony polyfill |
@@ -11183,7 +11183,7 @@ discard block |
||
| 11183 | 11183 | |
| 11184 | 11184 | $from = \array_combine($from, $to); |
| 11185 | 11185 | if ($from === false) { |
| 11186 | - 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) . ')'); |
|
| 11186 | + 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).')'); |
|
| 11187 | 11187 | } |
| 11188 | 11188 | } |
| 11189 | 11189 | |
@@ -11249,9 +11249,9 @@ discard block |
||
| 11249 | 11249 | } |
| 11250 | 11250 | |
| 11251 | 11251 | $wide = 0; |
| 11252 | - $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); |
|
| 11252 | + $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); |
|
| 11253 | 11253 | |
| 11254 | - return ($wide << 1) + (int) self::strlen($str); |
|
| 11254 | + return ($wide << 1) + (int)self::strlen($str); |
|
| 11255 | 11255 | } |
| 11256 | 11256 | |
| 11257 | 11257 | /** |
@@ -11360,7 +11360,7 @@ discard block |
||
| 11360 | 11360 | /** |
| 11361 | 11361 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11362 | 11362 | */ |
| 11363 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11363 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11364 | 11364 | } |
| 11365 | 11365 | |
| 11366 | 11366 | // |
@@ -11455,16 +11455,16 @@ discard block |
||
| 11455 | 11455 | ) { |
| 11456 | 11456 | if ($encoding === 'UTF-8') { |
| 11457 | 11457 | if ($length === null) { |
| 11458 | - $str1 = (string) \mb_substr($str1, $offset); |
|
| 11458 | + $str1 = (string)\mb_substr($str1, $offset); |
|
| 11459 | 11459 | } else { |
| 11460 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
| 11460 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
| 11461 | 11461 | } |
| 11462 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
| 11462 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
| 11463 | 11463 | } else { |
| 11464 | 11464 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 11465 | 11465 | |
| 11466 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
| 11467 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
| 11466 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
| 11467 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
| 11468 | 11468 | } |
| 11469 | 11469 | } |
| 11470 | 11470 | |
@@ -11543,9 +11543,9 @@ discard block |
||
| 11543 | 11543 | } |
| 11544 | 11544 | |
| 11545 | 11545 | if ($encoding === 'UTF-8') { |
| 11546 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
| 11546 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
| 11547 | 11547 | } else { |
| 11548 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
| 11548 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
| 11549 | 11549 | } |
| 11550 | 11550 | } |
| 11551 | 11551 | |
@@ -11557,7 +11557,7 @@ discard block |
||
| 11557 | 11557 | /** |
| 11558 | 11558 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11559 | 11559 | */ |
| 11560 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11560 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11561 | 11561 | } |
| 11562 | 11562 | |
| 11563 | 11563 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -11568,7 +11568,7 @@ discard block |
||
| 11568 | 11568 | return \mb_substr_count($haystack, $needle, $encoding); |
| 11569 | 11569 | } |
| 11570 | 11570 | |
| 11571 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 11571 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 11572 | 11572 | |
| 11573 | 11573 | return \count($matches); |
| 11574 | 11574 | } |
@@ -11640,7 +11640,7 @@ discard block |
||
| 11640 | 11640 | if ($haystack_tmp === false) { |
| 11641 | 11641 | $haystack_tmp = ''; |
| 11642 | 11642 | } |
| 11643 | - $haystack = (string) $haystack_tmp; |
|
| 11643 | + $haystack = (string)$haystack_tmp; |
|
| 11644 | 11644 | } |
| 11645 | 11645 | |
| 11646 | 11646 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -11681,10 +11681,10 @@ discard block |
||
| 11681 | 11681 | |
| 11682 | 11682 | if ($encoding === 'UTF-8') { |
| 11683 | 11683 | if ($case_sensitive) { |
| 11684 | - return (int) \mb_substr_count($str, $substring); |
|
| 11684 | + return (int)\mb_substr_count($str, $substring); |
|
| 11685 | 11685 | } |
| 11686 | 11686 | |
| 11687 | - return (int) \mb_substr_count( |
|
| 11687 | + return (int)\mb_substr_count( |
|
| 11688 | 11688 | \mb_strtoupper($str), |
| 11689 | 11689 | \mb_strtoupper($substring) |
| 11690 | 11690 | ); |
@@ -11693,10 +11693,10 @@ discard block |
||
| 11693 | 11693 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 11694 | 11694 | |
| 11695 | 11695 | if ($case_sensitive) { |
| 11696 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
| 11696 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
| 11697 | 11697 | } |
| 11698 | 11698 | |
| 11699 | - return (int) \mb_substr_count( |
|
| 11699 | + return (int)\mb_substr_count( |
|
| 11700 | 11700 | self::strtocasefold($str, true, false, $encoding, null, false), |
| 11701 | 11701 | self::strtocasefold($substring, true, false, $encoding, null, false), |
| 11702 | 11702 | $encoding |
@@ -11730,7 +11730,7 @@ discard block |
||
| 11730 | 11730 | } |
| 11731 | 11731 | |
| 11732 | 11732 | if (self::str_istarts_with($haystack, $needle)) { |
| 11733 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 11733 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 11734 | 11734 | } |
| 11735 | 11735 | |
| 11736 | 11736 | return $haystack; |
@@ -11797,7 +11797,7 @@ discard block |
||
| 11797 | 11797 | } |
| 11798 | 11798 | |
| 11799 | 11799 | if (self::str_iends_with($haystack, $needle)) { |
| 11800 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
| 11800 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
| 11801 | 11801 | } |
| 11802 | 11802 | |
| 11803 | 11803 | return $haystack; |
@@ -11830,7 +11830,7 @@ discard block |
||
| 11830 | 11830 | } |
| 11831 | 11831 | |
| 11832 | 11832 | if (self::str_starts_with($haystack, $needle)) { |
| 11833 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 11833 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 11834 | 11834 | } |
| 11835 | 11835 | |
| 11836 | 11836 | return $haystack; |
@@ -11891,7 +11891,7 @@ discard block |
||
| 11891 | 11891 | if (\is_array($offset)) { |
| 11892 | 11892 | $offset = \array_slice($offset, 0, $num); |
| 11893 | 11893 | foreach ($offset as &$value_tmp) { |
| 11894 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
| 11894 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
| 11895 | 11895 | } |
| 11896 | 11896 | unset($value_tmp); |
| 11897 | 11897 | } else { |
@@ -11904,7 +11904,7 @@ discard block |
||
| 11904 | 11904 | } elseif (\is_array($length)) { |
| 11905 | 11905 | $length = \array_slice($length, 0, $num); |
| 11906 | 11906 | foreach ($length as &$value_tmp_V2) { |
| 11907 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
| 11907 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
| 11908 | 11908 | } |
| 11909 | 11909 | unset($value_tmp_V2); |
| 11910 | 11910 | } else { |
@@ -11925,8 +11925,8 @@ discard block |
||
| 11925 | 11925 | } |
| 11926 | 11926 | |
| 11927 | 11927 | // init |
| 11928 | - $str = (string) $str; |
|
| 11929 | - $replacement = (string) $replacement; |
|
| 11928 | + $str = (string)$str; |
|
| 11929 | + $replacement = (string)$replacement; |
|
| 11930 | 11930 | |
| 11931 | 11931 | if (\is_array($length)) { |
| 11932 | 11932 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -11941,16 +11941,16 @@ discard block |
||
| 11941 | 11941 | } |
| 11942 | 11942 | |
| 11943 | 11943 | if (self::$SUPPORT['mbstring'] === true) { |
| 11944 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 11944 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 11945 | 11945 | |
| 11946 | 11946 | if ($offset < 0) { |
| 11947 | - $offset = (int) \max(0, $string_length + $offset); |
|
| 11947 | + $offset = (int)\max(0, $string_length + $offset); |
|
| 11948 | 11948 | } elseif ($offset > $string_length) { |
| 11949 | 11949 | $offset = $string_length; |
| 11950 | 11950 | } |
| 11951 | 11951 | |
| 11952 | 11952 | if ($length !== null && $length < 0) { |
| 11953 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
| 11953 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
| 11954 | 11954 | } elseif ($length === null || $length > $string_length) { |
| 11955 | 11955 | $length = $string_length; |
| 11956 | 11956 | } |
@@ -11959,9 +11959,9 @@ discard block |
||
| 11959 | 11959 | $length = $string_length - $offset; |
| 11960 | 11960 | } |
| 11961 | 11961 | |
| 11962 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
| 11963 | - $replacement . |
|
| 11964 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 11962 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
| 11963 | + $replacement. |
|
| 11964 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 11965 | 11965 | } |
| 11966 | 11966 | |
| 11967 | 11967 | // |
@@ -11970,8 +11970,7 @@ discard block |
||
| 11970 | 11970 | |
| 11971 | 11971 | if (ASCII::is_ascii($str)) { |
| 11972 | 11972 | return ($length === null) ? |
| 11973 | - \substr_replace($str, $replacement, $offset) : |
|
| 11974 | - \substr_replace($str, $replacement, $offset, $length); |
|
| 11973 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
| 11975 | 11974 | } |
| 11976 | 11975 | |
| 11977 | 11976 | // |
@@ -12030,14 +12029,14 @@ discard block |
||
| 12030 | 12029 | && |
| 12031 | 12030 | \substr($haystack, -\strlen($needle)) === $needle |
| 12032 | 12031 | ) { |
| 12033 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
| 12032 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
| 12034 | 12033 | } |
| 12035 | 12034 | |
| 12036 | 12035 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
| 12037 | - return (string) self::substr( |
|
| 12036 | + return (string)self::substr( |
|
| 12038 | 12037 | $haystack, |
| 12039 | 12038 | 0, |
| 12040 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
| 12039 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
| 12041 | 12040 | $encoding |
| 12042 | 12041 | ); |
| 12043 | 12042 | } |
@@ -12072,10 +12071,10 @@ discard block |
||
| 12072 | 12071 | } |
| 12073 | 12072 | |
| 12074 | 12073 | if ($encoding === 'UTF-8') { |
| 12075 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 12074 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 12076 | 12075 | } |
| 12077 | 12076 | |
| 12078 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 12077 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 12079 | 12078 | } |
| 12080 | 12079 | |
| 12081 | 12080 | /** |
@@ -12214,7 +12213,7 @@ discard block |
||
| 12214 | 12213 | public static function to_boolean($str): bool |
| 12215 | 12214 | { |
| 12216 | 12215 | // init |
| 12217 | - $str = (string) $str; |
|
| 12216 | + $str = (string)$str; |
|
| 12218 | 12217 | |
| 12219 | 12218 | if ($str === '') { |
| 12220 | 12219 | return false; |
@@ -12242,10 +12241,10 @@ discard block |
||
| 12242 | 12241 | } |
| 12243 | 12242 | |
| 12244 | 12243 | if (\is_numeric($str)) { |
| 12245 | - return ((float) $str) > 0; |
|
| 12244 | + return ((float)$str) > 0; |
|
| 12246 | 12245 | } |
| 12247 | 12246 | |
| 12248 | - return (bool) \trim($str); |
|
| 12247 | + return (bool)\trim($str); |
|
| 12249 | 12248 | } |
| 12250 | 12249 | |
| 12251 | 12250 | /** |
@@ -12297,7 +12296,7 @@ discard block |
||
| 12297 | 12296 | return $str; |
| 12298 | 12297 | } |
| 12299 | 12298 | |
| 12300 | - $str = (string) $str; |
|
| 12299 | + $str = (string)$str; |
|
| 12301 | 12300 | if ($str === '') { |
| 12302 | 12301 | return ''; |
| 12303 | 12302 | } |
@@ -12385,7 +12384,7 @@ discard block |
||
| 12385 | 12384 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
| 12386 | 12385 | |
| 12387 | 12386 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 12388 | - $buf .= $c1 . $c2; |
|
| 12387 | + $buf .= $c1.$c2; |
|
| 12389 | 12388 | ++$i; |
| 12390 | 12389 | } else { // not valid UTF8 - convert it |
| 12391 | 12390 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12396,7 +12395,7 @@ discard block |
||
| 12396 | 12395 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
| 12397 | 12396 | |
| 12398 | 12397 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 12399 | - $buf .= $c1 . $c2 . $c3; |
|
| 12398 | + $buf .= $c1.$c2.$c3; |
|
| 12400 | 12399 | $i += 2; |
| 12401 | 12400 | } else { // not valid UTF8 - convert it |
| 12402 | 12401 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12408,7 +12407,7 @@ discard block |
||
| 12408 | 12407 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
| 12409 | 12408 | |
| 12410 | 12409 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 12411 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
| 12410 | + $buf .= $c1.$c2.$c3.$c4; |
|
| 12412 | 12411 | $i += 3; |
| 12413 | 12412 | } else { // not valid UTF8 - convert it |
| 12414 | 12413 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12436,13 +12435,13 @@ discard block |
||
| 12436 | 12435 | * |
| 12437 | 12436 | * @return string |
| 12438 | 12437 | */ |
| 12439 | - static function (array $matches): string { |
|
| 12438 | + static function(array $matches): string { |
|
| 12440 | 12439 | if (isset($matches[3])) { |
| 12441 | - $cp = (int) \hexdec($matches[3]); |
|
| 12440 | + $cp = (int)\hexdec($matches[3]); |
|
| 12442 | 12441 | } else { |
| 12443 | 12442 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
| 12444 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
| 12445 | - + (int) \hexdec($matches[2]) |
|
| 12443 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
| 12444 | + + (int)\hexdec($matches[2]) |
|
| 12446 | 12445 | + 0x10000 |
| 12447 | 12446 | - (0xD800 << 10) |
| 12448 | 12447 | - 0xDC00; |
@@ -12453,12 +12452,12 @@ discard block |
||
| 12453 | 12452 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
| 12454 | 12453 | |
| 12455 | 12454 | if ($cp < 0x80) { |
| 12456 | - return (string) self::chr($cp); |
|
| 12455 | + return (string)self::chr($cp); |
|
| 12457 | 12456 | } |
| 12458 | 12457 | |
| 12459 | 12458 | if ($cp < 0xA0) { |
| 12460 | 12459 | /** @noinspection UnnecessaryCastingInspection */ |
| 12461 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
| 12460 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
| 12462 | 12461 | } |
| 12463 | 12462 | |
| 12464 | 12463 | return self::decimal_to_chr($cp); |
@@ -12491,7 +12490,7 @@ discard block |
||
| 12491 | 12490 | public static function to_int(string $str) |
| 12492 | 12491 | { |
| 12493 | 12492 | if (\is_numeric($str)) { |
| 12494 | - return (int) $str; |
|
| 12493 | + return (int)$str; |
|
| 12495 | 12494 | } |
| 12496 | 12495 | |
| 12497 | 12496 | return null; |
@@ -12526,12 +12525,12 @@ discard block |
||
| 12526 | 12525 | || |
| 12527 | 12526 | $input_type === 'double' |
| 12528 | 12527 | ) { |
| 12529 | - return (string) $input; |
|
| 12528 | + return (string)$input; |
|
| 12530 | 12529 | } |
| 12531 | 12530 | |
| 12532 | 12531 | /** @phpstan-ignore-next-line - "gettype": FP? */ |
| 12533 | 12532 | if ($input_type === 'object' && \method_exists($input, '__toString')) { |
| 12534 | - return (string) $input; |
|
| 12533 | + return (string)$input; |
|
| 12535 | 12534 | } |
| 12536 | 12535 | |
| 12537 | 12536 | return null; |
@@ -12570,7 +12569,7 @@ discard block |
||
| 12570 | 12569 | $pattern = '^[\\s]+|[\\s]+$'; |
| 12571 | 12570 | } |
| 12572 | 12571 | |
| 12573 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 12572 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 12574 | 12573 | } |
| 12575 | 12574 | |
| 12576 | 12575 | if ($chars !== null) { |
@@ -12621,15 +12620,15 @@ discard block |
||
| 12621 | 12620 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 12622 | 12621 | |
| 12623 | 12622 | if ($encoding === 'UTF-8') { |
| 12624 | - $str_part_two = (string) \mb_substr($str, 1); |
|
| 12623 | + $str_part_two = (string)\mb_substr($str, 1); |
|
| 12625 | 12624 | |
| 12626 | 12625 | if ($use_mb_functions) { |
| 12627 | 12626 | $str_part_one = \mb_strtoupper( |
| 12628 | - (string) \mb_substr($str, 0, 1) |
|
| 12627 | + (string)\mb_substr($str, 0, 1) |
|
| 12629 | 12628 | ); |
| 12630 | 12629 | } else { |
| 12631 | 12630 | $str_part_one = self::strtoupper( |
| 12632 | - (string) \mb_substr($str, 0, 1), |
|
| 12631 | + (string)\mb_substr($str, 0, 1), |
|
| 12633 | 12632 | $encoding, |
| 12634 | 12633 | false, |
| 12635 | 12634 | $lang, |
@@ -12639,16 +12638,16 @@ discard block |
||
| 12639 | 12638 | } else { |
| 12640 | 12639 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 12641 | 12640 | |
| 12642 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
| 12641 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
| 12643 | 12642 | |
| 12644 | 12643 | if ($use_mb_functions) { |
| 12645 | 12644 | $str_part_one = \mb_strtoupper( |
| 12646 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
| 12645 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
| 12647 | 12646 | $encoding |
| 12648 | 12647 | ); |
| 12649 | 12648 | } else { |
| 12650 | 12649 | $str_part_one = self::strtoupper( |
| 12651 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 12650 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 12652 | 12651 | $encoding, |
| 12653 | 12652 | false, |
| 12654 | 12653 | $lang, |
@@ -12657,7 +12656,7 @@ discard block |
||
| 12657 | 12656 | } |
| 12658 | 12657 | } |
| 12659 | 12658 | |
| 12660 | - return $str_part_one . $str_part_two; |
|
| 12659 | + return $str_part_one.$str_part_two; |
|
| 12661 | 12660 | } |
| 12662 | 12661 | |
| 12663 | 12662 | /** |
@@ -12696,7 +12695,7 @@ discard block |
||
| 12696 | 12695 | $str = self::clean($str); |
| 12697 | 12696 | } |
| 12698 | 12697 | |
| 12699 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
| 12698 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
| 12700 | 12699 | |
| 12701 | 12700 | if ( |
| 12702 | 12701 | $use_php_default_functions |
@@ -12854,7 +12853,7 @@ discard block |
||
| 12854 | 12853 | if ( |
| 12855 | 12854 | $keep_utf8_chars |
| 12856 | 12855 | && |
| 12857 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
| 12856 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
| 12858 | 12857 | ) { |
| 12859 | 12858 | return $str_backup; |
| 12860 | 12859 | } |
@@ -12927,17 +12926,17 @@ discard block |
||
| 12927 | 12926 | return ''; |
| 12928 | 12927 | } |
| 12929 | 12928 | |
| 12930 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
| 12929 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
| 12931 | 12930 | |
| 12932 | 12931 | if ( |
| 12933 | 12932 | !isset($matches[0]) |
| 12934 | 12933 | || |
| 12935 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
| 12934 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
| 12936 | 12935 | ) { |
| 12937 | 12936 | return $str; |
| 12938 | 12937 | } |
| 12939 | 12938 | |
| 12940 | - return \rtrim($matches[0]) . $str_add_on; |
|
| 12939 | + return \rtrim($matches[0]).$str_add_on; |
|
| 12941 | 12940 | } |
| 12942 | 12941 | |
| 12943 | 12942 | /** |
@@ -13030,7 +13029,7 @@ discard block |
||
| 13030 | 13029 | } |
| 13031 | 13030 | } |
| 13032 | 13031 | |
| 13033 | - return $str_return . \implode('', $charsArray); |
|
| 13032 | + return $str_return.\implode('', $charsArray); |
|
| 13034 | 13033 | } |
| 13035 | 13034 | |
| 13036 | 13035 | /** |
@@ -13084,7 +13083,7 @@ discard block |
||
| 13084 | 13083 | $final_break = ''; |
| 13085 | 13084 | } |
| 13086 | 13085 | |
| 13087 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
| 13086 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
| 13088 | 13087 | } |
| 13089 | 13088 | |
| 13090 | 13089 | /** |
@@ -13325,7 +13324,7 @@ discard block |
||
| 13325 | 13324 | /** @noinspection PhpIncludeInspection */ |
| 13326 | 13325 | /** @noinspection UsingInclusionReturnValueInspection */ |
| 13327 | 13326 | /** @psalm-suppress UnresolvableInclude */ |
| 13328 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
| 13327 | + return include __DIR__.'/data/'.$file.'.php'; |
|
| 13329 | 13328 | } |
| 13330 | 13329 | |
| 13331 | 13330 | /** |
@@ -13347,7 +13346,7 @@ discard block |
||
| 13347 | 13346 | */ |
| 13348 | 13347 | \uksort( |
| 13349 | 13348 | self::$EMOJI, |
| 13350 | - static function (string $a, string $b): int { |
|
| 13349 | + static function(string $a, string $b): int { |
|
| 13351 | 13350 | return \strlen($b) <=> \strlen($a); |
| 13352 | 13351 | } |
| 13353 | 13352 | ); |
@@ -13357,7 +13356,7 @@ discard block |
||
| 13357 | 13356 | |
| 13358 | 13357 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
| 13359 | 13358 | $tmp_key = \crc32($key); |
| 13360 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
| 13359 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
| 13361 | 13360 | } |
| 13362 | 13361 | |
| 13363 | 13362 | return true; |
@@ -13384,7 +13383,7 @@ discard block |
||
| 13384 | 13383 | /** @noinspection DeprecatedIniOptionsInspection */ |
| 13385 | 13384 | return \defined('MB_OVERLOAD_STRING') |
| 13386 | 13385 | && |
| 13387 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 13386 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 13388 | 13387 | } |
| 13389 | 13388 | |
| 13390 | 13389 | /** |
@@ -13448,7 +13447,7 @@ discard block |
||
| 13448 | 13447 | */ |
| 13449 | 13448 | static $RX_CLASS_CACHE = []; |
| 13450 | 13449 | |
| 13451 | - $cache_key = $s . '_' . $class; |
|
| 13450 | + $cache_key = $s.'_'.$class; |
|
| 13452 | 13451 | |
| 13453 | 13452 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
| 13454 | 13453 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -13460,7 +13459,7 @@ discard block |
||
| 13460 | 13459 | /** @noinspection AlterInForeachInspection */ |
| 13461 | 13460 | foreach (self::str_split($s) as &$s) { |
| 13462 | 13461 | if ($s === '-') { |
| 13463 | - $class_array[0] = '-' . $class_array[0]; |
|
| 13462 | + $class_array[0] = '-'.$class_array[0]; |
|
| 13464 | 13463 | } elseif (!isset($s[2])) { |
| 13465 | 13464 | $class_array[0] .= \preg_quote($s, '/'); |
| 13466 | 13465 | } elseif (self::strlen($s) === 1) { |
@@ -13471,13 +13470,13 @@ discard block |
||
| 13471 | 13470 | } |
| 13472 | 13471 | |
| 13473 | 13472 | if ($class_array[0]) { |
| 13474 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
| 13473 | + $class_array[0] = '['.$class_array[0].']'; |
|
| 13475 | 13474 | } |
| 13476 | 13475 | |
| 13477 | 13476 | if (\count($class_array) === 1) { |
| 13478 | 13477 | $return = $class_array[0]; |
| 13479 | 13478 | } else { |
| 13480 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
| 13479 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
| 13481 | 13480 | } |
| 13482 | 13481 | |
| 13483 | 13482 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -13557,7 +13556,7 @@ discard block |
||
| 13557 | 13556 | $continue = false; |
| 13558 | 13557 | |
| 13559 | 13558 | if ($delimiter === '-') { |
| 13560 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
| 13559 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
| 13561 | 13560 | if (\strncmp($name, $beginning, \strlen($beginning)) === 0) { |
| 13562 | 13561 | $continue = true; |
| 13563 | 13562 | |
@@ -13567,7 +13566,7 @@ discard block |
||
| 13567 | 13566 | unset($beginning); |
| 13568 | 13567 | } |
| 13569 | 13568 | |
| 13570 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
| 13569 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
| 13571 | 13570 | if (\strncmp($name, $beginning, \strlen($beginning)) === 0) { |
| 13572 | 13571 | $continue = true; |
| 13573 | 13572 | |
@@ -13643,8 +13642,8 @@ discard block |
||
| 13643 | 13642 | } else { |
| 13644 | 13643 | /** @noinspection OffsetOperationsInspection */ |
| 13645 | 13644 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
| 13646 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
| 13647 | - $buf .= $cc1 . $cc2; |
|
| 13645 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
| 13646 | + $buf .= $cc1.$cc2; |
|
| 13648 | 13647 | } |
| 13649 | 13648 | |
| 13650 | 13649 | return $buf; |
@@ -13667,7 +13666,7 @@ discard block |
||
| 13667 | 13666 | |
| 13668 | 13667 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
| 13669 | 13668 | if (\preg_match($pattern, $str)) { |
| 13670 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
| 13669 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
| 13671 | 13670 | } |
| 13672 | 13671 | |
| 13673 | 13672 | return $str; |