@@ -271,10 +271,10 @@ discard block |
||
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | if ($encoding === 'UTF-8') { |
| 274 | - return (string) \mb_substr($str, $pos, 1); |
|
| 274 | + return (string)\mb_substr($str, $pos, 1); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
| 277 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | /** |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | public static function add_bom_to_string(string $str): string |
| 295 | 295 | { |
| 296 | 296 | if (!self::string_has_bom($str)) { |
| 297 | - $str = self::bom() . $str; |
|
| 297 | + $str = self::bom().$str; |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | return $str; |
@@ -329,8 +329,8 @@ discard block |
||
| 329 | 329 | $return = []; |
| 330 | 330 | foreach ($array as $key => &$value) { |
| 331 | 331 | $key = $case === \CASE_LOWER |
| 332 | - ? self::strtolower((string) $key, $encoding) |
|
| 333 | - : self::strtoupper((string) $key, $encoding); |
|
| 332 | + ? self::strtolower((string)$key, $encoding) |
|
| 333 | + : self::strtoupper((string)$key, $encoding); |
|
| 334 | 334 | |
| 335 | 335 | $return[$key] = $value; |
| 336 | 336 | } |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | return ''; |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
| 369 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
| 370 | 370 | $end_position = \mb_strpos($str, $end, $substr_index); |
| 371 | 371 | if ( |
| 372 | 372 | $end_position === false |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | return ''; |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
| 379 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | return ''; |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
| 389 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
| 390 | 390 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
| 391 | 391 | if ( |
| 392 | 392 | $end_position === false |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | return ''; |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | - return (string) self::substr( |
|
| 399 | + return (string)self::substr( |
|
| 400 | 400 | $str, |
| 401 | 401 | $substr_index, |
| 402 | 402 | $end_position - $substr_index, |
@@ -480,10 +480,10 @@ discard block |
||
| 480 | 480 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
| 481 | 481 | { |
| 482 | 482 | if ($encoding === 'UTF-8') { |
| 483 | - return (string) \mb_substr($str, $index, 1); |
|
| 483 | + return (string)\mb_substr($str, $index, 1); |
|
| 484 | 484 | } |
| 485 | 485 | |
| 486 | - return (string) self::substr($str, $index, 1, $encoding); |
|
| 486 | + return (string)self::substr($str, $index, 1, $encoding); |
|
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | /** |
@@ -600,14 +600,14 @@ discard block |
||
| 600 | 600 | /** |
| 601 | 601 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 602 | 602 | */ |
| 603 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 603 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | if ($code_point <= 0) { |
| 607 | 607 | return null; |
| 608 | 608 | } |
| 609 | 609 | |
| 610 | - $cache_key = $code_point . '_' . $encoding; |
|
| 610 | + $cache_key = $code_point.'_'.$encoding; |
|
| 611 | 611 | if (isset($CHAR_CACHE[$cache_key])) { |
| 612 | 612 | return $CHAR_CACHE[$cache_key]; |
| 613 | 613 | } |
@@ -653,27 +653,27 @@ discard block |
||
| 653 | 653 | self::$CHR = self::getData('chr'); |
| 654 | 654 | } |
| 655 | 655 | |
| 656 | - $code_point = (int) $code_point; |
|
| 656 | + $code_point = (int)$code_point; |
|
| 657 | 657 | if ($code_point <= 0x7FF) { |
| 658 | 658 | /** |
| 659 | 659 | * @psalm-suppress PossiblyNullArrayAccess |
| 660 | 660 | */ |
| 661 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
| 661 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
| 662 | 662 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 663 | 663 | } elseif ($code_point <= 0xFFFF) { |
| 664 | 664 | /** |
| 665 | 665 | * @psalm-suppress PossiblyNullArrayAccess |
| 666 | 666 | */ |
| 667 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
| 668 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 667 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
| 668 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 669 | 669 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 670 | 670 | } else { |
| 671 | 671 | /** |
| 672 | 672 | * @psalm-suppress PossiblyNullArrayAccess |
| 673 | 673 | */ |
| 674 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
| 675 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 676 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 674 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
| 675 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
| 676 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 677 | 677 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 678 | 678 | } |
| 679 | 679 | |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | |
| 731 | 731 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
| 732 | 732 | return \array_map( |
| 733 | - static function (string $data): int { |
|
| 733 | + static function(string $data): int { |
|
| 734 | 734 | // "mb_" is available if overload is used, so use it ... |
| 735 | 735 | return \mb_strlen($data, 'CP850'); // 8-BIT |
| 736 | 736 | }, |
@@ -817,7 +817,7 @@ discard block |
||
| 817 | 817 | $char = ''; |
| 818 | 818 | } |
| 819 | 819 | |
| 820 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
| 820 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
| 821 | 821 | } |
| 822 | 822 | |
| 823 | 823 | /** |
@@ -914,7 +914,7 @@ discard block |
||
| 914 | 914 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
| 915 | 915 | /x'; |
| 916 | 916 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
| 917 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
| 917 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
| 918 | 918 | |
| 919 | 919 | if ($replace_diamond_question_mark) { |
| 920 | 920 | $str = self::replace_diamond_question_mark($str); |
@@ -953,7 +953,7 @@ discard block |
||
| 953 | 953 | public static function cleanup($str): string |
| 954 | 954 | { |
| 955 | 955 | // init |
| 956 | - $str = (string) $str; |
|
| 956 | + $str = (string)$str; |
|
| 957 | 957 | |
| 958 | 958 | if ($str === '') { |
| 959 | 959 | return ''; |
@@ -1055,7 +1055,7 @@ discard block |
||
| 1055 | 1055 | { |
| 1056 | 1056 | if (self::$SUPPORT['mbstring'] === true) { |
| 1057 | 1057 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 1058 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 1058 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 1059 | 1059 | } |
| 1060 | 1060 | |
| 1061 | 1061 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -1160,9 +1160,9 @@ discard block |
||
| 1160 | 1160 | // - 0-9 (U+0061 - U+007A) |
| 1161 | 1161 | // - ISO 10646 characters U+00A1 and higher |
| 1162 | 1162 | // We strip out any character not in the above list. |
| 1163 | - $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); |
|
| 1163 | + $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); |
|
| 1164 | 1164 | // Identifiers cannot start with a digit, two hyphens, or a hyphen followed by a digit. |
| 1165 | - $str = (string) \preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
| 1165 | + $str = (string)\preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
| 1166 | 1166 | |
| 1167 | 1167 | return \trim($str, '-'); |
| 1168 | 1168 | } |
@@ -1178,7 +1178,7 @@ discard block |
||
| 1178 | 1178 | */ |
| 1179 | 1179 | public static function css_stripe_media_queries(string $str): string |
| 1180 | 1180 | { |
| 1181 | - return (string) \preg_replace( |
|
| 1181 | + return (string)\preg_replace( |
|
| 1182 | 1182 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
| 1183 | 1183 | '', |
| 1184 | 1184 | $str |
@@ -1217,7 +1217,7 @@ discard block |
||
| 1217 | 1217 | */ |
| 1218 | 1218 | public static function decimal_to_chr($int): string |
| 1219 | 1219 | { |
| 1220 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
| 1220 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
| 1221 | 1221 | } |
| 1222 | 1222 | |
| 1223 | 1223 | /** |
@@ -1267,7 +1267,7 @@ discard block |
||
| 1267 | 1267 | $flagOffset = 0x1F1E6; |
| 1268 | 1268 | $asciiOffset = 0x41; |
| 1269 | 1269 | |
| 1270 | - return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? '') . |
|
| 1270 | + return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? ''). |
|
| 1271 | 1271 | (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
| 1272 | 1272 | } |
| 1273 | 1273 | |
@@ -1298,16 +1298,16 @@ discard block |
||
| 1298 | 1298 | self::initEmojiData(); |
| 1299 | 1299 | |
| 1300 | 1300 | if ($use_reversible_string_mappings) { |
| 1301 | - return (string) \str_replace( |
|
| 1302 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1303 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1301 | + return (string)\str_replace( |
|
| 1302 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1303 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1304 | 1304 | $str |
| 1305 | 1305 | ); |
| 1306 | 1306 | } |
| 1307 | 1307 | |
| 1308 | - return (string) \str_replace( |
|
| 1309 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 1310 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1308 | + return (string)\str_replace( |
|
| 1309 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 1310 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1311 | 1311 | $str |
| 1312 | 1312 | ); |
| 1313 | 1313 | } |
@@ -1339,16 +1339,16 @@ discard block |
||
| 1339 | 1339 | self::initEmojiData(); |
| 1340 | 1340 | |
| 1341 | 1341 | if ($use_reversible_string_mappings) { |
| 1342 | - return (string) \str_replace( |
|
| 1343 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1344 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1342 | + return (string)\str_replace( |
|
| 1343 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1344 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
| 1345 | 1345 | $str |
| 1346 | 1346 | ); |
| 1347 | 1347 | } |
| 1348 | 1348 | |
| 1349 | - return (string) \str_replace( |
|
| 1350 | - (array) self::$EMOJI_VALUES_CACHE, |
|
| 1351 | - (array) self::$EMOJI_KEYS_CACHE, |
|
| 1349 | + return (string)\str_replace( |
|
| 1350 | + (array)self::$EMOJI_VALUES_CACHE, |
|
| 1351 | + (array)self::$EMOJI_KEYS_CACHE, |
|
| 1352 | 1352 | $str |
| 1353 | 1353 | ); |
| 1354 | 1354 | } |
@@ -1414,7 +1414,7 @@ discard block |
||
| 1414 | 1414 | if ($to_encoding === 'JSON') { |
| 1415 | 1415 | $return = self::json_encode($str); |
| 1416 | 1416 | if ($return === false) { |
| 1417 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
| 1417 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
| 1418 | 1418 | } |
| 1419 | 1419 | |
| 1420 | 1420 | return $return; |
@@ -1505,7 +1505,7 @@ discard block |
||
| 1505 | 1505 | /** |
| 1506 | 1506 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 1507 | 1507 | */ |
| 1508 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
| 1508 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
| 1509 | 1509 | } |
| 1510 | 1510 | |
| 1511 | 1511 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1607,31 +1607,31 @@ discard block |
||
| 1607 | 1607 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
| 1608 | 1608 | |
| 1609 | 1609 | if ($length === null) { |
| 1610 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2); |
|
| 1610 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2); |
|
| 1611 | 1611 | } |
| 1612 | 1612 | |
| 1613 | 1613 | if ($search === '') { |
| 1614 | 1614 | if ($encoding === 'UTF-8') { |
| 1615 | 1615 | if ($length > 0) { |
| 1616 | - $string_length = (int) \mb_strlen($str); |
|
| 1616 | + $string_length = (int)\mb_strlen($str); |
|
| 1617 | 1617 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
| 1618 | 1618 | } else { |
| 1619 | 1619 | $end = 0; |
| 1620 | 1620 | } |
| 1621 | 1621 | |
| 1622 | - $pos = (int) \min( |
|
| 1622 | + $pos = (int)\min( |
|
| 1623 | 1623 | \mb_strpos($str, ' ', $end), |
| 1624 | 1624 | \mb_strpos($str, '.', $end) |
| 1625 | 1625 | ); |
| 1626 | 1626 | } else { |
| 1627 | 1627 | if ($length > 0) { |
| 1628 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 1628 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 1629 | 1629 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
| 1630 | 1630 | } else { |
| 1631 | 1631 | $end = 0; |
| 1632 | 1632 | } |
| 1633 | 1633 | |
| 1634 | - $pos = (int) \min( |
|
| 1634 | + $pos = (int)\min( |
|
| 1635 | 1635 | self::strpos($str, ' ', $end, $encoding), |
| 1636 | 1636 | self::strpos($str, '.', $end, $encoding) |
| 1637 | 1637 | ); |
@@ -1648,18 +1648,18 @@ discard block |
||
| 1648 | 1648 | return ''; |
| 1649 | 1649 | } |
| 1650 | 1650 | |
| 1651 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1651 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1652 | 1652 | } |
| 1653 | 1653 | |
| 1654 | 1654 | return $str; |
| 1655 | 1655 | } |
| 1656 | 1656 | |
| 1657 | 1657 | if ($encoding === 'UTF-8') { |
| 1658 | - $word_position = (int) \mb_stripos($str, $search); |
|
| 1659 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
| 1658 | + $word_position = (int)\mb_stripos($str, $search); |
|
| 1659 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
| 1660 | 1660 | } else { |
| 1661 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
| 1662 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
| 1661 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
| 1662 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
| 1663 | 1663 | } |
| 1664 | 1664 | |
| 1665 | 1665 | $pos_start = 0; |
@@ -1671,12 +1671,12 @@ discard block |
||
| 1671 | 1671 | } |
| 1672 | 1672 | if ($half_text !== false) { |
| 1673 | 1673 | if ($encoding === 'UTF-8') { |
| 1674 | - $pos_start = (int) \max( |
|
| 1674 | + $pos_start = (int)\max( |
|
| 1675 | 1675 | \mb_strrpos($half_text, ' '), |
| 1676 | 1676 | \mb_strrpos($half_text, '.') |
| 1677 | 1677 | ); |
| 1678 | 1678 | } else { |
| 1679 | - $pos_start = (int) \max( |
|
| 1679 | + $pos_start = (int)\max( |
|
| 1680 | 1680 | self::strrpos($half_text, ' ', 0, $encoding), |
| 1681 | 1681 | self::strrpos($half_text, '.', 0, $encoding) |
| 1682 | 1682 | ); |
@@ -1686,19 +1686,19 @@ discard block |
||
| 1686 | 1686 | |
| 1687 | 1687 | if ($word_position && $half_side > 0) { |
| 1688 | 1688 | $offset = $pos_start + $length - 1; |
| 1689 | - $real_length = (int) self::strlen($str, $encoding); |
|
| 1689 | + $real_length = (int)self::strlen($str, $encoding); |
|
| 1690 | 1690 | |
| 1691 | 1691 | if ($offset > $real_length) { |
| 1692 | 1692 | $offset = $real_length; |
| 1693 | 1693 | } |
| 1694 | 1694 | |
| 1695 | 1695 | if ($encoding === 'UTF-8') { |
| 1696 | - $pos_end = (int) \min( |
|
| 1696 | + $pos_end = (int)\min( |
|
| 1697 | 1697 | \mb_strpos($str, ' ', $offset), |
| 1698 | 1698 | \mb_strpos($str, '.', $offset) |
| 1699 | 1699 | ) - $pos_start; |
| 1700 | 1700 | } else { |
| 1701 | - $pos_end = (int) \min( |
|
| 1701 | + $pos_end = (int)\min( |
|
| 1702 | 1702 | self::strpos($str, ' ', $offset, $encoding), |
| 1703 | 1703 | self::strpos($str, '.', $offset, $encoding) |
| 1704 | 1704 | ) - $pos_start; |
@@ -1706,12 +1706,12 @@ discard block |
||
| 1706 | 1706 | |
| 1707 | 1707 | if (!$pos_end || $pos_end <= 0) { |
| 1708 | 1708 | if ($encoding === 'UTF-8') { |
| 1709 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
| 1709 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
| 1710 | 1710 | } else { |
| 1711 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
| 1711 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
| 1712 | 1712 | } |
| 1713 | 1713 | if ($str_sub !== false) { |
| 1714 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
| 1714 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
| 1715 | 1715 | } else { |
| 1716 | 1716 | $extract = ''; |
| 1717 | 1717 | } |
@@ -1722,26 +1722,26 @@ discard block |
||
| 1722 | 1722 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
| 1723 | 1723 | } |
| 1724 | 1724 | if ($str_sub !== false) { |
| 1725 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1725 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1726 | 1726 | } else { |
| 1727 | 1727 | $extract = ''; |
| 1728 | 1728 | } |
| 1729 | 1729 | } |
| 1730 | 1730 | } else { |
| 1731 | 1731 | $offset = $length - 1; |
| 1732 | - $true_length = (int) self::strlen($str, $encoding); |
|
| 1732 | + $true_length = (int)self::strlen($str, $encoding); |
|
| 1733 | 1733 | |
| 1734 | 1734 | if ($offset > $true_length) { |
| 1735 | 1735 | $offset = $true_length; |
| 1736 | 1736 | } |
| 1737 | 1737 | |
| 1738 | 1738 | if ($encoding === 'UTF-8') { |
| 1739 | - $pos_end = (int) \min( |
|
| 1739 | + $pos_end = (int)\min( |
|
| 1740 | 1740 | \mb_strpos($str, ' ', $offset), |
| 1741 | 1741 | \mb_strpos($str, '.', $offset) |
| 1742 | 1742 | ); |
| 1743 | 1743 | } else { |
| 1744 | - $pos_end = (int) \min( |
|
| 1744 | + $pos_end = (int)\min( |
|
| 1745 | 1745 | self::strpos($str, ' ', $offset, $encoding), |
| 1746 | 1746 | self::strpos($str, '.', $offset, $encoding) |
| 1747 | 1747 | ); |
@@ -1754,7 +1754,7 @@ discard block |
||
| 1754 | 1754 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
| 1755 | 1755 | } |
| 1756 | 1756 | if ($str_sub !== false) { |
| 1757 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
| 1757 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
| 1758 | 1758 | } else { |
| 1759 | 1759 | $extract = ''; |
| 1760 | 1760 | } |
@@ -1887,7 +1887,7 @@ discard block |
||
| 1887 | 1887 | { |
| 1888 | 1888 | $file_content = \file_get_contents($file_path); |
| 1889 | 1889 | if ($file_content === false) { |
| 1890 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
| 1890 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
| 1891 | 1891 | } |
| 1892 | 1892 | |
| 1893 | 1893 | return self::string_has_bom($file_content); |
@@ -1953,7 +1953,7 @@ discard block |
||
| 1953 | 1953 | ) { |
| 1954 | 1954 | // Prevent leading combining chars |
| 1955 | 1955 | // for NFC-safe concatenations. |
| 1956 | - $var = $leading_combining . $var; |
|
| 1956 | + $var = $leading_combining.$var; |
|
| 1957 | 1957 | } |
| 1958 | 1958 | } |
| 1959 | 1959 | |
@@ -2274,10 +2274,10 @@ discard block |
||
| 2274 | 2274 | } |
| 2275 | 2275 | |
| 2276 | 2276 | if ($encoding === 'UTF-8') { |
| 2277 | - return (string) \mb_substr($str, 0, $n); |
|
| 2277 | + return (string)\mb_substr($str, 0, $n); |
|
| 2278 | 2278 | } |
| 2279 | 2279 | |
| 2280 | - return (string) self::substr($str, 0, $n, $encoding); |
|
| 2280 | + return (string)self::substr($str, 0, $n, $encoding); |
|
| 2281 | 2281 | } |
| 2282 | 2282 | |
| 2283 | 2283 | /** |
@@ -2295,7 +2295,7 @@ discard block |
||
| 2295 | 2295 | */ |
| 2296 | 2296 | public static function fits_inside(string $str, int $box_size): bool |
| 2297 | 2297 | { |
| 2298 | - return (int) self::strlen($str) <= $box_size; |
|
| 2298 | + return (int)self::strlen($str) <= $box_size; |
|
| 2299 | 2299 | } |
| 2300 | 2300 | |
| 2301 | 2301 | /** |
@@ -2378,7 +2378,7 @@ discard block |
||
| 2378 | 2378 | return $str; |
| 2379 | 2379 | } |
| 2380 | 2380 | |
| 2381 | - $str = (string) $str; |
|
| 2381 | + $str = (string)$str; |
|
| 2382 | 2382 | $last = ''; |
| 2383 | 2383 | while ($last !== $str) { |
| 2384 | 2384 | $last = $str; |
@@ -2587,7 +2587,7 @@ discard block |
||
| 2587 | 2587 | return $fallback; |
| 2588 | 2588 | } |
| 2589 | 2589 | /** @noinspection OffsetOperationsInspection */ |
| 2590 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
| 2590 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
| 2591 | 2591 | |
| 2592 | 2592 | // DEBUG |
| 2593 | 2593 | //var_dump($type_code); |
@@ -2645,7 +2645,7 @@ discard block |
||
| 2645 | 2645 | // |
| 2646 | 2646 | |
| 2647 | 2647 | if ($encoding === 'UTF-8') { |
| 2648 | - $max_length = (int) \mb_strlen($possible_chars); |
|
| 2648 | + $max_length = (int)\mb_strlen($possible_chars); |
|
| 2649 | 2649 | if ($max_length === 0) { |
| 2650 | 2650 | return ''; |
| 2651 | 2651 | } |
@@ -2666,7 +2666,7 @@ discard block |
||
| 2666 | 2666 | } else { |
| 2667 | 2667 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 2668 | 2668 | |
| 2669 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
| 2669 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
| 2670 | 2670 | if ($max_length === 0) { |
| 2671 | 2671 | return ''; |
| 2672 | 2672 | } |
@@ -2704,16 +2704,16 @@ discard block |
||
| 2704 | 2704 | $rand_int = \mt_rand(0, \mt_getrandmax()); |
| 2705 | 2705 | } |
| 2706 | 2706 | |
| 2707 | - $unique_helper = $rand_int . |
|
| 2708 | - \session_id() . |
|
| 2709 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2710 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2707 | + $unique_helper = $rand_int. |
|
| 2708 | + \session_id(). |
|
| 2709 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
| 2710 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
| 2711 | 2711 | $extra_entropy; |
| 2712 | 2712 | |
| 2713 | 2713 | $unique_string = \uniqid($unique_helper, true); |
| 2714 | 2714 | |
| 2715 | 2715 | if ($use_md5) { |
| 2716 | - $unique_string = \md5($unique_string . $unique_helper); |
|
| 2716 | + $unique_string = \md5($unique_string.$unique_helper); |
|
| 2717 | 2717 | } |
| 2718 | 2718 | |
| 2719 | 2719 | return $unique_string; |
@@ -2812,7 +2812,7 @@ discard block |
||
| 2812 | 2812 | public static function hex_to_chr(string $hexdec) |
| 2813 | 2813 | { |
| 2814 | 2814 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Invalid characters passed for attempted conversion, these have been ignored */ |
| 2815 | - return self::decimal_to_chr((int) @\hexdec($hexdec)); |
|
| 2815 | + return self::decimal_to_chr((int)@\hexdec($hexdec)); |
|
| 2816 | 2816 | } |
| 2817 | 2817 | |
| 2818 | 2818 | /** |
@@ -2832,7 +2832,7 @@ discard block |
||
| 2832 | 2832 | public static function hex_to_int($hexdec) |
| 2833 | 2833 | { |
| 2834 | 2834 | // init |
| 2835 | - $hexdec = (string) $hexdec; |
|
| 2835 | + $hexdec = (string)$hexdec; |
|
| 2836 | 2836 | |
| 2837 | 2837 | if ($hexdec === '') { |
| 2838 | 2838 | return false; |
@@ -2931,7 +2931,7 @@ discard block |
||
| 2931 | 2931 | return \implode( |
| 2932 | 2932 | '', |
| 2933 | 2933 | \array_map( |
| 2934 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
| 2934 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
| 2935 | 2935 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
| 2936 | 2936 | }, |
| 2937 | 2937 | self::str_split($str) |
@@ -3046,7 +3046,7 @@ discard block |
||
| 3046 | 3046 | /** |
| 3047 | 3047 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 3048 | 3048 | */ |
| 3049 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 3049 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 3050 | 3050 | } |
| 3051 | 3051 | |
| 3052 | 3052 | do { |
@@ -3055,7 +3055,7 @@ discard block |
||
| 3055 | 3055 | if (\strpos($str, '&') !== false) { |
| 3056 | 3056 | if (\strpos($str, '&#') !== false) { |
| 3057 | 3057 | // decode also numeric & UTF16 two byte entities |
| 3058 | - $str = (string) \preg_replace( |
|
| 3058 | + $str = (string)\preg_replace( |
|
| 3059 | 3059 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
| 3060 | 3060 | '$1;', |
| 3061 | 3061 | $str |
@@ -3105,7 +3105,7 @@ discard block |
||
| 3105 | 3105 | */ |
| 3106 | 3106 | public static function html_stripe_empty_tags(string $str): string |
| 3107 | 3107 | { |
| 3108 | - return (string) \preg_replace( |
|
| 3108 | + return (string)\preg_replace( |
|
| 3109 | 3109 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
| 3110 | 3110 | '', |
| 3111 | 3111 | $str |
@@ -3435,9 +3435,9 @@ discard block |
||
| 3435 | 3435 | { |
| 3436 | 3436 | $hex = \dechex($int); |
| 3437 | 3437 | |
| 3438 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
| 3438 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
| 3439 | 3439 | |
| 3440 | - return $prefix . $hex . ''; |
|
| 3440 | + return $prefix.$hex.''; |
|
| 3441 | 3441 | } |
| 3442 | 3442 | |
| 3443 | 3443 | /** |
@@ -3765,7 +3765,7 @@ discard block |
||
| 3765 | 3765 | */ |
| 3766 | 3766 | public static function is_binary($input, bool $strict = false): bool |
| 3767 | 3767 | { |
| 3768 | - $input = (string) $input; |
|
| 3768 | + $input = (string)$input; |
|
| 3769 | 3769 | if ($input === '') { |
| 3770 | 3770 | return false; |
| 3771 | 3771 | } |
@@ -4125,7 +4125,7 @@ discard block |
||
| 4125 | 4125 | public static function is_utf16($str, bool $check_if_string_is_binary = true) |
| 4126 | 4126 | { |
| 4127 | 4127 | // init |
| 4128 | - $str = (string) $str; |
|
| 4128 | + $str = (string)$str; |
|
| 4129 | 4129 | $str_chars = []; |
| 4130 | 4130 | |
| 4131 | 4131 | if ( |
@@ -4219,7 +4219,7 @@ discard block |
||
| 4219 | 4219 | public static function is_utf32($str, bool $check_if_string_is_binary = true) |
| 4220 | 4220 | { |
| 4221 | 4221 | // init |
| 4222 | - $str = (string) $str; |
|
| 4222 | + $str = (string)$str; |
|
| 4223 | 4223 | $str_chars = []; |
| 4224 | 4224 | |
| 4225 | 4225 | if ( |
@@ -4317,7 +4317,7 @@ discard block |
||
| 4317 | 4317 | return true; |
| 4318 | 4318 | } |
| 4319 | 4319 | |
| 4320 | - return self::is_utf8_string((string) $str, $strict); |
|
| 4320 | + return self::is_utf8_string((string)$str, $strict); |
|
| 4321 | 4321 | } |
| 4322 | 4322 | |
| 4323 | 4323 | /** |
@@ -4475,15 +4475,15 @@ discard block |
||
| 4475 | 4475 | $use_mb_functions = ($lang === null && !$try_to_keep_the_string_length); |
| 4476 | 4476 | |
| 4477 | 4477 | if ($encoding === 'UTF-8') { |
| 4478 | - $str_part_two = (string) \mb_substr($str, 1); |
|
| 4478 | + $str_part_two = (string)\mb_substr($str, 1); |
|
| 4479 | 4479 | |
| 4480 | 4480 | if ($use_mb_functions) { |
| 4481 | 4481 | $str_part_one = \mb_strtolower( |
| 4482 | - (string) \mb_substr($str, 0, 1) |
|
| 4482 | + (string)\mb_substr($str, 0, 1) |
|
| 4483 | 4483 | ); |
| 4484 | 4484 | } else { |
| 4485 | 4485 | $str_part_one = self::strtolower( |
| 4486 | - (string) \mb_substr($str, 0, 1), |
|
| 4486 | + (string)\mb_substr($str, 0, 1), |
|
| 4487 | 4487 | $encoding, |
| 4488 | 4488 | false, |
| 4489 | 4489 | $lang, |
@@ -4493,10 +4493,10 @@ discard block |
||
| 4493 | 4493 | } else { |
| 4494 | 4494 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4495 | 4495 | |
| 4496 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
| 4496 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
| 4497 | 4497 | |
| 4498 | 4498 | $str_part_one = self::strtolower( |
| 4499 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 4499 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 4500 | 4500 | $encoding, |
| 4501 | 4501 | false, |
| 4502 | 4502 | $lang, |
@@ -4504,7 +4504,7 @@ discard block |
||
| 4504 | 4504 | ); |
| 4505 | 4505 | } |
| 4506 | 4506 | |
| 4507 | - return $str_part_one . $str_part_two; |
|
| 4507 | + return $str_part_one.$str_part_two; |
|
| 4508 | 4508 | } |
| 4509 | 4509 | |
| 4510 | 4510 | /** |
@@ -4653,7 +4653,7 @@ discard block |
||
| 4653 | 4653 | } |
| 4654 | 4654 | |
| 4655 | 4655 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4656 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 4656 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 4657 | 4657 | } |
| 4658 | 4658 | |
| 4659 | 4659 | if ($chars !== null) { |
@@ -4690,7 +4690,7 @@ discard block |
||
| 4690 | 4690 | |
| 4691 | 4691 | $codepoint_max = \max($codepoints); |
| 4692 | 4692 | |
| 4693 | - return self::chr((int) $codepoint_max); |
|
| 4693 | + return self::chr((int)$codepoint_max); |
|
| 4694 | 4694 | } |
| 4695 | 4695 | |
| 4696 | 4696 | /** |
@@ -4710,7 +4710,7 @@ discard block |
||
| 4710 | 4710 | { |
| 4711 | 4711 | $bytes = self::chr_size_list($str); |
| 4712 | 4712 | if ($bytes !== []) { |
| 4713 | - return (int) \max($bytes); |
|
| 4713 | + return (int)\max($bytes); |
|
| 4714 | 4714 | } |
| 4715 | 4715 | |
| 4716 | 4716 | return 0; |
@@ -4756,7 +4756,7 @@ discard block |
||
| 4756 | 4756 | |
| 4757 | 4757 | $codepoint_min = \min($codepoints); |
| 4758 | 4758 | |
| 4759 | - return self::chr((int) $codepoint_min); |
|
| 4759 | + return self::chr((int)$codepoint_min); |
|
| 4760 | 4760 | } |
| 4761 | 4761 | |
| 4762 | 4762 | /** |
@@ -4804,7 +4804,7 @@ discard block |
||
| 4804 | 4804 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
| 4805 | 4805 | |
| 4806 | 4806 | // init |
| 4807 | - $encoding = (string) $encoding; |
|
| 4807 | + $encoding = (string)$encoding; |
|
| 4808 | 4808 | |
| 4809 | 4809 | if (!$encoding) { |
| 4810 | 4810 | return $fallback; |
@@ -4866,7 +4866,7 @@ discard block |
||
| 4866 | 4866 | |
| 4867 | 4867 | $encoding_original = $encoding; |
| 4868 | 4868 | $encoding = \strtoupper($encoding); |
| 4869 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
| 4869 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
| 4870 | 4870 | |
| 4871 | 4871 | $equivalences = [ |
| 4872 | 4872 | 'ISO8859' => 'ISO-8859-1', |
@@ -5030,13 +5030,13 @@ discard block |
||
| 5030 | 5030 | static $CHAR_CACHE = []; |
| 5031 | 5031 | |
| 5032 | 5032 | // init |
| 5033 | - $chr = (string) $chr; |
|
| 5033 | + $chr = (string)$chr; |
|
| 5034 | 5034 | |
| 5035 | 5035 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
| 5036 | 5036 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5037 | 5037 | } |
| 5038 | 5038 | |
| 5039 | - $cache_key = $chr . '_' . $encoding; |
|
| 5039 | + $cache_key = $chr.'_'.$encoding; |
|
| 5040 | 5040 | if (isset($CHAR_CACHE[$cache_key])) { |
| 5041 | 5041 | return $CHAR_CACHE[$cache_key]; |
| 5042 | 5042 | } |
@@ -5071,7 +5071,7 @@ discard block |
||
| 5071 | 5071 | // |
| 5072 | 5072 | |
| 5073 | 5073 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 5074 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
| 5074 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
| 5075 | 5075 | /** @noinspection OffsetOperationsInspection */ |
| 5076 | 5076 | $code = $chr ? $chr[1] : 0; |
| 5077 | 5077 | |
@@ -5079,21 +5079,21 @@ discard block |
||
| 5079 | 5079 | if ($code >= 0xF0 && isset($chr[4])) { |
| 5080 | 5080 | /** @noinspection UnnecessaryCastingInspection */ |
| 5081 | 5081 | /** @noinspection OffsetOperationsInspection */ |
| 5082 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 5082 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 5083 | 5083 | } |
| 5084 | 5084 | |
| 5085 | 5085 | /** @noinspection OffsetOperationsInspection */ |
| 5086 | 5086 | if ($code >= 0xE0 && isset($chr[3])) { |
| 5087 | 5087 | /** @noinspection UnnecessaryCastingInspection */ |
| 5088 | 5088 | /** @noinspection OffsetOperationsInspection */ |
| 5089 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 5089 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 5090 | 5090 | } |
| 5091 | 5091 | |
| 5092 | 5092 | /** @noinspection OffsetOperationsInspection */ |
| 5093 | 5093 | if ($code >= 0xC0 && isset($chr[2])) { |
| 5094 | 5094 | /** @noinspection UnnecessaryCastingInspection */ |
| 5095 | 5095 | /** @noinspection OffsetOperationsInspection */ |
| 5096 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 5096 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 5097 | 5097 | } |
| 5098 | 5098 | |
| 5099 | 5099 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -5155,7 +5155,7 @@ discard block |
||
| 5155 | 5155 | public static function pcre_utf8_support(): bool |
| 5156 | 5156 | { |
| 5157 | 5157 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 5158 | - return (bool) @\preg_match('//u', ''); |
|
| 5158 | + return (bool)@\preg_match('//u', ''); |
|
| 5159 | 5159 | } |
| 5160 | 5160 | |
| 5161 | 5161 | /** |
@@ -5196,14 +5196,14 @@ discard block |
||
| 5196 | 5196 | * @psalm-suppress DocblockTypeContradiction |
| 5197 | 5197 | */ |
| 5198 | 5198 | if (!\is_numeric($step)) { |
| 5199 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
| 5199 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
| 5200 | 5200 | } |
| 5201 | 5201 | |
| 5202 | 5202 | /** |
| 5203 | 5203 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
| 5204 | 5204 | */ |
| 5205 | 5205 | if ($step <= 0) { |
| 5206 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
| 5206 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
| 5207 | 5207 | } |
| 5208 | 5208 | } |
| 5209 | 5209 | |
@@ -5215,16 +5215,16 @@ discard block |
||
| 5215 | 5215 | $is_xdigit = false; |
| 5216 | 5216 | |
| 5217 | 5217 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5218 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
| 5218 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
| 5219 | 5219 | $is_digit = true; |
| 5220 | - $start = (int) $var1; |
|
| 5220 | + $start = (int)$var1; |
|
| 5221 | 5221 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
| 5222 | 5222 | $is_xdigit = true; |
| 5223 | - $start = (int) self::hex_to_int((string) $var1); |
|
| 5223 | + $start = (int)self::hex_to_int((string)$var1); |
|
| 5224 | 5224 | } elseif (!$use_ctype && \is_numeric($var1)) { |
| 5225 | - $start = (int) $var1; |
|
| 5225 | + $start = (int)$var1; |
|
| 5226 | 5226 | } else { |
| 5227 | - $start = self::ord((string) $var1); |
|
| 5227 | + $start = self::ord((string)$var1); |
|
| 5228 | 5228 | } |
| 5229 | 5229 | |
| 5230 | 5230 | if (!$start) { |
@@ -5232,13 +5232,13 @@ discard block |
||
| 5232 | 5232 | } |
| 5233 | 5233 | |
| 5234 | 5234 | if ($is_digit) { |
| 5235 | - $end = (int) $var2; |
|
| 5235 | + $end = (int)$var2; |
|
| 5236 | 5236 | } elseif ($is_xdigit) { |
| 5237 | - $end = (int) self::hex_to_int((string) $var2); |
|
| 5237 | + $end = (int)self::hex_to_int((string)$var2); |
|
| 5238 | 5238 | } elseif (!$use_ctype && \is_numeric($var2)) { |
| 5239 | - $end = (int) $var2; |
|
| 5239 | + $end = (int)$var2; |
|
| 5240 | 5240 | } else { |
| 5241 | - $end = self::ord((string) $var2); |
|
| 5241 | + $end = self::ord((string)$var2); |
|
| 5242 | 5242 | } |
| 5243 | 5243 | |
| 5244 | 5244 | if (!$end) { |
@@ -5247,7 +5247,7 @@ discard block |
||
| 5247 | 5247 | |
| 5248 | 5248 | $array = []; |
| 5249 | 5249 | foreach (\range($start, $end, $step) as $i) { |
| 5250 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
| 5250 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
| 5251 | 5251 | } |
| 5252 | 5252 | |
| 5253 | 5253 | return $array; |
@@ -5359,8 +5359,8 @@ discard block |
||
| 5359 | 5359 | $delimiter = '/'; |
| 5360 | 5360 | } |
| 5361 | 5361 | |
| 5362 | - return (string) \preg_replace( |
|
| 5363 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
| 5362 | + return (string)\preg_replace( |
|
| 5363 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
| 5364 | 5364 | $replacement, |
| 5365 | 5365 | $str |
| 5366 | 5366 | ); |
@@ -5410,9 +5410,9 @@ discard block |
||
| 5410 | 5410 | return ''; |
| 5411 | 5411 | } |
| 5412 | 5412 | |
| 5413 | - $str_length -= (int) $bom_byte_length; |
|
| 5413 | + $str_length -= (int)$bom_byte_length; |
|
| 5414 | 5414 | |
| 5415 | - $str = (string) $str_tmp; |
|
| 5415 | + $str = (string)$str_tmp; |
|
| 5416 | 5416 | } |
| 5417 | 5417 | } |
| 5418 | 5418 | |
@@ -5443,7 +5443,7 @@ discard block |
||
| 5443 | 5443 | */ |
| 5444 | 5444 | if (\is_array($what)) { |
| 5445 | 5445 | foreach ($what as $item) { |
| 5446 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
| 5446 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
| 5447 | 5447 | } |
| 5448 | 5448 | } |
| 5449 | 5449 | |
@@ -5481,7 +5481,7 @@ discard block |
||
| 5481 | 5481 | */ |
| 5482 | 5482 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
| 5483 | 5483 | { |
| 5484 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 5484 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 5485 | 5485 | } |
| 5486 | 5486 | |
| 5487 | 5487 | /** |
@@ -5542,17 +5542,17 @@ discard block |
||
| 5542 | 5542 | \strpos($str, $substring) === 0 |
| 5543 | 5543 | ) { |
| 5544 | 5544 | if ($encoding === 'UTF-8') { |
| 5545 | - return (string) \mb_substr( |
|
| 5545 | + return (string)\mb_substr( |
|
| 5546 | 5546 | $str, |
| 5547 | - (int) \mb_strlen($substring) |
|
| 5547 | + (int)\mb_strlen($substring) |
|
| 5548 | 5548 | ); |
| 5549 | 5549 | } |
| 5550 | 5550 | |
| 5551 | 5551 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5552 | 5552 | |
| 5553 | - return (string) self::substr( |
|
| 5553 | + return (string)self::substr( |
|
| 5554 | 5554 | $str, |
| 5555 | - (int) self::strlen($substring, $encoding), |
|
| 5555 | + (int)self::strlen($substring, $encoding), |
|
| 5556 | 5556 | null, |
| 5557 | 5557 | $encoding |
| 5558 | 5558 | ); |
@@ -5580,19 +5580,19 @@ discard block |
||
| 5580 | 5580 | ): string { |
| 5581 | 5581 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
| 5582 | 5582 | if ($encoding === 'UTF-8') { |
| 5583 | - return (string) \mb_substr( |
|
| 5583 | + return (string)\mb_substr( |
|
| 5584 | 5584 | $str, |
| 5585 | 5585 | 0, |
| 5586 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
| 5586 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
| 5587 | 5587 | ); |
| 5588 | 5588 | } |
| 5589 | 5589 | |
| 5590 | 5590 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5591 | 5591 | |
| 5592 | - return (string) self::substr( |
|
| 5592 | + return (string)self::substr( |
|
| 5593 | 5593 | $str, |
| 5594 | 5594 | 0, |
| 5595 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
| 5595 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
| 5596 | 5596 | $encoding |
| 5597 | 5597 | ); |
| 5598 | 5598 | } |
@@ -5694,7 +5694,7 @@ discard block |
||
| 5694 | 5694 | /** @noinspection PhpUsageOfSilenceOperatorInspection - ignore "Unknown character" warnings, it's working anyway */ |
| 5695 | 5695 | @\mb_substitute_character($replacement_char_helper); |
| 5696 | 5696 | // the polyfill maybe return false, so cast to string |
| 5697 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 5697 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 5698 | 5698 | \mb_substitute_character($save); |
| 5699 | 5699 | } |
| 5700 | 5700 | |
@@ -5740,7 +5740,7 @@ discard block |
||
| 5740 | 5740 | } |
| 5741 | 5741 | |
| 5742 | 5742 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5743 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 5743 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 5744 | 5744 | } |
| 5745 | 5745 | |
| 5746 | 5746 | if ($chars !== null) { |
@@ -5770,7 +5770,7 @@ discard block |
||
| 5770 | 5770 | $html .= '<pre>'; |
| 5771 | 5771 | /** @noinspection AlterInForeachInspection */ |
| 5772 | 5772 | foreach (self::$SUPPORT as $key => &$value) { |
| 5773 | - $html .= $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
| 5773 | + $html .= $key.' - '.\print_r($value, true)."\n<br>"; |
|
| 5774 | 5774 | } |
| 5775 | 5775 | $html .= '</pre>'; |
| 5776 | 5776 | |
@@ -5812,7 +5812,7 @@ discard block |
||
| 5812 | 5812 | return $char; |
| 5813 | 5813 | } |
| 5814 | 5814 | |
| 5815 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
| 5815 | + return '&#'.self::ord($char, $encoding).';'; |
|
| 5816 | 5816 | } |
| 5817 | 5817 | |
| 5818 | 5818 | /** |
@@ -5916,11 +5916,11 @@ discard block |
||
| 5916 | 5916 | $lang, |
| 5917 | 5917 | $try_to_keep_the_string_length |
| 5918 | 5918 | ); |
| 5919 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
| 5919 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
| 5920 | 5920 | |
| 5921 | 5921 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 5922 | 5922 | |
| 5923 | - $str = (string) \preg_replace_callback( |
|
| 5923 | + $str = (string)\preg_replace_callback( |
|
| 5924 | 5924 | '/[-_\\s]+(.)?/u', |
| 5925 | 5925 | /** |
| 5926 | 5926 | * @param array $match |
@@ -5929,7 +5929,7 @@ discard block |
||
| 5929 | 5929 | * |
| 5930 | 5930 | * @return string |
| 5931 | 5931 | */ |
| 5932 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
| 5932 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
| 5933 | 5933 | if (isset($match[1])) { |
| 5934 | 5934 | if ($use_mb_functions) { |
| 5935 | 5935 | if ($encoding === 'UTF-8') { |
@@ -5947,7 +5947,7 @@ discard block |
||
| 5947 | 5947 | $str |
| 5948 | 5948 | ); |
| 5949 | 5949 | |
| 5950 | - return (string) \preg_replace_callback( |
|
| 5950 | + return (string)\preg_replace_callback( |
|
| 5951 | 5951 | '/[\\p{N}]+(.)?/u', |
| 5952 | 5952 | /** |
| 5953 | 5953 | * @param array $match |
@@ -5956,7 +5956,7 @@ discard block |
||
| 5956 | 5956 | * |
| 5957 | 5957 | * @return string |
| 5958 | 5958 | */ |
| 5959 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
| 5959 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
| 5960 | 5960 | if ($use_mb_functions) { |
| 5961 | 5961 | if ($encoding === 'UTF-8') { |
| 5962 | 5962 | return \mb_strtoupper($match[0]); |
@@ -6150,7 +6150,7 @@ discard block |
||
| 6150 | 6150 | ): string { |
| 6151 | 6151 | if (self::$SUPPORT['mbstring'] === true) { |
| 6152 | 6152 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 6153 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
| 6153 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
| 6154 | 6154 | |
| 6155 | 6155 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 6156 | 6156 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -6160,10 +6160,10 @@ discard block |
||
| 6160 | 6160 | } |
| 6161 | 6161 | |
| 6162 | 6162 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 6163 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
| 6163 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
| 6164 | 6164 | } |
| 6165 | 6165 | |
| 6166 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
| 6166 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
| 6167 | 6167 | |
| 6168 | 6168 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 6169 | 6169 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -6172,7 +6172,7 @@ discard block |
||
| 6172 | 6172 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
| 6173 | 6173 | } |
| 6174 | 6174 | |
| 6175 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
| 6175 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
| 6176 | 6176 | } |
| 6177 | 6177 | |
| 6178 | 6178 | /** |
@@ -6196,7 +6196,7 @@ discard block |
||
| 6196 | 6196 | public static function str_detect_encoding($str) |
| 6197 | 6197 | { |
| 6198 | 6198 | // init |
| 6199 | - $str = (string) $str; |
|
| 6199 | + $str = (string)$str; |
|
| 6200 | 6200 | |
| 6201 | 6201 | // |
| 6202 | 6202 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -6298,7 +6298,7 @@ discard block |
||
| 6298 | 6298 | foreach (self::$ENCODINGS as $encoding_tmp) { |
| 6299 | 6299 | // INFO: //IGNORE but still throw notice |
| 6300 | 6300 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 6301 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
| 6301 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
| 6302 | 6302 | return $encoding_tmp; |
| 6303 | 6303 | } |
| 6304 | 6304 | } |
@@ -6401,7 +6401,7 @@ discard block |
||
| 6401 | 6401 | return $str; |
| 6402 | 6402 | } |
| 6403 | 6403 | |
| 6404 | - return $substring . $str; |
|
| 6404 | + return $substring.$str; |
|
| 6405 | 6405 | } |
| 6406 | 6406 | |
| 6407 | 6407 | /** |
@@ -6697,27 +6697,27 @@ discard block |
||
| 6697 | 6697 | string $encoding = 'UTF-8' |
| 6698 | 6698 | ): string { |
| 6699 | 6699 | if ($encoding === 'UTF-8') { |
| 6700 | - $len = (int) \mb_strlen($str); |
|
| 6700 | + $len = (int)\mb_strlen($str); |
|
| 6701 | 6701 | if ($index > $len) { |
| 6702 | 6702 | return $str; |
| 6703 | 6703 | } |
| 6704 | 6704 | |
| 6705 | 6705 | /** @noinspection UnnecessaryCastingInspection */ |
| 6706 | - return (string) \mb_substr($str, 0, $index) . |
|
| 6707 | - $substring . |
|
| 6708 | - (string) \mb_substr($str, $index, $len); |
|
| 6706 | + return (string)\mb_substr($str, 0, $index). |
|
| 6707 | + $substring. |
|
| 6708 | + (string)\mb_substr($str, $index, $len); |
|
| 6709 | 6709 | } |
| 6710 | 6710 | |
| 6711 | 6711 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6712 | 6712 | |
| 6713 | - $len = (int) self::strlen($str, $encoding); |
|
| 6713 | + $len = (int)self::strlen($str, $encoding); |
|
| 6714 | 6714 | if ($index > $len) { |
| 6715 | 6715 | return $str; |
| 6716 | 6716 | } |
| 6717 | 6717 | |
| 6718 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
| 6719 | - $substring . |
|
| 6720 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
| 6718 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
| 6719 | + $substring. |
|
| 6720 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
| 6721 | 6721 | } |
| 6722 | 6722 | |
| 6723 | 6723 | /** |
@@ -6757,15 +6757,15 @@ discard block |
||
| 6757 | 6757 | */ |
| 6758 | 6758 | public static function str_ireplace($search, $replacement, $subject, &$count = null) |
| 6759 | 6759 | { |
| 6760 | - $search = (array) $search; |
|
| 6760 | + $search = (array)$search; |
|
| 6761 | 6761 | |
| 6762 | 6762 | /** @noinspection AlterInForeachInspection */ |
| 6763 | 6763 | foreach ($search as &$s) { |
| 6764 | - $s = (string) $s; |
|
| 6764 | + $s = (string)$s; |
|
| 6765 | 6765 | if ($s === '') { |
| 6766 | 6766 | $s = '/^(?<=.)$/'; |
| 6767 | 6767 | } else { |
| 6768 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
| 6768 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
| 6769 | 6769 | } |
| 6770 | 6770 | } |
| 6771 | 6771 | |
@@ -6803,12 +6803,12 @@ discard block |
||
| 6803 | 6803 | } |
| 6804 | 6804 | |
| 6805 | 6805 | if ($search === '') { |
| 6806 | - return $str . $replacement; |
|
| 6806 | + return $str.$replacement; |
|
| 6807 | 6807 | } |
| 6808 | 6808 | |
| 6809 | 6809 | $searchLength = \strlen($search); |
| 6810 | 6810 | if (\strncasecmp($str, $search, $searchLength) === 0) { |
| 6811 | - return $replacement . \substr($str, $searchLength); |
|
| 6811 | + return $replacement.\substr($str, $searchLength); |
|
| 6812 | 6812 | } |
| 6813 | 6813 | |
| 6814 | 6814 | return $str; |
@@ -6839,11 +6839,11 @@ discard block |
||
| 6839 | 6839 | } |
| 6840 | 6840 | |
| 6841 | 6841 | if ($search === '') { |
| 6842 | - return $str . $replacement; |
|
| 6842 | + return $str.$replacement; |
|
| 6843 | 6843 | } |
| 6844 | 6844 | |
| 6845 | 6845 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 6846 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 6846 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 6847 | 6847 | } |
| 6848 | 6848 | |
| 6849 | 6849 | return $str; |
@@ -6935,15 +6935,15 @@ discard block |
||
| 6935 | 6935 | } |
| 6936 | 6936 | |
| 6937 | 6937 | if ($encoding === 'UTF-8') { |
| 6938 | - return (string) \mb_substr( |
|
| 6938 | + return (string)\mb_substr( |
|
| 6939 | 6939 | $str, |
| 6940 | - $offset + (int) \mb_strlen($separator) |
|
| 6940 | + $offset + (int)\mb_strlen($separator) |
|
| 6941 | 6941 | ); |
| 6942 | 6942 | } |
| 6943 | 6943 | |
| 6944 | - return (string) self::substr( |
|
| 6944 | + return (string)self::substr( |
|
| 6945 | 6945 | $str, |
| 6946 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6946 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6947 | 6947 | null, |
| 6948 | 6948 | $encoding |
| 6949 | 6949 | ); |
@@ -6975,15 +6975,15 @@ discard block |
||
| 6975 | 6975 | } |
| 6976 | 6976 | |
| 6977 | 6977 | if ($encoding === 'UTF-8') { |
| 6978 | - return (string) \mb_substr( |
|
| 6978 | + return (string)\mb_substr( |
|
| 6979 | 6979 | $str, |
| 6980 | - $offset + (int) self::strlen($separator) |
|
| 6980 | + $offset + (int)self::strlen($separator) |
|
| 6981 | 6981 | ); |
| 6982 | 6982 | } |
| 6983 | 6983 | |
| 6984 | - return (string) self::substr( |
|
| 6984 | + return (string)self::substr( |
|
| 6985 | 6985 | $str, |
| 6986 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6986 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6987 | 6987 | null, |
| 6988 | 6988 | $encoding |
| 6989 | 6989 | ); |
@@ -7015,10 +7015,10 @@ discard block |
||
| 7015 | 7015 | } |
| 7016 | 7016 | |
| 7017 | 7017 | if ($encoding === 'UTF-8') { |
| 7018 | - return (string) \mb_substr($str, 0, $offset); |
|
| 7018 | + return (string)\mb_substr($str, 0, $offset); |
|
| 7019 | 7019 | } |
| 7020 | 7020 | |
| 7021 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 7021 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 7022 | 7022 | } |
| 7023 | 7023 | |
| 7024 | 7024 | /** |
@@ -7047,7 +7047,7 @@ discard block |
||
| 7047 | 7047 | return ''; |
| 7048 | 7048 | } |
| 7049 | 7049 | |
| 7050 | - return (string) \mb_substr($str, 0, $offset); |
|
| 7050 | + return (string)\mb_substr($str, 0, $offset); |
|
| 7051 | 7051 | } |
| 7052 | 7052 | |
| 7053 | 7053 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -7055,7 +7055,7 @@ discard block |
||
| 7055 | 7055 | return ''; |
| 7056 | 7056 | } |
| 7057 | 7057 | |
| 7058 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 7058 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 7059 | 7059 | } |
| 7060 | 7060 | |
| 7061 | 7061 | /** |
@@ -7157,12 +7157,12 @@ discard block |
||
| 7157 | 7157 | } |
| 7158 | 7158 | |
| 7159 | 7159 | if ($encoding === 'UTF-8') { |
| 7160 | - return (string) \mb_substr($str, -$n); |
|
| 7160 | + return (string)\mb_substr($str, -$n); |
|
| 7161 | 7161 | } |
| 7162 | 7162 | |
| 7163 | 7163 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7164 | 7164 | |
| 7165 | - return (string) self::substr($str, -$n, null, $encoding); |
|
| 7165 | + return (string)self::substr($str, -$n, null, $encoding); |
|
| 7166 | 7166 | } |
| 7167 | 7167 | |
| 7168 | 7168 | /** |
@@ -7188,21 +7188,21 @@ discard block |
||
| 7188 | 7188 | } |
| 7189 | 7189 | |
| 7190 | 7190 | if ($encoding === 'UTF-8') { |
| 7191 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 7191 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 7192 | 7192 | return $str; |
| 7193 | 7193 | } |
| 7194 | 7194 | |
| 7195 | 7195 | /** @noinspection UnnecessaryCastingInspection */ |
| 7196 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
| 7196 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
| 7197 | 7197 | } |
| 7198 | 7198 | |
| 7199 | 7199 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7200 | 7200 | |
| 7201 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 7201 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 7202 | 7202 | return $str; |
| 7203 | 7203 | } |
| 7204 | 7204 | |
| 7205 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
| 7205 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
| 7206 | 7206 | } |
| 7207 | 7207 | |
| 7208 | 7208 | /** |
@@ -7231,12 +7231,12 @@ discard block |
||
| 7231 | 7231 | |
| 7232 | 7232 | if ($encoding === 'UTF-8') { |
| 7233 | 7233 | /** @noinspection UnnecessaryCastingInspection */ |
| 7234 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 7234 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 7235 | 7235 | return $str; |
| 7236 | 7236 | } |
| 7237 | 7237 | |
| 7238 | 7238 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
| 7239 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
| 7239 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
| 7240 | 7240 | } |
| 7241 | 7241 | |
| 7242 | 7242 | $str = \mb_substr($str, 0, $length); |
@@ -7245,33 +7245,33 @@ discard block |
||
| 7245 | 7245 | $new_str = \implode(' ', $array); |
| 7246 | 7246 | |
| 7247 | 7247 | if ($new_str === '') { |
| 7248 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
| 7248 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
| 7249 | 7249 | } |
| 7250 | 7250 | } else { |
| 7251 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 7251 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 7252 | 7252 | return $str; |
| 7253 | 7253 | } |
| 7254 | 7254 | |
| 7255 | 7255 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
| 7256 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
| 7256 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
| 7257 | 7257 | } |
| 7258 | 7258 | |
| 7259 | 7259 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 7260 | 7260 | $str = self::substr($str, 0, $length, $encoding); |
| 7261 | 7261 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 7262 | 7262 | if ($str === false) { |
| 7263 | - return '' . $str_add_on; |
|
| 7263 | + return ''.$str_add_on; |
|
| 7264 | 7264 | } |
| 7265 | 7265 | |
| 7266 | 7266 | $array = \explode(' ', $str, -1); |
| 7267 | 7267 | $new_str = \implode(' ', $array); |
| 7268 | 7268 | |
| 7269 | 7269 | if ($new_str === '') { |
| 7270 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
| 7270 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
| 7271 | 7271 | } |
| 7272 | 7272 | } |
| 7273 | 7273 | |
| 7274 | - return $new_str . $str_add_on; |
|
| 7274 | + return $new_str.$str_add_on; |
|
| 7275 | 7275 | } |
| 7276 | 7276 | |
| 7277 | 7277 | /** |
@@ -7294,7 +7294,7 @@ discard block |
||
| 7294 | 7294 | $longest_common_prefix = ''; |
| 7295 | 7295 | |
| 7296 | 7296 | if ($encoding === 'UTF-8') { |
| 7297 | - $max_length = (int) \min( |
|
| 7297 | + $max_length = (int)\min( |
|
| 7298 | 7298 | \mb_strlen($str1), |
| 7299 | 7299 | \mb_strlen($str2) |
| 7300 | 7300 | ); |
@@ -7315,7 +7315,7 @@ discard block |
||
| 7315 | 7315 | } else { |
| 7316 | 7316 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7317 | 7317 | |
| 7318 | - $max_length = (int) \min( |
|
| 7318 | + $max_length = (int)\min( |
|
| 7319 | 7319 | self::strlen($str1, $encoding), |
| 7320 | 7320 | self::strlen($str2, $encoding) |
| 7321 | 7321 | ); |
@@ -7364,13 +7364,13 @@ discard block |
||
| 7364 | 7364 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
| 7365 | 7365 | |
| 7366 | 7366 | if ($encoding === 'UTF-8') { |
| 7367 | - $str_length = (int) \mb_strlen($str1); |
|
| 7368 | - $other_length = (int) \mb_strlen($str2); |
|
| 7367 | + $str_length = (int)\mb_strlen($str1); |
|
| 7368 | + $other_length = (int)\mb_strlen($str2); |
|
| 7369 | 7369 | } else { |
| 7370 | 7370 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7371 | 7371 | |
| 7372 | - $str_length = (int) self::strlen($str1, $encoding); |
|
| 7373 | - $other_length = (int) self::strlen($str2, $encoding); |
|
| 7372 | + $str_length = (int)self::strlen($str1, $encoding); |
|
| 7373 | + $other_length = (int)self::strlen($str2, $encoding); |
|
| 7374 | 7374 | } |
| 7375 | 7375 | |
| 7376 | 7376 | // Return if either string is empty |
@@ -7423,10 +7423,10 @@ discard block |
||
| 7423 | 7423 | } |
| 7424 | 7424 | |
| 7425 | 7425 | if ($encoding === 'UTF-8') { |
| 7426 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
| 7426 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
| 7427 | 7427 | } |
| 7428 | 7428 | |
| 7429 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
| 7429 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
| 7430 | 7430 | } |
| 7431 | 7431 | |
| 7432 | 7432 | /** |
@@ -7450,7 +7450,7 @@ discard block |
||
| 7450 | 7450 | } |
| 7451 | 7451 | |
| 7452 | 7452 | if ($encoding === 'UTF-8') { |
| 7453 | - $max_length = (int) \min( |
|
| 7453 | + $max_length = (int)\min( |
|
| 7454 | 7454 | \mb_strlen($str1, $encoding), |
| 7455 | 7455 | \mb_strlen($str2, $encoding) |
| 7456 | 7456 | ); |
@@ -7464,7 +7464,7 @@ discard block |
||
| 7464 | 7464 | && |
| 7465 | 7465 | $char === \mb_substr($str2, -$i, 1) |
| 7466 | 7466 | ) { |
| 7467 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
| 7467 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
| 7468 | 7468 | } else { |
| 7469 | 7469 | break; |
| 7470 | 7470 | } |
@@ -7472,7 +7472,7 @@ discard block |
||
| 7472 | 7472 | } else { |
| 7473 | 7473 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7474 | 7474 | |
| 7475 | - $max_length = (int) \min( |
|
| 7475 | + $max_length = (int)\min( |
|
| 7476 | 7476 | self::strlen($str1, $encoding), |
| 7477 | 7477 | self::strlen($str2, $encoding) |
| 7478 | 7478 | ); |
@@ -7486,7 +7486,7 @@ discard block |
||
| 7486 | 7486 | && |
| 7487 | 7487 | $char === self::substr($str2, -$i, 1, $encoding) |
| 7488 | 7488 | ) { |
| 7489 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
| 7489 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
| 7490 | 7490 | } else { |
| 7491 | 7491 | break; |
| 7492 | 7492 | } |
@@ -7509,7 +7509,7 @@ discard block |
||
| 7509 | 7509 | */ |
| 7510 | 7510 | public static function str_matches_pattern(string $str, string $pattern): bool |
| 7511 | 7511 | { |
| 7512 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
| 7512 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
| 7513 | 7513 | } |
| 7514 | 7514 | |
| 7515 | 7515 | /** |
@@ -7529,7 +7529,7 @@ discard block |
||
| 7529 | 7529 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
| 7530 | 7530 | { |
| 7531 | 7531 | // init |
| 7532 | - $length = (int) self::strlen($str, $encoding); |
|
| 7532 | + $length = (int)self::strlen($str, $encoding); |
|
| 7533 | 7533 | |
| 7534 | 7534 | if ($offset >= 0) { |
| 7535 | 7535 | return $length > $offset; |
@@ -7558,7 +7558,7 @@ discard block |
||
| 7558 | 7558 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
| 7559 | 7559 | { |
| 7560 | 7560 | // init |
| 7561 | - $length = (int) self::strlen($str); |
|
| 7561 | + $length = (int)self::strlen($str); |
|
| 7562 | 7562 | |
| 7563 | 7563 | if ( |
| 7564 | 7564 | ($index >= 0 && $length <= $index) |
@@ -7602,7 +7602,7 @@ discard block |
||
| 7602 | 7602 | return $str; |
| 7603 | 7603 | } |
| 7604 | 7604 | |
| 7605 | - if ($pad_type !== (int) $pad_type) { |
|
| 7605 | + if ($pad_type !== (int)$pad_type) { |
|
| 7606 | 7606 | if ($pad_type === 'left') { |
| 7607 | 7607 | $pad_type = \STR_PAD_LEFT; |
| 7608 | 7608 | } elseif ($pad_type === 'right') { |
@@ -7611,23 +7611,23 @@ discard block |
||
| 7611 | 7611 | $pad_type = \STR_PAD_BOTH; |
| 7612 | 7612 | } else { |
| 7613 | 7613 | throw new \InvalidArgumentException( |
| 7614 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
| 7614 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
| 7615 | 7615 | ); |
| 7616 | 7616 | } |
| 7617 | 7617 | } |
| 7618 | 7618 | |
| 7619 | 7619 | if ($encoding === 'UTF-8') { |
| 7620 | - $str_length = (int) \mb_strlen($str); |
|
| 7620 | + $str_length = (int)\mb_strlen($str); |
|
| 7621 | 7621 | |
| 7622 | 7622 | if ($pad_length >= $str_length) { |
| 7623 | 7623 | switch ($pad_type) { |
| 7624 | 7624 | case \STR_PAD_LEFT: |
| 7625 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 7625 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 7626 | 7626 | |
| 7627 | 7627 | $diff = ($pad_length - $str_length); |
| 7628 | 7628 | |
| 7629 | - $pre = (string) \mb_substr( |
|
| 7630 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7629 | + $pre = (string)\mb_substr( |
|
| 7630 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7631 | 7631 | 0, |
| 7632 | 7632 | $diff |
| 7633 | 7633 | ); |
@@ -7638,16 +7638,16 @@ discard block |
||
| 7638 | 7638 | case \STR_PAD_BOTH: |
| 7639 | 7639 | $diff = ($pad_length - $str_length); |
| 7640 | 7640 | |
| 7641 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 7641 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 7642 | 7642 | |
| 7643 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 7643 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 7644 | 7644 | |
| 7645 | - $pre = (string) \mb_substr( |
|
| 7645 | + $pre = (string)\mb_substr( |
|
| 7646 | 7646 | \str_repeat($pad_string, $ps_length_left), |
| 7647 | 7647 | 0, |
| 7648 | 7648 | $ps_length_left |
| 7649 | 7649 | ); |
| 7650 | - $post = (string) \mb_substr( |
|
| 7650 | + $post = (string)\mb_substr( |
|
| 7651 | 7651 | \str_repeat($pad_string, $ps_length_right), |
| 7652 | 7652 | 0, |
| 7653 | 7653 | $ps_length_right |
@@ -7657,19 +7657,19 @@ discard block |
||
| 7657 | 7657 | |
| 7658 | 7658 | case \STR_PAD_RIGHT: |
| 7659 | 7659 | default: |
| 7660 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 7660 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 7661 | 7661 | |
| 7662 | 7662 | $diff = ($pad_length - $str_length); |
| 7663 | 7663 | |
| 7664 | - $post = (string) \mb_substr( |
|
| 7665 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7664 | + $post = (string)\mb_substr( |
|
| 7665 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7666 | 7666 | 0, |
| 7667 | 7667 | $diff |
| 7668 | 7668 | ); |
| 7669 | 7669 | $pre = ''; |
| 7670 | 7670 | } |
| 7671 | 7671 | |
| 7672 | - return $pre . $str . $post; |
|
| 7672 | + return $pre.$str.$post; |
|
| 7673 | 7673 | } |
| 7674 | 7674 | |
| 7675 | 7675 | return $str; |
@@ -7677,17 +7677,17 @@ discard block |
||
| 7677 | 7677 | |
| 7678 | 7678 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7679 | 7679 | |
| 7680 | - $str_length = (int) self::strlen($str, $encoding); |
|
| 7680 | + $str_length = (int)self::strlen($str, $encoding); |
|
| 7681 | 7681 | |
| 7682 | 7682 | if ($pad_length >= $str_length) { |
| 7683 | 7683 | switch ($pad_type) { |
| 7684 | 7684 | case \STR_PAD_LEFT: |
| 7685 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 7685 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 7686 | 7686 | |
| 7687 | 7687 | $diff = ($pad_length - $str_length); |
| 7688 | 7688 | |
| 7689 | - $pre = (string) self::substr( |
|
| 7690 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7689 | + $pre = (string)self::substr( |
|
| 7690 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7691 | 7691 | 0, |
| 7692 | 7692 | $diff, |
| 7693 | 7693 | $encoding |
@@ -7699,17 +7699,17 @@ discard block |
||
| 7699 | 7699 | case \STR_PAD_BOTH: |
| 7700 | 7700 | $diff = ($pad_length - $str_length); |
| 7701 | 7701 | |
| 7702 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 7702 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 7703 | 7703 | |
| 7704 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 7704 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 7705 | 7705 | |
| 7706 | - $pre = (string) self::substr( |
|
| 7706 | + $pre = (string)self::substr( |
|
| 7707 | 7707 | \str_repeat($pad_string, $ps_length_left), |
| 7708 | 7708 | 0, |
| 7709 | 7709 | $ps_length_left, |
| 7710 | 7710 | $encoding |
| 7711 | 7711 | ); |
| 7712 | - $post = (string) self::substr( |
|
| 7712 | + $post = (string)self::substr( |
|
| 7713 | 7713 | \str_repeat($pad_string, $ps_length_right), |
| 7714 | 7714 | 0, |
| 7715 | 7715 | $ps_length_right, |
@@ -7720,12 +7720,12 @@ discard block |
||
| 7720 | 7720 | |
| 7721 | 7721 | case \STR_PAD_RIGHT: |
| 7722 | 7722 | default: |
| 7723 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 7723 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 7724 | 7724 | |
| 7725 | 7725 | $diff = ($pad_length - $str_length); |
| 7726 | 7726 | |
| 7727 | - $post = (string) self::substr( |
|
| 7728 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 7727 | + $post = (string)self::substr( |
|
| 7728 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 7729 | 7729 | 0, |
| 7730 | 7730 | $diff, |
| 7731 | 7731 | $encoding |
@@ -7733,7 +7733,7 @@ discard block |
||
| 7733 | 7733 | $pre = ''; |
| 7734 | 7734 | } |
| 7735 | 7735 | |
| 7736 | - return $pre . $str . $post; |
|
| 7736 | + return $pre.$str.$post; |
|
| 7737 | 7737 | } |
| 7738 | 7738 | |
| 7739 | 7739 | return $str; |
@@ -7944,12 +7944,12 @@ discard block |
||
| 7944 | 7944 | } |
| 7945 | 7945 | |
| 7946 | 7946 | if ($search === '') { |
| 7947 | - return $str . $replacement; |
|
| 7947 | + return $str.$replacement; |
|
| 7948 | 7948 | } |
| 7949 | 7949 | |
| 7950 | 7950 | $searchLength = \strlen($search); |
| 7951 | 7951 | if (\strncmp($str, $search, $searchLength) === 0) { |
| 7952 | - return $replacement . \substr($str, $searchLength); |
|
| 7952 | + return $replacement.\substr($str, $searchLength); |
|
| 7953 | 7953 | } |
| 7954 | 7954 | |
| 7955 | 7955 | return $str; |
@@ -7983,11 +7983,11 @@ discard block |
||
| 7983 | 7983 | } |
| 7984 | 7984 | |
| 7985 | 7985 | if ($search === '') { |
| 7986 | - return $str . $replacement; |
|
| 7986 | + return $str.$replacement; |
|
| 7987 | 7987 | } |
| 7988 | 7988 | |
| 7989 | 7989 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 7990 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 7990 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 7991 | 7991 | } |
| 7992 | 7992 | |
| 7993 | 7993 | return $str; |
@@ -8021,7 +8021,7 @@ discard block |
||
| 8021 | 8021 | $subject, |
| 8022 | 8022 | $replace, |
| 8023 | 8023 | $pos, |
| 8024 | - (int) self::strlen($search) |
|
| 8024 | + (int)self::strlen($search) |
|
| 8025 | 8025 | ); |
| 8026 | 8026 | } |
| 8027 | 8027 | |
@@ -8055,7 +8055,7 @@ discard block |
||
| 8055 | 8055 | $subject, |
| 8056 | 8056 | $replace, |
| 8057 | 8057 | $pos, |
| 8058 | - (int) self::strlen($search) |
|
| 8058 | + (int)self::strlen($search) |
|
| 8059 | 8059 | ); |
| 8060 | 8060 | } |
| 8061 | 8061 | |
@@ -8078,7 +8078,7 @@ discard block |
||
| 8078 | 8078 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
| 8079 | 8079 | { |
| 8080 | 8080 | if ($encoding === 'UTF-8') { |
| 8081 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
| 8081 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
| 8082 | 8082 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 8083 | 8083 | \shuffle($indexes); |
| 8084 | 8084 | |
@@ -8094,7 +8094,7 @@ discard block |
||
| 8094 | 8094 | } else { |
| 8095 | 8095 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8096 | 8096 | |
| 8097 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
| 8097 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
| 8098 | 8098 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 8099 | 8099 | \shuffle($indexes); |
| 8100 | 8100 | |
@@ -8137,11 +8137,11 @@ discard block |
||
| 8137 | 8137 | ) { |
| 8138 | 8138 | if ($encoding === 'UTF-8') { |
| 8139 | 8139 | if ($end === null) { |
| 8140 | - $length = (int) \mb_strlen($str); |
|
| 8140 | + $length = (int)\mb_strlen($str); |
|
| 8141 | 8141 | } elseif ($end >= 0 && $end <= $start) { |
| 8142 | 8142 | return ''; |
| 8143 | 8143 | } elseif ($end < 0) { |
| 8144 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
| 8144 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
| 8145 | 8145 | } else { |
| 8146 | 8146 | $length = $end - $start; |
| 8147 | 8147 | } |
@@ -8152,11 +8152,11 @@ discard block |
||
| 8152 | 8152 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8153 | 8153 | |
| 8154 | 8154 | if ($end === null) { |
| 8155 | - $length = (int) self::strlen($str, $encoding); |
|
| 8155 | + $length = (int)self::strlen($str, $encoding); |
|
| 8156 | 8156 | } elseif ($end >= 0 && $end <= $start) { |
| 8157 | 8157 | return ''; |
| 8158 | 8158 | } elseif ($end < 0) { |
| 8159 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
| 8159 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
| 8160 | 8160 | } else { |
| 8161 | 8161 | $length = $end - $start; |
| 8162 | 8162 | } |
@@ -8191,7 +8191,7 @@ discard block |
||
| 8191 | 8191 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8192 | 8192 | } |
| 8193 | 8193 | |
| 8194 | - $str = (string) \preg_replace_callback( |
|
| 8194 | + $str = (string)\preg_replace_callback( |
|
| 8195 | 8195 | '/([\\p{N}|\\p{Lu}])/u', |
| 8196 | 8196 | /** |
| 8197 | 8197 | * @param string[] $matches |
@@ -8200,28 +8200,28 @@ discard block |
||
| 8200 | 8200 | * |
| 8201 | 8201 | * @return string |
| 8202 | 8202 | */ |
| 8203 | - static function (array $matches) use ($encoding): string { |
|
| 8203 | + static function(array $matches) use ($encoding): string { |
|
| 8204 | 8204 | $match = $matches[1]; |
| 8205 | - $match_int = (int) $match; |
|
| 8205 | + $match_int = (int)$match; |
|
| 8206 | 8206 | |
| 8207 | - if ((string) $match_int === $match) { |
|
| 8208 | - return '_' . $match . '_'; |
|
| 8207 | + if ((string)$match_int === $match) { |
|
| 8208 | + return '_'.$match.'_'; |
|
| 8209 | 8209 | } |
| 8210 | 8210 | |
| 8211 | 8211 | if ($encoding === 'UTF-8') { |
| 8212 | - return '_' . \mb_strtolower($match); |
|
| 8212 | + return '_'.\mb_strtolower($match); |
|
| 8213 | 8213 | } |
| 8214 | 8214 | |
| 8215 | - return '_' . self::strtolower($match, $encoding); |
|
| 8215 | + return '_'.self::strtolower($match, $encoding); |
|
| 8216 | 8216 | }, |
| 8217 | 8217 | $str |
| 8218 | 8218 | ); |
| 8219 | 8219 | |
| 8220 | - $str = (string) \preg_replace( |
|
| 8220 | + $str = (string)\preg_replace( |
|
| 8221 | 8221 | [ |
| 8222 | - '/\\s+/u', // convert spaces to "_" |
|
| 8222 | + '/\\s+/u', // convert spaces to "_" |
|
| 8223 | 8223 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
| 8224 | - '/_+/', // remove double "_" |
|
| 8224 | + '/_+/', // remove double "_" |
|
| 8225 | 8225 | ], |
| 8226 | 8226 | [ |
| 8227 | 8227 | '_', |
@@ -8352,7 +8352,7 @@ discard block |
||
| 8352 | 8352 | } |
| 8353 | 8353 | |
| 8354 | 8354 | // init |
| 8355 | - $input = (string) $input; |
|
| 8355 | + $input = (string)$input; |
|
| 8356 | 8356 | |
| 8357 | 8357 | if ($input === '') { |
| 8358 | 8358 | return []; |
@@ -8409,7 +8409,7 @@ discard block |
||
| 8409 | 8409 | ($input[$i] & "\xE0") === "\xC0" |
| 8410 | 8410 | ) { |
| 8411 | 8411 | if (($input[$i + 1] & "\xC0") === "\x80") { |
| 8412 | - $ret[] = $input[$i] . $input[$i + 1]; |
|
| 8412 | + $ret[] = $input[$i].$input[$i + 1]; |
|
| 8413 | 8413 | |
| 8414 | 8414 | ++$i; |
| 8415 | 8415 | } |
@@ -8423,7 +8423,7 @@ discard block |
||
| 8423 | 8423 | && |
| 8424 | 8424 | ($input[$i + 2] & "\xC0") === "\x80" |
| 8425 | 8425 | ) { |
| 8426 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2]; |
|
| 8426 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2]; |
|
| 8427 | 8427 | |
| 8428 | 8428 | $i += 2; |
| 8429 | 8429 | } |
@@ -8439,7 +8439,7 @@ discard block |
||
| 8439 | 8439 | && |
| 8440 | 8440 | ($input[$i + 3] & "\xC0") === "\x80" |
| 8441 | 8441 | ) { |
| 8442 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2] . $input[$i + 3]; |
|
| 8442 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2].$input[$i + 3]; |
|
| 8443 | 8443 | |
| 8444 | 8444 | $i += 3; |
| 8445 | 8445 | } |
@@ -8451,7 +8451,7 @@ discard block |
||
| 8451 | 8451 | $ret = \array_chunk($ret, $length); |
| 8452 | 8452 | |
| 8453 | 8453 | return \array_map( |
| 8454 | - static function (array &$item): string { |
|
| 8454 | + static function(array &$item): string { |
|
| 8455 | 8455 | return \implode('', $item); |
| 8456 | 8456 | }, |
| 8457 | 8457 | $ret |
@@ -8517,7 +8517,7 @@ discard block |
||
| 8517 | 8517 | $limit = -1; |
| 8518 | 8518 | } |
| 8519 | 8519 | |
| 8520 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
| 8520 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
| 8521 | 8521 | |
| 8522 | 8522 | if ($array === false) { |
| 8523 | 8523 | return []; |
@@ -8613,9 +8613,9 @@ discard block |
||
| 8613 | 8613 | return ''; |
| 8614 | 8614 | } |
| 8615 | 8615 | |
| 8616 | - return (string) \mb_substr( |
|
| 8616 | + return (string)\mb_substr( |
|
| 8617 | 8617 | $str, |
| 8618 | - $offset + (int) \mb_strlen($separator) |
|
| 8618 | + $offset + (int)\mb_strlen($separator) |
|
| 8619 | 8619 | ); |
| 8620 | 8620 | } |
| 8621 | 8621 | |
@@ -8624,9 +8624,9 @@ discard block |
||
| 8624 | 8624 | return ''; |
| 8625 | 8625 | } |
| 8626 | 8626 | |
| 8627 | - return (string) \mb_substr( |
|
| 8627 | + return (string)\mb_substr( |
|
| 8628 | 8628 | $str, |
| 8629 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 8629 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 8630 | 8630 | null, |
| 8631 | 8631 | $encoding |
| 8632 | 8632 | ); |
@@ -8658,9 +8658,9 @@ discard block |
||
| 8658 | 8658 | return ''; |
| 8659 | 8659 | } |
| 8660 | 8660 | |
| 8661 | - return (string) \mb_substr( |
|
| 8661 | + return (string)\mb_substr( |
|
| 8662 | 8662 | $str, |
| 8663 | - $offset + (int) \mb_strlen($separator) |
|
| 8663 | + $offset + (int)\mb_strlen($separator) |
|
| 8664 | 8664 | ); |
| 8665 | 8665 | } |
| 8666 | 8666 | |
@@ -8669,9 +8669,9 @@ discard block |
||
| 8669 | 8669 | return ''; |
| 8670 | 8670 | } |
| 8671 | 8671 | |
| 8672 | - return (string) self::substr( |
|
| 8672 | + return (string)self::substr( |
|
| 8673 | 8673 | $str, |
| 8674 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 8674 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 8675 | 8675 | null, |
| 8676 | 8676 | $encoding |
| 8677 | 8677 | ); |
@@ -8703,7 +8703,7 @@ discard block |
||
| 8703 | 8703 | return ''; |
| 8704 | 8704 | } |
| 8705 | 8705 | |
| 8706 | - return (string) \mb_substr( |
|
| 8706 | + return (string)\mb_substr( |
|
| 8707 | 8707 | $str, |
| 8708 | 8708 | 0, |
| 8709 | 8709 | $offset |
@@ -8715,7 +8715,7 @@ discard block |
||
| 8715 | 8715 | return ''; |
| 8716 | 8716 | } |
| 8717 | 8717 | |
| 8718 | - return (string) self::substr( |
|
| 8718 | + return (string)self::substr( |
|
| 8719 | 8719 | $str, |
| 8720 | 8720 | 0, |
| 8721 | 8721 | $offset, |
@@ -8746,7 +8746,7 @@ discard block |
||
| 8746 | 8746 | return ''; |
| 8747 | 8747 | } |
| 8748 | 8748 | |
| 8749 | - return (string) \mb_substr( |
|
| 8749 | + return (string)\mb_substr( |
|
| 8750 | 8750 | $str, |
| 8751 | 8751 | 0, |
| 8752 | 8752 | $offset |
@@ -8760,7 +8760,7 @@ discard block |
||
| 8760 | 8760 | |
| 8761 | 8761 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 8762 | 8762 | |
| 8763 | - return (string) self::substr( |
|
| 8763 | + return (string)self::substr( |
|
| 8764 | 8764 | $str, |
| 8765 | 8765 | 0, |
| 8766 | 8766 | $offset, |
@@ -8875,7 +8875,7 @@ discard block |
||
| 8875 | 8875 | */ |
| 8876 | 8876 | public static function str_surround(string $str, string $substring): string |
| 8877 | 8877 | { |
| 8878 | - return $substring . $str . $substring; |
|
| 8878 | + return $substring.$str.$substring; |
|
| 8879 | 8879 | } |
| 8880 | 8880 | |
| 8881 | 8881 | /** |
@@ -8939,9 +8939,9 @@ discard block |
||
| 8939 | 8939 | $word_define_chars = ''; |
| 8940 | 8940 | } |
| 8941 | 8941 | |
| 8942 | - $str = (string) \preg_replace_callback( |
|
| 8943 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
| 8944 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
| 8942 | + $str = (string)\preg_replace_callback( |
|
| 8943 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
| 8944 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
| 8945 | 8945 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
| 8946 | 8946 | return $match[0]; |
| 8947 | 8947 | } |
@@ -9108,16 +9108,16 @@ discard block |
||
| 9108 | 9108 | |
| 9109 | 9109 | // the main substitutions |
| 9110 | 9110 | /** @noinspection RegExpDuplicateAlternationBranch - false-positive - https://youtrack.jetbrains.com/issue/WI-51002 */ |
| 9111 | - $str = (string) \preg_replace_callback( |
|
| 9111 | + $str = (string)\preg_replace_callback( |
|
| 9112 | 9112 | '~\\b (_*) (?: # 1. Leading underscore and |
| 9113 | 9113 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
| 9114 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
| 9114 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
| 9115 | 9115 | | |
| 9116 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
| 9116 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
| 9117 | 9117 | | |
| 9118 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
| 9118 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
| 9119 | 9119 | | |
| 9120 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
| 9120 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
| 9121 | 9121 | ) (_*) \\b # 6. With trailing underscore |
| 9122 | 9122 | ~ux', |
| 9123 | 9123 | /** |
@@ -9127,7 +9127,7 @@ discard block |
||
| 9127 | 9127 | * |
| 9128 | 9128 | * @return string |
| 9129 | 9129 | */ |
| 9130 | - static function (array $matches) use ($encoding): string { |
|
| 9130 | + static function(array $matches) use ($encoding): string { |
|
| 9131 | 9131 | // preserve leading underscore |
| 9132 | 9132 | $str = $matches[1]; |
| 9133 | 9133 | if ($matches[2]) { |
@@ -9152,11 +9152,11 @@ discard block |
||
| 9152 | 9152 | ); |
| 9153 | 9153 | |
| 9154 | 9154 | // Exceptions for small words: capitalize at start of title... |
| 9155 | - $str = (string) \preg_replace_callback( |
|
| 9155 | + $str = (string)\preg_replace_callback( |
|
| 9156 | 9156 | '~( \\A [[:punct:]]* # start of title... |
| 9157 | 9157 | | [:.;?!][ ]+ # or of subsentence... |
| 9158 | 9158 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
| 9159 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
| 9159 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
| 9160 | 9160 | ~uxi', |
| 9161 | 9161 | /** |
| 9162 | 9162 | * @param string[] $matches |
@@ -9165,15 +9165,15 @@ discard block |
||
| 9165 | 9165 | * |
| 9166 | 9166 | * @return string |
| 9167 | 9167 | */ |
| 9168 | - static function (array $matches) use ($encoding): string { |
|
| 9169 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
| 9168 | + static function(array $matches) use ($encoding): string { |
|
| 9169 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
| 9170 | 9170 | }, |
| 9171 | 9171 | $str |
| 9172 | 9172 | ); |
| 9173 | 9173 | |
| 9174 | 9174 | // ...and end of title |
| 9175 | - $str = (string) \preg_replace_callback( |
|
| 9176 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
| 9175 | + $str = (string)\preg_replace_callback( |
|
| 9176 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
| 9177 | 9177 | (?= [[:punct:]]* \Z # ...at the end of the title... |
| 9178 | 9178 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
| 9179 | 9179 | ~uxi', |
@@ -9184,7 +9184,7 @@ discard block |
||
| 9184 | 9184 | * |
| 9185 | 9185 | * @return string |
| 9186 | 9186 | */ |
| 9187 | - static function (array $matches) use ($encoding): string { |
|
| 9187 | + static function(array $matches) use ($encoding): string { |
|
| 9188 | 9188 | return static::ucfirst($matches[1], $encoding); |
| 9189 | 9189 | }, |
| 9190 | 9190 | $str |
@@ -9192,10 +9192,10 @@ discard block |
||
| 9192 | 9192 | |
| 9193 | 9193 | // Exceptions for small words in hyphenated compound words. |
| 9194 | 9194 | // e.g. "in-flight" -> In-Flight |
| 9195 | - $str = (string) \preg_replace_callback( |
|
| 9195 | + $str = (string)\preg_replace_callback( |
|
| 9196 | 9196 | '~\\b |
| 9197 | 9197 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
| 9198 | - ( ' . $small_words_rx . ' ) |
|
| 9198 | + ( ' . $small_words_rx.' ) |
|
| 9199 | 9199 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
| 9200 | 9200 | ~uxi', |
| 9201 | 9201 | /** |
@@ -9205,18 +9205,18 @@ discard block |
||
| 9205 | 9205 | * |
| 9206 | 9206 | * @return string |
| 9207 | 9207 | */ |
| 9208 | - static function (array $matches) use ($encoding): string { |
|
| 9208 | + static function(array $matches) use ($encoding): string { |
|
| 9209 | 9209 | return static::ucfirst($matches[1], $encoding); |
| 9210 | 9210 | }, |
| 9211 | 9211 | $str |
| 9212 | 9212 | ); |
| 9213 | 9213 | |
| 9214 | 9214 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
| 9215 | - $str = (string) \preg_replace_callback( |
|
| 9215 | + $str = (string)\preg_replace_callback( |
|
| 9216 | 9216 | '~\\b |
| 9217 | 9217 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
| 9218 | 9218 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
| 9219 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
| 9219 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
| 9220 | 9220 | (?! - ) # Negative lookahead for another - |
| 9221 | 9221 | ~uxi', |
| 9222 | 9222 | /** |
@@ -9226,8 +9226,8 @@ discard block |
||
| 9226 | 9226 | * |
| 9227 | 9227 | * @return string |
| 9228 | 9228 | */ |
| 9229 | - static function (array $matches) use ($encoding): string { |
|
| 9230 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
| 9229 | + static function(array $matches) use ($encoding): string { |
|
| 9230 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
| 9231 | 9231 | }, |
| 9232 | 9232 | $str |
| 9233 | 9233 | ); |
@@ -9346,7 +9346,7 @@ discard block |
||
| 9346 | 9346 | ); |
| 9347 | 9347 | |
| 9348 | 9348 | foreach ($tmp_return as &$item) { |
| 9349 | - $item = (string) $item; |
|
| 9349 | + $item = (string)$item; |
|
| 9350 | 9350 | } |
| 9351 | 9351 | |
| 9352 | 9352 | return $tmp_return; |
@@ -9400,39 +9400,39 @@ discard block |
||
| 9400 | 9400 | } |
| 9401 | 9401 | |
| 9402 | 9402 | if ($encoding === 'UTF-8') { |
| 9403 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 9403 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 9404 | 9404 | return $str; |
| 9405 | 9405 | } |
| 9406 | 9406 | |
| 9407 | 9407 | if ($substring !== '') { |
| 9408 | - $length -= (int) \mb_strlen($substring); |
|
| 9408 | + $length -= (int)\mb_strlen($substring); |
|
| 9409 | 9409 | |
| 9410 | 9410 | /** @noinspection UnnecessaryCastingInspection */ |
| 9411 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
| 9411 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
| 9412 | 9412 | } |
| 9413 | 9413 | |
| 9414 | 9414 | /** @noinspection UnnecessaryCastingInspection */ |
| 9415 | - return (string) \mb_substr($str, 0, $length); |
|
| 9415 | + return (string)\mb_substr($str, 0, $length); |
|
| 9416 | 9416 | } |
| 9417 | 9417 | |
| 9418 | 9418 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 9419 | 9419 | |
| 9420 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 9420 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 9421 | 9421 | return $str; |
| 9422 | 9422 | } |
| 9423 | 9423 | |
| 9424 | 9424 | if ($substring !== '') { |
| 9425 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 9425 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 9426 | 9426 | } |
| 9427 | 9427 | |
| 9428 | 9428 | return ( |
| 9429 | - (string) self::substr( |
|
| 9429 | + (string)self::substr( |
|
| 9430 | 9430 | $str, |
| 9431 | 9431 | 0, |
| 9432 | 9432 | $length, |
| 9433 | 9433 | $encoding |
| 9434 | 9434 | ) |
| 9435 | - ) . $substring; |
|
| 9435 | + ).$substring; |
|
| 9436 | 9436 | } |
| 9437 | 9437 | |
| 9438 | 9438 | /** |
@@ -9466,12 +9466,12 @@ discard block |
||
| 9466 | 9466 | } |
| 9467 | 9467 | |
| 9468 | 9468 | if ($encoding === 'UTF-8') { |
| 9469 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 9469 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 9470 | 9470 | return $str; |
| 9471 | 9471 | } |
| 9472 | 9472 | |
| 9473 | 9473 | // need to further trim the string so we can append the substring |
| 9474 | - $length -= (int) \mb_strlen($substring); |
|
| 9474 | + $length -= (int)\mb_strlen($substring); |
|
| 9475 | 9475 | if ($length <= 0) { |
| 9476 | 9476 | return $substring; |
| 9477 | 9477 | } |
@@ -9497,18 +9497,18 @@ discard block |
||
| 9497 | 9497 | !$ignore_do_not_split_words_for_one_word |
| 9498 | 9498 | ) |
| 9499 | 9499 | ) { |
| 9500 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
| 9500 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
| 9501 | 9501 | } |
| 9502 | 9502 | } |
| 9503 | 9503 | } else { |
| 9504 | 9504 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 9505 | 9505 | |
| 9506 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 9506 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 9507 | 9507 | return $str; |
| 9508 | 9508 | } |
| 9509 | 9509 | |
| 9510 | 9510 | // need to further trim the string so we can append the substring |
| 9511 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 9511 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 9512 | 9512 | if ($length <= 0) { |
| 9513 | 9513 | return $substring; |
| 9514 | 9514 | } |
@@ -9534,12 +9534,12 @@ discard block |
||
| 9534 | 9534 | !$ignore_do_not_split_words_for_one_word |
| 9535 | 9535 | ) |
| 9536 | 9536 | ) { |
| 9537 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
| 9537 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
| 9538 | 9538 | } |
| 9539 | 9539 | } |
| 9540 | 9540 | } |
| 9541 | 9541 | |
| 9542 | - return $truncated . $substring; |
|
| 9542 | + return $truncated.$substring; |
|
| 9543 | 9543 | } |
| 9544 | 9544 | |
| 9545 | 9545 | /** |
@@ -9666,13 +9666,13 @@ discard block |
||
| 9666 | 9666 | } |
| 9667 | 9667 | } elseif ($format === 2) { |
| 9668 | 9668 | $number_of_words = []; |
| 9669 | - $offset = (int) self::strlen($str_parts[0]); |
|
| 9669 | + $offset = (int)self::strlen($str_parts[0]); |
|
| 9670 | 9670 | for ($i = 1; $i < $len; $i += 2) { |
| 9671 | 9671 | $number_of_words[$offset] = $str_parts[$i]; |
| 9672 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
| 9672 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
| 9673 | 9673 | } |
| 9674 | 9674 | } else { |
| 9675 | - $number_of_words = (int) (($len - 1) / 2); |
|
| 9675 | + $number_of_words = (int)(($len - 1) / 2); |
|
| 9676 | 9676 | } |
| 9677 | 9677 | |
| 9678 | 9678 | return $number_of_words; |
@@ -9805,7 +9805,7 @@ discard block |
||
| 9805 | 9805 | } |
| 9806 | 9806 | |
| 9807 | 9807 | if ($char_list === '') { |
| 9808 | - return (int) self::strlen($str, $encoding); |
|
| 9808 | + return (int)self::strlen($str, $encoding); |
|
| 9809 | 9809 | } |
| 9810 | 9810 | |
| 9811 | 9811 | if ($offset || $length !== null) { |
@@ -9832,7 +9832,7 @@ discard block |
||
| 9832 | 9832 | } |
| 9833 | 9833 | |
| 9834 | 9834 | $matches = []; |
| 9835 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
| 9835 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
| 9836 | 9836 | $return = self::strlen($matches[1], $encoding); |
| 9837 | 9837 | if ($return === false) { |
| 9838 | 9838 | return 0; |
@@ -9841,7 +9841,7 @@ discard block |
||
| 9841 | 9841 | return $return; |
| 9842 | 9842 | } |
| 9843 | 9843 | |
| 9844 | - return (int) self::strlen($str, $encoding); |
|
| 9844 | + return (int)self::strlen($str, $encoding); |
|
| 9845 | 9845 | } |
| 9846 | 9846 | |
| 9847 | 9847 | /** |
@@ -9904,7 +9904,7 @@ discard block |
||
| 9904 | 9904 | |
| 9905 | 9905 | $str = ''; |
| 9906 | 9906 | foreach ($intOrHex as $strPart) { |
| 9907 | - $str .= '&#' . (int) $strPart . ';'; |
|
| 9907 | + $str .= '&#'.(int)$strPart.';'; |
|
| 9908 | 9908 | } |
| 9909 | 9909 | |
| 9910 | 9910 | return self::html_entity_decode($str, \ENT_QUOTES | \ENT_HTML5); |
@@ -10001,7 +10001,7 @@ discard block |
||
| 10001 | 10001 | return ''; |
| 10002 | 10002 | } |
| 10003 | 10003 | |
| 10004 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
| 10004 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
| 10005 | 10005 | } |
| 10006 | 10006 | |
| 10007 | 10007 | /** |
@@ -10072,7 +10072,7 @@ discard block |
||
| 10072 | 10072 | // fallback for ascii only |
| 10073 | 10073 | // |
| 10074 | 10074 | |
| 10075 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10075 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10076 | 10076 | return \stripos($haystack, $needle, $offset); |
| 10077 | 10077 | } |
| 10078 | 10078 | |
@@ -10153,7 +10153,7 @@ discard block |
||
| 10153 | 10153 | /** |
| 10154 | 10154 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10155 | 10155 | */ |
| 10156 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10156 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10157 | 10157 | } |
| 10158 | 10158 | |
| 10159 | 10159 | if ( |
@@ -10167,11 +10167,11 @@ discard block |
||
| 10167 | 10167 | } |
| 10168 | 10168 | } |
| 10169 | 10169 | |
| 10170 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
| 10170 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
| 10171 | 10171 | return \stristr($haystack, $needle, $before_needle); |
| 10172 | 10172 | } |
| 10173 | 10173 | |
| 10174 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
| 10174 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
| 10175 | 10175 | |
| 10176 | 10176 | if (!isset($match[1])) { |
| 10177 | 10177 | return false; |
@@ -10181,7 +10181,7 @@ discard block |
||
| 10181 | 10181 | return $match[1]; |
| 10182 | 10182 | } |
| 10183 | 10183 | |
| 10184 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
| 10184 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
| 10185 | 10185 | } |
| 10186 | 10186 | |
| 10187 | 10187 | /** |
@@ -10264,7 +10264,7 @@ discard block |
||
| 10264 | 10264 | /** |
| 10265 | 10265 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10266 | 10266 | */ |
| 10267 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10267 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10268 | 10268 | } |
| 10269 | 10269 | |
| 10270 | 10270 | // |
@@ -10402,8 +10402,8 @@ discard block |
||
| 10402 | 10402 | } |
| 10403 | 10403 | |
| 10404 | 10404 | return \strnatcmp( |
| 10405 | - (string) self::strtonatfold($str1), |
|
| 10406 | - (string) self::strtonatfold($str2) |
|
| 10405 | + (string)self::strtonatfold($str1), |
|
| 10406 | + (string)self::strtonatfold($str2) |
|
| 10407 | 10407 | ); |
| 10408 | 10408 | } |
| 10409 | 10409 | |
@@ -10473,11 +10473,11 @@ discard block |
||
| 10473 | 10473 | } |
| 10474 | 10474 | |
| 10475 | 10475 | if ($encoding === 'UTF-8') { |
| 10476 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
| 10477 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
| 10476 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
| 10477 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
| 10478 | 10478 | } else { |
| 10479 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
| 10480 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
| 10479 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
| 10480 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
| 10481 | 10481 | } |
| 10482 | 10482 | |
| 10483 | 10483 | return self::strcmp($str1, $str2); |
@@ -10504,8 +10504,8 @@ discard block |
||
| 10504 | 10504 | return false; |
| 10505 | 10505 | } |
| 10506 | 10506 | |
| 10507 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
| 10508 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
| 10507 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
| 10508 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
| 10509 | 10509 | } |
| 10510 | 10510 | |
| 10511 | 10511 | return false; |
@@ -10544,10 +10544,10 @@ discard block |
||
| 10544 | 10544 | } |
| 10545 | 10545 | |
| 10546 | 10546 | // iconv and mbstring do not support integer $needle |
| 10547 | - if ((int) $needle === $needle) { |
|
| 10548 | - $needle = (string) self::chr($needle); |
|
| 10547 | + if ((int)$needle === $needle) { |
|
| 10548 | + $needle = (string)self::chr($needle); |
|
| 10549 | 10549 | } |
| 10550 | - $needle = (string) $needle; |
|
| 10550 | + $needle = (string)$needle; |
|
| 10551 | 10551 | |
| 10552 | 10552 | if ($needle === '') { |
| 10553 | 10553 | return false; |
@@ -10599,7 +10599,7 @@ discard block |
||
| 10599 | 10599 | /** |
| 10600 | 10600 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10601 | 10601 | */ |
| 10602 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10602 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10603 | 10603 | } |
| 10604 | 10604 | |
| 10605 | 10605 | // |
@@ -10640,7 +10640,7 @@ discard block |
||
| 10640 | 10640 | // fallback for ascii only |
| 10641 | 10641 | // |
| 10642 | 10642 | |
| 10643 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 10643 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 10644 | 10644 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Offset not contained in string */ |
| 10645 | 10645 | return @\strpos($haystack, $needle, $offset); |
| 10646 | 10646 | } |
@@ -10653,7 +10653,7 @@ discard block |
||
| 10653 | 10653 | if ($haystack_tmp === false) { |
| 10654 | 10654 | $haystack_tmp = ''; |
| 10655 | 10655 | } |
| 10656 | - $haystack = (string) $haystack_tmp; |
|
| 10656 | + $haystack = (string)$haystack_tmp; |
|
| 10657 | 10657 | |
| 10658 | 10658 | if ($offset < 0) { |
| 10659 | 10659 | $offset = 0; |
@@ -10665,7 +10665,7 @@ discard block |
||
| 10665 | 10665 | } |
| 10666 | 10666 | |
| 10667 | 10667 | if ($pos) { |
| 10668 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 10668 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 10669 | 10669 | } |
| 10670 | 10670 | |
| 10671 | 10671 | return $offset + 0; |
@@ -10820,7 +10820,7 @@ discard block |
||
| 10820 | 10820 | /** |
| 10821 | 10821 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 10822 | 10822 | */ |
| 10823 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10823 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10824 | 10824 | } |
| 10825 | 10825 | |
| 10826 | 10826 | // |
@@ -10832,7 +10832,7 @@ discard block |
||
| 10832 | 10832 | if ($needle_tmp === false) { |
| 10833 | 10833 | return false; |
| 10834 | 10834 | } |
| 10835 | - $needle = (string) $needle_tmp; |
|
| 10835 | + $needle = (string)$needle_tmp; |
|
| 10836 | 10836 | |
| 10837 | 10837 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
| 10838 | 10838 | if ($pos === false) { |
@@ -10854,7 +10854,7 @@ discard block |
||
| 10854 | 10854 | if ($needle_tmp === false) { |
| 10855 | 10855 | return false; |
| 10856 | 10856 | } |
| 10857 | - $needle = (string) $needle_tmp; |
|
| 10857 | + $needle = (string)$needle_tmp; |
|
| 10858 | 10858 | |
| 10859 | 10859 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
| 10860 | 10860 | if ($pos === false) { |
@@ -10895,7 +10895,7 @@ discard block |
||
| 10895 | 10895 | if ($encoding === 'UTF-8') { |
| 10896 | 10896 | if (self::$SUPPORT['intl'] === true) { |
| 10897 | 10897 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
| 10898 | - $i = (int) \grapheme_strlen($str); |
|
| 10898 | + $i = (int)\grapheme_strlen($str); |
|
| 10899 | 10899 | while ($i--) { |
| 10900 | 10900 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
| 10901 | 10901 | if ($reversed_tmp !== false) { |
@@ -10903,7 +10903,7 @@ discard block |
||
| 10903 | 10903 | } |
| 10904 | 10904 | } |
| 10905 | 10905 | } else { |
| 10906 | - $i = (int) \mb_strlen($str); |
|
| 10906 | + $i = (int)\mb_strlen($str); |
|
| 10907 | 10907 | while ($i--) { |
| 10908 | 10908 | $reversed_tmp = \mb_substr($str, $i, 1); |
| 10909 | 10909 | if ($reversed_tmp !== false) { |
@@ -10914,7 +10914,7 @@ discard block |
||
| 10914 | 10914 | } else { |
| 10915 | 10915 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 10916 | 10916 | |
| 10917 | - $i = (int) self::strlen($str, $encoding); |
|
| 10917 | + $i = (int)self::strlen($str, $encoding); |
|
| 10918 | 10918 | while ($i--) { |
| 10919 | 10919 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
| 10920 | 10920 | if ($reversed_tmp !== false) { |
@@ -10993,7 +10993,7 @@ discard block |
||
| 10993 | 10993 | if ($needle_tmp === false) { |
| 10994 | 10994 | return false; |
| 10995 | 10995 | } |
| 10996 | - $needle = (string) $needle_tmp; |
|
| 10996 | + $needle = (string)$needle_tmp; |
|
| 10997 | 10997 | |
| 10998 | 10998 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
| 10999 | 10999 | if ($pos === false) { |
@@ -11036,10 +11036,10 @@ discard block |
||
| 11036 | 11036 | } |
| 11037 | 11037 | |
| 11038 | 11038 | // iconv and mbstring do not support integer $needle |
| 11039 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 11040 | - $needle = (string) self::chr($needle); |
|
| 11039 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 11040 | + $needle = (string)self::chr($needle); |
|
| 11041 | 11041 | } |
| 11042 | - $needle = (string) $needle; |
|
| 11042 | + $needle = (string)$needle; |
|
| 11043 | 11043 | |
| 11044 | 11044 | if ($needle === '') { |
| 11045 | 11045 | return false; |
@@ -11087,7 +11087,7 @@ discard block |
||
| 11087 | 11087 | /** |
| 11088 | 11088 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11089 | 11089 | */ |
| 11090 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11090 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11091 | 11091 | } |
| 11092 | 11092 | |
| 11093 | 11093 | // |
@@ -11111,7 +11111,7 @@ discard block |
||
| 11111 | 11111 | // fallback for ascii only |
| 11112 | 11112 | // |
| 11113 | 11113 | |
| 11114 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 11114 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 11115 | 11115 | return \strripos($haystack, $needle, $offset); |
| 11116 | 11116 | } |
| 11117 | 11117 | |
@@ -11194,10 +11194,10 @@ discard block |
||
| 11194 | 11194 | } |
| 11195 | 11195 | |
| 11196 | 11196 | // iconv and mbstring do not support integer $needle |
| 11197 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 11198 | - $needle = (string) self::chr($needle); |
|
| 11197 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 11198 | + $needle = (string)self::chr($needle); |
|
| 11199 | 11199 | } |
| 11200 | - $needle = (string) $needle; |
|
| 11200 | + $needle = (string)$needle; |
|
| 11201 | 11201 | |
| 11202 | 11202 | if ($needle === '') { |
| 11203 | 11203 | return false; |
@@ -11245,7 +11245,7 @@ discard block |
||
| 11245 | 11245 | /** |
| 11246 | 11246 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11247 | 11247 | */ |
| 11248 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11248 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11249 | 11249 | } |
| 11250 | 11250 | |
| 11251 | 11251 | // |
@@ -11269,7 +11269,7 @@ discard block |
||
| 11269 | 11269 | // fallback for ascii only |
| 11270 | 11270 | // |
| 11271 | 11271 | |
| 11272 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 11272 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 11273 | 11273 | return \strrpos($haystack, $needle, $offset); |
| 11274 | 11274 | } |
| 11275 | 11275 | |
@@ -11289,7 +11289,7 @@ discard block |
||
| 11289 | 11289 | if ($haystack_tmp === false) { |
| 11290 | 11290 | $haystack_tmp = ''; |
| 11291 | 11291 | } |
| 11292 | - $haystack = (string) $haystack_tmp; |
|
| 11292 | + $haystack = (string)$haystack_tmp; |
|
| 11293 | 11293 | } |
| 11294 | 11294 | |
| 11295 | 11295 | $pos = \strrpos($haystack, $needle); |
@@ -11303,7 +11303,7 @@ discard block |
||
| 11303 | 11303 | return false; |
| 11304 | 11304 | } |
| 11305 | 11305 | |
| 11306 | - return $offset + (int) self::strlen($str_tmp); |
|
| 11306 | + return $offset + (int)self::strlen($str_tmp); |
|
| 11307 | 11307 | } |
| 11308 | 11308 | |
| 11309 | 11309 | /** |
@@ -11371,12 +11371,12 @@ discard block |
||
| 11371 | 11371 | if ($offset || $length !== null) { |
| 11372 | 11372 | if ($encoding === 'UTF-8') { |
| 11373 | 11373 | if ($length === null) { |
| 11374 | - $str = (string) \mb_substr($str, $offset); |
|
| 11374 | + $str = (string)\mb_substr($str, $offset); |
|
| 11375 | 11375 | } else { |
| 11376 | - $str = (string) \mb_substr($str, $offset, $length); |
|
| 11376 | + $str = (string)\mb_substr($str, $offset, $length); |
|
| 11377 | 11377 | } |
| 11378 | 11378 | } else { |
| 11379 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
| 11379 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
| 11380 | 11380 | } |
| 11381 | 11381 | } |
| 11382 | 11382 | |
@@ -11386,7 +11386,7 @@ discard block |
||
| 11386 | 11386 | |
| 11387 | 11387 | $matches = []; |
| 11388 | 11388 | |
| 11389 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
| 11389 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
| 11390 | 11390 | } |
| 11391 | 11391 | |
| 11392 | 11392 | /** |
@@ -11468,7 +11468,7 @@ discard block |
||
| 11468 | 11468 | /** |
| 11469 | 11469 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11470 | 11470 | */ |
| 11471 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 11471 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 11472 | 11472 | } |
| 11473 | 11473 | |
| 11474 | 11474 | // |
@@ -11490,7 +11490,7 @@ discard block |
||
| 11490 | 11490 | // fallback for ascii only |
| 11491 | 11491 | // |
| 11492 | 11492 | |
| 11493 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
| 11493 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
| 11494 | 11494 | return \strstr($haystack, $needle, $before_needle); |
| 11495 | 11495 | } |
| 11496 | 11496 | |
@@ -11498,7 +11498,7 @@ discard block |
||
| 11498 | 11498 | // fallback via vanilla php |
| 11499 | 11499 | // |
| 11500 | 11500 | |
| 11501 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
| 11501 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
| 11502 | 11502 | |
| 11503 | 11503 | if (!isset($match[1])) { |
| 11504 | 11504 | return false; |
@@ -11508,7 +11508,7 @@ discard block |
||
| 11508 | 11508 | return $match[1]; |
| 11509 | 11509 | } |
| 11510 | 11510 | |
| 11511 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
| 11511 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
| 11512 | 11512 | } |
| 11513 | 11513 | |
| 11514 | 11514 | /** |
@@ -11638,7 +11638,7 @@ discard block |
||
| 11638 | 11638 | bool $try_to_keep_the_string_length = false |
| 11639 | 11639 | ): string { |
| 11640 | 11640 | // init |
| 11641 | - $str = (string) $str; |
|
| 11641 | + $str = (string)$str; |
|
| 11642 | 11642 | |
| 11643 | 11643 | if ($str === '') { |
| 11644 | 11644 | return ''; |
@@ -11667,25 +11667,25 @@ discard block |
||
| 11667 | 11667 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 11668 | 11668 | } |
| 11669 | 11669 | |
| 11670 | - $language_code = $lang . '-Lower'; |
|
| 11670 | + $language_code = $lang.'-Lower'; |
|
| 11671 | 11671 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 11672 | 11672 | /** |
| 11673 | 11673 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11674 | 11674 | */ |
| 11675 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
| 11675 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
| 11676 | 11676 | |
| 11677 | 11677 | $language_code = 'Any-Lower'; |
| 11678 | 11678 | } |
| 11679 | 11679 | |
| 11680 | 11680 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 11681 | 11681 | /** @noinspection UnnecessaryCastingInspection */ |
| 11682 | - return (string) \transliterator_transliterate($language_code, $str); |
|
| 11682 | + return (string)\transliterator_transliterate($language_code, $str); |
|
| 11683 | 11683 | } |
| 11684 | 11684 | |
| 11685 | 11685 | /** |
| 11686 | 11686 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11687 | 11687 | */ |
| 11688 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
| 11688 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
| 11689 | 11689 | } |
| 11690 | 11690 | |
| 11691 | 11691 | // always fallback via symfony polyfill |
@@ -11720,7 +11720,7 @@ discard block |
||
| 11720 | 11720 | bool $try_to_keep_the_string_length = false |
| 11721 | 11721 | ): string { |
| 11722 | 11722 | // init |
| 11723 | - $str = (string) $str; |
|
| 11723 | + $str = (string)$str; |
|
| 11724 | 11724 | |
| 11725 | 11725 | if ($str === '') { |
| 11726 | 11726 | return ''; |
@@ -11749,25 +11749,25 @@ discard block |
||
| 11749 | 11749 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
| 11750 | 11750 | } |
| 11751 | 11751 | |
| 11752 | - $language_code = $lang . '-Upper'; |
|
| 11752 | + $language_code = $lang.'-Upper'; |
|
| 11753 | 11753 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
| 11754 | 11754 | /** |
| 11755 | 11755 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11756 | 11756 | */ |
| 11757 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
| 11757 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
| 11758 | 11758 | |
| 11759 | 11759 | $language_code = 'Any-Upper'; |
| 11760 | 11760 | } |
| 11761 | 11761 | |
| 11762 | 11762 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 11763 | 11763 | /** @noinspection UnnecessaryCastingInspection */ |
| 11764 | - return (string) \transliterator_transliterate($language_code, $str); |
|
| 11764 | + return (string)\transliterator_transliterate($language_code, $str); |
|
| 11765 | 11765 | } |
| 11766 | 11766 | |
| 11767 | 11767 | /** |
| 11768 | 11768 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 11769 | 11769 | */ |
| 11770 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
| 11770 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
| 11771 | 11771 | } |
| 11772 | 11772 | |
| 11773 | 11773 | // always fallback via symfony polyfill |
@@ -11831,7 +11831,7 @@ discard block |
||
| 11831 | 11831 | $from = \array_combine($from, $to); |
| 11832 | 11832 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
| 11833 | 11833 | if ($from === false) { |
| 11834 | - 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) . ')'); |
|
| 11834 | + 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).')'); |
|
| 11835 | 11835 | } |
| 11836 | 11836 | } |
| 11837 | 11837 | |
@@ -11897,9 +11897,9 @@ discard block |
||
| 11897 | 11897 | } |
| 11898 | 11898 | |
| 11899 | 11899 | $wide = 0; |
| 11900 | - $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); |
|
| 11900 | + $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); |
|
| 11901 | 11901 | |
| 11902 | - return ($wide << 1) + (int) self::strlen($str); |
|
| 11902 | + return ($wide << 1) + (int)self::strlen($str); |
|
| 11903 | 11903 | } |
| 11904 | 11904 | |
| 11905 | 11905 | /** |
@@ -11998,7 +11998,7 @@ discard block |
||
| 11998 | 11998 | return ''; |
| 11999 | 11999 | } |
| 12000 | 12000 | |
| 12001 | - $length = $length ?? (int) $str_length; |
|
| 12001 | + $length = $length ?? (int)$str_length; |
|
| 12002 | 12002 | |
| 12003 | 12003 | if ( |
| 12004 | 12004 | $encoding !== 'UTF-8' |
@@ -12008,7 +12008,7 @@ discard block |
||
| 12008 | 12008 | /** |
| 12009 | 12009 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 12010 | 12010 | */ |
| 12011 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 12011 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 12012 | 12012 | } |
| 12013 | 12013 | |
| 12014 | 12014 | // |
@@ -12104,16 +12104,16 @@ discard block |
||
| 12104 | 12104 | ) { |
| 12105 | 12105 | if ($encoding === 'UTF-8') { |
| 12106 | 12106 | if ($length === null) { |
| 12107 | - $str1 = (string) \mb_substr($str1, $offset); |
|
| 12107 | + $str1 = (string)\mb_substr($str1, $offset); |
|
| 12108 | 12108 | } else { |
| 12109 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
| 12109 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
| 12110 | 12110 | } |
| 12111 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
| 12111 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
| 12112 | 12112 | } else { |
| 12113 | 12113 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 12114 | 12114 | |
| 12115 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
| 12116 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
| 12115 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
| 12116 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
| 12117 | 12117 | } |
| 12118 | 12118 | } |
| 12119 | 12119 | |
@@ -12180,13 +12180,13 @@ discard block |
||
| 12180 | 12180 | if ($length_tmp === false) { |
| 12181 | 12181 | return false; |
| 12182 | 12182 | } |
| 12183 | - $length = (int) $length_tmp; |
|
| 12183 | + $length = (int)$length_tmp; |
|
| 12184 | 12184 | } |
| 12185 | 12185 | |
| 12186 | 12186 | if ($encoding === 'UTF-8') { |
| 12187 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
| 12187 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
| 12188 | 12188 | } else { |
| 12189 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
| 12189 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
| 12190 | 12190 | } |
| 12191 | 12191 | } |
| 12192 | 12192 | |
@@ -12198,7 +12198,7 @@ discard block |
||
| 12198 | 12198 | /** |
| 12199 | 12199 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
| 12200 | 12200 | */ |
| 12201 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 12201 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 12202 | 12202 | } |
| 12203 | 12203 | |
| 12204 | 12204 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -12209,7 +12209,7 @@ discard block |
||
| 12209 | 12209 | return \mb_substr_count($haystack, $needle, $encoding); |
| 12210 | 12210 | } |
| 12211 | 12211 | |
| 12212 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 12212 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 12213 | 12213 | |
| 12214 | 12214 | return \count($matches); |
| 12215 | 12215 | } |
@@ -12259,7 +12259,7 @@ discard block |
||
| 12259 | 12259 | if ($length_tmp === false) { |
| 12260 | 12260 | return false; |
| 12261 | 12261 | } |
| 12262 | - $length = (int) $length_tmp; |
|
| 12262 | + $length = (int)$length_tmp; |
|
| 12263 | 12263 | } |
| 12264 | 12264 | |
| 12265 | 12265 | if ( |
@@ -12281,7 +12281,7 @@ discard block |
||
| 12281 | 12281 | if ($haystack_tmp === false) { |
| 12282 | 12282 | $haystack_tmp = ''; |
| 12283 | 12283 | } |
| 12284 | - $haystack = (string) $haystack_tmp; |
|
| 12284 | + $haystack = (string)$haystack_tmp; |
|
| 12285 | 12285 | } |
| 12286 | 12286 | |
| 12287 | 12287 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -12322,10 +12322,10 @@ discard block |
||
| 12322 | 12322 | |
| 12323 | 12323 | if ($encoding === 'UTF-8') { |
| 12324 | 12324 | if ($case_sensitive) { |
| 12325 | - return (int) \mb_substr_count($str, $substring); |
|
| 12325 | + return (int)\mb_substr_count($str, $substring); |
|
| 12326 | 12326 | } |
| 12327 | 12327 | |
| 12328 | - return (int) \mb_substr_count( |
|
| 12328 | + return (int)\mb_substr_count( |
|
| 12329 | 12329 | \mb_strtoupper($str), |
| 12330 | 12330 | \mb_strtoupper($substring) |
| 12331 | 12331 | ); |
@@ -12334,10 +12334,10 @@ discard block |
||
| 12334 | 12334 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 12335 | 12335 | |
| 12336 | 12336 | if ($case_sensitive) { |
| 12337 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
| 12337 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
| 12338 | 12338 | } |
| 12339 | 12339 | |
| 12340 | - return (int) \mb_substr_count( |
|
| 12340 | + return (int)\mb_substr_count( |
|
| 12341 | 12341 | self::strtocasefold($str, true, false, $encoding, null, false), |
| 12342 | 12342 | self::strtocasefold($substring, true, false, $encoding, null, false), |
| 12343 | 12343 | $encoding |
@@ -12371,7 +12371,7 @@ discard block |
||
| 12371 | 12371 | } |
| 12372 | 12372 | |
| 12373 | 12373 | if (self::str_istarts_with($haystack, $needle)) { |
| 12374 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 12374 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 12375 | 12375 | } |
| 12376 | 12376 | |
| 12377 | 12377 | return $haystack; |
@@ -12438,7 +12438,7 @@ discard block |
||
| 12438 | 12438 | } |
| 12439 | 12439 | |
| 12440 | 12440 | if (self::str_iends_with($haystack, $needle)) { |
| 12441 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
| 12441 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
| 12442 | 12442 | } |
| 12443 | 12443 | |
| 12444 | 12444 | return $haystack; |
@@ -12471,7 +12471,7 @@ discard block |
||
| 12471 | 12471 | } |
| 12472 | 12472 | |
| 12473 | 12473 | if (self::str_starts_with($haystack, $needle)) { |
| 12474 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 12474 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 12475 | 12475 | } |
| 12476 | 12476 | |
| 12477 | 12477 | return $haystack; |
@@ -12528,7 +12528,7 @@ discard block |
||
| 12528 | 12528 | if (\is_array($offset)) { |
| 12529 | 12529 | $offset = \array_slice($offset, 0, $num); |
| 12530 | 12530 | foreach ($offset as &$value_tmp) { |
| 12531 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
| 12531 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
| 12532 | 12532 | } |
| 12533 | 12533 | unset($value_tmp); |
| 12534 | 12534 | } else { |
@@ -12541,7 +12541,7 @@ discard block |
||
| 12541 | 12541 | } elseif (\is_array($length)) { |
| 12542 | 12542 | $length = \array_slice($length, 0, $num); |
| 12543 | 12543 | foreach ($length as &$value_tmp_V2) { |
| 12544 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
| 12544 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
| 12545 | 12545 | } |
| 12546 | 12546 | unset($value_tmp_V2); |
| 12547 | 12547 | } else { |
@@ -12561,8 +12561,8 @@ discard block |
||
| 12561 | 12561 | } |
| 12562 | 12562 | |
| 12563 | 12563 | // init |
| 12564 | - $str = (string) $str; |
|
| 12565 | - $replacement = (string) $replacement; |
|
| 12564 | + $str = (string)$str; |
|
| 12565 | + $replacement = (string)$replacement; |
|
| 12566 | 12566 | |
| 12567 | 12567 | if (\is_array($length)) { |
| 12568 | 12568 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -12577,16 +12577,16 @@ discard block |
||
| 12577 | 12577 | } |
| 12578 | 12578 | |
| 12579 | 12579 | if (self::$SUPPORT['mbstring'] === true) { |
| 12580 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 12580 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 12581 | 12581 | |
| 12582 | 12582 | if ($offset < 0) { |
| 12583 | - $offset = (int) \max(0, $string_length + $offset); |
|
| 12583 | + $offset = (int)\max(0, $string_length + $offset); |
|
| 12584 | 12584 | } elseif ($offset > $string_length) { |
| 12585 | 12585 | $offset = $string_length; |
| 12586 | 12586 | } |
| 12587 | 12587 | |
| 12588 | 12588 | if ($length !== null && $length < 0) { |
| 12589 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
| 12589 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
| 12590 | 12590 | } elseif ($length === null || $length > $string_length) { |
| 12591 | 12591 | $length = $string_length; |
| 12592 | 12592 | } |
@@ -12597,9 +12597,9 @@ discard block |
||
| 12597 | 12597 | } |
| 12598 | 12598 | |
| 12599 | 12599 | /** @noinspection AdditionOperationOnArraysInspection */ |
| 12600 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
| 12601 | - $replacement . |
|
| 12602 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 12600 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
| 12601 | + $replacement. |
|
| 12602 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 12603 | 12603 | } |
| 12604 | 12604 | |
| 12605 | 12605 | // |
@@ -12608,8 +12608,7 @@ discard block |
||
| 12608 | 12608 | |
| 12609 | 12609 | if (ASCII::is_ascii($str)) { |
| 12610 | 12610 | return ($length === null) ? |
| 12611 | - \substr_replace($str, $replacement, $offset) : |
|
| 12612 | - \substr_replace($str, $replacement, $offset, $length); |
|
| 12611 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
| 12613 | 12612 | } |
| 12614 | 12613 | |
| 12615 | 12614 | // |
@@ -12625,7 +12624,7 @@ discard block |
||
| 12625 | 12624 | // e.g.: non mbstring support + invalid chars |
| 12626 | 12625 | return ''; |
| 12627 | 12626 | } |
| 12628 | - $length = (int) $length_tmp; |
|
| 12627 | + $length = (int)$length_tmp; |
|
| 12629 | 12628 | } |
| 12630 | 12629 | |
| 12631 | 12630 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -12668,14 +12667,14 @@ discard block |
||
| 12668 | 12667 | && |
| 12669 | 12668 | \substr($haystack, -\strlen($needle)) === $needle |
| 12670 | 12669 | ) { |
| 12671 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
| 12670 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
| 12672 | 12671 | } |
| 12673 | 12672 | |
| 12674 | 12673 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
| 12675 | - return (string) self::substr( |
|
| 12674 | + return (string)self::substr( |
|
| 12676 | 12675 | $haystack, |
| 12677 | 12676 | 0, |
| 12678 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
| 12677 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
| 12679 | 12678 | $encoding |
| 12680 | 12679 | ); |
| 12681 | 12680 | } |
@@ -12710,10 +12709,10 @@ discard block |
||
| 12710 | 12709 | } |
| 12711 | 12710 | |
| 12712 | 12711 | if ($encoding === 'UTF-8') { |
| 12713 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 12712 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 12714 | 12713 | } |
| 12715 | 12714 | |
| 12716 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 12715 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 12717 | 12716 | } |
| 12718 | 12717 | |
| 12719 | 12718 | /** |
@@ -12927,7 +12926,7 @@ discard block |
||
| 12927 | 12926 | public static function to_boolean($str): bool |
| 12928 | 12927 | { |
| 12929 | 12928 | // init |
| 12930 | - $str = (string) $str; |
|
| 12929 | + $str = (string)$str; |
|
| 12931 | 12930 | |
| 12932 | 12931 | if ($str === '') { |
| 12933 | 12932 | return false; |
@@ -12955,10 +12954,10 @@ discard block |
||
| 12955 | 12954 | } |
| 12956 | 12955 | |
| 12957 | 12956 | if (\is_numeric($str)) { |
| 12958 | - return ((float) $str + 0) > 0; |
|
| 12957 | + return ((float)$str + 0) > 0; |
|
| 12959 | 12958 | } |
| 12960 | 12959 | |
| 12961 | - return (bool) \trim($str); |
|
| 12960 | + return (bool)\trim($str); |
|
| 12962 | 12961 | } |
| 12963 | 12962 | |
| 12964 | 12963 | /** |
@@ -13006,7 +13005,7 @@ discard block |
||
| 13006 | 13005 | return $str; |
| 13007 | 13006 | } |
| 13008 | 13007 | |
| 13009 | - $str = (string) $str; |
|
| 13008 | + $str = (string)$str; |
|
| 13010 | 13009 | if ($str === '') { |
| 13011 | 13010 | return ''; |
| 13012 | 13011 | } |
@@ -13114,7 +13113,7 @@ discard block |
||
| 13114 | 13113 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
| 13115 | 13114 | |
| 13116 | 13115 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 13117 | - $buf .= $c1 . $c2; |
|
| 13116 | + $buf .= $c1.$c2; |
|
| 13118 | 13117 | ++$i; |
| 13119 | 13118 | } else { // not valid UTF8 - convert it |
| 13120 | 13119 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13125,7 +13124,7 @@ discard block |
||
| 13125 | 13124 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
| 13126 | 13125 | |
| 13127 | 13126 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 13128 | - $buf .= $c1 . $c2 . $c3; |
|
| 13127 | + $buf .= $c1.$c2.$c3; |
|
| 13129 | 13128 | $i += 2; |
| 13130 | 13129 | } else { // not valid UTF8 - convert it |
| 13131 | 13130 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13137,7 +13136,7 @@ discard block |
||
| 13137 | 13136 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
| 13138 | 13137 | |
| 13139 | 13138 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 13140 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
| 13139 | + $buf .= $c1.$c2.$c3.$c4; |
|
| 13141 | 13140 | $i += 3; |
| 13142 | 13141 | } else { // not valid UTF8 - convert it |
| 13143 | 13142 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13165,13 +13164,13 @@ discard block |
||
| 13165 | 13164 | * |
| 13166 | 13165 | * @return string |
| 13167 | 13166 | */ |
| 13168 | - static function (array $matches): string { |
|
| 13167 | + static function(array $matches): string { |
|
| 13169 | 13168 | if (isset($matches[3])) { |
| 13170 | - $cp = (int) \hexdec($matches[3]); |
|
| 13169 | + $cp = (int)\hexdec($matches[3]); |
|
| 13171 | 13170 | } else { |
| 13172 | 13171 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
| 13173 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
| 13174 | - + (int) \hexdec($matches[2]) |
|
| 13172 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
| 13173 | + + (int)\hexdec($matches[2]) |
|
| 13175 | 13174 | + 0x10000 |
| 13176 | 13175 | - (0xD800 << 10) |
| 13177 | 13176 | - 0xDC00; |
@@ -13182,12 +13181,12 @@ discard block |
||
| 13182 | 13181 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
| 13183 | 13182 | |
| 13184 | 13183 | if ($cp < 0x80) { |
| 13185 | - return (string) self::chr($cp); |
|
| 13184 | + return (string)self::chr($cp); |
|
| 13186 | 13185 | } |
| 13187 | 13186 | |
| 13188 | 13187 | if ($cp < 0xA0) { |
| 13189 | 13188 | /** @noinspection UnnecessaryCastingInspection */ |
| 13190 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
| 13189 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
| 13191 | 13190 | } |
| 13192 | 13191 | |
| 13193 | 13192 | return self::decimal_to_chr($cp); |
@@ -13220,7 +13219,7 @@ discard block |
||
| 13220 | 13219 | public static function to_int(string $str) |
| 13221 | 13220 | { |
| 13222 | 13221 | if (\is_numeric($str)) { |
| 13223 | - return (int) $str; |
|
| 13222 | + return (int)$str; |
|
| 13224 | 13223 | } |
| 13225 | 13224 | |
| 13226 | 13225 | return null; |
@@ -13255,7 +13254,7 @@ discard block |
||
| 13255 | 13254 | || |
| 13256 | 13255 | $input_type === 'double' |
| 13257 | 13256 | ) { |
| 13258 | - return (string) $input; |
|
| 13257 | + return (string)$input; |
|
| 13259 | 13258 | } |
| 13260 | 13259 | |
| 13261 | 13260 | if ($input_type === 'object') { |
@@ -13265,7 +13264,7 @@ discard block |
||
| 13265 | 13264 | /** @noinspection NestedPositiveIfStatementsInspection */ |
| 13266 | 13265 | /** @noinspection MissingOrEmptyGroupStatementInspection */ |
| 13267 | 13266 | if (\method_exists($input, '__toString')) { |
| 13268 | - return (string) $input; |
|
| 13267 | + return (string)$input; |
|
| 13269 | 13268 | } |
| 13270 | 13269 | } |
| 13271 | 13270 | |
@@ -13306,7 +13305,7 @@ discard block |
||
| 13306 | 13305 | } |
| 13307 | 13306 | |
| 13308 | 13307 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 13309 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 13308 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 13310 | 13309 | } |
| 13311 | 13310 | |
| 13312 | 13311 | if ($chars !== null) { |
@@ -13357,15 +13356,15 @@ discard block |
||
| 13357 | 13356 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
| 13358 | 13357 | |
| 13359 | 13358 | if ($encoding === 'UTF-8') { |
| 13360 | - $str_part_two = (string) \mb_substr($str, 1); |
|
| 13359 | + $str_part_two = (string)\mb_substr($str, 1); |
|
| 13361 | 13360 | |
| 13362 | 13361 | if ($use_mb_functions) { |
| 13363 | 13362 | $str_part_one = \mb_strtoupper( |
| 13364 | - (string) \mb_substr($str, 0, 1) |
|
| 13363 | + (string)\mb_substr($str, 0, 1) |
|
| 13365 | 13364 | ); |
| 13366 | 13365 | } else { |
| 13367 | 13366 | $str_part_one = self::strtoupper( |
| 13368 | - (string) \mb_substr($str, 0, 1), |
|
| 13367 | + (string)\mb_substr($str, 0, 1), |
|
| 13369 | 13368 | $encoding, |
| 13370 | 13369 | false, |
| 13371 | 13370 | $lang, |
@@ -13375,16 +13374,16 @@ discard block |
||
| 13375 | 13374 | } else { |
| 13376 | 13375 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 13377 | 13376 | |
| 13378 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
| 13377 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
| 13379 | 13378 | |
| 13380 | 13379 | if ($use_mb_functions) { |
| 13381 | 13380 | $str_part_one = \mb_strtoupper( |
| 13382 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
| 13381 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
| 13383 | 13382 | $encoding |
| 13384 | 13383 | ); |
| 13385 | 13384 | } else { |
| 13386 | 13385 | $str_part_one = self::strtoupper( |
| 13387 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 13386 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 13388 | 13387 | $encoding, |
| 13389 | 13388 | false, |
| 13390 | 13389 | $lang, |
@@ -13393,7 +13392,7 @@ discard block |
||
| 13393 | 13392 | } |
| 13394 | 13393 | } |
| 13395 | 13394 | |
| 13396 | - return $str_part_one . $str_part_two; |
|
| 13395 | + return $str_part_one.$str_part_two; |
|
| 13397 | 13396 | } |
| 13398 | 13397 | |
| 13399 | 13398 | /** |
@@ -13454,7 +13453,7 @@ discard block |
||
| 13454 | 13453 | $str = self::clean($str); |
| 13455 | 13454 | } |
| 13456 | 13455 | |
| 13457 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
| 13456 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
| 13458 | 13457 | |
| 13459 | 13458 | if ( |
| 13460 | 13459 | $use_php_default_functions |
@@ -13871,7 +13870,7 @@ discard block |
||
| 13871 | 13870 | if ( |
| 13872 | 13871 | $keep_utf8_chars |
| 13873 | 13872 | && |
| 13874 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
| 13873 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
| 13875 | 13874 | ) { |
| 13876 | 13875 | return $str_backup; |
| 13877 | 13876 | } |
@@ -13962,17 +13961,17 @@ discard block |
||
| 13962 | 13961 | return ''; |
| 13963 | 13962 | } |
| 13964 | 13963 | |
| 13965 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
| 13964 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
| 13966 | 13965 | |
| 13967 | 13966 | if ( |
| 13968 | 13967 | !isset($matches[0]) |
| 13969 | 13968 | || |
| 13970 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
| 13969 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
| 13971 | 13970 | ) { |
| 13972 | 13971 | return $str; |
| 13973 | 13972 | } |
| 13974 | 13973 | |
| 13975 | - return \rtrim($matches[0]) . $str_add_on; |
|
| 13974 | + return \rtrim($matches[0]).$str_add_on; |
|
| 13976 | 13975 | } |
| 13977 | 13976 | |
| 13978 | 13977 | /** |
@@ -14067,7 +14066,7 @@ discard block |
||
| 14067 | 14066 | } |
| 14068 | 14067 | } |
| 14069 | 14068 | |
| 14070 | - return $str_return . \implode('', $charsArray); |
|
| 14069 | + return $str_return.\implode('', $charsArray); |
|
| 14071 | 14070 | } |
| 14072 | 14071 | |
| 14073 | 14072 | /** |
@@ -14121,7 +14120,7 @@ discard block |
||
| 14121 | 14120 | $final_break = ''; |
| 14122 | 14121 | } |
| 14123 | 14122 | |
| 14124 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
| 14123 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
| 14125 | 14124 | } |
| 14126 | 14125 | |
| 14127 | 14126 | /** |
@@ -14363,7 +14362,7 @@ discard block |
||
| 14363 | 14362 | /** @noinspection PhpIncludeInspection */ |
| 14364 | 14363 | /** @noinspection UsingInclusionReturnValueInspection */ |
| 14365 | 14364 | /** @psalm-suppress UnresolvableInclude */ |
| 14366 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
| 14365 | + return include __DIR__.'/data/'.$file.'.php'; |
|
| 14367 | 14366 | } |
| 14368 | 14367 | |
| 14369 | 14368 | /** |
@@ -14383,7 +14382,7 @@ discard block |
||
| 14383 | 14382 | */ |
| 14384 | 14383 | \uksort( |
| 14385 | 14384 | self::$EMOJI, |
| 14386 | - static function (string $a, string $b): int { |
|
| 14385 | + static function(string $a, string $b): int { |
|
| 14387 | 14386 | return \strlen($b) <=> \strlen($a); |
| 14388 | 14387 | } |
| 14389 | 14388 | ); |
@@ -14393,7 +14392,7 @@ discard block |
||
| 14393 | 14392 | |
| 14394 | 14393 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
| 14395 | 14394 | $tmp_key = \crc32($key); |
| 14396 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
| 14395 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
| 14397 | 14396 | } |
| 14398 | 14397 | |
| 14399 | 14398 | return true; |
@@ -14421,7 +14420,7 @@ discard block |
||
| 14421 | 14420 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 14422 | 14421 | return \defined('MB_OVERLOAD_STRING') |
| 14423 | 14422 | && |
| 14424 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 14423 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 14425 | 14424 | } |
| 14426 | 14425 | |
| 14427 | 14426 | /** |
@@ -14487,7 +14486,7 @@ discard block |
||
| 14487 | 14486 | */ |
| 14488 | 14487 | static $RX_CLASS_CACHE = []; |
| 14489 | 14488 | |
| 14490 | - $cache_key = $s . '_' . $class; |
|
| 14489 | + $cache_key = $s.'_'.$class; |
|
| 14491 | 14490 | |
| 14492 | 14491 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
| 14493 | 14492 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -14500,7 +14499,7 @@ discard block |
||
| 14500 | 14499 | /** @noinspection AlterInForeachInspection */ |
| 14501 | 14500 | foreach (self::str_split($s) as &$s) { |
| 14502 | 14501 | if ($s === '-') { |
| 14503 | - $class_array[0] = '-' . $class_array[0]; |
|
| 14502 | + $class_array[0] = '-'.$class_array[0]; |
|
| 14504 | 14503 | } elseif (!isset($s[2])) { |
| 14505 | 14504 | $class_array[0] .= \preg_quote($s, '/'); |
| 14506 | 14505 | } elseif (self::strlen($s) === 1) { |
@@ -14511,13 +14510,13 @@ discard block |
||
| 14511 | 14510 | } |
| 14512 | 14511 | |
| 14513 | 14512 | if ($class_array[0]) { |
| 14514 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
| 14513 | + $class_array[0] = '['.$class_array[0].']'; |
|
| 14515 | 14514 | } |
| 14516 | 14515 | |
| 14517 | 14516 | if (\count($class_array) === 1) { |
| 14518 | 14517 | $return = $class_array[0]; |
| 14519 | 14518 | } else { |
| 14520 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
| 14519 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
| 14521 | 14520 | } |
| 14522 | 14521 | |
| 14523 | 14522 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -14598,7 +14597,7 @@ discard block |
||
| 14598 | 14597 | |
| 14599 | 14598 | if ($delimiter === '-') { |
| 14600 | 14599 | /** @noinspection AlterInForeachInspection */ |
| 14601 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
| 14600 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
| 14602 | 14601 | if (\strncmp($name, $beginning, \strlen($beginning)) === 0) { |
| 14603 | 14602 | $continue = true; |
| 14604 | 14603 | |
@@ -14608,7 +14607,7 @@ discard block |
||
| 14608 | 14607 | } |
| 14609 | 14608 | |
| 14610 | 14609 | /** @noinspection AlterInForeachInspection */ |
| 14611 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
| 14610 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
| 14612 | 14611 | if (\strncmp($name, $beginning, \strlen($beginning)) === 0) { |
| 14613 | 14612 | $continue = true; |
| 14614 | 14613 | |
@@ -14678,8 +14677,8 @@ discard block |
||
| 14678 | 14677 | } else { |
| 14679 | 14678 | /** @noinspection OffsetOperationsInspection */ |
| 14680 | 14679 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
| 14681 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
| 14682 | - $buf .= $cc1 . $cc2; |
|
| 14680 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
| 14681 | + $buf .= $cc1.$cc2; |
|
| 14683 | 14682 | } |
| 14684 | 14683 | |
| 14685 | 14684 | return $buf; |
@@ -14698,7 +14697,7 @@ discard block |
||
| 14698 | 14697 | { |
| 14699 | 14698 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
| 14700 | 14699 | if (\preg_match($pattern, $str)) { |
| 14701 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
| 14700 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
| 14702 | 14701 | } |
| 14703 | 14702 | |
| 14704 | 14703 | return $str; |