@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | return false; |
84 | 84 | } |
85 | 85 | |
86 | - $uri = (string) $_SERVER['REQUEST_URI']; |
|
86 | + $uri = (string)$_SERVER['REQUEST_URI']; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | $uriOrig = $uri; |
@@ -100,27 +100,27 @@ discard block |
||
100 | 100 | // When not, assumes Windows-1252 and redirects to the corresponding UTF-8 encoded URL |
101 | 101 | // |
102 | 102 | |
103 | - $uri = (string) \preg_replace_callback( |
|
103 | + $uri = (string)\preg_replace_callback( |
|
104 | 104 | '/[\x80-\xFF]+/', |
105 | 105 | /** |
106 | 106 | * @param array $m |
107 | 107 | * |
108 | 108 | * @return string |
109 | 109 | */ |
110 | - static function (array $m): string { |
|
110 | + static function(array $m): string { |
|
111 | 111 | return \rawurlencode($m[0]); |
112 | 112 | }, |
113 | 113 | $uri |
114 | 114 | ); |
115 | 115 | |
116 | - $uri = (string) \preg_replace_callback( |
|
116 | + $uri = (string)\preg_replace_callback( |
|
117 | 117 | '/(?:%[89A-F][0-9A-F])+/i', |
118 | 118 | /** |
119 | 119 | * @param array $m |
120 | 120 | * |
121 | 121 | * @return string |
122 | 122 | */ |
123 | - static function (array $m): string { |
|
123 | + static function(array $m): string { |
|
124 | 124 | return \rawurlencode(UTF8::rawurldecode($m[0])); |
125 | 125 | }, |
126 | 126 | $uri |
@@ -134,19 +134,19 @@ discard block |
||
134 | 134 | \headers_sent() === false |
135 | 135 | ) { |
136 | 136 | $severProtocol = ($_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'); |
137 | - \header($severProtocol . ' 301 Moved Permanently'); |
|
137 | + \header($severProtocol.' 301 Moved Permanently'); |
|
138 | 138 | |
139 | 139 | if (\strncmp($uri, '/', 1) === 0) { |
140 | - \header('Location: /' . \ltrim($uri, '/')); |
|
140 | + \header('Location: /'.\ltrim($uri, '/')); |
|
141 | 141 | } else { |
142 | - \header('Location: ' . $uri); |
|
142 | + \header('Location: '.$uri); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | exit(); |
146 | 146 | } |
147 | 147 | |
148 | 148 | if (\strncmp($uri, '/', 1) === 0) { |
149 | - $uri = '/' . \ltrim($uri, '/'); |
|
149 | + $uri = '/'.\ltrim($uri, '/'); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | return $uri; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | return false; |
190 | 190 | } |
191 | 191 | |
192 | - $length = (int) $length; |
|
192 | + $length = (int)$length; |
|
193 | 193 | |
194 | 194 | if ($length <= 0) { |
195 | 195 | return false; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | */ |
230 | 230 | static $_IS_PHP; |
231 | 231 | |
232 | - $version = (string) $version; |
|
232 | + $version = (string)$version; |
|
233 | 233 | |
234 | 234 | if (!isset($_IS_PHP[$version])) { |
235 | 235 | $_IS_PHP[$version] = \version_compare(\PHP_VERSION, $version, '>='); |
@@ -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 | /** |
@@ -3421,7 +3421,7 @@ discard block |
||
3421 | 3421 | */ |
3422 | 3422 | public static function is_binary($input, bool $strict = false): bool |
3423 | 3423 | { |
3424 | - $input = (string) $input; |
|
3424 | + $input = (string)$input; |
|
3425 | 3425 | if ($input === '') { |
3426 | 3426 | return false; |
3427 | 3427 | } |
@@ -3710,7 +3710,7 @@ discard block |
||
3710 | 3710 | public static function is_utf16($str, $check_if_string_is_binary = true) |
3711 | 3711 | { |
3712 | 3712 | // init |
3713 | - $str = (string) $str; |
|
3713 | + $str = (string)$str; |
|
3714 | 3714 | $str_chars = []; |
3715 | 3715 | |
3716 | 3716 | if ( |
@@ -3796,7 +3796,7 @@ discard block |
||
3796 | 3796 | public static function is_utf32($str, $check_if_string_is_binary = true) |
3797 | 3797 | { |
3798 | 3798 | // init |
3799 | - $str = (string) $str; |
|
3799 | + $str = (string)$str; |
|
3800 | 3800 | $str_chars = []; |
3801 | 3801 | |
3802 | 3802 | if ( |
@@ -3888,7 +3888,7 @@ discard block |
||
3888 | 3888 | return true; |
3889 | 3889 | } |
3890 | 3890 | |
3891 | - return self::is_utf8_string((string) $str, $strict); |
|
3891 | + return self::is_utf8_string((string)$str, $strict); |
|
3892 | 3892 | } |
3893 | 3893 | |
3894 | 3894 | /** |
@@ -4038,15 +4038,15 @@ discard block |
||
4038 | 4038 | $use_mb_functions = ($lang === null && $try_to_keep_the_string_length === false); |
4039 | 4039 | |
4040 | 4040 | if ($encoding === 'UTF-8') { |
4041 | - $str_part_two = (string) \mb_substr($str, 1); |
|
4041 | + $str_part_two = (string)\mb_substr($str, 1); |
|
4042 | 4042 | |
4043 | 4043 | if ($use_mb_functions === true) { |
4044 | 4044 | $str_part_one = \mb_strtolower( |
4045 | - (string) \mb_substr($str, 0, 1) |
|
4045 | + (string)\mb_substr($str, 0, 1) |
|
4046 | 4046 | ); |
4047 | 4047 | } else { |
4048 | 4048 | $str_part_one = self::strtolower( |
4049 | - (string) \mb_substr($str, 0, 1), |
|
4049 | + (string)\mb_substr($str, 0, 1), |
|
4050 | 4050 | $encoding, |
4051 | 4051 | false, |
4052 | 4052 | $lang, |
@@ -4056,10 +4056,10 @@ discard block |
||
4056 | 4056 | } else { |
4057 | 4057 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4058 | 4058 | |
4059 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
4059 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
4060 | 4060 | |
4061 | 4061 | $str_part_one = self::strtolower( |
4062 | - (string) self::substr($str, 0, 1, $encoding), |
|
4062 | + (string)self::substr($str, 0, 1, $encoding), |
|
4063 | 4063 | $encoding, |
4064 | 4064 | false, |
4065 | 4065 | $lang, |
@@ -4067,7 +4067,7 @@ discard block |
||
4067 | 4067 | ); |
4068 | 4068 | } |
4069 | 4069 | |
4070 | - return $str_part_one . $str_part_two; |
|
4070 | + return $str_part_one.$str_part_two; |
|
4071 | 4071 | } |
4072 | 4072 | |
4073 | 4073 | /** |
@@ -4214,7 +4214,7 @@ discard block |
||
4214 | 4214 | } |
4215 | 4215 | |
4216 | 4216 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4217 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4217 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4218 | 4218 | } |
4219 | 4219 | |
4220 | 4220 | if ($chars) { |
@@ -4267,7 +4267,7 @@ discard block |
||
4267 | 4267 | { |
4268 | 4268 | $bytes = self::chr_size_list($str); |
4269 | 4269 | if ($bytes !== []) { |
4270 | - return (int) \max($bytes); |
|
4270 | + return (int)\max($bytes); |
|
4271 | 4271 | } |
4272 | 4272 | |
4273 | 4273 | return 0; |
@@ -4349,7 +4349,7 @@ discard block |
||
4349 | 4349 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4350 | 4350 | |
4351 | 4351 | // init |
4352 | - $encoding = (string) $encoding; |
|
4352 | + $encoding = (string)$encoding; |
|
4353 | 4353 | |
4354 | 4354 | if (!$encoding) { |
4355 | 4355 | return $fallback; |
@@ -4411,7 +4411,7 @@ discard block |
||
4411 | 4411 | |
4412 | 4412 | $encoding_original = $encoding; |
4413 | 4413 | $encoding = \strtoupper($encoding); |
4414 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4414 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4415 | 4415 | |
4416 | 4416 | $equivalences = [ |
4417 | 4417 | 'ISO8859' => 'ISO-8859-1', |
@@ -4569,13 +4569,13 @@ discard block |
||
4569 | 4569 | static $CHAR_CACHE = []; |
4570 | 4570 | |
4571 | 4571 | // init |
4572 | - $chr = (string) $chr; |
|
4572 | + $chr = (string)$chr; |
|
4573 | 4573 | |
4574 | 4574 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4575 | 4575 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4576 | 4576 | } |
4577 | 4577 | |
4578 | - $cache_key = $chr . '_' . $encoding; |
|
4578 | + $cache_key = $chr.'_'.$encoding; |
|
4579 | 4579 | if (isset($CHAR_CACHE[$cache_key]) === true) { |
4580 | 4580 | return $CHAR_CACHE[$cache_key]; |
4581 | 4581 | } |
@@ -4610,7 +4610,7 @@ discard block |
||
4610 | 4610 | // |
4611 | 4611 | |
4612 | 4612 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
4613 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
4613 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
4614 | 4614 | /** @noinspection OffsetOperationsInspection */ |
4615 | 4615 | $code = $chr ? $chr[1] : 0; |
4616 | 4616 | |
@@ -4618,21 +4618,21 @@ discard block |
||
4618 | 4618 | if ($code >= 0xF0 && isset($chr[4])) { |
4619 | 4619 | /** @noinspection UnnecessaryCastingInspection */ |
4620 | 4620 | /** @noinspection OffsetOperationsInspection */ |
4621 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4621 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4622 | 4622 | } |
4623 | 4623 | |
4624 | 4624 | /** @noinspection OffsetOperationsInspection */ |
4625 | 4625 | if ($code >= 0xE0 && isset($chr[3])) { |
4626 | 4626 | /** @noinspection UnnecessaryCastingInspection */ |
4627 | 4627 | /** @noinspection OffsetOperationsInspection */ |
4628 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4628 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4629 | 4629 | } |
4630 | 4630 | |
4631 | 4631 | /** @noinspection OffsetOperationsInspection */ |
4632 | 4632 | if ($code >= 0xC0 && isset($chr[2])) { |
4633 | 4633 | /** @noinspection UnnecessaryCastingInspection */ |
4634 | 4634 | /** @noinspection OffsetOperationsInspection */ |
4635 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4635 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4636 | 4636 | } |
4637 | 4637 | |
4638 | 4638 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -4689,7 +4689,7 @@ discard block |
||
4689 | 4689 | public static function pcre_utf8_support(): bool |
4690 | 4690 | { |
4691 | 4691 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4692 | - return (bool) @\preg_match('//u', ''); |
|
4692 | + return (bool)@\preg_match('//u', ''); |
|
4693 | 4693 | } |
4694 | 4694 | |
4695 | 4695 | /** |
@@ -4727,14 +4727,14 @@ discard block |
||
4727 | 4727 | * @psalm-suppress RedundantConditionGivenDocblockType |
4728 | 4728 | */ |
4729 | 4729 | if (!\is_numeric($step)) { |
4730 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
4730 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
4731 | 4731 | } |
4732 | 4732 | |
4733 | 4733 | /** |
4734 | 4734 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
4735 | 4735 | */ |
4736 | 4736 | if ($step <= 0) { |
4737 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
4737 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
4738 | 4738 | } |
4739 | 4739 | } |
4740 | 4740 | |
@@ -4746,14 +4746,14 @@ discard block |
||
4746 | 4746 | $is_xdigit = false; |
4747 | 4747 | |
4748 | 4748 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4749 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
4749 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
4750 | 4750 | $is_digit = true; |
4751 | - $start = (int) $var1; |
|
4751 | + $start = (int)$var1; |
|
4752 | 4752 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
4753 | 4753 | $is_xdigit = true; |
4754 | - $start = (int) self::hex_to_int($var1); |
|
4754 | + $start = (int)self::hex_to_int($var1); |
|
4755 | 4755 | } elseif (!$use_ctype && \is_numeric($var1)) { |
4756 | - $start = (int) $var1; |
|
4756 | + $start = (int)$var1; |
|
4757 | 4757 | } else { |
4758 | 4758 | $start = self::ord($var1); |
4759 | 4759 | } |
@@ -4763,11 +4763,11 @@ discard block |
||
4763 | 4763 | } |
4764 | 4764 | |
4765 | 4765 | if ($is_digit) { |
4766 | - $end = (int) $var2; |
|
4766 | + $end = (int)$var2; |
|
4767 | 4767 | } elseif ($is_xdigit) { |
4768 | - $end = (int) self::hex_to_int($var2); |
|
4768 | + $end = (int)self::hex_to_int($var2); |
|
4769 | 4769 | } elseif (!$use_ctype && \is_numeric($var2)) { |
4770 | - $end = (int) $var2; |
|
4770 | + $end = (int)$var2; |
|
4771 | 4771 | } else { |
4772 | 4772 | $end = self::ord($var2); |
4773 | 4773 | } |
@@ -4778,7 +4778,7 @@ discard block |
||
4778 | 4778 | |
4779 | 4779 | $array = []; |
4780 | 4780 | foreach (\range($start, $end, $step) as $i) { |
4781 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
4781 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
4782 | 4782 | } |
4783 | 4783 | |
4784 | 4784 | return $array; |
@@ -4888,8 +4888,8 @@ discard block |
||
4888 | 4888 | $delimiter = '/'; |
4889 | 4889 | } |
4890 | 4890 | |
4891 | - return (string) \preg_replace( |
|
4892 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4891 | + return (string)\preg_replace( |
|
4892 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4893 | 4893 | $replacement, |
4894 | 4894 | $str |
4895 | 4895 | ); |
@@ -4937,9 +4937,9 @@ discard block |
||
4937 | 4937 | return ''; |
4938 | 4938 | } |
4939 | 4939 | |
4940 | - $str_length -= (int) $bom_byte_length; |
|
4940 | + $str_length -= (int)$bom_byte_length; |
|
4941 | 4941 | |
4942 | - $str = (string) $str_tmp; |
|
4942 | + $str = (string)$str_tmp; |
|
4943 | 4943 | } |
4944 | 4944 | } |
4945 | 4945 | |
@@ -4968,7 +4968,7 @@ discard block |
||
4968 | 4968 | */ |
4969 | 4969 | if (\is_array($what) === true) { |
4970 | 4970 | foreach ($what as $item) { |
4971 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
4971 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
4972 | 4972 | } |
4973 | 4973 | } |
4974 | 4974 | |
@@ -5006,7 +5006,7 @@ discard block |
||
5006 | 5006 | */ |
5007 | 5007 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
5008 | 5008 | { |
5009 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
5009 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
5010 | 5010 | } |
5011 | 5011 | |
5012 | 5012 | /** |
@@ -5061,17 +5061,17 @@ discard block |
||
5061 | 5061 | ): string { |
5062 | 5062 | if ($substring && \strpos($str, $substring) === 0) { |
5063 | 5063 | if ($encoding === 'UTF-8') { |
5064 | - return (string) \mb_substr( |
|
5064 | + return (string)\mb_substr( |
|
5065 | 5065 | $str, |
5066 | - (int) \mb_strlen($substring) |
|
5066 | + (int)\mb_strlen($substring) |
|
5067 | 5067 | ); |
5068 | 5068 | } |
5069 | 5069 | |
5070 | 5070 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5071 | 5071 | |
5072 | - return (string) self::substr( |
|
5072 | + return (string)self::substr( |
|
5073 | 5073 | $str, |
5074 | - (int) self::strlen($substring, $encoding), |
|
5074 | + (int)self::strlen($substring, $encoding), |
|
5075 | 5075 | null, |
5076 | 5076 | $encoding |
5077 | 5077 | ); |
@@ -5099,19 +5099,19 @@ discard block |
||
5099 | 5099 | ): string { |
5100 | 5100 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
5101 | 5101 | if ($encoding === 'UTF-8') { |
5102 | - return (string) \mb_substr( |
|
5102 | + return (string)\mb_substr( |
|
5103 | 5103 | $str, |
5104 | 5104 | 0, |
5105 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
5105 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
5106 | 5106 | ); |
5107 | 5107 | } |
5108 | 5108 | |
5109 | 5109 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5110 | 5110 | |
5111 | - return (string) self::substr( |
|
5111 | + return (string)self::substr( |
|
5112 | 5112 | $str, |
5113 | 5113 | 0, |
5114 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
5114 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
5115 | 5115 | $encoding |
5116 | 5116 | ); |
5117 | 5117 | } |
@@ -5210,7 +5210,7 @@ discard block |
||
5210 | 5210 | $save = \mb_substitute_character(); |
5211 | 5211 | \mb_substitute_character($replacement_char_helper); |
5212 | 5212 | // the polyfill maybe return false, so cast to string |
5213 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
5213 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
5214 | 5214 | \mb_substitute_character($save); |
5215 | 5215 | } |
5216 | 5216 | |
@@ -5254,7 +5254,7 @@ discard block |
||
5254 | 5254 | } |
5255 | 5255 | |
5256 | 5256 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5257 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
5257 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
5258 | 5258 | } |
5259 | 5259 | |
5260 | 5260 | if ($chars) { |
@@ -5278,7 +5278,7 @@ discard block |
||
5278 | 5278 | { |
5279 | 5279 | echo '<pre>'; |
5280 | 5280 | foreach (self::$SUPPORT as $key => &$value) { |
5281 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
5281 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
5282 | 5282 | } |
5283 | 5283 | unset($value); |
5284 | 5284 | echo '</pre>'; |
@@ -5313,7 +5313,7 @@ discard block |
||
5313 | 5313 | return $char; |
5314 | 5314 | } |
5315 | 5315 | |
5316 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
5316 | + return '&#'.self::ord($char, $encoding).';'; |
|
5317 | 5317 | } |
5318 | 5318 | |
5319 | 5319 | /** |
@@ -5416,11 +5416,11 @@ discard block |
||
5416 | 5416 | $lang, |
5417 | 5417 | $try_to_keep_the_string_length |
5418 | 5418 | ); |
5419 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5419 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5420 | 5420 | |
5421 | 5421 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
5422 | 5422 | |
5423 | - $str = (string) \preg_replace_callback( |
|
5423 | + $str = (string)\preg_replace_callback( |
|
5424 | 5424 | '/[-_\\s]+(.)?/u', |
5425 | 5425 | /** |
5426 | 5426 | * @param array $match |
@@ -5429,7 +5429,7 @@ discard block |
||
5429 | 5429 | * |
5430 | 5430 | * @return string |
5431 | 5431 | */ |
5432 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5432 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5433 | 5433 | if (isset($match[1])) { |
5434 | 5434 | if ($use_mb_functions === true) { |
5435 | 5435 | if ($encoding === 'UTF-8') { |
@@ -5447,7 +5447,7 @@ discard block |
||
5447 | 5447 | $str |
5448 | 5448 | ); |
5449 | 5449 | |
5450 | - return (string) \preg_replace_callback( |
|
5450 | + return (string)\preg_replace_callback( |
|
5451 | 5451 | '/[\\p{N}]+(.)?/u', |
5452 | 5452 | /** |
5453 | 5453 | * @param array $match |
@@ -5456,7 +5456,7 @@ discard block |
||
5456 | 5456 | * |
5457 | 5457 | * @return string |
5458 | 5458 | */ |
5459 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5459 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5460 | 5460 | if ($use_mb_functions === true) { |
5461 | 5461 | if ($encoding === 'UTF-8') { |
5462 | 5462 | return \mb_strtoupper($match[0]); |
@@ -5648,7 +5648,7 @@ discard block |
||
5648 | 5648 | ): string { |
5649 | 5649 | if (self::$SUPPORT['mbstring'] === true) { |
5650 | 5650 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5651 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5651 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5652 | 5652 | |
5653 | 5653 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
5654 | 5654 | if ($use_mb_functions === true && $encoding === 'UTF-8') { |
@@ -5658,10 +5658,10 @@ discard block |
||
5658 | 5658 | } |
5659 | 5659 | |
5660 | 5660 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5661 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5661 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5662 | 5662 | } |
5663 | 5663 | |
5664 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5664 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5665 | 5665 | |
5666 | 5666 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
5667 | 5667 | if ($use_mb_functions === true && $encoding === 'UTF-8') { |
@@ -5670,7 +5670,7 @@ discard block |
||
5670 | 5670 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
5671 | 5671 | } |
5672 | 5672 | |
5673 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5673 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5674 | 5674 | } |
5675 | 5675 | |
5676 | 5676 | /** |
@@ -5687,7 +5687,7 @@ discard block |
||
5687 | 5687 | public static function str_detect_encoding($str) |
5688 | 5688 | { |
5689 | 5689 | // init |
5690 | - $str = (string) $str; |
|
5690 | + $str = (string)$str; |
|
5691 | 5691 | |
5692 | 5692 | // |
5693 | 5693 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5789,7 +5789,7 @@ discard block |
||
5789 | 5789 | foreach (self::$ENCODINGS as $encoding_tmp) { |
5790 | 5790 | // INFO: //IGNORE but still throw notice |
5791 | 5791 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5792 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
5792 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
5793 | 5793 | return $encoding_tmp; |
5794 | 5794 | } |
5795 | 5795 | } |
@@ -5886,7 +5886,7 @@ discard block |
||
5886 | 5886 | return $str; |
5887 | 5887 | } |
5888 | 5888 | |
5889 | - return $substring . $str; |
|
5889 | + return $substring.$str; |
|
5890 | 5890 | } |
5891 | 5891 | |
5892 | 5892 | /** |
@@ -6177,27 +6177,27 @@ discard block |
||
6177 | 6177 | string $encoding = 'UTF-8' |
6178 | 6178 | ): string { |
6179 | 6179 | if ($encoding === 'UTF-8') { |
6180 | - $len = (int) \mb_strlen($str); |
|
6180 | + $len = (int)\mb_strlen($str); |
|
6181 | 6181 | if ($index > $len) { |
6182 | 6182 | return $str; |
6183 | 6183 | } |
6184 | 6184 | |
6185 | 6185 | /** @noinspection UnnecessaryCastingInspection */ |
6186 | - return (string) \mb_substr($str, 0, $index) . |
|
6187 | - $substring . |
|
6188 | - (string) \mb_substr($str, $index, $len); |
|
6186 | + return (string)\mb_substr($str, 0, $index). |
|
6187 | + $substring. |
|
6188 | + (string)\mb_substr($str, $index, $len); |
|
6189 | 6189 | } |
6190 | 6190 | |
6191 | 6191 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6192 | 6192 | |
6193 | - $len = (int) self::strlen($str, $encoding); |
|
6193 | + $len = (int)self::strlen($str, $encoding); |
|
6194 | 6194 | if ($index > $len) { |
6195 | 6195 | return $str; |
6196 | 6196 | } |
6197 | 6197 | |
6198 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
6199 | - $substring . |
|
6200 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
6198 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
6199 | + $substring. |
|
6200 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
6201 | 6201 | } |
6202 | 6202 | |
6203 | 6203 | /** |
@@ -6229,15 +6229,15 @@ discard block |
||
6229 | 6229 | */ |
6230 | 6230 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
6231 | 6231 | { |
6232 | - $search = (array) $search; |
|
6232 | + $search = (array)$search; |
|
6233 | 6233 | |
6234 | 6234 | /** @noinspection AlterInForeachInspection */ |
6235 | 6235 | foreach ($search as &$s) { |
6236 | - $s = (string) $s; |
|
6236 | + $s = (string)$s; |
|
6237 | 6237 | if ($s === '') { |
6238 | 6238 | $s = '/^(?<=.)$/'; |
6239 | 6239 | } else { |
6240 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
6240 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
6241 | 6241 | } |
6242 | 6242 | } |
6243 | 6243 | |
@@ -6271,11 +6271,11 @@ discard block |
||
6271 | 6271 | } |
6272 | 6272 | |
6273 | 6273 | if ($search === '') { |
6274 | - return $str . $replacement; |
|
6274 | + return $str.$replacement; |
|
6275 | 6275 | } |
6276 | 6276 | |
6277 | 6277 | if (\stripos($str, $search) === 0) { |
6278 | - return $replacement . \substr($str, \strlen($search)); |
|
6278 | + return $replacement.\substr($str, \strlen($search)); |
|
6279 | 6279 | } |
6280 | 6280 | |
6281 | 6281 | return $str; |
@@ -6306,11 +6306,11 @@ discard block |
||
6306 | 6306 | } |
6307 | 6307 | |
6308 | 6308 | if ($search === '') { |
6309 | - return $str . $replacement; |
|
6309 | + return $str.$replacement; |
|
6310 | 6310 | } |
6311 | 6311 | |
6312 | 6312 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6313 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6313 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6314 | 6314 | } |
6315 | 6315 | |
6316 | 6316 | return $str; |
@@ -6396,15 +6396,15 @@ discard block |
||
6396 | 6396 | } |
6397 | 6397 | |
6398 | 6398 | if ($encoding === 'UTF-8') { |
6399 | - return (string) \mb_substr( |
|
6399 | + return (string)\mb_substr( |
|
6400 | 6400 | $str, |
6401 | - $offset + (int) \mb_strlen($separator) |
|
6401 | + $offset + (int)\mb_strlen($separator) |
|
6402 | 6402 | ); |
6403 | 6403 | } |
6404 | 6404 | |
6405 | - return (string) self::substr( |
|
6405 | + return (string)self::substr( |
|
6406 | 6406 | $str, |
6407 | - $offset + (int) self::strlen($separator, $encoding), |
|
6407 | + $offset + (int)self::strlen($separator, $encoding), |
|
6408 | 6408 | null, |
6409 | 6409 | $encoding |
6410 | 6410 | ); |
@@ -6436,15 +6436,15 @@ discard block |
||
6436 | 6436 | } |
6437 | 6437 | |
6438 | 6438 | if ($encoding === 'UTF-8') { |
6439 | - return (string) \mb_substr( |
|
6439 | + return (string)\mb_substr( |
|
6440 | 6440 | $str, |
6441 | - $offset + (int) self::strlen($separator) |
|
6441 | + $offset + (int)self::strlen($separator) |
|
6442 | 6442 | ); |
6443 | 6443 | } |
6444 | 6444 | |
6445 | - return (string) self::substr( |
|
6445 | + return (string)self::substr( |
|
6446 | 6446 | $str, |
6447 | - $offset + (int) self::strlen($separator, $encoding), |
|
6447 | + $offset + (int)self::strlen($separator, $encoding), |
|
6448 | 6448 | null, |
6449 | 6449 | $encoding |
6450 | 6450 | ); |
@@ -6476,10 +6476,10 @@ discard block |
||
6476 | 6476 | } |
6477 | 6477 | |
6478 | 6478 | if ($encoding === 'UTF-8') { |
6479 | - return (string) \mb_substr($str, 0, $offset); |
|
6479 | + return (string)\mb_substr($str, 0, $offset); |
|
6480 | 6480 | } |
6481 | 6481 | |
6482 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6482 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6483 | 6483 | } |
6484 | 6484 | |
6485 | 6485 | /** |
@@ -6508,7 +6508,7 @@ discard block |
||
6508 | 6508 | return ''; |
6509 | 6509 | } |
6510 | 6510 | |
6511 | - return (string) \mb_substr($str, 0, $offset); |
|
6511 | + return (string)\mb_substr($str, 0, $offset); |
|
6512 | 6512 | } |
6513 | 6513 | |
6514 | 6514 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6516,7 +6516,7 @@ discard block |
||
6516 | 6516 | return ''; |
6517 | 6517 | } |
6518 | 6518 | |
6519 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6519 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6520 | 6520 | } |
6521 | 6521 | |
6522 | 6522 | /** |
@@ -6618,12 +6618,12 @@ discard block |
||
6618 | 6618 | } |
6619 | 6619 | |
6620 | 6620 | if ($encoding === 'UTF-8') { |
6621 | - return (string) \mb_substr($str, -$n); |
|
6621 | + return (string)\mb_substr($str, -$n); |
|
6622 | 6622 | } |
6623 | 6623 | |
6624 | 6624 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6625 | 6625 | |
6626 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6626 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6627 | 6627 | } |
6628 | 6628 | |
6629 | 6629 | /** |
@@ -6649,21 +6649,21 @@ discard block |
||
6649 | 6649 | } |
6650 | 6650 | |
6651 | 6651 | if ($encoding === 'UTF-8') { |
6652 | - if ((int) \mb_strlen($str) <= $length) { |
|
6652 | + if ((int)\mb_strlen($str) <= $length) { |
|
6653 | 6653 | return $str; |
6654 | 6654 | } |
6655 | 6655 | |
6656 | 6656 | /** @noinspection UnnecessaryCastingInspection */ |
6657 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
6657 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
6658 | 6658 | } |
6659 | 6659 | |
6660 | 6660 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6661 | 6661 | |
6662 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6662 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6663 | 6663 | return $str; |
6664 | 6664 | } |
6665 | 6665 | |
6666 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
6666 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
6667 | 6667 | } |
6668 | 6668 | |
6669 | 6669 | /** |
@@ -6690,12 +6690,12 @@ discard block |
||
6690 | 6690 | |
6691 | 6691 | if ($encoding === 'UTF-8') { |
6692 | 6692 | /** @noinspection UnnecessaryCastingInspection */ |
6693 | - if ((int) \mb_strlen($str) <= $length) { |
|
6693 | + if ((int)\mb_strlen($str) <= $length) { |
|
6694 | 6694 | return $str; |
6695 | 6695 | } |
6696 | 6696 | |
6697 | 6697 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6698 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6698 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6699 | 6699 | } |
6700 | 6700 | |
6701 | 6701 | $str = \mb_substr($str, 0, $length); |
@@ -6705,22 +6705,22 @@ discard block |
||
6705 | 6705 | $new_str = \implode(' ', $array); |
6706 | 6706 | |
6707 | 6707 | if ($new_str === '') { |
6708 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6708 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6709 | 6709 | } |
6710 | 6710 | } else { |
6711 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6711 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6712 | 6712 | return $str; |
6713 | 6713 | } |
6714 | 6714 | |
6715 | 6715 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6716 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6716 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6717 | 6717 | } |
6718 | 6718 | |
6719 | 6719 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6720 | 6720 | $str = self::substr($str, 0, $length, $encoding); |
6721 | 6721 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6722 | 6722 | if ($str === false) { |
6723 | - return '' . $str_add_on; |
|
6723 | + return ''.$str_add_on; |
|
6724 | 6724 | } |
6725 | 6725 | |
6726 | 6726 | $array = \explode(' ', $str); |
@@ -6728,11 +6728,11 @@ discard block |
||
6728 | 6728 | $new_str = \implode(' ', $array); |
6729 | 6729 | |
6730 | 6730 | if ($new_str === '') { |
6731 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6731 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6732 | 6732 | } |
6733 | 6733 | } |
6734 | 6734 | |
6735 | - return $new_str . $str_add_on; |
|
6735 | + return $new_str.$str_add_on; |
|
6736 | 6736 | } |
6737 | 6737 | |
6738 | 6738 | /** |
@@ -6755,7 +6755,7 @@ discard block |
||
6755 | 6755 | $longest_common_prefix = ''; |
6756 | 6756 | |
6757 | 6757 | if ($encoding === 'UTF-8') { |
6758 | - $max_length = (int) \min( |
|
6758 | + $max_length = (int)\min( |
|
6759 | 6759 | \mb_strlen($str1), |
6760 | 6760 | \mb_strlen($str2) |
6761 | 6761 | ); |
@@ -6776,7 +6776,7 @@ discard block |
||
6776 | 6776 | } else { |
6777 | 6777 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6778 | 6778 | |
6779 | - $max_length = (int) \min( |
|
6779 | + $max_length = (int)\min( |
|
6780 | 6780 | self::strlen($str1, $encoding), |
6781 | 6781 | self::strlen($str2, $encoding) |
6782 | 6782 | ); |
@@ -6825,13 +6825,13 @@ discard block |
||
6825 | 6825 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6826 | 6826 | |
6827 | 6827 | if ($encoding === 'UTF-8') { |
6828 | - $str_length = (int) \mb_strlen($str1); |
|
6829 | - $other_length = (int) \mb_strlen($str2); |
|
6828 | + $str_length = (int)\mb_strlen($str1); |
|
6829 | + $other_length = (int)\mb_strlen($str2); |
|
6830 | 6830 | } else { |
6831 | 6831 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6832 | 6832 | |
6833 | - $str_length = (int) self::strlen($str1, $encoding); |
|
6834 | - $other_length = (int) self::strlen($str2, $encoding); |
|
6833 | + $str_length = (int)self::strlen($str1, $encoding); |
|
6834 | + $other_length = (int)self::strlen($str2, $encoding); |
|
6835 | 6835 | } |
6836 | 6836 | |
6837 | 6837 | // Return if either string is empty |
@@ -6884,10 +6884,10 @@ discard block |
||
6884 | 6884 | } |
6885 | 6885 | |
6886 | 6886 | if ($encoding === 'UTF-8') { |
6887 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
6887 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
6888 | 6888 | } |
6889 | 6889 | |
6890 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
6890 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
6891 | 6891 | } |
6892 | 6892 | |
6893 | 6893 | /** |
@@ -6911,7 +6911,7 @@ discard block |
||
6911 | 6911 | } |
6912 | 6912 | |
6913 | 6913 | if ($encoding === 'UTF-8') { |
6914 | - $max_length = (int) \min( |
|
6914 | + $max_length = (int)\min( |
|
6915 | 6915 | \mb_strlen($str1, $encoding), |
6916 | 6916 | \mb_strlen($str2, $encoding) |
6917 | 6917 | ); |
@@ -6925,7 +6925,7 @@ discard block |
||
6925 | 6925 | && |
6926 | 6926 | $char === \mb_substr($str2, -$i, 1) |
6927 | 6927 | ) { |
6928 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
6928 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
6929 | 6929 | } else { |
6930 | 6930 | break; |
6931 | 6931 | } |
@@ -6933,7 +6933,7 @@ discard block |
||
6933 | 6933 | } else { |
6934 | 6934 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6935 | 6935 | |
6936 | - $max_length = (int) \min( |
|
6936 | + $max_length = (int)\min( |
|
6937 | 6937 | self::strlen($str1, $encoding), |
6938 | 6938 | self::strlen($str2, $encoding) |
6939 | 6939 | ); |
@@ -6947,7 +6947,7 @@ discard block |
||
6947 | 6947 | && |
6948 | 6948 | $char === self::substr($str2, -$i, 1, $encoding) |
6949 | 6949 | ) { |
6950 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
6950 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
6951 | 6951 | } else { |
6952 | 6952 | break; |
6953 | 6953 | } |
@@ -6969,7 +6969,7 @@ discard block |
||
6969 | 6969 | */ |
6970 | 6970 | public static function str_matches_pattern(string $str, string $pattern): bool |
6971 | 6971 | { |
6972 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6972 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6973 | 6973 | } |
6974 | 6974 | |
6975 | 6975 | /** |
@@ -6988,7 +6988,7 @@ discard block |
||
6988 | 6988 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6989 | 6989 | { |
6990 | 6990 | // init |
6991 | - $length = (int) self::strlen($str, $encoding); |
|
6991 | + $length = (int)self::strlen($str, $encoding); |
|
6992 | 6992 | |
6993 | 6993 | if ($offset >= 0) { |
6994 | 6994 | return $length > $offset; |
@@ -7017,7 +7017,7 @@ discard block |
||
7017 | 7017 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
7018 | 7018 | { |
7019 | 7019 | // init |
7020 | - $length = (int) self::strlen($str); |
|
7020 | + $length = (int)self::strlen($str); |
|
7021 | 7021 | |
7022 | 7022 | if ( |
7023 | 7023 | ($index >= 0 && $length <= $index) |
@@ -7059,7 +7059,7 @@ discard block |
||
7059 | 7059 | return $str; |
7060 | 7060 | } |
7061 | 7061 | |
7062 | - if ($pad_type !== (int) $pad_type) { |
|
7062 | + if ($pad_type !== (int)$pad_type) { |
|
7063 | 7063 | if ($pad_type === 'left') { |
7064 | 7064 | $pad_type = \STR_PAD_LEFT; |
7065 | 7065 | } elseif ($pad_type === 'right') { |
@@ -7068,23 +7068,23 @@ discard block |
||
7068 | 7068 | $pad_type = \STR_PAD_BOTH; |
7069 | 7069 | } else { |
7070 | 7070 | throw new \InvalidArgumentException( |
7071 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
7071 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
7072 | 7072 | ); |
7073 | 7073 | } |
7074 | 7074 | } |
7075 | 7075 | |
7076 | 7076 | if ($encoding === 'UTF-8') { |
7077 | - $str_length = (int) \mb_strlen($str); |
|
7077 | + $str_length = (int)\mb_strlen($str); |
|
7078 | 7078 | |
7079 | 7079 | if ($pad_length >= $str_length) { |
7080 | 7080 | switch ($pad_type) { |
7081 | 7081 | case \STR_PAD_LEFT: |
7082 | - $ps_length = (int) \mb_strlen($pad_string); |
|
7082 | + $ps_length = (int)\mb_strlen($pad_string); |
|
7083 | 7083 | |
7084 | 7084 | $diff = ($pad_length - $str_length); |
7085 | 7085 | |
7086 | - $pre = (string) \mb_substr( |
|
7087 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7086 | + $pre = (string)\mb_substr( |
|
7087 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7088 | 7088 | 0, |
7089 | 7089 | $diff |
7090 | 7090 | ); |
@@ -7095,16 +7095,16 @@ discard block |
||
7095 | 7095 | case \STR_PAD_BOTH: |
7096 | 7096 | $diff = ($pad_length - $str_length); |
7097 | 7097 | |
7098 | - $ps_length_left = (int) \floor($diff / 2); |
|
7098 | + $ps_length_left = (int)\floor($diff / 2); |
|
7099 | 7099 | |
7100 | - $ps_length_right = (int) \ceil($diff / 2); |
|
7100 | + $ps_length_right = (int)\ceil($diff / 2); |
|
7101 | 7101 | |
7102 | - $pre = (string) \mb_substr( |
|
7102 | + $pre = (string)\mb_substr( |
|
7103 | 7103 | \str_repeat($pad_string, $ps_length_left), |
7104 | 7104 | 0, |
7105 | 7105 | $ps_length_left |
7106 | 7106 | ); |
7107 | - $post = (string) \mb_substr( |
|
7107 | + $post = (string)\mb_substr( |
|
7108 | 7108 | \str_repeat($pad_string, $ps_length_right), |
7109 | 7109 | 0, |
7110 | 7110 | $ps_length_right |
@@ -7114,19 +7114,19 @@ discard block |
||
7114 | 7114 | |
7115 | 7115 | case \STR_PAD_RIGHT: |
7116 | 7116 | default: |
7117 | - $ps_length = (int) \mb_strlen($pad_string); |
|
7117 | + $ps_length = (int)\mb_strlen($pad_string); |
|
7118 | 7118 | |
7119 | 7119 | $diff = ($pad_length - $str_length); |
7120 | 7120 | |
7121 | - $post = (string) \mb_substr( |
|
7122 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7121 | + $post = (string)\mb_substr( |
|
7122 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7123 | 7123 | 0, |
7124 | 7124 | $diff |
7125 | 7125 | ); |
7126 | 7126 | $pre = ''; |
7127 | 7127 | } |
7128 | 7128 | |
7129 | - return $pre . $str . $post; |
|
7129 | + return $pre.$str.$post; |
|
7130 | 7130 | } |
7131 | 7131 | |
7132 | 7132 | return $str; |
@@ -7134,17 +7134,17 @@ discard block |
||
7134 | 7134 | |
7135 | 7135 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7136 | 7136 | |
7137 | - $str_length = (int) self::strlen($str, $encoding); |
|
7137 | + $str_length = (int)self::strlen($str, $encoding); |
|
7138 | 7138 | |
7139 | 7139 | if ($pad_length >= $str_length) { |
7140 | 7140 | switch ($pad_type) { |
7141 | 7141 | case \STR_PAD_LEFT: |
7142 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
7142 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
7143 | 7143 | |
7144 | 7144 | $diff = ($pad_length - $str_length); |
7145 | 7145 | |
7146 | - $pre = (string) self::substr( |
|
7147 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7146 | + $pre = (string)self::substr( |
|
7147 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7148 | 7148 | 0, |
7149 | 7149 | $diff, |
7150 | 7150 | $encoding |
@@ -7156,17 +7156,17 @@ discard block |
||
7156 | 7156 | case \STR_PAD_BOTH: |
7157 | 7157 | $diff = ($pad_length - $str_length); |
7158 | 7158 | |
7159 | - $ps_length_left = (int) \floor($diff / 2); |
|
7159 | + $ps_length_left = (int)\floor($diff / 2); |
|
7160 | 7160 | |
7161 | - $ps_length_right = (int) \ceil($diff / 2); |
|
7161 | + $ps_length_right = (int)\ceil($diff / 2); |
|
7162 | 7162 | |
7163 | - $pre = (string) self::substr( |
|
7163 | + $pre = (string)self::substr( |
|
7164 | 7164 | \str_repeat($pad_string, $ps_length_left), |
7165 | 7165 | 0, |
7166 | 7166 | $ps_length_left, |
7167 | 7167 | $encoding |
7168 | 7168 | ); |
7169 | - $post = (string) self::substr( |
|
7169 | + $post = (string)self::substr( |
|
7170 | 7170 | \str_repeat($pad_string, $ps_length_right), |
7171 | 7171 | 0, |
7172 | 7172 | $ps_length_right, |
@@ -7177,12 +7177,12 @@ discard block |
||
7177 | 7177 | |
7178 | 7178 | case \STR_PAD_RIGHT: |
7179 | 7179 | default: |
7180 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
7180 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
7181 | 7181 | |
7182 | 7182 | $diff = ($pad_length - $str_length); |
7183 | 7183 | |
7184 | - $post = (string) self::substr( |
|
7185 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7184 | + $post = (string)self::substr( |
|
7185 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7186 | 7186 | 0, |
7187 | 7187 | $diff, |
7188 | 7188 | $encoding |
@@ -7190,7 +7190,7 @@ discard block |
||
7190 | 7190 | $pre = ''; |
7191 | 7191 | } |
7192 | 7192 | |
7193 | - return $pre . $str . $post; |
|
7193 | + return $pre.$str.$post; |
|
7194 | 7194 | } |
7195 | 7195 | |
7196 | 7196 | return $str; |
@@ -7387,11 +7387,11 @@ discard block |
||
7387 | 7387 | } |
7388 | 7388 | |
7389 | 7389 | if ($search === '') { |
7390 | - return $str . $replacement; |
|
7390 | + return $str.$replacement; |
|
7391 | 7391 | } |
7392 | 7392 | |
7393 | 7393 | if (\strpos($str, $search) === 0) { |
7394 | - return $replacement . \substr($str, \strlen($search)); |
|
7394 | + return $replacement.\substr($str, \strlen($search)); |
|
7395 | 7395 | } |
7396 | 7396 | |
7397 | 7397 | return $str; |
@@ -7425,11 +7425,11 @@ discard block |
||
7425 | 7425 | } |
7426 | 7426 | |
7427 | 7427 | if ($search === '') { |
7428 | - return $str . $replacement; |
|
7428 | + return $str.$replacement; |
|
7429 | 7429 | } |
7430 | 7430 | |
7431 | 7431 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
7432 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
7432 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
7433 | 7433 | } |
7434 | 7434 | |
7435 | 7435 | return $str; |
@@ -7463,7 +7463,7 @@ discard block |
||
7463 | 7463 | $subject, |
7464 | 7464 | $replace, |
7465 | 7465 | $pos, |
7466 | - (int) self::strlen($search) |
|
7466 | + (int)self::strlen($search) |
|
7467 | 7467 | ); |
7468 | 7468 | } |
7469 | 7469 | |
@@ -7497,7 +7497,7 @@ discard block |
||
7497 | 7497 | $subject, |
7498 | 7498 | $replace, |
7499 | 7499 | $pos, |
7500 | - (int) self::strlen($search) |
|
7500 | + (int)self::strlen($search) |
|
7501 | 7501 | ); |
7502 | 7502 | } |
7503 | 7503 | |
@@ -7520,7 +7520,7 @@ discard block |
||
7520 | 7520 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
7521 | 7521 | { |
7522 | 7522 | if ($encoding === 'UTF-8') { |
7523 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
7523 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
7524 | 7524 | /** @noinspection NonSecureShuffleUsageInspection */ |
7525 | 7525 | \shuffle($indexes); |
7526 | 7526 | |
@@ -7536,7 +7536,7 @@ discard block |
||
7536 | 7536 | } else { |
7537 | 7537 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7538 | 7538 | |
7539 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
7539 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
7540 | 7540 | /** @noinspection NonSecureShuffleUsageInspection */ |
7541 | 7541 | \shuffle($indexes); |
7542 | 7542 | |
@@ -7579,11 +7579,11 @@ discard block |
||
7579 | 7579 | ) { |
7580 | 7580 | if ($encoding === 'UTF-8') { |
7581 | 7581 | if ($end === null) { |
7582 | - $length = (int) \mb_strlen($str); |
|
7582 | + $length = (int)\mb_strlen($str); |
|
7583 | 7583 | } elseif ($end >= 0 && $end <= $start) { |
7584 | 7584 | return ''; |
7585 | 7585 | } elseif ($end < 0) { |
7586 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7586 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7587 | 7587 | } else { |
7588 | 7588 | $length = $end - $start; |
7589 | 7589 | } |
@@ -7594,11 +7594,11 @@ discard block |
||
7594 | 7594 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7595 | 7595 | |
7596 | 7596 | if ($end === null) { |
7597 | - $length = (int) self::strlen($str, $encoding); |
|
7597 | + $length = (int)self::strlen($str, $encoding); |
|
7598 | 7598 | } elseif ($end >= 0 && $end <= $start) { |
7599 | 7599 | return ''; |
7600 | 7600 | } elseif ($end < 0) { |
7601 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7601 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7602 | 7602 | } else { |
7603 | 7603 | $length = $end - $start; |
7604 | 7604 | } |
@@ -7633,7 +7633,7 @@ discard block |
||
7633 | 7633 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7634 | 7634 | } |
7635 | 7635 | |
7636 | - $str = (string) \preg_replace_callback( |
|
7636 | + $str = (string)\preg_replace_callback( |
|
7637 | 7637 | '/([\\p{N}|\\p{Lu}])/u', |
7638 | 7638 | /** |
7639 | 7639 | * @param string[] $matches |
@@ -7642,28 +7642,28 @@ discard block |
||
7642 | 7642 | * |
7643 | 7643 | * @return string |
7644 | 7644 | */ |
7645 | - static function (array $matches) use ($encoding): string { |
|
7645 | + static function(array $matches) use ($encoding): string { |
|
7646 | 7646 | $match = $matches[1]; |
7647 | - $match_int = (int) $match; |
|
7647 | + $match_int = (int)$match; |
|
7648 | 7648 | |
7649 | - if ((string) $match_int === $match) { |
|
7650 | - return '_' . $match . '_'; |
|
7649 | + if ((string)$match_int === $match) { |
|
7650 | + return '_'.$match.'_'; |
|
7651 | 7651 | } |
7652 | 7652 | |
7653 | 7653 | if ($encoding === 'UTF-8') { |
7654 | - return '_' . \mb_strtolower($match); |
|
7654 | + return '_'.\mb_strtolower($match); |
|
7655 | 7655 | } |
7656 | 7656 | |
7657 | - return '_' . self::strtolower($match, $encoding); |
|
7657 | + return '_'.self::strtolower($match, $encoding); |
|
7658 | 7658 | }, |
7659 | 7659 | $str |
7660 | 7660 | ); |
7661 | 7661 | |
7662 | - $str = (string) \preg_replace( |
|
7662 | + $str = (string)\preg_replace( |
|
7663 | 7663 | [ |
7664 | - '/\\s+/u', // convert spaces to "_" |
|
7664 | + '/\\s+/u', // convert spaces to "_" |
|
7665 | 7665 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
7666 | - '/_+/', // remove double "_" |
|
7666 | + '/_+/', // remove double "_" |
|
7667 | 7667 | ], |
7668 | 7668 | [ |
7669 | 7669 | '_', |
@@ -7745,7 +7745,7 @@ discard block |
||
7745 | 7745 | } |
7746 | 7746 | |
7747 | 7747 | // init |
7748 | - $str = (string) $str; |
|
7748 | + $str = (string)$str; |
|
7749 | 7749 | |
7750 | 7750 | if ($str === '') { |
7751 | 7751 | return []; |
@@ -7799,7 +7799,7 @@ discard block |
||
7799 | 7799 | ($str[$i] & "\xE0") === "\xC0" |
7800 | 7800 | ) { |
7801 | 7801 | if (($str[$i + 1] & "\xC0") === "\x80") { |
7802 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
7802 | + $ret[] = $str[$i].$str[$i + 1]; |
|
7803 | 7803 | |
7804 | 7804 | ++$i; |
7805 | 7805 | } |
@@ -7813,7 +7813,7 @@ discard block |
||
7813 | 7813 | && |
7814 | 7814 | ($str[$i + 2] & "\xC0") === "\x80" |
7815 | 7815 | ) { |
7816 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
7816 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
7817 | 7817 | |
7818 | 7818 | $i += 2; |
7819 | 7819 | } |
@@ -7829,7 +7829,7 @@ discard block |
||
7829 | 7829 | && |
7830 | 7830 | ($str[$i + 3] & "\xC0") === "\x80" |
7831 | 7831 | ) { |
7832 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
7832 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
7833 | 7833 | |
7834 | 7834 | $i += 3; |
7835 | 7835 | } |
@@ -7841,7 +7841,7 @@ discard block |
||
7841 | 7841 | $ret = \array_chunk($ret, $length); |
7842 | 7842 | |
7843 | 7843 | return \array_map( |
7844 | - static function (array &$item): string { |
|
7844 | + static function(array &$item): string { |
|
7845 | 7845 | return \implode('', $item); |
7846 | 7846 | }, |
7847 | 7847 | $ret |
@@ -7907,7 +7907,7 @@ discard block |
||
7907 | 7907 | $limit = -1; |
7908 | 7908 | } |
7909 | 7909 | |
7910 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7910 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7911 | 7911 | |
7912 | 7912 | if ($array === false) { |
7913 | 7913 | return []; |
@@ -7997,9 +7997,9 @@ discard block |
||
7997 | 7997 | return ''; |
7998 | 7998 | } |
7999 | 7999 | |
8000 | - return (string) \mb_substr( |
|
8000 | + return (string)\mb_substr( |
|
8001 | 8001 | $str, |
8002 | - $offset + (int) \mb_strlen($separator) |
|
8002 | + $offset + (int)\mb_strlen($separator) |
|
8003 | 8003 | ); |
8004 | 8004 | } |
8005 | 8005 | |
@@ -8008,9 +8008,9 @@ discard block |
||
8008 | 8008 | return ''; |
8009 | 8009 | } |
8010 | 8010 | |
8011 | - return (string) \mb_substr( |
|
8011 | + return (string)\mb_substr( |
|
8012 | 8012 | $str, |
8013 | - $offset + (int) self::strlen($separator, $encoding), |
|
8013 | + $offset + (int)self::strlen($separator, $encoding), |
|
8014 | 8014 | null, |
8015 | 8015 | $encoding |
8016 | 8016 | ); |
@@ -8039,9 +8039,9 @@ discard block |
||
8039 | 8039 | return ''; |
8040 | 8040 | } |
8041 | 8041 | |
8042 | - return (string) \mb_substr( |
|
8042 | + return (string)\mb_substr( |
|
8043 | 8043 | $str, |
8044 | - $offset + (int) \mb_strlen($separator) |
|
8044 | + $offset + (int)\mb_strlen($separator) |
|
8045 | 8045 | ); |
8046 | 8046 | } |
8047 | 8047 | |
@@ -8050,9 +8050,9 @@ discard block |
||
8050 | 8050 | return ''; |
8051 | 8051 | } |
8052 | 8052 | |
8053 | - return (string) self::substr( |
|
8053 | + return (string)self::substr( |
|
8054 | 8054 | $str, |
8055 | - $offset + (int) self::strlen($separator, $encoding), |
|
8055 | + $offset + (int)self::strlen($separator, $encoding), |
|
8056 | 8056 | null, |
8057 | 8057 | $encoding |
8058 | 8058 | ); |
@@ -8084,7 +8084,7 @@ discard block |
||
8084 | 8084 | return ''; |
8085 | 8085 | } |
8086 | 8086 | |
8087 | - return (string) \mb_substr( |
|
8087 | + return (string)\mb_substr( |
|
8088 | 8088 | $str, |
8089 | 8089 | 0, |
8090 | 8090 | $offset |
@@ -8096,7 +8096,7 @@ discard block |
||
8096 | 8096 | return ''; |
8097 | 8097 | } |
8098 | 8098 | |
8099 | - return (string) self::substr( |
|
8099 | + return (string)self::substr( |
|
8100 | 8100 | $str, |
8101 | 8101 | 0, |
8102 | 8102 | $offset, |
@@ -8127,7 +8127,7 @@ discard block |
||
8127 | 8127 | return ''; |
8128 | 8128 | } |
8129 | 8129 | |
8130 | - return (string) \mb_substr( |
|
8130 | + return (string)\mb_substr( |
|
8131 | 8131 | $str, |
8132 | 8132 | 0, |
8133 | 8133 | $offset |
@@ -8141,7 +8141,7 @@ discard block |
||
8141 | 8141 | |
8142 | 8142 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8143 | 8143 | |
8144 | - return (string) self::substr( |
|
8144 | + return (string)self::substr( |
|
8145 | 8145 | $str, |
8146 | 8146 | 0, |
8147 | 8147 | $offset, |
@@ -8256,7 +8256,7 @@ discard block |
||
8256 | 8256 | */ |
8257 | 8257 | public static function str_surround(string $str, string $substring): string |
8258 | 8258 | { |
8259 | - return $substring . $str . $substring; |
|
8259 | + return $substring.$str.$substring; |
|
8260 | 8260 | } |
8261 | 8261 | |
8262 | 8262 | /** |
@@ -8318,9 +8318,9 @@ discard block |
||
8318 | 8318 | $word_define_chars = ''; |
8319 | 8319 | } |
8320 | 8320 | |
8321 | - $str = (string) \preg_replace_callback( |
|
8322 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
8323 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
8321 | + $str = (string)\preg_replace_callback( |
|
8322 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
8323 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
8324 | 8324 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
8325 | 8325 | return $match[0]; |
8326 | 8326 | } |
@@ -8419,16 +8419,16 @@ discard block |
||
8419 | 8419 | } |
8420 | 8420 | |
8421 | 8421 | // the main substitutions |
8422 | - $str = (string) \preg_replace_callback( |
|
8422 | + $str = (string)\preg_replace_callback( |
|
8423 | 8423 | '~\\b (_*) (?: # 1. Leading underscore and |
8424 | 8424 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
8425 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
8425 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
8426 | 8426 | | |
8427 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
8427 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
8428 | 8428 | | |
8429 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
8429 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
8430 | 8430 | | |
8431 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
8431 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
8432 | 8432 | ) (_*) \\b # 6. With trailing underscore |
8433 | 8433 | ~ux', |
8434 | 8434 | /** |
@@ -8438,7 +8438,7 @@ discard block |
||
8438 | 8438 | * |
8439 | 8439 | * @return string |
8440 | 8440 | */ |
8441 | - static function (array $matches) use ($encoding): string { |
|
8441 | + static function(array $matches) use ($encoding): string { |
|
8442 | 8442 | // preserve leading underscore |
8443 | 8443 | $str = $matches[1]; |
8444 | 8444 | if ($matches[2]) { |
@@ -8463,11 +8463,11 @@ discard block |
||
8463 | 8463 | ); |
8464 | 8464 | |
8465 | 8465 | // Exceptions for small words: capitalize at start of title... |
8466 | - $str = (string) \preg_replace_callback( |
|
8466 | + $str = (string)\preg_replace_callback( |
|
8467 | 8467 | '~( \\A [[:punct:]]* # start of title... |
8468 | 8468 | | [:.;?!][ ]+ # or of subsentence... |
8469 | 8469 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
8470 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
8470 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
8471 | 8471 | ~uxi', |
8472 | 8472 | /** |
8473 | 8473 | * @param string[] $matches |
@@ -8476,15 +8476,15 @@ discard block |
||
8476 | 8476 | * |
8477 | 8477 | * @return string |
8478 | 8478 | */ |
8479 | - static function (array $matches) use ($encoding): string { |
|
8480 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
8479 | + static function(array $matches) use ($encoding): string { |
|
8480 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
8481 | 8481 | }, |
8482 | 8482 | $str |
8483 | 8483 | ); |
8484 | 8484 | |
8485 | 8485 | // ...and end of title |
8486 | - $str = (string) \preg_replace_callback( |
|
8487 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
8486 | + $str = (string)\preg_replace_callback( |
|
8487 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
8488 | 8488 | (?= [[:punct:]]* \Z # ...at the end of the title... |
8489 | 8489 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
8490 | 8490 | ~uxi', |
@@ -8495,7 +8495,7 @@ discard block |
||
8495 | 8495 | * |
8496 | 8496 | * @return string |
8497 | 8497 | */ |
8498 | - static function (array $matches) use ($encoding): string { |
|
8498 | + static function(array $matches) use ($encoding): string { |
|
8499 | 8499 | return static::ucfirst($matches[1], $encoding); |
8500 | 8500 | }, |
8501 | 8501 | $str |
@@ -8503,10 +8503,10 @@ discard block |
||
8503 | 8503 | |
8504 | 8504 | // Exceptions for small words in hyphenated compound words. |
8505 | 8505 | // e.g. "in-flight" -> In-Flight |
8506 | - $str = (string) \preg_replace_callback( |
|
8506 | + $str = (string)\preg_replace_callback( |
|
8507 | 8507 | '~\\b |
8508 | 8508 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
8509 | - ( ' . $small_words_rx . ' ) |
|
8509 | + ( ' . $small_words_rx.' ) |
|
8510 | 8510 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
8511 | 8511 | ~uxi', |
8512 | 8512 | /** |
@@ -8516,18 +8516,18 @@ discard block |
||
8516 | 8516 | * |
8517 | 8517 | * @return string |
8518 | 8518 | */ |
8519 | - static function (array $matches) use ($encoding): string { |
|
8519 | + static function(array $matches) use ($encoding): string { |
|
8520 | 8520 | return static::ucfirst($matches[1], $encoding); |
8521 | 8521 | }, |
8522 | 8522 | $str |
8523 | 8523 | ); |
8524 | 8524 | |
8525 | 8525 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
8526 | - $str = (string) \preg_replace_callback( |
|
8526 | + $str = (string)\preg_replace_callback( |
|
8527 | 8527 | '~\\b |
8528 | 8528 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
8529 | 8529 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
8530 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
8530 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
8531 | 8531 | (?! - ) # Negative lookahead for another - |
8532 | 8532 | ~uxi', |
8533 | 8533 | /** |
@@ -8537,8 +8537,8 @@ discard block |
||
8537 | 8537 | * |
8538 | 8538 | * @return string |
8539 | 8539 | */ |
8540 | - static function (array $matches) use ($encoding): string { |
|
8541 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
8540 | + static function(array $matches) use ($encoding): string { |
|
8541 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
8542 | 8542 | }, |
8543 | 8543 | $str |
8544 | 8544 | ); |
@@ -8653,7 +8653,7 @@ discard block |
||
8653 | 8653 | ); |
8654 | 8654 | |
8655 | 8655 | foreach ($tmp_return as &$item) { |
8656 | - $item = (string) $item; |
|
8656 | + $item = (string)$item; |
|
8657 | 8657 | } |
8658 | 8658 | |
8659 | 8659 | return $tmp_return; |
@@ -8707,39 +8707,39 @@ discard block |
||
8707 | 8707 | } |
8708 | 8708 | |
8709 | 8709 | if ($encoding === 'UTF-8') { |
8710 | - if ($length >= (int) \mb_strlen($str)) { |
|
8710 | + if ($length >= (int)\mb_strlen($str)) { |
|
8711 | 8711 | return $str; |
8712 | 8712 | } |
8713 | 8713 | |
8714 | 8714 | if ($substring !== '') { |
8715 | - $length -= (int) \mb_strlen($substring); |
|
8715 | + $length -= (int)\mb_strlen($substring); |
|
8716 | 8716 | |
8717 | 8717 | /** @noinspection UnnecessaryCastingInspection */ |
8718 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8718 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8719 | 8719 | } |
8720 | 8720 | |
8721 | 8721 | /** @noinspection UnnecessaryCastingInspection */ |
8722 | - return (string) \mb_substr($str, 0, $length); |
|
8722 | + return (string)\mb_substr($str, 0, $length); |
|
8723 | 8723 | } |
8724 | 8724 | |
8725 | 8725 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8726 | 8726 | |
8727 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8727 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8728 | 8728 | return $str; |
8729 | 8729 | } |
8730 | 8730 | |
8731 | 8731 | if ($substring !== '') { |
8732 | - $length -= (int) self::strlen($substring, $encoding); |
|
8732 | + $length -= (int)self::strlen($substring, $encoding); |
|
8733 | 8733 | } |
8734 | 8734 | |
8735 | 8735 | return ( |
8736 | - (string) self::substr( |
|
8736 | + (string)self::substr( |
|
8737 | 8737 | $str, |
8738 | 8738 | 0, |
8739 | 8739 | $length, |
8740 | 8740 | $encoding |
8741 | 8741 | ) |
8742 | - ) . $substring; |
|
8742 | + ).$substring; |
|
8743 | 8743 | } |
8744 | 8744 | |
8745 | 8745 | /** |
@@ -8773,12 +8773,12 @@ discard block |
||
8773 | 8773 | } |
8774 | 8774 | |
8775 | 8775 | if ($encoding === 'UTF-8') { |
8776 | - if ($length >= (int) \mb_strlen($str)) { |
|
8776 | + if ($length >= (int)\mb_strlen($str)) { |
|
8777 | 8777 | return $str; |
8778 | 8778 | } |
8779 | 8779 | |
8780 | 8780 | // need to further trim the string so we can append the substring |
8781 | - $length -= (int) \mb_strlen($substring); |
|
8781 | + $length -= (int)\mb_strlen($substring); |
|
8782 | 8782 | if ($length <= 0) { |
8783 | 8783 | return $substring; |
8784 | 8784 | } |
@@ -8800,18 +8800,18 @@ discard block |
||
8800 | 8800 | || |
8801 | 8801 | ($space_position !== false && $ignore_do_not_split_words_for_one_word === false) |
8802 | 8802 | ) { |
8803 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
8803 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
8804 | 8804 | } |
8805 | 8805 | } |
8806 | 8806 | } else { |
8807 | 8807 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8808 | 8808 | |
8809 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8809 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8810 | 8810 | return $str; |
8811 | 8811 | } |
8812 | 8812 | |
8813 | 8813 | // need to further trim the string so we can append the substring |
8814 | - $length -= (int) self::strlen($substring, $encoding); |
|
8814 | + $length -= (int)self::strlen($substring, $encoding); |
|
8815 | 8815 | if ($length <= 0) { |
8816 | 8816 | return $substring; |
8817 | 8817 | } |
@@ -8833,12 +8833,12 @@ discard block |
||
8833 | 8833 | || |
8834 | 8834 | ($space_position !== false && $ignore_do_not_split_words_for_one_word === false) |
8835 | 8835 | ) { |
8836 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
8836 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
8837 | 8837 | } |
8838 | 8838 | } |
8839 | 8839 | } |
8840 | 8840 | |
8841 | - return $truncated . $substring; |
|
8841 | + return $truncated.$substring; |
|
8842 | 8842 | } |
8843 | 8843 | |
8844 | 8844 | /** |
@@ -8947,13 +8947,13 @@ discard block |
||
8947 | 8947 | } |
8948 | 8948 | } elseif ($format === 2) { |
8949 | 8949 | $number_of_words = []; |
8950 | - $offset = (int) self::strlen($str_parts[0]); |
|
8950 | + $offset = (int)self::strlen($str_parts[0]); |
|
8951 | 8951 | for ($i = 1; $i < $len; $i += 2) { |
8952 | 8952 | $number_of_words[$offset] = $str_parts[$i]; |
8953 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
8953 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
8954 | 8954 | } |
8955 | 8955 | } else { |
8956 | - $number_of_words = (int) (($len - 1) / 2); |
|
8956 | + $number_of_words = (int)(($len - 1) / 2); |
|
8957 | 8957 | } |
8958 | 8958 | |
8959 | 8959 | return $number_of_words; |
@@ -9082,21 +9082,21 @@ discard block |
||
9082 | 9082 | } |
9083 | 9083 | |
9084 | 9084 | if ($char_list === '') { |
9085 | - return (int) self::strlen($str, $encoding); |
|
9085 | + return (int)self::strlen($str, $encoding); |
|
9086 | 9086 | } |
9087 | 9087 | |
9088 | 9088 | if ($offset !== null || $length !== null) { |
9089 | 9089 | if ($encoding === 'UTF-8') { |
9090 | 9090 | if ($length === null) { |
9091 | 9091 | /** @noinspection UnnecessaryCastingInspection */ |
9092 | - $str_tmp = \mb_substr($str, (int) $offset); |
|
9092 | + $str_tmp = \mb_substr($str, (int)$offset); |
|
9093 | 9093 | } else { |
9094 | 9094 | /** @noinspection UnnecessaryCastingInspection */ |
9095 | - $str_tmp = \mb_substr($str, (int) $offset, $length); |
|
9095 | + $str_tmp = \mb_substr($str, (int)$offset, $length); |
|
9096 | 9096 | } |
9097 | 9097 | } else { |
9098 | 9098 | /** @noinspection UnnecessaryCastingInspection */ |
9099 | - $str_tmp = self::substr($str, (int) $offset, $length, $encoding); |
|
9099 | + $str_tmp = self::substr($str, (int)$offset, $length, $encoding); |
|
9100 | 9100 | } |
9101 | 9101 | |
9102 | 9102 | if ($str_tmp === false) { |
@@ -9112,7 +9112,7 @@ discard block |
||
9112 | 9112 | } |
9113 | 9113 | |
9114 | 9114 | $matches = []; |
9115 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
9115 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
9116 | 9116 | $return = self::strlen($matches[1], $encoding); |
9117 | 9117 | if ($return === false) { |
9118 | 9118 | return 0; |
@@ -9121,7 +9121,7 @@ discard block |
||
9121 | 9121 | return $return; |
9122 | 9122 | } |
9123 | 9123 | |
9124 | - return (int) self::strlen($str, $encoding); |
|
9124 | + return (int)self::strlen($str, $encoding); |
|
9125 | 9125 | } |
9126 | 9126 | |
9127 | 9127 | /** |
@@ -9176,7 +9176,7 @@ discard block |
||
9176 | 9176 | |
9177 | 9177 | $str = ''; |
9178 | 9178 | foreach ($array as $strPart) { |
9179 | - $str .= '&#' . (int) $strPart . ';'; |
|
9179 | + $str .= '&#'.(int)$strPart.';'; |
|
9180 | 9180 | } |
9181 | 9181 | |
9182 | 9182 | return self::html_entity_decode($str, \ENT_QUOTES | \ENT_HTML5); |
@@ -9265,7 +9265,7 @@ discard block |
||
9265 | 9265 | return ''; |
9266 | 9266 | } |
9267 | 9267 | |
9268 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
9268 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
9269 | 9269 | } |
9270 | 9270 | |
9271 | 9271 | /** |
@@ -9332,7 +9332,7 @@ discard block |
||
9332 | 9332 | // fallback for ascii only |
9333 | 9333 | // |
9334 | 9334 | |
9335 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9335 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9336 | 9336 | return \stripos($haystack, $needle, $offset); |
9337 | 9337 | } |
9338 | 9338 | |
@@ -9405,7 +9405,7 @@ discard block |
||
9405 | 9405 | /** |
9406 | 9406 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
9407 | 9407 | */ |
9408 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9408 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9409 | 9409 | } |
9410 | 9410 | |
9411 | 9411 | if ( |
@@ -9419,11 +9419,11 @@ discard block |
||
9419 | 9419 | } |
9420 | 9420 | } |
9421 | 9421 | |
9422 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
9422 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
9423 | 9423 | return \stristr($haystack, $needle, $before_needle); |
9424 | 9424 | } |
9425 | 9425 | |
9426 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
9426 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
9427 | 9427 | |
9428 | 9428 | if (!isset($match[1])) { |
9429 | 9429 | return false; |
@@ -9433,7 +9433,7 @@ discard block |
||
9433 | 9433 | return $match[1]; |
9434 | 9434 | } |
9435 | 9435 | |
9436 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
9436 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
9437 | 9437 | } |
9438 | 9438 | |
9439 | 9439 | /** |
@@ -9510,7 +9510,7 @@ discard block |
||
9510 | 9510 | /** |
9511 | 9511 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
9512 | 9512 | */ |
9513 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9513 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9514 | 9514 | } |
9515 | 9515 | |
9516 | 9516 | // |
@@ -9632,8 +9632,8 @@ discard block |
||
9632 | 9632 | } |
9633 | 9633 | |
9634 | 9634 | return \strnatcmp( |
9635 | - (string) self::strtonatfold($str1), |
|
9636 | - (string) self::strtonatfold($str2) |
|
9635 | + (string)self::strtonatfold($str1), |
|
9636 | + (string)self::strtonatfold($str2) |
|
9637 | 9637 | ); |
9638 | 9638 | } |
9639 | 9639 | |
@@ -9695,11 +9695,11 @@ discard block |
||
9695 | 9695 | } |
9696 | 9696 | |
9697 | 9697 | if ($encoding === 'UTF-8') { |
9698 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
9699 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
9698 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
9699 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
9700 | 9700 | } else { |
9701 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
9702 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
9701 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
9702 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
9703 | 9703 | } |
9704 | 9704 | |
9705 | 9705 | return self::strcmp($str1, $str2); |
@@ -9723,8 +9723,8 @@ discard block |
||
9723 | 9723 | return false; |
9724 | 9724 | } |
9725 | 9725 | |
9726 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
9727 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
9726 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
9727 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
9728 | 9728 | } |
9729 | 9729 | |
9730 | 9730 | return false; |
@@ -9759,10 +9759,10 @@ discard block |
||
9759 | 9759 | } |
9760 | 9760 | |
9761 | 9761 | // iconv and mbstring do not support integer $needle |
9762 | - if ((int) $needle === $needle) { |
|
9763 | - $needle = (string) self::chr($needle); |
|
9762 | + if ((int)$needle === $needle) { |
|
9763 | + $needle = (string)self::chr($needle); |
|
9764 | 9764 | } |
9765 | - $needle = (string) $needle; |
|
9765 | + $needle = (string)$needle; |
|
9766 | 9766 | |
9767 | 9767 | if ($needle === '') { |
9768 | 9768 | return false; |
@@ -9812,7 +9812,7 @@ discard block |
||
9812 | 9812 | /** |
9813 | 9813 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
9814 | 9814 | */ |
9815 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9815 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9816 | 9816 | } |
9817 | 9817 | |
9818 | 9818 | // |
@@ -9853,7 +9853,7 @@ discard block |
||
9853 | 9853 | // fallback for ascii only |
9854 | 9854 | // |
9855 | 9855 | |
9856 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9856 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9857 | 9857 | return \strpos($haystack, $needle, $offset); |
9858 | 9858 | } |
9859 | 9859 | |
@@ -9865,7 +9865,7 @@ discard block |
||
9865 | 9865 | if ($haystack_tmp === false) { |
9866 | 9866 | $haystack_tmp = ''; |
9867 | 9867 | } |
9868 | - $haystack = (string) $haystack_tmp; |
|
9868 | + $haystack = (string)$haystack_tmp; |
|
9869 | 9869 | |
9870 | 9870 | if ($offset < 0) { |
9871 | 9871 | $offset = 0; |
@@ -9877,7 +9877,7 @@ discard block |
||
9877 | 9877 | } |
9878 | 9878 | |
9879 | 9879 | if ($pos) { |
9880 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9880 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9881 | 9881 | } |
9882 | 9882 | |
9883 | 9883 | return $offset + 0; |
@@ -9995,7 +9995,7 @@ discard block |
||
9995 | 9995 | /** |
9996 | 9996 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
9997 | 9997 | */ |
9998 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9998 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9999 | 9999 | } |
10000 | 10000 | |
10001 | 10001 | // |
@@ -10007,7 +10007,7 @@ discard block |
||
10007 | 10007 | if ($needle_tmp === false) { |
10008 | 10008 | return false; |
10009 | 10009 | } |
10010 | - $needle = (string) $needle_tmp; |
|
10010 | + $needle = (string)$needle_tmp; |
|
10011 | 10011 | |
10012 | 10012 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
10013 | 10013 | if ($pos === false) { |
@@ -10029,7 +10029,7 @@ discard block |
||
10029 | 10029 | if ($needle_tmp === false) { |
10030 | 10030 | return false; |
10031 | 10031 | } |
10032 | - $needle = (string) $needle_tmp; |
|
10032 | + $needle = (string)$needle_tmp; |
|
10033 | 10033 | |
10034 | 10034 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
10035 | 10035 | if ($pos === false) { |
@@ -10067,7 +10067,7 @@ discard block |
||
10067 | 10067 | if ($encoding === 'UTF-8') { |
10068 | 10068 | if (self::$SUPPORT['intl'] === true) { |
10069 | 10069 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
10070 | - $i = (int) \grapheme_strlen($str); |
|
10070 | + $i = (int)\grapheme_strlen($str); |
|
10071 | 10071 | while ($i--) { |
10072 | 10072 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
10073 | 10073 | if ($reversed_tmp !== false) { |
@@ -10075,7 +10075,7 @@ discard block |
||
10075 | 10075 | } |
10076 | 10076 | } |
10077 | 10077 | } else { |
10078 | - $i = (int) \mb_strlen($str); |
|
10078 | + $i = (int)\mb_strlen($str); |
|
10079 | 10079 | while ($i--) { |
10080 | 10080 | $reversed_tmp = \mb_substr($str, $i, 1); |
10081 | 10081 | if ($reversed_tmp !== false) { |
@@ -10086,7 +10086,7 @@ discard block |
||
10086 | 10086 | } else { |
10087 | 10087 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10088 | 10088 | |
10089 | - $i = (int) self::strlen($str, $encoding); |
|
10089 | + $i = (int)self::strlen($str, $encoding); |
|
10090 | 10090 | while ($i--) { |
10091 | 10091 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
10092 | 10092 | if ($reversed_tmp !== false) { |
@@ -10162,7 +10162,7 @@ discard block |
||
10162 | 10162 | if ($needle_tmp === false) { |
10163 | 10163 | return false; |
10164 | 10164 | } |
10165 | - $needle = (string) $needle_tmp; |
|
10165 | + $needle = (string)$needle_tmp; |
|
10166 | 10166 | |
10167 | 10167 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
10168 | 10168 | if ($pos === false) { |
@@ -10203,10 +10203,10 @@ discard block |
||
10203 | 10203 | } |
10204 | 10204 | |
10205 | 10205 | // iconv and mbstring do not support integer $needle |
10206 | - if ((int) $needle === $needle && $needle >= 0) { |
|
10207 | - $needle = (string) self::chr($needle); |
|
10206 | + if ((int)$needle === $needle && $needle >= 0) { |
|
10207 | + $needle = (string)self::chr($needle); |
|
10208 | 10208 | } |
10209 | - $needle = (string) $needle; |
|
10209 | + $needle = (string)$needle; |
|
10210 | 10210 | |
10211 | 10211 | if ($needle === '') { |
10212 | 10212 | return false; |
@@ -10254,7 +10254,7 @@ discard block |
||
10254 | 10254 | /** |
10255 | 10255 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10256 | 10256 | */ |
10257 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10257 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10258 | 10258 | } |
10259 | 10259 | |
10260 | 10260 | // |
@@ -10278,7 +10278,7 @@ discard block |
||
10278 | 10278 | // fallback for ascii only |
10279 | 10279 | // |
10280 | 10280 | |
10281 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10281 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10282 | 10282 | return \strripos($haystack, $needle, $offset); |
10283 | 10283 | } |
10284 | 10284 | |
@@ -10359,10 +10359,10 @@ discard block |
||
10359 | 10359 | } |
10360 | 10360 | |
10361 | 10361 | // iconv and mbstring do not support integer $needle |
10362 | - if ((int) $needle === $needle && $needle >= 0) { |
|
10363 | - $needle = (string) self::chr($needle); |
|
10362 | + if ((int)$needle === $needle && $needle >= 0) { |
|
10363 | + $needle = (string)self::chr($needle); |
|
10364 | 10364 | } |
10365 | - $needle = (string) $needle; |
|
10365 | + $needle = (string)$needle; |
|
10366 | 10366 | |
10367 | 10367 | if ($needle === '') { |
10368 | 10368 | return false; |
@@ -10410,7 +10410,7 @@ discard block |
||
10410 | 10410 | /** |
10411 | 10411 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10412 | 10412 | */ |
10413 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10413 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10414 | 10414 | } |
10415 | 10415 | |
10416 | 10416 | // |
@@ -10434,7 +10434,7 @@ discard block |
||
10434 | 10434 | // fallback for ascii only |
10435 | 10435 | // |
10436 | 10436 | |
10437 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10437 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10438 | 10438 | return \strrpos($haystack, $needle, $offset); |
10439 | 10439 | } |
10440 | 10440 | |
@@ -10454,7 +10454,7 @@ discard block |
||
10454 | 10454 | if ($haystack_tmp === false) { |
10455 | 10455 | $haystack_tmp = ''; |
10456 | 10456 | } |
10457 | - $haystack = (string) $haystack_tmp; |
|
10457 | + $haystack = (string)$haystack_tmp; |
|
10458 | 10458 | } |
10459 | 10459 | |
10460 | 10460 | $pos = \strrpos($haystack, $needle); |
@@ -10468,7 +10468,7 @@ discard block |
||
10468 | 10468 | return false; |
10469 | 10469 | } |
10470 | 10470 | |
10471 | - return $offset + (int) self::strlen($str_tmp); |
|
10471 | + return $offset + (int)self::strlen($str_tmp); |
|
10472 | 10472 | } |
10473 | 10473 | |
10474 | 10474 | /** |
@@ -10534,12 +10534,12 @@ discard block |
||
10534 | 10534 | if ($offset || $length !== null) { |
10535 | 10535 | if ($encoding === 'UTF-8') { |
10536 | 10536 | if ($length === null) { |
10537 | - $str = (string) \mb_substr($str, $offset); |
|
10537 | + $str = (string)\mb_substr($str, $offset); |
|
10538 | 10538 | } else { |
10539 | - $str = (string) \mb_substr($str, $offset, $length); |
|
10539 | + $str = (string)\mb_substr($str, $offset, $length); |
|
10540 | 10540 | } |
10541 | 10541 | } else { |
10542 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
10542 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
10543 | 10543 | } |
10544 | 10544 | } |
10545 | 10545 | |
@@ -10549,7 +10549,7 @@ discard block |
||
10549 | 10549 | |
10550 | 10550 | $matches = []; |
10551 | 10551 | |
10552 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
10552 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
10553 | 10553 | } |
10554 | 10554 | |
10555 | 10555 | /** |
@@ -10623,7 +10623,7 @@ discard block |
||
10623 | 10623 | /** |
10624 | 10624 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10625 | 10625 | */ |
10626 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10626 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10627 | 10627 | } |
10628 | 10628 | |
10629 | 10629 | // |
@@ -10645,7 +10645,7 @@ discard block |
||
10645 | 10645 | // fallback for ascii only |
10646 | 10646 | // |
10647 | 10647 | |
10648 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10648 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10649 | 10649 | return \strstr($haystack, $needle, $before_needle); |
10650 | 10650 | } |
10651 | 10651 | |
@@ -10653,7 +10653,7 @@ discard block |
||
10653 | 10653 | // fallback via vanilla php |
10654 | 10654 | // |
10655 | 10655 | |
10656 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
10656 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
10657 | 10657 | |
10658 | 10658 | if (!isset($match[1])) { |
10659 | 10659 | return false; |
@@ -10663,7 +10663,7 @@ discard block |
||
10663 | 10663 | return $match[1]; |
10664 | 10664 | } |
10665 | 10665 | |
10666 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
10666 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
10667 | 10667 | } |
10668 | 10668 | |
10669 | 10669 | /** |
@@ -10789,7 +10789,7 @@ discard block |
||
10789 | 10789 | bool $try_to_keep_the_string_length = false |
10790 | 10790 | ): string { |
10791 | 10791 | // init |
10792 | - $str = (string) $str; |
|
10792 | + $str = (string)$str; |
|
10793 | 10793 | |
10794 | 10794 | if ($str === '') { |
10795 | 10795 | return ''; |
@@ -10818,25 +10818,25 @@ discard block |
||
10818 | 10818 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10819 | 10819 | } |
10820 | 10820 | |
10821 | - $language_code = $lang . '-Lower'; |
|
10821 | + $language_code = $lang.'-Lower'; |
|
10822 | 10822 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10823 | 10823 | /** |
10824 | 10824 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10825 | 10825 | */ |
10826 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
10826 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
10827 | 10827 | |
10828 | 10828 | $language_code = 'Any-Lower'; |
10829 | 10829 | } |
10830 | 10830 | |
10831 | 10831 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10832 | 10832 | /** @noinspection UnnecessaryCastingInspection */ |
10833 | - return (string) \transliterator_transliterate($language_code, $str); |
|
10833 | + return (string)\transliterator_transliterate($language_code, $str); |
|
10834 | 10834 | } |
10835 | 10835 | |
10836 | 10836 | /** |
10837 | 10837 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10838 | 10838 | */ |
10839 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
10839 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
10840 | 10840 | } |
10841 | 10841 | |
10842 | 10842 | // always fallback via symfony polyfill |
@@ -10869,7 +10869,7 @@ discard block |
||
10869 | 10869 | bool $try_to_keep_the_string_length = false |
10870 | 10870 | ): string { |
10871 | 10871 | // init |
10872 | - $str = (string) $str; |
|
10872 | + $str = (string)$str; |
|
10873 | 10873 | |
10874 | 10874 | if ($str === '') { |
10875 | 10875 | return ''; |
@@ -10898,25 +10898,25 @@ discard block |
||
10898 | 10898 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10899 | 10899 | } |
10900 | 10900 | |
10901 | - $language_code = $lang . '-Upper'; |
|
10901 | + $language_code = $lang.'-Upper'; |
|
10902 | 10902 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10903 | 10903 | /** |
10904 | 10904 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10905 | 10905 | */ |
10906 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
10906 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
10907 | 10907 | |
10908 | 10908 | $language_code = 'Any-Upper'; |
10909 | 10909 | } |
10910 | 10910 | |
10911 | 10911 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10912 | 10912 | /** @noinspection UnnecessaryCastingInspection */ |
10913 | - return (string) \transliterator_transliterate($language_code, $str); |
|
10913 | + return (string)\transliterator_transliterate($language_code, $str); |
|
10914 | 10914 | } |
10915 | 10915 | |
10916 | 10916 | /** |
10917 | 10917 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10918 | 10918 | */ |
10919 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
10919 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
10920 | 10920 | } |
10921 | 10921 | |
10922 | 10922 | // always fallback via symfony polyfill |
@@ -10963,7 +10963,7 @@ discard block |
||
10963 | 10963 | $from = \array_combine($from, $to); |
10964 | 10964 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
10965 | 10965 | if ($from === false) { |
10966 | - 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) . ')'); |
|
10966 | + 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).')'); |
|
10967 | 10967 | } |
10968 | 10968 | } |
10969 | 10969 | |
@@ -11025,9 +11025,9 @@ discard block |
||
11025 | 11025 | } |
11026 | 11026 | |
11027 | 11027 | $wide = 0; |
11028 | - $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); |
|
11028 | + $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); |
|
11029 | 11029 | |
11030 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
11030 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
11031 | 11031 | } |
11032 | 11032 | |
11033 | 11033 | /** |
@@ -11129,9 +11129,9 @@ discard block |
||
11129 | 11129 | } |
11130 | 11130 | |
11131 | 11131 | if ($length === null) { |
11132 | - $length = (int) $str_length; |
|
11132 | + $length = (int)$str_length; |
|
11133 | 11133 | } else { |
11134 | - $length = (int) $length; |
|
11134 | + $length = (int)$length; |
|
11135 | 11135 | } |
11136 | 11136 | |
11137 | 11137 | if ( |
@@ -11142,7 +11142,7 @@ discard block |
||
11142 | 11142 | /** |
11143 | 11143 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11144 | 11144 | */ |
11145 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11145 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11146 | 11146 | } |
11147 | 11147 | |
11148 | 11148 | // |
@@ -11232,16 +11232,16 @@ discard block |
||
11232 | 11232 | ) { |
11233 | 11233 | if ($encoding === 'UTF-8') { |
11234 | 11234 | if ($length === null) { |
11235 | - $str1 = (string) \mb_substr($str1, $offset); |
|
11235 | + $str1 = (string)\mb_substr($str1, $offset); |
|
11236 | 11236 | } else { |
11237 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
11237 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
11238 | 11238 | } |
11239 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
11239 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
11240 | 11240 | } else { |
11241 | 11241 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11242 | 11242 | |
11243 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
11244 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
11243 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
11244 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
11245 | 11245 | } |
11246 | 11246 | } |
11247 | 11247 | |
@@ -11305,13 +11305,13 @@ discard block |
||
11305 | 11305 | if ($length_tmp === false) { |
11306 | 11306 | return false; |
11307 | 11307 | } |
11308 | - $length = (int) $length_tmp; |
|
11308 | + $length = (int)$length_tmp; |
|
11309 | 11309 | } |
11310 | 11310 | |
11311 | 11311 | if ($encoding === 'UTF-8') { |
11312 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
11312 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
11313 | 11313 | } else { |
11314 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
11314 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
11315 | 11315 | } |
11316 | 11316 | } |
11317 | 11317 | |
@@ -11323,7 +11323,7 @@ discard block |
||
11323 | 11323 | /** |
11324 | 11324 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11325 | 11325 | */ |
11326 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11326 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11327 | 11327 | } |
11328 | 11328 | |
11329 | 11329 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -11334,7 +11334,7 @@ discard block |
||
11334 | 11334 | return \mb_substr_count($haystack, $needle, $encoding); |
11335 | 11335 | } |
11336 | 11336 | |
11337 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
11337 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
11338 | 11338 | |
11339 | 11339 | return \count($matches); |
11340 | 11340 | } |
@@ -11383,7 +11383,7 @@ discard block |
||
11383 | 11383 | if ($length_tmp === false) { |
11384 | 11384 | return false; |
11385 | 11385 | } |
11386 | - $length = (int) $length_tmp; |
|
11386 | + $length = (int)$length_tmp; |
|
11387 | 11387 | } |
11388 | 11388 | |
11389 | 11389 | if ( |
@@ -11405,7 +11405,7 @@ discard block |
||
11405 | 11405 | if ($haystack_tmp === false) { |
11406 | 11406 | $haystack_tmp = ''; |
11407 | 11407 | } |
11408 | - $haystack = (string) $haystack_tmp; |
|
11408 | + $haystack = (string)$haystack_tmp; |
|
11409 | 11409 | } |
11410 | 11410 | |
11411 | 11411 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -11446,10 +11446,10 @@ discard block |
||
11446 | 11446 | |
11447 | 11447 | if ($encoding === 'UTF-8') { |
11448 | 11448 | if ($case_sensitive) { |
11449 | - return (int) \mb_substr_count($str, $substring); |
|
11449 | + return (int)\mb_substr_count($str, $substring); |
|
11450 | 11450 | } |
11451 | 11451 | |
11452 | - return (int) \mb_substr_count( |
|
11452 | + return (int)\mb_substr_count( |
|
11453 | 11453 | \mb_strtoupper($str), |
11454 | 11454 | \mb_strtoupper($substring) |
11455 | 11455 | ); |
@@ -11458,10 +11458,10 @@ discard block |
||
11458 | 11458 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11459 | 11459 | |
11460 | 11460 | if ($case_sensitive) { |
11461 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
11461 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
11462 | 11462 | } |
11463 | 11463 | |
11464 | - return (int) \mb_substr_count( |
|
11464 | + return (int)\mb_substr_count( |
|
11465 | 11465 | self::strtocasefold($str, true, false, $encoding, null, false), |
11466 | 11466 | self::strtocasefold($substring, true, false, $encoding, null, false), |
11467 | 11467 | $encoding |
@@ -11489,7 +11489,7 @@ discard block |
||
11489 | 11489 | } |
11490 | 11490 | |
11491 | 11491 | if (self::str_istarts_with($haystack, $needle) === true) { |
11492 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
11492 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
11493 | 11493 | } |
11494 | 11494 | |
11495 | 11495 | return $haystack; |
@@ -11550,7 +11550,7 @@ discard block |
||
11550 | 11550 | } |
11551 | 11551 | |
11552 | 11552 | if (self::str_iends_with($haystack, $needle) === true) { |
11553 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
11553 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
11554 | 11554 | } |
11555 | 11555 | |
11556 | 11556 | return $haystack; |
@@ -11577,7 +11577,7 @@ discard block |
||
11577 | 11577 | } |
11578 | 11578 | |
11579 | 11579 | if (self::str_starts_with($haystack, $needle) === true) { |
11580 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
11580 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
11581 | 11581 | } |
11582 | 11582 | |
11583 | 11583 | return $haystack; |
@@ -11631,7 +11631,7 @@ discard block |
||
11631 | 11631 | if (\is_array($offset) === true) { |
11632 | 11632 | $offset = \array_slice($offset, 0, $num); |
11633 | 11633 | foreach ($offset as &$value_tmp) { |
11634 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
11634 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
11635 | 11635 | } |
11636 | 11636 | unset($value_tmp); |
11637 | 11637 | } else { |
@@ -11644,7 +11644,7 @@ discard block |
||
11644 | 11644 | } elseif (\is_array($length) === true) { |
11645 | 11645 | $length = \array_slice($length, 0, $num); |
11646 | 11646 | foreach ($length as &$value_tmp_V2) { |
11647 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
11647 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
11648 | 11648 | } |
11649 | 11649 | unset($value_tmp_V2); |
11650 | 11650 | } else { |
@@ -11664,8 +11664,8 @@ discard block |
||
11664 | 11664 | } |
11665 | 11665 | |
11666 | 11666 | // init |
11667 | - $str = (string) $str; |
|
11668 | - $replacement = (string) $replacement; |
|
11667 | + $str = (string)$str; |
|
11668 | + $replacement = (string)$replacement; |
|
11669 | 11669 | |
11670 | 11670 | if (\is_array($length) === true) { |
11671 | 11671 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -11680,16 +11680,16 @@ discard block |
||
11680 | 11680 | } |
11681 | 11681 | |
11682 | 11682 | if (self::$SUPPORT['mbstring'] === true) { |
11683 | - $string_length = (int) self::strlen($str, $encoding); |
|
11683 | + $string_length = (int)self::strlen($str, $encoding); |
|
11684 | 11684 | |
11685 | 11685 | if ($offset < 0) { |
11686 | - $offset = (int) \max(0, $string_length + $offset); |
|
11686 | + $offset = (int)\max(0, $string_length + $offset); |
|
11687 | 11687 | } elseif ($offset > $string_length) { |
11688 | 11688 | $offset = $string_length; |
11689 | 11689 | } |
11690 | 11690 | |
11691 | 11691 | if ($length !== null && $length < 0) { |
11692 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
11692 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
11693 | 11693 | } elseif ($length === null || $length > $string_length) { |
11694 | 11694 | $length = $string_length; |
11695 | 11695 | } |
@@ -11700,9 +11700,9 @@ discard block |
||
11700 | 11700 | } |
11701 | 11701 | |
11702 | 11702 | /** @noinspection AdditionOperationOnArraysInspection */ |
11703 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
11704 | - $replacement . |
|
11705 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
11703 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
11704 | + $replacement. |
|
11705 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
11706 | 11706 | } |
11707 | 11707 | |
11708 | 11708 | // |
@@ -11711,8 +11711,7 @@ discard block |
||
11711 | 11711 | |
11712 | 11712 | if (ASCII::is_ascii($str)) { |
11713 | 11713 | return ($length === null) ? |
11714 | - \substr_replace($str, $replacement, $offset) : |
|
11715 | - \substr_replace($str, $replacement, $offset, $length); |
|
11714 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
11716 | 11715 | } |
11717 | 11716 | |
11718 | 11717 | // |
@@ -11728,7 +11727,7 @@ discard block |
||
11728 | 11727 | // e.g.: non mbstring support + invalid chars |
11729 | 11728 | return ''; |
11730 | 11729 | } |
11731 | - $length = (int) $length_tmp; |
|
11730 | + $length = (int)$length_tmp; |
|
11732 | 11731 | } |
11733 | 11732 | |
11734 | 11733 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -11765,14 +11764,14 @@ discard block |
||
11765 | 11764 | && |
11766 | 11765 | \substr($haystack, -\strlen($needle)) === $needle |
11767 | 11766 | ) { |
11768 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
11767 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
11769 | 11768 | } |
11770 | 11769 | |
11771 | 11770 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
11772 | - return (string) self::substr( |
|
11771 | + return (string)self::substr( |
|
11773 | 11772 | $haystack, |
11774 | 11773 | 0, |
11775 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
11774 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
11776 | 11775 | $encoding |
11777 | 11776 | ); |
11778 | 11777 | } |
@@ -11804,10 +11803,10 @@ discard block |
||
11804 | 11803 | } |
11805 | 11804 | |
11806 | 11805 | if ($encoding === 'UTF-8') { |
11807 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
11806 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
11808 | 11807 | } |
11809 | 11808 | |
11810 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
11809 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
11811 | 11810 | } |
11812 | 11811 | |
11813 | 11812 | /** |
@@ -12015,7 +12014,7 @@ discard block |
||
12015 | 12014 | public static function to_boolean($str): bool |
12016 | 12015 | { |
12017 | 12016 | // init |
12018 | - $str = (string) $str; |
|
12017 | + $str = (string)$str; |
|
12019 | 12018 | |
12020 | 12019 | if ($str === '') { |
12021 | 12020 | return false; |
@@ -12043,10 +12042,10 @@ discard block |
||
12043 | 12042 | } |
12044 | 12043 | |
12045 | 12044 | if (\is_numeric($str)) { |
12046 | - return ((float) $str + 0) > 0; |
|
12045 | + return ((float)$str + 0) > 0; |
|
12047 | 12046 | } |
12048 | 12047 | |
12049 | - return (bool) \trim($str); |
|
12048 | + return (bool)\trim($str); |
|
12050 | 12049 | } |
12051 | 12050 | |
12052 | 12051 | /** |
@@ -12092,7 +12091,7 @@ discard block |
||
12092 | 12091 | return $str; |
12093 | 12092 | } |
12094 | 12093 | |
12095 | - $str = (string) $str; |
|
12094 | + $str = (string)$str; |
|
12096 | 12095 | if ($str === '') { |
12097 | 12096 | return ''; |
12098 | 12097 | } |
@@ -12144,7 +12143,7 @@ discard block |
||
12144 | 12143 | return $str; |
12145 | 12144 | } |
12146 | 12145 | |
12147 | - $str = (string) $str; |
|
12146 | + $str = (string)$str; |
|
12148 | 12147 | if ($str === '') { |
12149 | 12148 | return $str; |
12150 | 12149 | } |
@@ -12162,7 +12161,7 @@ discard block |
||
12162 | 12161 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
12163 | 12162 | |
12164 | 12163 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
12165 | - $buf .= $c1 . $c2; |
|
12164 | + $buf .= $c1.$c2; |
|
12166 | 12165 | ++$i; |
12167 | 12166 | } else { // not valid UTF8 - convert it |
12168 | 12167 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12173,7 +12172,7 @@ discard block |
||
12173 | 12172 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
12174 | 12173 | |
12175 | 12174 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
12176 | - $buf .= $c1 . $c2 . $c3; |
|
12175 | + $buf .= $c1.$c2.$c3; |
|
12177 | 12176 | $i += 2; |
12178 | 12177 | } else { // not valid UTF8 - convert it |
12179 | 12178 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12185,7 +12184,7 @@ discard block |
||
12185 | 12184 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
12186 | 12185 | |
12187 | 12186 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
12188 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
12187 | + $buf .= $c1.$c2.$c3.$c4; |
|
12189 | 12188 | $i += 3; |
12190 | 12189 | } else { // not valid UTF8 - convert it |
12191 | 12190 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12213,13 +12212,13 @@ discard block |
||
12213 | 12212 | * |
12214 | 12213 | * @return string |
12215 | 12214 | */ |
12216 | - static function (array $matches): string { |
|
12215 | + static function(array $matches): string { |
|
12217 | 12216 | if (isset($matches[3])) { |
12218 | - $cp = (int) \hexdec($matches[3]); |
|
12217 | + $cp = (int)\hexdec($matches[3]); |
|
12219 | 12218 | } else { |
12220 | 12219 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
12221 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
12222 | - + (int) \hexdec($matches[2]) |
|
12220 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
12221 | + + (int)\hexdec($matches[2]) |
|
12223 | 12222 | + 0x10000 |
12224 | 12223 | - (0xD800 << 10) |
12225 | 12224 | - 0xDC00; |
@@ -12230,12 +12229,12 @@ discard block |
||
12230 | 12229 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
12231 | 12230 | |
12232 | 12231 | if ($cp < 0x80) { |
12233 | - return (string) self::chr($cp); |
|
12232 | + return (string)self::chr($cp); |
|
12234 | 12233 | } |
12235 | 12234 | |
12236 | 12235 | if ($cp < 0xA0) { |
12237 | 12236 | /** @noinspection UnnecessaryCastingInspection */ |
12238 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
12237 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
12239 | 12238 | } |
12240 | 12239 | |
12241 | 12240 | return self::decimal_to_chr($cp); |
@@ -12286,7 +12285,7 @@ discard block |
||
12286 | 12285 | } |
12287 | 12286 | |
12288 | 12287 | /** @noinspection PhpComposerExtensionStubsInspection */ |
12289 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
12288 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
12290 | 12289 | } |
12291 | 12290 | |
12292 | 12291 | if ($chars) { |
@@ -12334,15 +12333,15 @@ discard block |
||
12334 | 12333 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
12335 | 12334 | |
12336 | 12335 | if ($encoding === 'UTF-8') { |
12337 | - $str_part_two = (string) \mb_substr($str, 1); |
|
12336 | + $str_part_two = (string)\mb_substr($str, 1); |
|
12338 | 12337 | |
12339 | 12338 | if ($use_mb_functions === true) { |
12340 | 12339 | $str_part_one = \mb_strtoupper( |
12341 | - (string) \mb_substr($str, 0, 1) |
|
12340 | + (string)\mb_substr($str, 0, 1) |
|
12342 | 12341 | ); |
12343 | 12342 | } else { |
12344 | 12343 | $str_part_one = self::strtoupper( |
12345 | - (string) \mb_substr($str, 0, 1), |
|
12344 | + (string)\mb_substr($str, 0, 1), |
|
12346 | 12345 | $encoding, |
12347 | 12346 | false, |
12348 | 12347 | $lang, |
@@ -12352,16 +12351,16 @@ discard block |
||
12352 | 12351 | } else { |
12353 | 12352 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
12354 | 12353 | |
12355 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
12354 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
12356 | 12355 | |
12357 | 12356 | if ($use_mb_functions === true) { |
12358 | 12357 | $str_part_one = \mb_strtoupper( |
12359 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
12358 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
12360 | 12359 | $encoding |
12361 | 12360 | ); |
12362 | 12361 | } else { |
12363 | 12362 | $str_part_one = self::strtoupper( |
12364 | - (string) self::substr($str, 0, 1, $encoding), |
|
12363 | + (string)self::substr($str, 0, 1, $encoding), |
|
12365 | 12364 | $encoding, |
12366 | 12365 | false, |
12367 | 12366 | $lang, |
@@ -12370,7 +12369,7 @@ discard block |
||
12370 | 12369 | } |
12371 | 12370 | } |
12372 | 12371 | |
12373 | - return $str_part_one . $str_part_two; |
|
12372 | + return $str_part_one.$str_part_two; |
|
12374 | 12373 | } |
12375 | 12374 | |
12376 | 12375 | /** |
@@ -12429,7 +12428,7 @@ discard block |
||
12429 | 12428 | $str = self::clean($str); |
12430 | 12429 | } |
12431 | 12430 | |
12432 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
12431 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
12433 | 12432 | |
12434 | 12433 | if ( |
12435 | 12434 | $use_php_default_functions === true |
@@ -12840,7 +12839,7 @@ discard block |
||
12840 | 12839 | if ( |
12841 | 12840 | $keep_utf8_chars === true |
12842 | 12841 | && |
12843 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
12842 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
12844 | 12843 | ) { |
12845 | 12844 | return $str_backup; |
12846 | 12845 | } |
@@ -12927,17 +12926,17 @@ discard block |
||
12927 | 12926 | return ''; |
12928 | 12927 | } |
12929 | 12928 | |
12930 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
12929 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
12931 | 12930 | |
12932 | 12931 | if ( |
12933 | 12932 | !isset($matches[0]) |
12934 | 12933 | || |
12935 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
12934 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
12936 | 12935 | ) { |
12937 | 12936 | return $str; |
12938 | 12937 | } |
12939 | 12938 | |
12940 | - return \rtrim($matches[0]) . $str_add_on; |
|
12939 | + return \rtrim($matches[0]).$str_add_on; |
|
12941 | 12940 | } |
12942 | 12941 | |
12943 | 12942 | /** |
@@ -13026,7 +13025,7 @@ discard block |
||
13026 | 13025 | } |
13027 | 13026 | } |
13028 | 13027 | |
13029 | - return $str_return . \implode('', $chars); |
|
13028 | + return $str_return.\implode('', $chars); |
|
13030 | 13029 | } |
13031 | 13030 | |
13032 | 13031 | /** |
@@ -13080,7 +13079,7 @@ discard block |
||
13080 | 13079 | $final_break = ''; |
13081 | 13080 | } |
13082 | 13081 | |
13083 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
13082 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
13084 | 13083 | } |
13085 | 13084 | |
13086 | 13085 | /** |
@@ -13315,7 +13314,7 @@ discard block |
||
13315 | 13314 | /** @noinspection PhpIncludeInspection */ |
13316 | 13315 | /** @noinspection UsingInclusionReturnValueInspection */ |
13317 | 13316 | /** @psalm-suppress UnresolvableInclude */ |
13318 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
13317 | + return include __DIR__.'/data/'.$file.'.php'; |
|
13319 | 13318 | } |
13320 | 13319 | |
13321 | 13320 | /** |
@@ -13332,7 +13331,7 @@ discard block |
||
13332 | 13331 | |
13333 | 13332 | \uksort( |
13334 | 13333 | self::$EMOJI, |
13335 | - static function (string $a, string $b): int { |
|
13334 | + static function(string $a, string $b): int { |
|
13336 | 13335 | return \strlen($b) <=> \strlen($a); |
13337 | 13336 | } |
13338 | 13337 | ); |
@@ -13342,7 +13341,7 @@ discard block |
||
13342 | 13341 | |
13343 | 13342 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
13344 | 13343 | $tmp_key = \crc32($key); |
13345 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
13344 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
13346 | 13345 | } |
13347 | 13346 | |
13348 | 13347 | return true; |
@@ -13370,7 +13369,7 @@ discard block |
||
13370 | 13369 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
13371 | 13370 | return \defined('MB_OVERLOAD_STRING') |
13372 | 13371 | && |
13373 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
13372 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
13374 | 13373 | } |
13375 | 13374 | |
13376 | 13375 | /** |
@@ -13436,7 +13435,7 @@ discard block |
||
13436 | 13435 | */ |
13437 | 13436 | static $RX_CLASS_CACHE = []; |
13438 | 13437 | |
13439 | - $cache_key = $s . '_' . $class; |
|
13438 | + $cache_key = $s.'_'.$class; |
|
13440 | 13439 | |
13441 | 13440 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
13442 | 13441 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -13448,7 +13447,7 @@ discard block |
||
13448 | 13447 | /** @noinspection AlterInForeachInspection */ |
13449 | 13448 | foreach (self::str_split($s) as &$s) { |
13450 | 13449 | if ($s === '-') { |
13451 | - $class_array[0] = '-' . $class_array[0]; |
|
13450 | + $class_array[0] = '-'.$class_array[0]; |
|
13452 | 13451 | } elseif (!isset($s[2])) { |
13453 | 13452 | $class_array[0] .= \preg_quote($s, '/'); |
13454 | 13453 | } elseif (self::strlen($s) === 1) { |
@@ -13459,13 +13458,13 @@ discard block |
||
13459 | 13458 | } |
13460 | 13459 | |
13461 | 13460 | if ($class_array[0]) { |
13462 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
13461 | + $class_array[0] = '['.$class_array[0].']'; |
|
13463 | 13462 | } |
13464 | 13463 | |
13465 | 13464 | if (\count($class_array) === 1) { |
13466 | 13465 | $return = $class_array[0]; |
13467 | 13466 | } else { |
13468 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
13467 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
13469 | 13468 | } |
13470 | 13469 | |
13471 | 13470 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -13546,7 +13545,7 @@ discard block |
||
13546 | 13545 | |
13547 | 13546 | if ($delimiter === '-') { |
13548 | 13547 | /** @noinspection AlterInForeachInspection */ |
13549 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
13548 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
13550 | 13549 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
13551 | 13550 | $continue = true; |
13552 | 13551 | } |
@@ -13554,7 +13553,7 @@ discard block |
||
13554 | 13553 | } |
13555 | 13554 | |
13556 | 13555 | /** @noinspection AlterInForeachInspection */ |
13557 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
13556 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
13558 | 13557 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
13559 | 13558 | $continue = true; |
13560 | 13559 | } |
@@ -13621,8 +13620,8 @@ discard block |
||
13621 | 13620 | } else { |
13622 | 13621 | /** @noinspection OffsetOperationsInspection */ |
13623 | 13622 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
13624 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
13625 | - $buf .= $cc1 . $cc2; |
|
13623 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
13624 | + $buf .= $cc1.$cc2; |
|
13626 | 13625 | } |
13627 | 13626 | |
13628 | 13627 | return $buf; |
@@ -13641,7 +13640,7 @@ discard block |
||
13641 | 13640 | { |
13642 | 13641 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
13643 | 13642 | if (\preg_match($pattern, $str)) { |
13644 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
13643 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
13645 | 13644 | } |
13646 | 13645 | |
13647 | 13646 | return $str; |