@@ -235,10 +235,10 @@ discard block |
||
235 | 235 | } |
236 | 236 | |
237 | 237 | if ($encoding === 'UTF-8') { |
238 | - return (string) \mb_substr($str, $pos, 1); |
|
238 | + return (string)\mb_substr($str, $pos, 1); |
|
239 | 239 | } |
240 | 240 | |
241 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
241 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | public static function add_bom_to_string(string $str): string |
254 | 254 | { |
255 | 255 | if (self::string_has_bom($str) === false) { |
256 | - $str = self::bom() . $str; |
|
256 | + $str = self::bom().$str; |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | return $str; |
@@ -286,8 +286,8 @@ discard block |
||
286 | 286 | $return = []; |
287 | 287 | foreach ($array as $key => &$value) { |
288 | 288 | $key = $case === \CASE_LOWER |
289 | - ? self::strtolower((string) $key, $encoding) |
|
290 | - : self::strtoupper((string) $key, $encoding); |
|
289 | + ? self::strtolower((string)$key, $encoding) |
|
290 | + : self::strtoupper((string)$key, $encoding); |
|
291 | 291 | |
292 | 292 | $return[$key] = $value; |
293 | 293 | } |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | return ''; |
322 | 322 | } |
323 | 323 | |
324 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
324 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
325 | 325 | $end_position = \mb_strpos($str, $end, $substr_index); |
326 | 326 | if ( |
327 | 327 | $end_position === false |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | return ''; |
332 | 332 | } |
333 | 333 | |
334 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
334 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | return ''; |
342 | 342 | } |
343 | 343 | |
344 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
344 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
345 | 345 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
346 | 346 | if ( |
347 | 347 | $end_position === false |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | return ''; |
352 | 352 | } |
353 | 353 | |
354 | - return (string) self::substr( |
|
354 | + return (string)self::substr( |
|
355 | 355 | $str, |
356 | 356 | $substr_index, |
357 | 357 | $end_position - $substr_index, |
@@ -419,10 +419,10 @@ discard block |
||
419 | 419 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
420 | 420 | { |
421 | 421 | if ($encoding === 'UTF-8') { |
422 | - return (string) \mb_substr($str, $index, 1); |
|
422 | + return (string)\mb_substr($str, $index, 1); |
|
423 | 423 | } |
424 | 424 | |
425 | - return (string) self::substr($str, $index, 1, $encoding); |
|
425 | + return (string)self::substr($str, $index, 1, $encoding); |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | /** |
@@ -521,10 +521,10 @@ discard block |
||
521 | 521 | && |
522 | 522 | self::$SUPPORT['mbstring'] === false |
523 | 523 | ) { |
524 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
524 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
525 | 525 | } |
526 | 526 | |
527 | - $cache_key = $code_point . $encoding; |
|
527 | + $cache_key = $code_point.$encoding; |
|
528 | 528 | if (isset($CHAR_CACHE[$cache_key]) === true) { |
529 | 529 | return $CHAR_CACHE[$cache_key]; |
530 | 530 | } |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | self::$CHR = self::getData('chr'); |
571 | 571 | } |
572 | 572 | |
573 | - $code_point = (int) $code_point; |
|
573 | + $code_point = (int)$code_point; |
|
574 | 574 | if ($code_point <= 0x7F) { |
575 | 575 | /** |
576 | 576 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -580,22 +580,22 @@ discard block |
||
580 | 580 | /** |
581 | 581 | * @psalm-suppress PossiblyNullArrayAccess |
582 | 582 | */ |
583 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
583 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
584 | 584 | self::$CHR[($code_point & 0x3F) + 0x80]; |
585 | 585 | } elseif ($code_point <= 0xFFFF) { |
586 | 586 | /** |
587 | 587 | * @psalm-suppress PossiblyNullArrayAccess |
588 | 588 | */ |
589 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
590 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
589 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
590 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
591 | 591 | self::$CHR[($code_point & 0x3F) + 0x80]; |
592 | 592 | } else { |
593 | 593 | /** |
594 | 594 | * @psalm-suppress PossiblyNullArrayAccess |
595 | 595 | */ |
596 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
597 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
598 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
596 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
597 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
598 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
599 | 599 | self::$CHR[($code_point & 0x3F) + 0x80]; |
600 | 600 | } |
601 | 601 | |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | |
644 | 644 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
645 | 645 | return \array_map( |
646 | - static function (string $data): int { |
|
646 | + static function(string $data): int { |
|
647 | 647 | // "mb_" is available if overload is used, so use it ... |
648 | 648 | return \mb_strlen($data, 'CP850'); // 8-BIT |
649 | 649 | }, |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | $char = ''; |
712 | 712 | } |
713 | 713 | |
714 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
714 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
715 | 715 | } |
716 | 716 | |
717 | 717 | /** |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
788 | 788 | /x'; |
789 | 789 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
790 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
790 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
791 | 791 | |
792 | 792 | if ($replace_diamond_question_mark === true) { |
793 | 793 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -822,7 +822,7 @@ discard block |
||
822 | 822 | public static function cleanup($str): string |
823 | 823 | { |
824 | 824 | // init |
825 | - $str = (string) $str; |
|
825 | + $str = (string)$str; |
|
826 | 826 | |
827 | 827 | if ($str === '') { |
828 | 828 | return ''; |
@@ -905,7 +905,7 @@ discard block |
||
905 | 905 | { |
906 | 906 | if (self::$SUPPORT['mbstring'] === true) { |
907 | 907 | /** @noinspection PhpComposerExtensionStubsInspection */ |
908 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
908 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
909 | 909 | } |
910 | 910 | |
911 | 911 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -945,7 +945,7 @@ discard block |
||
945 | 945 | */ |
946 | 946 | public static function css_stripe_media_queries(string $str): string |
947 | 947 | { |
948 | - return (string) \preg_replace( |
|
948 | + return (string)\preg_replace( |
|
949 | 949 | '#@media\\s+(?:only\\s)?(?:[\\s{\\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
950 | 950 | '', |
951 | 951 | $str |
@@ -972,7 +972,7 @@ discard block |
||
972 | 972 | */ |
973 | 973 | public static function decimal_to_chr($int): string |
974 | 974 | { |
975 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
975 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
976 | 976 | } |
977 | 977 | |
978 | 978 | /** |
@@ -1019,16 +1019,16 @@ discard block |
||
1019 | 1019 | self::initEmojiData(); |
1020 | 1020 | |
1021 | 1021 | if ($use_reversible_string_mappings === true) { |
1022 | - return (string) \str_replace( |
|
1023 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1024 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1022 | + return (string)\str_replace( |
|
1023 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1024 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1025 | 1025 | $str |
1026 | 1026 | ); |
1027 | 1027 | } |
1028 | 1028 | |
1029 | - return (string) \str_replace( |
|
1030 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1031 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1029 | + return (string)\str_replace( |
|
1030 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1031 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1032 | 1032 | $str |
1033 | 1033 | ); |
1034 | 1034 | } |
@@ -1050,16 +1050,16 @@ discard block |
||
1050 | 1050 | self::initEmojiData(); |
1051 | 1051 | |
1052 | 1052 | if ($use_reversible_string_mappings === true) { |
1053 | - return (string) \str_replace( |
|
1054 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1055 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1053 | + return (string)\str_replace( |
|
1054 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1055 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1056 | 1056 | $str |
1057 | 1057 | ); |
1058 | 1058 | } |
1059 | 1059 | |
1060 | - return (string) \str_replace( |
|
1061 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1062 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1060 | + return (string)\str_replace( |
|
1061 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1062 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1063 | 1063 | $str |
1064 | 1064 | ); |
1065 | 1065 | } |
@@ -1113,7 +1113,7 @@ discard block |
||
1113 | 1113 | if ($to_encoding === 'JSON') { |
1114 | 1114 | $return = self::json_encode($str); |
1115 | 1115 | if ($return === false) { |
1116 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1116 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1117 | 1117 | } |
1118 | 1118 | |
1119 | 1119 | return $return; |
@@ -1200,7 +1200,7 @@ discard block |
||
1200 | 1200 | && |
1201 | 1201 | self::$SUPPORT['mbstring'] === false |
1202 | 1202 | ) { |
1203 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
1203 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
1204 | 1204 | } |
1205 | 1205 | |
1206 | 1206 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1294,31 +1294,31 @@ discard block |
||
1294 | 1294 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1295 | 1295 | |
1296 | 1296 | if ($length === null) { |
1297 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
1297 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
1298 | 1298 | } |
1299 | 1299 | |
1300 | 1300 | if ($search === '') { |
1301 | 1301 | if ($encoding === 'UTF-8') { |
1302 | 1302 | if ($length > 0) { |
1303 | - $string_length = (int) \mb_strlen($str); |
|
1303 | + $string_length = (int)\mb_strlen($str); |
|
1304 | 1304 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1305 | 1305 | } else { |
1306 | 1306 | $end = 0; |
1307 | 1307 | } |
1308 | 1308 | |
1309 | - $pos = (int) \min( |
|
1309 | + $pos = (int)\min( |
|
1310 | 1310 | \mb_strpos($str, ' ', $end), |
1311 | 1311 | \mb_strpos($str, '.', $end) |
1312 | 1312 | ); |
1313 | 1313 | } else { |
1314 | 1314 | if ($length > 0) { |
1315 | - $string_length = (int) self::strlen($str, $encoding); |
|
1315 | + $string_length = (int)self::strlen($str, $encoding); |
|
1316 | 1316 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1317 | 1317 | } else { |
1318 | 1318 | $end = 0; |
1319 | 1319 | } |
1320 | 1320 | |
1321 | - $pos = (int) \min( |
|
1321 | + $pos = (int)\min( |
|
1322 | 1322 | self::strpos($str, ' ', $end, $encoding), |
1323 | 1323 | self::strpos($str, '.', $end, $encoding) |
1324 | 1324 | ); |
@@ -1335,18 +1335,18 @@ discard block |
||
1335 | 1335 | return ''; |
1336 | 1336 | } |
1337 | 1337 | |
1338 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1338 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1339 | 1339 | } |
1340 | 1340 | |
1341 | 1341 | return $str; |
1342 | 1342 | } |
1343 | 1343 | |
1344 | 1344 | if ($encoding === 'UTF-8') { |
1345 | - $word_position = (int) \mb_stripos($str, $search); |
|
1346 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1345 | + $word_position = (int)\mb_stripos($str, $search); |
|
1346 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1347 | 1347 | } else { |
1348 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
1349 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1348 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
1349 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1350 | 1350 | } |
1351 | 1351 | |
1352 | 1352 | $pos_start = 0; |
@@ -1358,12 +1358,12 @@ discard block |
||
1358 | 1358 | } |
1359 | 1359 | if ($half_text !== false) { |
1360 | 1360 | if ($encoding === 'UTF-8') { |
1361 | - $pos_start = (int) \max( |
|
1361 | + $pos_start = (int)\max( |
|
1362 | 1362 | \mb_strrpos($half_text, ' '), |
1363 | 1363 | \mb_strrpos($half_text, '.') |
1364 | 1364 | ); |
1365 | 1365 | } else { |
1366 | - $pos_start = (int) \max( |
|
1366 | + $pos_start = (int)\max( |
|
1367 | 1367 | self::strrpos($half_text, ' ', 0, $encoding), |
1368 | 1368 | self::strrpos($half_text, '.', 0, $encoding) |
1369 | 1369 | ); |
@@ -1373,19 +1373,19 @@ discard block |
||
1373 | 1373 | |
1374 | 1374 | if ($word_position && $half_side > 0) { |
1375 | 1375 | $offset = $pos_start + $length - 1; |
1376 | - $real_length = (int) self::strlen($str, $encoding); |
|
1376 | + $real_length = (int)self::strlen($str, $encoding); |
|
1377 | 1377 | |
1378 | 1378 | if ($offset > $real_length) { |
1379 | 1379 | $offset = $real_length; |
1380 | 1380 | } |
1381 | 1381 | |
1382 | 1382 | if ($encoding === 'UTF-8') { |
1383 | - $pos_end = (int) \min( |
|
1383 | + $pos_end = (int)\min( |
|
1384 | 1384 | \mb_strpos($str, ' ', $offset), |
1385 | 1385 | \mb_strpos($str, '.', $offset) |
1386 | 1386 | ) - $pos_start; |
1387 | 1387 | } else { |
1388 | - $pos_end = (int) \min( |
|
1388 | + $pos_end = (int)\min( |
|
1389 | 1389 | self::strpos($str, ' ', $offset, $encoding), |
1390 | 1390 | self::strpos($str, '.', $offset, $encoding) |
1391 | 1391 | ) - $pos_start; |
@@ -1393,12 +1393,12 @@ discard block |
||
1393 | 1393 | |
1394 | 1394 | if (!$pos_end || $pos_end <= 0) { |
1395 | 1395 | if ($encoding === 'UTF-8') { |
1396 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1396 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1397 | 1397 | } else { |
1398 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1398 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1399 | 1399 | } |
1400 | 1400 | if ($str_sub !== false) { |
1401 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
1401 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
1402 | 1402 | } else { |
1403 | 1403 | $extract = ''; |
1404 | 1404 | } |
@@ -1409,26 +1409,26 @@ discard block |
||
1409 | 1409 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
1410 | 1410 | } |
1411 | 1411 | if ($str_sub !== false) { |
1412 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1412 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1413 | 1413 | } else { |
1414 | 1414 | $extract = ''; |
1415 | 1415 | } |
1416 | 1416 | } |
1417 | 1417 | } else { |
1418 | 1418 | $offset = $length - 1; |
1419 | - $true_length = (int) self::strlen($str, $encoding); |
|
1419 | + $true_length = (int)self::strlen($str, $encoding); |
|
1420 | 1420 | |
1421 | 1421 | if ($offset > $true_length) { |
1422 | 1422 | $offset = $true_length; |
1423 | 1423 | } |
1424 | 1424 | |
1425 | 1425 | if ($encoding === 'UTF-8') { |
1426 | - $pos_end = (int) \min( |
|
1426 | + $pos_end = (int)\min( |
|
1427 | 1427 | \mb_strpos($str, ' ', $offset), |
1428 | 1428 | \mb_strpos($str, '.', $offset) |
1429 | 1429 | ); |
1430 | 1430 | } else { |
1431 | - $pos_end = (int) \min( |
|
1431 | + $pos_end = (int)\min( |
|
1432 | 1432 | self::strpos($str, ' ', $offset, $encoding), |
1433 | 1433 | self::strpos($str, '.', $offset, $encoding) |
1434 | 1434 | ); |
@@ -1441,7 +1441,7 @@ discard block |
||
1441 | 1441 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
1442 | 1442 | } |
1443 | 1443 | if ($str_sub !== false) { |
1444 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1444 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1445 | 1445 | } else { |
1446 | 1446 | $extract = ''; |
1447 | 1447 | } |
@@ -1564,7 +1564,7 @@ discard block |
||
1564 | 1564 | { |
1565 | 1565 | $file_content = \file_get_contents($file_path); |
1566 | 1566 | if ($file_content === false) { |
1567 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1567 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1568 | 1568 | } |
1569 | 1569 | |
1570 | 1570 | return self::string_has_bom($file_content); |
@@ -1630,7 +1630,7 @@ discard block |
||
1630 | 1630 | ) { |
1631 | 1631 | // Prevent leading combining chars |
1632 | 1632 | // for NFC-safe concatenations. |
1633 | - $var = $leading_combining . $var; |
|
1633 | + $var = $leading_combining.$var; |
|
1634 | 1634 | } |
1635 | 1635 | } |
1636 | 1636 | |
@@ -1881,10 +1881,10 @@ discard block |
||
1881 | 1881 | } |
1882 | 1882 | |
1883 | 1883 | if ($encoding === 'UTF-8') { |
1884 | - return (string) \mb_substr($str, 0, $n); |
|
1884 | + return (string)\mb_substr($str, 0, $n); |
|
1885 | 1885 | } |
1886 | 1886 | |
1887 | - return (string) self::substr($str, 0, $n, $encoding); |
|
1887 | + return (string)self::substr($str, 0, $n, $encoding); |
|
1888 | 1888 | } |
1889 | 1889 | |
1890 | 1890 | /** |
@@ -1897,7 +1897,7 @@ discard block |
||
1897 | 1897 | */ |
1898 | 1898 | public static function fits_inside(string $str, int $box_size): bool |
1899 | 1899 | { |
1900 | - return (int) self::strlen($str) <= $box_size; |
|
1900 | + return (int)self::strlen($str) <= $box_size; |
|
1901 | 1901 | } |
1902 | 1902 | |
1903 | 1903 | /** |
@@ -1959,7 +1959,7 @@ discard block |
||
1959 | 1959 | return $str; |
1960 | 1960 | } |
1961 | 1961 | |
1962 | - $str = (string) $str; |
|
1962 | + $str = (string)$str; |
|
1963 | 1963 | $last = ''; |
1964 | 1964 | while ($last !== $str) { |
1965 | 1965 | $last = $str; |
@@ -2153,7 +2153,7 @@ discard block |
||
2153 | 2153 | return $fallback; |
2154 | 2154 | } |
2155 | 2155 | /** @noinspection OffsetOperationsInspection */ |
2156 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2156 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2157 | 2157 | |
2158 | 2158 | // DEBUG |
2159 | 2159 | //var_dump($type_code); |
@@ -2211,7 +2211,7 @@ discard block |
||
2211 | 2211 | // |
2212 | 2212 | |
2213 | 2213 | if ($encoding === 'UTF-8') { |
2214 | - $max_length = (int) \mb_strlen($possible_chars); |
|
2214 | + $max_length = (int)\mb_strlen($possible_chars); |
|
2215 | 2215 | if ($max_length === 0) { |
2216 | 2216 | return ''; |
2217 | 2217 | } |
@@ -2232,7 +2232,7 @@ discard block |
||
2232 | 2232 | } else { |
2233 | 2233 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2234 | 2234 | |
2235 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
2235 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
2236 | 2236 | if ($max_length === 0) { |
2237 | 2237 | return ''; |
2238 | 2238 | } |
@@ -2263,16 +2263,16 @@ discard block |
||
2263 | 2263 | */ |
2264 | 2264 | public static function get_unique_string($entropy_extra = '', bool $use_md5 = true): string |
2265 | 2265 | { |
2266 | - $unique_helper = \random_int(0, \mt_getrandmax()) . |
|
2267 | - \session_id() . |
|
2268 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2269 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2266 | + $unique_helper = \random_int(0, \mt_getrandmax()). |
|
2267 | + \session_id(). |
|
2268 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2269 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2270 | 2270 | $entropy_extra; |
2271 | 2271 | |
2272 | 2272 | $unique_string = \uniqid($unique_helper, true); |
2273 | 2273 | |
2274 | 2274 | if ($use_md5) { |
2275 | - $unique_string = \md5($unique_string . $unique_helper); |
|
2275 | + $unique_string = \md5($unique_string.$unique_helper); |
|
2276 | 2276 | } |
2277 | 2277 | |
2278 | 2278 | return $unique_string; |
@@ -2351,7 +2351,7 @@ discard block |
||
2351 | 2351 | public static function hex_to_int($hexdec) |
2352 | 2352 | { |
2353 | 2353 | // init |
2354 | - $hexdec = (string) $hexdec; |
|
2354 | + $hexdec = (string)$hexdec; |
|
2355 | 2355 | |
2356 | 2356 | if ($hexdec === '') { |
2357 | 2357 | return false; |
@@ -2444,7 +2444,7 @@ discard block |
||
2444 | 2444 | return \implode( |
2445 | 2445 | '', |
2446 | 2446 | \array_map( |
2447 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2447 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2448 | 2448 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
2449 | 2449 | }, |
2450 | 2450 | self::str_split($str) |
@@ -2551,7 +2551,7 @@ discard block |
||
2551 | 2551 | && |
2552 | 2552 | self::$SUPPORT['mbstring'] === false |
2553 | 2553 | ) { |
2554 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2554 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2555 | 2555 | } |
2556 | 2556 | |
2557 | 2557 | do { |
@@ -2583,7 +2583,7 @@ discard block |
||
2583 | 2583 | if (\strpos($str, '&') !== false) { |
2584 | 2584 | if (\strpos($str, '&#') !== false) { |
2585 | 2585 | // decode also numeric & UTF16 two byte entities |
2586 | - $str = (string) \preg_replace( |
|
2586 | + $str = (string)\preg_replace( |
|
2587 | 2587 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
2588 | 2588 | '$1;', |
2589 | 2589 | $str |
@@ -2629,7 +2629,7 @@ discard block |
||
2629 | 2629 | */ |
2630 | 2630 | public static function html_stripe_empty_tags(string $str): string |
2631 | 2631 | { |
2632 | - return (string) \preg_replace( |
|
2632 | + return (string)\preg_replace( |
|
2633 | 2633 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
2634 | 2634 | '', |
2635 | 2635 | $str |
@@ -2939,9 +2939,9 @@ discard block |
||
2939 | 2939 | { |
2940 | 2940 | $hex = \dechex($int); |
2941 | 2941 | |
2942 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
2942 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
2943 | 2943 | |
2944 | - return $prefix . $hex . ''; |
|
2944 | + return $prefix.$hex.''; |
|
2945 | 2945 | } |
2946 | 2946 | |
2947 | 2947 | /** |
@@ -3199,7 +3199,7 @@ discard block |
||
3199 | 3199 | */ |
3200 | 3200 | public static function is_binary($input, bool $strict = false): bool |
3201 | 3201 | { |
3202 | - $input = (string) $input; |
|
3202 | + $input = (string)$input; |
|
3203 | 3203 | if ($input === '') { |
3204 | 3204 | return false; |
3205 | 3205 | } |
@@ -3462,7 +3462,7 @@ discard block |
||
3462 | 3462 | public static function is_utf16($str, $check_if_string_is_binary = true) |
3463 | 3463 | { |
3464 | 3464 | // init |
3465 | - $str = (string) $str; |
|
3465 | + $str = (string)$str; |
|
3466 | 3466 | $str_chars = []; |
3467 | 3467 | |
3468 | 3468 | if ( |
@@ -3540,7 +3540,7 @@ discard block |
||
3540 | 3540 | public static function is_utf32($str, $check_if_string_is_binary = true) |
3541 | 3541 | { |
3542 | 3542 | // init |
3543 | - $str = (string) $str; |
|
3543 | + $str = (string)$str; |
|
3544 | 3544 | $str_chars = []; |
3545 | 3545 | |
3546 | 3546 | if ( |
@@ -3624,7 +3624,7 @@ discard block |
||
3624 | 3624 | return true; |
3625 | 3625 | } |
3626 | 3626 | |
3627 | - return self::is_utf8_string((string) $str, $strict); |
|
3627 | + return self::is_utf8_string((string)$str, $strict); |
|
3628 | 3628 | } |
3629 | 3629 | |
3630 | 3630 | /** |
@@ -3764,15 +3764,15 @@ discard block |
||
3764 | 3764 | $use_mb_functions = ($lang === null && $try_to_keep_the_string_length === false); |
3765 | 3765 | |
3766 | 3766 | if ($encoding === 'UTF-8') { |
3767 | - $str_part_two = (string) \mb_substr($str, 1); |
|
3767 | + $str_part_two = (string)\mb_substr($str, 1); |
|
3768 | 3768 | |
3769 | 3769 | if ($use_mb_functions === true) { |
3770 | 3770 | $str_part_one = \mb_strtolower( |
3771 | - (string) \mb_substr($str, 0, 1) |
|
3771 | + (string)\mb_substr($str, 0, 1) |
|
3772 | 3772 | ); |
3773 | 3773 | } else { |
3774 | 3774 | $str_part_one = self::strtolower( |
3775 | - (string) \mb_substr($str, 0, 1), |
|
3775 | + (string)\mb_substr($str, 0, 1), |
|
3776 | 3776 | $encoding, |
3777 | 3777 | false, |
3778 | 3778 | $lang, |
@@ -3782,10 +3782,10 @@ discard block |
||
3782 | 3782 | } else { |
3783 | 3783 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
3784 | 3784 | |
3785 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
3785 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
3786 | 3786 | |
3787 | 3787 | $str_part_one = self::strtolower( |
3788 | - (string) self::substr($str, 0, 1, $encoding), |
|
3788 | + (string)self::substr($str, 0, 1, $encoding), |
|
3789 | 3789 | $encoding, |
3790 | 3790 | false, |
3791 | 3791 | $lang, |
@@ -3793,7 +3793,7 @@ discard block |
||
3793 | 3793 | ); |
3794 | 3794 | } |
3795 | 3795 | |
3796 | - return $str_part_one . $str_part_two; |
|
3796 | + return $str_part_one.$str_part_two; |
|
3797 | 3797 | } |
3798 | 3798 | |
3799 | 3799 | /** |
@@ -3928,7 +3928,7 @@ discard block |
||
3928 | 3928 | } |
3929 | 3929 | |
3930 | 3930 | /** @noinspection PhpComposerExtensionStubsInspection */ |
3931 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
3931 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
3932 | 3932 | } |
3933 | 3933 | |
3934 | 3934 | if ($chars) { |
@@ -3976,7 +3976,7 @@ discard block |
||
3976 | 3976 | { |
3977 | 3977 | $bytes = self::chr_size_list($str); |
3978 | 3978 | if (\count($bytes) > 0) { |
3979 | - return (int) \max($bytes); |
|
3979 | + return (int)\max($bytes); |
|
3980 | 3980 | } |
3981 | 3981 | |
3982 | 3982 | return 0; |
@@ -4045,7 +4045,7 @@ discard block |
||
4045 | 4045 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4046 | 4046 | |
4047 | 4047 | // init |
4048 | - $encoding = (string) $encoding; |
|
4048 | + $encoding = (string)$encoding; |
|
4049 | 4049 | |
4050 | 4050 | if (!$encoding) { |
4051 | 4051 | return $fallback; |
@@ -4099,7 +4099,7 @@ discard block |
||
4099 | 4099 | |
4100 | 4100 | $encoding_original = $encoding; |
4101 | 4101 | $encoding = \strtoupper($encoding); |
4102 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4102 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4103 | 4103 | |
4104 | 4104 | $equivalences = [ |
4105 | 4105 | 'ISO8859' => 'ISO-8859-1', |
@@ -4239,13 +4239,13 @@ discard block |
||
4239 | 4239 | static $CHAR_CACHE = []; |
4240 | 4240 | |
4241 | 4241 | // init |
4242 | - $chr = (string) $chr; |
|
4242 | + $chr = (string)$chr; |
|
4243 | 4243 | |
4244 | 4244 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4245 | 4245 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4246 | 4246 | } |
4247 | 4247 | |
4248 | - $cache_key = $chr . $encoding; |
|
4248 | + $cache_key = $chr.$encoding; |
|
4249 | 4249 | if (isset($CHAR_CACHE[$cache_key]) === true) { |
4250 | 4250 | return $CHAR_CACHE[$cache_key]; |
4251 | 4251 | } |
@@ -4280,7 +4280,7 @@ discard block |
||
4280 | 4280 | // |
4281 | 4281 | |
4282 | 4282 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
4283 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
4283 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
4284 | 4284 | /** @noinspection OffsetOperationsInspection */ |
4285 | 4285 | $code = $chr ? $chr[1] : 0; |
4286 | 4286 | |
@@ -4288,21 +4288,21 @@ discard block |
||
4288 | 4288 | if ($code >= 0xF0 && isset($chr[4])) { |
4289 | 4289 | /** @noinspection UnnecessaryCastingInspection */ |
4290 | 4290 | /** @noinspection OffsetOperationsInspection */ |
4291 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4291 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4292 | 4292 | } |
4293 | 4293 | |
4294 | 4294 | /** @noinspection OffsetOperationsInspection */ |
4295 | 4295 | if ($code >= 0xE0 && isset($chr[3])) { |
4296 | 4296 | /** @noinspection UnnecessaryCastingInspection */ |
4297 | 4297 | /** @noinspection OffsetOperationsInspection */ |
4298 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4298 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4299 | 4299 | } |
4300 | 4300 | |
4301 | 4301 | /** @noinspection OffsetOperationsInspection */ |
4302 | 4302 | if ($code >= 0xC0 && isset($chr[2])) { |
4303 | 4303 | /** @noinspection UnnecessaryCastingInspection */ |
4304 | 4304 | /** @noinspection OffsetOperationsInspection */ |
4305 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4305 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4306 | 4306 | } |
4307 | 4307 | |
4308 | 4308 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -4351,7 +4351,7 @@ discard block |
||
4351 | 4351 | public static function pcre_utf8_support(): bool |
4352 | 4352 | { |
4353 | 4353 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4354 | - return (bool) @\preg_match('//u', ''); |
|
4354 | + return (bool)@\preg_match('//u', ''); |
|
4355 | 4355 | } |
4356 | 4356 | |
4357 | 4357 | /** |
@@ -4383,11 +4383,11 @@ discard block |
||
4383 | 4383 | |
4384 | 4384 | if ($step !== 1) { |
4385 | 4385 | if (!\is_numeric($step)) { |
4386 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
4386 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
4387 | 4387 | } |
4388 | 4388 | |
4389 | 4389 | if ($step <= 0) { |
4390 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
4390 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
4391 | 4391 | } |
4392 | 4392 | } |
4393 | 4393 | |
@@ -4399,14 +4399,14 @@ discard block |
||
4399 | 4399 | $is_xdigit = false; |
4400 | 4400 | |
4401 | 4401 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4402 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
4402 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
4403 | 4403 | $is_digit = true; |
4404 | - $start = (int) $var1; |
|
4404 | + $start = (int)$var1; |
|
4405 | 4405 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
4406 | 4406 | $is_xdigit = true; |
4407 | - $start = (int) self::hex_to_int($var1); |
|
4407 | + $start = (int)self::hex_to_int($var1); |
|
4408 | 4408 | } elseif (!$use_ctype && \is_numeric($var1)) { |
4409 | - $start = (int) $var1; |
|
4409 | + $start = (int)$var1; |
|
4410 | 4410 | } else { |
4411 | 4411 | $start = self::ord($var1); |
4412 | 4412 | } |
@@ -4416,11 +4416,11 @@ discard block |
||
4416 | 4416 | } |
4417 | 4417 | |
4418 | 4418 | if ($is_digit) { |
4419 | - $end = (int) $var2; |
|
4419 | + $end = (int)$var2; |
|
4420 | 4420 | } elseif ($is_xdigit) { |
4421 | - $end = (int) self::hex_to_int($var2); |
|
4421 | + $end = (int)self::hex_to_int($var2); |
|
4422 | 4422 | } elseif (!$use_ctype && \is_numeric($var2)) { |
4423 | - $end = (int) $var2; |
|
4423 | + $end = (int)$var2; |
|
4424 | 4424 | } else { |
4425 | 4425 | $end = self::ord($var2); |
4426 | 4426 | } |
@@ -4431,7 +4431,7 @@ discard block |
||
4431 | 4431 | |
4432 | 4432 | $array = []; |
4433 | 4433 | foreach (\range($start, $end, $step) as $i) { |
4434 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
4434 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
4435 | 4435 | } |
4436 | 4436 | |
4437 | 4437 | return $array; |
@@ -4522,8 +4522,8 @@ discard block |
||
4522 | 4522 | $delimiter = '/'; |
4523 | 4523 | } |
4524 | 4524 | |
4525 | - return (string) \preg_replace( |
|
4526 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4525 | + return (string)\preg_replace( |
|
4526 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4527 | 4527 | $replacement, |
4528 | 4528 | $str |
4529 | 4529 | ); |
@@ -4566,9 +4566,9 @@ discard block |
||
4566 | 4566 | return ''; |
4567 | 4567 | } |
4568 | 4568 | |
4569 | - $str_length -= (int) $bom_byte_length; |
|
4569 | + $str_length -= (int)$bom_byte_length; |
|
4570 | 4570 | |
4571 | - $str = (string) $str_tmp; |
|
4571 | + $str = (string)$str_tmp; |
|
4572 | 4572 | } |
4573 | 4573 | } |
4574 | 4574 | |
@@ -4592,7 +4592,7 @@ discard block |
||
4592 | 4592 | if (\is_array($what) === true) { |
4593 | 4593 | /** @noinspection ForeachSourceInspection */ |
4594 | 4594 | foreach ($what as $item) { |
4595 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
4595 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
4596 | 4596 | } |
4597 | 4597 | } |
4598 | 4598 | |
@@ -4624,7 +4624,7 @@ discard block |
||
4624 | 4624 | */ |
4625 | 4625 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
4626 | 4626 | { |
4627 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4627 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4628 | 4628 | } |
4629 | 4629 | |
4630 | 4630 | /** |
@@ -4668,17 +4668,17 @@ discard block |
||
4668 | 4668 | ): string { |
4669 | 4669 | if ($substring && \strpos($str, $substring) === 0) { |
4670 | 4670 | if ($encoding === 'UTF-8') { |
4671 | - return (string) \mb_substr( |
|
4671 | + return (string)\mb_substr( |
|
4672 | 4672 | $str, |
4673 | - (int) \mb_strlen($substring) |
|
4673 | + (int)\mb_strlen($substring) |
|
4674 | 4674 | ); |
4675 | 4675 | } |
4676 | 4676 | |
4677 | 4677 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4678 | 4678 | |
4679 | - return (string) self::substr( |
|
4679 | + return (string)self::substr( |
|
4680 | 4680 | $str, |
4681 | - (int) self::strlen($substring, $encoding), |
|
4681 | + (int)self::strlen($substring, $encoding), |
|
4682 | 4682 | null, |
4683 | 4683 | $encoding |
4684 | 4684 | ); |
@@ -4703,19 +4703,19 @@ discard block |
||
4703 | 4703 | ): string { |
4704 | 4704 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
4705 | 4705 | if ($encoding === 'UTF-8') { |
4706 | - return (string) \mb_substr( |
|
4706 | + return (string)\mb_substr( |
|
4707 | 4707 | $str, |
4708 | 4708 | 0, |
4709 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
4709 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
4710 | 4710 | ); |
4711 | 4711 | } |
4712 | 4712 | |
4713 | 4713 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4714 | 4714 | |
4715 | - return (string) self::substr( |
|
4715 | + return (string)self::substr( |
|
4716 | 4716 | $str, |
4717 | 4717 | 0, |
4718 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
4718 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
4719 | 4719 | $encoding |
4720 | 4720 | ); |
4721 | 4721 | } |
@@ -4802,7 +4802,7 @@ discard block |
||
4802 | 4802 | $save = \mb_substitute_character(); |
4803 | 4803 | \mb_substitute_character($replacement_char_helper); |
4804 | 4804 | // the polyfill maybe return false, so cast to string |
4805 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4805 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4806 | 4806 | \mb_substitute_character($save); |
4807 | 4807 | } |
4808 | 4808 | |
@@ -4844,7 +4844,7 @@ discard block |
||
4844 | 4844 | } |
4845 | 4845 | |
4846 | 4846 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4847 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4847 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4848 | 4848 | } |
4849 | 4849 | |
4850 | 4850 | if ($chars) { |
@@ -4866,7 +4866,7 @@ discard block |
||
4866 | 4866 | { |
4867 | 4867 | echo '<pre>'; |
4868 | 4868 | foreach (self::$SUPPORT as $key => &$value) { |
4869 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
4869 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
4870 | 4870 | } |
4871 | 4871 | unset($value); |
4872 | 4872 | echo '</pre>'; |
@@ -4898,7 +4898,7 @@ discard block |
||
4898 | 4898 | return $char; |
4899 | 4899 | } |
4900 | 4900 | |
4901 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
4901 | + return '&#'.self::ord($char, $encoding).';'; |
|
4902 | 4902 | } |
4903 | 4903 | |
4904 | 4904 | /** |
@@ -4991,18 +4991,18 @@ discard block |
||
4991 | 4991 | $lang, |
4992 | 4992 | $try_to_keep_the_string_length |
4993 | 4993 | ); |
4994 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
4994 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
4995 | 4995 | |
4996 | 4996 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
4997 | 4997 | |
4998 | - $str = (string) \preg_replace_callback( |
|
4998 | + $str = (string)\preg_replace_callback( |
|
4999 | 4999 | '/[-_\\s]+(.)?/u', |
5000 | 5000 | /** |
5001 | 5001 | * @param array $match |
5002 | 5002 | * |
5003 | 5003 | * @return string |
5004 | 5004 | */ |
5005 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5005 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5006 | 5006 | if (isset($match[1])) { |
5007 | 5007 | if ($use_mb_functions === true) { |
5008 | 5008 | if ($encoding === 'UTF-8') { |
@@ -5020,14 +5020,14 @@ discard block |
||
5020 | 5020 | $str |
5021 | 5021 | ); |
5022 | 5022 | |
5023 | - return (string) \preg_replace_callback( |
|
5023 | + return (string)\preg_replace_callback( |
|
5024 | 5024 | '/[\\p{N}]+(.)?/u', |
5025 | 5025 | /** |
5026 | 5026 | * @param array $match |
5027 | 5027 | * |
5028 | 5028 | * @return string |
5029 | 5029 | */ |
5030 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5030 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5031 | 5031 | if ($use_mb_functions === true) { |
5032 | 5032 | if ($encoding === 'UTF-8') { |
5033 | 5033 | return \mb_strtoupper($match[0]); |
@@ -5205,7 +5205,7 @@ discard block |
||
5205 | 5205 | ): string { |
5206 | 5206 | if (self::$SUPPORT['mbstring'] === true) { |
5207 | 5207 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5208 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5208 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5209 | 5209 | |
5210 | 5210 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
5211 | 5211 | if ($use_mb_functions === true && $encoding === 'UTF-8') { |
@@ -5215,10 +5215,10 @@ discard block |
||
5215 | 5215 | } |
5216 | 5216 | |
5217 | 5217 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5218 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5218 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5219 | 5219 | } |
5220 | 5220 | |
5221 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5221 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5222 | 5222 | |
5223 | 5223 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
5224 | 5224 | if ($use_mb_functions === true && $encoding === 'UTF-8') { |
@@ -5227,7 +5227,7 @@ discard block |
||
5227 | 5227 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
5228 | 5228 | } |
5229 | 5229 | |
5230 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5230 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5231 | 5231 | } |
5232 | 5232 | |
5233 | 5233 | /** |
@@ -5242,7 +5242,7 @@ discard block |
||
5242 | 5242 | public static function str_detect_encoding($str) |
5243 | 5243 | { |
5244 | 5244 | // init |
5245 | - $str = (string) $str; |
|
5245 | + $str = (string)$str; |
|
5246 | 5246 | |
5247 | 5247 | // |
5248 | 5248 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5344,7 +5344,7 @@ discard block |
||
5344 | 5344 | foreach (self::$ENCODINGS as $encoding_tmp) { |
5345 | 5345 | // INFO: //IGNORE but still throw notice |
5346 | 5346 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5347 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
5347 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
5348 | 5348 | return $encoding_tmp; |
5349 | 5349 | } |
5350 | 5350 | } |
@@ -5433,7 +5433,7 @@ discard block |
||
5433 | 5433 | return $str; |
5434 | 5434 | } |
5435 | 5435 | |
5436 | - return $substring . $str; |
|
5436 | + return $substring.$str; |
|
5437 | 5437 | } |
5438 | 5438 | |
5439 | 5439 | /** |
@@ -5702,27 +5702,27 @@ discard block |
||
5702 | 5702 | string $encoding = 'UTF-8' |
5703 | 5703 | ): string { |
5704 | 5704 | if ($encoding === 'UTF-8') { |
5705 | - $len = (int) \mb_strlen($str); |
|
5705 | + $len = (int)\mb_strlen($str); |
|
5706 | 5706 | if ($index > $len) { |
5707 | 5707 | return $str; |
5708 | 5708 | } |
5709 | 5709 | |
5710 | 5710 | /** @noinspection UnnecessaryCastingInspection */ |
5711 | - return (string) \mb_substr($str, 0, $index) . |
|
5712 | - $substring . |
|
5713 | - (string) \mb_substr($str, $index, $len); |
|
5711 | + return (string)\mb_substr($str, 0, $index). |
|
5712 | + $substring. |
|
5713 | + (string)\mb_substr($str, $index, $len); |
|
5714 | 5714 | } |
5715 | 5715 | |
5716 | 5716 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5717 | 5717 | |
5718 | - $len = (int) self::strlen($str, $encoding); |
|
5718 | + $len = (int)self::strlen($str, $encoding); |
|
5719 | 5719 | if ($index > $len) { |
5720 | 5720 | return $str; |
5721 | 5721 | } |
5722 | 5722 | |
5723 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
5724 | - $substring . |
|
5725 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5723 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
5724 | + $substring. |
|
5725 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
5726 | 5726 | } |
5727 | 5727 | |
5728 | 5728 | /** |
@@ -5752,15 +5752,15 @@ discard block |
||
5752 | 5752 | */ |
5753 | 5753 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5754 | 5754 | { |
5755 | - $search = (array) $search; |
|
5755 | + $search = (array)$search; |
|
5756 | 5756 | |
5757 | 5757 | /** @noinspection AlterInForeachInspection */ |
5758 | 5758 | foreach ($search as &$s) { |
5759 | - $s = (string) $s; |
|
5759 | + $s = (string)$s; |
|
5760 | 5760 | if ($s === '') { |
5761 | 5761 | $s = '/^(?<=.)$/'; |
5762 | 5762 | } else { |
5763 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5763 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5764 | 5764 | } |
5765 | 5765 | } |
5766 | 5766 | |
@@ -5792,11 +5792,11 @@ discard block |
||
5792 | 5792 | } |
5793 | 5793 | |
5794 | 5794 | if ($search === '') { |
5795 | - return $str . $replacement; |
|
5795 | + return $str.$replacement; |
|
5796 | 5796 | } |
5797 | 5797 | |
5798 | 5798 | if (\stripos($str, $search) === 0) { |
5799 | - return $replacement . \substr($str, \strlen($search)); |
|
5799 | + return $replacement.\substr($str, \strlen($search)); |
|
5800 | 5800 | } |
5801 | 5801 | |
5802 | 5802 | return $str; |
@@ -5824,11 +5824,11 @@ discard block |
||
5824 | 5824 | } |
5825 | 5825 | |
5826 | 5826 | if ($search === '') { |
5827 | - return $str . $replacement; |
|
5827 | + return $str.$replacement; |
|
5828 | 5828 | } |
5829 | 5829 | |
5830 | 5830 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
5831 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
5831 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
5832 | 5832 | } |
5833 | 5833 | |
5834 | 5834 | return $str; |
@@ -5908,15 +5908,15 @@ discard block |
||
5908 | 5908 | } |
5909 | 5909 | |
5910 | 5910 | if ($encoding === 'UTF-8') { |
5911 | - return (string) \mb_substr( |
|
5911 | + return (string)\mb_substr( |
|
5912 | 5912 | $str, |
5913 | - $offset + (int) \mb_strlen($separator) |
|
5913 | + $offset + (int)\mb_strlen($separator) |
|
5914 | 5914 | ); |
5915 | 5915 | } |
5916 | 5916 | |
5917 | - return (string) self::substr( |
|
5917 | + return (string)self::substr( |
|
5918 | 5918 | $str, |
5919 | - $offset + (int) self::strlen($separator, $encoding), |
|
5919 | + $offset + (int)self::strlen($separator, $encoding), |
|
5920 | 5920 | null, |
5921 | 5921 | $encoding |
5922 | 5922 | ); |
@@ -5946,15 +5946,15 @@ discard block |
||
5946 | 5946 | } |
5947 | 5947 | |
5948 | 5948 | if ($encoding === 'UTF-8') { |
5949 | - return (string) \mb_substr( |
|
5949 | + return (string)\mb_substr( |
|
5950 | 5950 | $str, |
5951 | - $offset + (int) self::strlen($separator) |
|
5951 | + $offset + (int)self::strlen($separator) |
|
5952 | 5952 | ); |
5953 | 5953 | } |
5954 | 5954 | |
5955 | - return (string) self::substr( |
|
5955 | + return (string)self::substr( |
|
5956 | 5956 | $str, |
5957 | - $offset + (int) self::strlen($separator, $encoding), |
|
5957 | + $offset + (int)self::strlen($separator, $encoding), |
|
5958 | 5958 | null, |
5959 | 5959 | $encoding |
5960 | 5960 | ); |
@@ -5984,10 +5984,10 @@ discard block |
||
5984 | 5984 | } |
5985 | 5985 | |
5986 | 5986 | if ($encoding === 'UTF-8') { |
5987 | - return (string) \mb_substr($str, 0, $offset); |
|
5987 | + return (string)\mb_substr($str, 0, $offset); |
|
5988 | 5988 | } |
5989 | 5989 | |
5990 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
5990 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
5991 | 5991 | } |
5992 | 5992 | |
5993 | 5993 | /** |
@@ -6014,7 +6014,7 @@ discard block |
||
6014 | 6014 | return ''; |
6015 | 6015 | } |
6016 | 6016 | |
6017 | - return (string) \mb_substr($str, 0, $offset); |
|
6017 | + return (string)\mb_substr($str, 0, $offset); |
|
6018 | 6018 | } |
6019 | 6019 | |
6020 | 6020 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6022,7 +6022,7 @@ discard block |
||
6022 | 6022 | return ''; |
6023 | 6023 | } |
6024 | 6024 | |
6025 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6025 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6026 | 6026 | } |
6027 | 6027 | |
6028 | 6028 | /** |
@@ -6118,12 +6118,12 @@ discard block |
||
6118 | 6118 | } |
6119 | 6119 | |
6120 | 6120 | if ($encoding === 'UTF-8') { |
6121 | - return (string) \mb_substr($str, -$n); |
|
6121 | + return (string)\mb_substr($str, -$n); |
|
6122 | 6122 | } |
6123 | 6123 | |
6124 | 6124 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6125 | 6125 | |
6126 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6126 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6127 | 6127 | } |
6128 | 6128 | |
6129 | 6129 | /** |
@@ -6147,21 +6147,21 @@ discard block |
||
6147 | 6147 | } |
6148 | 6148 | |
6149 | 6149 | if ($encoding === 'UTF-8') { |
6150 | - if ((int) \mb_strlen($str) <= $length) { |
|
6150 | + if ((int)\mb_strlen($str) <= $length) { |
|
6151 | 6151 | return $str; |
6152 | 6152 | } |
6153 | 6153 | |
6154 | 6154 | /** @noinspection UnnecessaryCastingInspection */ |
6155 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
6155 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
6156 | 6156 | } |
6157 | 6157 | |
6158 | 6158 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6159 | 6159 | |
6160 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6160 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6161 | 6161 | return $str; |
6162 | 6162 | } |
6163 | 6163 | |
6164 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
6164 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
6165 | 6165 | } |
6166 | 6166 | |
6167 | 6167 | /** |
@@ -6186,12 +6186,12 @@ discard block |
||
6186 | 6186 | |
6187 | 6187 | if ($encoding === 'UTF-8') { |
6188 | 6188 | /** @noinspection UnnecessaryCastingInspection */ |
6189 | - if ((int) \mb_strlen($str) <= $length) { |
|
6189 | + if ((int)\mb_strlen($str) <= $length) { |
|
6190 | 6190 | return $str; |
6191 | 6191 | } |
6192 | 6192 | |
6193 | 6193 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6194 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6194 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6195 | 6195 | } |
6196 | 6196 | |
6197 | 6197 | $str = \mb_substr($str, 0, $length); |
@@ -6201,22 +6201,22 @@ discard block |
||
6201 | 6201 | $new_str = \implode(' ', $array); |
6202 | 6202 | |
6203 | 6203 | if ($new_str === '') { |
6204 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6204 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6205 | 6205 | } |
6206 | 6206 | } else { |
6207 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6207 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6208 | 6208 | return $str; |
6209 | 6209 | } |
6210 | 6210 | |
6211 | 6211 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6212 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6212 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6213 | 6213 | } |
6214 | 6214 | |
6215 | 6215 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6216 | 6216 | $str = self::substr($str, 0, $length, $encoding); |
6217 | 6217 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6218 | 6218 | if ($str === false) { |
6219 | - return '' . $str_add_on; |
|
6219 | + return ''.$str_add_on; |
|
6220 | 6220 | } |
6221 | 6221 | |
6222 | 6222 | $array = \explode(' ', $str); |
@@ -6224,11 +6224,11 @@ discard block |
||
6224 | 6224 | $new_str = \implode(' ', $array); |
6225 | 6225 | |
6226 | 6226 | if ($new_str === '') { |
6227 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6227 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6228 | 6228 | } |
6229 | 6229 | } |
6230 | 6230 | |
6231 | - return $new_str . $str_add_on; |
|
6231 | + return $new_str.$str_add_on; |
|
6232 | 6232 | } |
6233 | 6233 | |
6234 | 6234 | /** |
@@ -6249,7 +6249,7 @@ discard block |
||
6249 | 6249 | $longest_common_prefix = ''; |
6250 | 6250 | |
6251 | 6251 | if ($encoding === 'UTF-8') { |
6252 | - $max_length = (int) \min( |
|
6252 | + $max_length = (int)\min( |
|
6253 | 6253 | \mb_strlen($str1), |
6254 | 6254 | \mb_strlen($str2) |
6255 | 6255 | ); |
@@ -6270,7 +6270,7 @@ discard block |
||
6270 | 6270 | } else { |
6271 | 6271 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6272 | 6272 | |
6273 | - $max_length = (int) \min( |
|
6273 | + $max_length = (int)\min( |
|
6274 | 6274 | self::strlen($str1, $encoding), |
6275 | 6275 | self::strlen($str2, $encoding) |
6276 | 6276 | ); |
@@ -6316,13 +6316,13 @@ discard block |
||
6316 | 6316 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6317 | 6317 | |
6318 | 6318 | if ($encoding === 'UTF-8') { |
6319 | - $str_length = (int) \mb_strlen($str1); |
|
6320 | - $other_length = (int) \mb_strlen($str2); |
|
6319 | + $str_length = (int)\mb_strlen($str1); |
|
6320 | + $other_length = (int)\mb_strlen($str2); |
|
6321 | 6321 | } else { |
6322 | 6322 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6323 | 6323 | |
6324 | - $str_length = (int) self::strlen($str1, $encoding); |
|
6325 | - $other_length = (int) self::strlen($str2, $encoding); |
|
6324 | + $str_length = (int)self::strlen($str1, $encoding); |
|
6325 | + $other_length = (int)self::strlen($str2, $encoding); |
|
6326 | 6326 | } |
6327 | 6327 | |
6328 | 6328 | // Return if either string is empty |
@@ -6375,10 +6375,10 @@ discard block |
||
6375 | 6375 | } |
6376 | 6376 | |
6377 | 6377 | if ($encoding === 'UTF-8') { |
6378 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
6378 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
6379 | 6379 | } |
6380 | 6380 | |
6381 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
6381 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
6382 | 6382 | } |
6383 | 6383 | |
6384 | 6384 | /** |
@@ -6400,7 +6400,7 @@ discard block |
||
6400 | 6400 | } |
6401 | 6401 | |
6402 | 6402 | if ($encoding === 'UTF-8') { |
6403 | - $max_length = (int) \min( |
|
6403 | + $max_length = (int)\min( |
|
6404 | 6404 | \mb_strlen($str1, $encoding), |
6405 | 6405 | \mb_strlen($str2, $encoding) |
6406 | 6406 | ); |
@@ -6414,7 +6414,7 @@ discard block |
||
6414 | 6414 | && |
6415 | 6415 | $char === \mb_substr($str2, -$i, 1) |
6416 | 6416 | ) { |
6417 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
6417 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
6418 | 6418 | } else { |
6419 | 6419 | break; |
6420 | 6420 | } |
@@ -6422,7 +6422,7 @@ discard block |
||
6422 | 6422 | } else { |
6423 | 6423 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6424 | 6424 | |
6425 | - $max_length = (int) \min( |
|
6425 | + $max_length = (int)\min( |
|
6426 | 6426 | self::strlen($str1, $encoding), |
6427 | 6427 | self::strlen($str2, $encoding) |
6428 | 6428 | ); |
@@ -6436,7 +6436,7 @@ discard block |
||
6436 | 6436 | && |
6437 | 6437 | $char === self::substr($str2, -$i, 1, $encoding) |
6438 | 6438 | ) { |
6439 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
6439 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
6440 | 6440 | } else { |
6441 | 6441 | break; |
6442 | 6442 | } |
@@ -6456,7 +6456,7 @@ discard block |
||
6456 | 6456 | */ |
6457 | 6457 | public static function str_matches_pattern(string $str, string $pattern): bool |
6458 | 6458 | { |
6459 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6459 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6460 | 6460 | } |
6461 | 6461 | |
6462 | 6462 | /** |
@@ -6473,7 +6473,7 @@ discard block |
||
6473 | 6473 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6474 | 6474 | { |
6475 | 6475 | // init |
6476 | - $length = (int) self::strlen($str, $encoding); |
|
6476 | + $length = (int)self::strlen($str, $encoding); |
|
6477 | 6477 | |
6478 | 6478 | if ($offset >= 0) { |
6479 | 6479 | return $length > $offset; |
@@ -6499,7 +6499,7 @@ discard block |
||
6499 | 6499 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6500 | 6500 | { |
6501 | 6501 | // init |
6502 | - $length = (int) self::strlen($str); |
|
6502 | + $length = (int)self::strlen($str); |
|
6503 | 6503 | |
6504 | 6504 | if ( |
6505 | 6505 | ($index >= 0 && $length <= $index) |
@@ -6538,7 +6538,7 @@ discard block |
||
6538 | 6538 | return $str; |
6539 | 6539 | } |
6540 | 6540 | |
6541 | - if ($pad_type !== (int) $pad_type) { |
|
6541 | + if ($pad_type !== (int)$pad_type) { |
|
6542 | 6542 | if ($pad_type === 'left') { |
6543 | 6543 | $pad_type = \STR_PAD_LEFT; |
6544 | 6544 | } elseif ($pad_type === 'right') { |
@@ -6547,23 +6547,23 @@ discard block |
||
6547 | 6547 | $pad_type = \STR_PAD_BOTH; |
6548 | 6548 | } else { |
6549 | 6549 | throw new \InvalidArgumentException( |
6550 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6550 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6551 | 6551 | ); |
6552 | 6552 | } |
6553 | 6553 | } |
6554 | 6554 | |
6555 | 6555 | if ($encoding === 'UTF-8') { |
6556 | - $str_length = (int) \mb_strlen($str); |
|
6556 | + $str_length = (int)\mb_strlen($str); |
|
6557 | 6557 | |
6558 | 6558 | if ($pad_length >= $str_length) { |
6559 | 6559 | switch ($pad_type) { |
6560 | 6560 | case \STR_PAD_LEFT: |
6561 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6561 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6562 | 6562 | |
6563 | 6563 | $diff = ($pad_length - $str_length); |
6564 | 6564 | |
6565 | - $pre = (string) \mb_substr( |
|
6566 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6565 | + $pre = (string)\mb_substr( |
|
6566 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6567 | 6567 | 0, |
6568 | 6568 | $diff |
6569 | 6569 | ); |
@@ -6574,16 +6574,16 @@ discard block |
||
6574 | 6574 | case \STR_PAD_BOTH: |
6575 | 6575 | $diff = ($pad_length - $str_length); |
6576 | 6576 | |
6577 | - $ps_length_left = (int) \floor($diff / 2); |
|
6577 | + $ps_length_left = (int)\floor($diff / 2); |
|
6578 | 6578 | |
6579 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6579 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6580 | 6580 | |
6581 | - $pre = (string) \mb_substr( |
|
6581 | + $pre = (string)\mb_substr( |
|
6582 | 6582 | \str_repeat($pad_string, $ps_length_left), |
6583 | 6583 | 0, |
6584 | 6584 | $ps_length_left |
6585 | 6585 | ); |
6586 | - $post = (string) \mb_substr( |
|
6586 | + $post = (string)\mb_substr( |
|
6587 | 6587 | \str_repeat($pad_string, $ps_length_right), |
6588 | 6588 | 0, |
6589 | 6589 | $ps_length_right |
@@ -6593,19 +6593,19 @@ discard block |
||
6593 | 6593 | |
6594 | 6594 | case \STR_PAD_RIGHT: |
6595 | 6595 | default: |
6596 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6596 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6597 | 6597 | |
6598 | 6598 | $diff = ($pad_length - $str_length); |
6599 | 6599 | |
6600 | - $post = (string) \mb_substr( |
|
6601 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6600 | + $post = (string)\mb_substr( |
|
6601 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6602 | 6602 | 0, |
6603 | 6603 | $diff |
6604 | 6604 | ); |
6605 | 6605 | $pre = ''; |
6606 | 6606 | } |
6607 | 6607 | |
6608 | - return $pre . $str . $post; |
|
6608 | + return $pre.$str.$post; |
|
6609 | 6609 | } |
6610 | 6610 | |
6611 | 6611 | return $str; |
@@ -6613,17 +6613,17 @@ discard block |
||
6613 | 6613 | |
6614 | 6614 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6615 | 6615 | |
6616 | - $str_length = (int) self::strlen($str, $encoding); |
|
6616 | + $str_length = (int)self::strlen($str, $encoding); |
|
6617 | 6617 | |
6618 | 6618 | if ($pad_length >= $str_length) { |
6619 | 6619 | switch ($pad_type) { |
6620 | 6620 | case \STR_PAD_LEFT: |
6621 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6621 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6622 | 6622 | |
6623 | 6623 | $diff = ($pad_length - $str_length); |
6624 | 6624 | |
6625 | - $pre = (string) self::substr( |
|
6626 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6625 | + $pre = (string)self::substr( |
|
6626 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6627 | 6627 | 0, |
6628 | 6628 | $diff, |
6629 | 6629 | $encoding |
@@ -6635,17 +6635,17 @@ discard block |
||
6635 | 6635 | case \STR_PAD_BOTH: |
6636 | 6636 | $diff = ($pad_length - $str_length); |
6637 | 6637 | |
6638 | - $ps_length_left = (int) \floor($diff / 2); |
|
6638 | + $ps_length_left = (int)\floor($diff / 2); |
|
6639 | 6639 | |
6640 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6640 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6641 | 6641 | |
6642 | - $pre = (string) self::substr( |
|
6642 | + $pre = (string)self::substr( |
|
6643 | 6643 | \str_repeat($pad_string, $ps_length_left), |
6644 | 6644 | 0, |
6645 | 6645 | $ps_length_left, |
6646 | 6646 | $encoding |
6647 | 6647 | ); |
6648 | - $post = (string) self::substr( |
|
6648 | + $post = (string)self::substr( |
|
6649 | 6649 | \str_repeat($pad_string, $ps_length_right), |
6650 | 6650 | 0, |
6651 | 6651 | $ps_length_right, |
@@ -6656,12 +6656,12 @@ discard block |
||
6656 | 6656 | |
6657 | 6657 | case \STR_PAD_RIGHT: |
6658 | 6658 | default: |
6659 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6659 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6660 | 6660 | |
6661 | 6661 | $diff = ($pad_length - $str_length); |
6662 | 6662 | |
6663 | - $post = (string) self::substr( |
|
6664 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6663 | + $post = (string)self::substr( |
|
6664 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6665 | 6665 | 0, |
6666 | 6666 | $diff, |
6667 | 6667 | $encoding |
@@ -6669,7 +6669,7 @@ discard block |
||
6669 | 6669 | $pre = ''; |
6670 | 6670 | } |
6671 | 6671 | |
6672 | - return $pre . $str . $post; |
|
6672 | + return $pre.$str.$post; |
|
6673 | 6673 | } |
6674 | 6674 | |
6675 | 6675 | return $str; |
@@ -6853,11 +6853,11 @@ discard block |
||
6853 | 6853 | } |
6854 | 6854 | |
6855 | 6855 | if ($search === '') { |
6856 | - return $str . $replacement; |
|
6856 | + return $str.$replacement; |
|
6857 | 6857 | } |
6858 | 6858 | |
6859 | 6859 | if (\strpos($str, $search) === 0) { |
6860 | - return $replacement . \substr($str, \strlen($search)); |
|
6860 | + return $replacement.\substr($str, \strlen($search)); |
|
6861 | 6861 | } |
6862 | 6862 | |
6863 | 6863 | return $str; |
@@ -6888,11 +6888,11 @@ discard block |
||
6888 | 6888 | } |
6889 | 6889 | |
6890 | 6890 | if ($search === '') { |
6891 | - return $str . $replacement; |
|
6891 | + return $str.$replacement; |
|
6892 | 6892 | } |
6893 | 6893 | |
6894 | 6894 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6895 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6895 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6896 | 6896 | } |
6897 | 6897 | |
6898 | 6898 | return $str; |
@@ -6924,7 +6924,7 @@ discard block |
||
6924 | 6924 | $subject, |
6925 | 6925 | $replace, |
6926 | 6926 | $pos, |
6927 | - (int) self::strlen($search) |
|
6927 | + (int)self::strlen($search) |
|
6928 | 6928 | ); |
6929 | 6929 | } |
6930 | 6930 | |
@@ -6956,7 +6956,7 @@ discard block |
||
6956 | 6956 | $subject, |
6957 | 6957 | $replace, |
6958 | 6958 | $pos, |
6959 | - (int) self::strlen($search) |
|
6959 | + (int)self::strlen($search) |
|
6960 | 6960 | ); |
6961 | 6961 | } |
6962 | 6962 | |
@@ -6976,7 +6976,7 @@ discard block |
||
6976 | 6976 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
6977 | 6977 | { |
6978 | 6978 | if ($encoding === 'UTF-8') { |
6979 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
6979 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
6980 | 6980 | /** @noinspection NonSecureShuffleUsageInspection */ |
6981 | 6981 | \shuffle($indexes); |
6982 | 6982 | |
@@ -6992,7 +6992,7 @@ discard block |
||
6992 | 6992 | } else { |
6993 | 6993 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6994 | 6994 | |
6995 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
6995 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
6996 | 6996 | /** @noinspection NonSecureShuffleUsageInspection */ |
6997 | 6997 | \shuffle($indexes); |
6998 | 6998 | |
@@ -7033,11 +7033,11 @@ discard block |
||
7033 | 7033 | ) { |
7034 | 7034 | if ($encoding === 'UTF-8') { |
7035 | 7035 | if ($end === null) { |
7036 | - $length = (int) \mb_strlen($str); |
|
7036 | + $length = (int)\mb_strlen($str); |
|
7037 | 7037 | } elseif ($end >= 0 && $end <= $start) { |
7038 | 7038 | return ''; |
7039 | 7039 | } elseif ($end < 0) { |
7040 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7040 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7041 | 7041 | } else { |
7042 | 7042 | $length = $end - $start; |
7043 | 7043 | } |
@@ -7048,11 +7048,11 @@ discard block |
||
7048 | 7048 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7049 | 7049 | |
7050 | 7050 | if ($end === null) { |
7051 | - $length = (int) self::strlen($str, $encoding); |
|
7051 | + $length = (int)self::strlen($str, $encoding); |
|
7052 | 7052 | } elseif ($end >= 0 && $end <= $start) { |
7053 | 7053 | return ''; |
7054 | 7054 | } elseif ($end < 0) { |
7055 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7055 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7056 | 7056 | } else { |
7057 | 7057 | $length = $end - $start; |
7058 | 7058 | } |
@@ -7084,35 +7084,35 @@ discard block |
||
7084 | 7084 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7085 | 7085 | } |
7086 | 7086 | |
7087 | - $str = (string) \preg_replace_callback( |
|
7087 | + $str = (string)\preg_replace_callback( |
|
7088 | 7088 | '/([\\p{N}|\\p{Lu}])/u', |
7089 | 7089 | /** |
7090 | 7090 | * @param string[] $matches |
7091 | 7091 | * |
7092 | 7092 | * @return string |
7093 | 7093 | */ |
7094 | - static function (array $matches) use ($encoding): string { |
|
7094 | + static function(array $matches) use ($encoding): string { |
|
7095 | 7095 | $match = $matches[1]; |
7096 | - $match_int = (int) $match; |
|
7096 | + $match_int = (int)$match; |
|
7097 | 7097 | |
7098 | - if ((string) $match_int === $match) { |
|
7099 | - return '_' . $match . '_'; |
|
7098 | + if ((string)$match_int === $match) { |
|
7099 | + return '_'.$match.'_'; |
|
7100 | 7100 | } |
7101 | 7101 | |
7102 | 7102 | if ($encoding === 'UTF-8') { |
7103 | - return '_' . \mb_strtolower($match); |
|
7103 | + return '_'.\mb_strtolower($match); |
|
7104 | 7104 | } |
7105 | 7105 | |
7106 | - return '_' . self::strtolower($match, $encoding); |
|
7106 | + return '_'.self::strtolower($match, $encoding); |
|
7107 | 7107 | }, |
7108 | 7108 | $str |
7109 | 7109 | ); |
7110 | 7110 | |
7111 | - $str = (string) \preg_replace( |
|
7111 | + $str = (string)\preg_replace( |
|
7112 | 7112 | [ |
7113 | - '/\\s+/u', // convert spaces to "_" |
|
7113 | + '/\\s+/u', // convert spaces to "_" |
|
7114 | 7114 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
7115 | - '/_+/', // remove double "_" |
|
7115 | + '/_+/', // remove double "_" |
|
7116 | 7116 | ], |
7117 | 7117 | [ |
7118 | 7118 | '_', |
@@ -7188,7 +7188,7 @@ discard block |
||
7188 | 7188 | } |
7189 | 7189 | |
7190 | 7190 | // init |
7191 | - $str = (string) $str; |
|
7191 | + $str = (string)$str; |
|
7192 | 7192 | |
7193 | 7193 | if ($str === '') { |
7194 | 7194 | return []; |
@@ -7235,7 +7235,7 @@ discard block |
||
7235 | 7235 | ($str[$i] & "\xE0") === "\xC0" |
7236 | 7236 | ) { |
7237 | 7237 | if (($str[$i + 1] & "\xC0") === "\x80") { |
7238 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
7238 | + $ret[] = $str[$i].$str[$i + 1]; |
|
7239 | 7239 | |
7240 | 7240 | ++$i; |
7241 | 7241 | } |
@@ -7249,7 +7249,7 @@ discard block |
||
7249 | 7249 | && |
7250 | 7250 | ($str[$i + 2] & "\xC0") === "\x80" |
7251 | 7251 | ) { |
7252 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
7252 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
7253 | 7253 | |
7254 | 7254 | $i += 2; |
7255 | 7255 | } |
@@ -7265,7 +7265,7 @@ discard block |
||
7265 | 7265 | && |
7266 | 7266 | ($str[$i + 3] & "\xC0") === "\x80" |
7267 | 7267 | ) { |
7268 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
7268 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
7269 | 7269 | |
7270 | 7270 | $i += 3; |
7271 | 7271 | } |
@@ -7277,7 +7277,7 @@ discard block |
||
7277 | 7277 | $ret = \array_chunk($ret, $length); |
7278 | 7278 | |
7279 | 7279 | return \array_map( |
7280 | - static function (array &$item): string { |
|
7280 | + static function(array &$item): string { |
|
7281 | 7281 | return \implode('', $item); |
7282 | 7282 | }, |
7283 | 7283 | $ret |
@@ -7340,7 +7340,7 @@ discard block |
||
7340 | 7340 | $limit = -1; |
7341 | 7341 | } |
7342 | 7342 | |
7343 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7343 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7344 | 7344 | |
7345 | 7345 | if ($array === false) { |
7346 | 7346 | return []; |
@@ -7424,9 +7424,9 @@ discard block |
||
7424 | 7424 | return ''; |
7425 | 7425 | } |
7426 | 7426 | |
7427 | - return (string) \mb_substr( |
|
7427 | + return (string)\mb_substr( |
|
7428 | 7428 | $str, |
7429 | - $offset + (int) \mb_strlen($separator) |
|
7429 | + $offset + (int)\mb_strlen($separator) |
|
7430 | 7430 | ); |
7431 | 7431 | } |
7432 | 7432 | |
@@ -7435,9 +7435,9 @@ discard block |
||
7435 | 7435 | return ''; |
7436 | 7436 | } |
7437 | 7437 | |
7438 | - return (string) \mb_substr( |
|
7438 | + return (string)\mb_substr( |
|
7439 | 7439 | $str, |
7440 | - $offset + (int) self::strlen($separator, $encoding), |
|
7440 | + $offset + (int)self::strlen($separator, $encoding), |
|
7441 | 7441 | null, |
7442 | 7442 | $encoding |
7443 | 7443 | ); |
@@ -7464,9 +7464,9 @@ discard block |
||
7464 | 7464 | return ''; |
7465 | 7465 | } |
7466 | 7466 | |
7467 | - return (string) \mb_substr( |
|
7467 | + return (string)\mb_substr( |
|
7468 | 7468 | $str, |
7469 | - $offset + (int) \mb_strlen($separator) |
|
7469 | + $offset + (int)\mb_strlen($separator) |
|
7470 | 7470 | ); |
7471 | 7471 | } |
7472 | 7472 | |
@@ -7475,9 +7475,9 @@ discard block |
||
7475 | 7475 | return ''; |
7476 | 7476 | } |
7477 | 7477 | |
7478 | - return (string) self::substr( |
|
7478 | + return (string)self::substr( |
|
7479 | 7479 | $str, |
7480 | - $offset + (int) self::strlen($separator, $encoding), |
|
7480 | + $offset + (int)self::strlen($separator, $encoding), |
|
7481 | 7481 | null, |
7482 | 7482 | $encoding |
7483 | 7483 | ); |
@@ -7507,7 +7507,7 @@ discard block |
||
7507 | 7507 | return ''; |
7508 | 7508 | } |
7509 | 7509 | |
7510 | - return (string) \mb_substr( |
|
7510 | + return (string)\mb_substr( |
|
7511 | 7511 | $str, |
7512 | 7512 | 0, |
7513 | 7513 | $offset |
@@ -7519,7 +7519,7 @@ discard block |
||
7519 | 7519 | return ''; |
7520 | 7520 | } |
7521 | 7521 | |
7522 | - return (string) self::substr( |
|
7522 | + return (string)self::substr( |
|
7523 | 7523 | $str, |
7524 | 7524 | 0, |
7525 | 7525 | $offset, |
@@ -7548,7 +7548,7 @@ discard block |
||
7548 | 7548 | return ''; |
7549 | 7549 | } |
7550 | 7550 | |
7551 | - return (string) \mb_substr( |
|
7551 | + return (string)\mb_substr( |
|
7552 | 7552 | $str, |
7553 | 7553 | 0, |
7554 | 7554 | $offset |
@@ -7562,7 +7562,7 @@ discard block |
||
7562 | 7562 | |
7563 | 7563 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7564 | 7564 | |
7565 | - return (string) self::substr( |
|
7565 | + return (string)self::substr( |
|
7566 | 7566 | $str, |
7567 | 7567 | 0, |
7568 | 7568 | $offset, |
@@ -7670,7 +7670,7 @@ discard block |
||
7670 | 7670 | */ |
7671 | 7671 | public static function str_surround(string $str, string $substring): string |
7672 | 7672 | { |
7673 | - return $substring . $str . $substring; |
|
7673 | + return $substring.$str.$substring; |
|
7674 | 7674 | } |
7675 | 7675 | |
7676 | 7676 | /** |
@@ -7727,9 +7727,9 @@ discard block |
||
7727 | 7727 | $word_define_chars = ''; |
7728 | 7728 | } |
7729 | 7729 | |
7730 | - $str = (string) \preg_replace_callback( |
|
7731 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
7732 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
7730 | + $str = (string)\preg_replace_callback( |
|
7731 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
7732 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
7733 | 7733 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
7734 | 7734 | return $match[0]; |
7735 | 7735 | } |
@@ -7820,16 +7820,16 @@ discard block |
||
7820 | 7820 | } |
7821 | 7821 | |
7822 | 7822 | // the main substitutions |
7823 | - $str = (string) \preg_replace_callback( |
|
7823 | + $str = (string)\preg_replace_callback( |
|
7824 | 7824 | '~\\b (_*) (?: # 1. Leading underscore and |
7825 | 7825 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
7826 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
7826 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
7827 | 7827 | | |
7828 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
7828 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
7829 | 7829 | | |
7830 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
7830 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
7831 | 7831 | | |
7832 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
7832 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
7833 | 7833 | ) (_*) \\b # 6. With trailing underscore |
7834 | 7834 | ~ux', |
7835 | 7835 | /** |
@@ -7837,7 +7837,7 @@ discard block |
||
7837 | 7837 | * |
7838 | 7838 | * @return string |
7839 | 7839 | */ |
7840 | - static function (array $matches) use ($encoding): string { |
|
7840 | + static function(array $matches) use ($encoding): string { |
|
7841 | 7841 | // preserve leading underscore |
7842 | 7842 | $str = $matches[1]; |
7843 | 7843 | if ($matches[2]) { |
@@ -7862,26 +7862,26 @@ discard block |
||
7862 | 7862 | ); |
7863 | 7863 | |
7864 | 7864 | // Exceptions for small words: capitalize at start of title... |
7865 | - $str = (string) \preg_replace_callback( |
|
7865 | + $str = (string)\preg_replace_callback( |
|
7866 | 7866 | '~( \\A [[:punct:]]* # start of title... |
7867 | 7867 | | [:.;?!][ ]+ # or of subsentence... |
7868 | 7868 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
7869 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
7869 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
7870 | 7870 | ~uxi', |
7871 | 7871 | /** |
7872 | 7872 | * @param string[] $matches |
7873 | 7873 | * |
7874 | 7874 | * @return string |
7875 | 7875 | */ |
7876 | - static function (array $matches) use ($encoding): string { |
|
7877 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
7876 | + static function(array $matches) use ($encoding): string { |
|
7877 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
7878 | 7878 | }, |
7879 | 7879 | $str |
7880 | 7880 | ); |
7881 | 7881 | |
7882 | 7882 | // ...and end of title |
7883 | - $str = (string) \preg_replace_callback( |
|
7884 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
7883 | + $str = (string)\preg_replace_callback( |
|
7884 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
7885 | 7885 | (?= [[:punct:]]* \Z # ...at the end of the title... |
7886 | 7886 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
7887 | 7887 | ~uxi', |
@@ -7890,7 +7890,7 @@ discard block |
||
7890 | 7890 | * |
7891 | 7891 | * @return string |
7892 | 7892 | */ |
7893 | - static function (array $matches) use ($encoding): string { |
|
7893 | + static function(array $matches) use ($encoding): string { |
|
7894 | 7894 | return static::ucfirst($matches[1], $encoding); |
7895 | 7895 | }, |
7896 | 7896 | $str |
@@ -7898,10 +7898,10 @@ discard block |
||
7898 | 7898 | |
7899 | 7899 | // Exceptions for small words in hyphenated compound words. |
7900 | 7900 | // e.g. "in-flight" -> In-Flight |
7901 | - $str = (string) \preg_replace_callback( |
|
7901 | + $str = (string)\preg_replace_callback( |
|
7902 | 7902 | '~\\b |
7903 | 7903 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
7904 | - ( ' . $small_words_rx . ' ) |
|
7904 | + ( ' . $small_words_rx.' ) |
|
7905 | 7905 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
7906 | 7906 | ~uxi', |
7907 | 7907 | /** |
@@ -7909,18 +7909,18 @@ discard block |
||
7909 | 7909 | * |
7910 | 7910 | * @return string |
7911 | 7911 | */ |
7912 | - static function (array $matches) use ($encoding): string { |
|
7912 | + static function(array $matches) use ($encoding): string { |
|
7913 | 7913 | return static::ucfirst($matches[1], $encoding); |
7914 | 7914 | }, |
7915 | 7915 | $str |
7916 | 7916 | ); |
7917 | 7917 | |
7918 | 7918 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
7919 | - $str = (string) \preg_replace_callback( |
|
7919 | + $str = (string)\preg_replace_callback( |
|
7920 | 7920 | '~\\b |
7921 | 7921 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
7922 | 7922 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
7923 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
7923 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
7924 | 7924 | (?! - ) # Negative lookahead for another - |
7925 | 7925 | ~uxi', |
7926 | 7926 | /** |
@@ -7928,8 +7928,8 @@ discard block |
||
7928 | 7928 | * |
7929 | 7929 | * @return string |
7930 | 7930 | */ |
7931 | - static function (array $matches) use ($encoding): string { |
|
7932 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
7931 | + static function(array $matches) use ($encoding): string { |
|
7932 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
7933 | 7933 | }, |
7934 | 7934 | $str |
7935 | 7935 | ); |
@@ -8038,7 +8038,7 @@ discard block |
||
8038 | 8038 | ); |
8039 | 8039 | |
8040 | 8040 | foreach ($tmp_return as &$item) { |
8041 | - $item = (string) $item; |
|
8041 | + $item = (string)$item; |
|
8042 | 8042 | } |
8043 | 8043 | |
8044 | 8044 | return $tmp_return; |
@@ -8087,39 +8087,39 @@ discard block |
||
8087 | 8087 | } |
8088 | 8088 | |
8089 | 8089 | if ($encoding === 'UTF-8') { |
8090 | - if ($length >= (int) \mb_strlen($str)) { |
|
8090 | + if ($length >= (int)\mb_strlen($str)) { |
|
8091 | 8091 | return $str; |
8092 | 8092 | } |
8093 | 8093 | |
8094 | 8094 | if ($substring !== '') { |
8095 | - $length -= (int) \mb_strlen($substring); |
|
8095 | + $length -= (int)\mb_strlen($substring); |
|
8096 | 8096 | |
8097 | 8097 | /** @noinspection UnnecessaryCastingInspection */ |
8098 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8098 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8099 | 8099 | } |
8100 | 8100 | |
8101 | 8101 | /** @noinspection UnnecessaryCastingInspection */ |
8102 | - return (string) \mb_substr($str, 0, $length); |
|
8102 | + return (string)\mb_substr($str, 0, $length); |
|
8103 | 8103 | } |
8104 | 8104 | |
8105 | 8105 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8106 | 8106 | |
8107 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8107 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8108 | 8108 | return $str; |
8109 | 8109 | } |
8110 | 8110 | |
8111 | 8111 | if ($substring !== '') { |
8112 | - $length -= (int) self::strlen($substring, $encoding); |
|
8112 | + $length -= (int)self::strlen($substring, $encoding); |
|
8113 | 8113 | } |
8114 | 8114 | |
8115 | 8115 | return ( |
8116 | - (string) self::substr( |
|
8116 | + (string)self::substr( |
|
8117 | 8117 | $str, |
8118 | 8118 | 0, |
8119 | 8119 | $length, |
8120 | 8120 | $encoding |
8121 | 8121 | ) |
8122 | - ) . $substring; |
|
8122 | + ).$substring; |
|
8123 | 8123 | } |
8124 | 8124 | |
8125 | 8125 | /** |
@@ -8149,12 +8149,12 @@ discard block |
||
8149 | 8149 | } |
8150 | 8150 | |
8151 | 8151 | if ($encoding === 'UTF-8') { |
8152 | - if ($length >= (int) \mb_strlen($str)) { |
|
8152 | + if ($length >= (int)\mb_strlen($str)) { |
|
8153 | 8153 | return $str; |
8154 | 8154 | } |
8155 | 8155 | |
8156 | 8156 | // need to further trim the string so we can append the substring |
8157 | - $length -= (int) \mb_strlen($substring); |
|
8157 | + $length -= (int)\mb_strlen($substring); |
|
8158 | 8158 | if ($length <= 0) { |
8159 | 8159 | return $substring; |
8160 | 8160 | } |
@@ -8176,18 +8176,18 @@ discard block |
||
8176 | 8176 | || |
8177 | 8177 | ($space_position !== false && $ignore_do_not_split_words_for_one_word === false) |
8178 | 8178 | ) { |
8179 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
8179 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
8180 | 8180 | } |
8181 | 8181 | } |
8182 | 8182 | } else { |
8183 | 8183 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8184 | 8184 | |
8185 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8185 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8186 | 8186 | return $str; |
8187 | 8187 | } |
8188 | 8188 | |
8189 | 8189 | // need to further trim the string so we can append the substring |
8190 | - $length -= (int) self::strlen($substring, $encoding); |
|
8190 | + $length -= (int)self::strlen($substring, $encoding); |
|
8191 | 8191 | if ($length <= 0) { |
8192 | 8192 | return $substring; |
8193 | 8193 | } |
@@ -8209,12 +8209,12 @@ discard block |
||
8209 | 8209 | || |
8210 | 8210 | ($space_position !== false && $ignore_do_not_split_words_for_one_word === false) |
8211 | 8211 | ) { |
8212 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
8212 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
8213 | 8213 | } |
8214 | 8214 | } |
8215 | 8215 | } |
8216 | 8216 | |
8217 | - return $truncated . $substring; |
|
8217 | + return $truncated.$substring; |
|
8218 | 8218 | } |
8219 | 8219 | |
8220 | 8220 | /** |
@@ -8311,13 +8311,13 @@ discard block |
||
8311 | 8311 | } |
8312 | 8312 | } elseif ($format === 2) { |
8313 | 8313 | $number_of_words = []; |
8314 | - $offset = (int) self::strlen($str_parts[0]); |
|
8314 | + $offset = (int)self::strlen($str_parts[0]); |
|
8315 | 8315 | for ($i = 1; $i < $len; $i += 2) { |
8316 | 8316 | $number_of_words[$offset] = $str_parts[$i]; |
8317 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
8317 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
8318 | 8318 | } |
8319 | 8319 | } else { |
8320 | - $number_of_words = (int) (($len - 1) / 2); |
|
8320 | + $number_of_words = (int)(($len - 1) / 2); |
|
8321 | 8321 | } |
8322 | 8322 | |
8323 | 8323 | return $number_of_words; |
@@ -8438,21 +8438,21 @@ discard block |
||
8438 | 8438 | } |
8439 | 8439 | |
8440 | 8440 | if ($char_list === '') { |
8441 | - return (int) self::strlen($str, $encoding); |
|
8441 | + return (int)self::strlen($str, $encoding); |
|
8442 | 8442 | } |
8443 | 8443 | |
8444 | 8444 | if ($offset !== null || $length !== null) { |
8445 | 8445 | if ($encoding === 'UTF-8') { |
8446 | 8446 | if ($length === null) { |
8447 | 8447 | /** @noinspection UnnecessaryCastingInspection */ |
8448 | - $str_tmp = \mb_substr($str, (int) $offset); |
|
8448 | + $str_tmp = \mb_substr($str, (int)$offset); |
|
8449 | 8449 | } else { |
8450 | 8450 | /** @noinspection UnnecessaryCastingInspection */ |
8451 | - $str_tmp = \mb_substr($str, (int) $offset, $length); |
|
8451 | + $str_tmp = \mb_substr($str, (int)$offset, $length); |
|
8452 | 8452 | } |
8453 | 8453 | } else { |
8454 | 8454 | /** @noinspection UnnecessaryCastingInspection */ |
8455 | - $str_tmp = self::substr($str, (int) $offset, $length, $encoding); |
|
8455 | + $str_tmp = self::substr($str, (int)$offset, $length, $encoding); |
|
8456 | 8456 | } |
8457 | 8457 | |
8458 | 8458 | if ($str_tmp === false) { |
@@ -8468,7 +8468,7 @@ discard block |
||
8468 | 8468 | } |
8469 | 8469 | |
8470 | 8470 | $matches = []; |
8471 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
8471 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
8472 | 8472 | $return = self::strlen($matches[1], $encoding); |
8473 | 8473 | if ($return === false) { |
8474 | 8474 | return 0; |
@@ -8477,7 +8477,7 @@ discard block |
||
8477 | 8477 | return $return; |
8478 | 8478 | } |
8479 | 8479 | |
8480 | - return (int) self::strlen($str, $encoding); |
|
8480 | + return (int)self::strlen($str, $encoding); |
|
8481 | 8481 | } |
8482 | 8482 | |
8483 | 8483 | /** |
@@ -8610,7 +8610,7 @@ discard block |
||
8610 | 8610 | return ''; |
8611 | 8611 | } |
8612 | 8612 | |
8613 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
8613 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
8614 | 8614 | } |
8615 | 8615 | |
8616 | 8616 | /** |
@@ -8675,7 +8675,7 @@ discard block |
||
8675 | 8675 | // fallback for ascii only |
8676 | 8676 | // |
8677 | 8677 | |
8678 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
8678 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
8679 | 8679 | return \stripos($haystack, $needle, $offset); |
8680 | 8680 | } |
8681 | 8681 | |
@@ -8743,7 +8743,7 @@ discard block |
||
8743 | 8743 | && |
8744 | 8744 | self::$SUPPORT['mbstring'] === false |
8745 | 8745 | ) { |
8746 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8746 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8747 | 8747 | } |
8748 | 8748 | |
8749 | 8749 | if ( |
@@ -8757,11 +8757,11 @@ discard block |
||
8757 | 8757 | } |
8758 | 8758 | } |
8759 | 8759 | |
8760 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
8760 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
8761 | 8761 | return \stristr($haystack, $needle, $before_needle); |
8762 | 8762 | } |
8763 | 8763 | |
8764 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
8764 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
8765 | 8765 | |
8766 | 8766 | if (!isset($match[1])) { |
8767 | 8767 | return false; |
@@ -8771,7 +8771,7 @@ discard block |
||
8771 | 8771 | return $match[1]; |
8772 | 8772 | } |
8773 | 8773 | |
8774 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
8774 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
8775 | 8775 | } |
8776 | 8776 | |
8777 | 8777 | /** |
@@ -8843,7 +8843,7 @@ discard block |
||
8843 | 8843 | && |
8844 | 8844 | self::$SUPPORT['iconv'] === false |
8845 | 8845 | ) { |
8846 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8846 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8847 | 8847 | } |
8848 | 8848 | |
8849 | 8849 | // |
@@ -8959,8 +8959,8 @@ discard block |
||
8959 | 8959 | } |
8960 | 8960 | |
8961 | 8961 | return \strnatcmp( |
8962 | - (string) self::strtonatfold($str1), |
|
8963 | - (string) self::strtonatfold($str2) |
|
8962 | + (string)self::strtonatfold($str1), |
|
8963 | + (string)self::strtonatfold($str2) |
|
8964 | 8964 | ); |
8965 | 8965 | } |
8966 | 8966 | |
@@ -9018,11 +9018,11 @@ discard block |
||
9018 | 9018 | } |
9019 | 9019 | |
9020 | 9020 | if ($encoding === 'UTF-8') { |
9021 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
9022 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
9021 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
9022 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
9023 | 9023 | } else { |
9024 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
9025 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
9024 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
9025 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
9026 | 9026 | } |
9027 | 9027 | |
9028 | 9028 | return self::strcmp($str1, $str2); |
@@ -9044,8 +9044,8 @@ discard block |
||
9044 | 9044 | return false; |
9045 | 9045 | } |
9046 | 9046 | |
9047 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
9048 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
9047 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
9048 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
9049 | 9049 | } |
9050 | 9050 | |
9051 | 9051 | return false; |
@@ -9078,10 +9078,10 @@ discard block |
||
9078 | 9078 | } |
9079 | 9079 | |
9080 | 9080 | // iconv and mbstring do not support integer $needle |
9081 | - if ((int) $needle === $needle) { |
|
9082 | - $needle = (string) self::chr($needle); |
|
9081 | + if ((int)$needle === $needle) { |
|
9082 | + $needle = (string)self::chr($needle); |
|
9083 | 9083 | } |
9084 | - $needle = (string) $needle; |
|
9084 | + $needle = (string)$needle; |
|
9085 | 9085 | |
9086 | 9086 | if ($needle === '') { |
9087 | 9087 | return false; |
@@ -9128,7 +9128,7 @@ discard block |
||
9128 | 9128 | && |
9129 | 9129 | self::$SUPPORT['mbstring'] === false |
9130 | 9130 | ) { |
9131 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9131 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9132 | 9132 | } |
9133 | 9133 | |
9134 | 9134 | // |
@@ -9169,7 +9169,7 @@ discard block |
||
9169 | 9169 | // fallback for ascii only |
9170 | 9170 | // |
9171 | 9171 | |
9172 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9172 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9173 | 9173 | return \strpos($haystack, $needle, $offset); |
9174 | 9174 | } |
9175 | 9175 | |
@@ -9181,7 +9181,7 @@ discard block |
||
9181 | 9181 | if ($haystack_tmp === false) { |
9182 | 9182 | $haystack_tmp = ''; |
9183 | 9183 | } |
9184 | - $haystack = (string) $haystack_tmp; |
|
9184 | + $haystack = (string)$haystack_tmp; |
|
9185 | 9185 | |
9186 | 9186 | if ($offset < 0) { |
9187 | 9187 | $offset = 0; |
@@ -9193,7 +9193,7 @@ discard block |
||
9193 | 9193 | } |
9194 | 9194 | |
9195 | 9195 | if ($pos) { |
9196 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9196 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9197 | 9197 | } |
9198 | 9198 | |
9199 | 9199 | return $offset + 0; |
@@ -9304,7 +9304,7 @@ discard block |
||
9304 | 9304 | && |
9305 | 9305 | self::$SUPPORT['mbstring'] === false |
9306 | 9306 | ) { |
9307 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9307 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9308 | 9308 | } |
9309 | 9309 | |
9310 | 9310 | // |
@@ -9316,7 +9316,7 @@ discard block |
||
9316 | 9316 | if ($needle_tmp === false) { |
9317 | 9317 | return false; |
9318 | 9318 | } |
9319 | - $needle = (string) $needle_tmp; |
|
9319 | + $needle = (string)$needle_tmp; |
|
9320 | 9320 | |
9321 | 9321 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
9322 | 9322 | if ($pos === false) { |
@@ -9338,7 +9338,7 @@ discard block |
||
9338 | 9338 | if ($needle_tmp === false) { |
9339 | 9339 | return false; |
9340 | 9340 | } |
9341 | - $needle = (string) $needle_tmp; |
|
9341 | + $needle = (string)$needle_tmp; |
|
9342 | 9342 | |
9343 | 9343 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
9344 | 9344 | if ($pos === false) { |
@@ -9374,7 +9374,7 @@ discard block |
||
9374 | 9374 | if ($encoding === 'UTF-8') { |
9375 | 9375 | if (self::$SUPPORT['intl'] === true) { |
9376 | 9376 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
9377 | - $i = (int) \grapheme_strlen($str); |
|
9377 | + $i = (int)\grapheme_strlen($str); |
|
9378 | 9378 | while ($i--) { |
9379 | 9379 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
9380 | 9380 | if ($reversed_tmp !== false) { |
@@ -9382,7 +9382,7 @@ discard block |
||
9382 | 9382 | } |
9383 | 9383 | } |
9384 | 9384 | } else { |
9385 | - $i = (int) \mb_strlen($str); |
|
9385 | + $i = (int)\mb_strlen($str); |
|
9386 | 9386 | while ($i--) { |
9387 | 9387 | $reversed_tmp = \mb_substr($str, $i, 1); |
9388 | 9388 | if ($reversed_tmp !== false) { |
@@ -9393,7 +9393,7 @@ discard block |
||
9393 | 9393 | } else { |
9394 | 9394 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9395 | 9395 | |
9396 | - $i = (int) self::strlen($str, $encoding); |
|
9396 | + $i = (int)self::strlen($str, $encoding); |
|
9397 | 9397 | while ($i--) { |
9398 | 9398 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
9399 | 9399 | if ($reversed_tmp !== false) { |
@@ -9467,7 +9467,7 @@ discard block |
||
9467 | 9467 | if ($needle_tmp === false) { |
9468 | 9468 | return false; |
9469 | 9469 | } |
9470 | - $needle = (string) $needle_tmp; |
|
9470 | + $needle = (string)$needle_tmp; |
|
9471 | 9471 | |
9472 | 9472 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
9473 | 9473 | if ($pos === false) { |
@@ -9506,10 +9506,10 @@ discard block |
||
9506 | 9506 | } |
9507 | 9507 | |
9508 | 9508 | // iconv and mbstring do not support integer $needle |
9509 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9510 | - $needle = (string) self::chr($needle); |
|
9509 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9510 | + $needle = (string)self::chr($needle); |
|
9511 | 9511 | } |
9512 | - $needle = (string) $needle; |
|
9512 | + $needle = (string)$needle; |
|
9513 | 9513 | |
9514 | 9514 | if ($needle === '') { |
9515 | 9515 | return false; |
@@ -9554,7 +9554,7 @@ discard block |
||
9554 | 9554 | && |
9555 | 9555 | self::$SUPPORT['mbstring'] === false |
9556 | 9556 | ) { |
9557 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9557 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9558 | 9558 | } |
9559 | 9559 | |
9560 | 9560 | // |
@@ -9578,7 +9578,7 @@ discard block |
||
9578 | 9578 | // fallback for ascii only |
9579 | 9579 | // |
9580 | 9580 | |
9581 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9581 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9582 | 9582 | return \strripos($haystack, $needle, $offset); |
9583 | 9583 | } |
9584 | 9584 | |
@@ -9655,10 +9655,10 @@ discard block |
||
9655 | 9655 | } |
9656 | 9656 | |
9657 | 9657 | // iconv and mbstring do not support integer $needle |
9658 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9659 | - $needle = (string) self::chr($needle); |
|
9658 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9659 | + $needle = (string)self::chr($needle); |
|
9660 | 9660 | } |
9661 | - $needle = (string) $needle; |
|
9661 | + $needle = (string)$needle; |
|
9662 | 9662 | |
9663 | 9663 | if ($needle === '') { |
9664 | 9664 | return false; |
@@ -9703,7 +9703,7 @@ discard block |
||
9703 | 9703 | && |
9704 | 9704 | self::$SUPPORT['mbstring'] === false |
9705 | 9705 | ) { |
9706 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9706 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9707 | 9707 | } |
9708 | 9708 | |
9709 | 9709 | // |
@@ -9727,7 +9727,7 @@ discard block |
||
9727 | 9727 | // fallback for ascii only |
9728 | 9728 | // |
9729 | 9729 | |
9730 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9730 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9731 | 9731 | return \strrpos($haystack, $needle, $offset); |
9732 | 9732 | } |
9733 | 9733 | |
@@ -9747,7 +9747,7 @@ discard block |
||
9747 | 9747 | if ($haystack_tmp === false) { |
9748 | 9748 | $haystack_tmp = ''; |
9749 | 9749 | } |
9750 | - $haystack = (string) $haystack_tmp; |
|
9750 | + $haystack = (string)$haystack_tmp; |
|
9751 | 9751 | } |
9752 | 9752 | |
9753 | 9753 | $pos = \strrpos($haystack, $needle); |
@@ -9761,7 +9761,7 @@ discard block |
||
9761 | 9761 | return false; |
9762 | 9762 | } |
9763 | 9763 | |
9764 | - return $offset + (int) self::strlen($str_tmp); |
|
9764 | + return $offset + (int)self::strlen($str_tmp); |
|
9765 | 9765 | } |
9766 | 9766 | |
9767 | 9767 | /** |
@@ -9823,12 +9823,12 @@ discard block |
||
9823 | 9823 | if ($offset || $length !== null) { |
9824 | 9824 | if ($encoding === 'UTF-8') { |
9825 | 9825 | if ($length === null) { |
9826 | - $str = (string) \mb_substr($str, $offset); |
|
9826 | + $str = (string)\mb_substr($str, $offset); |
|
9827 | 9827 | } else { |
9828 | - $str = (string) \mb_substr($str, $offset, $length); |
|
9828 | + $str = (string)\mb_substr($str, $offset, $length); |
|
9829 | 9829 | } |
9830 | 9830 | } else { |
9831 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
9831 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
9832 | 9832 | } |
9833 | 9833 | } |
9834 | 9834 | |
@@ -9838,7 +9838,7 @@ discard block |
||
9838 | 9838 | |
9839 | 9839 | $matches = []; |
9840 | 9840 | |
9841 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
9841 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
9842 | 9842 | } |
9843 | 9843 | |
9844 | 9844 | /** |
@@ -9907,7 +9907,7 @@ discard block |
||
9907 | 9907 | && |
9908 | 9908 | self::$SUPPORT['mbstring'] === false |
9909 | 9909 | ) { |
9910 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9910 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9911 | 9911 | } |
9912 | 9912 | |
9913 | 9913 | // |
@@ -9929,7 +9929,7 @@ discard block |
||
9929 | 9929 | // fallback for ascii only |
9930 | 9930 | // |
9931 | 9931 | |
9932 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9932 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9933 | 9933 | return \strstr($haystack, $needle, $before_needle); |
9934 | 9934 | } |
9935 | 9935 | |
@@ -9937,7 +9937,7 @@ discard block |
||
9937 | 9937 | // fallback via vanilla php |
9938 | 9938 | // |
9939 | 9939 | |
9940 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
9940 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
9941 | 9941 | |
9942 | 9942 | if (!isset($match[1])) { |
9943 | 9943 | return false; |
@@ -9947,7 +9947,7 @@ discard block |
||
9947 | 9947 | return $match[1]; |
9948 | 9948 | } |
9949 | 9949 | |
9950 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
9950 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
9951 | 9951 | } |
9952 | 9952 | |
9953 | 9953 | /** |
@@ -10065,7 +10065,7 @@ discard block |
||
10065 | 10065 | bool $try_to_keep_the_string_length = false |
10066 | 10066 | ): string { |
10067 | 10067 | // init |
10068 | - $str = (string) $str; |
|
10068 | + $str = (string)$str; |
|
10069 | 10069 | |
10070 | 10070 | if ($str === '') { |
10071 | 10071 | return ''; |
@@ -10094,19 +10094,19 @@ discard block |
||
10094 | 10094 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10095 | 10095 | } |
10096 | 10096 | |
10097 | - $language_code = $lang . '-Lower'; |
|
10097 | + $language_code = $lang.'-Lower'; |
|
10098 | 10098 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10099 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
10099 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
10100 | 10100 | |
10101 | 10101 | $language_code = 'Any-Lower'; |
10102 | 10102 | } |
10103 | 10103 | |
10104 | 10104 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10105 | 10105 | /** @noinspection UnnecessaryCastingInspection */ |
10106 | - return (string) \transliterator_transliterate($language_code, $str); |
|
10106 | + return (string)\transliterator_transliterate($language_code, $str); |
|
10107 | 10107 | } |
10108 | 10108 | |
10109 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
10109 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
10110 | 10110 | } |
10111 | 10111 | |
10112 | 10112 | // always fallback via symfony polyfill |
@@ -10135,7 +10135,7 @@ discard block |
||
10135 | 10135 | bool $try_to_keep_the_string_length = false |
10136 | 10136 | ): string { |
10137 | 10137 | // init |
10138 | - $str = (string) $str; |
|
10138 | + $str = (string)$str; |
|
10139 | 10139 | |
10140 | 10140 | if ($str === '') { |
10141 | 10141 | return ''; |
@@ -10164,19 +10164,19 @@ discard block |
||
10164 | 10164 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10165 | 10165 | } |
10166 | 10166 | |
10167 | - $language_code = $lang . '-Upper'; |
|
10167 | + $language_code = $lang.'-Upper'; |
|
10168 | 10168 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10169 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
10169 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
10170 | 10170 | |
10171 | 10171 | $language_code = 'Any-Upper'; |
10172 | 10172 | } |
10173 | 10173 | |
10174 | 10174 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10175 | 10175 | /** @noinspection UnnecessaryCastingInspection */ |
10176 | - return (string) \transliterator_transliterate($language_code, $str); |
|
10176 | + return (string)\transliterator_transliterate($language_code, $str); |
|
10177 | 10177 | } |
10178 | 10178 | |
10179 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
10179 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
10180 | 10180 | } |
10181 | 10181 | |
10182 | 10182 | // always fallback via symfony polyfill |
@@ -10221,7 +10221,7 @@ discard block |
||
10221 | 10221 | $from = \array_combine($from, $to); |
10222 | 10222 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
10223 | 10223 | if ($from === false) { |
10224 | - 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) . ')'); |
|
10224 | + 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).')'); |
|
10225 | 10225 | } |
10226 | 10226 | } |
10227 | 10227 | |
@@ -10281,9 +10281,9 @@ discard block |
||
10281 | 10281 | } |
10282 | 10282 | |
10283 | 10283 | $wide = 0; |
10284 | - $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); |
|
10284 | + $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); |
|
10285 | 10285 | |
10286 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
10286 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
10287 | 10287 | } |
10288 | 10288 | |
10289 | 10289 | /** |
@@ -10383,9 +10383,9 @@ discard block |
||
10383 | 10383 | } |
10384 | 10384 | |
10385 | 10385 | if ($length === null) { |
10386 | - $length = (int) $str_length; |
|
10386 | + $length = (int)$str_length; |
|
10387 | 10387 | } else { |
10388 | - $length = (int) $length; |
|
10388 | + $length = (int)$length; |
|
10389 | 10389 | } |
10390 | 10390 | |
10391 | 10391 | if ( |
@@ -10393,7 +10393,7 @@ discard block |
||
10393 | 10393 | && |
10394 | 10394 | self::$SUPPORT['mbstring'] === false |
10395 | 10395 | ) { |
10396 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10396 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10397 | 10397 | } |
10398 | 10398 | |
10399 | 10399 | // |
@@ -10481,16 +10481,16 @@ discard block |
||
10481 | 10481 | ) { |
10482 | 10482 | if ($encoding === 'UTF-8') { |
10483 | 10483 | if ($length === null) { |
10484 | - $str1 = (string) \mb_substr($str1, $offset); |
|
10484 | + $str1 = (string)\mb_substr($str1, $offset); |
|
10485 | 10485 | } else { |
10486 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
10486 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
10487 | 10487 | } |
10488 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
10488 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
10489 | 10489 | } else { |
10490 | 10490 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10491 | 10491 | |
10492 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
10493 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
10492 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
10493 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
10494 | 10494 | } |
10495 | 10495 | } |
10496 | 10496 | |
@@ -10552,13 +10552,13 @@ discard block |
||
10552 | 10552 | if ($length_tmp === false) { |
10553 | 10553 | return false; |
10554 | 10554 | } |
10555 | - $length = (int) $length_tmp; |
|
10555 | + $length = (int)$length_tmp; |
|
10556 | 10556 | } |
10557 | 10557 | |
10558 | 10558 | if ($encoding === 'UTF-8') { |
10559 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
10559 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
10560 | 10560 | } else { |
10561 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
10561 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
10562 | 10562 | } |
10563 | 10563 | } |
10564 | 10564 | |
@@ -10567,7 +10567,7 @@ discard block |
||
10567 | 10567 | && |
10568 | 10568 | self::$SUPPORT['mbstring'] === false |
10569 | 10569 | ) { |
10570 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10570 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10571 | 10571 | } |
10572 | 10572 | |
10573 | 10573 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10578,7 +10578,7 @@ discard block |
||
10578 | 10578 | return \mb_substr_count($haystack, $needle, $encoding); |
10579 | 10579 | } |
10580 | 10580 | |
10581 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10581 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10582 | 10582 | |
10583 | 10583 | return \count($matches); |
10584 | 10584 | } |
@@ -10625,7 +10625,7 @@ discard block |
||
10625 | 10625 | if ($length_tmp === false) { |
10626 | 10626 | return false; |
10627 | 10627 | } |
10628 | - $length = (int) $length_tmp; |
|
10628 | + $length = (int)$length_tmp; |
|
10629 | 10629 | } |
10630 | 10630 | |
10631 | 10631 | if ( |
@@ -10647,7 +10647,7 @@ discard block |
||
10647 | 10647 | if ($haystack_tmp === false) { |
10648 | 10648 | $haystack_tmp = ''; |
10649 | 10649 | } |
10650 | - $haystack = (string) $haystack_tmp; |
|
10650 | + $haystack = (string)$haystack_tmp; |
|
10651 | 10651 | } |
10652 | 10652 | |
10653 | 10653 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10686,10 +10686,10 @@ discard block |
||
10686 | 10686 | |
10687 | 10687 | if ($encoding === 'UTF-8') { |
10688 | 10688 | if ($case_sensitive) { |
10689 | - return (int) \mb_substr_count($str, $substring); |
|
10689 | + return (int)\mb_substr_count($str, $substring); |
|
10690 | 10690 | } |
10691 | 10691 | |
10692 | - return (int) \mb_substr_count( |
|
10692 | + return (int)\mb_substr_count( |
|
10693 | 10693 | \mb_strtoupper($str), |
10694 | 10694 | \mb_strtoupper($substring) |
10695 | 10695 | ); |
@@ -10698,10 +10698,10 @@ discard block |
||
10698 | 10698 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10699 | 10699 | |
10700 | 10700 | if ($case_sensitive) { |
10701 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
10701 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
10702 | 10702 | } |
10703 | 10703 | |
10704 | - return (int) \mb_substr_count( |
|
10704 | + return (int)\mb_substr_count( |
|
10705 | 10705 | self::strtocasefold($str, true, false, $encoding, null, false), |
10706 | 10706 | self::strtocasefold($substring, true, false, $encoding, null, false), |
10707 | 10707 | $encoding |
@@ -10727,7 +10727,7 @@ discard block |
||
10727 | 10727 | } |
10728 | 10728 | |
10729 | 10729 | if (self::str_istarts_with($haystack, $needle) === true) { |
10730 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10730 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10731 | 10731 | } |
10732 | 10732 | |
10733 | 10733 | return $haystack; |
@@ -10784,7 +10784,7 @@ discard block |
||
10784 | 10784 | } |
10785 | 10785 | |
10786 | 10786 | if (self::str_iends_with($haystack, $needle) === true) { |
10787 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
10787 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
10788 | 10788 | } |
10789 | 10789 | |
10790 | 10790 | return $haystack; |
@@ -10809,7 +10809,7 @@ discard block |
||
10809 | 10809 | } |
10810 | 10810 | |
10811 | 10811 | if (self::str_starts_with($haystack, $needle) === true) { |
10812 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10812 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10813 | 10813 | } |
10814 | 10814 | |
10815 | 10815 | return $haystack; |
@@ -10861,7 +10861,7 @@ discard block |
||
10861 | 10861 | if (\is_array($offset) === true) { |
10862 | 10862 | $offset = \array_slice($offset, 0, $num); |
10863 | 10863 | foreach ($offset as &$value_tmp) { |
10864 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
10864 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
10865 | 10865 | } |
10866 | 10866 | unset($value_tmp); |
10867 | 10867 | } else { |
@@ -10874,7 +10874,7 @@ discard block |
||
10874 | 10874 | } elseif (\is_array($length) === true) { |
10875 | 10875 | $length = \array_slice($length, 0, $num); |
10876 | 10876 | foreach ($length as &$value_tmp_V2) { |
10877 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
10877 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
10878 | 10878 | } |
10879 | 10879 | unset($value_tmp_V2); |
10880 | 10880 | } else { |
@@ -10894,8 +10894,8 @@ discard block |
||
10894 | 10894 | } |
10895 | 10895 | |
10896 | 10896 | // init |
10897 | - $str = (string) $str; |
|
10898 | - $replacement = (string) $replacement; |
|
10897 | + $str = (string)$str; |
|
10898 | + $replacement = (string)$replacement; |
|
10899 | 10899 | |
10900 | 10900 | if (\is_array($length) === true) { |
10901 | 10901 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -10910,16 +10910,16 @@ discard block |
||
10910 | 10910 | } |
10911 | 10911 | |
10912 | 10912 | if (self::$SUPPORT['mbstring'] === true) { |
10913 | - $string_length = (int) self::strlen($str, $encoding); |
|
10913 | + $string_length = (int)self::strlen($str, $encoding); |
|
10914 | 10914 | |
10915 | 10915 | if ($offset < 0) { |
10916 | - $offset = (int) \max(0, $string_length + $offset); |
|
10916 | + $offset = (int)\max(0, $string_length + $offset); |
|
10917 | 10917 | } elseif ($offset > $string_length) { |
10918 | 10918 | $offset = $string_length; |
10919 | 10919 | } |
10920 | 10920 | |
10921 | 10921 | if ($length !== null && $length < 0) { |
10922 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
10922 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
10923 | 10923 | } elseif ($length === null || $length > $string_length) { |
10924 | 10924 | $length = $string_length; |
10925 | 10925 | } |
@@ -10930,9 +10930,9 @@ discard block |
||
10930 | 10930 | } |
10931 | 10931 | |
10932 | 10932 | /** @noinspection AdditionOperationOnArraysInspection */ |
10933 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
10934 | - $replacement . |
|
10935 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10933 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
10934 | + $replacement. |
|
10935 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10936 | 10936 | } |
10937 | 10937 | |
10938 | 10938 | // |
@@ -10941,8 +10941,7 @@ discard block |
||
10941 | 10941 | |
10942 | 10942 | if (ASCII::is_ascii($str)) { |
10943 | 10943 | return ($length === null) ? |
10944 | - \substr_replace($str, $replacement, $offset) : |
|
10945 | - \substr_replace($str, $replacement, $offset, $length); |
|
10944 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
10946 | 10945 | } |
10947 | 10946 | |
10948 | 10947 | // |
@@ -10958,7 +10957,7 @@ discard block |
||
10958 | 10957 | // e.g.: non mbstring support + invalid chars |
10959 | 10958 | return ''; |
10960 | 10959 | } |
10961 | - $length = (int) $length_tmp; |
|
10960 | + $length = (int)$length_tmp; |
|
10962 | 10961 | } |
10963 | 10962 | |
10964 | 10963 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -10993,14 +10992,14 @@ discard block |
||
10993 | 10992 | && |
10994 | 10993 | \substr($haystack, -\strlen($needle)) === $needle |
10995 | 10994 | ) { |
10996 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
10995 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
10997 | 10996 | } |
10998 | 10997 | |
10999 | 10998 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
11000 | - return (string) self::substr( |
|
10999 | + return (string)self::substr( |
|
11001 | 11000 | $haystack, |
11002 | 11001 | 0, |
11003 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
11002 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
11004 | 11003 | $encoding |
11005 | 11004 | ); |
11006 | 11005 | } |
@@ -11030,10 +11029,10 @@ discard block |
||
11030 | 11029 | } |
11031 | 11030 | |
11032 | 11031 | if ($encoding === 'UTF-8') { |
11033 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
11032 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
11034 | 11033 | } |
11035 | 11034 | |
11036 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
11035 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
11037 | 11036 | } |
11038 | 11037 | |
11039 | 11038 | /** |
@@ -11217,7 +11216,7 @@ discard block |
||
11217 | 11216 | public static function to_boolean($str): bool |
11218 | 11217 | { |
11219 | 11218 | // init |
11220 | - $str = (string) $str; |
|
11219 | + $str = (string)$str; |
|
11221 | 11220 | |
11222 | 11221 | if ($str === '') { |
11223 | 11222 | return false; |
@@ -11245,10 +11244,10 @@ discard block |
||
11245 | 11244 | } |
11246 | 11245 | |
11247 | 11246 | if (\is_numeric($str)) { |
11248 | - return ((float) $str + 0) > 0; |
|
11247 | + return ((float)$str + 0) > 0; |
|
11249 | 11248 | } |
11250 | 11249 | |
11251 | - return (bool) \trim($str); |
|
11250 | + return (bool)\trim($str); |
|
11252 | 11251 | } |
11253 | 11252 | |
11254 | 11253 | /** |
@@ -11290,7 +11289,7 @@ discard block |
||
11290 | 11289 | return $str; |
11291 | 11290 | } |
11292 | 11291 | |
11293 | - $str = (string) $str; |
|
11292 | + $str = (string)$str; |
|
11294 | 11293 | if ($str === '') { |
11295 | 11294 | return ''; |
11296 | 11295 | } |
@@ -11338,7 +11337,7 @@ discard block |
||
11338 | 11337 | return $str; |
11339 | 11338 | } |
11340 | 11339 | |
11341 | - $str = (string) $str; |
|
11340 | + $str = (string)$str; |
|
11342 | 11341 | if ($str === '') { |
11343 | 11342 | return $str; |
11344 | 11343 | } |
@@ -11356,7 +11355,7 @@ discard block |
||
11356 | 11355 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
11357 | 11356 | |
11358 | 11357 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11359 | - $buf .= $c1 . $c2; |
|
11358 | + $buf .= $c1.$c2; |
|
11360 | 11359 | ++$i; |
11361 | 11360 | } else { // not valid UTF8 - convert it |
11362 | 11361 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11367,7 +11366,7 @@ discard block |
||
11367 | 11366 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
11368 | 11367 | |
11369 | 11368 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11370 | - $buf .= $c1 . $c2 . $c3; |
|
11369 | + $buf .= $c1.$c2.$c3; |
|
11371 | 11370 | $i += 2; |
11372 | 11371 | } else { // not valid UTF8 - convert it |
11373 | 11372 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11379,7 +11378,7 @@ discard block |
||
11379 | 11378 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
11380 | 11379 | |
11381 | 11380 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11382 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
11381 | + $buf .= $c1.$c2.$c3.$c4; |
|
11383 | 11382 | $i += 3; |
11384 | 11383 | } else { // not valid UTF8 - convert it |
11385 | 11384 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11405,13 +11404,13 @@ discard block |
||
11405 | 11404 | * |
11406 | 11405 | * @return string |
11407 | 11406 | */ |
11408 | - static function (array $matches): string { |
|
11407 | + static function(array $matches): string { |
|
11409 | 11408 | if (isset($matches[3])) { |
11410 | - $cp = (int) \hexdec($matches[3]); |
|
11409 | + $cp = (int)\hexdec($matches[3]); |
|
11411 | 11410 | } else { |
11412 | 11411 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
11413 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
11414 | - + (int) \hexdec($matches[2]) |
|
11412 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
11413 | + + (int)\hexdec($matches[2]) |
|
11415 | 11414 | + 0x10000 |
11416 | 11415 | - (0xD800 << 10) |
11417 | 11416 | - 0xDC00; |
@@ -11422,12 +11421,12 @@ discard block |
||
11422 | 11421 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
11423 | 11422 | |
11424 | 11423 | if ($cp < 0x80) { |
11425 | - return (string) self::chr($cp); |
|
11424 | + return (string)self::chr($cp); |
|
11426 | 11425 | } |
11427 | 11426 | |
11428 | 11427 | if ($cp < 0xA0) { |
11429 | 11428 | /** @noinspection UnnecessaryCastingInspection */ |
11430 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
11429 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
11431 | 11430 | } |
11432 | 11431 | |
11433 | 11432 | return self::decimal_to_chr($cp); |
@@ -11477,7 +11476,7 @@ discard block |
||
11477 | 11476 | } |
11478 | 11477 | |
11479 | 11478 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11480 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
11479 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
11481 | 11480 | } |
11482 | 11481 | |
11483 | 11482 | if ($chars) { |
@@ -11521,15 +11520,15 @@ discard block |
||
11521 | 11520 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
11522 | 11521 | |
11523 | 11522 | if ($encoding === 'UTF-8') { |
11524 | - $str_part_two = (string) \mb_substr($str, 1); |
|
11523 | + $str_part_two = (string)\mb_substr($str, 1); |
|
11525 | 11524 | |
11526 | 11525 | if ($use_mb_functions === true) { |
11527 | 11526 | $str_part_one = \mb_strtoupper( |
11528 | - (string) \mb_substr($str, 0, 1) |
|
11527 | + (string)\mb_substr($str, 0, 1) |
|
11529 | 11528 | ); |
11530 | 11529 | } else { |
11531 | 11530 | $str_part_one = self::strtoupper( |
11532 | - (string) \mb_substr($str, 0, 1), |
|
11531 | + (string)\mb_substr($str, 0, 1), |
|
11533 | 11532 | $encoding, |
11534 | 11533 | false, |
11535 | 11534 | $lang, |
@@ -11539,16 +11538,16 @@ discard block |
||
11539 | 11538 | } else { |
11540 | 11539 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11541 | 11540 | |
11542 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
11541 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
11543 | 11542 | |
11544 | 11543 | if ($use_mb_functions === true) { |
11545 | 11544 | $str_part_one = \mb_strtoupper( |
11546 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
11545 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
11547 | 11546 | $encoding |
11548 | 11547 | ); |
11549 | 11548 | } else { |
11550 | 11549 | $str_part_one = self::strtoupper( |
11551 | - (string) self::substr($str, 0, 1, $encoding), |
|
11550 | + (string)self::substr($str, 0, 1, $encoding), |
|
11552 | 11551 | $encoding, |
11553 | 11552 | false, |
11554 | 11553 | $lang, |
@@ -11557,7 +11556,7 @@ discard block |
||
11557 | 11556 | } |
11558 | 11557 | } |
11559 | 11558 | |
11560 | - return $str_part_one . $str_part_two; |
|
11559 | + return $str_part_one.$str_part_two; |
|
11561 | 11560 | } |
11562 | 11561 | |
11563 | 11562 | /** |
@@ -11612,7 +11611,7 @@ discard block |
||
11612 | 11611 | $str = self::clean($str); |
11613 | 11612 | } |
11614 | 11613 | |
11615 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
11614 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
11616 | 11615 | |
11617 | 11616 | if ( |
11618 | 11617 | $use_php_default_functions === true |
@@ -12000,7 +11999,7 @@ discard block |
||
12000 | 11999 | if ( |
12001 | 12000 | $keep_utf8_chars === true |
12002 | 12001 | && |
12003 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
12002 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
12004 | 12003 | ) { |
12005 | 12004 | return $str_backup; |
12006 | 12005 | } |
@@ -12079,17 +12078,17 @@ discard block |
||
12079 | 12078 | return ''; |
12080 | 12079 | } |
12081 | 12080 | |
12082 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
12081 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
12083 | 12082 | |
12084 | 12083 | if ( |
12085 | 12084 | !isset($matches[0]) |
12086 | 12085 | || |
12087 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
12086 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
12088 | 12087 | ) { |
12089 | 12088 | return $str; |
12090 | 12089 | } |
12091 | 12090 | |
12092 | - return \rtrim($matches[0]) . $str_add_on; |
|
12091 | + return \rtrim($matches[0]).$str_add_on; |
|
12093 | 12092 | } |
12094 | 12093 | |
12095 | 12094 | /** |
@@ -12176,7 +12175,7 @@ discard block |
||
12176 | 12175 | } |
12177 | 12176 | } |
12178 | 12177 | |
12179 | - return $str_return . \implode('', $chars); |
|
12178 | + return $str_return.\implode('', $chars); |
|
12180 | 12179 | } |
12181 | 12180 | |
12182 | 12181 | /** |
@@ -12228,7 +12227,7 @@ discard block |
||
12228 | 12227 | $final_break = ''; |
12229 | 12228 | } |
12230 | 12229 | |
12231 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
12230 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
12232 | 12231 | } |
12233 | 12232 | |
12234 | 12233 | /** |
@@ -12249,14 +12248,14 @@ discard block |
||
12249 | 12248 | */ |
12250 | 12249 | private static function html_entity_decode_helper(string $str, string $encoding): string |
12251 | 12250 | { |
12252 | - return (string) \preg_replace_callback( |
|
12251 | + return (string)\preg_replace_callback( |
|
12253 | 12252 | "/&#\d{2,6};/", |
12254 | 12253 | /** |
12255 | 12254 | * @param string[] $matches |
12256 | 12255 | * |
12257 | 12256 | * @return string |
12258 | 12257 | */ |
12259 | - static function (array $matches) use ($encoding): string { |
|
12258 | + static function(array $matches) use ($encoding): string { |
|
12260 | 12259 | $return_tmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
12261 | 12260 | if ($return_tmp !== '"' && $return_tmp !== "'") { |
12262 | 12261 | return $return_tmp; |
@@ -12471,7 +12470,7 @@ discard block |
||
12471 | 12470 | /** @noinspection PhpIncludeInspection */ |
12472 | 12471 | /** @noinspection UsingInclusionReturnValueInspection */ |
12473 | 12472 | /** @psalm-suppress UnresolvableInclude */ |
12474 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
12473 | + return include __DIR__.'/data/'.$file.'.php'; |
|
12475 | 12474 | } |
12476 | 12475 | |
12477 | 12476 | /** |
@@ -12486,7 +12485,7 @@ discard block |
||
12486 | 12485 | |
12487 | 12486 | \uksort( |
12488 | 12487 | self::$EMOJI, |
12489 | - static function (string $a, string $b): int { |
|
12488 | + static function(string $a, string $b): int { |
|
12490 | 12489 | return \strlen($b) <=> \strlen($a); |
12491 | 12490 | } |
12492 | 12491 | ); |
@@ -12496,7 +12495,7 @@ discard block |
||
12496 | 12495 | |
12497 | 12496 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
12498 | 12497 | $tmp_key = \crc32($key); |
12499 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
12498 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
12500 | 12499 | } |
12501 | 12500 | |
12502 | 12501 | return true; |
@@ -12520,7 +12519,7 @@ discard block |
||
12520 | 12519 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
12521 | 12520 | return \defined('MB_OVERLOAD_STRING') |
12522 | 12521 | && |
12523 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12522 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12524 | 12523 | } |
12525 | 12524 | |
12526 | 12525 | /** |
@@ -12573,7 +12572,7 @@ discard block |
||
12573 | 12572 | { |
12574 | 12573 | static $RX_CLASS_CACHE = []; |
12575 | 12574 | |
12576 | - $cache_key = $s . $class; |
|
12575 | + $cache_key = $s.$class; |
|
12577 | 12576 | |
12578 | 12577 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
12579 | 12578 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -12585,7 +12584,7 @@ discard block |
||
12585 | 12584 | /** @noinspection AlterInForeachInspection */ |
12586 | 12585 | foreach (self::str_split($s) as &$s) { |
12587 | 12586 | if ($s === '-') { |
12588 | - $class_array[0] = '-' . $class_array[0]; |
|
12587 | + $class_array[0] = '-'.$class_array[0]; |
|
12589 | 12588 | } elseif (!isset($s[2])) { |
12590 | 12589 | $class_array[0] .= \preg_quote($s, '/'); |
12591 | 12590 | } elseif (self::strlen($s) === 1) { |
@@ -12596,13 +12595,13 @@ discard block |
||
12596 | 12595 | } |
12597 | 12596 | |
12598 | 12597 | if ($class_array[0]) { |
12599 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
12598 | + $class_array[0] = '['.$class_array[0].']'; |
|
12600 | 12599 | } |
12601 | 12600 | |
12602 | 12601 | if (\count($class_array) === 1) { |
12603 | 12602 | $return = $class_array[0]; |
12604 | 12603 | } else { |
12605 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
12604 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
12606 | 12605 | } |
12607 | 12606 | |
12608 | 12607 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -12676,7 +12675,7 @@ discard block |
||
12676 | 12675 | |
12677 | 12676 | if ($delimiter === '-') { |
12678 | 12677 | /** @noinspection AlterInForeachInspection */ |
12679 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
12678 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
12680 | 12679 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12681 | 12680 | $continue = true; |
12682 | 12681 | } |
@@ -12684,7 +12683,7 @@ discard block |
||
12684 | 12683 | } |
12685 | 12684 | |
12686 | 12685 | /** @noinspection AlterInForeachInspection */ |
12687 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
12686 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
12688 | 12687 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12689 | 12688 | $continue = true; |
12690 | 12689 | } |
@@ -12745,8 +12744,8 @@ discard block |
||
12745 | 12744 | } else { |
12746 | 12745 | /** @noinspection OffsetOperationsInspection */ |
12747 | 12746 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
12748 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
12749 | - $buf .= $cc1 . $cc2; |
|
12747 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
12748 | + $buf .= $cc1.$cc2; |
|
12750 | 12749 | } |
12751 | 12750 | |
12752 | 12751 | return $buf; |
@@ -12761,7 +12760,7 @@ discard block |
||
12761 | 12760 | { |
12762 | 12761 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
12763 | 12762 | if (\preg_match($pattern, $str)) { |
12764 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
12763 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
12765 | 12764 | } |
12766 | 12765 | |
12767 | 12766 | return $str; |