@@ -263,10 +263,10 @@ discard block |
||
263 | 263 | } |
264 | 264 | |
265 | 265 | if ($encoding === 'UTF-8') { |
266 | - return (string) \mb_substr($str, $pos, 1); |
|
266 | + return (string)\mb_substr($str, $pos, 1); |
|
267 | 267 | } |
268 | 268 | |
269 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
269 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | /** |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | public static function add_bom_to_string(string $str): string |
287 | 287 | { |
288 | 288 | if (!self::string_has_bom($str)) { |
289 | - $str = self::bom() . $str; |
|
289 | + $str = self::bom().$str; |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | return $str; |
@@ -321,8 +321,8 @@ discard block |
||
321 | 321 | $return = []; |
322 | 322 | foreach ($array as $key => &$value) { |
323 | 323 | $key = $case === \CASE_LOWER |
324 | - ? self::strtolower( $key, $encoding) |
|
325 | - : self::strtoupper( $key, $encoding); |
|
324 | + ? self::strtolower($key, $encoding) |
|
325 | + : self::strtoupper($key, $encoding); |
|
326 | 326 | |
327 | 327 | $return[$key] = $value; |
328 | 328 | } |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | return ''; |
359 | 359 | } |
360 | 360 | |
361 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
361 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
362 | 362 | $end_position = \mb_strpos($str, $end, $substr_index); |
363 | 363 | if ( |
364 | 364 | $end_position === false |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | return ''; |
369 | 369 | } |
370 | 370 | |
371 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
371 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | return ''; |
379 | 379 | } |
380 | 380 | |
381 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
381 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
382 | 382 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
383 | 383 | if ( |
384 | 384 | $end_position === false |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | return ''; |
389 | 389 | } |
390 | 390 | |
391 | - return (string) self::substr( |
|
391 | + return (string)self::substr( |
|
392 | 392 | $str, |
393 | 393 | $substr_index, |
394 | 394 | $end_position - $substr_index, |
@@ -472,10 +472,10 @@ discard block |
||
472 | 472 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
473 | 473 | { |
474 | 474 | if ($encoding === 'UTF-8') { |
475 | - return (string) \mb_substr($str, $index, 1); |
|
475 | + return (string)\mb_substr($str, $index, 1); |
|
476 | 476 | } |
477 | 477 | |
478 | - return (string) self::substr($str, $index, 1, $encoding); |
|
478 | + return (string)self::substr($str, $index, 1, $encoding); |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | /** |
@@ -590,14 +590,14 @@ discard block |
||
590 | 590 | /** |
591 | 591 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
592 | 592 | */ |
593 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
593 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | if (!\is_int($code_point) || $code_point <= 0) { |
597 | 597 | return null; |
598 | 598 | } |
599 | 599 | |
600 | - $cache_key = $code_point . '_' . $encoding; |
|
600 | + $cache_key = $code_point.'_'.$encoding; |
|
601 | 601 | if (isset($CHAR_CACHE[$cache_key])) { |
602 | 602 | return $CHAR_CACHE[$cache_key]; |
603 | 603 | } |
@@ -642,27 +642,27 @@ discard block |
||
642 | 642 | self::$CHR = self::getData('chr'); |
643 | 643 | } |
644 | 644 | |
645 | - $code_point = (int) $code_point; |
|
645 | + $code_point = (int)$code_point; |
|
646 | 646 | if ($code_point <= 0x7FF) { |
647 | 647 | /** |
648 | 648 | * @psalm-suppress PossiblyNullArrayAccess |
649 | 649 | */ |
650 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
650 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
651 | 651 | self::$CHR[($code_point & 0x3F) + 0x80]; |
652 | 652 | } elseif ($code_point <= 0xFFFF) { |
653 | 653 | /** |
654 | 654 | * @psalm-suppress PossiblyNullArrayAccess |
655 | 655 | */ |
656 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
657 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
656 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
657 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
658 | 658 | self::$CHR[($code_point & 0x3F) + 0x80]; |
659 | 659 | } else { |
660 | 660 | /** |
661 | 661 | * @psalm-suppress PossiblyNullArrayAccess |
662 | 662 | */ |
663 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
664 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
665 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
663 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
664 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
665 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
666 | 666 | self::$CHR[($code_point & 0x3F) + 0x80]; |
667 | 667 | } |
668 | 668 | |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | |
720 | 720 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
721 | 721 | return \array_map( |
722 | - static function (string $data): int { |
|
722 | + static function(string $data): int { |
|
723 | 723 | // "mb_" is available if overload is used, so use it ... |
724 | 724 | return \mb_strlen($data, 'CP850'); // 8-BIT |
725 | 725 | }, |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | $char = ''; |
807 | 807 | } |
808 | 808 | |
809 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
809 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
810 | 810 | } |
811 | 811 | |
812 | 812 | /** |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | | ( [\x80-\xBF] ) # invalid byte in range 10000000 - 10111111 |
884 | 884 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
885 | 885 | /x'; |
886 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
886 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
887 | 887 | |
888 | 888 | if ($replace_diamond_question_mark) { |
889 | 889 | $str = self::replace_diamond_question_mark($str); |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | public static function cleanup($str): string |
923 | 923 | { |
924 | 924 | // init |
925 | - $str = (string) $str; |
|
925 | + $str = (string)$str; |
|
926 | 926 | |
927 | 927 | if ($str === '') { |
928 | 928 | return ''; |
@@ -1023,7 +1023,7 @@ discard block |
||
1023 | 1023 | public static function collapse_whitespace(string $str): string |
1024 | 1024 | { |
1025 | 1025 | if (self::$SUPPORT['mbstring'] === true) { |
1026 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
1026 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
1027 | 1027 | } |
1028 | 1028 | |
1029 | 1029 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -1127,9 +1127,9 @@ discard block |
||
1127 | 1127 | // - 0-9 (U+0061 - U+007A) |
1128 | 1128 | // - ISO 10646 characters U+00A1 and higher |
1129 | 1129 | // We strip out any character not in the above list. |
1130 | - $str = (string) \preg_replace('/[^\x{002D}\x{0030}-\x{0039}\x{0041}-\x{005A}\x{005F}\x{0061}-\x{007A}\x{00A1}-\x{FFFF}]/u', '', $str); |
|
1130 | + $str = (string)\preg_replace('/[^\x{002D}\x{0030}-\x{0039}\x{0041}-\x{005A}\x{005F}\x{0061}-\x{007A}\x{00A1}-\x{FFFF}]/u', '', $str); |
|
1131 | 1131 | // Identifiers cannot start with a digit, two hyphens, or a hyphen followed by a digit. |
1132 | - $str = (string) \preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
1132 | + $str = (string)\preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
1133 | 1133 | |
1134 | 1134 | return \trim($str, '-'); |
1135 | 1135 | } |
@@ -1145,7 +1145,7 @@ discard block |
||
1145 | 1145 | */ |
1146 | 1146 | public static function css_stripe_media_queries(string $str): string |
1147 | 1147 | { |
1148 | - return (string) \preg_replace( |
|
1148 | + return (string)\preg_replace( |
|
1149 | 1149 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
1150 | 1150 | '', |
1151 | 1151 | $str |
@@ -1184,7 +1184,7 @@ discard block |
||
1184 | 1184 | */ |
1185 | 1185 | public static function decimal_to_chr($int): string |
1186 | 1186 | { |
1187 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
1187 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
1188 | 1188 | } |
1189 | 1189 | |
1190 | 1190 | /** |
@@ -1234,7 +1234,7 @@ discard block |
||
1234 | 1234 | $flagOffset = 0x1F1E6; |
1235 | 1235 | $asciiOffset = 0x41; |
1236 | 1236 | |
1237 | - return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? '') . |
|
1237 | + return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? ''). |
|
1238 | 1238 | (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
1239 | 1239 | } |
1240 | 1240 | |
@@ -1268,16 +1268,16 @@ discard block |
||
1268 | 1268 | } |
1269 | 1269 | |
1270 | 1270 | if ($use_reversible_string_mappings) { |
1271 | - return (string) \str_replace( |
|
1272 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1273 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1271 | + return (string)\str_replace( |
|
1272 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1273 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1274 | 1274 | $str |
1275 | 1275 | ); |
1276 | 1276 | } |
1277 | 1277 | |
1278 | - return (string) \str_replace( |
|
1279 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1280 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1278 | + return (string)\str_replace( |
|
1279 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1280 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1281 | 1281 | $str |
1282 | 1282 | ); |
1283 | 1283 | } |
@@ -1312,16 +1312,16 @@ discard block |
||
1312 | 1312 | } |
1313 | 1313 | |
1314 | 1314 | if ($use_reversible_string_mappings) { |
1315 | - return (string) \str_replace( |
|
1316 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1317 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1315 | + return (string)\str_replace( |
|
1316 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1317 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1318 | 1318 | $str |
1319 | 1319 | ); |
1320 | 1320 | } |
1321 | 1321 | |
1322 | - return (string) \str_replace( |
|
1323 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1324 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1322 | + return (string)\str_replace( |
|
1323 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1324 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1325 | 1325 | $str |
1326 | 1326 | ); |
1327 | 1327 | } |
@@ -1387,7 +1387,7 @@ discard block |
||
1387 | 1387 | if ($to_encoding === 'JSON') { |
1388 | 1388 | $return = self::json_encode($str); |
1389 | 1389 | if ($return === false) { |
1390 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1390 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1391 | 1391 | } |
1392 | 1392 | |
1393 | 1393 | return $return; |
@@ -1476,7 +1476,7 @@ discard block |
||
1476 | 1476 | /** |
1477 | 1477 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
1478 | 1478 | */ |
1479 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
1479 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
1480 | 1480 | } |
1481 | 1481 | |
1482 | 1482 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1577,31 +1577,31 @@ discard block |
||
1577 | 1577 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1578 | 1578 | |
1579 | 1579 | if ($length === null) { |
1580 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2); |
|
1580 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2); |
|
1581 | 1581 | } |
1582 | 1582 | |
1583 | 1583 | if ($search === '') { |
1584 | 1584 | if ($encoding === 'UTF-8') { |
1585 | 1585 | if ($length > 0) { |
1586 | - $string_length = (int) \mb_strlen($str); |
|
1586 | + $string_length = (int)\mb_strlen($str); |
|
1587 | 1587 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1588 | 1588 | } else { |
1589 | 1589 | $end = 0; |
1590 | 1590 | } |
1591 | 1591 | |
1592 | - $pos = (int) \min( |
|
1592 | + $pos = (int)\min( |
|
1593 | 1593 | \mb_strpos($str, ' ', $end), |
1594 | 1594 | \mb_strpos($str, '.', $end) |
1595 | 1595 | ); |
1596 | 1596 | } else { |
1597 | 1597 | if ($length > 0) { |
1598 | - $string_length = (int) self::strlen($str, $encoding); |
|
1598 | + $string_length = (int)self::strlen($str, $encoding); |
|
1599 | 1599 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1600 | 1600 | } else { |
1601 | 1601 | $end = 0; |
1602 | 1602 | } |
1603 | 1603 | |
1604 | - $pos = (int) \min( |
|
1604 | + $pos = (int)\min( |
|
1605 | 1605 | self::strpos($str, ' ', $end, $encoding), |
1606 | 1606 | self::strpos($str, '.', $end, $encoding) |
1607 | 1607 | ); |
@@ -1618,18 +1618,18 @@ discard block |
||
1618 | 1618 | return ''; |
1619 | 1619 | } |
1620 | 1620 | |
1621 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1621 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1622 | 1622 | } |
1623 | 1623 | |
1624 | 1624 | return $str; |
1625 | 1625 | } |
1626 | 1626 | |
1627 | 1627 | if ($encoding === 'UTF-8') { |
1628 | - $word_position = (int) \mb_stripos($str, $search); |
|
1629 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1628 | + $word_position = (int)\mb_stripos($str, $search); |
|
1629 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1630 | 1630 | } else { |
1631 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
1632 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1631 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
1632 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1633 | 1633 | } |
1634 | 1634 | |
1635 | 1635 | $pos_start = 0; |
@@ -1641,12 +1641,12 @@ discard block |
||
1641 | 1641 | } |
1642 | 1642 | if ($half_text !== false) { |
1643 | 1643 | if ($encoding === 'UTF-8') { |
1644 | - $pos_start = (int) \max( |
|
1644 | + $pos_start = (int)\max( |
|
1645 | 1645 | \mb_strrpos($half_text, ' '), |
1646 | 1646 | \mb_strrpos($half_text, '.') |
1647 | 1647 | ); |
1648 | 1648 | } else { |
1649 | - $pos_start = (int) \max( |
|
1649 | + $pos_start = (int)\max( |
|
1650 | 1650 | self::strrpos($half_text, ' ', 0, $encoding), |
1651 | 1651 | self::strrpos($half_text, '.', 0, $encoding) |
1652 | 1652 | ); |
@@ -1656,19 +1656,19 @@ discard block |
||
1656 | 1656 | |
1657 | 1657 | if ($word_position && $half_side > 0) { |
1658 | 1658 | $offset = $pos_start + $length - 1; |
1659 | - $real_length = (int) self::strlen($str, $encoding); |
|
1659 | + $real_length = (int)self::strlen($str, $encoding); |
|
1660 | 1660 | |
1661 | 1661 | if ($offset > $real_length) { |
1662 | 1662 | $offset = $real_length; |
1663 | 1663 | } |
1664 | 1664 | |
1665 | 1665 | if ($encoding === 'UTF-8') { |
1666 | - $pos_end = (int) \min( |
|
1666 | + $pos_end = (int)\min( |
|
1667 | 1667 | \mb_strpos($str, ' ', $offset), |
1668 | 1668 | \mb_strpos($str, '.', $offset) |
1669 | 1669 | ) - $pos_start; |
1670 | 1670 | } else { |
1671 | - $pos_end = (int) \min( |
|
1671 | + $pos_end = (int)\min( |
|
1672 | 1672 | self::strpos($str, ' ', $offset, $encoding), |
1673 | 1673 | self::strpos($str, '.', $offset, $encoding) |
1674 | 1674 | ) - $pos_start; |
@@ -1676,12 +1676,12 @@ discard block |
||
1676 | 1676 | |
1677 | 1677 | if (!$pos_end || $pos_end <= 0) { |
1678 | 1678 | if ($encoding === 'UTF-8') { |
1679 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1679 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1680 | 1680 | } else { |
1681 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1681 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1682 | 1682 | } |
1683 | 1683 | if ($str_sub !== false) { |
1684 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
1684 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
1685 | 1685 | } else { |
1686 | 1686 | $extract = ''; |
1687 | 1687 | } |
@@ -1692,26 +1692,26 @@ discard block |
||
1692 | 1692 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
1693 | 1693 | } |
1694 | 1694 | if ($str_sub !== false) { |
1695 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1695 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1696 | 1696 | } else { |
1697 | 1697 | $extract = ''; |
1698 | 1698 | } |
1699 | 1699 | } |
1700 | 1700 | } else { |
1701 | 1701 | $offset = $length - 1; |
1702 | - $true_length = (int) self::strlen($str, $encoding); |
|
1702 | + $true_length = (int)self::strlen($str, $encoding); |
|
1703 | 1703 | |
1704 | 1704 | if ($offset > $true_length) { |
1705 | 1705 | $offset = $true_length; |
1706 | 1706 | } |
1707 | 1707 | |
1708 | 1708 | if ($encoding === 'UTF-8') { |
1709 | - $pos_end = (int) \min( |
|
1709 | + $pos_end = (int)\min( |
|
1710 | 1710 | \mb_strpos($str, ' ', $offset), |
1711 | 1711 | \mb_strpos($str, '.', $offset) |
1712 | 1712 | ); |
1713 | 1713 | } else { |
1714 | - $pos_end = (int) \min( |
|
1714 | + $pos_end = (int)\min( |
|
1715 | 1715 | self::strpos($str, ' ', $offset, $encoding), |
1716 | 1716 | self::strpos($str, '.', $offset, $encoding) |
1717 | 1717 | ); |
@@ -1724,7 +1724,7 @@ discard block |
||
1724 | 1724 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
1725 | 1725 | } |
1726 | 1726 | if ($str_sub !== false) { |
1727 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1727 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1728 | 1728 | } else { |
1729 | 1729 | $extract = ''; |
1730 | 1730 | } |
@@ -1855,7 +1855,7 @@ discard block |
||
1855 | 1855 | { |
1856 | 1856 | $file_content = \file_get_contents($file_path); |
1857 | 1857 | if ($file_content === false) { |
1858 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1858 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1859 | 1859 | } |
1860 | 1860 | |
1861 | 1861 | return self::string_has_bom($file_content); |
@@ -1923,7 +1923,7 @@ discard block |
||
1923 | 1923 | ) { |
1924 | 1924 | // Prevent leading combining chars |
1925 | 1925 | // for NFC-safe concatenations. |
1926 | - $var = $leading_combining . $var; |
|
1926 | + $var = $leading_combining.$var; |
|
1927 | 1927 | } |
1928 | 1928 | } |
1929 | 1929 | |
@@ -2244,10 +2244,10 @@ discard block |
||
2244 | 2244 | } |
2245 | 2245 | |
2246 | 2246 | if ($encoding === 'UTF-8') { |
2247 | - return (string) \mb_substr($str, 0, $n); |
|
2247 | + return (string)\mb_substr($str, 0, $n); |
|
2248 | 2248 | } |
2249 | 2249 | |
2250 | - return (string) self::substr($str, 0, $n, $encoding); |
|
2250 | + return (string)self::substr($str, 0, $n, $encoding); |
|
2251 | 2251 | } |
2252 | 2252 | |
2253 | 2253 | /** |
@@ -2265,7 +2265,7 @@ discard block |
||
2265 | 2265 | */ |
2266 | 2266 | public static function fits_inside(string $str, int $box_size): bool |
2267 | 2267 | { |
2268 | - return (int) self::strlen($str) <= $box_size; |
|
2268 | + return (int)self::strlen($str) <= $box_size; |
|
2269 | 2269 | } |
2270 | 2270 | |
2271 | 2271 | /** |
@@ -2350,7 +2350,7 @@ discard block |
||
2350 | 2350 | return $str; |
2351 | 2351 | } |
2352 | 2352 | |
2353 | - $str = (string) $str; |
|
2353 | + $str = (string)$str; |
|
2354 | 2354 | $last = ''; |
2355 | 2355 | while ($last !== $str) { |
2356 | 2356 | $last = $str; |
@@ -2553,7 +2553,7 @@ discard block |
||
2553 | 2553 | if ($str_info === false) { |
2554 | 2554 | return $fallback; |
2555 | 2555 | } |
2556 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2556 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2557 | 2557 | |
2558 | 2558 | // DEBUG |
2559 | 2559 | //var_dump($type_code); |
@@ -2611,7 +2611,7 @@ discard block |
||
2611 | 2611 | // |
2612 | 2612 | |
2613 | 2613 | if ($encoding === 'UTF-8') { |
2614 | - $max_length = (int) \mb_strlen($possible_chars); |
|
2614 | + $max_length = (int)\mb_strlen($possible_chars); |
|
2615 | 2615 | if ($max_length === 0) { |
2616 | 2616 | return ''; |
2617 | 2617 | } |
@@ -2631,7 +2631,7 @@ discard block |
||
2631 | 2631 | } else { |
2632 | 2632 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2633 | 2633 | |
2634 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
2634 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
2635 | 2635 | if ($max_length === 0) { |
2636 | 2636 | return ''; |
2637 | 2637 | } |
@@ -2667,16 +2667,16 @@ discard block |
||
2667 | 2667 | $rand_int = \mt_rand(0, \mt_getrandmax()); |
2668 | 2668 | } |
2669 | 2669 | |
2670 | - $unique_helper = $rand_int . |
|
2671 | - \session_id() . |
|
2672 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2673 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2670 | + $unique_helper = $rand_int. |
|
2671 | + \session_id(). |
|
2672 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2673 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2674 | 2674 | $extra_entropy; |
2675 | 2675 | |
2676 | 2676 | $unique_string = \uniqid($unique_helper, true); |
2677 | 2677 | |
2678 | 2678 | if ($use_md5) { |
2679 | - $unique_string = \md5($unique_string . $unique_helper); |
|
2679 | + $unique_string = \md5($unique_string.$unique_helper); |
|
2680 | 2680 | } |
2681 | 2681 | |
2682 | 2682 | return $unique_string; |
@@ -2755,7 +2755,7 @@ discard block |
||
2755 | 2755 | public static function hex_to_chr(string $hexdec) |
2756 | 2756 | { |
2757 | 2757 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Invalid characters passed for attempted conversion, these have been ignored */ |
2758 | - return self::decimal_to_chr((int) @\hexdec($hexdec)); |
|
2758 | + return self::decimal_to_chr((int)@\hexdec($hexdec)); |
|
2759 | 2759 | } |
2760 | 2760 | |
2761 | 2761 | /** |
@@ -2775,7 +2775,7 @@ discard block |
||
2775 | 2775 | public static function hex_to_int($hexdec) |
2776 | 2776 | { |
2777 | 2777 | // init |
2778 | - $hexdec = (string) $hexdec; |
|
2778 | + $hexdec = (string)$hexdec; |
|
2779 | 2779 | |
2780 | 2780 | if ($hexdec === '') { |
2781 | 2781 | return false; |
@@ -2853,7 +2853,7 @@ discard block |
||
2853 | 2853 | return \implode( |
2854 | 2854 | '', |
2855 | 2855 | \array_map( |
2856 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2856 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2857 | 2857 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
2858 | 2858 | }, |
2859 | 2859 | self::str_split($str) |
@@ -2967,7 +2967,7 @@ discard block |
||
2967 | 2967 | /** |
2968 | 2968 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
2969 | 2969 | */ |
2970 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2970 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2971 | 2971 | } |
2972 | 2972 | |
2973 | 2973 | do { |
@@ -2976,7 +2976,7 @@ discard block |
||
2976 | 2976 | if (\strpos($str, '&') !== false) { |
2977 | 2977 | if (\strpos($str, '&#') !== false) { |
2978 | 2978 | // decode also numeric & UTF16 two byte entities |
2979 | - $str = (string) \preg_replace( |
|
2979 | + $str = (string)\preg_replace( |
|
2980 | 2980 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
2981 | 2981 | '$1;', |
2982 | 2982 | $str |
@@ -3026,7 +3026,7 @@ discard block |
||
3026 | 3026 | */ |
3027 | 3027 | public static function html_stripe_empty_tags(string $str): string |
3028 | 3028 | { |
3029 | - return (string) \preg_replace( |
|
3029 | + return (string)\preg_replace( |
|
3030 | 3030 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
3031 | 3031 | '', |
3032 | 3032 | $str |
@@ -3337,9 +3337,9 @@ discard block |
||
3337 | 3337 | { |
3338 | 3338 | $hex = \dechex($int); |
3339 | 3339 | |
3340 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
3340 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
3341 | 3341 | |
3342 | - return $prefix . $hex . ''; |
|
3342 | + return $prefix.$hex.''; |
|
3343 | 3343 | } |
3344 | 3344 | |
3345 | 3345 | /** |
@@ -3507,7 +3507,7 @@ discard block |
||
3507 | 3507 | */ |
3508 | 3508 | public static function is_binary($input, bool $strict = false): bool |
3509 | 3509 | { |
3510 | - $input = (string) $input; |
|
3510 | + $input = (string)$input; |
|
3511 | 3511 | if ($input === '') { |
3512 | 3512 | return false; |
3513 | 3513 | } |
@@ -3857,7 +3857,7 @@ discard block |
||
3857 | 3857 | public static function is_utf16($str, bool $check_if_string_is_binary = true) |
3858 | 3858 | { |
3859 | 3859 | // init |
3860 | - $str = (string) $str; |
|
3860 | + $str = (string)$str; |
|
3861 | 3861 | $str_chars = []; |
3862 | 3862 | |
3863 | 3863 | if ( |
@@ -3951,7 +3951,7 @@ discard block |
||
3951 | 3951 | public static function is_utf32($str, bool $check_if_string_is_binary = true) |
3952 | 3952 | { |
3953 | 3953 | // init |
3954 | - $str = (string) $str; |
|
3954 | + $str = (string)$str; |
|
3955 | 3955 | $str_chars = []; |
3956 | 3956 | |
3957 | 3957 | if ( |
@@ -4049,7 +4049,7 @@ discard block |
||
4049 | 4049 | return true; |
4050 | 4050 | } |
4051 | 4051 | |
4052 | - return self::is_utf8_string((string) $str, $strict); |
|
4052 | + return self::is_utf8_string((string)$str, $strict); |
|
4053 | 4053 | } |
4054 | 4054 | |
4055 | 4055 | /** |
@@ -4205,15 +4205,15 @@ discard block |
||
4205 | 4205 | $use_mb_functions = ($lang === null && !$try_to_keep_the_string_length); |
4206 | 4206 | |
4207 | 4207 | if ($encoding === 'UTF-8') { |
4208 | - $str_part_two = (string) \mb_substr($str, 1); |
|
4208 | + $str_part_two = (string)\mb_substr($str, 1); |
|
4209 | 4209 | |
4210 | 4210 | if ($use_mb_functions) { |
4211 | 4211 | $str_part_one = \mb_strtolower( |
4212 | - (string) \mb_substr($str, 0, 1) |
|
4212 | + (string)\mb_substr($str, 0, 1) |
|
4213 | 4213 | ); |
4214 | 4214 | } else { |
4215 | 4215 | $str_part_one = self::strtolower( |
4216 | - (string) \mb_substr($str, 0, 1), |
|
4216 | + (string)\mb_substr($str, 0, 1), |
|
4217 | 4217 | $encoding, |
4218 | 4218 | false, |
4219 | 4219 | $lang, |
@@ -4223,10 +4223,10 @@ discard block |
||
4223 | 4223 | } else { |
4224 | 4224 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4225 | 4225 | |
4226 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
4226 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
4227 | 4227 | |
4228 | 4228 | $str_part_one = self::strtolower( |
4229 | - (string) self::substr($str, 0, 1, $encoding), |
|
4229 | + (string)self::substr($str, 0, 1, $encoding), |
|
4230 | 4230 | $encoding, |
4231 | 4231 | false, |
4232 | 4232 | $lang, |
@@ -4234,7 +4234,7 @@ discard block |
||
4234 | 4234 | ); |
4235 | 4235 | } |
4236 | 4236 | |
4237 | - return $str_part_one . $str_part_two; |
|
4237 | + return $str_part_one.$str_part_two; |
|
4238 | 4238 | } |
4239 | 4239 | |
4240 | 4240 | /** |
@@ -4318,7 +4318,7 @@ discard block |
||
4318 | 4318 | $pattern = '^[\\s]+'; |
4319 | 4319 | } |
4320 | 4320 | |
4321 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4321 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4322 | 4322 | } |
4323 | 4323 | |
4324 | 4324 | if ($chars !== null) { |
@@ -4355,7 +4355,7 @@ discard block |
||
4355 | 4355 | |
4356 | 4356 | $codepoint_max = \max($codepoints); |
4357 | 4357 | |
4358 | - return self::chr((int) $codepoint_max); |
|
4358 | + return self::chr((int)$codepoint_max); |
|
4359 | 4359 | } |
4360 | 4360 | |
4361 | 4361 | /** |
@@ -4375,7 +4375,7 @@ discard block |
||
4375 | 4375 | { |
4376 | 4376 | $bytes = self::chr_size_list($str); |
4377 | 4377 | if ($bytes !== []) { |
4378 | - return (int) \max($bytes); |
|
4378 | + return (int)\max($bytes); |
|
4379 | 4379 | } |
4380 | 4380 | |
4381 | 4381 | return 0; |
@@ -4421,7 +4421,7 @@ discard block |
||
4421 | 4421 | |
4422 | 4422 | $codepoint_min = \min($codepoints); |
4423 | 4423 | |
4424 | - return self::chr((int) $codepoint_min); |
|
4424 | + return self::chr((int)$codepoint_min); |
|
4425 | 4425 | } |
4426 | 4426 | |
4427 | 4427 | /** |
@@ -4451,7 +4451,7 @@ discard block |
||
4451 | 4451 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4452 | 4452 | |
4453 | 4453 | // init |
4454 | - $encoding = (string) $encoding; |
|
4454 | + $encoding = (string)$encoding; |
|
4455 | 4455 | |
4456 | 4456 | if (!$encoding) { |
4457 | 4457 | return $fallback; |
@@ -4513,7 +4513,7 @@ discard block |
||
4513 | 4513 | |
4514 | 4514 | $encoding_original = $encoding; |
4515 | 4515 | $encoding = \strtoupper($encoding); |
4516 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4516 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4517 | 4517 | |
4518 | 4518 | $equivalences = [ |
4519 | 4519 | 'ISO8859' => 'ISO-8859-1', |
@@ -4680,13 +4680,13 @@ discard block |
||
4680 | 4680 | static $CHAR_CACHE = []; |
4681 | 4681 | |
4682 | 4682 | // init |
4683 | - $chr = (string) $chr; |
|
4683 | + $chr = (string)$chr; |
|
4684 | 4684 | |
4685 | 4685 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4686 | 4686 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4687 | 4687 | } |
4688 | 4688 | |
4689 | - $cache_key = $chr . '_' . $encoding; |
|
4689 | + $cache_key = $chr.'_'.$encoding; |
|
4690 | 4690 | if (isset($CHAR_CACHE[$cache_key])) { |
4691 | 4691 | return $CHAR_CACHE[$cache_key]; |
4692 | 4692 | } |
@@ -4719,7 +4719,7 @@ discard block |
||
4719 | 4719 | // fallback via vanilla php |
4720 | 4720 | // |
4721 | 4721 | |
4722 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
4722 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
4723 | 4723 | /** @noinspection PhpSillyAssignmentInspection - hack for phpstan */ |
4724 | 4724 | /** @var int[] $chr - "unpack": only false if the format string contains errors */ |
4725 | 4725 | $chr = $chr; |
@@ -4796,7 +4796,7 @@ discard block |
||
4796 | 4796 | public static function pcre_utf8_support(): bool |
4797 | 4797 | { |
4798 | 4798 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4799 | - return (bool) @\preg_match('//u', ''); |
|
4799 | + return (bool)@\preg_match('//u', ''); |
|
4800 | 4800 | } |
4801 | 4801 | |
4802 | 4802 | /** |
@@ -4837,14 +4837,14 @@ discard block |
||
4837 | 4837 | * @psalm-suppress DocblockTypeContradiction |
4838 | 4838 | */ |
4839 | 4839 | if (!\is_numeric($step)) { |
4840 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
4840 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
4841 | 4841 | } |
4842 | 4842 | |
4843 | 4843 | /** |
4844 | 4844 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
4845 | 4845 | */ |
4846 | 4846 | if ($step <= 0) { |
4847 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
4847 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
4848 | 4848 | } |
4849 | 4849 | } |
4850 | 4850 | |
@@ -4855,16 +4855,16 @@ discard block |
||
4855 | 4855 | $is_digit = false; |
4856 | 4856 | $is_xdigit = false; |
4857 | 4857 | |
4858 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
4858 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
4859 | 4859 | $is_digit = true; |
4860 | - $start = (int) $var1; |
|
4860 | + $start = (int)$var1; |
|
4861 | 4861 | } elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
4862 | 4862 | $is_xdigit = true; |
4863 | - $start = (int) self::hex_to_int((string) $var1); |
|
4863 | + $start = (int)self::hex_to_int((string)$var1); |
|
4864 | 4864 | } elseif (!$use_ctype && \is_numeric($var1)) { |
4865 | - $start = (int) $var1; |
|
4865 | + $start = (int)$var1; |
|
4866 | 4866 | } else { |
4867 | - $start = self::ord((string) $var1); |
|
4867 | + $start = self::ord((string)$var1); |
|
4868 | 4868 | } |
4869 | 4869 | |
4870 | 4870 | if (!$start) { |
@@ -4872,13 +4872,13 @@ discard block |
||
4872 | 4872 | } |
4873 | 4873 | |
4874 | 4874 | if ($is_digit) { |
4875 | - $end = (int) $var2; |
|
4875 | + $end = (int)$var2; |
|
4876 | 4876 | } elseif ($is_xdigit) { |
4877 | - $end = (int) self::hex_to_int((string) $var2); |
|
4877 | + $end = (int)self::hex_to_int((string)$var2); |
|
4878 | 4878 | } elseif (!$use_ctype && \is_numeric($var2)) { |
4879 | - $end = (int) $var2; |
|
4879 | + $end = (int)$var2; |
|
4880 | 4880 | } else { |
4881 | - $end = self::ord((string) $var2); |
|
4881 | + $end = self::ord((string)$var2); |
|
4882 | 4882 | } |
4883 | 4883 | |
4884 | 4884 | if (!$end) { |
@@ -4887,7 +4887,7 @@ discard block |
||
4887 | 4887 | |
4888 | 4888 | $array = []; |
4889 | 4889 | foreach (\range($start, $end, $step) as $i) { |
4890 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
4890 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
4891 | 4891 | } |
4892 | 4892 | |
4893 | 4893 | return $array; |
@@ -4983,8 +4983,8 @@ discard block |
||
4983 | 4983 | $delimiter = '/'; |
4984 | 4984 | } |
4985 | 4985 | |
4986 | - return (string) \preg_replace( |
|
4987 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4986 | + return (string)\preg_replace( |
|
4987 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4988 | 4988 | $replacement, |
4989 | 4989 | $str |
4990 | 4990 | ); |
@@ -5019,7 +5019,7 @@ discard block |
||
5019 | 5019 | |
5020 | 5020 | $str_length -= $bom_byte_length; |
5021 | 5021 | |
5022 | - $str = (string) $str_tmp; |
|
5022 | + $str = (string)$str_tmp; |
|
5023 | 5023 | } |
5024 | 5024 | } |
5025 | 5025 | |
@@ -5050,7 +5050,7 @@ discard block |
||
5050 | 5050 | */ |
5051 | 5051 | if (\is_array($what)) { |
5052 | 5052 | foreach ($what as $item) { |
5053 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
5053 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
5054 | 5054 | } |
5055 | 5055 | } |
5056 | 5056 | |
@@ -5088,7 +5088,7 @@ discard block |
||
5088 | 5088 | */ |
5089 | 5089 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
5090 | 5090 | { |
5091 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
5091 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
5092 | 5092 | } |
5093 | 5093 | |
5094 | 5094 | /** |
@@ -5152,17 +5152,17 @@ discard block |
||
5152 | 5152 | \strpos($str, $substring) === 0 |
5153 | 5153 | ) { |
5154 | 5154 | if ($encoding === 'UTF-8') { |
5155 | - return (string) \mb_substr( |
|
5155 | + return (string)\mb_substr( |
|
5156 | 5156 | $str, |
5157 | - (int) \mb_strlen($substring) |
|
5157 | + (int)\mb_strlen($substring) |
|
5158 | 5158 | ); |
5159 | 5159 | } |
5160 | 5160 | |
5161 | 5161 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5162 | 5162 | |
5163 | - return (string) self::substr( |
|
5163 | + return (string)self::substr( |
|
5164 | 5164 | $str, |
5165 | - (int) self::strlen($substring, $encoding), |
|
5165 | + (int)self::strlen($substring, $encoding), |
|
5166 | 5166 | null, |
5167 | 5167 | $encoding |
5168 | 5168 | ); |
@@ -5190,19 +5190,19 @@ discard block |
||
5190 | 5190 | ): string { |
5191 | 5191 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
5192 | 5192 | if ($encoding === 'UTF-8') { |
5193 | - return (string) \mb_substr( |
|
5193 | + return (string)\mb_substr( |
|
5194 | 5194 | $str, |
5195 | 5195 | 0, |
5196 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
5196 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
5197 | 5197 | ); |
5198 | 5198 | } |
5199 | 5199 | |
5200 | 5200 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5201 | 5201 | |
5202 | - return (string) self::substr( |
|
5202 | + return (string)self::substr( |
|
5203 | 5203 | $str, |
5204 | 5204 | 0, |
5205 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
5205 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
5206 | 5206 | $encoding |
5207 | 5207 | ); |
5208 | 5208 | } |
@@ -5305,7 +5305,7 @@ discard block |
||
5305 | 5305 | /** @noinspection PhpUsageOfSilenceOperatorInspection - ignore "Unknown character" warnings, it's working anyway */ |
5306 | 5306 | @\mb_substitute_character($replacement_char_helper); |
5307 | 5307 | // the polyfill maybe return false, so cast to string |
5308 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
5308 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
5309 | 5309 | \mb_substitute_character($save); |
5310 | 5310 | } |
5311 | 5311 | |
@@ -5350,7 +5350,7 @@ discard block |
||
5350 | 5350 | $pattern = '[\\s]+$'; |
5351 | 5351 | } |
5352 | 5352 | |
5353 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
5353 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
5354 | 5354 | } |
5355 | 5355 | |
5356 | 5356 | if ($chars !== null) { |
@@ -5379,7 +5379,7 @@ discard block |
||
5379 | 5379 | |
5380 | 5380 | $html .= '<pre>'; |
5381 | 5381 | foreach (self::$SUPPORT as $key => &$value) { |
5382 | - $html .= $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
5382 | + $html .= $key.' - '.\print_r($value, true)."\n<br>"; |
|
5383 | 5383 | } |
5384 | 5384 | $html .= '</pre>'; |
5385 | 5385 | |
@@ -5421,7 +5421,7 @@ discard block |
||
5421 | 5421 | return $char; |
5422 | 5422 | } |
5423 | 5423 | |
5424 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
5424 | + return '&#'.self::ord($char, $encoding).';'; |
|
5425 | 5425 | } |
5426 | 5426 | |
5427 | 5427 | /** |
@@ -5484,11 +5484,11 @@ discard block |
||
5484 | 5484 | $lang, |
5485 | 5485 | $try_to_keep_the_string_length |
5486 | 5486 | ); |
5487 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5487 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5488 | 5488 | |
5489 | 5489 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
5490 | 5490 | |
5491 | - $str = (string) \preg_replace_callback( |
|
5491 | + $str = (string)\preg_replace_callback( |
|
5492 | 5492 | '/[-_\\s]+(.)?/u', |
5493 | 5493 | /** |
5494 | 5494 | * @param array $match |
@@ -5497,7 +5497,7 @@ discard block |
||
5497 | 5497 | * |
5498 | 5498 | * @return string |
5499 | 5499 | */ |
5500 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5500 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5501 | 5501 | if (isset($match[1])) { |
5502 | 5502 | if ($use_mb_functions) { |
5503 | 5503 | if ($encoding === 'UTF-8') { |
@@ -5515,7 +5515,7 @@ discard block |
||
5515 | 5515 | $str |
5516 | 5516 | ); |
5517 | 5517 | |
5518 | - return (string) \preg_replace_callback( |
|
5518 | + return (string)\preg_replace_callback( |
|
5519 | 5519 | '/[\\p{N}]+(.)?/u', |
5520 | 5520 | /** |
5521 | 5521 | * @param array $match |
@@ -5524,7 +5524,7 @@ discard block |
||
5524 | 5524 | * |
5525 | 5525 | * @return string |
5526 | 5526 | */ |
5527 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5527 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5528 | 5528 | if ($use_mb_functions) { |
5529 | 5529 | if ($encoding === 'UTF-8') { |
5530 | 5530 | return \mb_strtoupper($match[0]); |
@@ -5719,7 +5719,7 @@ discard block |
||
5719 | 5719 | bool $try_to_keep_the_string_length = false |
5720 | 5720 | ): string { |
5721 | 5721 | if (self::$SUPPORT['mbstring'] === true) { |
5722 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5722 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5723 | 5723 | |
5724 | 5724 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
5725 | 5725 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -5728,10 +5728,10 @@ discard block |
||
5728 | 5728 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
5729 | 5729 | } |
5730 | 5730 | |
5731 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5731 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5732 | 5732 | } |
5733 | 5733 | |
5734 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5734 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5735 | 5735 | |
5736 | 5736 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
5737 | 5737 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -5740,7 +5740,7 @@ discard block |
||
5740 | 5740 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
5741 | 5741 | } |
5742 | 5742 | |
5743 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5743 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5744 | 5744 | } |
5745 | 5745 | |
5746 | 5746 | /** |
@@ -5764,7 +5764,7 @@ discard block |
||
5764 | 5764 | public static function str_detect_encoding($str) |
5765 | 5765 | { |
5766 | 5766 | // init |
5767 | - $str = (string) $str; |
|
5767 | + $str = (string)$str; |
|
5768 | 5768 | |
5769 | 5769 | // |
5770 | 5770 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5866,7 +5866,7 @@ discard block |
||
5866 | 5866 | foreach (self::$ENCODINGS as $encoding_tmp) { |
5867 | 5867 | // INFO: //IGNORE but still throw notice |
5868 | 5868 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5869 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
5869 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
5870 | 5870 | return $encoding_tmp; |
5871 | 5871 | } |
5872 | 5872 | } |
@@ -5956,7 +5956,7 @@ discard block |
||
5956 | 5956 | return $str; |
5957 | 5957 | } |
5958 | 5958 | |
5959 | - return $substring . $str; |
|
5959 | + return $substring.$str; |
|
5960 | 5960 | } |
5961 | 5961 | |
5962 | 5962 | /** |
@@ -6086,27 +6086,27 @@ discard block |
||
6086 | 6086 | string $encoding = 'UTF-8' |
6087 | 6087 | ): string { |
6088 | 6088 | if ($encoding === 'UTF-8') { |
6089 | - $len = (int) \mb_strlen($str); |
|
6089 | + $len = (int)\mb_strlen($str); |
|
6090 | 6090 | if ($index > $len) { |
6091 | 6091 | return $str; |
6092 | 6092 | } |
6093 | 6093 | |
6094 | 6094 | /** @noinspection UnnecessaryCastingInspection */ |
6095 | - return (string) \mb_substr($str, 0, $index) . |
|
6096 | - $substring . |
|
6097 | - (string) \mb_substr($str, $index, $len); |
|
6095 | + return (string)\mb_substr($str, 0, $index). |
|
6096 | + $substring. |
|
6097 | + (string)\mb_substr($str, $index, $len); |
|
6098 | 6098 | } |
6099 | 6099 | |
6100 | 6100 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6101 | 6101 | |
6102 | - $len = (int) self::strlen($str, $encoding); |
|
6102 | + $len = (int)self::strlen($str, $encoding); |
|
6103 | 6103 | if ($index > $len) { |
6104 | 6104 | return $str; |
6105 | 6105 | } |
6106 | 6106 | |
6107 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
6108 | - $substring . |
|
6109 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
6107 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
6108 | + $substring. |
|
6109 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
6110 | 6110 | } |
6111 | 6111 | |
6112 | 6112 | /** |
@@ -6146,15 +6146,15 @@ discard block |
||
6146 | 6146 | */ |
6147 | 6147 | public static function str_ireplace($search, $replacement, $subject, &$count = null) |
6148 | 6148 | { |
6149 | - $search = (array) $search; |
|
6149 | + $search = (array)$search; |
|
6150 | 6150 | |
6151 | 6151 | /** @noinspection AlterInForeachInspection */ |
6152 | 6152 | foreach ($search as &$s) { |
6153 | - $s = (string) $s; |
|
6153 | + $s = (string)$s; |
|
6154 | 6154 | if ($s === '') { |
6155 | 6155 | $s = '/^(?<=.)$/'; |
6156 | 6156 | } else { |
6157 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
6157 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
6158 | 6158 | } |
6159 | 6159 | } |
6160 | 6160 | |
@@ -6202,12 +6202,12 @@ discard block |
||
6202 | 6202 | } |
6203 | 6203 | |
6204 | 6204 | if ($search === '') { |
6205 | - return $str . $replacement; |
|
6205 | + return $str.$replacement; |
|
6206 | 6206 | } |
6207 | 6207 | |
6208 | 6208 | $searchLength = \strlen($search); |
6209 | 6209 | if (\strncasecmp($str, $search, $searchLength) === 0) { |
6210 | - return $replacement . \substr($str, $searchLength); |
|
6210 | + return $replacement.\substr($str, $searchLength); |
|
6211 | 6211 | } |
6212 | 6212 | |
6213 | 6213 | return $str; |
@@ -6238,11 +6238,11 @@ discard block |
||
6238 | 6238 | } |
6239 | 6239 | |
6240 | 6240 | if ($search === '') { |
6241 | - return $str . $replacement; |
|
6241 | + return $str.$replacement; |
|
6242 | 6242 | } |
6243 | 6243 | |
6244 | 6244 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6245 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6245 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6246 | 6246 | } |
6247 | 6247 | |
6248 | 6248 | return $str; |
@@ -6334,15 +6334,15 @@ discard block |
||
6334 | 6334 | } |
6335 | 6335 | |
6336 | 6336 | if ($encoding === 'UTF-8') { |
6337 | - return (string) \mb_substr( |
|
6337 | + return (string)\mb_substr( |
|
6338 | 6338 | $str, |
6339 | - $offset + (int) \mb_strlen($separator) |
|
6339 | + $offset + (int)\mb_strlen($separator) |
|
6340 | 6340 | ); |
6341 | 6341 | } |
6342 | 6342 | |
6343 | - return (string) self::substr( |
|
6343 | + return (string)self::substr( |
|
6344 | 6344 | $str, |
6345 | - $offset + (int) self::strlen($separator, $encoding), |
|
6345 | + $offset + (int)self::strlen($separator, $encoding), |
|
6346 | 6346 | null, |
6347 | 6347 | $encoding |
6348 | 6348 | ); |
@@ -6374,15 +6374,15 @@ discard block |
||
6374 | 6374 | } |
6375 | 6375 | |
6376 | 6376 | if ($encoding === 'UTF-8') { |
6377 | - return (string) \mb_substr( |
|
6377 | + return (string)\mb_substr( |
|
6378 | 6378 | $str, |
6379 | - $offset + (int) self::strlen($separator) |
|
6379 | + $offset + (int)self::strlen($separator) |
|
6380 | 6380 | ); |
6381 | 6381 | } |
6382 | 6382 | |
6383 | - return (string) self::substr( |
|
6383 | + return (string)self::substr( |
|
6384 | 6384 | $str, |
6385 | - $offset + (int) self::strlen($separator, $encoding), |
|
6385 | + $offset + (int)self::strlen($separator, $encoding), |
|
6386 | 6386 | null, |
6387 | 6387 | $encoding |
6388 | 6388 | ); |
@@ -6414,10 +6414,10 @@ discard block |
||
6414 | 6414 | } |
6415 | 6415 | |
6416 | 6416 | if ($encoding === 'UTF-8') { |
6417 | - return (string) \mb_substr($str, 0, $offset); |
|
6417 | + return (string)\mb_substr($str, 0, $offset); |
|
6418 | 6418 | } |
6419 | 6419 | |
6420 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6420 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6421 | 6421 | } |
6422 | 6422 | |
6423 | 6423 | /** |
@@ -6446,7 +6446,7 @@ discard block |
||
6446 | 6446 | return ''; |
6447 | 6447 | } |
6448 | 6448 | |
6449 | - return (string) \mb_substr($str, 0, $offset); |
|
6449 | + return (string)\mb_substr($str, 0, $offset); |
|
6450 | 6450 | } |
6451 | 6451 | |
6452 | 6452 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6454,7 +6454,7 @@ discard block |
||
6454 | 6454 | return ''; |
6455 | 6455 | } |
6456 | 6456 | |
6457 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6457 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6458 | 6458 | } |
6459 | 6459 | |
6460 | 6460 | /** |
@@ -6556,12 +6556,12 @@ discard block |
||
6556 | 6556 | } |
6557 | 6557 | |
6558 | 6558 | if ($encoding === 'UTF-8') { |
6559 | - return (string) \mb_substr($str, -$n); |
|
6559 | + return (string)\mb_substr($str, -$n); |
|
6560 | 6560 | } |
6561 | 6561 | |
6562 | 6562 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6563 | 6563 | |
6564 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6564 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6565 | 6565 | } |
6566 | 6566 | |
6567 | 6567 | /** |
@@ -6587,21 +6587,21 @@ discard block |
||
6587 | 6587 | } |
6588 | 6588 | |
6589 | 6589 | if ($encoding === 'UTF-8') { |
6590 | - if ((int) \mb_strlen($str) <= $length) { |
|
6590 | + if ((int)\mb_strlen($str) <= $length) { |
|
6591 | 6591 | return $str; |
6592 | 6592 | } |
6593 | 6593 | |
6594 | 6594 | /** @noinspection UnnecessaryCastingInspection */ |
6595 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
6595 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
6596 | 6596 | } |
6597 | 6597 | |
6598 | 6598 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6599 | 6599 | |
6600 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6600 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6601 | 6601 | return $str; |
6602 | 6602 | } |
6603 | 6603 | |
6604 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
6604 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
6605 | 6605 | } |
6606 | 6606 | |
6607 | 6607 | /** |
@@ -6629,12 +6629,12 @@ discard block |
||
6629 | 6629 | } |
6630 | 6630 | |
6631 | 6631 | if ($encoding === 'UTF-8') { |
6632 | - if ((int) \mb_strlen($str) <= $length) { |
|
6632 | + if ((int)\mb_strlen($str) <= $length) { |
|
6633 | 6633 | return $str; |
6634 | 6634 | } |
6635 | 6635 | |
6636 | 6636 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6637 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6637 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6638 | 6638 | } |
6639 | 6639 | |
6640 | 6640 | $str = \mb_substr($str, 0, $length); |
@@ -6643,32 +6643,32 @@ discard block |
||
6643 | 6643 | $new_str = \implode(' ', $array); |
6644 | 6644 | |
6645 | 6645 | if ($new_str === '') { |
6646 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6646 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6647 | 6647 | } |
6648 | 6648 | } else { |
6649 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6649 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6650 | 6650 | return $str; |
6651 | 6651 | } |
6652 | 6652 | |
6653 | 6653 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6654 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6654 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6655 | 6655 | } |
6656 | 6656 | |
6657 | 6657 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6658 | 6658 | $str = self::substr($str, 0, $length, $encoding); |
6659 | 6659 | if ($str === false) { |
6660 | - return '' . $str_add_on; |
|
6660 | + return ''.$str_add_on; |
|
6661 | 6661 | } |
6662 | 6662 | |
6663 | 6663 | $array = \explode(' ', $str, -1); |
6664 | 6664 | $new_str = \implode(' ', $array); |
6665 | 6665 | |
6666 | 6666 | if ($new_str === '') { |
6667 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6667 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6668 | 6668 | } |
6669 | 6669 | } |
6670 | 6670 | |
6671 | - return $new_str . $str_add_on; |
|
6671 | + return $new_str.$str_add_on; |
|
6672 | 6672 | } |
6673 | 6673 | |
6674 | 6674 | /** |
@@ -6691,7 +6691,7 @@ discard block |
||
6691 | 6691 | $longest_common_prefix = ''; |
6692 | 6692 | |
6693 | 6693 | if ($encoding === 'UTF-8') { |
6694 | - $max_length = (int) \min( |
|
6694 | + $max_length = (int)\min( |
|
6695 | 6695 | \mb_strlen($str1), |
6696 | 6696 | \mb_strlen($str2) |
6697 | 6697 | ); |
@@ -6712,7 +6712,7 @@ discard block |
||
6712 | 6712 | } else { |
6713 | 6713 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6714 | 6714 | |
6715 | - $max_length = (int) \min( |
|
6715 | + $max_length = (int)\min( |
|
6716 | 6716 | self::strlen($str1, $encoding), |
6717 | 6717 | self::strlen($str2, $encoding) |
6718 | 6718 | ); |
@@ -6761,13 +6761,13 @@ discard block |
||
6761 | 6761 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6762 | 6762 | |
6763 | 6763 | if ($encoding === 'UTF-8') { |
6764 | - $str_length = (int) \mb_strlen($str1); |
|
6765 | - $other_length = (int) \mb_strlen($str2); |
|
6764 | + $str_length = (int)\mb_strlen($str1); |
|
6765 | + $other_length = (int)\mb_strlen($str2); |
|
6766 | 6766 | } else { |
6767 | 6767 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6768 | 6768 | |
6769 | - $str_length = (int) self::strlen($str1, $encoding); |
|
6770 | - $other_length = (int) self::strlen($str2, $encoding); |
|
6769 | + $str_length = (int)self::strlen($str1, $encoding); |
|
6770 | + $other_length = (int)self::strlen($str2, $encoding); |
|
6771 | 6771 | } |
6772 | 6772 | |
6773 | 6773 | // Return if either string is empty |
@@ -6820,10 +6820,10 @@ discard block |
||
6820 | 6820 | } |
6821 | 6821 | |
6822 | 6822 | if ($encoding === 'UTF-8') { |
6823 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
6823 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
6824 | 6824 | } |
6825 | 6825 | |
6826 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
6826 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
6827 | 6827 | } |
6828 | 6828 | |
6829 | 6829 | /** |
@@ -6847,7 +6847,7 @@ discard block |
||
6847 | 6847 | } |
6848 | 6848 | |
6849 | 6849 | if ($encoding === 'UTF-8') { |
6850 | - $max_length = (int) \min( |
|
6850 | + $max_length = (int)\min( |
|
6851 | 6851 | \mb_strlen($str1, $encoding), |
6852 | 6852 | \mb_strlen($str2, $encoding) |
6853 | 6853 | ); |
@@ -6861,7 +6861,7 @@ discard block |
||
6861 | 6861 | && |
6862 | 6862 | $char === \mb_substr($str2, -$i, 1) |
6863 | 6863 | ) { |
6864 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
6864 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
6865 | 6865 | } else { |
6866 | 6866 | break; |
6867 | 6867 | } |
@@ -6869,7 +6869,7 @@ discard block |
||
6869 | 6869 | } else { |
6870 | 6870 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6871 | 6871 | |
6872 | - $max_length = (int) \min( |
|
6872 | + $max_length = (int)\min( |
|
6873 | 6873 | self::strlen($str1, $encoding), |
6874 | 6874 | self::strlen($str2, $encoding) |
6875 | 6875 | ); |
@@ -6883,7 +6883,7 @@ discard block |
||
6883 | 6883 | && |
6884 | 6884 | $char === self::substr($str2, -$i, 1, $encoding) |
6885 | 6885 | ) { |
6886 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
6886 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
6887 | 6887 | } else { |
6888 | 6888 | break; |
6889 | 6889 | } |
@@ -6906,7 +6906,7 @@ discard block |
||
6906 | 6906 | */ |
6907 | 6907 | public static function str_matches_pattern(string $str, string $pattern): bool |
6908 | 6908 | { |
6909 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6909 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6910 | 6910 | } |
6911 | 6911 | |
6912 | 6912 | /** |
@@ -6926,7 +6926,7 @@ discard block |
||
6926 | 6926 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6927 | 6927 | { |
6928 | 6928 | // init |
6929 | - $length = (int) self::strlen($str, $encoding); |
|
6929 | + $length = (int)self::strlen($str, $encoding); |
|
6930 | 6930 | |
6931 | 6931 | if ($offset >= 0) { |
6932 | 6932 | return $length > $offset; |
@@ -6955,7 +6955,7 @@ discard block |
||
6955 | 6955 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6956 | 6956 | { |
6957 | 6957 | // init |
6958 | - $length = (int) self::strlen($str); |
|
6958 | + $length = (int)self::strlen($str); |
|
6959 | 6959 | |
6960 | 6960 | if ( |
6961 | 6961 | ($index >= 0 && $length <= $index) |
@@ -6999,7 +6999,7 @@ discard block |
||
6999 | 6999 | return $str; |
7000 | 7000 | } |
7001 | 7001 | |
7002 | - if ($pad_type !== (int) $pad_type) { |
|
7002 | + if ($pad_type !== (int)$pad_type) { |
|
7003 | 7003 | if ($pad_type === 'left') { |
7004 | 7004 | $pad_type = \STR_PAD_LEFT; |
7005 | 7005 | } elseif ($pad_type === 'right') { |
@@ -7008,23 +7008,23 @@ discard block |
||
7008 | 7008 | $pad_type = \STR_PAD_BOTH; |
7009 | 7009 | } else { |
7010 | 7010 | throw new \InvalidArgumentException( |
7011 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
7011 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
7012 | 7012 | ); |
7013 | 7013 | } |
7014 | 7014 | } |
7015 | 7015 | |
7016 | 7016 | if ($encoding === 'UTF-8') { |
7017 | - $str_length = (int) \mb_strlen($str); |
|
7017 | + $str_length = (int)\mb_strlen($str); |
|
7018 | 7018 | |
7019 | 7019 | if ($pad_length >= $str_length) { |
7020 | 7020 | switch ($pad_type) { |
7021 | 7021 | case \STR_PAD_LEFT: |
7022 | - $ps_length = (int) \mb_strlen($pad_string); |
|
7022 | + $ps_length = (int)\mb_strlen($pad_string); |
|
7023 | 7023 | |
7024 | 7024 | $diff = ($pad_length - $str_length); |
7025 | 7025 | |
7026 | - $pre = (string) \mb_substr( |
|
7027 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7026 | + $pre = (string)\mb_substr( |
|
7027 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7028 | 7028 | 0, |
7029 | 7029 | $diff |
7030 | 7030 | ); |
@@ -7035,16 +7035,16 @@ discard block |
||
7035 | 7035 | case \STR_PAD_BOTH: |
7036 | 7036 | $diff = ($pad_length - $str_length); |
7037 | 7037 | |
7038 | - $ps_length_left = (int) \floor($diff / 2); |
|
7038 | + $ps_length_left = (int)\floor($diff / 2); |
|
7039 | 7039 | |
7040 | - $ps_length_right = (int) \ceil($diff / 2); |
|
7040 | + $ps_length_right = (int)\ceil($diff / 2); |
|
7041 | 7041 | |
7042 | - $pre = (string) \mb_substr( |
|
7042 | + $pre = (string)\mb_substr( |
|
7043 | 7043 | \str_repeat($pad_string, $ps_length_left), |
7044 | 7044 | 0, |
7045 | 7045 | $ps_length_left |
7046 | 7046 | ); |
7047 | - $post = (string) \mb_substr( |
|
7047 | + $post = (string)\mb_substr( |
|
7048 | 7048 | \str_repeat($pad_string, $ps_length_right), |
7049 | 7049 | 0, |
7050 | 7050 | $ps_length_right |
@@ -7054,19 +7054,19 @@ discard block |
||
7054 | 7054 | |
7055 | 7055 | case \STR_PAD_RIGHT: |
7056 | 7056 | default: |
7057 | - $ps_length = (int) \mb_strlen($pad_string); |
|
7057 | + $ps_length = (int)\mb_strlen($pad_string); |
|
7058 | 7058 | |
7059 | 7059 | $diff = ($pad_length - $str_length); |
7060 | 7060 | |
7061 | - $post = (string) \mb_substr( |
|
7062 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7061 | + $post = (string)\mb_substr( |
|
7062 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7063 | 7063 | 0, |
7064 | 7064 | $diff |
7065 | 7065 | ); |
7066 | 7066 | $pre = ''; |
7067 | 7067 | } |
7068 | 7068 | |
7069 | - return $pre . $str . $post; |
|
7069 | + return $pre.$str.$post; |
|
7070 | 7070 | } |
7071 | 7071 | |
7072 | 7072 | return $str; |
@@ -7074,17 +7074,17 @@ discard block |
||
7074 | 7074 | |
7075 | 7075 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7076 | 7076 | |
7077 | - $str_length = (int) self::strlen($str, $encoding); |
|
7077 | + $str_length = (int)self::strlen($str, $encoding); |
|
7078 | 7078 | |
7079 | 7079 | if ($pad_length >= $str_length) { |
7080 | 7080 | switch ($pad_type) { |
7081 | 7081 | case \STR_PAD_LEFT: |
7082 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
7082 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
7083 | 7083 | |
7084 | 7084 | $diff = ($pad_length - $str_length); |
7085 | 7085 | |
7086 | - $pre = (string) self::substr( |
|
7087 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7086 | + $pre = (string)self::substr( |
|
7087 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7088 | 7088 | 0, |
7089 | 7089 | $diff, |
7090 | 7090 | $encoding |
@@ -7096,17 +7096,17 @@ discard block |
||
7096 | 7096 | case \STR_PAD_BOTH: |
7097 | 7097 | $diff = ($pad_length - $str_length); |
7098 | 7098 | |
7099 | - $ps_length_left = (int) \floor($diff / 2); |
|
7099 | + $ps_length_left = (int)\floor($diff / 2); |
|
7100 | 7100 | |
7101 | - $ps_length_right = (int) \ceil($diff / 2); |
|
7101 | + $ps_length_right = (int)\ceil($diff / 2); |
|
7102 | 7102 | |
7103 | - $pre = (string) self::substr( |
|
7103 | + $pre = (string)self::substr( |
|
7104 | 7104 | \str_repeat($pad_string, $ps_length_left), |
7105 | 7105 | 0, |
7106 | 7106 | $ps_length_left, |
7107 | 7107 | $encoding |
7108 | 7108 | ); |
7109 | - $post = (string) self::substr( |
|
7109 | + $post = (string)self::substr( |
|
7110 | 7110 | \str_repeat($pad_string, $ps_length_right), |
7111 | 7111 | 0, |
7112 | 7112 | $ps_length_right, |
@@ -7117,12 +7117,12 @@ discard block |
||
7117 | 7117 | |
7118 | 7118 | case \STR_PAD_RIGHT: |
7119 | 7119 | default: |
7120 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
7120 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
7121 | 7121 | |
7122 | 7122 | $diff = ($pad_length - $str_length); |
7123 | 7123 | |
7124 | - $post = (string) self::substr( |
|
7125 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7124 | + $post = (string)self::substr( |
|
7125 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7126 | 7126 | 0, |
7127 | 7127 | $diff, |
7128 | 7128 | $encoding |
@@ -7130,7 +7130,7 @@ discard block |
||
7130 | 7130 | $pre = ''; |
7131 | 7131 | } |
7132 | 7132 | |
7133 | - return $pre . $str . $post; |
|
7133 | + return $pre.$str.$post; |
|
7134 | 7134 | } |
7135 | 7135 | |
7136 | 7136 | return $str; |
@@ -7341,12 +7341,12 @@ discard block |
||
7341 | 7341 | } |
7342 | 7342 | |
7343 | 7343 | if ($search === '') { |
7344 | - return $str . $replacement; |
|
7344 | + return $str.$replacement; |
|
7345 | 7345 | } |
7346 | 7346 | |
7347 | 7347 | $searchLength = \strlen($search); |
7348 | 7348 | if (\strncmp($str, $search, $searchLength) === 0) { |
7349 | - return $replacement . \substr($str, $searchLength); |
|
7349 | + return $replacement.\substr($str, $searchLength); |
|
7350 | 7350 | } |
7351 | 7351 | |
7352 | 7352 | return $str; |
@@ -7380,11 +7380,11 @@ discard block |
||
7380 | 7380 | } |
7381 | 7381 | |
7382 | 7382 | if ($search === '') { |
7383 | - return $str . $replacement; |
|
7383 | + return $str.$replacement; |
|
7384 | 7384 | } |
7385 | 7385 | |
7386 | 7386 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
7387 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
7387 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
7388 | 7388 | } |
7389 | 7389 | |
7390 | 7390 | return $str; |
@@ -7418,7 +7418,7 @@ discard block |
||
7418 | 7418 | $subject, |
7419 | 7419 | $replace, |
7420 | 7420 | $pos, |
7421 | - (int) self::strlen($search) |
|
7421 | + (int)self::strlen($search) |
|
7422 | 7422 | ); |
7423 | 7423 | } |
7424 | 7424 | |
@@ -7452,7 +7452,7 @@ discard block |
||
7452 | 7452 | $subject, |
7453 | 7453 | $replace, |
7454 | 7454 | $pos, |
7455 | - (int) self::strlen($search) |
|
7455 | + (int)self::strlen($search) |
|
7456 | 7456 | ); |
7457 | 7457 | } |
7458 | 7458 | |
@@ -7475,7 +7475,7 @@ discard block |
||
7475 | 7475 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
7476 | 7476 | { |
7477 | 7477 | if ($encoding === 'UTF-8') { |
7478 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
7478 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
7479 | 7479 | \shuffle($indexes); |
7480 | 7480 | |
7481 | 7481 | // init |
@@ -7490,7 +7490,7 @@ discard block |
||
7490 | 7490 | } else { |
7491 | 7491 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7492 | 7492 | |
7493 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
7493 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
7494 | 7494 | \shuffle($indexes); |
7495 | 7495 | |
7496 | 7496 | // init |
@@ -7532,11 +7532,11 @@ discard block |
||
7532 | 7532 | ) { |
7533 | 7533 | if ($encoding === 'UTF-8') { |
7534 | 7534 | if ($end === null) { |
7535 | - $length = (int) \mb_strlen($str); |
|
7535 | + $length = (int)\mb_strlen($str); |
|
7536 | 7536 | } elseif ($end >= 0 && $end <= $start) { |
7537 | 7537 | return ''; |
7538 | 7538 | } elseif ($end < 0) { |
7539 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7539 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7540 | 7540 | } else { |
7541 | 7541 | $length = $end - $start; |
7542 | 7542 | } |
@@ -7547,11 +7547,11 @@ discard block |
||
7547 | 7547 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7548 | 7548 | |
7549 | 7549 | if ($end === null) { |
7550 | - $length = (int) self::strlen($str, $encoding); |
|
7550 | + $length = (int)self::strlen($str, $encoding); |
|
7551 | 7551 | } elseif ($end >= 0 && $end <= $start) { |
7552 | 7552 | return ''; |
7553 | 7553 | } elseif ($end < 0) { |
7554 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7554 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7555 | 7555 | } else { |
7556 | 7556 | $length = $end - $start; |
7557 | 7557 | } |
@@ -7586,7 +7586,7 @@ discard block |
||
7586 | 7586 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7587 | 7587 | } |
7588 | 7588 | |
7589 | - $str = (string) \preg_replace_callback( |
|
7589 | + $str = (string)\preg_replace_callback( |
|
7590 | 7590 | '/([\\p{N}|\\p{Lu}])/u', |
7591 | 7591 | /** |
7592 | 7592 | * @param string[] $matches |
@@ -7595,28 +7595,28 @@ discard block |
||
7595 | 7595 | * |
7596 | 7596 | * @return string |
7597 | 7597 | */ |
7598 | - static function (array $matches) use ($encoding): string { |
|
7598 | + static function(array $matches) use ($encoding): string { |
|
7599 | 7599 | $match = $matches[1]; |
7600 | - $match_int = (int) $match; |
|
7600 | + $match_int = (int)$match; |
|
7601 | 7601 | |
7602 | - if ((string) $match_int === $match) { |
|
7603 | - return '_' . $match . '_'; |
|
7602 | + if ((string)$match_int === $match) { |
|
7603 | + return '_'.$match.'_'; |
|
7604 | 7604 | } |
7605 | 7605 | |
7606 | 7606 | if ($encoding === 'UTF-8') { |
7607 | - return '_' . \mb_strtolower($match); |
|
7607 | + return '_'.\mb_strtolower($match); |
|
7608 | 7608 | } |
7609 | 7609 | |
7610 | - return '_' . self::strtolower($match, $encoding); |
|
7610 | + return '_'.self::strtolower($match, $encoding); |
|
7611 | 7611 | }, |
7612 | 7612 | $str |
7613 | 7613 | ); |
7614 | 7614 | |
7615 | - $str = (string) \preg_replace( |
|
7615 | + $str = (string)\preg_replace( |
|
7616 | 7616 | [ |
7617 | - '/\\s+/u', // convert spaces to "_" |
|
7617 | + '/\\s+/u', // convert spaces to "_" |
|
7618 | 7618 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
7619 | - '/_+/', // remove double "_" |
|
7619 | + '/_+/', // remove double "_" |
|
7620 | 7620 | ], |
7621 | 7621 | [ |
7622 | 7622 | '_', |
@@ -7744,7 +7744,7 @@ discard block |
||
7744 | 7744 | } |
7745 | 7745 | |
7746 | 7746 | // init |
7747 | - $input = (string) $input; |
|
7747 | + $input = (string)$input; |
|
7748 | 7748 | |
7749 | 7749 | if ($input === '') { |
7750 | 7750 | return []; |
@@ -7800,7 +7800,7 @@ discard block |
||
7800 | 7800 | ($input[$i] & "\xE0") === "\xC0" |
7801 | 7801 | ) { |
7802 | 7802 | if (($input[$i + 1] & "\xC0") === "\x80") { |
7803 | - $ret[] = $input[$i] . $input[$i + 1]; |
|
7803 | + $ret[] = $input[$i].$input[$i + 1]; |
|
7804 | 7804 | |
7805 | 7805 | ++$i; |
7806 | 7806 | } |
@@ -7814,7 +7814,7 @@ discard block |
||
7814 | 7814 | && |
7815 | 7815 | ($input[$i + 2] & "\xC0") === "\x80" |
7816 | 7816 | ) { |
7817 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2]; |
|
7817 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2]; |
|
7818 | 7818 | |
7819 | 7819 | $i += 2; |
7820 | 7820 | } |
@@ -7830,7 +7830,7 @@ discard block |
||
7830 | 7830 | && |
7831 | 7831 | ($input[$i + 3] & "\xC0") === "\x80" |
7832 | 7832 | ) { |
7833 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2] . $input[$i + 3]; |
|
7833 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2].$input[$i + 3]; |
|
7834 | 7834 | |
7835 | 7835 | $i += 3; |
7836 | 7836 | } |
@@ -7840,7 +7840,7 @@ discard block |
||
7840 | 7840 | |
7841 | 7841 | if ($length > 1) { |
7842 | 7842 | return \array_map( |
7843 | - static function (array $item): string { |
|
7843 | + static function(array $item): string { |
|
7844 | 7844 | return \implode('', $item); |
7845 | 7845 | }, |
7846 | 7846 | \array_chunk($ret, $length) |
@@ -7912,7 +7912,7 @@ discard block |
||
7912 | 7912 | $limit = -1; |
7913 | 7913 | } |
7914 | 7914 | |
7915 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7915 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7916 | 7916 | if ($array === false) { |
7917 | 7917 | return []; |
7918 | 7918 | } |
@@ -8012,9 +8012,9 @@ discard block |
||
8012 | 8012 | return ''; |
8013 | 8013 | } |
8014 | 8014 | |
8015 | - return (string) \mb_substr( |
|
8015 | + return (string)\mb_substr( |
|
8016 | 8016 | $str, |
8017 | - $offset + (int) \mb_strlen($separator) |
|
8017 | + $offset + (int)\mb_strlen($separator) |
|
8018 | 8018 | ); |
8019 | 8019 | } |
8020 | 8020 | |
@@ -8023,9 +8023,9 @@ discard block |
||
8023 | 8023 | return ''; |
8024 | 8024 | } |
8025 | 8025 | |
8026 | - return (string) \mb_substr( |
|
8026 | + return (string)\mb_substr( |
|
8027 | 8027 | $str, |
8028 | - $offset + (int) self::strlen($separator, $encoding), |
|
8028 | + $offset + (int)self::strlen($separator, $encoding), |
|
8029 | 8029 | null, |
8030 | 8030 | $encoding |
8031 | 8031 | ); |
@@ -8057,9 +8057,9 @@ discard block |
||
8057 | 8057 | return ''; |
8058 | 8058 | } |
8059 | 8059 | |
8060 | - return (string) \mb_substr( |
|
8060 | + return (string)\mb_substr( |
|
8061 | 8061 | $str, |
8062 | - $offset + (int) \mb_strlen($separator) |
|
8062 | + $offset + (int)\mb_strlen($separator) |
|
8063 | 8063 | ); |
8064 | 8064 | } |
8065 | 8065 | |
@@ -8068,9 +8068,9 @@ discard block |
||
8068 | 8068 | return ''; |
8069 | 8069 | } |
8070 | 8070 | |
8071 | - return (string) self::substr( |
|
8071 | + return (string)self::substr( |
|
8072 | 8072 | $str, |
8073 | - $offset + (int) self::strlen($separator, $encoding), |
|
8073 | + $offset + (int)self::strlen($separator, $encoding), |
|
8074 | 8074 | null, |
8075 | 8075 | $encoding |
8076 | 8076 | ); |
@@ -8102,7 +8102,7 @@ discard block |
||
8102 | 8102 | return ''; |
8103 | 8103 | } |
8104 | 8104 | |
8105 | - return (string) \mb_substr( |
|
8105 | + return (string)\mb_substr( |
|
8106 | 8106 | $str, |
8107 | 8107 | 0, |
8108 | 8108 | $offset |
@@ -8114,7 +8114,7 @@ discard block |
||
8114 | 8114 | return ''; |
8115 | 8115 | } |
8116 | 8116 | |
8117 | - return (string) self::substr( |
|
8117 | + return (string)self::substr( |
|
8118 | 8118 | $str, |
8119 | 8119 | 0, |
8120 | 8120 | $offset, |
@@ -8145,7 +8145,7 @@ discard block |
||
8145 | 8145 | return ''; |
8146 | 8146 | } |
8147 | 8147 | |
8148 | - return (string) \mb_substr( |
|
8148 | + return (string)\mb_substr( |
|
8149 | 8149 | $str, |
8150 | 8150 | 0, |
8151 | 8151 | $offset |
@@ -8159,7 +8159,7 @@ discard block |
||
8159 | 8159 | |
8160 | 8160 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8161 | 8161 | |
8162 | - return (string) self::substr( |
|
8162 | + return (string)self::substr( |
|
8163 | 8163 | $str, |
8164 | 8164 | 0, |
8165 | 8165 | $offset, |
@@ -8274,7 +8274,7 @@ discard block |
||
8274 | 8274 | */ |
8275 | 8275 | public static function str_surround(string $str, string $substring): string |
8276 | 8276 | { |
8277 | - return $substring . $str . $substring; |
|
8277 | + return $substring.$str.$substring; |
|
8278 | 8278 | } |
8279 | 8279 | |
8280 | 8280 | /** |
@@ -8336,9 +8336,9 @@ discard block |
||
8336 | 8336 | $word_define_chars = ''; |
8337 | 8337 | } |
8338 | 8338 | |
8339 | - $str = (string) \preg_replace_callback( |
|
8340 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
8341 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
8339 | + $str = (string)\preg_replace_callback( |
|
8340 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
8341 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
8342 | 8342 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
8343 | 8343 | return $match[0]; |
8344 | 8344 | } |
@@ -8504,16 +8504,16 @@ discard block |
||
8504 | 8504 | } |
8505 | 8505 | |
8506 | 8506 | // the main substitutions |
8507 | - $str = (string) \preg_replace_callback( |
|
8507 | + $str = (string)\preg_replace_callback( |
|
8508 | 8508 | '~\\b (_*) (?: # 1. Leading underscore and |
8509 | 8509 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
8510 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
8510 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
8511 | 8511 | | |
8512 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
8512 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
8513 | 8513 | | |
8514 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
8514 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
8515 | 8515 | | |
8516 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
8516 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
8517 | 8517 | ) (_*) \\b # 6. With trailing underscore |
8518 | 8518 | ~ux', |
8519 | 8519 | /** |
@@ -8523,7 +8523,7 @@ discard block |
||
8523 | 8523 | * |
8524 | 8524 | * @return string |
8525 | 8525 | */ |
8526 | - static function (array $matches) use ($encoding): string { |
|
8526 | + static function(array $matches) use ($encoding): string { |
|
8527 | 8527 | // preserve leading underscore |
8528 | 8528 | $str = $matches[1]; |
8529 | 8529 | if ($matches[2]) { |
@@ -8548,11 +8548,11 @@ discard block |
||
8548 | 8548 | ); |
8549 | 8549 | |
8550 | 8550 | // Exceptions for small words: capitalize at start of title... |
8551 | - $str = (string) \preg_replace_callback( |
|
8551 | + $str = (string)\preg_replace_callback( |
|
8552 | 8552 | '~( \\A [[:punct:]]* # start of title... |
8553 | 8553 | | [:.;?!][ ]+ # or of subsentence... |
8554 | 8554 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
8555 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
8555 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
8556 | 8556 | ~uxi', |
8557 | 8557 | /** |
8558 | 8558 | * @param string[] $matches |
@@ -8561,15 +8561,15 @@ discard block |
||
8561 | 8561 | * |
8562 | 8562 | * @return string |
8563 | 8563 | */ |
8564 | - static function (array $matches) use ($encoding): string { |
|
8565 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
8564 | + static function(array $matches) use ($encoding): string { |
|
8565 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
8566 | 8566 | }, |
8567 | 8567 | $str |
8568 | 8568 | ); |
8569 | 8569 | |
8570 | 8570 | // ...and end of title |
8571 | - $str = (string) \preg_replace_callback( |
|
8572 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
8571 | + $str = (string)\preg_replace_callback( |
|
8572 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
8573 | 8573 | (?= [[:punct:]]* \Z # ...at the end of the title... |
8574 | 8574 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
8575 | 8575 | ~uxi', |
@@ -8580,7 +8580,7 @@ discard block |
||
8580 | 8580 | * |
8581 | 8581 | * @return string |
8582 | 8582 | */ |
8583 | - static function (array $matches) use ($encoding): string { |
|
8583 | + static function(array $matches) use ($encoding): string { |
|
8584 | 8584 | return static::ucfirst($matches[1], $encoding); |
8585 | 8585 | }, |
8586 | 8586 | $str |
@@ -8588,10 +8588,10 @@ discard block |
||
8588 | 8588 | |
8589 | 8589 | // Exceptions for small words in hyphenated compound words. |
8590 | 8590 | // e.g. "in-flight" -> In-Flight |
8591 | - $str = (string) \preg_replace_callback( |
|
8591 | + $str = (string)\preg_replace_callback( |
|
8592 | 8592 | '~\\b |
8593 | 8593 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
8594 | - ( ' . $small_words_rx . ' ) |
|
8594 | + ( ' . $small_words_rx.' ) |
|
8595 | 8595 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
8596 | 8596 | ~uxi', |
8597 | 8597 | /** |
@@ -8601,18 +8601,18 @@ discard block |
||
8601 | 8601 | * |
8602 | 8602 | * @return string |
8603 | 8603 | */ |
8604 | - static function (array $matches) use ($encoding): string { |
|
8604 | + static function(array $matches) use ($encoding): string { |
|
8605 | 8605 | return static::ucfirst($matches[1], $encoding); |
8606 | 8606 | }, |
8607 | 8607 | $str |
8608 | 8608 | ); |
8609 | 8609 | |
8610 | 8610 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
8611 | - $str = (string) \preg_replace_callback( |
|
8611 | + $str = (string)\preg_replace_callback( |
|
8612 | 8612 | '~\\b |
8613 | 8613 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
8614 | 8614 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
8615 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
8615 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
8616 | 8616 | (?! - ) # Negative lookahead for another - |
8617 | 8617 | ~uxi', |
8618 | 8618 | /** |
@@ -8622,8 +8622,8 @@ discard block |
||
8622 | 8622 | * |
8623 | 8623 | * @return string |
8624 | 8624 | */ |
8625 | - static function (array $matches) use ($encoding): string { |
|
8626 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
8625 | + static function(array $matches) use ($encoding): string { |
|
8626 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
8627 | 8627 | }, |
8628 | 8628 | $str |
8629 | 8629 | ); |
@@ -8741,7 +8741,7 @@ discard block |
||
8741 | 8741 | ); |
8742 | 8742 | |
8743 | 8743 | foreach ($tmp_return as &$item) { |
8744 | - $item = (string) $item; |
|
8744 | + $item = (string)$item; |
|
8745 | 8745 | } |
8746 | 8746 | |
8747 | 8747 | return $tmp_return; |
@@ -8773,38 +8773,38 @@ discard block |
||
8773 | 8773 | } |
8774 | 8774 | |
8775 | 8775 | if ($encoding === 'UTF-8') { |
8776 | - if ($length >= (int) \mb_strlen($str)) { |
|
8776 | + if ($length >= (int)\mb_strlen($str)) { |
|
8777 | 8777 | return $str; |
8778 | 8778 | } |
8779 | 8779 | |
8780 | 8780 | if ($substring !== '') { |
8781 | - $length -= (int) \mb_strlen($substring); |
|
8781 | + $length -= (int)\mb_strlen($substring); |
|
8782 | 8782 | |
8783 | 8783 | /** @noinspection UnnecessaryCastingInspection */ |
8784 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8784 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8785 | 8785 | } |
8786 | 8786 | |
8787 | - return (string) \mb_substr($str, 0, $length); |
|
8787 | + return (string)\mb_substr($str, 0, $length); |
|
8788 | 8788 | } |
8789 | 8789 | |
8790 | 8790 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8791 | 8791 | |
8792 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8792 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8793 | 8793 | return $str; |
8794 | 8794 | } |
8795 | 8795 | |
8796 | 8796 | if ($substring !== '') { |
8797 | - $length -= (int) self::strlen($substring, $encoding); |
|
8797 | + $length -= (int)self::strlen($substring, $encoding); |
|
8798 | 8798 | } |
8799 | 8799 | |
8800 | 8800 | return ( |
8801 | - (string) self::substr( |
|
8801 | + (string)self::substr( |
|
8802 | 8802 | $str, |
8803 | 8803 | 0, |
8804 | 8804 | $length, |
8805 | 8805 | $encoding |
8806 | 8806 | ) |
8807 | - ) . $substring; |
|
8807 | + ).$substring; |
|
8808 | 8808 | } |
8809 | 8809 | |
8810 | 8810 | /** |
@@ -8838,12 +8838,12 @@ discard block |
||
8838 | 8838 | } |
8839 | 8839 | |
8840 | 8840 | if ($encoding === 'UTF-8') { |
8841 | - if ($length >= (int) \mb_strlen($str)) { |
|
8841 | + if ($length >= (int)\mb_strlen($str)) { |
|
8842 | 8842 | return $str; |
8843 | 8843 | } |
8844 | 8844 | |
8845 | 8845 | // need to further trim the string so we can append the substring |
8846 | - $length -= (int) \mb_strlen($substring); |
|
8846 | + $length -= (int)\mb_strlen($substring); |
|
8847 | 8847 | if ($length <= 0) { |
8848 | 8848 | return $substring; |
8849 | 8849 | } |
@@ -8869,18 +8869,18 @@ discard block |
||
8869 | 8869 | !$ignore_do_not_split_words_for_one_word |
8870 | 8870 | ) |
8871 | 8871 | ) { |
8872 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
8872 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
8873 | 8873 | } |
8874 | 8874 | } |
8875 | 8875 | } else { |
8876 | 8876 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8877 | 8877 | |
8878 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8878 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8879 | 8879 | return $str; |
8880 | 8880 | } |
8881 | 8881 | |
8882 | 8882 | // need to further trim the string so we can append the substring |
8883 | - $length -= (int) self::strlen($substring, $encoding); |
|
8883 | + $length -= (int)self::strlen($substring, $encoding); |
|
8884 | 8884 | if ($length <= 0) { |
8885 | 8885 | return $substring; |
8886 | 8886 | } |
@@ -8906,12 +8906,12 @@ discard block |
||
8906 | 8906 | !$ignore_do_not_split_words_for_one_word |
8907 | 8907 | ) |
8908 | 8908 | ) { |
8909 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
8909 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
8910 | 8910 | } |
8911 | 8911 | } |
8912 | 8912 | } |
8913 | 8913 | |
8914 | - return $truncated . $substring; |
|
8914 | + return $truncated.$substring; |
|
8915 | 8915 | } |
8916 | 8916 | |
8917 | 8917 | /** |
@@ -9006,13 +9006,13 @@ discard block |
||
9006 | 9006 | } |
9007 | 9007 | } elseif ($format === 2) { |
9008 | 9008 | $number_of_words = []; |
9009 | - $offset = (int) self::strlen($str_parts[0]); |
|
9009 | + $offset = (int)self::strlen($str_parts[0]); |
|
9010 | 9010 | for ($i = 1; $i < $len; $i += 2) { |
9011 | 9011 | $number_of_words[$offset] = $str_parts[$i]; |
9012 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
9012 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
9013 | 9013 | } |
9014 | 9014 | } else { |
9015 | - $number_of_words = (int) (($len - 1) / 2); |
|
9015 | + $number_of_words = (int)(($len - 1) / 2); |
|
9016 | 9016 | } |
9017 | 9017 | |
9018 | 9018 | return $number_of_words; |
@@ -9115,7 +9115,7 @@ discard block |
||
9115 | 9115 | } |
9116 | 9116 | |
9117 | 9117 | if ($char_list === '') { |
9118 | - return (int) self::strlen($str, $encoding); |
|
9118 | + return (int)self::strlen($str, $encoding); |
|
9119 | 9119 | } |
9120 | 9120 | |
9121 | 9121 | if ($offset || $length !== null) { |
@@ -9141,7 +9141,7 @@ discard block |
||
9141 | 9141 | } |
9142 | 9142 | |
9143 | 9143 | $matches = []; |
9144 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
9144 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
9145 | 9145 | $return = self::strlen($matches[1], $encoding); |
9146 | 9146 | if ($return === false) { |
9147 | 9147 | return 0; |
@@ -9150,7 +9150,7 @@ discard block |
||
9150 | 9150 | return $return; |
9151 | 9151 | } |
9152 | 9152 | |
9153 | - return (int) self::strlen($str, $encoding); |
|
9153 | + return (int)self::strlen($str, $encoding); |
|
9154 | 9154 | } |
9155 | 9155 | |
9156 | 9156 | /** |
@@ -9181,7 +9181,7 @@ discard block |
||
9181 | 9181 | |
9182 | 9182 | $str = ''; |
9183 | 9183 | foreach ($intOrHex as $strPart) { |
9184 | - $str .= '&#' . (int) $strPart . ';'; |
|
9184 | + $str .= '&#'.(int)$strPart.';'; |
|
9185 | 9185 | } |
9186 | 9186 | |
9187 | 9187 | return self::html_entity_decode($str, \ENT_QUOTES | \ENT_HTML5); |
@@ -9277,7 +9277,7 @@ discard block |
||
9277 | 9277 | return ''; |
9278 | 9278 | } |
9279 | 9279 | |
9280 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
9280 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
9281 | 9281 | } |
9282 | 9282 | |
9283 | 9283 | /** |
@@ -9356,7 +9356,7 @@ discard block |
||
9356 | 9356 | // fallback for ascii only |
9357 | 9357 | // |
9358 | 9358 | |
9359 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9359 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9360 | 9360 | return \stripos($haystack, $needle, $offset); |
9361 | 9361 | } |
9362 | 9362 | |
@@ -9445,7 +9445,7 @@ discard block |
||
9445 | 9445 | /** |
9446 | 9446 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
9447 | 9447 | */ |
9448 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9448 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9449 | 9449 | } |
9450 | 9450 | |
9451 | 9451 | if ( |
@@ -9459,11 +9459,11 @@ discard block |
||
9459 | 9459 | } |
9460 | 9460 | } |
9461 | 9461 | |
9462 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
9462 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
9463 | 9463 | return \stristr($haystack, $needle, $before_needle); |
9464 | 9464 | } |
9465 | 9465 | |
9466 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
9466 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
9467 | 9467 | |
9468 | 9468 | if (!isset($match[1])) { |
9469 | 9469 | return false; |
@@ -9473,7 +9473,7 @@ discard block |
||
9473 | 9473 | return $match[1]; |
9474 | 9474 | } |
9475 | 9475 | |
9476 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
9476 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
9477 | 9477 | } |
9478 | 9478 | |
9479 | 9479 | /** |
@@ -9556,7 +9556,7 @@ discard block |
||
9556 | 9556 | /** |
9557 | 9557 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
9558 | 9558 | */ |
9559 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9559 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9560 | 9560 | } |
9561 | 9561 | |
9562 | 9562 | // |
@@ -9694,8 +9694,8 @@ discard block |
||
9694 | 9694 | } |
9695 | 9695 | |
9696 | 9696 | return \strnatcmp( |
9697 | - (string) self::strtonatfold($str1), |
|
9698 | - (string) self::strtonatfold($str2) |
|
9697 | + (string)self::strtonatfold($str1), |
|
9698 | + (string)self::strtonatfold($str2) |
|
9699 | 9699 | ); |
9700 | 9700 | } |
9701 | 9701 | |
@@ -9765,11 +9765,11 @@ discard block |
||
9765 | 9765 | } |
9766 | 9766 | |
9767 | 9767 | if ($encoding === 'UTF-8') { |
9768 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
9769 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
9768 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
9769 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
9770 | 9770 | } else { |
9771 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
9772 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
9771 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
9772 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
9773 | 9773 | } |
9774 | 9774 | |
9775 | 9775 | return self::strcmp($str1, $str2); |
@@ -9796,8 +9796,8 @@ discard block |
||
9796 | 9796 | return false; |
9797 | 9797 | } |
9798 | 9798 | |
9799 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
9800 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
9799 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
9800 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
9801 | 9801 | } |
9802 | 9802 | |
9803 | 9803 | return false; |
@@ -9842,10 +9842,10 @@ discard block |
||
9842 | 9842 | } |
9843 | 9843 | |
9844 | 9844 | // iconv and mbstring do not support integer $needle |
9845 | - if ((int) $needle === $needle) { |
|
9846 | - $needle = (string) self::chr($needle); |
|
9845 | + if ((int)$needle === $needle) { |
|
9846 | + $needle = (string)self::chr($needle); |
|
9847 | 9847 | } |
9848 | - $needle = (string) $needle; |
|
9848 | + $needle = (string)$needle; |
|
9849 | 9849 | |
9850 | 9850 | if ($haystack === '') { |
9851 | 9851 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -9905,7 +9905,7 @@ discard block |
||
9905 | 9905 | /** |
9906 | 9906 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
9907 | 9907 | */ |
9908 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9908 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9909 | 9909 | } |
9910 | 9910 | |
9911 | 9911 | // |
@@ -9946,7 +9946,7 @@ discard block |
||
9946 | 9946 | // fallback for ascii only |
9947 | 9947 | // |
9948 | 9948 | |
9949 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9949 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9950 | 9950 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Offset not contained in string */ |
9951 | 9951 | return @\strpos($haystack, $needle, $offset); |
9952 | 9952 | } |
@@ -9959,7 +9959,7 @@ discard block |
||
9959 | 9959 | if ($haystack_tmp === false) { |
9960 | 9960 | $haystack_tmp = ''; |
9961 | 9961 | } |
9962 | - $haystack = (string) $haystack_tmp; |
|
9962 | + $haystack = (string)$haystack_tmp; |
|
9963 | 9963 | |
9964 | 9964 | if ($offset < 0) { |
9965 | 9965 | $offset = 0; |
@@ -9971,7 +9971,7 @@ discard block |
||
9971 | 9971 | } |
9972 | 9972 | |
9973 | 9973 | if ($pos) { |
9974 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9974 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9975 | 9975 | } |
9976 | 9976 | |
9977 | 9977 | return $offset + 0; |
@@ -10126,7 +10126,7 @@ discard block |
||
10126 | 10126 | /** |
10127 | 10127 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10128 | 10128 | */ |
10129 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10129 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10130 | 10130 | } |
10131 | 10131 | |
10132 | 10132 | // |
@@ -10201,7 +10201,7 @@ discard block |
||
10201 | 10201 | if ($encoding === 'UTF-8') { |
10202 | 10202 | if (self::$SUPPORT['intl'] === true) { |
10203 | 10203 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
10204 | - $i = (int) \grapheme_strlen($str); |
|
10204 | + $i = (int)\grapheme_strlen($str); |
|
10205 | 10205 | while ($i--) { |
10206 | 10206 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
10207 | 10207 | if ($reversed_tmp !== false) { |
@@ -10209,7 +10209,7 @@ discard block |
||
10209 | 10209 | } |
10210 | 10210 | } |
10211 | 10211 | } else { |
10212 | - $i = (int) \mb_strlen($str); |
|
10212 | + $i = (int)\mb_strlen($str); |
|
10213 | 10213 | while ($i--) { |
10214 | 10214 | $reversed_tmp = \mb_substr($str, $i, 1); |
10215 | 10215 | if ($reversed_tmp !== false) { |
@@ -10220,7 +10220,7 @@ discard block |
||
10220 | 10220 | } else { |
10221 | 10221 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10222 | 10222 | |
10223 | - $i = (int) self::strlen($str, $encoding); |
|
10223 | + $i = (int)self::strlen($str, $encoding); |
|
10224 | 10224 | while ($i--) { |
10225 | 10225 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
10226 | 10226 | if ($reversed_tmp !== false) { |
@@ -10348,10 +10348,10 @@ discard block |
||
10348 | 10348 | } |
10349 | 10349 | |
10350 | 10350 | // iconv and mbstring do not support integer $needle |
10351 | - if ((int) $needle === $needle && $needle >= 0) { |
|
10352 | - $needle = (string) self::chr($needle); |
|
10351 | + if ((int)$needle === $needle && $needle >= 0) { |
|
10352 | + $needle = (string)self::chr($needle); |
|
10353 | 10353 | } |
10354 | - $needle = (string) $needle; |
|
10354 | + $needle = (string)$needle; |
|
10355 | 10355 | |
10356 | 10356 | if ($haystack === '') { |
10357 | 10357 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -10407,7 +10407,7 @@ discard block |
||
10407 | 10407 | /** |
10408 | 10408 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10409 | 10409 | */ |
10410 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10410 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10411 | 10411 | } |
10412 | 10412 | |
10413 | 10413 | // |
@@ -10431,7 +10431,7 @@ discard block |
||
10431 | 10431 | // fallback for ascii only |
10432 | 10432 | // |
10433 | 10433 | |
10434 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10434 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10435 | 10435 | return \strripos($haystack, $needle, $offset); |
10436 | 10436 | } |
10437 | 10437 | |
@@ -10520,10 +10520,10 @@ discard block |
||
10520 | 10520 | } |
10521 | 10521 | |
10522 | 10522 | // iconv and mbstring do not support integer $needle |
10523 | - if ((int) $needle === $needle && $needle >= 0) { |
|
10524 | - $needle = (string) self::chr($needle); |
|
10523 | + if ((int)$needle === $needle && $needle >= 0) { |
|
10524 | + $needle = (string)self::chr($needle); |
|
10525 | 10525 | } |
10526 | - $needle = (string) $needle; |
|
10526 | + $needle = (string)$needle; |
|
10527 | 10527 | |
10528 | 10528 | if ($haystack === '') { |
10529 | 10529 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -10579,7 +10579,7 @@ discard block |
||
10579 | 10579 | /** |
10580 | 10580 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10581 | 10581 | */ |
10582 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10582 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10583 | 10583 | } |
10584 | 10584 | |
10585 | 10585 | // |
@@ -10603,7 +10603,7 @@ discard block |
||
10603 | 10603 | // fallback for ascii only |
10604 | 10604 | // |
10605 | 10605 | |
10606 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10606 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10607 | 10607 | return \strrpos($haystack, $needle, $offset); |
10608 | 10608 | } |
10609 | 10609 | |
@@ -10623,7 +10623,7 @@ discard block |
||
10623 | 10623 | if ($haystack_tmp === false) { |
10624 | 10624 | $haystack_tmp = ''; |
10625 | 10625 | } |
10626 | - $haystack = (string) $haystack_tmp; |
|
10626 | + $haystack = (string)$haystack_tmp; |
|
10627 | 10627 | } |
10628 | 10628 | |
10629 | 10629 | $pos = \strrpos($haystack, $needle); |
@@ -10637,7 +10637,7 @@ discard block |
||
10637 | 10637 | return false; |
10638 | 10638 | } |
10639 | 10639 | |
10640 | - return $offset + (int) self::strlen($str_tmp); |
|
10640 | + return $offset + (int)self::strlen($str_tmp); |
|
10641 | 10641 | } |
10642 | 10642 | |
10643 | 10643 | /** |
@@ -10705,12 +10705,12 @@ discard block |
||
10705 | 10705 | if ($offset || $length !== null) { |
10706 | 10706 | if ($encoding === 'UTF-8') { |
10707 | 10707 | if ($length === null) { |
10708 | - $str = (string) \mb_substr($str, $offset); |
|
10708 | + $str = (string)\mb_substr($str, $offset); |
|
10709 | 10709 | } else { |
10710 | - $str = (string) \mb_substr($str, $offset, $length); |
|
10710 | + $str = (string)\mb_substr($str, $offset, $length); |
|
10711 | 10711 | } |
10712 | 10712 | } else { |
10713 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
10713 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
10714 | 10714 | } |
10715 | 10715 | } |
10716 | 10716 | |
@@ -10720,7 +10720,7 @@ discard block |
||
10720 | 10720 | |
10721 | 10721 | $matches = []; |
10722 | 10722 | |
10723 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
10723 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
10724 | 10724 | } |
10725 | 10725 | |
10726 | 10726 | /** |
@@ -10814,7 +10814,7 @@ discard block |
||
10814 | 10814 | /** |
10815 | 10815 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10816 | 10816 | */ |
10817 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10817 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10818 | 10818 | } |
10819 | 10819 | |
10820 | 10820 | // |
@@ -10836,7 +10836,7 @@ discard block |
||
10836 | 10836 | // fallback for ascii only |
10837 | 10837 | // |
10838 | 10838 | |
10839 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10839 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10840 | 10840 | return \strstr($haystack, $needle, $before_needle); |
10841 | 10841 | } |
10842 | 10842 | |
@@ -10844,7 +10844,7 @@ discard block |
||
10844 | 10844 | // fallback via vanilla php |
10845 | 10845 | // |
10846 | 10846 | |
10847 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
10847 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
10848 | 10848 | |
10849 | 10849 | if (!isset($match[1])) { |
10850 | 10850 | return false; |
@@ -10854,7 +10854,7 @@ discard block |
||
10854 | 10854 | return $match[1]; |
10855 | 10855 | } |
10856 | 10856 | |
10857 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
10857 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
10858 | 10858 | } |
10859 | 10859 | |
10860 | 10860 | /** |
@@ -10984,7 +10984,7 @@ discard block |
||
10984 | 10984 | bool $try_to_keep_the_string_length = false |
10985 | 10985 | ): string { |
10986 | 10986 | // init |
10987 | - $str = (string) $str; |
|
10987 | + $str = (string)$str; |
|
10988 | 10988 | |
10989 | 10989 | if ($str === '') { |
10990 | 10990 | return ''; |
@@ -11013,23 +11013,23 @@ discard block |
||
11013 | 11013 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
11014 | 11014 | } |
11015 | 11015 | |
11016 | - $language_code = $lang . '-Lower'; |
|
11016 | + $language_code = $lang.'-Lower'; |
|
11017 | 11017 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
11018 | 11018 | /** |
11019 | 11019 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11020 | 11020 | */ |
11021 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
11021 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
11022 | 11022 | |
11023 | 11023 | $language_code = 'Any-Lower'; |
11024 | 11024 | } |
11025 | 11025 | |
11026 | - return (string) \transliterator_transliterate($language_code, $str); |
|
11026 | + return (string)\transliterator_transliterate($language_code, $str); |
|
11027 | 11027 | } |
11028 | 11028 | |
11029 | 11029 | /** |
11030 | 11030 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11031 | 11031 | */ |
11032 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
11032 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
11033 | 11033 | } |
11034 | 11034 | |
11035 | 11035 | // always fallback via symfony polyfill |
@@ -11064,7 +11064,7 @@ discard block |
||
11064 | 11064 | bool $try_to_keep_the_string_length = false |
11065 | 11065 | ): string { |
11066 | 11066 | // init |
11067 | - $str = (string) $str; |
|
11067 | + $str = (string)$str; |
|
11068 | 11068 | |
11069 | 11069 | if ($str === '') { |
11070 | 11070 | return ''; |
@@ -11093,23 +11093,23 @@ discard block |
||
11093 | 11093 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
11094 | 11094 | } |
11095 | 11095 | |
11096 | - $language_code = $lang . '-Upper'; |
|
11096 | + $language_code = $lang.'-Upper'; |
|
11097 | 11097 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
11098 | 11098 | /** |
11099 | 11099 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11100 | 11100 | */ |
11101 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
11101 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
11102 | 11102 | |
11103 | 11103 | $language_code = 'Any-Upper'; |
11104 | 11104 | } |
11105 | 11105 | |
11106 | - return (string) \transliterator_transliterate($language_code, $str); |
|
11106 | + return (string)\transliterator_transliterate($language_code, $str); |
|
11107 | 11107 | } |
11108 | 11108 | |
11109 | 11109 | /** |
11110 | 11110 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11111 | 11111 | */ |
11112 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
11112 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
11113 | 11113 | } |
11114 | 11114 | |
11115 | 11115 | // always fallback via symfony polyfill |
@@ -11172,7 +11172,7 @@ discard block |
||
11172 | 11172 | |
11173 | 11173 | $from = \array_combine($from, $to); |
11174 | 11174 | if ($from === false) { |
11175 | - 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) . ')'); |
|
11175 | + 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).')'); |
|
11176 | 11176 | } |
11177 | 11177 | } |
11178 | 11178 | |
@@ -11238,9 +11238,9 @@ discard block |
||
11238 | 11238 | } |
11239 | 11239 | |
11240 | 11240 | $wide = 0; |
11241 | - $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); |
|
11241 | + $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); |
|
11242 | 11242 | |
11243 | - return ($wide << 1) + (int) self::strlen($str); |
|
11243 | + return ($wide << 1) + (int)self::strlen($str); |
|
11244 | 11244 | } |
11245 | 11245 | |
11246 | 11246 | /** |
@@ -11349,7 +11349,7 @@ discard block |
||
11349 | 11349 | /** |
11350 | 11350 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11351 | 11351 | */ |
11352 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11352 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11353 | 11353 | } |
11354 | 11354 | |
11355 | 11355 | // |
@@ -11444,16 +11444,16 @@ discard block |
||
11444 | 11444 | ) { |
11445 | 11445 | if ($encoding === 'UTF-8') { |
11446 | 11446 | if ($length === null) { |
11447 | - $str1 = (string) \mb_substr($str1, $offset); |
|
11447 | + $str1 = (string)\mb_substr($str1, $offset); |
|
11448 | 11448 | } else { |
11449 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
11449 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
11450 | 11450 | } |
11451 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
11451 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
11452 | 11452 | } else { |
11453 | 11453 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11454 | 11454 | |
11455 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
11456 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
11455 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
11456 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
11457 | 11457 | } |
11458 | 11458 | } |
11459 | 11459 | |
@@ -11532,9 +11532,9 @@ discard block |
||
11532 | 11532 | } |
11533 | 11533 | |
11534 | 11534 | if ($encoding === 'UTF-8') { |
11535 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
11535 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
11536 | 11536 | } else { |
11537 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
11537 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
11538 | 11538 | } |
11539 | 11539 | } |
11540 | 11540 | |
@@ -11546,7 +11546,7 @@ discard block |
||
11546 | 11546 | /** |
11547 | 11547 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11548 | 11548 | */ |
11549 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11549 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11550 | 11550 | } |
11551 | 11551 | |
11552 | 11552 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -11557,7 +11557,7 @@ discard block |
||
11557 | 11557 | return \mb_substr_count($haystack, $needle, $encoding); |
11558 | 11558 | } |
11559 | 11559 | |
11560 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
11560 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
11561 | 11561 | |
11562 | 11562 | return \count($matches); |
11563 | 11563 | } |
@@ -11629,7 +11629,7 @@ discard block |
||
11629 | 11629 | if ($haystack_tmp === false) { |
11630 | 11630 | $haystack_tmp = ''; |
11631 | 11631 | } |
11632 | - $haystack = (string) $haystack_tmp; |
|
11632 | + $haystack = (string)$haystack_tmp; |
|
11633 | 11633 | } |
11634 | 11634 | |
11635 | 11635 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -11670,10 +11670,10 @@ discard block |
||
11670 | 11670 | |
11671 | 11671 | if ($encoding === 'UTF-8') { |
11672 | 11672 | if ($case_sensitive) { |
11673 | - return (int) \mb_substr_count($str, $substring); |
|
11673 | + return (int)\mb_substr_count($str, $substring); |
|
11674 | 11674 | } |
11675 | 11675 | |
11676 | - return (int) \mb_substr_count( |
|
11676 | + return (int)\mb_substr_count( |
|
11677 | 11677 | \mb_strtoupper($str), |
11678 | 11678 | \mb_strtoupper($substring) |
11679 | 11679 | ); |
@@ -11682,10 +11682,10 @@ discard block |
||
11682 | 11682 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11683 | 11683 | |
11684 | 11684 | if ($case_sensitive) { |
11685 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
11685 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
11686 | 11686 | } |
11687 | 11687 | |
11688 | - return (int) \mb_substr_count( |
|
11688 | + return (int)\mb_substr_count( |
|
11689 | 11689 | self::strtocasefold($str, true, false, $encoding, null, false), |
11690 | 11690 | self::strtocasefold($substring, true, false, $encoding, null, false), |
11691 | 11691 | $encoding |
@@ -11719,7 +11719,7 @@ discard block |
||
11719 | 11719 | } |
11720 | 11720 | |
11721 | 11721 | if (self::str_istarts_with($haystack, $needle)) { |
11722 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
11722 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
11723 | 11723 | } |
11724 | 11724 | |
11725 | 11725 | return $haystack; |
@@ -11786,7 +11786,7 @@ discard block |
||
11786 | 11786 | } |
11787 | 11787 | |
11788 | 11788 | if (self::str_iends_with($haystack, $needle)) { |
11789 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
11789 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
11790 | 11790 | } |
11791 | 11791 | |
11792 | 11792 | return $haystack; |
@@ -11819,7 +11819,7 @@ discard block |
||
11819 | 11819 | } |
11820 | 11820 | |
11821 | 11821 | if (self::str_starts_with($haystack, $needle)) { |
11822 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
11822 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
11823 | 11823 | } |
11824 | 11824 | |
11825 | 11825 | return $haystack; |
@@ -11880,7 +11880,7 @@ discard block |
||
11880 | 11880 | if (\is_array($offset)) { |
11881 | 11881 | $offset = \array_slice($offset, 0, $num); |
11882 | 11882 | foreach ($offset as &$value_tmp) { |
11883 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
11883 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
11884 | 11884 | } |
11885 | 11885 | unset($value_tmp); |
11886 | 11886 | } else { |
@@ -11893,7 +11893,7 @@ discard block |
||
11893 | 11893 | } elseif (\is_array($length)) { |
11894 | 11894 | $length = \array_slice($length, 0, $num); |
11895 | 11895 | foreach ($length as &$value_tmp_V2) { |
11896 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
11896 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
11897 | 11897 | } |
11898 | 11898 | unset($value_tmp_V2); |
11899 | 11899 | } else { |
@@ -11914,8 +11914,8 @@ discard block |
||
11914 | 11914 | } |
11915 | 11915 | |
11916 | 11916 | // init |
11917 | - $str = (string) $str; |
|
11918 | - $replacement = (string) $replacement; |
|
11917 | + $str = (string)$str; |
|
11918 | + $replacement = (string)$replacement; |
|
11919 | 11919 | |
11920 | 11920 | if (\is_array($length)) { |
11921 | 11921 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -11930,16 +11930,16 @@ discard block |
||
11930 | 11930 | } |
11931 | 11931 | |
11932 | 11932 | if (self::$SUPPORT['mbstring'] === true) { |
11933 | - $string_length = (int) self::strlen($str, $encoding); |
|
11933 | + $string_length = (int)self::strlen($str, $encoding); |
|
11934 | 11934 | |
11935 | 11935 | if ($offset < 0) { |
11936 | - $offset = (int) \max(0, $string_length + $offset); |
|
11936 | + $offset = (int)\max(0, $string_length + $offset); |
|
11937 | 11937 | } elseif ($offset > $string_length) { |
11938 | 11938 | $offset = $string_length; |
11939 | 11939 | } |
11940 | 11940 | |
11941 | 11941 | if ($length !== null && $length < 0) { |
11942 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
11942 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
11943 | 11943 | } elseif ($length === null || $length > $string_length) { |
11944 | 11944 | $length = $string_length; |
11945 | 11945 | } |
@@ -11948,9 +11948,9 @@ discard block |
||
11948 | 11948 | $length = $string_length - $offset; |
11949 | 11949 | } |
11950 | 11950 | |
11951 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
11952 | - $replacement . |
|
11953 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
11951 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
11952 | + $replacement. |
|
11953 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
11954 | 11954 | } |
11955 | 11955 | |
11956 | 11956 | // |
@@ -11959,8 +11959,7 @@ discard block |
||
11959 | 11959 | |
11960 | 11960 | if (ASCII::is_ascii($str)) { |
11961 | 11961 | return ($length === null) ? |
11962 | - \substr_replace($str, $replacement, $offset) : |
|
11963 | - \substr_replace($str, $replacement, $offset, $length); |
|
11962 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
11964 | 11963 | } |
11965 | 11964 | |
11966 | 11965 | // |
@@ -12019,14 +12018,14 @@ discard block |
||
12019 | 12018 | && |
12020 | 12019 | \substr($haystack, -\strlen($needle)) === $needle |
12021 | 12020 | ) { |
12022 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
12021 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
12023 | 12022 | } |
12024 | 12023 | |
12025 | 12024 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
12026 | - return (string) self::substr( |
|
12025 | + return (string)self::substr( |
|
12027 | 12026 | $haystack, |
12028 | 12027 | 0, |
12029 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
12028 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
12030 | 12029 | $encoding |
12031 | 12030 | ); |
12032 | 12031 | } |
@@ -12061,10 +12060,10 @@ discard block |
||
12061 | 12060 | } |
12062 | 12061 | |
12063 | 12062 | if ($encoding === 'UTF-8') { |
12064 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
12063 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
12065 | 12064 | } |
12066 | 12065 | |
12067 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
12066 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
12068 | 12067 | } |
12069 | 12068 | |
12070 | 12069 | /** |
@@ -12203,7 +12202,7 @@ discard block |
||
12203 | 12202 | public static function to_boolean($str): bool |
12204 | 12203 | { |
12205 | 12204 | // init |
12206 | - $str = (string) $str; |
|
12205 | + $str = (string)$str; |
|
12207 | 12206 | |
12208 | 12207 | if ($str === '') { |
12209 | 12208 | return false; |
@@ -12231,10 +12230,10 @@ discard block |
||
12231 | 12230 | } |
12232 | 12231 | |
12233 | 12232 | if (\is_numeric($str)) { |
12234 | - return ((float) $str) > 0; |
|
12233 | + return ((float)$str) > 0; |
|
12235 | 12234 | } |
12236 | 12235 | |
12237 | - return (bool) \trim($str); |
|
12236 | + return (bool)\trim($str); |
|
12238 | 12237 | } |
12239 | 12238 | |
12240 | 12239 | /** |
@@ -12286,7 +12285,7 @@ discard block |
||
12286 | 12285 | return $str; |
12287 | 12286 | } |
12288 | 12287 | |
12289 | - $str = (string) $str; |
|
12288 | + $str = (string)$str; |
|
12290 | 12289 | if ($str === '') { |
12291 | 12290 | return ''; |
12292 | 12291 | } |
@@ -12374,7 +12373,7 @@ discard block |
||
12374 | 12373 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
12375 | 12374 | |
12376 | 12375 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
12377 | - $buf .= $c1 . $c2; |
|
12376 | + $buf .= $c1.$c2; |
|
12378 | 12377 | ++$i; |
12379 | 12378 | } else { // not valid UTF8 - convert it |
12380 | 12379 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12385,7 +12384,7 @@ discard block |
||
12385 | 12384 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
12386 | 12385 | |
12387 | 12386 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
12388 | - $buf .= $c1 . $c2 . $c3; |
|
12387 | + $buf .= $c1.$c2.$c3; |
|
12389 | 12388 | $i += 2; |
12390 | 12389 | } else { // not valid UTF8 - convert it |
12391 | 12390 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12397,7 +12396,7 @@ discard block |
||
12397 | 12396 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
12398 | 12397 | |
12399 | 12398 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
12400 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
12399 | + $buf .= $c1.$c2.$c3.$c4; |
|
12401 | 12400 | $i += 3; |
12402 | 12401 | } else { // not valid UTF8 - convert it |
12403 | 12402 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12425,13 +12424,13 @@ discard block |
||
12425 | 12424 | * |
12426 | 12425 | * @return string |
12427 | 12426 | */ |
12428 | - static function (array $matches): string { |
|
12427 | + static function(array $matches): string { |
|
12429 | 12428 | if (isset($matches[3])) { |
12430 | - $cp = (int) \hexdec($matches[3]); |
|
12429 | + $cp = (int)\hexdec($matches[3]); |
|
12431 | 12430 | } else { |
12432 | 12431 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
12433 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
12434 | - + (int) \hexdec($matches[2]) |
|
12432 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
12433 | + + (int)\hexdec($matches[2]) |
|
12435 | 12434 | + 0x10000 |
12436 | 12435 | - (0xD800 << 10) |
12437 | 12436 | - 0xDC00; |
@@ -12442,12 +12441,12 @@ discard block |
||
12442 | 12441 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
12443 | 12442 | |
12444 | 12443 | if ($cp < 0x80) { |
12445 | - return (string) self::chr($cp); |
|
12444 | + return (string)self::chr($cp); |
|
12446 | 12445 | } |
12447 | 12446 | |
12448 | 12447 | if ($cp < 0xA0) { |
12449 | 12448 | /** @noinspection UnnecessaryCastingInspection */ |
12450 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
12449 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
12451 | 12450 | } |
12452 | 12451 | |
12453 | 12452 | return self::decimal_to_chr($cp); |
@@ -12480,7 +12479,7 @@ discard block |
||
12480 | 12479 | public static function to_int(string $str) |
12481 | 12480 | { |
12482 | 12481 | if (\is_numeric($str)) { |
12483 | - return (int) $str; |
|
12482 | + return (int)$str; |
|
12484 | 12483 | } |
12485 | 12484 | |
12486 | 12485 | return null; |
@@ -12515,12 +12514,12 @@ discard block |
||
12515 | 12514 | || |
12516 | 12515 | $input_type === 'double' |
12517 | 12516 | ) { |
12518 | - return (string) $input; |
|
12517 | + return (string)$input; |
|
12519 | 12518 | } |
12520 | 12519 | |
12521 | 12520 | /** @phpstan-ignore-next-line - "gettype": FP? */ |
12522 | 12521 | if ($input_type === 'object' && \method_exists($input, '__toString')) { |
12523 | - return (string) $input; |
|
12522 | + return (string)$input; |
|
12524 | 12523 | } |
12525 | 12524 | |
12526 | 12525 | return null; |
@@ -12559,7 +12558,7 @@ discard block |
||
12559 | 12558 | $pattern = '^[\\s]+|[\\s]+$'; |
12560 | 12559 | } |
12561 | 12560 | |
12562 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
12561 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
12563 | 12562 | } |
12564 | 12563 | |
12565 | 12564 | if ($chars !== null) { |
@@ -12610,15 +12609,15 @@ discard block |
||
12610 | 12609 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
12611 | 12610 | |
12612 | 12611 | if ($encoding === 'UTF-8') { |
12613 | - $str_part_two = (string) \mb_substr($str, 1); |
|
12612 | + $str_part_two = (string)\mb_substr($str, 1); |
|
12614 | 12613 | |
12615 | 12614 | if ($use_mb_functions) { |
12616 | 12615 | $str_part_one = \mb_strtoupper( |
12617 | - (string) \mb_substr($str, 0, 1) |
|
12616 | + (string)\mb_substr($str, 0, 1) |
|
12618 | 12617 | ); |
12619 | 12618 | } else { |
12620 | 12619 | $str_part_one = self::strtoupper( |
12621 | - (string) \mb_substr($str, 0, 1), |
|
12620 | + (string)\mb_substr($str, 0, 1), |
|
12622 | 12621 | $encoding, |
12623 | 12622 | false, |
12624 | 12623 | $lang, |
@@ -12628,16 +12627,16 @@ discard block |
||
12628 | 12627 | } else { |
12629 | 12628 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
12630 | 12629 | |
12631 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
12630 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
12632 | 12631 | |
12633 | 12632 | if ($use_mb_functions) { |
12634 | 12633 | $str_part_one = \mb_strtoupper( |
12635 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
12634 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
12636 | 12635 | $encoding |
12637 | 12636 | ); |
12638 | 12637 | } else { |
12639 | 12638 | $str_part_one = self::strtoupper( |
12640 | - (string) self::substr($str, 0, 1, $encoding), |
|
12639 | + (string)self::substr($str, 0, 1, $encoding), |
|
12641 | 12640 | $encoding, |
12642 | 12641 | false, |
12643 | 12642 | $lang, |
@@ -12646,7 +12645,7 @@ discard block |
||
12646 | 12645 | } |
12647 | 12646 | } |
12648 | 12647 | |
12649 | - return $str_part_one . $str_part_two; |
|
12648 | + return $str_part_one.$str_part_two; |
|
12650 | 12649 | } |
12651 | 12650 | |
12652 | 12651 | /** |
@@ -12685,7 +12684,7 @@ discard block |
||
12685 | 12684 | $str = self::clean($str); |
12686 | 12685 | } |
12687 | 12686 | |
12688 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
12687 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
12689 | 12688 | |
12690 | 12689 | if ( |
12691 | 12690 | $use_php_default_functions |
@@ -12843,7 +12842,7 @@ discard block |
||
12843 | 12842 | if ( |
12844 | 12843 | $keep_utf8_chars |
12845 | 12844 | && |
12846 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
12845 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
12847 | 12846 | ) { |
12848 | 12847 | return $str_backup; |
12849 | 12848 | } |
@@ -12916,17 +12915,17 @@ discard block |
||
12916 | 12915 | return ''; |
12917 | 12916 | } |
12918 | 12917 | |
12919 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
12918 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
12920 | 12919 | |
12921 | 12920 | if ( |
12922 | 12921 | !isset($matches[0]) |
12923 | 12922 | || |
12924 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
12923 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
12925 | 12924 | ) { |
12926 | 12925 | return $str; |
12927 | 12926 | } |
12928 | 12927 | |
12929 | - return \rtrim($matches[0]) . $str_add_on; |
|
12928 | + return \rtrim($matches[0]).$str_add_on; |
|
12930 | 12929 | } |
12931 | 12930 | |
12932 | 12931 | /** |
@@ -13019,7 +13018,7 @@ discard block |
||
13019 | 13018 | } |
13020 | 13019 | } |
13021 | 13020 | |
13022 | - return $str_return . \implode('', $charsArray); |
|
13021 | + return $str_return.\implode('', $charsArray); |
|
13023 | 13022 | } |
13024 | 13023 | |
13025 | 13024 | /** |
@@ -13073,7 +13072,7 @@ discard block |
||
13073 | 13072 | $final_break = ''; |
13074 | 13073 | } |
13075 | 13074 | |
13076 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
13075 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
13077 | 13076 | } |
13078 | 13077 | |
13079 | 13078 | /** |
@@ -13314,7 +13313,7 @@ discard block |
||
13314 | 13313 | /** @noinspection PhpIncludeInspection */ |
13315 | 13314 | /** @noinspection UsingInclusionReturnValueInspection */ |
13316 | 13315 | /** @psalm-suppress UnresolvableInclude */ |
13317 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
13316 | + return include __DIR__.'/data/'.$file.'.php'; |
|
13318 | 13317 | } |
13319 | 13318 | |
13320 | 13319 | /** |
@@ -13336,7 +13335,7 @@ discard block |
||
13336 | 13335 | */ |
13337 | 13336 | \uksort( |
13338 | 13337 | self::$EMOJI, |
13339 | - static function (string $a, string $b): int { |
|
13338 | + static function(string $a, string $b): int { |
|
13340 | 13339 | return \strlen($b) <=> \strlen($a); |
13341 | 13340 | } |
13342 | 13341 | ); |
@@ -13346,7 +13345,7 @@ discard block |
||
13346 | 13345 | |
13347 | 13346 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
13348 | 13347 | $tmp_key = \crc32($key); |
13349 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
13348 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
13350 | 13349 | } |
13351 | 13350 | |
13352 | 13351 | return true; |
@@ -13373,7 +13372,7 @@ discard block |
||
13373 | 13372 | /** @noinspection DeprecatedIniOptionsInspection */ |
13374 | 13373 | return \defined('MB_OVERLOAD_STRING') |
13375 | 13374 | && |
13376 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
13375 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
13377 | 13376 | } |
13378 | 13377 | |
13379 | 13378 | /** |
@@ -13437,7 +13436,7 @@ discard block |
||
13437 | 13436 | */ |
13438 | 13437 | static $RX_CLASS_CACHE = []; |
13439 | 13438 | |
13440 | - $cache_key = $s . '_' . $class; |
|
13439 | + $cache_key = $s.'_'.$class; |
|
13441 | 13440 | |
13442 | 13441 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
13443 | 13442 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -13449,7 +13448,7 @@ discard block |
||
13449 | 13448 | /** @noinspection AlterInForeachInspection */ |
13450 | 13449 | foreach (self::str_split($s) as &$s) { |
13451 | 13450 | if ($s === '-') { |
13452 | - $class_array[0] = '-' . $class_array[0]; |
|
13451 | + $class_array[0] = '-'.$class_array[0]; |
|
13453 | 13452 | } elseif (!isset($s[2])) { |
13454 | 13453 | $class_array[0] .= \preg_quote($s, '/'); |
13455 | 13454 | } elseif (self::strlen($s) === 1) { |
@@ -13460,13 +13459,13 @@ discard block |
||
13460 | 13459 | } |
13461 | 13460 | |
13462 | 13461 | if ($class_array[0]) { |
13463 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
13462 | + $class_array[0] = '['.$class_array[0].']'; |
|
13464 | 13463 | } |
13465 | 13464 | |
13466 | 13465 | if (\count($class_array) === 1) { |
13467 | 13466 | $return = $class_array[0]; |
13468 | 13467 | } else { |
13469 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
13468 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
13470 | 13469 | } |
13471 | 13470 | |
13472 | 13471 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -13546,7 +13545,7 @@ discard block |
||
13546 | 13545 | $continue = false; |
13547 | 13546 | |
13548 | 13547 | if ($delimiter === '-') { |
13549 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
13548 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
13550 | 13549 | if (\strncmp($name, $beginning, \strlen($beginning)) === 0) { |
13551 | 13550 | $continue = true; |
13552 | 13551 | |
@@ -13556,7 +13555,7 @@ discard block |
||
13556 | 13555 | unset($beginning); |
13557 | 13556 | } |
13558 | 13557 | |
13559 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
13558 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
13560 | 13559 | if (\strncmp($name, $beginning, \strlen($beginning)) === 0) { |
13561 | 13560 | $continue = true; |
13562 | 13561 | |
@@ -13632,8 +13631,8 @@ discard block |
||
13632 | 13631 | } else { |
13633 | 13632 | /** @noinspection OffsetOperationsInspection */ |
13634 | 13633 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
13635 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
13636 | - $buf .= $cc1 . $cc2; |
|
13634 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
13635 | + $buf .= $cc1.$cc2; |
|
13637 | 13636 | } |
13638 | 13637 | |
13639 | 13638 | return $buf; |
@@ -13656,7 +13655,7 @@ discard block |
||
13656 | 13655 | |
13657 | 13656 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
13658 | 13657 | if (\preg_match($pattern, $str)) { |
13659 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
13658 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
13660 | 13659 | } |
13661 | 13660 | |
13662 | 13661 | return $str; |