@@ -242,10 +242,10 @@ discard block |
||
242 | 242 | } |
243 | 243 | |
244 | 244 | if ($encoding === 'UTF-8') { |
245 | - return (string) \mb_substr($str, $pos, 1); |
|
245 | + return (string)\mb_substr($str, $pos, 1); |
|
246 | 246 | } |
247 | 247 | |
248 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
248 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | public static function add_bom_to_string(string $str): string |
263 | 263 | { |
264 | 264 | if (self::string_has_bom($str) === false) { |
265 | - $str = self::bom() . $str; |
|
265 | + $str = self::bom().$str; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | return $str; |
@@ -297,8 +297,8 @@ discard block |
||
297 | 297 | $return = []; |
298 | 298 | foreach ($array as $key => &$value) { |
299 | 299 | $key = $case === \CASE_LOWER |
300 | - ? self::strtolower((string) $key, $encoding) |
|
301 | - : self::strtoupper((string) $key, $encoding); |
|
300 | + ? self::strtolower((string)$key, $encoding) |
|
301 | + : self::strtoupper((string)$key, $encoding); |
|
302 | 302 | |
303 | 303 | $return[$key] = $value; |
304 | 304 | } |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | return ''; |
335 | 335 | } |
336 | 336 | |
337 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
337 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
338 | 338 | $end_position = \mb_strpos($str, $end, $substr_index); |
339 | 339 | if ( |
340 | 340 | $end_position === false |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | return ''; |
345 | 345 | } |
346 | 346 | |
347 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
347 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | return ''; |
355 | 355 | } |
356 | 356 | |
357 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
357 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
358 | 358 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
359 | 359 | if ( |
360 | 360 | $end_position === false |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | return ''; |
365 | 365 | } |
366 | 366 | |
367 | - return (string) self::substr( |
|
367 | + return (string)self::substr( |
|
368 | 368 | $str, |
369 | 369 | $substr_index, |
370 | 370 | $end_position - $substr_index, |
@@ -440,10 +440,10 @@ discard block |
||
440 | 440 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
441 | 441 | { |
442 | 442 | if ($encoding === 'UTF-8') { |
443 | - return (string) \mb_substr($str, $index, 1); |
|
443 | + return (string)\mb_substr($str, $index, 1); |
|
444 | 444 | } |
445 | 445 | |
446 | - return (string) self::substr($str, $index, 1, $encoding); |
|
446 | + return (string)self::substr($str, $index, 1, $encoding); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
@@ -554,10 +554,10 @@ discard block |
||
554 | 554 | /** |
555 | 555 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
556 | 556 | */ |
557 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
557 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
558 | 558 | } |
559 | 559 | |
560 | - $cache_key = $code_point . '_' . $encoding; |
|
560 | + $cache_key = $code_point.'_'.$encoding; |
|
561 | 561 | if (isset($CHAR_CACHE[$cache_key]) === true) { |
562 | 562 | return $CHAR_CACHE[$cache_key]; |
563 | 563 | } |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | self::$CHR = self::getData('chr'); |
604 | 604 | } |
605 | 605 | |
606 | - $code_point = (int) $code_point; |
|
606 | + $code_point = (int)$code_point; |
|
607 | 607 | if ($code_point <= 0x7F) { |
608 | 608 | /** |
609 | 609 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -613,22 +613,22 @@ discard block |
||
613 | 613 | /** |
614 | 614 | * @psalm-suppress PossiblyNullArrayAccess |
615 | 615 | */ |
616 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
616 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
617 | 617 | self::$CHR[($code_point & 0x3F) + 0x80]; |
618 | 618 | } elseif ($code_point <= 0xFFFF) { |
619 | 619 | /** |
620 | 620 | * @psalm-suppress PossiblyNullArrayAccess |
621 | 621 | */ |
622 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
623 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
622 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
623 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
624 | 624 | self::$CHR[($code_point & 0x3F) + 0x80]; |
625 | 625 | } else { |
626 | 626 | /** |
627 | 627 | * @psalm-suppress PossiblyNullArrayAccess |
628 | 628 | */ |
629 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
630 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
631 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
629 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
630 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
631 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
632 | 632 | self::$CHR[($code_point & 0x3F) + 0x80]; |
633 | 633 | } |
634 | 634 | |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | |
681 | 681 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
682 | 682 | return \array_map( |
683 | - static function (string $data): int { |
|
683 | + static function(string $data): int { |
|
684 | 684 | // "mb_" is available if overload is used, so use it ... |
685 | 685 | return \mb_strlen($data, 'CP850'); // 8-BIT |
686 | 686 | }, |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | $char = ''; |
761 | 761 | } |
762 | 762 | |
763 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
763 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
764 | 764 | } |
765 | 765 | |
766 | 766 | /** |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
850 | 850 | /x'; |
851 | 851 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
852 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
852 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
853 | 853 | |
854 | 854 | if ($replace_diamond_question_mark === true) { |
855 | 855 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | public static function cleanup($str): string |
887 | 887 | { |
888 | 888 | // init |
889 | - $str = (string) $str; |
|
889 | + $str = (string)$str; |
|
890 | 890 | |
891 | 891 | if ($str === '') { |
892 | 892 | return ''; |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | { |
981 | 981 | if (self::$SUPPORT['mbstring'] === true) { |
982 | 982 | /** @noinspection PhpComposerExtensionStubsInspection */ |
983 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
983 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
984 | 984 | } |
985 | 985 | |
986 | 986 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -1024,7 +1024,7 @@ discard block |
||
1024 | 1024 | */ |
1025 | 1025 | public static function css_stripe_media_queries(string $str): string |
1026 | 1026 | { |
1027 | - return (string) \preg_replace( |
|
1027 | + return (string)\preg_replace( |
|
1028 | 1028 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
1029 | 1029 | '', |
1030 | 1030 | $str |
@@ -1055,7 +1055,7 @@ discard block |
||
1055 | 1055 | */ |
1056 | 1056 | public static function decimal_to_chr($int): string |
1057 | 1057 | { |
1058 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
1058 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
1059 | 1059 | } |
1060 | 1060 | |
1061 | 1061 | /** |
@@ -1106,16 +1106,16 @@ discard block |
||
1106 | 1106 | self::initEmojiData(); |
1107 | 1107 | |
1108 | 1108 | if ($use_reversible_string_mappings === true) { |
1109 | - return (string) \str_replace( |
|
1110 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1111 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1109 | + return (string)\str_replace( |
|
1110 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1111 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1112 | 1112 | $str |
1113 | 1113 | ); |
1114 | 1114 | } |
1115 | 1115 | |
1116 | - return (string) \str_replace( |
|
1117 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1118 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1116 | + return (string)\str_replace( |
|
1117 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1118 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1119 | 1119 | $str |
1120 | 1120 | ); |
1121 | 1121 | } |
@@ -1139,16 +1139,16 @@ discard block |
||
1139 | 1139 | self::initEmojiData(); |
1140 | 1140 | |
1141 | 1141 | if ($use_reversible_string_mappings === true) { |
1142 | - return (string) \str_replace( |
|
1143 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1144 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1142 | + return (string)\str_replace( |
|
1143 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1144 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1145 | 1145 | $str |
1146 | 1146 | ); |
1147 | 1147 | } |
1148 | 1148 | |
1149 | - return (string) \str_replace( |
|
1150 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1151 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1149 | + return (string)\str_replace( |
|
1150 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1151 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1152 | 1152 | $str |
1153 | 1153 | ); |
1154 | 1154 | } |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | if ($to_encoding === 'JSON') { |
1205 | 1205 | $return = self::json_encode($str); |
1206 | 1206 | if ($return === false) { |
1207 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1207 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1208 | 1208 | } |
1209 | 1209 | |
1210 | 1210 | return $return; |
@@ -1294,7 +1294,7 @@ discard block |
||
1294 | 1294 | /** |
1295 | 1295 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
1296 | 1296 | */ |
1297 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
1297 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
1298 | 1298 | } |
1299 | 1299 | |
1300 | 1300 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1392,31 +1392,31 @@ discard block |
||
1392 | 1392 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1393 | 1393 | |
1394 | 1394 | if ($length === null) { |
1395 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
1395 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
1396 | 1396 | } |
1397 | 1397 | |
1398 | 1398 | if ($search === '') { |
1399 | 1399 | if ($encoding === 'UTF-8') { |
1400 | 1400 | if ($length > 0) { |
1401 | - $string_length = (int) \mb_strlen($str); |
|
1401 | + $string_length = (int)\mb_strlen($str); |
|
1402 | 1402 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1403 | 1403 | } else { |
1404 | 1404 | $end = 0; |
1405 | 1405 | } |
1406 | 1406 | |
1407 | - $pos = (int) \min( |
|
1407 | + $pos = (int)\min( |
|
1408 | 1408 | \mb_strpos($str, ' ', $end), |
1409 | 1409 | \mb_strpos($str, '.', $end) |
1410 | 1410 | ); |
1411 | 1411 | } else { |
1412 | 1412 | if ($length > 0) { |
1413 | - $string_length = (int) self::strlen($str, $encoding); |
|
1413 | + $string_length = (int)self::strlen($str, $encoding); |
|
1414 | 1414 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1415 | 1415 | } else { |
1416 | 1416 | $end = 0; |
1417 | 1417 | } |
1418 | 1418 | |
1419 | - $pos = (int) \min( |
|
1419 | + $pos = (int)\min( |
|
1420 | 1420 | self::strpos($str, ' ', $end, $encoding), |
1421 | 1421 | self::strpos($str, '.', $end, $encoding) |
1422 | 1422 | ); |
@@ -1433,18 +1433,18 @@ discard block |
||
1433 | 1433 | return ''; |
1434 | 1434 | } |
1435 | 1435 | |
1436 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1436 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1437 | 1437 | } |
1438 | 1438 | |
1439 | 1439 | return $str; |
1440 | 1440 | } |
1441 | 1441 | |
1442 | 1442 | if ($encoding === 'UTF-8') { |
1443 | - $word_position = (int) \mb_stripos($str, $search); |
|
1444 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1443 | + $word_position = (int)\mb_stripos($str, $search); |
|
1444 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1445 | 1445 | } else { |
1446 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
1447 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1446 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
1447 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1448 | 1448 | } |
1449 | 1449 | |
1450 | 1450 | $pos_start = 0; |
@@ -1456,12 +1456,12 @@ discard block |
||
1456 | 1456 | } |
1457 | 1457 | if ($half_text !== false) { |
1458 | 1458 | if ($encoding === 'UTF-8') { |
1459 | - $pos_start = (int) \max( |
|
1459 | + $pos_start = (int)\max( |
|
1460 | 1460 | \mb_strrpos($half_text, ' '), |
1461 | 1461 | \mb_strrpos($half_text, '.') |
1462 | 1462 | ); |
1463 | 1463 | } else { |
1464 | - $pos_start = (int) \max( |
|
1464 | + $pos_start = (int)\max( |
|
1465 | 1465 | self::strrpos($half_text, ' ', 0, $encoding), |
1466 | 1466 | self::strrpos($half_text, '.', 0, $encoding) |
1467 | 1467 | ); |
@@ -1471,19 +1471,19 @@ discard block |
||
1471 | 1471 | |
1472 | 1472 | if ($word_position && $half_side > 0) { |
1473 | 1473 | $offset = $pos_start + $length - 1; |
1474 | - $real_length = (int) self::strlen($str, $encoding); |
|
1474 | + $real_length = (int)self::strlen($str, $encoding); |
|
1475 | 1475 | |
1476 | 1476 | if ($offset > $real_length) { |
1477 | 1477 | $offset = $real_length; |
1478 | 1478 | } |
1479 | 1479 | |
1480 | 1480 | if ($encoding === 'UTF-8') { |
1481 | - $pos_end = (int) \min( |
|
1481 | + $pos_end = (int)\min( |
|
1482 | 1482 | \mb_strpos($str, ' ', $offset), |
1483 | 1483 | \mb_strpos($str, '.', $offset) |
1484 | 1484 | ) - $pos_start; |
1485 | 1485 | } else { |
1486 | - $pos_end = (int) \min( |
|
1486 | + $pos_end = (int)\min( |
|
1487 | 1487 | self::strpos($str, ' ', $offset, $encoding), |
1488 | 1488 | self::strpos($str, '.', $offset, $encoding) |
1489 | 1489 | ) - $pos_start; |
@@ -1491,12 +1491,12 @@ discard block |
||
1491 | 1491 | |
1492 | 1492 | if (!$pos_end || $pos_end <= 0) { |
1493 | 1493 | if ($encoding === 'UTF-8') { |
1494 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1494 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1495 | 1495 | } else { |
1496 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1496 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1497 | 1497 | } |
1498 | 1498 | if ($str_sub !== false) { |
1499 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
1499 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
1500 | 1500 | } else { |
1501 | 1501 | $extract = ''; |
1502 | 1502 | } |
@@ -1507,26 +1507,26 @@ discard block |
||
1507 | 1507 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
1508 | 1508 | } |
1509 | 1509 | if ($str_sub !== false) { |
1510 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1510 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1511 | 1511 | } else { |
1512 | 1512 | $extract = ''; |
1513 | 1513 | } |
1514 | 1514 | } |
1515 | 1515 | } else { |
1516 | 1516 | $offset = $length - 1; |
1517 | - $true_length = (int) self::strlen($str, $encoding); |
|
1517 | + $true_length = (int)self::strlen($str, $encoding); |
|
1518 | 1518 | |
1519 | 1519 | if ($offset > $true_length) { |
1520 | 1520 | $offset = $true_length; |
1521 | 1521 | } |
1522 | 1522 | |
1523 | 1523 | if ($encoding === 'UTF-8') { |
1524 | - $pos_end = (int) \min( |
|
1524 | + $pos_end = (int)\min( |
|
1525 | 1525 | \mb_strpos($str, ' ', $offset), |
1526 | 1526 | \mb_strpos($str, '.', $offset) |
1527 | 1527 | ); |
1528 | 1528 | } else { |
1529 | - $pos_end = (int) \min( |
|
1529 | + $pos_end = (int)\min( |
|
1530 | 1530 | self::strpos($str, ' ', $offset, $encoding), |
1531 | 1531 | self::strpos($str, '.', $offset, $encoding) |
1532 | 1532 | ); |
@@ -1539,7 +1539,7 @@ discard block |
||
1539 | 1539 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
1540 | 1540 | } |
1541 | 1541 | if ($str_sub !== false) { |
1542 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1542 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1543 | 1543 | } else { |
1544 | 1544 | $extract = ''; |
1545 | 1545 | } |
@@ -1666,7 +1666,7 @@ discard block |
||
1666 | 1666 | { |
1667 | 1667 | $file_content = \file_get_contents($file_path); |
1668 | 1668 | if ($file_content === false) { |
1669 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1669 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1670 | 1670 | } |
1671 | 1671 | |
1672 | 1672 | return self::string_has_bom($file_content); |
@@ -1734,7 +1734,7 @@ discard block |
||
1734 | 1734 | ) { |
1735 | 1735 | // Prevent leading combining chars |
1736 | 1736 | // for NFC-safe concatenations. |
1737 | - $var = $leading_combining . $var; |
|
1737 | + $var = $leading_combining.$var; |
|
1738 | 1738 | } |
1739 | 1739 | } |
1740 | 1740 | |
@@ -2009,10 +2009,10 @@ discard block |
||
2009 | 2009 | } |
2010 | 2010 | |
2011 | 2011 | if ($encoding === 'UTF-8') { |
2012 | - return (string) \mb_substr($str, 0, $n); |
|
2012 | + return (string)\mb_substr($str, 0, $n); |
|
2013 | 2013 | } |
2014 | 2014 | |
2015 | - return (string) self::substr($str, 0, $n, $encoding); |
|
2015 | + return (string)self::substr($str, 0, $n, $encoding); |
|
2016 | 2016 | } |
2017 | 2017 | |
2018 | 2018 | /** |
@@ -2027,7 +2027,7 @@ discard block |
||
2027 | 2027 | */ |
2028 | 2028 | public static function fits_inside(string $str, int $box_size): bool |
2029 | 2029 | { |
2030 | - return (int) self::strlen($str) <= $box_size; |
|
2030 | + return (int)self::strlen($str) <= $box_size; |
|
2031 | 2031 | } |
2032 | 2032 | |
2033 | 2033 | /** |
@@ -2106,7 +2106,7 @@ discard block |
||
2106 | 2106 | return $str; |
2107 | 2107 | } |
2108 | 2108 | |
2109 | - $str = (string) $str; |
|
2109 | + $str = (string)$str; |
|
2110 | 2110 | $last = ''; |
2111 | 2111 | while ($last !== $str) { |
2112 | 2112 | $last = $str; |
@@ -2312,7 +2312,7 @@ discard block |
||
2312 | 2312 | return $fallback; |
2313 | 2313 | } |
2314 | 2314 | /** @noinspection OffsetOperationsInspection */ |
2315 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2315 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2316 | 2316 | |
2317 | 2317 | // DEBUG |
2318 | 2318 | //var_dump($type_code); |
@@ -2370,7 +2370,7 @@ discard block |
||
2370 | 2370 | // |
2371 | 2371 | |
2372 | 2372 | if ($encoding === 'UTF-8') { |
2373 | - $max_length = (int) \mb_strlen($possible_chars); |
|
2373 | + $max_length = (int)\mb_strlen($possible_chars); |
|
2374 | 2374 | if ($max_length === 0) { |
2375 | 2375 | return ''; |
2376 | 2376 | } |
@@ -2391,7 +2391,7 @@ discard block |
||
2391 | 2391 | } else { |
2392 | 2392 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2393 | 2393 | |
2394 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
2394 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
2395 | 2395 | if ($max_length === 0) { |
2396 | 2396 | return ''; |
2397 | 2397 | } |
@@ -2422,16 +2422,16 @@ discard block |
||
2422 | 2422 | */ |
2423 | 2423 | public static function get_unique_string($entropy_extra = '', bool $use_md5 = true): string |
2424 | 2424 | { |
2425 | - $unique_helper = \random_int(0, \mt_getrandmax()) . |
|
2426 | - \session_id() . |
|
2427 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2428 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2425 | + $unique_helper = \random_int(0, \mt_getrandmax()). |
|
2426 | + \session_id(). |
|
2427 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2428 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2429 | 2429 | $entropy_extra; |
2430 | 2430 | |
2431 | 2431 | $unique_string = \uniqid($unique_helper, true); |
2432 | 2432 | |
2433 | 2433 | if ($use_md5) { |
2434 | - $unique_string = \md5($unique_string . $unique_helper); |
|
2434 | + $unique_string = \md5($unique_string.$unique_helper); |
|
2435 | 2435 | } |
2436 | 2436 | |
2437 | 2437 | return $unique_string; |
@@ -2541,7 +2541,7 @@ discard block |
||
2541 | 2541 | public static function hex_to_int($hexdec) |
2542 | 2542 | { |
2543 | 2543 | // init |
2544 | - $hexdec = (string) $hexdec; |
|
2544 | + $hexdec = (string)$hexdec; |
|
2545 | 2545 | |
2546 | 2546 | if ($hexdec === '') { |
2547 | 2547 | return false; |
@@ -2638,7 +2638,7 @@ discard block |
||
2638 | 2638 | return \implode( |
2639 | 2639 | '', |
2640 | 2640 | \array_map( |
2641 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2641 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2642 | 2642 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
2643 | 2643 | }, |
2644 | 2644 | self::str_split($str) |
@@ -2750,7 +2750,7 @@ discard block |
||
2750 | 2750 | /** |
2751 | 2751 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
2752 | 2752 | */ |
2753 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2753 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2754 | 2754 | } |
2755 | 2755 | |
2756 | 2756 | do { |
@@ -2759,7 +2759,7 @@ discard block |
||
2759 | 2759 | if (\strpos($str, '&') !== false) { |
2760 | 2760 | if (\strpos($str, '&#') !== false) { |
2761 | 2761 | // decode also numeric & UTF16 two byte entities |
2762 | - $str = (string) \preg_replace( |
|
2762 | + $str = (string)\preg_replace( |
|
2763 | 2763 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
2764 | 2764 | '$1;', |
2765 | 2765 | $str |
@@ -2809,7 +2809,7 @@ discard block |
||
2809 | 2809 | */ |
2810 | 2810 | public static function html_stripe_empty_tags(string $str): string |
2811 | 2811 | { |
2812 | - return (string) \preg_replace( |
|
2812 | + return (string)\preg_replace( |
|
2813 | 2813 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
2814 | 2814 | '', |
2815 | 2815 | $str |
@@ -3129,9 +3129,9 @@ discard block |
||
3129 | 3129 | { |
3130 | 3130 | $hex = \dechex($int); |
3131 | 3131 | |
3132 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
3132 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
3133 | 3133 | |
3134 | - return $prefix . $hex . ''; |
|
3134 | + return $prefix.$hex.''; |
|
3135 | 3135 | } |
3136 | 3136 | |
3137 | 3137 | /** |
@@ -3451,7 +3451,7 @@ discard block |
||
3451 | 3451 | */ |
3452 | 3452 | public static function is_binary($input, bool $strict = false): bool |
3453 | 3453 | { |
3454 | - $input = (string) $input; |
|
3454 | + $input = (string)$input; |
|
3455 | 3455 | if ($input === '') { |
3456 | 3456 | return false; |
3457 | 3457 | } |
@@ -3633,7 +3633,7 @@ discard block |
||
3633 | 3633 | */ |
3634 | 3634 | public static function is_url(string $url, bool $disallow_localhost = false): bool |
3635 | 3635 | { |
3636 | - $url = (string) $url; |
|
3636 | + $url = (string)$url; |
|
3637 | 3637 | if (!$url) { |
3638 | 3638 | return false; |
3639 | 3639 | } |
@@ -3793,7 +3793,7 @@ discard block |
||
3793 | 3793 | public static function is_utf16($str, $check_if_string_is_binary = true) |
3794 | 3794 | { |
3795 | 3795 | // init |
3796 | - $str = (string) $str; |
|
3796 | + $str = (string)$str; |
|
3797 | 3797 | $str_chars = []; |
3798 | 3798 | |
3799 | 3799 | if ( |
@@ -3879,7 +3879,7 @@ discard block |
||
3879 | 3879 | public static function is_utf32($str, $check_if_string_is_binary = true) |
3880 | 3880 | { |
3881 | 3881 | // init |
3882 | - $str = (string) $str; |
|
3882 | + $str = (string)$str; |
|
3883 | 3883 | $str_chars = []; |
3884 | 3884 | |
3885 | 3885 | if ( |
@@ -3971,7 +3971,7 @@ discard block |
||
3971 | 3971 | return true; |
3972 | 3972 | } |
3973 | 3973 | |
3974 | - return self::is_utf8_string((string) $str, $strict); |
|
3974 | + return self::is_utf8_string((string)$str, $strict); |
|
3975 | 3975 | } |
3976 | 3976 | |
3977 | 3977 | /** |
@@ -4121,15 +4121,15 @@ discard block |
||
4121 | 4121 | $use_mb_functions = ($lang === null && $try_to_keep_the_string_length === false); |
4122 | 4122 | |
4123 | 4123 | if ($encoding === 'UTF-8') { |
4124 | - $str_part_two = (string) \mb_substr($str, 1); |
|
4124 | + $str_part_two = (string)\mb_substr($str, 1); |
|
4125 | 4125 | |
4126 | 4126 | if ($use_mb_functions === true) { |
4127 | 4127 | $str_part_one = \mb_strtolower( |
4128 | - (string) \mb_substr($str, 0, 1) |
|
4128 | + (string)\mb_substr($str, 0, 1) |
|
4129 | 4129 | ); |
4130 | 4130 | } else { |
4131 | 4131 | $str_part_one = self::strtolower( |
4132 | - (string) \mb_substr($str, 0, 1), |
|
4132 | + (string)\mb_substr($str, 0, 1), |
|
4133 | 4133 | $encoding, |
4134 | 4134 | false, |
4135 | 4135 | $lang, |
@@ -4139,10 +4139,10 @@ discard block |
||
4139 | 4139 | } else { |
4140 | 4140 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4141 | 4141 | |
4142 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
4142 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
4143 | 4143 | |
4144 | 4144 | $str_part_one = self::strtolower( |
4145 | - (string) self::substr($str, 0, 1, $encoding), |
|
4145 | + (string)self::substr($str, 0, 1, $encoding), |
|
4146 | 4146 | $encoding, |
4147 | 4147 | false, |
4148 | 4148 | $lang, |
@@ -4150,7 +4150,7 @@ discard block |
||
4150 | 4150 | ); |
4151 | 4151 | } |
4152 | 4152 | |
4153 | - return $str_part_one . $str_part_two; |
|
4153 | + return $str_part_one.$str_part_two; |
|
4154 | 4154 | } |
4155 | 4155 | |
4156 | 4156 | /** |
@@ -4297,7 +4297,7 @@ discard block |
||
4297 | 4297 | } |
4298 | 4298 | |
4299 | 4299 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4300 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4300 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4301 | 4301 | } |
4302 | 4302 | |
4303 | 4303 | if ($chars) { |
@@ -4350,7 +4350,7 @@ discard block |
||
4350 | 4350 | { |
4351 | 4351 | $bytes = self::chr_size_list($str); |
4352 | 4352 | if ($bytes !== []) { |
4353 | - return (int) \max($bytes); |
|
4353 | + return (int)\max($bytes); |
|
4354 | 4354 | } |
4355 | 4355 | |
4356 | 4356 | return 0; |
@@ -4432,7 +4432,7 @@ discard block |
||
4432 | 4432 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4433 | 4433 | |
4434 | 4434 | // init |
4435 | - $encoding = (string) $encoding; |
|
4435 | + $encoding = (string)$encoding; |
|
4436 | 4436 | |
4437 | 4437 | if (!$encoding) { |
4438 | 4438 | return $fallback; |
@@ -4494,7 +4494,7 @@ discard block |
||
4494 | 4494 | |
4495 | 4495 | $encoding_original = $encoding; |
4496 | 4496 | $encoding = \strtoupper($encoding); |
4497 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4497 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4498 | 4498 | |
4499 | 4499 | $equivalences = [ |
4500 | 4500 | 'ISO8859' => 'ISO-8859-1', |
@@ -4652,13 +4652,13 @@ discard block |
||
4652 | 4652 | static $CHAR_CACHE = []; |
4653 | 4653 | |
4654 | 4654 | // init |
4655 | - $chr = (string) $chr; |
|
4655 | + $chr = (string)$chr; |
|
4656 | 4656 | |
4657 | 4657 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4658 | 4658 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4659 | 4659 | } |
4660 | 4660 | |
4661 | - $cache_key = $chr . '_' . $encoding; |
|
4661 | + $cache_key = $chr.'_'.$encoding; |
|
4662 | 4662 | if (isset($CHAR_CACHE[$cache_key]) === true) { |
4663 | 4663 | return $CHAR_CACHE[$cache_key]; |
4664 | 4664 | } |
@@ -4693,7 +4693,7 @@ discard block |
||
4693 | 4693 | // |
4694 | 4694 | |
4695 | 4695 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
4696 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
4696 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
4697 | 4697 | /** @noinspection OffsetOperationsInspection */ |
4698 | 4698 | $code = $chr ? $chr[1] : 0; |
4699 | 4699 | |
@@ -4701,21 +4701,21 @@ discard block |
||
4701 | 4701 | if ($code >= 0xF0 && isset($chr[4])) { |
4702 | 4702 | /** @noinspection UnnecessaryCastingInspection */ |
4703 | 4703 | /** @noinspection OffsetOperationsInspection */ |
4704 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4704 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4705 | 4705 | } |
4706 | 4706 | |
4707 | 4707 | /** @noinspection OffsetOperationsInspection */ |
4708 | 4708 | if ($code >= 0xE0 && isset($chr[3])) { |
4709 | 4709 | /** @noinspection UnnecessaryCastingInspection */ |
4710 | 4710 | /** @noinspection OffsetOperationsInspection */ |
4711 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4711 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4712 | 4712 | } |
4713 | 4713 | |
4714 | 4714 | /** @noinspection OffsetOperationsInspection */ |
4715 | 4715 | if ($code >= 0xC0 && isset($chr[2])) { |
4716 | 4716 | /** @noinspection UnnecessaryCastingInspection */ |
4717 | 4717 | /** @noinspection OffsetOperationsInspection */ |
4718 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4718 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4719 | 4719 | } |
4720 | 4720 | |
4721 | 4721 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -4772,7 +4772,7 @@ discard block |
||
4772 | 4772 | public static function pcre_utf8_support(): bool |
4773 | 4773 | { |
4774 | 4774 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4775 | - return (bool) @\preg_match('//u', ''); |
|
4775 | + return (bool)@\preg_match('//u', ''); |
|
4776 | 4776 | } |
4777 | 4777 | |
4778 | 4778 | /** |
@@ -4811,14 +4811,14 @@ discard block |
||
4811 | 4811 | * @psalm-suppress DocblockTypeContradiction |
4812 | 4812 | */ |
4813 | 4813 | if (!\is_numeric($step)) { |
4814 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
4814 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
4815 | 4815 | } |
4816 | 4816 | |
4817 | 4817 | /** |
4818 | 4818 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
4819 | 4819 | */ |
4820 | 4820 | if ($step <= 0) { |
4821 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
4821 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
4822 | 4822 | } |
4823 | 4823 | } |
4824 | 4824 | |
@@ -4830,14 +4830,14 @@ discard block |
||
4830 | 4830 | $is_xdigit = false; |
4831 | 4831 | |
4832 | 4832 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4833 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
4833 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
4834 | 4834 | $is_digit = true; |
4835 | - $start = (int) $var1; |
|
4835 | + $start = (int)$var1; |
|
4836 | 4836 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
4837 | 4837 | $is_xdigit = true; |
4838 | - $start = (int) self::hex_to_int($var1); |
|
4838 | + $start = (int)self::hex_to_int($var1); |
|
4839 | 4839 | } elseif (!$use_ctype && \is_numeric($var1)) { |
4840 | - $start = (int) $var1; |
|
4840 | + $start = (int)$var1; |
|
4841 | 4841 | } else { |
4842 | 4842 | $start = self::ord($var1); |
4843 | 4843 | } |
@@ -4847,11 +4847,11 @@ discard block |
||
4847 | 4847 | } |
4848 | 4848 | |
4849 | 4849 | if ($is_digit) { |
4850 | - $end = (int) $var2; |
|
4850 | + $end = (int)$var2; |
|
4851 | 4851 | } elseif ($is_xdigit) { |
4852 | - $end = (int) self::hex_to_int($var2); |
|
4852 | + $end = (int)self::hex_to_int($var2); |
|
4853 | 4853 | } elseif (!$use_ctype && \is_numeric($var2)) { |
4854 | - $end = (int) $var2; |
|
4854 | + $end = (int)$var2; |
|
4855 | 4855 | } else { |
4856 | 4856 | $end = self::ord($var2); |
4857 | 4857 | } |
@@ -4862,7 +4862,7 @@ discard block |
||
4862 | 4862 | |
4863 | 4863 | $array = []; |
4864 | 4864 | foreach (\range($start, $end, $step) as $i) { |
4865 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
4865 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
4866 | 4866 | } |
4867 | 4867 | |
4868 | 4868 | return $array; |
@@ -4972,8 +4972,8 @@ discard block |
||
4972 | 4972 | $delimiter = '/'; |
4973 | 4973 | } |
4974 | 4974 | |
4975 | - return (string) \preg_replace( |
|
4976 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4975 | + return (string)\preg_replace( |
|
4976 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4977 | 4977 | $replacement, |
4978 | 4978 | $str |
4979 | 4979 | ); |
@@ -5021,9 +5021,9 @@ discard block |
||
5021 | 5021 | return ''; |
5022 | 5022 | } |
5023 | 5023 | |
5024 | - $str_length -= (int) $bom_byte_length; |
|
5024 | + $str_length -= (int)$bom_byte_length; |
|
5025 | 5025 | |
5026 | - $str = (string) $str_tmp; |
|
5026 | + $str = (string)$str_tmp; |
|
5027 | 5027 | } |
5028 | 5028 | } |
5029 | 5029 | |
@@ -5052,7 +5052,7 @@ discard block |
||
5052 | 5052 | */ |
5053 | 5053 | if (\is_array($what) === true) { |
5054 | 5054 | foreach ($what as $item) { |
5055 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
5055 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
5056 | 5056 | } |
5057 | 5057 | } |
5058 | 5058 | |
@@ -5090,7 +5090,7 @@ discard block |
||
5090 | 5090 | */ |
5091 | 5091 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
5092 | 5092 | { |
5093 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
5093 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
5094 | 5094 | } |
5095 | 5095 | |
5096 | 5096 | /** |
@@ -5145,17 +5145,17 @@ discard block |
||
5145 | 5145 | ): string { |
5146 | 5146 | if ($substring && \strpos($str, $substring) === 0) { |
5147 | 5147 | if ($encoding === 'UTF-8') { |
5148 | - return (string) \mb_substr( |
|
5148 | + return (string)\mb_substr( |
|
5149 | 5149 | $str, |
5150 | - (int) \mb_strlen($substring) |
|
5150 | + (int)\mb_strlen($substring) |
|
5151 | 5151 | ); |
5152 | 5152 | } |
5153 | 5153 | |
5154 | 5154 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5155 | 5155 | |
5156 | - return (string) self::substr( |
|
5156 | + return (string)self::substr( |
|
5157 | 5157 | $str, |
5158 | - (int) self::strlen($substring, $encoding), |
|
5158 | + (int)self::strlen($substring, $encoding), |
|
5159 | 5159 | null, |
5160 | 5160 | $encoding |
5161 | 5161 | ); |
@@ -5183,19 +5183,19 @@ discard block |
||
5183 | 5183 | ): string { |
5184 | 5184 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
5185 | 5185 | if ($encoding === 'UTF-8') { |
5186 | - return (string) \mb_substr( |
|
5186 | + return (string)\mb_substr( |
|
5187 | 5187 | $str, |
5188 | 5188 | 0, |
5189 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
5189 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
5190 | 5190 | ); |
5191 | 5191 | } |
5192 | 5192 | |
5193 | 5193 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5194 | 5194 | |
5195 | - return (string) self::substr( |
|
5195 | + return (string)self::substr( |
|
5196 | 5196 | $str, |
5197 | 5197 | 0, |
5198 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
5198 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
5199 | 5199 | $encoding |
5200 | 5200 | ); |
5201 | 5201 | } |
@@ -5294,7 +5294,7 @@ discard block |
||
5294 | 5294 | $save = \mb_substitute_character(); |
5295 | 5295 | \mb_substitute_character($replacement_char_helper); |
5296 | 5296 | // the polyfill maybe return false, so cast to string |
5297 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
5297 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
5298 | 5298 | \mb_substitute_character($save); |
5299 | 5299 | } |
5300 | 5300 | |
@@ -5338,7 +5338,7 @@ discard block |
||
5338 | 5338 | } |
5339 | 5339 | |
5340 | 5340 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5341 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
5341 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
5342 | 5342 | } |
5343 | 5343 | |
5344 | 5344 | if ($chars) { |
@@ -5368,7 +5368,7 @@ discard block |
||
5368 | 5368 | $html .= '<pre>'; |
5369 | 5369 | /** @noinspection AlterInForeachInspection */ |
5370 | 5370 | foreach (self::$SUPPORT as $key => &$value) { |
5371 | - $html .= $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
5371 | + $html .= $key.' - '.\print_r($value, true)."\n<br>"; |
|
5372 | 5372 | } |
5373 | 5373 | $html .= '</pre>'; |
5374 | 5374 | |
@@ -5408,7 +5408,7 @@ discard block |
||
5408 | 5408 | return $char; |
5409 | 5409 | } |
5410 | 5410 | |
5411 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
5411 | + return '&#'.self::ord($char, $encoding).';'; |
|
5412 | 5412 | } |
5413 | 5413 | |
5414 | 5414 | /** |
@@ -5511,11 +5511,11 @@ discard block |
||
5511 | 5511 | $lang, |
5512 | 5512 | $try_to_keep_the_string_length |
5513 | 5513 | ); |
5514 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5514 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5515 | 5515 | |
5516 | 5516 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
5517 | 5517 | |
5518 | - $str = (string) \preg_replace_callback( |
|
5518 | + $str = (string)\preg_replace_callback( |
|
5519 | 5519 | '/[-_\\s]+(.)?/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, $lang, $try_to_keep_the_string_length): string { |
|
5527 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5528 | 5528 | if (isset($match[1])) { |
5529 | 5529 | if ($use_mb_functions === true) { |
5530 | 5530 | if ($encoding === 'UTF-8') { |
@@ -5542,7 +5542,7 @@ discard block |
||
5542 | 5542 | $str |
5543 | 5543 | ); |
5544 | 5544 | |
5545 | - return (string) \preg_replace_callback( |
|
5545 | + return (string)\preg_replace_callback( |
|
5546 | 5546 | '/[\\p{N}]+(.)?/u', |
5547 | 5547 | /** |
5548 | 5548 | * @param array $match |
@@ -5551,7 +5551,7 @@ discard block |
||
5551 | 5551 | * |
5552 | 5552 | * @return string |
5553 | 5553 | */ |
5554 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5554 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5555 | 5555 | if ($use_mb_functions === true) { |
5556 | 5556 | if ($encoding === 'UTF-8') { |
5557 | 5557 | return \mb_strtoupper($match[0]); |
@@ -5743,7 +5743,7 @@ discard block |
||
5743 | 5743 | ): string { |
5744 | 5744 | if (self::$SUPPORT['mbstring'] === true) { |
5745 | 5745 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5746 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5746 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5747 | 5747 | |
5748 | 5748 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
5749 | 5749 | if ($use_mb_functions === true && $encoding === 'UTF-8') { |
@@ -5753,10 +5753,10 @@ discard block |
||
5753 | 5753 | } |
5754 | 5754 | |
5755 | 5755 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5756 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5756 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5757 | 5757 | } |
5758 | 5758 | |
5759 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5759 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5760 | 5760 | |
5761 | 5761 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
5762 | 5762 | if ($use_mb_functions === true && $encoding === 'UTF-8') { |
@@ -5765,7 +5765,7 @@ discard block |
||
5765 | 5765 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
5766 | 5766 | } |
5767 | 5767 | |
5768 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5768 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5769 | 5769 | } |
5770 | 5770 | |
5771 | 5771 | /** |
@@ -5782,7 +5782,7 @@ discard block |
||
5782 | 5782 | public static function str_detect_encoding($str) |
5783 | 5783 | { |
5784 | 5784 | // init |
5785 | - $str = (string) $str; |
|
5785 | + $str = (string)$str; |
|
5786 | 5786 | |
5787 | 5787 | // |
5788 | 5788 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5884,7 +5884,7 @@ discard block |
||
5884 | 5884 | foreach (self::$ENCODINGS as $encoding_tmp) { |
5885 | 5885 | // INFO: //IGNORE but still throw notice |
5886 | 5886 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5887 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
5887 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
5888 | 5888 | return $encoding_tmp; |
5889 | 5889 | } |
5890 | 5890 | } |
@@ -5981,7 +5981,7 @@ discard block |
||
5981 | 5981 | return $str; |
5982 | 5982 | } |
5983 | 5983 | |
5984 | - return $substring . $str; |
|
5984 | + return $substring.$str; |
|
5985 | 5985 | } |
5986 | 5986 | |
5987 | 5987 | /** |
@@ -6272,27 +6272,27 @@ discard block |
||
6272 | 6272 | string $encoding = 'UTF-8' |
6273 | 6273 | ): string { |
6274 | 6274 | if ($encoding === 'UTF-8') { |
6275 | - $len = (int) \mb_strlen($str); |
|
6275 | + $len = (int)\mb_strlen($str); |
|
6276 | 6276 | if ($index > $len) { |
6277 | 6277 | return $str; |
6278 | 6278 | } |
6279 | 6279 | |
6280 | 6280 | /** @noinspection UnnecessaryCastingInspection */ |
6281 | - return (string) \mb_substr($str, 0, $index) . |
|
6282 | - $substring . |
|
6283 | - (string) \mb_substr($str, $index, $len); |
|
6281 | + return (string)\mb_substr($str, 0, $index). |
|
6282 | + $substring. |
|
6283 | + (string)\mb_substr($str, $index, $len); |
|
6284 | 6284 | } |
6285 | 6285 | |
6286 | 6286 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6287 | 6287 | |
6288 | - $len = (int) self::strlen($str, $encoding); |
|
6288 | + $len = (int)self::strlen($str, $encoding); |
|
6289 | 6289 | if ($index > $len) { |
6290 | 6290 | return $str; |
6291 | 6291 | } |
6292 | 6292 | |
6293 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
6294 | - $substring . |
|
6295 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
6293 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
6294 | + $substring. |
|
6295 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
6296 | 6296 | } |
6297 | 6297 | |
6298 | 6298 | /** |
@@ -6324,15 +6324,15 @@ discard block |
||
6324 | 6324 | */ |
6325 | 6325 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
6326 | 6326 | { |
6327 | - $search = (array) $search; |
|
6327 | + $search = (array)$search; |
|
6328 | 6328 | |
6329 | 6329 | /** @noinspection AlterInForeachInspection */ |
6330 | 6330 | foreach ($search as &$s) { |
6331 | - $s = (string) $s; |
|
6331 | + $s = (string)$s; |
|
6332 | 6332 | if ($s === '') { |
6333 | 6333 | $s = '/^(?<=.)$/'; |
6334 | 6334 | } else { |
6335 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
6335 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
6336 | 6336 | } |
6337 | 6337 | } |
6338 | 6338 | |
@@ -6366,11 +6366,11 @@ discard block |
||
6366 | 6366 | } |
6367 | 6367 | |
6368 | 6368 | if ($search === '') { |
6369 | - return $str . $replacement; |
|
6369 | + return $str.$replacement; |
|
6370 | 6370 | } |
6371 | 6371 | |
6372 | 6372 | if (\stripos($str, $search) === 0) { |
6373 | - return $replacement . \substr($str, \strlen($search)); |
|
6373 | + return $replacement.\substr($str, \strlen($search)); |
|
6374 | 6374 | } |
6375 | 6375 | |
6376 | 6376 | return $str; |
@@ -6401,11 +6401,11 @@ discard block |
||
6401 | 6401 | } |
6402 | 6402 | |
6403 | 6403 | if ($search === '') { |
6404 | - return $str . $replacement; |
|
6404 | + return $str.$replacement; |
|
6405 | 6405 | } |
6406 | 6406 | |
6407 | 6407 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6408 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6408 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6409 | 6409 | } |
6410 | 6410 | |
6411 | 6411 | return $str; |
@@ -6491,15 +6491,15 @@ discard block |
||
6491 | 6491 | } |
6492 | 6492 | |
6493 | 6493 | if ($encoding === 'UTF-8') { |
6494 | - return (string) \mb_substr( |
|
6494 | + return (string)\mb_substr( |
|
6495 | 6495 | $str, |
6496 | - $offset + (int) \mb_strlen($separator) |
|
6496 | + $offset + (int)\mb_strlen($separator) |
|
6497 | 6497 | ); |
6498 | 6498 | } |
6499 | 6499 | |
6500 | - return (string) self::substr( |
|
6500 | + return (string)self::substr( |
|
6501 | 6501 | $str, |
6502 | - $offset + (int) self::strlen($separator, $encoding), |
|
6502 | + $offset + (int)self::strlen($separator, $encoding), |
|
6503 | 6503 | null, |
6504 | 6504 | $encoding |
6505 | 6505 | ); |
@@ -6531,15 +6531,15 @@ discard block |
||
6531 | 6531 | } |
6532 | 6532 | |
6533 | 6533 | if ($encoding === 'UTF-8') { |
6534 | - return (string) \mb_substr( |
|
6534 | + return (string)\mb_substr( |
|
6535 | 6535 | $str, |
6536 | - $offset + (int) self::strlen($separator) |
|
6536 | + $offset + (int)self::strlen($separator) |
|
6537 | 6537 | ); |
6538 | 6538 | } |
6539 | 6539 | |
6540 | - return (string) self::substr( |
|
6540 | + return (string)self::substr( |
|
6541 | 6541 | $str, |
6542 | - $offset + (int) self::strlen($separator, $encoding), |
|
6542 | + $offset + (int)self::strlen($separator, $encoding), |
|
6543 | 6543 | null, |
6544 | 6544 | $encoding |
6545 | 6545 | ); |
@@ -6571,10 +6571,10 @@ discard block |
||
6571 | 6571 | } |
6572 | 6572 | |
6573 | 6573 | if ($encoding === 'UTF-8') { |
6574 | - return (string) \mb_substr($str, 0, $offset); |
|
6574 | + return (string)\mb_substr($str, 0, $offset); |
|
6575 | 6575 | } |
6576 | 6576 | |
6577 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6577 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6578 | 6578 | } |
6579 | 6579 | |
6580 | 6580 | /** |
@@ -6603,7 +6603,7 @@ discard block |
||
6603 | 6603 | return ''; |
6604 | 6604 | } |
6605 | 6605 | |
6606 | - return (string) \mb_substr($str, 0, $offset); |
|
6606 | + return (string)\mb_substr($str, 0, $offset); |
|
6607 | 6607 | } |
6608 | 6608 | |
6609 | 6609 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6611,7 +6611,7 @@ discard block |
||
6611 | 6611 | return ''; |
6612 | 6612 | } |
6613 | 6613 | |
6614 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6614 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6615 | 6615 | } |
6616 | 6616 | |
6617 | 6617 | /** |
@@ -6713,12 +6713,12 @@ discard block |
||
6713 | 6713 | } |
6714 | 6714 | |
6715 | 6715 | if ($encoding === 'UTF-8') { |
6716 | - return (string) \mb_substr($str, -$n); |
|
6716 | + return (string)\mb_substr($str, -$n); |
|
6717 | 6717 | } |
6718 | 6718 | |
6719 | 6719 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6720 | 6720 | |
6721 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6721 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6722 | 6722 | } |
6723 | 6723 | |
6724 | 6724 | /** |
@@ -6744,21 +6744,21 @@ discard block |
||
6744 | 6744 | } |
6745 | 6745 | |
6746 | 6746 | if ($encoding === 'UTF-8') { |
6747 | - if ((int) \mb_strlen($str) <= $length) { |
|
6747 | + if ((int)\mb_strlen($str) <= $length) { |
|
6748 | 6748 | return $str; |
6749 | 6749 | } |
6750 | 6750 | |
6751 | 6751 | /** @noinspection UnnecessaryCastingInspection */ |
6752 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
6752 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
6753 | 6753 | } |
6754 | 6754 | |
6755 | 6755 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6756 | 6756 | |
6757 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6757 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6758 | 6758 | return $str; |
6759 | 6759 | } |
6760 | 6760 | |
6761 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
6761 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
6762 | 6762 | } |
6763 | 6763 | |
6764 | 6764 | /** |
@@ -6785,12 +6785,12 @@ discard block |
||
6785 | 6785 | |
6786 | 6786 | if ($encoding === 'UTF-8') { |
6787 | 6787 | /** @noinspection UnnecessaryCastingInspection */ |
6788 | - if ((int) \mb_strlen($str) <= $length) { |
|
6788 | + if ((int)\mb_strlen($str) <= $length) { |
|
6789 | 6789 | return $str; |
6790 | 6790 | } |
6791 | 6791 | |
6792 | 6792 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6793 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6793 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6794 | 6794 | } |
6795 | 6795 | |
6796 | 6796 | $str = \mb_substr($str, 0, $length); |
@@ -6800,22 +6800,22 @@ discard block |
||
6800 | 6800 | $new_str = \implode(' ', $array); |
6801 | 6801 | |
6802 | 6802 | if ($new_str === '') { |
6803 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6803 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6804 | 6804 | } |
6805 | 6805 | } else { |
6806 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6806 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6807 | 6807 | return $str; |
6808 | 6808 | } |
6809 | 6809 | |
6810 | 6810 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6811 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6811 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6812 | 6812 | } |
6813 | 6813 | |
6814 | 6814 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6815 | 6815 | $str = self::substr($str, 0, $length, $encoding); |
6816 | 6816 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6817 | 6817 | if ($str === false) { |
6818 | - return '' . $str_add_on; |
|
6818 | + return ''.$str_add_on; |
|
6819 | 6819 | } |
6820 | 6820 | |
6821 | 6821 | $array = \explode(' ', $str); |
@@ -6823,11 +6823,11 @@ discard block |
||
6823 | 6823 | $new_str = \implode(' ', $array); |
6824 | 6824 | |
6825 | 6825 | if ($new_str === '') { |
6826 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6826 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6827 | 6827 | } |
6828 | 6828 | } |
6829 | 6829 | |
6830 | - return $new_str . $str_add_on; |
|
6830 | + return $new_str.$str_add_on; |
|
6831 | 6831 | } |
6832 | 6832 | |
6833 | 6833 | /** |
@@ -6850,7 +6850,7 @@ discard block |
||
6850 | 6850 | $longest_common_prefix = ''; |
6851 | 6851 | |
6852 | 6852 | if ($encoding === 'UTF-8') { |
6853 | - $max_length = (int) \min( |
|
6853 | + $max_length = (int)\min( |
|
6854 | 6854 | \mb_strlen($str1), |
6855 | 6855 | \mb_strlen($str2) |
6856 | 6856 | ); |
@@ -6871,7 +6871,7 @@ discard block |
||
6871 | 6871 | } else { |
6872 | 6872 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6873 | 6873 | |
6874 | - $max_length = (int) \min( |
|
6874 | + $max_length = (int)\min( |
|
6875 | 6875 | self::strlen($str1, $encoding), |
6876 | 6876 | self::strlen($str2, $encoding) |
6877 | 6877 | ); |
@@ -6920,13 +6920,13 @@ discard block |
||
6920 | 6920 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6921 | 6921 | |
6922 | 6922 | if ($encoding === 'UTF-8') { |
6923 | - $str_length = (int) \mb_strlen($str1); |
|
6924 | - $other_length = (int) \mb_strlen($str2); |
|
6923 | + $str_length = (int)\mb_strlen($str1); |
|
6924 | + $other_length = (int)\mb_strlen($str2); |
|
6925 | 6925 | } else { |
6926 | 6926 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6927 | 6927 | |
6928 | - $str_length = (int) self::strlen($str1, $encoding); |
|
6929 | - $other_length = (int) self::strlen($str2, $encoding); |
|
6928 | + $str_length = (int)self::strlen($str1, $encoding); |
|
6929 | + $other_length = (int)self::strlen($str2, $encoding); |
|
6930 | 6930 | } |
6931 | 6931 | |
6932 | 6932 | // Return if either string is empty |
@@ -6979,10 +6979,10 @@ discard block |
||
6979 | 6979 | } |
6980 | 6980 | |
6981 | 6981 | if ($encoding === 'UTF-8') { |
6982 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
6982 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
6983 | 6983 | } |
6984 | 6984 | |
6985 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
6985 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
6986 | 6986 | } |
6987 | 6987 | |
6988 | 6988 | /** |
@@ -7006,7 +7006,7 @@ discard block |
||
7006 | 7006 | } |
7007 | 7007 | |
7008 | 7008 | if ($encoding === 'UTF-8') { |
7009 | - $max_length = (int) \min( |
|
7009 | + $max_length = (int)\min( |
|
7010 | 7010 | \mb_strlen($str1, $encoding), |
7011 | 7011 | \mb_strlen($str2, $encoding) |
7012 | 7012 | ); |
@@ -7020,7 +7020,7 @@ discard block |
||
7020 | 7020 | && |
7021 | 7021 | $char === \mb_substr($str2, -$i, 1) |
7022 | 7022 | ) { |
7023 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
7023 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
7024 | 7024 | } else { |
7025 | 7025 | break; |
7026 | 7026 | } |
@@ -7028,7 +7028,7 @@ discard block |
||
7028 | 7028 | } else { |
7029 | 7029 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7030 | 7030 | |
7031 | - $max_length = (int) \min( |
|
7031 | + $max_length = (int)\min( |
|
7032 | 7032 | self::strlen($str1, $encoding), |
7033 | 7033 | self::strlen($str2, $encoding) |
7034 | 7034 | ); |
@@ -7042,7 +7042,7 @@ discard block |
||
7042 | 7042 | && |
7043 | 7043 | $char === self::substr($str2, -$i, 1, $encoding) |
7044 | 7044 | ) { |
7045 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
7045 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
7046 | 7046 | } else { |
7047 | 7047 | break; |
7048 | 7048 | } |
@@ -7064,7 +7064,7 @@ discard block |
||
7064 | 7064 | */ |
7065 | 7065 | public static function str_matches_pattern(string $str, string $pattern): bool |
7066 | 7066 | { |
7067 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
7067 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
7068 | 7068 | } |
7069 | 7069 | |
7070 | 7070 | /** |
@@ -7083,7 +7083,7 @@ discard block |
||
7083 | 7083 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
7084 | 7084 | { |
7085 | 7085 | // init |
7086 | - $length = (int) self::strlen($str, $encoding); |
|
7086 | + $length = (int)self::strlen($str, $encoding); |
|
7087 | 7087 | |
7088 | 7088 | if ($offset >= 0) { |
7089 | 7089 | return $length > $offset; |
@@ -7112,7 +7112,7 @@ discard block |
||
7112 | 7112 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
7113 | 7113 | { |
7114 | 7114 | // init |
7115 | - $length = (int) self::strlen($str); |
|
7115 | + $length = (int)self::strlen($str); |
|
7116 | 7116 | |
7117 | 7117 | if ( |
7118 | 7118 | ($index >= 0 && $length <= $index) |
@@ -7154,7 +7154,7 @@ discard block |
||
7154 | 7154 | return $str; |
7155 | 7155 | } |
7156 | 7156 | |
7157 | - if ($pad_type !== (int) $pad_type) { |
|
7157 | + if ($pad_type !== (int)$pad_type) { |
|
7158 | 7158 | if ($pad_type === 'left') { |
7159 | 7159 | $pad_type = \STR_PAD_LEFT; |
7160 | 7160 | } elseif ($pad_type === 'right') { |
@@ -7163,23 +7163,23 @@ discard block |
||
7163 | 7163 | $pad_type = \STR_PAD_BOTH; |
7164 | 7164 | } else { |
7165 | 7165 | throw new \InvalidArgumentException( |
7166 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
7166 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
7167 | 7167 | ); |
7168 | 7168 | } |
7169 | 7169 | } |
7170 | 7170 | |
7171 | 7171 | if ($encoding === 'UTF-8') { |
7172 | - $str_length = (int) \mb_strlen($str); |
|
7172 | + $str_length = (int)\mb_strlen($str); |
|
7173 | 7173 | |
7174 | 7174 | if ($pad_length >= $str_length) { |
7175 | 7175 | switch ($pad_type) { |
7176 | 7176 | case \STR_PAD_LEFT: |
7177 | - $ps_length = (int) \mb_strlen($pad_string); |
|
7177 | + $ps_length = (int)\mb_strlen($pad_string); |
|
7178 | 7178 | |
7179 | 7179 | $diff = ($pad_length - $str_length); |
7180 | 7180 | |
7181 | - $pre = (string) \mb_substr( |
|
7182 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7181 | + $pre = (string)\mb_substr( |
|
7182 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7183 | 7183 | 0, |
7184 | 7184 | $diff |
7185 | 7185 | ); |
@@ -7190,16 +7190,16 @@ discard block |
||
7190 | 7190 | case \STR_PAD_BOTH: |
7191 | 7191 | $diff = ($pad_length - $str_length); |
7192 | 7192 | |
7193 | - $ps_length_left = (int) \floor($diff / 2); |
|
7193 | + $ps_length_left = (int)\floor($diff / 2); |
|
7194 | 7194 | |
7195 | - $ps_length_right = (int) \ceil($diff / 2); |
|
7195 | + $ps_length_right = (int)\ceil($diff / 2); |
|
7196 | 7196 | |
7197 | - $pre = (string) \mb_substr( |
|
7197 | + $pre = (string)\mb_substr( |
|
7198 | 7198 | \str_repeat($pad_string, $ps_length_left), |
7199 | 7199 | 0, |
7200 | 7200 | $ps_length_left |
7201 | 7201 | ); |
7202 | - $post = (string) \mb_substr( |
|
7202 | + $post = (string)\mb_substr( |
|
7203 | 7203 | \str_repeat($pad_string, $ps_length_right), |
7204 | 7204 | 0, |
7205 | 7205 | $ps_length_right |
@@ -7209,19 +7209,19 @@ discard block |
||
7209 | 7209 | |
7210 | 7210 | case \STR_PAD_RIGHT: |
7211 | 7211 | default: |
7212 | - $ps_length = (int) \mb_strlen($pad_string); |
|
7212 | + $ps_length = (int)\mb_strlen($pad_string); |
|
7213 | 7213 | |
7214 | 7214 | $diff = ($pad_length - $str_length); |
7215 | 7215 | |
7216 | - $post = (string) \mb_substr( |
|
7217 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7216 | + $post = (string)\mb_substr( |
|
7217 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7218 | 7218 | 0, |
7219 | 7219 | $diff |
7220 | 7220 | ); |
7221 | 7221 | $pre = ''; |
7222 | 7222 | } |
7223 | 7223 | |
7224 | - return $pre . $str . $post; |
|
7224 | + return $pre.$str.$post; |
|
7225 | 7225 | } |
7226 | 7226 | |
7227 | 7227 | return $str; |
@@ -7229,17 +7229,17 @@ discard block |
||
7229 | 7229 | |
7230 | 7230 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7231 | 7231 | |
7232 | - $str_length = (int) self::strlen($str, $encoding); |
|
7232 | + $str_length = (int)self::strlen($str, $encoding); |
|
7233 | 7233 | |
7234 | 7234 | if ($pad_length >= $str_length) { |
7235 | 7235 | switch ($pad_type) { |
7236 | 7236 | case \STR_PAD_LEFT: |
7237 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
7237 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
7238 | 7238 | |
7239 | 7239 | $diff = ($pad_length - $str_length); |
7240 | 7240 | |
7241 | - $pre = (string) self::substr( |
|
7242 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7241 | + $pre = (string)self::substr( |
|
7242 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7243 | 7243 | 0, |
7244 | 7244 | $diff, |
7245 | 7245 | $encoding |
@@ -7251,17 +7251,17 @@ discard block |
||
7251 | 7251 | case \STR_PAD_BOTH: |
7252 | 7252 | $diff = ($pad_length - $str_length); |
7253 | 7253 | |
7254 | - $ps_length_left = (int) \floor($diff / 2); |
|
7254 | + $ps_length_left = (int)\floor($diff / 2); |
|
7255 | 7255 | |
7256 | - $ps_length_right = (int) \ceil($diff / 2); |
|
7256 | + $ps_length_right = (int)\ceil($diff / 2); |
|
7257 | 7257 | |
7258 | - $pre = (string) self::substr( |
|
7258 | + $pre = (string)self::substr( |
|
7259 | 7259 | \str_repeat($pad_string, $ps_length_left), |
7260 | 7260 | 0, |
7261 | 7261 | $ps_length_left, |
7262 | 7262 | $encoding |
7263 | 7263 | ); |
7264 | - $post = (string) self::substr( |
|
7264 | + $post = (string)self::substr( |
|
7265 | 7265 | \str_repeat($pad_string, $ps_length_right), |
7266 | 7266 | 0, |
7267 | 7267 | $ps_length_right, |
@@ -7272,12 +7272,12 @@ discard block |
||
7272 | 7272 | |
7273 | 7273 | case \STR_PAD_RIGHT: |
7274 | 7274 | default: |
7275 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
7275 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
7276 | 7276 | |
7277 | 7277 | $diff = ($pad_length - $str_length); |
7278 | 7278 | |
7279 | - $post = (string) self::substr( |
|
7280 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7279 | + $post = (string)self::substr( |
|
7280 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7281 | 7281 | 0, |
7282 | 7282 | $diff, |
7283 | 7283 | $encoding |
@@ -7285,7 +7285,7 @@ discard block |
||
7285 | 7285 | $pre = ''; |
7286 | 7286 | } |
7287 | 7287 | |
7288 | - return $pre . $str . $post; |
|
7288 | + return $pre.$str.$post; |
|
7289 | 7289 | } |
7290 | 7290 | |
7291 | 7291 | return $str; |
@@ -7482,11 +7482,11 @@ discard block |
||
7482 | 7482 | } |
7483 | 7483 | |
7484 | 7484 | if ($search === '') { |
7485 | - return $str . $replacement; |
|
7485 | + return $str.$replacement; |
|
7486 | 7486 | } |
7487 | 7487 | |
7488 | 7488 | if (\strpos($str, $search) === 0) { |
7489 | - return $replacement . \substr($str, \strlen($search)); |
|
7489 | + return $replacement.\substr($str, \strlen($search)); |
|
7490 | 7490 | } |
7491 | 7491 | |
7492 | 7492 | return $str; |
@@ -7520,11 +7520,11 @@ discard block |
||
7520 | 7520 | } |
7521 | 7521 | |
7522 | 7522 | if ($search === '') { |
7523 | - return $str . $replacement; |
|
7523 | + return $str.$replacement; |
|
7524 | 7524 | } |
7525 | 7525 | |
7526 | 7526 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
7527 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
7527 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
7528 | 7528 | } |
7529 | 7529 | |
7530 | 7530 | return $str; |
@@ -7558,7 +7558,7 @@ discard block |
||
7558 | 7558 | $subject, |
7559 | 7559 | $replace, |
7560 | 7560 | $pos, |
7561 | - (int) self::strlen($search) |
|
7561 | + (int)self::strlen($search) |
|
7562 | 7562 | ); |
7563 | 7563 | } |
7564 | 7564 | |
@@ -7592,7 +7592,7 @@ discard block |
||
7592 | 7592 | $subject, |
7593 | 7593 | $replace, |
7594 | 7594 | $pos, |
7595 | - (int) self::strlen($search) |
|
7595 | + (int)self::strlen($search) |
|
7596 | 7596 | ); |
7597 | 7597 | } |
7598 | 7598 | |
@@ -7615,7 +7615,7 @@ discard block |
||
7615 | 7615 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
7616 | 7616 | { |
7617 | 7617 | if ($encoding === 'UTF-8') { |
7618 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
7618 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
7619 | 7619 | /** @noinspection NonSecureShuffleUsageInspection */ |
7620 | 7620 | \shuffle($indexes); |
7621 | 7621 | |
@@ -7631,7 +7631,7 @@ discard block |
||
7631 | 7631 | } else { |
7632 | 7632 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7633 | 7633 | |
7634 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
7634 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
7635 | 7635 | /** @noinspection NonSecureShuffleUsageInspection */ |
7636 | 7636 | \shuffle($indexes); |
7637 | 7637 | |
@@ -7674,11 +7674,11 @@ discard block |
||
7674 | 7674 | ) { |
7675 | 7675 | if ($encoding === 'UTF-8') { |
7676 | 7676 | if ($end === null) { |
7677 | - $length = (int) \mb_strlen($str); |
|
7677 | + $length = (int)\mb_strlen($str); |
|
7678 | 7678 | } elseif ($end >= 0 && $end <= $start) { |
7679 | 7679 | return ''; |
7680 | 7680 | } elseif ($end < 0) { |
7681 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7681 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7682 | 7682 | } else { |
7683 | 7683 | $length = $end - $start; |
7684 | 7684 | } |
@@ -7689,11 +7689,11 @@ discard block |
||
7689 | 7689 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7690 | 7690 | |
7691 | 7691 | if ($end === null) { |
7692 | - $length = (int) self::strlen($str, $encoding); |
|
7692 | + $length = (int)self::strlen($str, $encoding); |
|
7693 | 7693 | } elseif ($end >= 0 && $end <= $start) { |
7694 | 7694 | return ''; |
7695 | 7695 | } elseif ($end < 0) { |
7696 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7696 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7697 | 7697 | } else { |
7698 | 7698 | $length = $end - $start; |
7699 | 7699 | } |
@@ -7728,7 +7728,7 @@ discard block |
||
7728 | 7728 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7729 | 7729 | } |
7730 | 7730 | |
7731 | - $str = (string) \preg_replace_callback( |
|
7731 | + $str = (string)\preg_replace_callback( |
|
7732 | 7732 | '/([\\p{N}|\\p{Lu}])/u', |
7733 | 7733 | /** |
7734 | 7734 | * @param string[] $matches |
@@ -7737,28 +7737,28 @@ discard block |
||
7737 | 7737 | * |
7738 | 7738 | * @return string |
7739 | 7739 | */ |
7740 | - static function (array $matches) use ($encoding): string { |
|
7740 | + static function(array $matches) use ($encoding): string { |
|
7741 | 7741 | $match = $matches[1]; |
7742 | - $match_int = (int) $match; |
|
7742 | + $match_int = (int)$match; |
|
7743 | 7743 | |
7744 | - if ((string) $match_int === $match) { |
|
7745 | - return '_' . $match . '_'; |
|
7744 | + if ((string)$match_int === $match) { |
|
7745 | + return '_'.$match.'_'; |
|
7746 | 7746 | } |
7747 | 7747 | |
7748 | 7748 | if ($encoding === 'UTF-8') { |
7749 | - return '_' . \mb_strtolower($match); |
|
7749 | + return '_'.\mb_strtolower($match); |
|
7750 | 7750 | } |
7751 | 7751 | |
7752 | - return '_' . self::strtolower($match, $encoding); |
|
7752 | + return '_'.self::strtolower($match, $encoding); |
|
7753 | 7753 | }, |
7754 | 7754 | $str |
7755 | 7755 | ); |
7756 | 7756 | |
7757 | - $str = (string) \preg_replace( |
|
7757 | + $str = (string)\preg_replace( |
|
7758 | 7758 | [ |
7759 | - '/\\s+/u', // convert spaces to "_" |
|
7759 | + '/\\s+/u', // convert spaces to "_" |
|
7760 | 7760 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
7761 | - '/_+/', // remove double "_" |
|
7761 | + '/_+/', // remove double "_" |
|
7762 | 7762 | ], |
7763 | 7763 | [ |
7764 | 7764 | '_', |
@@ -7840,7 +7840,7 @@ discard block |
||
7840 | 7840 | } |
7841 | 7841 | |
7842 | 7842 | // init |
7843 | - $str = (string) $str; |
|
7843 | + $str = (string)$str; |
|
7844 | 7844 | |
7845 | 7845 | if ($str === '') { |
7846 | 7846 | return []; |
@@ -7897,7 +7897,7 @@ discard block |
||
7897 | 7897 | ($str[$i] & "\xE0") === "\xC0" |
7898 | 7898 | ) { |
7899 | 7899 | if (($str[$i + 1] & "\xC0") === "\x80") { |
7900 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
7900 | + $ret[] = $str[$i].$str[$i + 1]; |
|
7901 | 7901 | |
7902 | 7902 | ++$i; |
7903 | 7903 | } |
@@ -7911,7 +7911,7 @@ discard block |
||
7911 | 7911 | && |
7912 | 7912 | ($str[$i + 2] & "\xC0") === "\x80" |
7913 | 7913 | ) { |
7914 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
7914 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
7915 | 7915 | |
7916 | 7916 | $i += 2; |
7917 | 7917 | } |
@@ -7927,7 +7927,7 @@ discard block |
||
7927 | 7927 | && |
7928 | 7928 | ($str[$i + 3] & "\xC0") === "\x80" |
7929 | 7929 | ) { |
7930 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
7930 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
7931 | 7931 | |
7932 | 7932 | $i += 3; |
7933 | 7933 | } |
@@ -7939,7 +7939,7 @@ discard block |
||
7939 | 7939 | $ret = \array_chunk($ret, $length); |
7940 | 7940 | |
7941 | 7941 | return \array_map( |
7942 | - static function (array &$item): string { |
|
7942 | + static function(array &$item): string { |
|
7943 | 7943 | return \implode('', $item); |
7944 | 7944 | }, |
7945 | 7945 | $ret |
@@ -8005,7 +8005,7 @@ discard block |
||
8005 | 8005 | $limit = -1; |
8006 | 8006 | } |
8007 | 8007 | |
8008 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
8008 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
8009 | 8009 | |
8010 | 8010 | if ($array === false) { |
8011 | 8011 | return []; |
@@ -8095,9 +8095,9 @@ discard block |
||
8095 | 8095 | return ''; |
8096 | 8096 | } |
8097 | 8097 | |
8098 | - return (string) \mb_substr( |
|
8098 | + return (string)\mb_substr( |
|
8099 | 8099 | $str, |
8100 | - $offset + (int) \mb_strlen($separator) |
|
8100 | + $offset + (int)\mb_strlen($separator) |
|
8101 | 8101 | ); |
8102 | 8102 | } |
8103 | 8103 | |
@@ -8106,9 +8106,9 @@ discard block |
||
8106 | 8106 | return ''; |
8107 | 8107 | } |
8108 | 8108 | |
8109 | - return (string) \mb_substr( |
|
8109 | + return (string)\mb_substr( |
|
8110 | 8110 | $str, |
8111 | - $offset + (int) self::strlen($separator, $encoding), |
|
8111 | + $offset + (int)self::strlen($separator, $encoding), |
|
8112 | 8112 | null, |
8113 | 8113 | $encoding |
8114 | 8114 | ); |
@@ -8137,9 +8137,9 @@ discard block |
||
8137 | 8137 | return ''; |
8138 | 8138 | } |
8139 | 8139 | |
8140 | - return (string) \mb_substr( |
|
8140 | + return (string)\mb_substr( |
|
8141 | 8141 | $str, |
8142 | - $offset + (int) \mb_strlen($separator) |
|
8142 | + $offset + (int)\mb_strlen($separator) |
|
8143 | 8143 | ); |
8144 | 8144 | } |
8145 | 8145 | |
@@ -8148,9 +8148,9 @@ discard block |
||
8148 | 8148 | return ''; |
8149 | 8149 | } |
8150 | 8150 | |
8151 | - return (string) self::substr( |
|
8151 | + return (string)self::substr( |
|
8152 | 8152 | $str, |
8153 | - $offset + (int) self::strlen($separator, $encoding), |
|
8153 | + $offset + (int)self::strlen($separator, $encoding), |
|
8154 | 8154 | null, |
8155 | 8155 | $encoding |
8156 | 8156 | ); |
@@ -8182,7 +8182,7 @@ discard block |
||
8182 | 8182 | return ''; |
8183 | 8183 | } |
8184 | 8184 | |
8185 | - return (string) \mb_substr( |
|
8185 | + return (string)\mb_substr( |
|
8186 | 8186 | $str, |
8187 | 8187 | 0, |
8188 | 8188 | $offset |
@@ -8194,7 +8194,7 @@ discard block |
||
8194 | 8194 | return ''; |
8195 | 8195 | } |
8196 | 8196 | |
8197 | - return (string) self::substr( |
|
8197 | + return (string)self::substr( |
|
8198 | 8198 | $str, |
8199 | 8199 | 0, |
8200 | 8200 | $offset, |
@@ -8225,7 +8225,7 @@ discard block |
||
8225 | 8225 | return ''; |
8226 | 8226 | } |
8227 | 8227 | |
8228 | - return (string) \mb_substr( |
|
8228 | + return (string)\mb_substr( |
|
8229 | 8229 | $str, |
8230 | 8230 | 0, |
8231 | 8231 | $offset |
@@ -8239,7 +8239,7 @@ discard block |
||
8239 | 8239 | |
8240 | 8240 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8241 | 8241 | |
8242 | - return (string) self::substr( |
|
8242 | + return (string)self::substr( |
|
8243 | 8243 | $str, |
8244 | 8244 | 0, |
8245 | 8245 | $offset, |
@@ -8354,7 +8354,7 @@ discard block |
||
8354 | 8354 | */ |
8355 | 8355 | public static function str_surround(string $str, string $substring): string |
8356 | 8356 | { |
8357 | - return $substring . $str . $substring; |
|
8357 | + return $substring.$str.$substring; |
|
8358 | 8358 | } |
8359 | 8359 | |
8360 | 8360 | /** |
@@ -8416,9 +8416,9 @@ discard block |
||
8416 | 8416 | $word_define_chars = ''; |
8417 | 8417 | } |
8418 | 8418 | |
8419 | - $str = (string) \preg_replace_callback( |
|
8420 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
8421 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
8419 | + $str = (string)\preg_replace_callback( |
|
8420 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
8421 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
8422 | 8422 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
8423 | 8423 | return $match[0]; |
8424 | 8424 | } |
@@ -8517,16 +8517,16 @@ discard block |
||
8517 | 8517 | } |
8518 | 8518 | |
8519 | 8519 | // the main substitutions |
8520 | - $str = (string) \preg_replace_callback( |
|
8520 | + $str = (string)\preg_replace_callback( |
|
8521 | 8521 | '~\\b (_*) (?: # 1. Leading underscore and |
8522 | 8522 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
8523 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
8523 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
8524 | 8524 | | |
8525 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
8525 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
8526 | 8526 | | |
8527 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
8527 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
8528 | 8528 | | |
8529 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
8529 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
8530 | 8530 | ) (_*) \\b # 6. With trailing underscore |
8531 | 8531 | ~ux', |
8532 | 8532 | /** |
@@ -8536,7 +8536,7 @@ discard block |
||
8536 | 8536 | * |
8537 | 8537 | * @return string |
8538 | 8538 | */ |
8539 | - static function (array $matches) use ($encoding): string { |
|
8539 | + static function(array $matches) use ($encoding): string { |
|
8540 | 8540 | // preserve leading underscore |
8541 | 8541 | $str = $matches[1]; |
8542 | 8542 | if ($matches[2]) { |
@@ -8561,11 +8561,11 @@ discard block |
||
8561 | 8561 | ); |
8562 | 8562 | |
8563 | 8563 | // Exceptions for small words: capitalize at start of title... |
8564 | - $str = (string) \preg_replace_callback( |
|
8564 | + $str = (string)\preg_replace_callback( |
|
8565 | 8565 | '~( \\A [[:punct:]]* # start of title... |
8566 | 8566 | | [:.;?!][ ]+ # or of subsentence... |
8567 | 8567 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
8568 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
8568 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
8569 | 8569 | ~uxi', |
8570 | 8570 | /** |
8571 | 8571 | * @param string[] $matches |
@@ -8574,15 +8574,15 @@ discard block |
||
8574 | 8574 | * |
8575 | 8575 | * @return string |
8576 | 8576 | */ |
8577 | - static function (array $matches) use ($encoding): string { |
|
8578 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
8577 | + static function(array $matches) use ($encoding): string { |
|
8578 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
8579 | 8579 | }, |
8580 | 8580 | $str |
8581 | 8581 | ); |
8582 | 8582 | |
8583 | 8583 | // ...and end of title |
8584 | - $str = (string) \preg_replace_callback( |
|
8585 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
8584 | + $str = (string)\preg_replace_callback( |
|
8585 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
8586 | 8586 | (?= [[:punct:]]* \Z # ...at the end of the title... |
8587 | 8587 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
8588 | 8588 | ~uxi', |
@@ -8593,7 +8593,7 @@ discard block |
||
8593 | 8593 | * |
8594 | 8594 | * @return string |
8595 | 8595 | */ |
8596 | - static function (array $matches) use ($encoding): string { |
|
8596 | + static function(array $matches) use ($encoding): string { |
|
8597 | 8597 | return static::ucfirst($matches[1], $encoding); |
8598 | 8598 | }, |
8599 | 8599 | $str |
@@ -8601,10 +8601,10 @@ discard block |
||
8601 | 8601 | |
8602 | 8602 | // Exceptions for small words in hyphenated compound words. |
8603 | 8603 | // e.g. "in-flight" -> In-Flight |
8604 | - $str = (string) \preg_replace_callback( |
|
8604 | + $str = (string)\preg_replace_callback( |
|
8605 | 8605 | '~\\b |
8606 | 8606 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
8607 | - ( ' . $small_words_rx . ' ) |
|
8607 | + ( ' . $small_words_rx.' ) |
|
8608 | 8608 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
8609 | 8609 | ~uxi', |
8610 | 8610 | /** |
@@ -8614,18 +8614,18 @@ discard block |
||
8614 | 8614 | * |
8615 | 8615 | * @return string |
8616 | 8616 | */ |
8617 | - static function (array $matches) use ($encoding): string { |
|
8617 | + static function(array $matches) use ($encoding): string { |
|
8618 | 8618 | return static::ucfirst($matches[1], $encoding); |
8619 | 8619 | }, |
8620 | 8620 | $str |
8621 | 8621 | ); |
8622 | 8622 | |
8623 | 8623 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
8624 | - $str = (string) \preg_replace_callback( |
|
8624 | + $str = (string)\preg_replace_callback( |
|
8625 | 8625 | '~\\b |
8626 | 8626 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
8627 | 8627 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
8628 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
8628 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
8629 | 8629 | (?! - ) # Negative lookahead for another - |
8630 | 8630 | ~uxi', |
8631 | 8631 | /** |
@@ -8635,8 +8635,8 @@ discard block |
||
8635 | 8635 | * |
8636 | 8636 | * @return string |
8637 | 8637 | */ |
8638 | - static function (array $matches) use ($encoding): string { |
|
8639 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
8638 | + static function(array $matches) use ($encoding): string { |
|
8639 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
8640 | 8640 | }, |
8641 | 8641 | $str |
8642 | 8642 | ); |
@@ -8751,7 +8751,7 @@ discard block |
||
8751 | 8751 | ); |
8752 | 8752 | |
8753 | 8753 | foreach ($tmp_return as &$item) { |
8754 | - $item = (string) $item; |
|
8754 | + $item = (string)$item; |
|
8755 | 8755 | } |
8756 | 8756 | |
8757 | 8757 | return $tmp_return; |
@@ -8805,39 +8805,39 @@ discard block |
||
8805 | 8805 | } |
8806 | 8806 | |
8807 | 8807 | if ($encoding === 'UTF-8') { |
8808 | - if ($length >= (int) \mb_strlen($str)) { |
|
8808 | + if ($length >= (int)\mb_strlen($str)) { |
|
8809 | 8809 | return $str; |
8810 | 8810 | } |
8811 | 8811 | |
8812 | 8812 | if ($substring !== '') { |
8813 | - $length -= (int) \mb_strlen($substring); |
|
8813 | + $length -= (int)\mb_strlen($substring); |
|
8814 | 8814 | |
8815 | 8815 | /** @noinspection UnnecessaryCastingInspection */ |
8816 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8816 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8817 | 8817 | } |
8818 | 8818 | |
8819 | 8819 | /** @noinspection UnnecessaryCastingInspection */ |
8820 | - return (string) \mb_substr($str, 0, $length); |
|
8820 | + return (string)\mb_substr($str, 0, $length); |
|
8821 | 8821 | } |
8822 | 8822 | |
8823 | 8823 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8824 | 8824 | |
8825 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8825 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8826 | 8826 | return $str; |
8827 | 8827 | } |
8828 | 8828 | |
8829 | 8829 | if ($substring !== '') { |
8830 | - $length -= (int) self::strlen($substring, $encoding); |
|
8830 | + $length -= (int)self::strlen($substring, $encoding); |
|
8831 | 8831 | } |
8832 | 8832 | |
8833 | 8833 | return ( |
8834 | - (string) self::substr( |
|
8834 | + (string)self::substr( |
|
8835 | 8835 | $str, |
8836 | 8836 | 0, |
8837 | 8837 | $length, |
8838 | 8838 | $encoding |
8839 | 8839 | ) |
8840 | - ) . $substring; |
|
8840 | + ).$substring; |
|
8841 | 8841 | } |
8842 | 8842 | |
8843 | 8843 | /** |
@@ -8871,12 +8871,12 @@ discard block |
||
8871 | 8871 | } |
8872 | 8872 | |
8873 | 8873 | if ($encoding === 'UTF-8') { |
8874 | - if ($length >= (int) \mb_strlen($str)) { |
|
8874 | + if ($length >= (int)\mb_strlen($str)) { |
|
8875 | 8875 | return $str; |
8876 | 8876 | } |
8877 | 8877 | |
8878 | 8878 | // need to further trim the string so we can append the substring |
8879 | - $length -= (int) \mb_strlen($substring); |
|
8879 | + $length -= (int)\mb_strlen($substring); |
|
8880 | 8880 | if ($length <= 0) { |
8881 | 8881 | return $substring; |
8882 | 8882 | } |
@@ -8898,18 +8898,18 @@ discard block |
||
8898 | 8898 | || |
8899 | 8899 | ($space_position !== false && $ignore_do_not_split_words_for_one_word === false) |
8900 | 8900 | ) { |
8901 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
8901 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
8902 | 8902 | } |
8903 | 8903 | } |
8904 | 8904 | } else { |
8905 | 8905 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8906 | 8906 | |
8907 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8907 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8908 | 8908 | return $str; |
8909 | 8909 | } |
8910 | 8910 | |
8911 | 8911 | // need to further trim the string so we can append the substring |
8912 | - $length -= (int) self::strlen($substring, $encoding); |
|
8912 | + $length -= (int)self::strlen($substring, $encoding); |
|
8913 | 8913 | if ($length <= 0) { |
8914 | 8914 | return $substring; |
8915 | 8915 | } |
@@ -8931,12 +8931,12 @@ discard block |
||
8931 | 8931 | || |
8932 | 8932 | ($space_position !== false && $ignore_do_not_split_words_for_one_word === false) |
8933 | 8933 | ) { |
8934 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
8934 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
8935 | 8935 | } |
8936 | 8936 | } |
8937 | 8937 | } |
8938 | 8938 | |
8939 | - return $truncated . $substring; |
|
8939 | + return $truncated.$substring; |
|
8940 | 8940 | } |
8941 | 8941 | |
8942 | 8942 | /** |
@@ -9045,13 +9045,13 @@ discard block |
||
9045 | 9045 | } |
9046 | 9046 | } elseif ($format === 2) { |
9047 | 9047 | $number_of_words = []; |
9048 | - $offset = (int) self::strlen($str_parts[0]); |
|
9048 | + $offset = (int)self::strlen($str_parts[0]); |
|
9049 | 9049 | for ($i = 1; $i < $len; $i += 2) { |
9050 | 9050 | $number_of_words[$offset] = $str_parts[$i]; |
9051 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
9051 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
9052 | 9052 | } |
9053 | 9053 | } else { |
9054 | - $number_of_words = (int) (($len - 1) / 2); |
|
9054 | + $number_of_words = (int)(($len - 1) / 2); |
|
9055 | 9055 | } |
9056 | 9056 | |
9057 | 9057 | return $number_of_words; |
@@ -9180,21 +9180,21 @@ discard block |
||
9180 | 9180 | } |
9181 | 9181 | |
9182 | 9182 | if ($char_list === '') { |
9183 | - return (int) self::strlen($str, $encoding); |
|
9183 | + return (int)self::strlen($str, $encoding); |
|
9184 | 9184 | } |
9185 | 9185 | |
9186 | 9186 | if ($offset !== null || $length !== null) { |
9187 | 9187 | if ($encoding === 'UTF-8') { |
9188 | 9188 | if ($length === null) { |
9189 | 9189 | /** @noinspection UnnecessaryCastingInspection */ |
9190 | - $str_tmp = \mb_substr($str, (int) $offset); |
|
9190 | + $str_tmp = \mb_substr($str, (int)$offset); |
|
9191 | 9191 | } else { |
9192 | 9192 | /** @noinspection UnnecessaryCastingInspection */ |
9193 | - $str_tmp = \mb_substr($str, (int) $offset, $length); |
|
9193 | + $str_tmp = \mb_substr($str, (int)$offset, $length); |
|
9194 | 9194 | } |
9195 | 9195 | } else { |
9196 | 9196 | /** @noinspection UnnecessaryCastingInspection */ |
9197 | - $str_tmp = self::substr($str, (int) $offset, $length, $encoding); |
|
9197 | + $str_tmp = self::substr($str, (int)$offset, $length, $encoding); |
|
9198 | 9198 | } |
9199 | 9199 | |
9200 | 9200 | if ($str_tmp === false) { |
@@ -9210,7 +9210,7 @@ discard block |
||
9210 | 9210 | } |
9211 | 9211 | |
9212 | 9212 | $matches = []; |
9213 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
9213 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
9214 | 9214 | $return = self::strlen($matches[1], $encoding); |
9215 | 9215 | if ($return === false) { |
9216 | 9216 | return 0; |
@@ -9219,7 +9219,7 @@ discard block |
||
9219 | 9219 | return $return; |
9220 | 9220 | } |
9221 | 9221 | |
9222 | - return (int) self::strlen($str, $encoding); |
|
9222 | + return (int)self::strlen($str, $encoding); |
|
9223 | 9223 | } |
9224 | 9224 | |
9225 | 9225 | /** |
@@ -9274,7 +9274,7 @@ discard block |
||
9274 | 9274 | |
9275 | 9275 | $str = ''; |
9276 | 9276 | foreach ($array as $strPart) { |
9277 | - $str .= '&#' . (int) $strPart . ';'; |
|
9277 | + $str .= '&#'.(int)$strPart.';'; |
|
9278 | 9278 | } |
9279 | 9279 | |
9280 | 9280 | return self::html_entity_decode($str, \ENT_QUOTES | \ENT_HTML5); |
@@ -9363,7 +9363,7 @@ discard block |
||
9363 | 9363 | return ''; |
9364 | 9364 | } |
9365 | 9365 | |
9366 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
9366 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
9367 | 9367 | } |
9368 | 9368 | |
9369 | 9369 | /** |
@@ -9430,7 +9430,7 @@ discard block |
||
9430 | 9430 | // fallback for ascii only |
9431 | 9431 | // |
9432 | 9432 | |
9433 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9433 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9434 | 9434 | return \stripos($haystack, $needle, $offset); |
9435 | 9435 | } |
9436 | 9436 | |
@@ -9503,7 +9503,7 @@ discard block |
||
9503 | 9503 | /** |
9504 | 9504 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
9505 | 9505 | */ |
9506 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9506 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9507 | 9507 | } |
9508 | 9508 | |
9509 | 9509 | if ( |
@@ -9517,11 +9517,11 @@ discard block |
||
9517 | 9517 | } |
9518 | 9518 | } |
9519 | 9519 | |
9520 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
9520 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
9521 | 9521 | return \stristr($haystack, $needle, $before_needle); |
9522 | 9522 | } |
9523 | 9523 | |
9524 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
9524 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
9525 | 9525 | |
9526 | 9526 | if (!isset($match[1])) { |
9527 | 9527 | return false; |
@@ -9531,7 +9531,7 @@ discard block |
||
9531 | 9531 | return $match[1]; |
9532 | 9532 | } |
9533 | 9533 | |
9534 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
9534 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
9535 | 9535 | } |
9536 | 9536 | |
9537 | 9537 | /** |
@@ -9608,7 +9608,7 @@ discard block |
||
9608 | 9608 | /** |
9609 | 9609 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
9610 | 9610 | */ |
9611 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9611 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9612 | 9612 | } |
9613 | 9613 | |
9614 | 9614 | // |
@@ -9730,8 +9730,8 @@ discard block |
||
9730 | 9730 | } |
9731 | 9731 | |
9732 | 9732 | return \strnatcmp( |
9733 | - (string) self::strtonatfold($str1), |
|
9734 | - (string) self::strtonatfold($str2) |
|
9733 | + (string)self::strtonatfold($str1), |
|
9734 | + (string)self::strtonatfold($str2) |
|
9735 | 9735 | ); |
9736 | 9736 | } |
9737 | 9737 | |
@@ -9793,11 +9793,11 @@ discard block |
||
9793 | 9793 | } |
9794 | 9794 | |
9795 | 9795 | if ($encoding === 'UTF-8') { |
9796 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
9797 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
9796 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
9797 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
9798 | 9798 | } else { |
9799 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
9800 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
9799 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
9800 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
9801 | 9801 | } |
9802 | 9802 | |
9803 | 9803 | return self::strcmp($str1, $str2); |
@@ -9821,8 +9821,8 @@ discard block |
||
9821 | 9821 | return false; |
9822 | 9822 | } |
9823 | 9823 | |
9824 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
9825 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
9824 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
9825 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
9826 | 9826 | } |
9827 | 9827 | |
9828 | 9828 | return false; |
@@ -9857,10 +9857,10 @@ discard block |
||
9857 | 9857 | } |
9858 | 9858 | |
9859 | 9859 | // iconv and mbstring do not support integer $needle |
9860 | - if ((int) $needle === $needle) { |
|
9861 | - $needle = (string) self::chr($needle); |
|
9860 | + if ((int)$needle === $needle) { |
|
9861 | + $needle = (string)self::chr($needle); |
|
9862 | 9862 | } |
9863 | - $needle = (string) $needle; |
|
9863 | + $needle = (string)$needle; |
|
9864 | 9864 | |
9865 | 9865 | if ($needle === '') { |
9866 | 9866 | return false; |
@@ -9910,7 +9910,7 @@ discard block |
||
9910 | 9910 | /** |
9911 | 9911 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
9912 | 9912 | */ |
9913 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9913 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9914 | 9914 | } |
9915 | 9915 | |
9916 | 9916 | // |
@@ -9951,7 +9951,7 @@ discard block |
||
9951 | 9951 | // fallback for ascii only |
9952 | 9952 | // |
9953 | 9953 | |
9954 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9954 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9955 | 9955 | return \strpos($haystack, $needle, $offset); |
9956 | 9956 | } |
9957 | 9957 | |
@@ -9963,7 +9963,7 @@ discard block |
||
9963 | 9963 | if ($haystack_tmp === false) { |
9964 | 9964 | $haystack_tmp = ''; |
9965 | 9965 | } |
9966 | - $haystack = (string) $haystack_tmp; |
|
9966 | + $haystack = (string)$haystack_tmp; |
|
9967 | 9967 | |
9968 | 9968 | if ($offset < 0) { |
9969 | 9969 | $offset = 0; |
@@ -9975,7 +9975,7 @@ discard block |
||
9975 | 9975 | } |
9976 | 9976 | |
9977 | 9977 | if ($pos) { |
9978 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9978 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9979 | 9979 | } |
9980 | 9980 | |
9981 | 9981 | return $offset + 0; |
@@ -10093,7 +10093,7 @@ discard block |
||
10093 | 10093 | /** |
10094 | 10094 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10095 | 10095 | */ |
10096 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10096 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10097 | 10097 | } |
10098 | 10098 | |
10099 | 10099 | // |
@@ -10105,7 +10105,7 @@ discard block |
||
10105 | 10105 | if ($needle_tmp === false) { |
10106 | 10106 | return false; |
10107 | 10107 | } |
10108 | - $needle = (string) $needle_tmp; |
|
10108 | + $needle = (string)$needle_tmp; |
|
10109 | 10109 | |
10110 | 10110 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
10111 | 10111 | if ($pos === false) { |
@@ -10127,7 +10127,7 @@ discard block |
||
10127 | 10127 | if ($needle_tmp === false) { |
10128 | 10128 | return false; |
10129 | 10129 | } |
10130 | - $needle = (string) $needle_tmp; |
|
10130 | + $needle = (string)$needle_tmp; |
|
10131 | 10131 | |
10132 | 10132 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
10133 | 10133 | if ($pos === false) { |
@@ -10165,7 +10165,7 @@ discard block |
||
10165 | 10165 | if ($encoding === 'UTF-8') { |
10166 | 10166 | if (self::$SUPPORT['intl'] === true) { |
10167 | 10167 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
10168 | - $i = (int) \grapheme_strlen($str); |
|
10168 | + $i = (int)\grapheme_strlen($str); |
|
10169 | 10169 | while ($i--) { |
10170 | 10170 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
10171 | 10171 | if ($reversed_tmp !== false) { |
@@ -10173,7 +10173,7 @@ discard block |
||
10173 | 10173 | } |
10174 | 10174 | } |
10175 | 10175 | } else { |
10176 | - $i = (int) \mb_strlen($str); |
|
10176 | + $i = (int)\mb_strlen($str); |
|
10177 | 10177 | while ($i--) { |
10178 | 10178 | $reversed_tmp = \mb_substr($str, $i, 1); |
10179 | 10179 | if ($reversed_tmp !== false) { |
@@ -10184,7 +10184,7 @@ discard block |
||
10184 | 10184 | } else { |
10185 | 10185 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10186 | 10186 | |
10187 | - $i = (int) self::strlen($str, $encoding); |
|
10187 | + $i = (int)self::strlen($str, $encoding); |
|
10188 | 10188 | while ($i--) { |
10189 | 10189 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
10190 | 10190 | if ($reversed_tmp !== false) { |
@@ -10260,7 +10260,7 @@ discard block |
||
10260 | 10260 | if ($needle_tmp === false) { |
10261 | 10261 | return false; |
10262 | 10262 | } |
10263 | - $needle = (string) $needle_tmp; |
|
10263 | + $needle = (string)$needle_tmp; |
|
10264 | 10264 | |
10265 | 10265 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
10266 | 10266 | if ($pos === false) { |
@@ -10301,10 +10301,10 @@ discard block |
||
10301 | 10301 | } |
10302 | 10302 | |
10303 | 10303 | // iconv and mbstring do not support integer $needle |
10304 | - if ((int) $needle === $needle && $needle >= 0) { |
|
10305 | - $needle = (string) self::chr($needle); |
|
10304 | + if ((int)$needle === $needle && $needle >= 0) { |
|
10305 | + $needle = (string)self::chr($needle); |
|
10306 | 10306 | } |
10307 | - $needle = (string) $needle; |
|
10307 | + $needle = (string)$needle; |
|
10308 | 10308 | |
10309 | 10309 | if ($needle === '') { |
10310 | 10310 | return false; |
@@ -10352,7 +10352,7 @@ discard block |
||
10352 | 10352 | /** |
10353 | 10353 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10354 | 10354 | */ |
10355 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10355 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10356 | 10356 | } |
10357 | 10357 | |
10358 | 10358 | // |
@@ -10376,7 +10376,7 @@ discard block |
||
10376 | 10376 | // fallback for ascii only |
10377 | 10377 | // |
10378 | 10378 | |
10379 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10379 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10380 | 10380 | return \strripos($haystack, $needle, $offset); |
10381 | 10381 | } |
10382 | 10382 | |
@@ -10457,10 +10457,10 @@ discard block |
||
10457 | 10457 | } |
10458 | 10458 | |
10459 | 10459 | // iconv and mbstring do not support integer $needle |
10460 | - if ((int) $needle === $needle && $needle >= 0) { |
|
10461 | - $needle = (string) self::chr($needle); |
|
10460 | + if ((int)$needle === $needle && $needle >= 0) { |
|
10461 | + $needle = (string)self::chr($needle); |
|
10462 | 10462 | } |
10463 | - $needle = (string) $needle; |
|
10463 | + $needle = (string)$needle; |
|
10464 | 10464 | |
10465 | 10465 | if ($needle === '') { |
10466 | 10466 | return false; |
@@ -10508,7 +10508,7 @@ discard block |
||
10508 | 10508 | /** |
10509 | 10509 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10510 | 10510 | */ |
10511 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10511 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10512 | 10512 | } |
10513 | 10513 | |
10514 | 10514 | // |
@@ -10532,7 +10532,7 @@ discard block |
||
10532 | 10532 | // fallback for ascii only |
10533 | 10533 | // |
10534 | 10534 | |
10535 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10535 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10536 | 10536 | return \strrpos($haystack, $needle, $offset); |
10537 | 10537 | } |
10538 | 10538 | |
@@ -10552,7 +10552,7 @@ discard block |
||
10552 | 10552 | if ($haystack_tmp === false) { |
10553 | 10553 | $haystack_tmp = ''; |
10554 | 10554 | } |
10555 | - $haystack = (string) $haystack_tmp; |
|
10555 | + $haystack = (string)$haystack_tmp; |
|
10556 | 10556 | } |
10557 | 10557 | |
10558 | 10558 | $pos = \strrpos($haystack, $needle); |
@@ -10566,7 +10566,7 @@ discard block |
||
10566 | 10566 | return false; |
10567 | 10567 | } |
10568 | 10568 | |
10569 | - return $offset + (int) self::strlen($str_tmp); |
|
10569 | + return $offset + (int)self::strlen($str_tmp); |
|
10570 | 10570 | } |
10571 | 10571 | |
10572 | 10572 | /** |
@@ -10632,12 +10632,12 @@ discard block |
||
10632 | 10632 | if ($offset || $length !== null) { |
10633 | 10633 | if ($encoding === 'UTF-8') { |
10634 | 10634 | if ($length === null) { |
10635 | - $str = (string) \mb_substr($str, $offset); |
|
10635 | + $str = (string)\mb_substr($str, $offset); |
|
10636 | 10636 | } else { |
10637 | - $str = (string) \mb_substr($str, $offset, $length); |
|
10637 | + $str = (string)\mb_substr($str, $offset, $length); |
|
10638 | 10638 | } |
10639 | 10639 | } else { |
10640 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
10640 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
10641 | 10641 | } |
10642 | 10642 | } |
10643 | 10643 | |
@@ -10647,7 +10647,7 @@ discard block |
||
10647 | 10647 | |
10648 | 10648 | $matches = []; |
10649 | 10649 | |
10650 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
10650 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
10651 | 10651 | } |
10652 | 10652 | |
10653 | 10653 | /** |
@@ -10721,7 +10721,7 @@ discard block |
||
10721 | 10721 | /** |
10722 | 10722 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10723 | 10723 | */ |
10724 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10724 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10725 | 10725 | } |
10726 | 10726 | |
10727 | 10727 | // |
@@ -10743,7 +10743,7 @@ discard block |
||
10743 | 10743 | // fallback for ascii only |
10744 | 10744 | // |
10745 | 10745 | |
10746 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10746 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10747 | 10747 | return \strstr($haystack, $needle, $before_needle); |
10748 | 10748 | } |
10749 | 10749 | |
@@ -10751,7 +10751,7 @@ discard block |
||
10751 | 10751 | // fallback via vanilla php |
10752 | 10752 | // |
10753 | 10753 | |
10754 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
10754 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
10755 | 10755 | |
10756 | 10756 | if (!isset($match[1])) { |
10757 | 10757 | return false; |
@@ -10761,7 +10761,7 @@ discard block |
||
10761 | 10761 | return $match[1]; |
10762 | 10762 | } |
10763 | 10763 | |
10764 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
10764 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
10765 | 10765 | } |
10766 | 10766 | |
10767 | 10767 | /** |
@@ -10887,7 +10887,7 @@ discard block |
||
10887 | 10887 | bool $try_to_keep_the_string_length = false |
10888 | 10888 | ): string { |
10889 | 10889 | // init |
10890 | - $str = (string) $str; |
|
10890 | + $str = (string)$str; |
|
10891 | 10891 | |
10892 | 10892 | if ($str === '') { |
10893 | 10893 | return ''; |
@@ -10916,25 +10916,25 @@ discard block |
||
10916 | 10916 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10917 | 10917 | } |
10918 | 10918 | |
10919 | - $language_code = $lang . '-Lower'; |
|
10919 | + $language_code = $lang.'-Lower'; |
|
10920 | 10920 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10921 | 10921 | /** |
10922 | 10922 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10923 | 10923 | */ |
10924 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
10924 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
10925 | 10925 | |
10926 | 10926 | $language_code = 'Any-Lower'; |
10927 | 10927 | } |
10928 | 10928 | |
10929 | 10929 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10930 | 10930 | /** @noinspection UnnecessaryCastingInspection */ |
10931 | - return (string) \transliterator_transliterate($language_code, $str); |
|
10931 | + return (string)\transliterator_transliterate($language_code, $str); |
|
10932 | 10932 | } |
10933 | 10933 | |
10934 | 10934 | /** |
10935 | 10935 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10936 | 10936 | */ |
10937 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
10937 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
10938 | 10938 | } |
10939 | 10939 | |
10940 | 10940 | // always fallback via symfony polyfill |
@@ -10967,7 +10967,7 @@ discard block |
||
10967 | 10967 | bool $try_to_keep_the_string_length = false |
10968 | 10968 | ): string { |
10969 | 10969 | // init |
10970 | - $str = (string) $str; |
|
10970 | + $str = (string)$str; |
|
10971 | 10971 | |
10972 | 10972 | if ($str === '') { |
10973 | 10973 | return ''; |
@@ -10996,25 +10996,25 @@ discard block |
||
10996 | 10996 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10997 | 10997 | } |
10998 | 10998 | |
10999 | - $language_code = $lang . '-Upper'; |
|
10999 | + $language_code = $lang.'-Upper'; |
|
11000 | 11000 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
11001 | 11001 | /** |
11002 | 11002 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11003 | 11003 | */ |
11004 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
11004 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
11005 | 11005 | |
11006 | 11006 | $language_code = 'Any-Upper'; |
11007 | 11007 | } |
11008 | 11008 | |
11009 | 11009 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11010 | 11010 | /** @noinspection UnnecessaryCastingInspection */ |
11011 | - return (string) \transliterator_transliterate($language_code, $str); |
|
11011 | + return (string)\transliterator_transliterate($language_code, $str); |
|
11012 | 11012 | } |
11013 | 11013 | |
11014 | 11014 | /** |
11015 | 11015 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11016 | 11016 | */ |
11017 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
11017 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
11018 | 11018 | } |
11019 | 11019 | |
11020 | 11020 | // always fallback via symfony polyfill |
@@ -11061,7 +11061,7 @@ discard block |
||
11061 | 11061 | $from = \array_combine($from, $to); |
11062 | 11062 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
11063 | 11063 | if ($from === false) { |
11064 | - 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) . ')'); |
|
11064 | + 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).')'); |
|
11065 | 11065 | } |
11066 | 11066 | } |
11067 | 11067 | |
@@ -11123,9 +11123,9 @@ discard block |
||
11123 | 11123 | } |
11124 | 11124 | |
11125 | 11125 | $wide = 0; |
11126 | - $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); |
|
11126 | + $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); |
|
11127 | 11127 | |
11128 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
11128 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
11129 | 11129 | } |
11130 | 11130 | |
11131 | 11131 | /** |
@@ -11225,9 +11225,9 @@ discard block |
||
11225 | 11225 | } |
11226 | 11226 | |
11227 | 11227 | if ($length === null) { |
11228 | - $length = (int) $str_length; |
|
11228 | + $length = (int)$str_length; |
|
11229 | 11229 | } else { |
11230 | - $length = (int) $length; |
|
11230 | + $length = (int)$length; |
|
11231 | 11231 | } |
11232 | 11232 | |
11233 | 11233 | if ( |
@@ -11238,7 +11238,7 @@ discard block |
||
11238 | 11238 | /** |
11239 | 11239 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11240 | 11240 | */ |
11241 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11241 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11242 | 11242 | } |
11243 | 11243 | |
11244 | 11244 | // |
@@ -11328,16 +11328,16 @@ discard block |
||
11328 | 11328 | ) { |
11329 | 11329 | if ($encoding === 'UTF-8') { |
11330 | 11330 | if ($length === null) { |
11331 | - $str1 = (string) \mb_substr($str1, $offset); |
|
11331 | + $str1 = (string)\mb_substr($str1, $offset); |
|
11332 | 11332 | } else { |
11333 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
11333 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
11334 | 11334 | } |
11335 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
11335 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
11336 | 11336 | } else { |
11337 | 11337 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11338 | 11338 | |
11339 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
11340 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
11339 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
11340 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
11341 | 11341 | } |
11342 | 11342 | } |
11343 | 11343 | |
@@ -11401,13 +11401,13 @@ discard block |
||
11401 | 11401 | if ($length_tmp === false) { |
11402 | 11402 | return false; |
11403 | 11403 | } |
11404 | - $length = (int) $length_tmp; |
|
11404 | + $length = (int)$length_tmp; |
|
11405 | 11405 | } |
11406 | 11406 | |
11407 | 11407 | if ($encoding === 'UTF-8') { |
11408 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
11408 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
11409 | 11409 | } else { |
11410 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
11410 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
11411 | 11411 | } |
11412 | 11412 | } |
11413 | 11413 | |
@@ -11419,7 +11419,7 @@ discard block |
||
11419 | 11419 | /** |
11420 | 11420 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11421 | 11421 | */ |
11422 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11422 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11423 | 11423 | } |
11424 | 11424 | |
11425 | 11425 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -11430,7 +11430,7 @@ discard block |
||
11430 | 11430 | return \mb_substr_count($haystack, $needle, $encoding); |
11431 | 11431 | } |
11432 | 11432 | |
11433 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
11433 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
11434 | 11434 | |
11435 | 11435 | return \count($matches); |
11436 | 11436 | } |
@@ -11479,7 +11479,7 @@ discard block |
||
11479 | 11479 | if ($length_tmp === false) { |
11480 | 11480 | return false; |
11481 | 11481 | } |
11482 | - $length = (int) $length_tmp; |
|
11482 | + $length = (int)$length_tmp; |
|
11483 | 11483 | } |
11484 | 11484 | |
11485 | 11485 | if ( |
@@ -11501,7 +11501,7 @@ discard block |
||
11501 | 11501 | if ($haystack_tmp === false) { |
11502 | 11502 | $haystack_tmp = ''; |
11503 | 11503 | } |
11504 | - $haystack = (string) $haystack_tmp; |
|
11504 | + $haystack = (string)$haystack_tmp; |
|
11505 | 11505 | } |
11506 | 11506 | |
11507 | 11507 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -11542,10 +11542,10 @@ discard block |
||
11542 | 11542 | |
11543 | 11543 | if ($encoding === 'UTF-8') { |
11544 | 11544 | if ($case_sensitive) { |
11545 | - return (int) \mb_substr_count($str, $substring); |
|
11545 | + return (int)\mb_substr_count($str, $substring); |
|
11546 | 11546 | } |
11547 | 11547 | |
11548 | - return (int) \mb_substr_count( |
|
11548 | + return (int)\mb_substr_count( |
|
11549 | 11549 | \mb_strtoupper($str), |
11550 | 11550 | \mb_strtoupper($substring) |
11551 | 11551 | ); |
@@ -11554,10 +11554,10 @@ discard block |
||
11554 | 11554 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11555 | 11555 | |
11556 | 11556 | if ($case_sensitive) { |
11557 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
11557 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
11558 | 11558 | } |
11559 | 11559 | |
11560 | - return (int) \mb_substr_count( |
|
11560 | + return (int)\mb_substr_count( |
|
11561 | 11561 | self::strtocasefold($str, true, false, $encoding, null, false), |
11562 | 11562 | self::strtocasefold($substring, true, false, $encoding, null, false), |
11563 | 11563 | $encoding |
@@ -11585,7 +11585,7 @@ discard block |
||
11585 | 11585 | } |
11586 | 11586 | |
11587 | 11587 | if (self::str_istarts_with($haystack, $needle) === true) { |
11588 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
11588 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
11589 | 11589 | } |
11590 | 11590 | |
11591 | 11591 | return $haystack; |
@@ -11646,7 +11646,7 @@ discard block |
||
11646 | 11646 | } |
11647 | 11647 | |
11648 | 11648 | if (self::str_iends_with($haystack, $needle) === true) { |
11649 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
11649 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
11650 | 11650 | } |
11651 | 11651 | |
11652 | 11652 | return $haystack; |
@@ -11673,7 +11673,7 @@ discard block |
||
11673 | 11673 | } |
11674 | 11674 | |
11675 | 11675 | if (self::str_starts_with($haystack, $needle) === true) { |
11676 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
11676 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
11677 | 11677 | } |
11678 | 11678 | |
11679 | 11679 | return $haystack; |
@@ -11727,7 +11727,7 @@ discard block |
||
11727 | 11727 | if (\is_array($offset) === true) { |
11728 | 11728 | $offset = \array_slice($offset, 0, $num); |
11729 | 11729 | foreach ($offset as &$value_tmp) { |
11730 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
11730 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
11731 | 11731 | } |
11732 | 11732 | unset($value_tmp); |
11733 | 11733 | } else { |
@@ -11740,7 +11740,7 @@ discard block |
||
11740 | 11740 | } elseif (\is_array($length) === true) { |
11741 | 11741 | $length = \array_slice($length, 0, $num); |
11742 | 11742 | foreach ($length as &$value_tmp_V2) { |
11743 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
11743 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
11744 | 11744 | } |
11745 | 11745 | unset($value_tmp_V2); |
11746 | 11746 | } else { |
@@ -11760,8 +11760,8 @@ discard block |
||
11760 | 11760 | } |
11761 | 11761 | |
11762 | 11762 | // init |
11763 | - $str = (string) $str; |
|
11764 | - $replacement = (string) $replacement; |
|
11763 | + $str = (string)$str; |
|
11764 | + $replacement = (string)$replacement; |
|
11765 | 11765 | |
11766 | 11766 | if (\is_array($length) === true) { |
11767 | 11767 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -11776,16 +11776,16 @@ discard block |
||
11776 | 11776 | } |
11777 | 11777 | |
11778 | 11778 | if (self::$SUPPORT['mbstring'] === true) { |
11779 | - $string_length = (int) self::strlen($str, $encoding); |
|
11779 | + $string_length = (int)self::strlen($str, $encoding); |
|
11780 | 11780 | |
11781 | 11781 | if ($offset < 0) { |
11782 | - $offset = (int) \max(0, $string_length + $offset); |
|
11782 | + $offset = (int)\max(0, $string_length + $offset); |
|
11783 | 11783 | } elseif ($offset > $string_length) { |
11784 | 11784 | $offset = $string_length; |
11785 | 11785 | } |
11786 | 11786 | |
11787 | 11787 | if ($length !== null && $length < 0) { |
11788 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
11788 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
11789 | 11789 | } elseif ($length === null || $length > $string_length) { |
11790 | 11790 | $length = $string_length; |
11791 | 11791 | } |
@@ -11796,9 +11796,9 @@ discard block |
||
11796 | 11796 | } |
11797 | 11797 | |
11798 | 11798 | /** @noinspection AdditionOperationOnArraysInspection */ |
11799 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
11800 | - $replacement . |
|
11801 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
11799 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
11800 | + $replacement. |
|
11801 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
11802 | 11802 | } |
11803 | 11803 | |
11804 | 11804 | // |
@@ -11807,8 +11807,7 @@ discard block |
||
11807 | 11807 | |
11808 | 11808 | if (ASCII::is_ascii($str)) { |
11809 | 11809 | return ($length === null) ? |
11810 | - \substr_replace($str, $replacement, $offset) : |
|
11811 | - \substr_replace($str, $replacement, $offset, $length); |
|
11810 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
11812 | 11811 | } |
11813 | 11812 | |
11814 | 11813 | // |
@@ -11824,7 +11823,7 @@ discard block |
||
11824 | 11823 | // e.g.: non mbstring support + invalid chars |
11825 | 11824 | return ''; |
11826 | 11825 | } |
11827 | - $length = (int) $length_tmp; |
|
11826 | + $length = (int)$length_tmp; |
|
11828 | 11827 | } |
11829 | 11828 | |
11830 | 11829 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -11861,14 +11860,14 @@ discard block |
||
11861 | 11860 | && |
11862 | 11861 | \substr($haystack, -\strlen($needle)) === $needle |
11863 | 11862 | ) { |
11864 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
11863 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
11865 | 11864 | } |
11866 | 11865 | |
11867 | 11866 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
11868 | - return (string) self::substr( |
|
11867 | + return (string)self::substr( |
|
11869 | 11868 | $haystack, |
11870 | 11869 | 0, |
11871 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
11870 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
11872 | 11871 | $encoding |
11873 | 11872 | ); |
11874 | 11873 | } |
@@ -11900,10 +11899,10 @@ discard block |
||
11900 | 11899 | } |
11901 | 11900 | |
11902 | 11901 | if ($encoding === 'UTF-8') { |
11903 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
11902 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
11904 | 11903 | } |
11905 | 11904 | |
11906 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
11905 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
11907 | 11906 | } |
11908 | 11907 | |
11909 | 11908 | /** |
@@ -12111,7 +12110,7 @@ discard block |
||
12111 | 12110 | public static function to_boolean($str): bool |
12112 | 12111 | { |
12113 | 12112 | // init |
12114 | - $str = (string) $str; |
|
12113 | + $str = (string)$str; |
|
12115 | 12114 | |
12116 | 12115 | if ($str === '') { |
12117 | 12116 | return false; |
@@ -12139,10 +12138,10 @@ discard block |
||
12139 | 12138 | } |
12140 | 12139 | |
12141 | 12140 | if (\is_numeric($str)) { |
12142 | - return ((float) $str + 0) > 0; |
|
12141 | + return ((float)$str + 0) > 0; |
|
12143 | 12142 | } |
12144 | 12143 | |
12145 | - return (bool) \trim($str); |
|
12144 | + return (bool)\trim($str); |
|
12146 | 12145 | } |
12147 | 12146 | |
12148 | 12147 | /** |
@@ -12188,7 +12187,7 @@ discard block |
||
12188 | 12187 | return $str; |
12189 | 12188 | } |
12190 | 12189 | |
12191 | - $str = (string) $str; |
|
12190 | + $str = (string)$str; |
|
12192 | 12191 | if ($str === '') { |
12193 | 12192 | return ''; |
12194 | 12193 | } |
@@ -12240,7 +12239,7 @@ discard block |
||
12240 | 12239 | return $str; |
12241 | 12240 | } |
12242 | 12241 | |
12243 | - $str = (string) $str; |
|
12242 | + $str = (string)$str; |
|
12244 | 12243 | if ($str === '') { |
12245 | 12244 | return $str; |
12246 | 12245 | } |
@@ -12258,7 +12257,7 @@ discard block |
||
12258 | 12257 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
12259 | 12258 | |
12260 | 12259 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
12261 | - $buf .= $c1 . $c2; |
|
12260 | + $buf .= $c1.$c2; |
|
12262 | 12261 | ++$i; |
12263 | 12262 | } else { // not valid UTF8 - convert it |
12264 | 12263 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12269,7 +12268,7 @@ discard block |
||
12269 | 12268 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
12270 | 12269 | |
12271 | 12270 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
12272 | - $buf .= $c1 . $c2 . $c3; |
|
12271 | + $buf .= $c1.$c2.$c3; |
|
12273 | 12272 | $i += 2; |
12274 | 12273 | } else { // not valid UTF8 - convert it |
12275 | 12274 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12281,7 +12280,7 @@ discard block |
||
12281 | 12280 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
12282 | 12281 | |
12283 | 12282 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
12284 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
12283 | + $buf .= $c1.$c2.$c3.$c4; |
|
12285 | 12284 | $i += 3; |
12286 | 12285 | } else { // not valid UTF8 - convert it |
12287 | 12286 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12309,13 +12308,13 @@ discard block |
||
12309 | 12308 | * |
12310 | 12309 | * @return string |
12311 | 12310 | */ |
12312 | - static function (array $matches): string { |
|
12311 | + static function(array $matches): string { |
|
12313 | 12312 | if (isset($matches[3])) { |
12314 | - $cp = (int) \hexdec($matches[3]); |
|
12313 | + $cp = (int)\hexdec($matches[3]); |
|
12315 | 12314 | } else { |
12316 | 12315 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
12317 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
12318 | - + (int) \hexdec($matches[2]) |
|
12316 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
12317 | + + (int)\hexdec($matches[2]) |
|
12319 | 12318 | + 0x10000 |
12320 | 12319 | - (0xD800 << 10) |
12321 | 12320 | - 0xDC00; |
@@ -12326,12 +12325,12 @@ discard block |
||
12326 | 12325 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
12327 | 12326 | |
12328 | 12327 | if ($cp < 0x80) { |
12329 | - return (string) self::chr($cp); |
|
12328 | + return (string)self::chr($cp); |
|
12330 | 12329 | } |
12331 | 12330 | |
12332 | 12331 | if ($cp < 0xA0) { |
12333 | 12332 | /** @noinspection UnnecessaryCastingInspection */ |
12334 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
12333 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
12335 | 12334 | } |
12336 | 12335 | |
12337 | 12336 | return self::decimal_to_chr($cp); |
@@ -12364,7 +12363,7 @@ discard block |
||
12364 | 12363 | public static function to_int(string $str) |
12365 | 12364 | { |
12366 | 12365 | if (\is_numeric($str)) { |
12367 | - return (int) $str; |
|
12366 | + return (int)$str; |
|
12368 | 12367 | } |
12369 | 12368 | |
12370 | 12369 | return null; |
@@ -12395,7 +12394,7 @@ discard block |
||
12395 | 12394 | || |
12396 | 12395 | $input_type === 'double' |
12397 | 12396 | ) { |
12398 | - return (string) $input; |
|
12397 | + return (string)$input; |
|
12399 | 12398 | } |
12400 | 12399 | |
12401 | 12400 | if ( |
@@ -12403,7 +12402,7 @@ discard block |
||
12403 | 12402 | && |
12404 | 12403 | \method_exists($input, '__toString') |
12405 | 12404 | ) { |
12406 | - return (string) $input; |
|
12405 | + return (string)$input; |
|
12407 | 12406 | } |
12408 | 12407 | |
12409 | 12408 | return null; |
@@ -12440,7 +12439,7 @@ discard block |
||
12440 | 12439 | } |
12441 | 12440 | |
12442 | 12441 | /** @noinspection PhpComposerExtensionStubsInspection */ |
12443 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
12442 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
12444 | 12443 | } |
12445 | 12444 | |
12446 | 12445 | if ($chars) { |
@@ -12488,15 +12487,15 @@ discard block |
||
12488 | 12487 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
12489 | 12488 | |
12490 | 12489 | if ($encoding === 'UTF-8') { |
12491 | - $str_part_two = (string) \mb_substr($str, 1); |
|
12490 | + $str_part_two = (string)\mb_substr($str, 1); |
|
12492 | 12491 | |
12493 | 12492 | if ($use_mb_functions === true) { |
12494 | 12493 | $str_part_one = \mb_strtoupper( |
12495 | - (string) \mb_substr($str, 0, 1) |
|
12494 | + (string)\mb_substr($str, 0, 1) |
|
12496 | 12495 | ); |
12497 | 12496 | } else { |
12498 | 12497 | $str_part_one = self::strtoupper( |
12499 | - (string) \mb_substr($str, 0, 1), |
|
12498 | + (string)\mb_substr($str, 0, 1), |
|
12500 | 12499 | $encoding, |
12501 | 12500 | false, |
12502 | 12501 | $lang, |
@@ -12506,16 +12505,16 @@ discard block |
||
12506 | 12505 | } else { |
12507 | 12506 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
12508 | 12507 | |
12509 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
12508 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
12510 | 12509 | |
12511 | 12510 | if ($use_mb_functions === true) { |
12512 | 12511 | $str_part_one = \mb_strtoupper( |
12513 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
12512 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
12514 | 12513 | $encoding |
12515 | 12514 | ); |
12516 | 12515 | } else { |
12517 | 12516 | $str_part_one = self::strtoupper( |
12518 | - (string) self::substr($str, 0, 1, $encoding), |
|
12517 | + (string)self::substr($str, 0, 1, $encoding), |
|
12519 | 12518 | $encoding, |
12520 | 12519 | false, |
12521 | 12520 | $lang, |
@@ -12524,7 +12523,7 @@ discard block |
||
12524 | 12523 | } |
12525 | 12524 | } |
12526 | 12525 | |
12527 | - return $str_part_one . $str_part_two; |
|
12526 | + return $str_part_one.$str_part_two; |
|
12528 | 12527 | } |
12529 | 12528 | |
12530 | 12529 | /** |
@@ -12583,7 +12582,7 @@ discard block |
||
12583 | 12582 | $str = self::clean($str); |
12584 | 12583 | } |
12585 | 12584 | |
12586 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
12585 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
12587 | 12586 | |
12588 | 12587 | if ( |
12589 | 12588 | $use_php_default_functions === true |
@@ -12994,7 +12993,7 @@ discard block |
||
12994 | 12993 | if ( |
12995 | 12994 | $keep_utf8_chars === true |
12996 | 12995 | && |
12997 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
12996 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
12998 | 12997 | ) { |
12999 | 12998 | return $str_backup; |
13000 | 12999 | } |
@@ -13081,17 +13080,17 @@ discard block |
||
13081 | 13080 | return ''; |
13082 | 13081 | } |
13083 | 13082 | |
13084 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
13083 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
13085 | 13084 | |
13086 | 13085 | if ( |
13087 | 13086 | !isset($matches[0]) |
13088 | 13087 | || |
13089 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
13088 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
13090 | 13089 | ) { |
13091 | 13090 | return $str; |
13092 | 13091 | } |
13093 | 13092 | |
13094 | - return \rtrim($matches[0]) . $str_add_on; |
|
13093 | + return \rtrim($matches[0]).$str_add_on; |
|
13095 | 13094 | } |
13096 | 13095 | |
13097 | 13096 | /** |
@@ -13180,7 +13179,7 @@ discard block |
||
13180 | 13179 | } |
13181 | 13180 | } |
13182 | 13181 | |
13183 | - return $str_return . \implode('', $chars); |
|
13182 | + return $str_return.\implode('', $chars); |
|
13184 | 13183 | } |
13185 | 13184 | |
13186 | 13185 | /** |
@@ -13234,7 +13233,7 @@ discard block |
||
13234 | 13233 | $final_break = ''; |
13235 | 13234 | } |
13236 | 13235 | |
13237 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
13236 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
13238 | 13237 | } |
13239 | 13238 | |
13240 | 13239 | /** |
@@ -13469,7 +13468,7 @@ discard block |
||
13469 | 13468 | /** @noinspection PhpIncludeInspection */ |
13470 | 13469 | /** @noinspection UsingInclusionReturnValueInspection */ |
13471 | 13470 | /** @psalm-suppress UnresolvableInclude */ |
13472 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
13471 | + return include __DIR__.'/data/'.$file.'.php'; |
|
13473 | 13472 | } |
13474 | 13473 | |
13475 | 13474 | /** |
@@ -13486,7 +13485,7 @@ discard block |
||
13486 | 13485 | |
13487 | 13486 | \uksort( |
13488 | 13487 | self::$EMOJI, |
13489 | - static function (string $a, string $b): int { |
|
13488 | + static function(string $a, string $b): int { |
|
13490 | 13489 | return \strlen($b) <=> \strlen($a); |
13491 | 13490 | } |
13492 | 13491 | ); |
@@ -13496,7 +13495,7 @@ discard block |
||
13496 | 13495 | |
13497 | 13496 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
13498 | 13497 | $tmp_key = \crc32($key); |
13499 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
13498 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
13500 | 13499 | } |
13501 | 13500 | |
13502 | 13501 | return true; |
@@ -13524,7 +13523,7 @@ discard block |
||
13524 | 13523 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
13525 | 13524 | return \defined('MB_OVERLOAD_STRING') |
13526 | 13525 | && |
13527 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
13526 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
13528 | 13527 | } |
13529 | 13528 | |
13530 | 13529 | /** |
@@ -13590,7 +13589,7 @@ discard block |
||
13590 | 13589 | */ |
13591 | 13590 | static $RX_CLASS_CACHE = []; |
13592 | 13591 | |
13593 | - $cache_key = $s . '_' . $class; |
|
13592 | + $cache_key = $s.'_'.$class; |
|
13594 | 13593 | |
13595 | 13594 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
13596 | 13595 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -13602,7 +13601,7 @@ discard block |
||
13602 | 13601 | /** @noinspection AlterInForeachInspection */ |
13603 | 13602 | foreach (self::str_split($s) as &$s) { |
13604 | 13603 | if ($s === '-') { |
13605 | - $class_array[0] = '-' . $class_array[0]; |
|
13604 | + $class_array[0] = '-'.$class_array[0]; |
|
13606 | 13605 | } elseif (!isset($s[2])) { |
13607 | 13606 | $class_array[0] .= \preg_quote($s, '/'); |
13608 | 13607 | } elseif (self::strlen($s) === 1) { |
@@ -13613,13 +13612,13 @@ discard block |
||
13613 | 13612 | } |
13614 | 13613 | |
13615 | 13614 | if ($class_array[0]) { |
13616 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
13615 | + $class_array[0] = '['.$class_array[0].']'; |
|
13617 | 13616 | } |
13618 | 13617 | |
13619 | 13618 | if (\count($class_array) === 1) { |
13620 | 13619 | $return = $class_array[0]; |
13621 | 13620 | } else { |
13622 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
13621 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
13623 | 13622 | } |
13624 | 13623 | |
13625 | 13624 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -13700,7 +13699,7 @@ discard block |
||
13700 | 13699 | |
13701 | 13700 | if ($delimiter === '-') { |
13702 | 13701 | /** @noinspection AlterInForeachInspection */ |
13703 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
13702 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
13704 | 13703 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
13705 | 13704 | $continue = true; |
13706 | 13705 | } |
@@ -13708,7 +13707,7 @@ discard block |
||
13708 | 13707 | } |
13709 | 13708 | |
13710 | 13709 | /** @noinspection AlterInForeachInspection */ |
13711 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
13710 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
13712 | 13711 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
13713 | 13712 | $continue = true; |
13714 | 13713 | } |
@@ -13775,8 +13774,8 @@ discard block |
||
13775 | 13774 | } else { |
13776 | 13775 | /** @noinspection OffsetOperationsInspection */ |
13777 | 13776 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
13778 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
13779 | - $buf .= $cc1 . $cc2; |
|
13777 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
13778 | + $buf .= $cc1.$cc2; |
|
13780 | 13779 | } |
13781 | 13780 | |
13782 | 13781 | return $buf; |
@@ -13795,7 +13794,7 @@ discard block |
||
13795 | 13794 | { |
13796 | 13795 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
13797 | 13796 | if (\preg_match($pattern, $str)) { |
13798 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
13797 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
13799 | 13798 | } |
13800 | 13799 | |
13801 | 13800 | return $str; |