@@ -237,10 +237,10 @@ discard block |
||
237 | 237 | } |
238 | 238 | |
239 | 239 | if ($encoding === 'UTF-8') { |
240 | - return (string) \mb_substr($str, $pos, 1); |
|
240 | + return (string)\mb_substr($str, $pos, 1); |
|
241 | 241 | } |
242 | 242 | |
243 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
243 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | public static function add_bom_to_string(string $str): string |
256 | 256 | { |
257 | 257 | if (self::string_has_bom($str) === false) { |
258 | - $str = self::bom() . $str; |
|
258 | + $str = self::bom().$str; |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | return $str; |
@@ -288,8 +288,8 @@ discard block |
||
288 | 288 | $return = []; |
289 | 289 | foreach ($array as $key => &$value) { |
290 | 290 | $key = $case === \CASE_LOWER |
291 | - ? self::strtolower((string) $key, $encoding) |
|
292 | - : self::strtoupper((string) $key, $encoding); |
|
291 | + ? self::strtolower((string)$key, $encoding) |
|
292 | + : self::strtoupper((string)$key, $encoding); |
|
293 | 293 | |
294 | 294 | $return[$key] = $value; |
295 | 295 | } |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | return ''; |
324 | 324 | } |
325 | 325 | |
326 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
326 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
327 | 327 | $end_position = \mb_strpos($str, $end, $substr_index); |
328 | 328 | if ( |
329 | 329 | $end_position === false |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | return ''; |
334 | 334 | } |
335 | 335 | |
336 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
336 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | return ''; |
344 | 344 | } |
345 | 345 | |
346 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
346 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
347 | 347 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
348 | 348 | if ( |
349 | 349 | $end_position === false |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | return ''; |
354 | 354 | } |
355 | 355 | |
356 | - return (string) self::substr( |
|
356 | + return (string)self::substr( |
|
357 | 357 | $str, |
358 | 358 | $substr_index, |
359 | 359 | $end_position - $substr_index, |
@@ -421,10 +421,10 @@ discard block |
||
421 | 421 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
422 | 422 | { |
423 | 423 | if ($encoding === 'UTF-8') { |
424 | - return (string) \mb_substr($str, $index, 1); |
|
424 | + return (string)\mb_substr($str, $index, 1); |
|
425 | 425 | } |
426 | 426 | |
427 | - return (string) self::substr($str, $index, 1, $encoding); |
|
427 | + return (string)self::substr($str, $index, 1, $encoding); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | /** |
@@ -523,10 +523,10 @@ discard block |
||
523 | 523 | && |
524 | 524 | self::$SUPPORT['mbstring'] === false |
525 | 525 | ) { |
526 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
526 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
527 | 527 | } |
528 | 528 | |
529 | - $cache_key = $code_point . $encoding; |
|
529 | + $cache_key = $code_point.$encoding; |
|
530 | 530 | if (isset($CHAR_CACHE[$cache_key]) === true) { |
531 | 531 | return $CHAR_CACHE[$cache_key]; |
532 | 532 | } |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | self::$CHR = self::getData('chr'); |
573 | 573 | } |
574 | 574 | |
575 | - $code_point = (int) $code_point; |
|
575 | + $code_point = (int)$code_point; |
|
576 | 576 | if ($code_point <= 0x7F) { |
577 | 577 | /** |
578 | 578 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -582,22 +582,22 @@ discard block |
||
582 | 582 | /** |
583 | 583 | * @psalm-suppress PossiblyNullArrayAccess |
584 | 584 | */ |
585 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
585 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
586 | 586 | self::$CHR[($code_point & 0x3F) + 0x80]; |
587 | 587 | } elseif ($code_point <= 0xFFFF) { |
588 | 588 | /** |
589 | 589 | * @psalm-suppress PossiblyNullArrayAccess |
590 | 590 | */ |
591 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
592 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
591 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
592 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
593 | 593 | self::$CHR[($code_point & 0x3F) + 0x80]; |
594 | 594 | } else { |
595 | 595 | /** |
596 | 596 | * @psalm-suppress PossiblyNullArrayAccess |
597 | 597 | */ |
598 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
599 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
600 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
598 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
599 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
600 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
601 | 601 | self::$CHR[($code_point & 0x3F) + 0x80]; |
602 | 602 | } |
603 | 603 | |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | |
646 | 646 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
647 | 647 | return \array_map( |
648 | - static function (string $data): int { |
|
648 | + static function(string $data): int { |
|
649 | 649 | // "mb_" is available if overload is used, so use it ... |
650 | 650 | return \mb_strlen($data, 'CP850'); // 8-BIT |
651 | 651 | }, |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | $char = ''; |
722 | 722 | } |
723 | 723 | |
724 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
724 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | /** |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
798 | 798 | /x'; |
799 | 799 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
800 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
800 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
801 | 801 | |
802 | 802 | if ($replace_diamond_question_mark === true) { |
803 | 803 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | public static function cleanup($str): string |
833 | 833 | { |
834 | 834 | // init |
835 | - $str = (string) $str; |
|
835 | + $str = (string)$str; |
|
836 | 836 | |
837 | 837 | if ($str === '') { |
838 | 838 | return ''; |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | { |
920 | 920 | if (self::$SUPPORT['mbstring'] === true) { |
921 | 921 | /** @noinspection PhpComposerExtensionStubsInspection */ |
922 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
922 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
923 | 923 | } |
924 | 924 | |
925 | 925 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | */ |
960 | 960 | public static function css_stripe_media_queries(string $str): string |
961 | 961 | { |
962 | - return (string) \preg_replace( |
|
962 | + return (string)\preg_replace( |
|
963 | 963 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
964 | 964 | '', |
965 | 965 | $str |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | */ |
987 | 987 | public static function decimal_to_chr($int): string |
988 | 988 | { |
989 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
989 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
990 | 990 | } |
991 | 991 | |
992 | 992 | /** |
@@ -1033,16 +1033,16 @@ discard block |
||
1033 | 1033 | self::initEmojiData(); |
1034 | 1034 | |
1035 | 1035 | if ($use_reversible_string_mappings === true) { |
1036 | - return (string) \str_replace( |
|
1037 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1038 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1036 | + return (string)\str_replace( |
|
1037 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1038 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1039 | 1039 | $str |
1040 | 1040 | ); |
1041 | 1041 | } |
1042 | 1042 | |
1043 | - return (string) \str_replace( |
|
1044 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1045 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1043 | + return (string)\str_replace( |
|
1044 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1045 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1046 | 1046 | $str |
1047 | 1047 | ); |
1048 | 1048 | } |
@@ -1064,16 +1064,16 @@ discard block |
||
1064 | 1064 | self::initEmojiData(); |
1065 | 1065 | |
1066 | 1066 | if ($use_reversible_string_mappings === true) { |
1067 | - return (string) \str_replace( |
|
1068 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1069 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1067 | + return (string)\str_replace( |
|
1068 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1069 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1070 | 1070 | $str |
1071 | 1071 | ); |
1072 | 1072 | } |
1073 | 1073 | |
1074 | - return (string) \str_replace( |
|
1075 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1076 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1074 | + return (string)\str_replace( |
|
1075 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1076 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1077 | 1077 | $str |
1078 | 1078 | ); |
1079 | 1079 | } |
@@ -1127,7 +1127,7 @@ discard block |
||
1127 | 1127 | if ($to_encoding === 'JSON') { |
1128 | 1128 | $return = self::json_encode($str); |
1129 | 1129 | if ($return === false) { |
1130 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1130 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1131 | 1131 | } |
1132 | 1132 | |
1133 | 1133 | return $return; |
@@ -1214,7 +1214,7 @@ discard block |
||
1214 | 1214 | && |
1215 | 1215 | self::$SUPPORT['mbstring'] === false |
1216 | 1216 | ) { |
1217 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
1217 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
1218 | 1218 | } |
1219 | 1219 | |
1220 | 1220 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1308,31 +1308,31 @@ discard block |
||
1308 | 1308 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1309 | 1309 | |
1310 | 1310 | if ($length === null) { |
1311 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
1311 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
1312 | 1312 | } |
1313 | 1313 | |
1314 | 1314 | if ($search === '') { |
1315 | 1315 | if ($encoding === 'UTF-8') { |
1316 | 1316 | if ($length > 0) { |
1317 | - $string_length = (int) \mb_strlen($str); |
|
1317 | + $string_length = (int)\mb_strlen($str); |
|
1318 | 1318 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1319 | 1319 | } else { |
1320 | 1320 | $end = 0; |
1321 | 1321 | } |
1322 | 1322 | |
1323 | - $pos = (int) \min( |
|
1323 | + $pos = (int)\min( |
|
1324 | 1324 | \mb_strpos($str, ' ', $end), |
1325 | 1325 | \mb_strpos($str, '.', $end) |
1326 | 1326 | ); |
1327 | 1327 | } else { |
1328 | 1328 | if ($length > 0) { |
1329 | - $string_length = (int) self::strlen($str, $encoding); |
|
1329 | + $string_length = (int)self::strlen($str, $encoding); |
|
1330 | 1330 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1331 | 1331 | } else { |
1332 | 1332 | $end = 0; |
1333 | 1333 | } |
1334 | 1334 | |
1335 | - $pos = (int) \min( |
|
1335 | + $pos = (int)\min( |
|
1336 | 1336 | self::strpos($str, ' ', $end, $encoding), |
1337 | 1337 | self::strpos($str, '.', $end, $encoding) |
1338 | 1338 | ); |
@@ -1349,18 +1349,18 @@ discard block |
||
1349 | 1349 | return ''; |
1350 | 1350 | } |
1351 | 1351 | |
1352 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1352 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1353 | 1353 | } |
1354 | 1354 | |
1355 | 1355 | return $str; |
1356 | 1356 | } |
1357 | 1357 | |
1358 | 1358 | if ($encoding === 'UTF-8') { |
1359 | - $word_position = (int) \mb_stripos($str, $search); |
|
1360 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1359 | + $word_position = (int)\mb_stripos($str, $search); |
|
1360 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1361 | 1361 | } else { |
1362 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
1363 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1362 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
1363 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1364 | 1364 | } |
1365 | 1365 | |
1366 | 1366 | $pos_start = 0; |
@@ -1372,12 +1372,12 @@ discard block |
||
1372 | 1372 | } |
1373 | 1373 | if ($half_text !== false) { |
1374 | 1374 | if ($encoding === 'UTF-8') { |
1375 | - $pos_start = (int) \max( |
|
1375 | + $pos_start = (int)\max( |
|
1376 | 1376 | \mb_strrpos($half_text, ' '), |
1377 | 1377 | \mb_strrpos($half_text, '.') |
1378 | 1378 | ); |
1379 | 1379 | } else { |
1380 | - $pos_start = (int) \max( |
|
1380 | + $pos_start = (int)\max( |
|
1381 | 1381 | self::strrpos($half_text, ' ', 0, $encoding), |
1382 | 1382 | self::strrpos($half_text, '.', 0, $encoding) |
1383 | 1383 | ); |
@@ -1387,19 +1387,19 @@ discard block |
||
1387 | 1387 | |
1388 | 1388 | if ($word_position && $half_side > 0) { |
1389 | 1389 | $offset = $pos_start + $length - 1; |
1390 | - $real_length = (int) self::strlen($str, $encoding); |
|
1390 | + $real_length = (int)self::strlen($str, $encoding); |
|
1391 | 1391 | |
1392 | 1392 | if ($offset > $real_length) { |
1393 | 1393 | $offset = $real_length; |
1394 | 1394 | } |
1395 | 1395 | |
1396 | 1396 | if ($encoding === 'UTF-8') { |
1397 | - $pos_end = (int) \min( |
|
1397 | + $pos_end = (int)\min( |
|
1398 | 1398 | \mb_strpos($str, ' ', $offset), |
1399 | 1399 | \mb_strpos($str, '.', $offset) |
1400 | 1400 | ) - $pos_start; |
1401 | 1401 | } else { |
1402 | - $pos_end = (int) \min( |
|
1402 | + $pos_end = (int)\min( |
|
1403 | 1403 | self::strpos($str, ' ', $offset, $encoding), |
1404 | 1404 | self::strpos($str, '.', $offset, $encoding) |
1405 | 1405 | ) - $pos_start; |
@@ -1407,12 +1407,12 @@ discard block |
||
1407 | 1407 | |
1408 | 1408 | if (!$pos_end || $pos_end <= 0) { |
1409 | 1409 | if ($encoding === 'UTF-8') { |
1410 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1410 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1411 | 1411 | } else { |
1412 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1412 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1413 | 1413 | } |
1414 | 1414 | if ($str_sub !== false) { |
1415 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
1415 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
1416 | 1416 | } else { |
1417 | 1417 | $extract = ''; |
1418 | 1418 | } |
@@ -1423,26 +1423,26 @@ discard block |
||
1423 | 1423 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
1424 | 1424 | } |
1425 | 1425 | if ($str_sub !== false) { |
1426 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1426 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1427 | 1427 | } else { |
1428 | 1428 | $extract = ''; |
1429 | 1429 | } |
1430 | 1430 | } |
1431 | 1431 | } else { |
1432 | 1432 | $offset = $length - 1; |
1433 | - $true_length = (int) self::strlen($str, $encoding); |
|
1433 | + $true_length = (int)self::strlen($str, $encoding); |
|
1434 | 1434 | |
1435 | 1435 | if ($offset > $true_length) { |
1436 | 1436 | $offset = $true_length; |
1437 | 1437 | } |
1438 | 1438 | |
1439 | 1439 | if ($encoding === 'UTF-8') { |
1440 | - $pos_end = (int) \min( |
|
1440 | + $pos_end = (int)\min( |
|
1441 | 1441 | \mb_strpos($str, ' ', $offset), |
1442 | 1442 | \mb_strpos($str, '.', $offset) |
1443 | 1443 | ); |
1444 | 1444 | } else { |
1445 | - $pos_end = (int) \min( |
|
1445 | + $pos_end = (int)\min( |
|
1446 | 1446 | self::strpos($str, ' ', $offset, $encoding), |
1447 | 1447 | self::strpos($str, '.', $offset, $encoding) |
1448 | 1448 | ); |
@@ -1455,7 +1455,7 @@ discard block |
||
1455 | 1455 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
1456 | 1456 | } |
1457 | 1457 | if ($str_sub !== false) { |
1458 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1458 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1459 | 1459 | } else { |
1460 | 1460 | $extract = ''; |
1461 | 1461 | } |
@@ -1578,7 +1578,7 @@ discard block |
||
1578 | 1578 | { |
1579 | 1579 | $file_content = \file_get_contents($file_path); |
1580 | 1580 | if ($file_content === false) { |
1581 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1581 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1582 | 1582 | } |
1583 | 1583 | |
1584 | 1584 | return self::string_has_bom($file_content); |
@@ -1644,7 +1644,7 @@ discard block |
||
1644 | 1644 | ) { |
1645 | 1645 | // Prevent leading combining chars |
1646 | 1646 | // for NFC-safe concatenations. |
1647 | - $var = $leading_combining . $var; |
|
1647 | + $var = $leading_combining.$var; |
|
1648 | 1648 | } |
1649 | 1649 | } |
1650 | 1650 | |
@@ -1895,10 +1895,10 @@ discard block |
||
1895 | 1895 | } |
1896 | 1896 | |
1897 | 1897 | if ($encoding === 'UTF-8') { |
1898 | - return (string) \mb_substr($str, 0, $n); |
|
1898 | + return (string)\mb_substr($str, 0, $n); |
|
1899 | 1899 | } |
1900 | 1900 | |
1901 | - return (string) self::substr($str, 0, $n, $encoding); |
|
1901 | + return (string)self::substr($str, 0, $n, $encoding); |
|
1902 | 1902 | } |
1903 | 1903 | |
1904 | 1904 | /** |
@@ -1911,7 +1911,7 @@ discard block |
||
1911 | 1911 | */ |
1912 | 1912 | public static function fits_inside(string $str, int $box_size): bool |
1913 | 1913 | { |
1914 | - return (int) self::strlen($str) <= $box_size; |
|
1914 | + return (int)self::strlen($str) <= $box_size; |
|
1915 | 1915 | } |
1916 | 1916 | |
1917 | 1917 | /** |
@@ -1973,7 +1973,7 @@ discard block |
||
1973 | 1973 | return $str; |
1974 | 1974 | } |
1975 | 1975 | |
1976 | - $str = (string) $str; |
|
1976 | + $str = (string)$str; |
|
1977 | 1977 | $last = ''; |
1978 | 1978 | while ($last !== $str) { |
1979 | 1979 | $last = $str; |
@@ -2167,7 +2167,7 @@ discard block |
||
2167 | 2167 | return $fallback; |
2168 | 2168 | } |
2169 | 2169 | /** @noinspection OffsetOperationsInspection */ |
2170 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2170 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2171 | 2171 | |
2172 | 2172 | // DEBUG |
2173 | 2173 | //var_dump($type_code); |
@@ -2225,7 +2225,7 @@ discard block |
||
2225 | 2225 | // |
2226 | 2226 | |
2227 | 2227 | if ($encoding === 'UTF-8') { |
2228 | - $max_length = (int) \mb_strlen($possible_chars); |
|
2228 | + $max_length = (int)\mb_strlen($possible_chars); |
|
2229 | 2229 | if ($max_length === 0) { |
2230 | 2230 | return ''; |
2231 | 2231 | } |
@@ -2246,7 +2246,7 @@ discard block |
||
2246 | 2246 | } else { |
2247 | 2247 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2248 | 2248 | |
2249 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
2249 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
2250 | 2250 | if ($max_length === 0) { |
2251 | 2251 | return ''; |
2252 | 2252 | } |
@@ -2277,16 +2277,16 @@ discard block |
||
2277 | 2277 | */ |
2278 | 2278 | public static function get_unique_string($entropy_extra = '', bool $use_md5 = true): string |
2279 | 2279 | { |
2280 | - $unique_helper = \random_int(0, \mt_getrandmax()) . |
|
2281 | - \session_id() . |
|
2282 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2283 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2280 | + $unique_helper = \random_int(0, \mt_getrandmax()). |
|
2281 | + \session_id(). |
|
2282 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2283 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2284 | 2284 | $entropy_extra; |
2285 | 2285 | |
2286 | 2286 | $unique_string = \uniqid($unique_helper, true); |
2287 | 2287 | |
2288 | 2288 | if ($use_md5) { |
2289 | - $unique_string = \md5($unique_string . $unique_helper); |
|
2289 | + $unique_string = \md5($unique_string.$unique_helper); |
|
2290 | 2290 | } |
2291 | 2291 | |
2292 | 2292 | return $unique_string; |
@@ -2365,7 +2365,7 @@ discard block |
||
2365 | 2365 | public static function hex_to_int($hexdec) |
2366 | 2366 | { |
2367 | 2367 | // init |
2368 | - $hexdec = (string) $hexdec; |
|
2368 | + $hexdec = (string)$hexdec; |
|
2369 | 2369 | |
2370 | 2370 | if ($hexdec === '') { |
2371 | 2371 | return false; |
@@ -2458,7 +2458,7 @@ discard block |
||
2458 | 2458 | return \implode( |
2459 | 2459 | '', |
2460 | 2460 | \array_map( |
2461 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2461 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2462 | 2462 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
2463 | 2463 | }, |
2464 | 2464 | self::str_split($str) |
@@ -2565,7 +2565,7 @@ discard block |
||
2565 | 2565 | && |
2566 | 2566 | self::$SUPPORT['mbstring'] === false |
2567 | 2567 | ) { |
2568 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2568 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2569 | 2569 | } |
2570 | 2570 | |
2571 | 2571 | do { |
@@ -2575,7 +2575,7 @@ discard block |
||
2575 | 2575 | |
2576 | 2576 | if (\strpos($str, '&#') !== false) { |
2577 | 2577 | // decode also numeric & UTF16 two byte entities |
2578 | - $str = (string) \preg_replace( |
|
2578 | + $str = (string)\preg_replace( |
|
2579 | 2579 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
2580 | 2580 | '$1;', |
2581 | 2581 | $str |
@@ -2622,7 +2622,7 @@ discard block |
||
2622 | 2622 | */ |
2623 | 2623 | public static function html_stripe_empty_tags(string $str): string |
2624 | 2624 | { |
2625 | - return (string) \preg_replace( |
|
2625 | + return (string)\preg_replace( |
|
2626 | 2626 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
2627 | 2627 | '', |
2628 | 2628 | $str |
@@ -2932,9 +2932,9 @@ discard block |
||
2932 | 2932 | { |
2933 | 2933 | $hex = \dechex($int); |
2934 | 2934 | |
2935 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
2935 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
2936 | 2936 | |
2937 | - return $prefix . $hex . ''; |
|
2937 | + return $prefix.$hex.''; |
|
2938 | 2938 | } |
2939 | 2939 | |
2940 | 2940 | /** |
@@ -3192,7 +3192,7 @@ discard block |
||
3192 | 3192 | */ |
3193 | 3193 | public static function is_binary($input, bool $strict = false): bool |
3194 | 3194 | { |
3195 | - $input = (string) $input; |
|
3195 | + $input = (string)$input; |
|
3196 | 3196 | if ($input === '') { |
3197 | 3197 | return false; |
3198 | 3198 | } |
@@ -3455,7 +3455,7 @@ discard block |
||
3455 | 3455 | public static function is_utf16($str, $check_if_string_is_binary = true) |
3456 | 3456 | { |
3457 | 3457 | // init |
3458 | - $str = (string) $str; |
|
3458 | + $str = (string)$str; |
|
3459 | 3459 | $str_chars = []; |
3460 | 3460 | |
3461 | 3461 | if ( |
@@ -3533,7 +3533,7 @@ discard block |
||
3533 | 3533 | public static function is_utf32($str, $check_if_string_is_binary = true) |
3534 | 3534 | { |
3535 | 3535 | // init |
3536 | - $str = (string) $str; |
|
3536 | + $str = (string)$str; |
|
3537 | 3537 | $str_chars = []; |
3538 | 3538 | |
3539 | 3539 | if ( |
@@ -3617,7 +3617,7 @@ discard block |
||
3617 | 3617 | return true; |
3618 | 3618 | } |
3619 | 3619 | |
3620 | - return self::is_utf8_string((string) $str, $strict); |
|
3620 | + return self::is_utf8_string((string)$str, $strict); |
|
3621 | 3621 | } |
3622 | 3622 | |
3623 | 3623 | /** |
@@ -3757,15 +3757,15 @@ discard block |
||
3757 | 3757 | $use_mb_functions = ($lang === null && $try_to_keep_the_string_length === false); |
3758 | 3758 | |
3759 | 3759 | if ($encoding === 'UTF-8') { |
3760 | - $str_part_two = (string) \mb_substr($str, 1); |
|
3760 | + $str_part_two = (string)\mb_substr($str, 1); |
|
3761 | 3761 | |
3762 | 3762 | if ($use_mb_functions === true) { |
3763 | 3763 | $str_part_one = \mb_strtolower( |
3764 | - (string) \mb_substr($str, 0, 1) |
|
3764 | + (string)\mb_substr($str, 0, 1) |
|
3765 | 3765 | ); |
3766 | 3766 | } else { |
3767 | 3767 | $str_part_one = self::strtolower( |
3768 | - (string) \mb_substr($str, 0, 1), |
|
3768 | + (string)\mb_substr($str, 0, 1), |
|
3769 | 3769 | $encoding, |
3770 | 3770 | false, |
3771 | 3771 | $lang, |
@@ -3775,10 +3775,10 @@ discard block |
||
3775 | 3775 | } else { |
3776 | 3776 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
3777 | 3777 | |
3778 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
3778 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
3779 | 3779 | |
3780 | 3780 | $str_part_one = self::strtolower( |
3781 | - (string) self::substr($str, 0, 1, $encoding), |
|
3781 | + (string)self::substr($str, 0, 1, $encoding), |
|
3782 | 3782 | $encoding, |
3783 | 3783 | false, |
3784 | 3784 | $lang, |
@@ -3786,7 +3786,7 @@ discard block |
||
3786 | 3786 | ); |
3787 | 3787 | } |
3788 | 3788 | |
3789 | - return $str_part_one . $str_part_two; |
|
3789 | + return $str_part_one.$str_part_two; |
|
3790 | 3790 | } |
3791 | 3791 | |
3792 | 3792 | /** |
@@ -3920,7 +3920,7 @@ discard block |
||
3920 | 3920 | } |
3921 | 3921 | |
3922 | 3922 | /** @noinspection PhpComposerExtensionStubsInspection */ |
3923 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
3923 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
3924 | 3924 | } |
3925 | 3925 | |
3926 | 3926 | if ($chars) { |
@@ -3968,7 +3968,7 @@ discard block |
||
3968 | 3968 | { |
3969 | 3969 | $bytes = self::chr_size_list($str); |
3970 | 3970 | if ($bytes !== []) { |
3971 | - return (int) \max($bytes); |
|
3971 | + return (int)\max($bytes); |
|
3972 | 3972 | } |
3973 | 3973 | |
3974 | 3974 | return 0; |
@@ -4037,7 +4037,7 @@ discard block |
||
4037 | 4037 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4038 | 4038 | |
4039 | 4039 | // init |
4040 | - $encoding = (string) $encoding; |
|
4040 | + $encoding = (string)$encoding; |
|
4041 | 4041 | |
4042 | 4042 | if (!$encoding) { |
4043 | 4043 | 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 | |
@@ -4843,7 +4843,7 @@ discard block |
||
4843 | 4843 | } |
4844 | 4844 | |
4845 | 4845 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4846 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4846 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4847 | 4847 | } |
4848 | 4848 | |
4849 | 4849 | if ($chars) { |
@@ -4865,7 +4865,7 @@ discard block |
||
4865 | 4865 | { |
4866 | 4866 | echo '<pre>'; |
4867 | 4867 | foreach (self::$SUPPORT as $key => &$value) { |
4868 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
4868 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
4869 | 4869 | } |
4870 | 4870 | unset($value); |
4871 | 4871 | echo '</pre>'; |
@@ -4897,7 +4897,7 @@ discard block |
||
4897 | 4897 | return $char; |
4898 | 4898 | } |
4899 | 4899 | |
4900 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
4900 | + return '&#'.self::ord($char, $encoding).';'; |
|
4901 | 4901 | } |
4902 | 4902 | |
4903 | 4903 | /** |
@@ -4990,18 +4990,18 @@ discard block |
||
4990 | 4990 | $lang, |
4991 | 4991 | $try_to_keep_the_string_length |
4992 | 4992 | ); |
4993 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
4993 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
4994 | 4994 | |
4995 | 4995 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
4996 | 4996 | |
4997 | - $str = (string) \preg_replace_callback( |
|
4997 | + $str = (string)\preg_replace_callback( |
|
4998 | 4998 | '/[-_\\s]+(.)?/u', |
4999 | 4999 | /** |
5000 | 5000 | * @param array $match |
5001 | 5001 | * |
5002 | 5002 | * @return string |
5003 | 5003 | */ |
5004 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5004 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5005 | 5005 | if (isset($match[1])) { |
5006 | 5006 | if ($use_mb_functions === true) { |
5007 | 5007 | if ($encoding === 'UTF-8') { |
@@ -5019,14 +5019,14 @@ discard block |
||
5019 | 5019 | $str |
5020 | 5020 | ); |
5021 | 5021 | |
5022 | - return (string) \preg_replace_callback( |
|
5022 | + return (string)\preg_replace_callback( |
|
5023 | 5023 | '/[\\p{N}]+(.)?/u', |
5024 | 5024 | /** |
5025 | 5025 | * @param array $match |
5026 | 5026 | * |
5027 | 5027 | * @return string |
5028 | 5028 | */ |
5029 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5029 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5030 | 5030 | if ($use_mb_functions === true) { |
5031 | 5031 | if ($encoding === 'UTF-8') { |
5032 | 5032 | return \mb_strtoupper($match[0]); |
@@ -5204,7 +5204,7 @@ discard block |
||
5204 | 5204 | ): string { |
5205 | 5205 | if (self::$SUPPORT['mbstring'] === true) { |
5206 | 5206 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5207 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5207 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5208 | 5208 | |
5209 | 5209 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
5210 | 5210 | if ($use_mb_functions === true && $encoding === 'UTF-8') { |
@@ -5214,10 +5214,10 @@ discard block |
||
5214 | 5214 | } |
5215 | 5215 | |
5216 | 5216 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5217 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5217 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5218 | 5218 | } |
5219 | 5219 | |
5220 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5220 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5221 | 5221 | |
5222 | 5222 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
5223 | 5223 | if ($use_mb_functions === true && $encoding === 'UTF-8') { |
@@ -5226,7 +5226,7 @@ discard block |
||
5226 | 5226 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
5227 | 5227 | } |
5228 | 5228 | |
5229 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5229 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5230 | 5230 | } |
5231 | 5231 | |
5232 | 5232 | /** |
@@ -5241,7 +5241,7 @@ discard block |
||
5241 | 5241 | public static function str_detect_encoding($str) |
5242 | 5242 | { |
5243 | 5243 | // init |
5244 | - $str = (string) $str; |
|
5244 | + $str = (string)$str; |
|
5245 | 5245 | |
5246 | 5246 | // |
5247 | 5247 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5343,7 +5343,7 @@ discard block |
||
5343 | 5343 | foreach (self::$ENCODINGS as $encoding_tmp) { |
5344 | 5344 | // INFO: //IGNORE but still throw notice |
5345 | 5345 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5346 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
5346 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
5347 | 5347 | return $encoding_tmp; |
5348 | 5348 | } |
5349 | 5349 | } |
@@ -5432,7 +5432,7 @@ discard block |
||
5432 | 5432 | return $str; |
5433 | 5433 | } |
5434 | 5434 | |
5435 | - return $substring . $str; |
|
5435 | + return $substring.$str; |
|
5436 | 5436 | } |
5437 | 5437 | |
5438 | 5438 | /** |
@@ -5701,27 +5701,27 @@ discard block |
||
5701 | 5701 | string $encoding = 'UTF-8' |
5702 | 5702 | ): string { |
5703 | 5703 | if ($encoding === 'UTF-8') { |
5704 | - $len = (int) \mb_strlen($str); |
|
5704 | + $len = (int)\mb_strlen($str); |
|
5705 | 5705 | if ($index > $len) { |
5706 | 5706 | return $str; |
5707 | 5707 | } |
5708 | 5708 | |
5709 | 5709 | /** @noinspection UnnecessaryCastingInspection */ |
5710 | - return (string) \mb_substr($str, 0, $index) . |
|
5711 | - $substring . |
|
5712 | - (string) \mb_substr($str, $index, $len); |
|
5710 | + return (string)\mb_substr($str, 0, $index). |
|
5711 | + $substring. |
|
5712 | + (string)\mb_substr($str, $index, $len); |
|
5713 | 5713 | } |
5714 | 5714 | |
5715 | 5715 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5716 | 5716 | |
5717 | - $len = (int) self::strlen($str, $encoding); |
|
5717 | + $len = (int)self::strlen($str, $encoding); |
|
5718 | 5718 | if ($index > $len) { |
5719 | 5719 | return $str; |
5720 | 5720 | } |
5721 | 5721 | |
5722 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
5723 | - $substring . |
|
5724 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5722 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
5723 | + $substring. |
|
5724 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
5725 | 5725 | } |
5726 | 5726 | |
5727 | 5727 | /** |
@@ -5751,15 +5751,15 @@ discard block |
||
5751 | 5751 | */ |
5752 | 5752 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5753 | 5753 | { |
5754 | - $search = (array) $search; |
|
5754 | + $search = (array)$search; |
|
5755 | 5755 | |
5756 | 5756 | /** @noinspection AlterInForeachInspection */ |
5757 | 5757 | foreach ($search as &$s) { |
5758 | - $s = (string) $s; |
|
5758 | + $s = (string)$s; |
|
5759 | 5759 | if ($s === '') { |
5760 | 5760 | $s = '/^(?<=.)$/'; |
5761 | 5761 | } else { |
5762 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5762 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5763 | 5763 | } |
5764 | 5764 | } |
5765 | 5765 | |
@@ -5791,11 +5791,11 @@ discard block |
||
5791 | 5791 | } |
5792 | 5792 | |
5793 | 5793 | if ($search === '') { |
5794 | - return $str . $replacement; |
|
5794 | + return $str.$replacement; |
|
5795 | 5795 | } |
5796 | 5796 | |
5797 | 5797 | if (\stripos($str, $search) === 0) { |
5798 | - return $replacement . \substr($str, \strlen($search)); |
|
5798 | + return $replacement.\substr($str, \strlen($search)); |
|
5799 | 5799 | } |
5800 | 5800 | |
5801 | 5801 | return $str; |
@@ -5823,11 +5823,11 @@ discard block |
||
5823 | 5823 | } |
5824 | 5824 | |
5825 | 5825 | if ($search === '') { |
5826 | - return $str . $replacement; |
|
5826 | + return $str.$replacement; |
|
5827 | 5827 | } |
5828 | 5828 | |
5829 | 5829 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
5830 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
5830 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
5831 | 5831 | } |
5832 | 5832 | |
5833 | 5833 | return $str; |
@@ -5907,15 +5907,15 @@ discard block |
||
5907 | 5907 | } |
5908 | 5908 | |
5909 | 5909 | if ($encoding === 'UTF-8') { |
5910 | - return (string) \mb_substr( |
|
5910 | + return (string)\mb_substr( |
|
5911 | 5911 | $str, |
5912 | - $offset + (int) \mb_strlen($separator) |
|
5912 | + $offset + (int)\mb_strlen($separator) |
|
5913 | 5913 | ); |
5914 | 5914 | } |
5915 | 5915 | |
5916 | - return (string) self::substr( |
|
5916 | + return (string)self::substr( |
|
5917 | 5917 | $str, |
5918 | - $offset + (int) self::strlen($separator, $encoding), |
|
5918 | + $offset + (int)self::strlen($separator, $encoding), |
|
5919 | 5919 | null, |
5920 | 5920 | $encoding |
5921 | 5921 | ); |
@@ -5945,15 +5945,15 @@ discard block |
||
5945 | 5945 | } |
5946 | 5946 | |
5947 | 5947 | if ($encoding === 'UTF-8') { |
5948 | - return (string) \mb_substr( |
|
5948 | + return (string)\mb_substr( |
|
5949 | 5949 | $str, |
5950 | - $offset + (int) self::strlen($separator) |
|
5950 | + $offset + (int)self::strlen($separator) |
|
5951 | 5951 | ); |
5952 | 5952 | } |
5953 | 5953 | |
5954 | - return (string) self::substr( |
|
5954 | + return (string)self::substr( |
|
5955 | 5955 | $str, |
5956 | - $offset + (int) self::strlen($separator, $encoding), |
|
5956 | + $offset + (int)self::strlen($separator, $encoding), |
|
5957 | 5957 | null, |
5958 | 5958 | $encoding |
5959 | 5959 | ); |
@@ -5983,10 +5983,10 @@ discard block |
||
5983 | 5983 | } |
5984 | 5984 | |
5985 | 5985 | if ($encoding === 'UTF-8') { |
5986 | - return (string) \mb_substr($str, 0, $offset); |
|
5986 | + return (string)\mb_substr($str, 0, $offset); |
|
5987 | 5987 | } |
5988 | 5988 | |
5989 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
5989 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
5990 | 5990 | } |
5991 | 5991 | |
5992 | 5992 | /** |
@@ -6013,7 +6013,7 @@ discard block |
||
6013 | 6013 | return ''; |
6014 | 6014 | } |
6015 | 6015 | |
6016 | - return (string) \mb_substr($str, 0, $offset); |
|
6016 | + return (string)\mb_substr($str, 0, $offset); |
|
6017 | 6017 | } |
6018 | 6018 | |
6019 | 6019 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6021,7 +6021,7 @@ discard block |
||
6021 | 6021 | return ''; |
6022 | 6022 | } |
6023 | 6023 | |
6024 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6024 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6025 | 6025 | } |
6026 | 6026 | |
6027 | 6027 | /** |
@@ -6117,12 +6117,12 @@ discard block |
||
6117 | 6117 | } |
6118 | 6118 | |
6119 | 6119 | if ($encoding === 'UTF-8') { |
6120 | - return (string) \mb_substr($str, -$n); |
|
6120 | + return (string)\mb_substr($str, -$n); |
|
6121 | 6121 | } |
6122 | 6122 | |
6123 | 6123 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6124 | 6124 | |
6125 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6125 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6126 | 6126 | } |
6127 | 6127 | |
6128 | 6128 | /** |
@@ -6146,21 +6146,21 @@ discard block |
||
6146 | 6146 | } |
6147 | 6147 | |
6148 | 6148 | if ($encoding === 'UTF-8') { |
6149 | - if ((int) \mb_strlen($str) <= $length) { |
|
6149 | + if ((int)\mb_strlen($str) <= $length) { |
|
6150 | 6150 | return $str; |
6151 | 6151 | } |
6152 | 6152 | |
6153 | 6153 | /** @noinspection UnnecessaryCastingInspection */ |
6154 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
6154 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
6155 | 6155 | } |
6156 | 6156 | |
6157 | 6157 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6158 | 6158 | |
6159 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6159 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6160 | 6160 | return $str; |
6161 | 6161 | } |
6162 | 6162 | |
6163 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
6163 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
6164 | 6164 | } |
6165 | 6165 | |
6166 | 6166 | /** |
@@ -6185,12 +6185,12 @@ discard block |
||
6185 | 6185 | |
6186 | 6186 | if ($encoding === 'UTF-8') { |
6187 | 6187 | /** @noinspection UnnecessaryCastingInspection */ |
6188 | - if ((int) \mb_strlen($str) <= $length) { |
|
6188 | + if ((int)\mb_strlen($str) <= $length) { |
|
6189 | 6189 | return $str; |
6190 | 6190 | } |
6191 | 6191 | |
6192 | 6192 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6193 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6193 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6194 | 6194 | } |
6195 | 6195 | |
6196 | 6196 | $str = \mb_substr($str, 0, $length); |
@@ -6200,22 +6200,22 @@ discard block |
||
6200 | 6200 | $new_str = \implode(' ', $array); |
6201 | 6201 | |
6202 | 6202 | if ($new_str === '') { |
6203 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6203 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6204 | 6204 | } |
6205 | 6205 | } else { |
6206 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6206 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6207 | 6207 | return $str; |
6208 | 6208 | } |
6209 | 6209 | |
6210 | 6210 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6211 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6211 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6212 | 6212 | } |
6213 | 6213 | |
6214 | 6214 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6215 | 6215 | $str = self::substr($str, 0, $length, $encoding); |
6216 | 6216 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6217 | 6217 | if ($str === false) { |
6218 | - return '' . $str_add_on; |
|
6218 | + return ''.$str_add_on; |
|
6219 | 6219 | } |
6220 | 6220 | |
6221 | 6221 | $array = \explode(' ', $str); |
@@ -6223,11 +6223,11 @@ discard block |
||
6223 | 6223 | $new_str = \implode(' ', $array); |
6224 | 6224 | |
6225 | 6225 | if ($new_str === '') { |
6226 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6226 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6227 | 6227 | } |
6228 | 6228 | } |
6229 | 6229 | |
6230 | - return $new_str . $str_add_on; |
|
6230 | + return $new_str.$str_add_on; |
|
6231 | 6231 | } |
6232 | 6232 | |
6233 | 6233 | /** |
@@ -6248,7 +6248,7 @@ discard block |
||
6248 | 6248 | $longest_common_prefix = ''; |
6249 | 6249 | |
6250 | 6250 | if ($encoding === 'UTF-8') { |
6251 | - $max_length = (int) \min( |
|
6251 | + $max_length = (int)\min( |
|
6252 | 6252 | \mb_strlen($str1), |
6253 | 6253 | \mb_strlen($str2) |
6254 | 6254 | ); |
@@ -6269,7 +6269,7 @@ discard block |
||
6269 | 6269 | } else { |
6270 | 6270 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6271 | 6271 | |
6272 | - $max_length = (int) \min( |
|
6272 | + $max_length = (int)\min( |
|
6273 | 6273 | self::strlen($str1, $encoding), |
6274 | 6274 | self::strlen($str2, $encoding) |
6275 | 6275 | ); |
@@ -6315,13 +6315,13 @@ discard block |
||
6315 | 6315 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6316 | 6316 | |
6317 | 6317 | if ($encoding === 'UTF-8') { |
6318 | - $str_length = (int) \mb_strlen($str1); |
|
6319 | - $other_length = (int) \mb_strlen($str2); |
|
6318 | + $str_length = (int)\mb_strlen($str1); |
|
6319 | + $other_length = (int)\mb_strlen($str2); |
|
6320 | 6320 | } else { |
6321 | 6321 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6322 | 6322 | |
6323 | - $str_length = (int) self::strlen($str1, $encoding); |
|
6324 | - $other_length = (int) self::strlen($str2, $encoding); |
|
6323 | + $str_length = (int)self::strlen($str1, $encoding); |
|
6324 | + $other_length = (int)self::strlen($str2, $encoding); |
|
6325 | 6325 | } |
6326 | 6326 | |
6327 | 6327 | // Return if either string is empty |
@@ -6374,10 +6374,10 @@ discard block |
||
6374 | 6374 | } |
6375 | 6375 | |
6376 | 6376 | if ($encoding === 'UTF-8') { |
6377 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
6377 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
6378 | 6378 | } |
6379 | 6379 | |
6380 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
6380 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
6381 | 6381 | } |
6382 | 6382 | |
6383 | 6383 | /** |
@@ -6399,7 +6399,7 @@ discard block |
||
6399 | 6399 | } |
6400 | 6400 | |
6401 | 6401 | if ($encoding === 'UTF-8') { |
6402 | - $max_length = (int) \min( |
|
6402 | + $max_length = (int)\min( |
|
6403 | 6403 | \mb_strlen($str1, $encoding), |
6404 | 6404 | \mb_strlen($str2, $encoding) |
6405 | 6405 | ); |
@@ -6413,7 +6413,7 @@ discard block |
||
6413 | 6413 | && |
6414 | 6414 | $char === \mb_substr($str2, -$i, 1) |
6415 | 6415 | ) { |
6416 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
6416 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
6417 | 6417 | } else { |
6418 | 6418 | break; |
6419 | 6419 | } |
@@ -6421,7 +6421,7 @@ discard block |
||
6421 | 6421 | } else { |
6422 | 6422 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6423 | 6423 | |
6424 | - $max_length = (int) \min( |
|
6424 | + $max_length = (int)\min( |
|
6425 | 6425 | self::strlen($str1, $encoding), |
6426 | 6426 | self::strlen($str2, $encoding) |
6427 | 6427 | ); |
@@ -6435,7 +6435,7 @@ discard block |
||
6435 | 6435 | && |
6436 | 6436 | $char === self::substr($str2, -$i, 1, $encoding) |
6437 | 6437 | ) { |
6438 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
6438 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
6439 | 6439 | } else { |
6440 | 6440 | break; |
6441 | 6441 | } |
@@ -6455,7 +6455,7 @@ discard block |
||
6455 | 6455 | */ |
6456 | 6456 | public static function str_matches_pattern(string $str, string $pattern): bool |
6457 | 6457 | { |
6458 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6458 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6459 | 6459 | } |
6460 | 6460 | |
6461 | 6461 | /** |
@@ -6472,7 +6472,7 @@ discard block |
||
6472 | 6472 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6473 | 6473 | { |
6474 | 6474 | // init |
6475 | - $length = (int) self::strlen($str, $encoding); |
|
6475 | + $length = (int)self::strlen($str, $encoding); |
|
6476 | 6476 | |
6477 | 6477 | if ($offset >= 0) { |
6478 | 6478 | return $length > $offset; |
@@ -6498,7 +6498,7 @@ discard block |
||
6498 | 6498 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6499 | 6499 | { |
6500 | 6500 | // init |
6501 | - $length = (int) self::strlen($str); |
|
6501 | + $length = (int)self::strlen($str); |
|
6502 | 6502 | |
6503 | 6503 | if ( |
6504 | 6504 | ($index >= 0 && $length <= $index) |
@@ -6537,7 +6537,7 @@ discard block |
||
6537 | 6537 | return $str; |
6538 | 6538 | } |
6539 | 6539 | |
6540 | - if ($pad_type !== (int) $pad_type) { |
|
6540 | + if ($pad_type !== (int)$pad_type) { |
|
6541 | 6541 | if ($pad_type === 'left') { |
6542 | 6542 | $pad_type = \STR_PAD_LEFT; |
6543 | 6543 | } elseif ($pad_type === 'right') { |
@@ -6546,23 +6546,23 @@ discard block |
||
6546 | 6546 | $pad_type = \STR_PAD_BOTH; |
6547 | 6547 | } else { |
6548 | 6548 | throw new \InvalidArgumentException( |
6549 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6549 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6550 | 6550 | ); |
6551 | 6551 | } |
6552 | 6552 | } |
6553 | 6553 | |
6554 | 6554 | if ($encoding === 'UTF-8') { |
6555 | - $str_length = (int) \mb_strlen($str); |
|
6555 | + $str_length = (int)\mb_strlen($str); |
|
6556 | 6556 | |
6557 | 6557 | if ($pad_length >= $str_length) { |
6558 | 6558 | switch ($pad_type) { |
6559 | 6559 | case \STR_PAD_LEFT: |
6560 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6560 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6561 | 6561 | |
6562 | 6562 | $diff = ($pad_length - $str_length); |
6563 | 6563 | |
6564 | - $pre = (string) \mb_substr( |
|
6565 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6564 | + $pre = (string)\mb_substr( |
|
6565 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6566 | 6566 | 0, |
6567 | 6567 | $diff |
6568 | 6568 | ); |
@@ -6573,16 +6573,16 @@ discard block |
||
6573 | 6573 | case \STR_PAD_BOTH: |
6574 | 6574 | $diff = ($pad_length - $str_length); |
6575 | 6575 | |
6576 | - $ps_length_left = (int) \floor($diff / 2); |
|
6576 | + $ps_length_left = (int)\floor($diff / 2); |
|
6577 | 6577 | |
6578 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6578 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6579 | 6579 | |
6580 | - $pre = (string) \mb_substr( |
|
6580 | + $pre = (string)\mb_substr( |
|
6581 | 6581 | \str_repeat($pad_string, $ps_length_left), |
6582 | 6582 | 0, |
6583 | 6583 | $ps_length_left |
6584 | 6584 | ); |
6585 | - $post = (string) \mb_substr( |
|
6585 | + $post = (string)\mb_substr( |
|
6586 | 6586 | \str_repeat($pad_string, $ps_length_right), |
6587 | 6587 | 0, |
6588 | 6588 | $ps_length_right |
@@ -6592,19 +6592,19 @@ discard block |
||
6592 | 6592 | |
6593 | 6593 | case \STR_PAD_RIGHT: |
6594 | 6594 | default: |
6595 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6595 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6596 | 6596 | |
6597 | 6597 | $diff = ($pad_length - $str_length); |
6598 | 6598 | |
6599 | - $post = (string) \mb_substr( |
|
6600 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6599 | + $post = (string)\mb_substr( |
|
6600 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6601 | 6601 | 0, |
6602 | 6602 | $diff |
6603 | 6603 | ); |
6604 | 6604 | $pre = ''; |
6605 | 6605 | } |
6606 | 6606 | |
6607 | - return $pre . $str . $post; |
|
6607 | + return $pre.$str.$post; |
|
6608 | 6608 | } |
6609 | 6609 | |
6610 | 6610 | return $str; |
@@ -6612,17 +6612,17 @@ discard block |
||
6612 | 6612 | |
6613 | 6613 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6614 | 6614 | |
6615 | - $str_length = (int) self::strlen($str, $encoding); |
|
6615 | + $str_length = (int)self::strlen($str, $encoding); |
|
6616 | 6616 | |
6617 | 6617 | if ($pad_length >= $str_length) { |
6618 | 6618 | switch ($pad_type) { |
6619 | 6619 | case \STR_PAD_LEFT: |
6620 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6620 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6621 | 6621 | |
6622 | 6622 | $diff = ($pad_length - $str_length); |
6623 | 6623 | |
6624 | - $pre = (string) self::substr( |
|
6625 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6624 | + $pre = (string)self::substr( |
|
6625 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6626 | 6626 | 0, |
6627 | 6627 | $diff, |
6628 | 6628 | $encoding |
@@ -6634,17 +6634,17 @@ discard block |
||
6634 | 6634 | case \STR_PAD_BOTH: |
6635 | 6635 | $diff = ($pad_length - $str_length); |
6636 | 6636 | |
6637 | - $ps_length_left = (int) \floor($diff / 2); |
|
6637 | + $ps_length_left = (int)\floor($diff / 2); |
|
6638 | 6638 | |
6639 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6639 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6640 | 6640 | |
6641 | - $pre = (string) self::substr( |
|
6641 | + $pre = (string)self::substr( |
|
6642 | 6642 | \str_repeat($pad_string, $ps_length_left), |
6643 | 6643 | 0, |
6644 | 6644 | $ps_length_left, |
6645 | 6645 | $encoding |
6646 | 6646 | ); |
6647 | - $post = (string) self::substr( |
|
6647 | + $post = (string)self::substr( |
|
6648 | 6648 | \str_repeat($pad_string, $ps_length_right), |
6649 | 6649 | 0, |
6650 | 6650 | $ps_length_right, |
@@ -6655,12 +6655,12 @@ discard block |
||
6655 | 6655 | |
6656 | 6656 | case \STR_PAD_RIGHT: |
6657 | 6657 | default: |
6658 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6658 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6659 | 6659 | |
6660 | 6660 | $diff = ($pad_length - $str_length); |
6661 | 6661 | |
6662 | - $post = (string) self::substr( |
|
6663 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6662 | + $post = (string)self::substr( |
|
6663 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6664 | 6664 | 0, |
6665 | 6665 | $diff, |
6666 | 6666 | $encoding |
@@ -6668,7 +6668,7 @@ discard block |
||
6668 | 6668 | $pre = ''; |
6669 | 6669 | } |
6670 | 6670 | |
6671 | - return $pre . $str . $post; |
|
6671 | + return $pre.$str.$post; |
|
6672 | 6672 | } |
6673 | 6673 | |
6674 | 6674 | return $str; |
@@ -6852,11 +6852,11 @@ discard block |
||
6852 | 6852 | } |
6853 | 6853 | |
6854 | 6854 | if ($search === '') { |
6855 | - return $str . $replacement; |
|
6855 | + return $str.$replacement; |
|
6856 | 6856 | } |
6857 | 6857 | |
6858 | 6858 | if (\strpos($str, $search) === 0) { |
6859 | - return $replacement . \substr($str, \strlen($search)); |
|
6859 | + return $replacement.\substr($str, \strlen($search)); |
|
6860 | 6860 | } |
6861 | 6861 | |
6862 | 6862 | return $str; |
@@ -6887,11 +6887,11 @@ discard block |
||
6887 | 6887 | } |
6888 | 6888 | |
6889 | 6889 | if ($search === '') { |
6890 | - return $str . $replacement; |
|
6890 | + return $str.$replacement; |
|
6891 | 6891 | } |
6892 | 6892 | |
6893 | 6893 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6894 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6894 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6895 | 6895 | } |
6896 | 6896 | |
6897 | 6897 | return $str; |
@@ -6923,7 +6923,7 @@ discard block |
||
6923 | 6923 | $subject, |
6924 | 6924 | $replace, |
6925 | 6925 | $pos, |
6926 | - (int) self::strlen($search) |
|
6926 | + (int)self::strlen($search) |
|
6927 | 6927 | ); |
6928 | 6928 | } |
6929 | 6929 | |
@@ -6955,7 +6955,7 @@ discard block |
||
6955 | 6955 | $subject, |
6956 | 6956 | $replace, |
6957 | 6957 | $pos, |
6958 | - (int) self::strlen($search) |
|
6958 | + (int)self::strlen($search) |
|
6959 | 6959 | ); |
6960 | 6960 | } |
6961 | 6961 | |
@@ -6975,7 +6975,7 @@ discard block |
||
6975 | 6975 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
6976 | 6976 | { |
6977 | 6977 | if ($encoding === 'UTF-8') { |
6978 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
6978 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
6979 | 6979 | /** @noinspection NonSecureShuffleUsageInspection */ |
6980 | 6980 | \shuffle($indexes); |
6981 | 6981 | |
@@ -6991,7 +6991,7 @@ discard block |
||
6991 | 6991 | } else { |
6992 | 6992 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6993 | 6993 | |
6994 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
6994 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
6995 | 6995 | /** @noinspection NonSecureShuffleUsageInspection */ |
6996 | 6996 | \shuffle($indexes); |
6997 | 6997 | |
@@ -7032,11 +7032,11 @@ discard block |
||
7032 | 7032 | ) { |
7033 | 7033 | if ($encoding === 'UTF-8') { |
7034 | 7034 | if ($end === null) { |
7035 | - $length = (int) \mb_strlen($str); |
|
7035 | + $length = (int)\mb_strlen($str); |
|
7036 | 7036 | } elseif ($end >= 0 && $end <= $start) { |
7037 | 7037 | return ''; |
7038 | 7038 | } elseif ($end < 0) { |
7039 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7039 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7040 | 7040 | } else { |
7041 | 7041 | $length = $end - $start; |
7042 | 7042 | } |
@@ -7047,11 +7047,11 @@ discard block |
||
7047 | 7047 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7048 | 7048 | |
7049 | 7049 | if ($end === null) { |
7050 | - $length = (int) self::strlen($str, $encoding); |
|
7050 | + $length = (int)self::strlen($str, $encoding); |
|
7051 | 7051 | } elseif ($end >= 0 && $end <= $start) { |
7052 | 7052 | return ''; |
7053 | 7053 | } elseif ($end < 0) { |
7054 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7054 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7055 | 7055 | } else { |
7056 | 7056 | $length = $end - $start; |
7057 | 7057 | } |
@@ -7083,35 +7083,35 @@ discard block |
||
7083 | 7083 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7084 | 7084 | } |
7085 | 7085 | |
7086 | - $str = (string) \preg_replace_callback( |
|
7086 | + $str = (string)\preg_replace_callback( |
|
7087 | 7087 | '/([\\p{N}|\\p{Lu}])/u', |
7088 | 7088 | /** |
7089 | 7089 | * @param string[] $matches |
7090 | 7090 | * |
7091 | 7091 | * @return string |
7092 | 7092 | */ |
7093 | - static function (array $matches) use ($encoding): string { |
|
7093 | + static function(array $matches) use ($encoding): string { |
|
7094 | 7094 | $match = $matches[1]; |
7095 | - $match_int = (int) $match; |
|
7095 | + $match_int = (int)$match; |
|
7096 | 7096 | |
7097 | - if ((string) $match_int === $match) { |
|
7098 | - return '_' . $match . '_'; |
|
7097 | + if ((string)$match_int === $match) { |
|
7098 | + return '_'.$match.'_'; |
|
7099 | 7099 | } |
7100 | 7100 | |
7101 | 7101 | if ($encoding === 'UTF-8') { |
7102 | - return '_' . \mb_strtolower($match); |
|
7102 | + return '_'.\mb_strtolower($match); |
|
7103 | 7103 | } |
7104 | 7104 | |
7105 | - return '_' . self::strtolower($match, $encoding); |
|
7105 | + return '_'.self::strtolower($match, $encoding); |
|
7106 | 7106 | }, |
7107 | 7107 | $str |
7108 | 7108 | ); |
7109 | 7109 | |
7110 | - $str = (string) \preg_replace( |
|
7110 | + $str = (string)\preg_replace( |
|
7111 | 7111 | [ |
7112 | - '/\\s+/u', // convert spaces to "_" |
|
7112 | + '/\\s+/u', // convert spaces to "_" |
|
7113 | 7113 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
7114 | - '/_+/', // remove double "_" |
|
7114 | + '/_+/', // remove double "_" |
|
7115 | 7115 | ], |
7116 | 7116 | [ |
7117 | 7117 | '_', |
@@ -7187,7 +7187,7 @@ discard block |
||
7187 | 7187 | } |
7188 | 7188 | |
7189 | 7189 | // init |
7190 | - $str = (string) $str; |
|
7190 | + $str = (string)$str; |
|
7191 | 7191 | |
7192 | 7192 | if ($str === '') { |
7193 | 7193 | return []; |
@@ -7234,7 +7234,7 @@ discard block |
||
7234 | 7234 | ($str[$i] & "\xE0") === "\xC0" |
7235 | 7235 | ) { |
7236 | 7236 | if (($str[$i + 1] & "\xC0") === "\x80") { |
7237 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
7237 | + $ret[] = $str[$i].$str[$i + 1]; |
|
7238 | 7238 | |
7239 | 7239 | ++$i; |
7240 | 7240 | } |
@@ -7248,7 +7248,7 @@ discard block |
||
7248 | 7248 | && |
7249 | 7249 | ($str[$i + 2] & "\xC0") === "\x80" |
7250 | 7250 | ) { |
7251 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
7251 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
7252 | 7252 | |
7253 | 7253 | $i += 2; |
7254 | 7254 | } |
@@ -7264,7 +7264,7 @@ discard block |
||
7264 | 7264 | && |
7265 | 7265 | ($str[$i + 3] & "\xC0") === "\x80" |
7266 | 7266 | ) { |
7267 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
7267 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
7268 | 7268 | |
7269 | 7269 | $i += 3; |
7270 | 7270 | } |
@@ -7276,7 +7276,7 @@ discard block |
||
7276 | 7276 | $ret = \array_chunk($ret, $length); |
7277 | 7277 | |
7278 | 7278 | return \array_map( |
7279 | - static function (array &$item): string { |
|
7279 | + static function(array &$item): string { |
|
7280 | 7280 | return \implode('', $item); |
7281 | 7281 | }, |
7282 | 7282 | $ret |
@@ -7339,7 +7339,7 @@ discard block |
||
7339 | 7339 | $limit = -1; |
7340 | 7340 | } |
7341 | 7341 | |
7342 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7342 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7343 | 7343 | |
7344 | 7344 | if ($array === false) { |
7345 | 7345 | return []; |
@@ -7423,9 +7423,9 @@ discard block |
||
7423 | 7423 | return ''; |
7424 | 7424 | } |
7425 | 7425 | |
7426 | - return (string) \mb_substr( |
|
7426 | + return (string)\mb_substr( |
|
7427 | 7427 | $str, |
7428 | - $offset + (int) \mb_strlen($separator) |
|
7428 | + $offset + (int)\mb_strlen($separator) |
|
7429 | 7429 | ); |
7430 | 7430 | } |
7431 | 7431 | |
@@ -7434,9 +7434,9 @@ discard block |
||
7434 | 7434 | return ''; |
7435 | 7435 | } |
7436 | 7436 | |
7437 | - return (string) \mb_substr( |
|
7437 | + return (string)\mb_substr( |
|
7438 | 7438 | $str, |
7439 | - $offset + (int) self::strlen($separator, $encoding), |
|
7439 | + $offset + (int)self::strlen($separator, $encoding), |
|
7440 | 7440 | null, |
7441 | 7441 | $encoding |
7442 | 7442 | ); |
@@ -7463,9 +7463,9 @@ discard block |
||
7463 | 7463 | return ''; |
7464 | 7464 | } |
7465 | 7465 | |
7466 | - return (string) \mb_substr( |
|
7466 | + return (string)\mb_substr( |
|
7467 | 7467 | $str, |
7468 | - $offset + (int) \mb_strlen($separator) |
|
7468 | + $offset + (int)\mb_strlen($separator) |
|
7469 | 7469 | ); |
7470 | 7470 | } |
7471 | 7471 | |
@@ -7474,9 +7474,9 @@ discard block |
||
7474 | 7474 | return ''; |
7475 | 7475 | } |
7476 | 7476 | |
7477 | - return (string) self::substr( |
|
7477 | + return (string)self::substr( |
|
7478 | 7478 | $str, |
7479 | - $offset + (int) self::strlen($separator, $encoding), |
|
7479 | + $offset + (int)self::strlen($separator, $encoding), |
|
7480 | 7480 | null, |
7481 | 7481 | $encoding |
7482 | 7482 | ); |
@@ -7506,7 +7506,7 @@ discard block |
||
7506 | 7506 | return ''; |
7507 | 7507 | } |
7508 | 7508 | |
7509 | - return (string) \mb_substr( |
|
7509 | + return (string)\mb_substr( |
|
7510 | 7510 | $str, |
7511 | 7511 | 0, |
7512 | 7512 | $offset |
@@ -7518,7 +7518,7 @@ discard block |
||
7518 | 7518 | return ''; |
7519 | 7519 | } |
7520 | 7520 | |
7521 | - return (string) self::substr( |
|
7521 | + return (string)self::substr( |
|
7522 | 7522 | $str, |
7523 | 7523 | 0, |
7524 | 7524 | $offset, |
@@ -7547,7 +7547,7 @@ discard block |
||
7547 | 7547 | return ''; |
7548 | 7548 | } |
7549 | 7549 | |
7550 | - return (string) \mb_substr( |
|
7550 | + return (string)\mb_substr( |
|
7551 | 7551 | $str, |
7552 | 7552 | 0, |
7553 | 7553 | $offset |
@@ -7561,7 +7561,7 @@ discard block |
||
7561 | 7561 | |
7562 | 7562 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7563 | 7563 | |
7564 | - return (string) self::substr( |
|
7564 | + return (string)self::substr( |
|
7565 | 7565 | $str, |
7566 | 7566 | 0, |
7567 | 7567 | $offset, |
@@ -7669,7 +7669,7 @@ discard block |
||
7669 | 7669 | */ |
7670 | 7670 | public static function str_surround(string $str, string $substring): string |
7671 | 7671 | { |
7672 | - return $substring . $str . $substring; |
|
7672 | + return $substring.$str.$substring; |
|
7673 | 7673 | } |
7674 | 7674 | |
7675 | 7675 | /** |
@@ -7726,9 +7726,9 @@ discard block |
||
7726 | 7726 | $word_define_chars = ''; |
7727 | 7727 | } |
7728 | 7728 | |
7729 | - $str = (string) \preg_replace_callback( |
|
7730 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
7731 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
7729 | + $str = (string)\preg_replace_callback( |
|
7730 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
7731 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
7732 | 7732 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
7733 | 7733 | return $match[0]; |
7734 | 7734 | } |
@@ -7819,16 +7819,16 @@ discard block |
||
7819 | 7819 | } |
7820 | 7820 | |
7821 | 7821 | // the main substitutions |
7822 | - $str = (string) \preg_replace_callback( |
|
7822 | + $str = (string)\preg_replace_callback( |
|
7823 | 7823 | '~\\b (_*) (?: # 1. Leading underscore and |
7824 | 7824 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
7825 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
7825 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
7826 | 7826 | | |
7827 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
7827 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
7828 | 7828 | | |
7829 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
7829 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
7830 | 7830 | | |
7831 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
7831 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
7832 | 7832 | ) (_*) \\b # 6. With trailing underscore |
7833 | 7833 | ~ux', |
7834 | 7834 | /** |
@@ -7836,7 +7836,7 @@ discard block |
||
7836 | 7836 | * |
7837 | 7837 | * @return string |
7838 | 7838 | */ |
7839 | - static function (array $matches) use ($encoding): string { |
|
7839 | + static function(array $matches) use ($encoding): string { |
|
7840 | 7840 | // preserve leading underscore |
7841 | 7841 | $str = $matches[1]; |
7842 | 7842 | if ($matches[2]) { |
@@ -7861,26 +7861,26 @@ discard block |
||
7861 | 7861 | ); |
7862 | 7862 | |
7863 | 7863 | // Exceptions for small words: capitalize at start of title... |
7864 | - $str = (string) \preg_replace_callback( |
|
7864 | + $str = (string)\preg_replace_callback( |
|
7865 | 7865 | '~( \\A [[:punct:]]* # start of title... |
7866 | 7866 | | [:.;?!][ ]+ # or of subsentence... |
7867 | 7867 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
7868 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
7868 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
7869 | 7869 | ~uxi', |
7870 | 7870 | /** |
7871 | 7871 | * @param string[] $matches |
7872 | 7872 | * |
7873 | 7873 | * @return string |
7874 | 7874 | */ |
7875 | - static function (array $matches) use ($encoding): string { |
|
7876 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
7875 | + static function(array $matches) use ($encoding): string { |
|
7876 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
7877 | 7877 | }, |
7878 | 7878 | $str |
7879 | 7879 | ); |
7880 | 7880 | |
7881 | 7881 | // ...and end of title |
7882 | - $str = (string) \preg_replace_callback( |
|
7883 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
7882 | + $str = (string)\preg_replace_callback( |
|
7883 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
7884 | 7884 | (?= [[:punct:]]* \Z # ...at the end of the title... |
7885 | 7885 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
7886 | 7886 | ~uxi', |
@@ -7889,7 +7889,7 @@ discard block |
||
7889 | 7889 | * |
7890 | 7890 | * @return string |
7891 | 7891 | */ |
7892 | - static function (array $matches) use ($encoding): string { |
|
7892 | + static function(array $matches) use ($encoding): string { |
|
7893 | 7893 | return static::ucfirst($matches[1], $encoding); |
7894 | 7894 | }, |
7895 | 7895 | $str |
@@ -7897,10 +7897,10 @@ discard block |
||
7897 | 7897 | |
7898 | 7898 | // Exceptions for small words in hyphenated compound words. |
7899 | 7899 | // e.g. "in-flight" -> In-Flight |
7900 | - $str = (string) \preg_replace_callback( |
|
7900 | + $str = (string)\preg_replace_callback( |
|
7901 | 7901 | '~\\b |
7902 | 7902 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
7903 | - ( ' . $small_words_rx . ' ) |
|
7903 | + ( ' . $small_words_rx.' ) |
|
7904 | 7904 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
7905 | 7905 | ~uxi', |
7906 | 7906 | /** |
@@ -7908,18 +7908,18 @@ discard block |
||
7908 | 7908 | * |
7909 | 7909 | * @return string |
7910 | 7910 | */ |
7911 | - static function (array $matches) use ($encoding): string { |
|
7911 | + static function(array $matches) use ($encoding): string { |
|
7912 | 7912 | return static::ucfirst($matches[1], $encoding); |
7913 | 7913 | }, |
7914 | 7914 | $str |
7915 | 7915 | ); |
7916 | 7916 | |
7917 | 7917 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
7918 | - $str = (string) \preg_replace_callback( |
|
7918 | + $str = (string)\preg_replace_callback( |
|
7919 | 7919 | '~\\b |
7920 | 7920 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
7921 | 7921 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
7922 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
7922 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
7923 | 7923 | (?! - ) # Negative lookahead for another - |
7924 | 7924 | ~uxi', |
7925 | 7925 | /** |
@@ -7927,8 +7927,8 @@ discard block |
||
7927 | 7927 | * |
7928 | 7928 | * @return string |
7929 | 7929 | */ |
7930 | - static function (array $matches) use ($encoding): string { |
|
7931 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
7930 | + static function(array $matches) use ($encoding): string { |
|
7931 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
7932 | 7932 | }, |
7933 | 7933 | $str |
7934 | 7934 | ); |
@@ -8037,7 +8037,7 @@ discard block |
||
8037 | 8037 | ); |
8038 | 8038 | |
8039 | 8039 | foreach ($tmp_return as &$item) { |
8040 | - $item = (string) $item; |
|
8040 | + $item = (string)$item; |
|
8041 | 8041 | } |
8042 | 8042 | |
8043 | 8043 | return $tmp_return; |
@@ -8086,39 +8086,39 @@ discard block |
||
8086 | 8086 | } |
8087 | 8087 | |
8088 | 8088 | if ($encoding === 'UTF-8') { |
8089 | - if ($length >= (int) \mb_strlen($str)) { |
|
8089 | + if ($length >= (int)\mb_strlen($str)) { |
|
8090 | 8090 | return $str; |
8091 | 8091 | } |
8092 | 8092 | |
8093 | 8093 | if ($substring !== '') { |
8094 | - $length -= (int) \mb_strlen($substring); |
|
8094 | + $length -= (int)\mb_strlen($substring); |
|
8095 | 8095 | |
8096 | 8096 | /** @noinspection UnnecessaryCastingInspection */ |
8097 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8097 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8098 | 8098 | } |
8099 | 8099 | |
8100 | 8100 | /** @noinspection UnnecessaryCastingInspection */ |
8101 | - return (string) \mb_substr($str, 0, $length); |
|
8101 | + return (string)\mb_substr($str, 0, $length); |
|
8102 | 8102 | } |
8103 | 8103 | |
8104 | 8104 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8105 | 8105 | |
8106 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8106 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8107 | 8107 | return $str; |
8108 | 8108 | } |
8109 | 8109 | |
8110 | 8110 | if ($substring !== '') { |
8111 | - $length -= (int) self::strlen($substring, $encoding); |
|
8111 | + $length -= (int)self::strlen($substring, $encoding); |
|
8112 | 8112 | } |
8113 | 8113 | |
8114 | 8114 | return ( |
8115 | - (string) self::substr( |
|
8115 | + (string)self::substr( |
|
8116 | 8116 | $str, |
8117 | 8117 | 0, |
8118 | 8118 | $length, |
8119 | 8119 | $encoding |
8120 | 8120 | ) |
8121 | - ) . $substring; |
|
8121 | + ).$substring; |
|
8122 | 8122 | } |
8123 | 8123 | |
8124 | 8124 | /** |
@@ -8148,12 +8148,12 @@ discard block |
||
8148 | 8148 | } |
8149 | 8149 | |
8150 | 8150 | if ($encoding === 'UTF-8') { |
8151 | - if ($length >= (int) \mb_strlen($str)) { |
|
8151 | + if ($length >= (int)\mb_strlen($str)) { |
|
8152 | 8152 | return $str; |
8153 | 8153 | } |
8154 | 8154 | |
8155 | 8155 | // need to further trim the string so we can append the substring |
8156 | - $length -= (int) \mb_strlen($substring); |
|
8156 | + $length -= (int)\mb_strlen($substring); |
|
8157 | 8157 | if ($length <= 0) { |
8158 | 8158 | return $substring; |
8159 | 8159 | } |
@@ -8175,18 +8175,18 @@ discard block |
||
8175 | 8175 | || |
8176 | 8176 | ($space_position !== false && $ignore_do_not_split_words_for_one_word === false) |
8177 | 8177 | ) { |
8178 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
8178 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
8179 | 8179 | } |
8180 | 8180 | } |
8181 | 8181 | } else { |
8182 | 8182 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8183 | 8183 | |
8184 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8184 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8185 | 8185 | return $str; |
8186 | 8186 | } |
8187 | 8187 | |
8188 | 8188 | // need to further trim the string so we can append the substring |
8189 | - $length -= (int) self::strlen($substring, $encoding); |
|
8189 | + $length -= (int)self::strlen($substring, $encoding); |
|
8190 | 8190 | if ($length <= 0) { |
8191 | 8191 | return $substring; |
8192 | 8192 | } |
@@ -8208,12 +8208,12 @@ discard block |
||
8208 | 8208 | || |
8209 | 8209 | ($space_position !== false && $ignore_do_not_split_words_for_one_word === false) |
8210 | 8210 | ) { |
8211 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
8211 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
8212 | 8212 | } |
8213 | 8213 | } |
8214 | 8214 | } |
8215 | 8215 | |
8216 | - return $truncated . $substring; |
|
8216 | + return $truncated.$substring; |
|
8217 | 8217 | } |
8218 | 8218 | |
8219 | 8219 | /** |
@@ -8310,13 +8310,13 @@ discard block |
||
8310 | 8310 | } |
8311 | 8311 | } elseif ($format === 2) { |
8312 | 8312 | $number_of_words = []; |
8313 | - $offset = (int) self::strlen($str_parts[0]); |
|
8313 | + $offset = (int)self::strlen($str_parts[0]); |
|
8314 | 8314 | for ($i = 1; $i < $len; $i += 2) { |
8315 | 8315 | $number_of_words[$offset] = $str_parts[$i]; |
8316 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
8316 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
8317 | 8317 | } |
8318 | 8318 | } else { |
8319 | - $number_of_words = (int) (($len - 1) / 2); |
|
8319 | + $number_of_words = (int)(($len - 1) / 2); |
|
8320 | 8320 | } |
8321 | 8321 | |
8322 | 8322 | return $number_of_words; |
@@ -8437,21 +8437,21 @@ discard block |
||
8437 | 8437 | } |
8438 | 8438 | |
8439 | 8439 | if ($char_list === '') { |
8440 | - return (int) self::strlen($str, $encoding); |
|
8440 | + return (int)self::strlen($str, $encoding); |
|
8441 | 8441 | } |
8442 | 8442 | |
8443 | 8443 | if ($offset !== null || $length !== null) { |
8444 | 8444 | if ($encoding === 'UTF-8') { |
8445 | 8445 | if ($length === null) { |
8446 | 8446 | /** @noinspection UnnecessaryCastingInspection */ |
8447 | - $str_tmp = \mb_substr($str, (int) $offset); |
|
8447 | + $str_tmp = \mb_substr($str, (int)$offset); |
|
8448 | 8448 | } else { |
8449 | 8449 | /** @noinspection UnnecessaryCastingInspection */ |
8450 | - $str_tmp = \mb_substr($str, (int) $offset, $length); |
|
8450 | + $str_tmp = \mb_substr($str, (int)$offset, $length); |
|
8451 | 8451 | } |
8452 | 8452 | } else { |
8453 | 8453 | /** @noinspection UnnecessaryCastingInspection */ |
8454 | - $str_tmp = self::substr($str, (int) $offset, $length, $encoding); |
|
8454 | + $str_tmp = self::substr($str, (int)$offset, $length, $encoding); |
|
8455 | 8455 | } |
8456 | 8456 | |
8457 | 8457 | if ($str_tmp === false) { |
@@ -8467,7 +8467,7 @@ discard block |
||
8467 | 8467 | } |
8468 | 8468 | |
8469 | 8469 | $matches = []; |
8470 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
8470 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
8471 | 8471 | $return = self::strlen($matches[1], $encoding); |
8472 | 8472 | if ($return === false) { |
8473 | 8473 | return 0; |
@@ -8476,7 +8476,7 @@ discard block |
||
8476 | 8476 | return $return; |
8477 | 8477 | } |
8478 | 8478 | |
8479 | - return (int) self::strlen($str, $encoding); |
|
8479 | + return (int)self::strlen($str, $encoding); |
|
8480 | 8480 | } |
8481 | 8481 | |
8482 | 8482 | /** |
@@ -8609,7 +8609,7 @@ discard block |
||
8609 | 8609 | return ''; |
8610 | 8610 | } |
8611 | 8611 | |
8612 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
8612 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
8613 | 8613 | } |
8614 | 8614 | |
8615 | 8615 | /** |
@@ -8674,7 +8674,7 @@ discard block |
||
8674 | 8674 | // fallback for ascii only |
8675 | 8675 | // |
8676 | 8676 | |
8677 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
8677 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
8678 | 8678 | return \stripos($haystack, $needle, $offset); |
8679 | 8679 | } |
8680 | 8680 | |
@@ -8742,7 +8742,7 @@ discard block |
||
8742 | 8742 | && |
8743 | 8743 | self::$SUPPORT['mbstring'] === false |
8744 | 8744 | ) { |
8745 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8745 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8746 | 8746 | } |
8747 | 8747 | |
8748 | 8748 | if ( |
@@ -8756,11 +8756,11 @@ discard block |
||
8756 | 8756 | } |
8757 | 8757 | } |
8758 | 8758 | |
8759 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
8759 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
8760 | 8760 | return \stristr($haystack, $needle, $before_needle); |
8761 | 8761 | } |
8762 | 8762 | |
8763 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
8763 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
8764 | 8764 | |
8765 | 8765 | if (!isset($match[1])) { |
8766 | 8766 | return false; |
@@ -8770,7 +8770,7 @@ discard block |
||
8770 | 8770 | return $match[1]; |
8771 | 8771 | } |
8772 | 8772 | |
8773 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
8773 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
8774 | 8774 | } |
8775 | 8775 | |
8776 | 8776 | /** |
@@ -8842,7 +8842,7 @@ discard block |
||
8842 | 8842 | && |
8843 | 8843 | self::$SUPPORT['iconv'] === false |
8844 | 8844 | ) { |
8845 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8845 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8846 | 8846 | } |
8847 | 8847 | |
8848 | 8848 | // |
@@ -8958,8 +8958,8 @@ discard block |
||
8958 | 8958 | } |
8959 | 8959 | |
8960 | 8960 | return \strnatcmp( |
8961 | - (string) self::strtonatfold($str1), |
|
8962 | - (string) self::strtonatfold($str2) |
|
8961 | + (string)self::strtonatfold($str1), |
|
8962 | + (string)self::strtonatfold($str2) |
|
8963 | 8963 | ); |
8964 | 8964 | } |
8965 | 8965 | |
@@ -9017,11 +9017,11 @@ discard block |
||
9017 | 9017 | } |
9018 | 9018 | |
9019 | 9019 | if ($encoding === 'UTF-8') { |
9020 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
9021 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
9020 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
9021 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
9022 | 9022 | } else { |
9023 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
9024 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
9023 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
9024 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
9025 | 9025 | } |
9026 | 9026 | |
9027 | 9027 | return self::strcmp($str1, $str2); |
@@ -9043,8 +9043,8 @@ discard block |
||
9043 | 9043 | return false; |
9044 | 9044 | } |
9045 | 9045 | |
9046 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
9047 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
9046 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
9047 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
9048 | 9048 | } |
9049 | 9049 | |
9050 | 9050 | return false; |
@@ -9077,10 +9077,10 @@ discard block |
||
9077 | 9077 | } |
9078 | 9078 | |
9079 | 9079 | // iconv and mbstring do not support integer $needle |
9080 | - if ((int) $needle === $needle) { |
|
9081 | - $needle = (string) self::chr($needle); |
|
9080 | + if ((int)$needle === $needle) { |
|
9081 | + $needle = (string)self::chr($needle); |
|
9082 | 9082 | } |
9083 | - $needle = (string) $needle; |
|
9083 | + $needle = (string)$needle; |
|
9084 | 9084 | |
9085 | 9085 | if ($needle === '') { |
9086 | 9086 | return false; |
@@ -9127,7 +9127,7 @@ discard block |
||
9127 | 9127 | && |
9128 | 9128 | self::$SUPPORT['mbstring'] === false |
9129 | 9129 | ) { |
9130 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9130 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9131 | 9131 | } |
9132 | 9132 | |
9133 | 9133 | // |
@@ -9168,7 +9168,7 @@ discard block |
||
9168 | 9168 | // fallback for ascii only |
9169 | 9169 | // |
9170 | 9170 | |
9171 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9171 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9172 | 9172 | return \strpos($haystack, $needle, $offset); |
9173 | 9173 | } |
9174 | 9174 | |
@@ -9180,7 +9180,7 @@ discard block |
||
9180 | 9180 | if ($haystack_tmp === false) { |
9181 | 9181 | $haystack_tmp = ''; |
9182 | 9182 | } |
9183 | - $haystack = (string) $haystack_tmp; |
|
9183 | + $haystack = (string)$haystack_tmp; |
|
9184 | 9184 | |
9185 | 9185 | if ($offset < 0) { |
9186 | 9186 | $offset = 0; |
@@ -9192,7 +9192,7 @@ discard block |
||
9192 | 9192 | } |
9193 | 9193 | |
9194 | 9194 | if ($pos) { |
9195 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9195 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9196 | 9196 | } |
9197 | 9197 | |
9198 | 9198 | return $offset + 0; |
@@ -9303,7 +9303,7 @@ discard block |
||
9303 | 9303 | && |
9304 | 9304 | self::$SUPPORT['mbstring'] === false |
9305 | 9305 | ) { |
9306 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9306 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9307 | 9307 | } |
9308 | 9308 | |
9309 | 9309 | // |
@@ -9315,7 +9315,7 @@ discard block |
||
9315 | 9315 | if ($needle_tmp === false) { |
9316 | 9316 | return false; |
9317 | 9317 | } |
9318 | - $needle = (string) $needle_tmp; |
|
9318 | + $needle = (string)$needle_tmp; |
|
9319 | 9319 | |
9320 | 9320 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
9321 | 9321 | if ($pos === false) { |
@@ -9337,7 +9337,7 @@ discard block |
||
9337 | 9337 | if ($needle_tmp === false) { |
9338 | 9338 | return false; |
9339 | 9339 | } |
9340 | - $needle = (string) $needle_tmp; |
|
9340 | + $needle = (string)$needle_tmp; |
|
9341 | 9341 | |
9342 | 9342 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
9343 | 9343 | if ($pos === false) { |
@@ -9373,7 +9373,7 @@ discard block |
||
9373 | 9373 | if ($encoding === 'UTF-8') { |
9374 | 9374 | if (self::$SUPPORT['intl'] === true) { |
9375 | 9375 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
9376 | - $i = (int) \grapheme_strlen($str); |
|
9376 | + $i = (int)\grapheme_strlen($str); |
|
9377 | 9377 | while ($i--) { |
9378 | 9378 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
9379 | 9379 | if ($reversed_tmp !== false) { |
@@ -9381,7 +9381,7 @@ discard block |
||
9381 | 9381 | } |
9382 | 9382 | } |
9383 | 9383 | } else { |
9384 | - $i = (int) \mb_strlen($str); |
|
9384 | + $i = (int)\mb_strlen($str); |
|
9385 | 9385 | while ($i--) { |
9386 | 9386 | $reversed_tmp = \mb_substr($str, $i, 1); |
9387 | 9387 | if ($reversed_tmp !== false) { |
@@ -9392,7 +9392,7 @@ discard block |
||
9392 | 9392 | } else { |
9393 | 9393 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9394 | 9394 | |
9395 | - $i = (int) self::strlen($str, $encoding); |
|
9395 | + $i = (int)self::strlen($str, $encoding); |
|
9396 | 9396 | while ($i--) { |
9397 | 9397 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
9398 | 9398 | if ($reversed_tmp !== false) { |
@@ -9466,7 +9466,7 @@ discard block |
||
9466 | 9466 | if ($needle_tmp === false) { |
9467 | 9467 | return false; |
9468 | 9468 | } |
9469 | - $needle = (string) $needle_tmp; |
|
9469 | + $needle = (string)$needle_tmp; |
|
9470 | 9470 | |
9471 | 9471 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
9472 | 9472 | if ($pos === false) { |
@@ -9505,10 +9505,10 @@ discard block |
||
9505 | 9505 | } |
9506 | 9506 | |
9507 | 9507 | // iconv and mbstring do not support integer $needle |
9508 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9509 | - $needle = (string) self::chr($needle); |
|
9508 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9509 | + $needle = (string)self::chr($needle); |
|
9510 | 9510 | } |
9511 | - $needle = (string) $needle; |
|
9511 | + $needle = (string)$needle; |
|
9512 | 9512 | |
9513 | 9513 | if ($needle === '') { |
9514 | 9514 | return false; |
@@ -9553,7 +9553,7 @@ discard block |
||
9553 | 9553 | && |
9554 | 9554 | self::$SUPPORT['mbstring'] === false |
9555 | 9555 | ) { |
9556 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9556 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9557 | 9557 | } |
9558 | 9558 | |
9559 | 9559 | // |
@@ -9577,7 +9577,7 @@ discard block |
||
9577 | 9577 | // fallback for ascii only |
9578 | 9578 | // |
9579 | 9579 | |
9580 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9580 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9581 | 9581 | return \strripos($haystack, $needle, $offset); |
9582 | 9582 | } |
9583 | 9583 | |
@@ -9654,10 +9654,10 @@ discard block |
||
9654 | 9654 | } |
9655 | 9655 | |
9656 | 9656 | // iconv and mbstring do not support integer $needle |
9657 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9658 | - $needle = (string) self::chr($needle); |
|
9657 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9658 | + $needle = (string)self::chr($needle); |
|
9659 | 9659 | } |
9660 | - $needle = (string) $needle; |
|
9660 | + $needle = (string)$needle; |
|
9661 | 9661 | |
9662 | 9662 | if ($needle === '') { |
9663 | 9663 | return false; |
@@ -9702,7 +9702,7 @@ discard block |
||
9702 | 9702 | && |
9703 | 9703 | self::$SUPPORT['mbstring'] === false |
9704 | 9704 | ) { |
9705 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9705 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9706 | 9706 | } |
9707 | 9707 | |
9708 | 9708 | // |
@@ -9726,7 +9726,7 @@ discard block |
||
9726 | 9726 | // fallback for ascii only |
9727 | 9727 | // |
9728 | 9728 | |
9729 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9729 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9730 | 9730 | return \strrpos($haystack, $needle, $offset); |
9731 | 9731 | } |
9732 | 9732 | |
@@ -9746,7 +9746,7 @@ discard block |
||
9746 | 9746 | if ($haystack_tmp === false) { |
9747 | 9747 | $haystack_tmp = ''; |
9748 | 9748 | } |
9749 | - $haystack = (string) $haystack_tmp; |
|
9749 | + $haystack = (string)$haystack_tmp; |
|
9750 | 9750 | } |
9751 | 9751 | |
9752 | 9752 | $pos = \strrpos($haystack, $needle); |
@@ -9760,7 +9760,7 @@ discard block |
||
9760 | 9760 | return false; |
9761 | 9761 | } |
9762 | 9762 | |
9763 | - return $offset + (int) self::strlen($str_tmp); |
|
9763 | + return $offset + (int)self::strlen($str_tmp); |
|
9764 | 9764 | } |
9765 | 9765 | |
9766 | 9766 | /** |
@@ -9822,12 +9822,12 @@ discard block |
||
9822 | 9822 | if ($offset || $length !== null) { |
9823 | 9823 | if ($encoding === 'UTF-8') { |
9824 | 9824 | if ($length === null) { |
9825 | - $str = (string) \mb_substr($str, $offset); |
|
9825 | + $str = (string)\mb_substr($str, $offset); |
|
9826 | 9826 | } else { |
9827 | - $str = (string) \mb_substr($str, $offset, $length); |
|
9827 | + $str = (string)\mb_substr($str, $offset, $length); |
|
9828 | 9828 | } |
9829 | 9829 | } else { |
9830 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
9830 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
9831 | 9831 | } |
9832 | 9832 | } |
9833 | 9833 | |
@@ -9837,7 +9837,7 @@ discard block |
||
9837 | 9837 | |
9838 | 9838 | $matches = []; |
9839 | 9839 | |
9840 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
9840 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
9841 | 9841 | } |
9842 | 9842 | |
9843 | 9843 | /** |
@@ -9906,7 +9906,7 @@ discard block |
||
9906 | 9906 | && |
9907 | 9907 | self::$SUPPORT['mbstring'] === false |
9908 | 9908 | ) { |
9909 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9909 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9910 | 9910 | } |
9911 | 9911 | |
9912 | 9912 | // |
@@ -9928,7 +9928,7 @@ discard block |
||
9928 | 9928 | // fallback for ascii only |
9929 | 9929 | // |
9930 | 9930 | |
9931 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9931 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9932 | 9932 | return \strstr($haystack, $needle, $before_needle); |
9933 | 9933 | } |
9934 | 9934 | |
@@ -9936,7 +9936,7 @@ discard block |
||
9936 | 9936 | // fallback via vanilla php |
9937 | 9937 | // |
9938 | 9938 | |
9939 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
9939 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
9940 | 9940 | |
9941 | 9941 | if (!isset($match[1])) { |
9942 | 9942 | return false; |
@@ -9946,7 +9946,7 @@ discard block |
||
9946 | 9946 | return $match[1]; |
9947 | 9947 | } |
9948 | 9948 | |
9949 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
9949 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
9950 | 9950 | } |
9951 | 9951 | |
9952 | 9952 | /** |
@@ -10064,7 +10064,7 @@ discard block |
||
10064 | 10064 | bool $try_to_keep_the_string_length = false |
10065 | 10065 | ): string { |
10066 | 10066 | // init |
10067 | - $str = (string) $str; |
|
10067 | + $str = (string)$str; |
|
10068 | 10068 | |
10069 | 10069 | if ($str === '') { |
10070 | 10070 | return ''; |
@@ -10093,19 +10093,19 @@ discard block |
||
10093 | 10093 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10094 | 10094 | } |
10095 | 10095 | |
10096 | - $language_code = $lang . '-Lower'; |
|
10096 | + $language_code = $lang.'-Lower'; |
|
10097 | 10097 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10098 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
10098 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
10099 | 10099 | |
10100 | 10100 | $language_code = 'Any-Lower'; |
10101 | 10101 | } |
10102 | 10102 | |
10103 | 10103 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10104 | 10104 | /** @noinspection UnnecessaryCastingInspection */ |
10105 | - return (string) \transliterator_transliterate($language_code, $str); |
|
10105 | + return (string)\transliterator_transliterate($language_code, $str); |
|
10106 | 10106 | } |
10107 | 10107 | |
10108 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
10108 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
10109 | 10109 | } |
10110 | 10110 | |
10111 | 10111 | // always fallback via symfony polyfill |
@@ -10134,7 +10134,7 @@ discard block |
||
10134 | 10134 | bool $try_to_keep_the_string_length = false |
10135 | 10135 | ): string { |
10136 | 10136 | // init |
10137 | - $str = (string) $str; |
|
10137 | + $str = (string)$str; |
|
10138 | 10138 | |
10139 | 10139 | if ($str === '') { |
10140 | 10140 | return ''; |
@@ -10163,19 +10163,19 @@ discard block |
||
10163 | 10163 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10164 | 10164 | } |
10165 | 10165 | |
10166 | - $language_code = $lang . '-Upper'; |
|
10166 | + $language_code = $lang.'-Upper'; |
|
10167 | 10167 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10168 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
10168 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
10169 | 10169 | |
10170 | 10170 | $language_code = 'Any-Upper'; |
10171 | 10171 | } |
10172 | 10172 | |
10173 | 10173 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10174 | 10174 | /** @noinspection UnnecessaryCastingInspection */ |
10175 | - return (string) \transliterator_transliterate($language_code, $str); |
|
10175 | + return (string)\transliterator_transliterate($language_code, $str); |
|
10176 | 10176 | } |
10177 | 10177 | |
10178 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
10178 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
10179 | 10179 | } |
10180 | 10180 | |
10181 | 10181 | // always fallback via symfony polyfill |
@@ -10220,7 +10220,7 @@ discard block |
||
10220 | 10220 | $from = \array_combine($from, $to); |
10221 | 10221 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
10222 | 10222 | if ($from === false) { |
10223 | - 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) . ')'); |
|
10223 | + 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 | 10224 | } |
10225 | 10225 | } |
10226 | 10226 | |
@@ -10280,9 +10280,9 @@ discard block |
||
10280 | 10280 | } |
10281 | 10281 | |
10282 | 10282 | $wide = 0; |
10283 | - $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); |
|
10283 | + $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 | 10284 | |
10285 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
10285 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
10286 | 10286 | } |
10287 | 10287 | |
10288 | 10288 | /** |
@@ -10382,9 +10382,9 @@ discard block |
||
10382 | 10382 | } |
10383 | 10383 | |
10384 | 10384 | if ($length === null) { |
10385 | - $length = (int) $str_length; |
|
10385 | + $length = (int)$str_length; |
|
10386 | 10386 | } else { |
10387 | - $length = (int) $length; |
|
10387 | + $length = (int)$length; |
|
10388 | 10388 | } |
10389 | 10389 | |
10390 | 10390 | if ( |
@@ -10392,7 +10392,7 @@ discard block |
||
10392 | 10392 | && |
10393 | 10393 | self::$SUPPORT['mbstring'] === false |
10394 | 10394 | ) { |
10395 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10395 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10396 | 10396 | } |
10397 | 10397 | |
10398 | 10398 | // |
@@ -10480,16 +10480,16 @@ discard block |
||
10480 | 10480 | ) { |
10481 | 10481 | if ($encoding === 'UTF-8') { |
10482 | 10482 | if ($length === null) { |
10483 | - $str1 = (string) \mb_substr($str1, $offset); |
|
10483 | + $str1 = (string)\mb_substr($str1, $offset); |
|
10484 | 10484 | } else { |
10485 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
10485 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
10486 | 10486 | } |
10487 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
10487 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
10488 | 10488 | } else { |
10489 | 10489 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10490 | 10490 | |
10491 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
10492 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
10491 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
10492 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
10493 | 10493 | } |
10494 | 10494 | } |
10495 | 10495 | |
@@ -10551,13 +10551,13 @@ discard block |
||
10551 | 10551 | if ($length_tmp === false) { |
10552 | 10552 | return false; |
10553 | 10553 | } |
10554 | - $length = (int) $length_tmp; |
|
10554 | + $length = (int)$length_tmp; |
|
10555 | 10555 | } |
10556 | 10556 | |
10557 | 10557 | if ($encoding === 'UTF-8') { |
10558 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
10558 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
10559 | 10559 | } else { |
10560 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
10560 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
10561 | 10561 | } |
10562 | 10562 | } |
10563 | 10563 | |
@@ -10566,7 +10566,7 @@ discard block |
||
10566 | 10566 | && |
10567 | 10567 | self::$SUPPORT['mbstring'] === false |
10568 | 10568 | ) { |
10569 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10569 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10570 | 10570 | } |
10571 | 10571 | |
10572 | 10572 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10577,7 +10577,7 @@ discard block |
||
10577 | 10577 | return \mb_substr_count($haystack, $needle, $encoding); |
10578 | 10578 | } |
10579 | 10579 | |
10580 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10580 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10581 | 10581 | |
10582 | 10582 | return \count($matches); |
10583 | 10583 | } |
@@ -10624,7 +10624,7 @@ discard block |
||
10624 | 10624 | if ($length_tmp === false) { |
10625 | 10625 | return false; |
10626 | 10626 | } |
10627 | - $length = (int) $length_tmp; |
|
10627 | + $length = (int)$length_tmp; |
|
10628 | 10628 | } |
10629 | 10629 | |
10630 | 10630 | if ( |
@@ -10646,7 +10646,7 @@ discard block |
||
10646 | 10646 | if ($haystack_tmp === false) { |
10647 | 10647 | $haystack_tmp = ''; |
10648 | 10648 | } |
10649 | - $haystack = (string) $haystack_tmp; |
|
10649 | + $haystack = (string)$haystack_tmp; |
|
10650 | 10650 | } |
10651 | 10651 | |
10652 | 10652 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10685,10 +10685,10 @@ discard block |
||
10685 | 10685 | |
10686 | 10686 | if ($encoding === 'UTF-8') { |
10687 | 10687 | if ($case_sensitive) { |
10688 | - return (int) \mb_substr_count($str, $substring); |
|
10688 | + return (int)\mb_substr_count($str, $substring); |
|
10689 | 10689 | } |
10690 | 10690 | |
10691 | - return (int) \mb_substr_count( |
|
10691 | + return (int)\mb_substr_count( |
|
10692 | 10692 | \mb_strtoupper($str), |
10693 | 10693 | \mb_strtoupper($substring) |
10694 | 10694 | ); |
@@ -10697,10 +10697,10 @@ discard block |
||
10697 | 10697 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10698 | 10698 | |
10699 | 10699 | if ($case_sensitive) { |
10700 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
10700 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
10701 | 10701 | } |
10702 | 10702 | |
10703 | - return (int) \mb_substr_count( |
|
10703 | + return (int)\mb_substr_count( |
|
10704 | 10704 | self::strtocasefold($str, true, false, $encoding, null, false), |
10705 | 10705 | self::strtocasefold($substring, true, false, $encoding, null, false), |
10706 | 10706 | $encoding |
@@ -10726,7 +10726,7 @@ discard block |
||
10726 | 10726 | } |
10727 | 10727 | |
10728 | 10728 | if (self::str_istarts_with($haystack, $needle) === true) { |
10729 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10729 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10730 | 10730 | } |
10731 | 10731 | |
10732 | 10732 | return $haystack; |
@@ -10783,7 +10783,7 @@ discard block |
||
10783 | 10783 | } |
10784 | 10784 | |
10785 | 10785 | if (self::str_iends_with($haystack, $needle) === true) { |
10786 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
10786 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
10787 | 10787 | } |
10788 | 10788 | |
10789 | 10789 | return $haystack; |
@@ -10808,7 +10808,7 @@ discard block |
||
10808 | 10808 | } |
10809 | 10809 | |
10810 | 10810 | if (self::str_starts_with($haystack, $needle) === true) { |
10811 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10811 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10812 | 10812 | } |
10813 | 10813 | |
10814 | 10814 | return $haystack; |
@@ -10860,7 +10860,7 @@ discard block |
||
10860 | 10860 | if (\is_array($offset) === true) { |
10861 | 10861 | $offset = \array_slice($offset, 0, $num); |
10862 | 10862 | foreach ($offset as &$value_tmp) { |
10863 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
10863 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
10864 | 10864 | } |
10865 | 10865 | unset($value_tmp); |
10866 | 10866 | } else { |
@@ -10873,7 +10873,7 @@ discard block |
||
10873 | 10873 | } elseif (\is_array($length) === true) { |
10874 | 10874 | $length = \array_slice($length, 0, $num); |
10875 | 10875 | foreach ($length as &$value_tmp_V2) { |
10876 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
10876 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
10877 | 10877 | } |
10878 | 10878 | unset($value_tmp_V2); |
10879 | 10879 | } else { |
@@ -10893,8 +10893,8 @@ discard block |
||
10893 | 10893 | } |
10894 | 10894 | |
10895 | 10895 | // init |
10896 | - $str = (string) $str; |
|
10897 | - $replacement = (string) $replacement; |
|
10896 | + $str = (string)$str; |
|
10897 | + $replacement = (string)$replacement; |
|
10898 | 10898 | |
10899 | 10899 | if (\is_array($length) === true) { |
10900 | 10900 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -10909,16 +10909,16 @@ discard block |
||
10909 | 10909 | } |
10910 | 10910 | |
10911 | 10911 | if (self::$SUPPORT['mbstring'] === true) { |
10912 | - $string_length = (int) self::strlen($str, $encoding); |
|
10912 | + $string_length = (int)self::strlen($str, $encoding); |
|
10913 | 10913 | |
10914 | 10914 | if ($offset < 0) { |
10915 | - $offset = (int) \max(0, $string_length + $offset); |
|
10915 | + $offset = (int)\max(0, $string_length + $offset); |
|
10916 | 10916 | } elseif ($offset > $string_length) { |
10917 | 10917 | $offset = $string_length; |
10918 | 10918 | } |
10919 | 10919 | |
10920 | 10920 | if ($length !== null && $length < 0) { |
10921 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
10921 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
10922 | 10922 | } elseif ($length === null || $length > $string_length) { |
10923 | 10923 | $length = $string_length; |
10924 | 10924 | } |
@@ -10929,9 +10929,9 @@ discard block |
||
10929 | 10929 | } |
10930 | 10930 | |
10931 | 10931 | /** @noinspection AdditionOperationOnArraysInspection */ |
10932 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
10933 | - $replacement . |
|
10934 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10932 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
10933 | + $replacement. |
|
10934 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10935 | 10935 | } |
10936 | 10936 | |
10937 | 10937 | // |
@@ -10940,8 +10940,7 @@ discard block |
||
10940 | 10940 | |
10941 | 10941 | if (ASCII::is_ascii($str)) { |
10942 | 10942 | return ($length === null) ? |
10943 | - \substr_replace($str, $replacement, $offset) : |
|
10944 | - \substr_replace($str, $replacement, $offset, $length); |
|
10943 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
10945 | 10944 | } |
10946 | 10945 | |
10947 | 10946 | // |
@@ -10957,7 +10956,7 @@ discard block |
||
10957 | 10956 | // e.g.: non mbstring support + invalid chars |
10958 | 10957 | return ''; |
10959 | 10958 | } |
10960 | - $length = (int) $length_tmp; |
|
10959 | + $length = (int)$length_tmp; |
|
10961 | 10960 | } |
10962 | 10961 | |
10963 | 10962 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -10992,14 +10991,14 @@ discard block |
||
10992 | 10991 | && |
10993 | 10992 | \substr($haystack, -\strlen($needle)) === $needle |
10994 | 10993 | ) { |
10995 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
10994 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
10996 | 10995 | } |
10997 | 10996 | |
10998 | 10997 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
10999 | - return (string) self::substr( |
|
10998 | + return (string)self::substr( |
|
11000 | 10999 | $haystack, |
11001 | 11000 | 0, |
11002 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
11001 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
11003 | 11002 | $encoding |
11004 | 11003 | ); |
11005 | 11004 | } |
@@ -11029,10 +11028,10 @@ discard block |
||
11029 | 11028 | } |
11030 | 11029 | |
11031 | 11030 | if ($encoding === 'UTF-8') { |
11032 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
11031 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
11033 | 11032 | } |
11034 | 11033 | |
11035 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
11034 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
11036 | 11035 | } |
11037 | 11036 | |
11038 | 11037 | /** |
@@ -11216,7 +11215,7 @@ discard block |
||
11216 | 11215 | public static function to_boolean($str): bool |
11217 | 11216 | { |
11218 | 11217 | // init |
11219 | - $str = (string) $str; |
|
11218 | + $str = (string)$str; |
|
11220 | 11219 | |
11221 | 11220 | if ($str === '') { |
11222 | 11221 | return false; |
@@ -11244,10 +11243,10 @@ discard block |
||
11244 | 11243 | } |
11245 | 11244 | |
11246 | 11245 | if (\is_numeric($str)) { |
11247 | - return ((float) $str + 0) > 0; |
|
11246 | + return ((float)$str + 0) > 0; |
|
11248 | 11247 | } |
11249 | 11248 | |
11250 | - return (bool) \trim($str); |
|
11249 | + return (bool)\trim($str); |
|
11251 | 11250 | } |
11252 | 11251 | |
11253 | 11252 | /** |
@@ -11289,7 +11288,7 @@ discard block |
||
11289 | 11288 | return $str; |
11290 | 11289 | } |
11291 | 11290 | |
11292 | - $str = (string) $str; |
|
11291 | + $str = (string)$str; |
|
11293 | 11292 | if ($str === '') { |
11294 | 11293 | return ''; |
11295 | 11294 | } |
@@ -11337,7 +11336,7 @@ discard block |
||
11337 | 11336 | return $str; |
11338 | 11337 | } |
11339 | 11338 | |
11340 | - $str = (string) $str; |
|
11339 | + $str = (string)$str; |
|
11341 | 11340 | if ($str === '') { |
11342 | 11341 | return $str; |
11343 | 11342 | } |
@@ -11355,7 +11354,7 @@ discard block |
||
11355 | 11354 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
11356 | 11355 | |
11357 | 11356 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11358 | - $buf .= $c1 . $c2; |
|
11357 | + $buf .= $c1.$c2; |
|
11359 | 11358 | ++$i; |
11360 | 11359 | } else { // not valid UTF8 - convert it |
11361 | 11360 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11366,7 +11365,7 @@ discard block |
||
11366 | 11365 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
11367 | 11366 | |
11368 | 11367 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11369 | - $buf .= $c1 . $c2 . $c3; |
|
11368 | + $buf .= $c1.$c2.$c3; |
|
11370 | 11369 | $i += 2; |
11371 | 11370 | } else { // not valid UTF8 - convert it |
11372 | 11371 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11378,7 +11377,7 @@ discard block |
||
11378 | 11377 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
11379 | 11378 | |
11380 | 11379 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11381 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
11380 | + $buf .= $c1.$c2.$c3.$c4; |
|
11382 | 11381 | $i += 3; |
11383 | 11382 | } else { // not valid UTF8 - convert it |
11384 | 11383 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11404,13 +11403,13 @@ discard block |
||
11404 | 11403 | * |
11405 | 11404 | * @return string |
11406 | 11405 | */ |
11407 | - static function (array $matches): string { |
|
11406 | + static function(array $matches): string { |
|
11408 | 11407 | if (isset($matches[3])) { |
11409 | - $cp = (int) \hexdec($matches[3]); |
|
11408 | + $cp = (int)\hexdec($matches[3]); |
|
11410 | 11409 | } else { |
11411 | 11410 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
11412 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
11413 | - + (int) \hexdec($matches[2]) |
|
11411 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
11412 | + + (int)\hexdec($matches[2]) |
|
11414 | 11413 | + 0x10000 |
11415 | 11414 | - (0xD800 << 10) |
11416 | 11415 | - 0xDC00; |
@@ -11421,12 +11420,12 @@ discard block |
||
11421 | 11420 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
11422 | 11421 | |
11423 | 11422 | if ($cp < 0x80) { |
11424 | - return (string) self::chr($cp); |
|
11423 | + return (string)self::chr($cp); |
|
11425 | 11424 | } |
11426 | 11425 | |
11427 | 11426 | if ($cp < 0xA0) { |
11428 | 11427 | /** @noinspection UnnecessaryCastingInspection */ |
11429 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
11428 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
11430 | 11429 | } |
11431 | 11430 | |
11432 | 11431 | return self::decimal_to_chr($cp); |
@@ -11475,7 +11474,7 @@ discard block |
||
11475 | 11474 | } |
11476 | 11475 | |
11477 | 11476 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11478 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
11477 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
11479 | 11478 | } |
11480 | 11479 | |
11481 | 11480 | if ($chars) { |
@@ -11519,15 +11518,15 @@ discard block |
||
11519 | 11518 | $use_mb_functions = $lang === null && $try_to_keep_the_string_length === false; |
11520 | 11519 | |
11521 | 11520 | if ($encoding === 'UTF-8') { |
11522 | - $str_part_two = (string) \mb_substr($str, 1); |
|
11521 | + $str_part_two = (string)\mb_substr($str, 1); |
|
11523 | 11522 | |
11524 | 11523 | if ($use_mb_functions === true) { |
11525 | 11524 | $str_part_one = \mb_strtoupper( |
11526 | - (string) \mb_substr($str, 0, 1) |
|
11525 | + (string)\mb_substr($str, 0, 1) |
|
11527 | 11526 | ); |
11528 | 11527 | } else { |
11529 | 11528 | $str_part_one = self::strtoupper( |
11530 | - (string) \mb_substr($str, 0, 1), |
|
11529 | + (string)\mb_substr($str, 0, 1), |
|
11531 | 11530 | $encoding, |
11532 | 11531 | false, |
11533 | 11532 | $lang, |
@@ -11537,16 +11536,16 @@ discard block |
||
11537 | 11536 | } else { |
11538 | 11537 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11539 | 11538 | |
11540 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
11539 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
11541 | 11540 | |
11542 | 11541 | if ($use_mb_functions === true) { |
11543 | 11542 | $str_part_one = \mb_strtoupper( |
11544 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
11543 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
11545 | 11544 | $encoding |
11546 | 11545 | ); |
11547 | 11546 | } else { |
11548 | 11547 | $str_part_one = self::strtoupper( |
11549 | - (string) self::substr($str, 0, 1, $encoding), |
|
11548 | + (string)self::substr($str, 0, 1, $encoding), |
|
11550 | 11549 | $encoding, |
11551 | 11550 | false, |
11552 | 11551 | $lang, |
@@ -11555,7 +11554,7 @@ discard block |
||
11555 | 11554 | } |
11556 | 11555 | } |
11557 | 11556 | |
11558 | - return $str_part_one . $str_part_two; |
|
11557 | + return $str_part_one.$str_part_two; |
|
11559 | 11558 | } |
11560 | 11559 | |
11561 | 11560 | /** |
@@ -11610,7 +11609,7 @@ discard block |
||
11610 | 11609 | $str = self::clean($str); |
11611 | 11610 | } |
11612 | 11611 | |
11613 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
11612 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
11614 | 11613 | |
11615 | 11614 | if ( |
11616 | 11615 | $use_php_default_functions === true |
@@ -11998,7 +11997,7 @@ discard block |
||
11998 | 11997 | if ( |
11999 | 11998 | $keep_utf8_chars === true |
12000 | 11999 | && |
12001 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
12000 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
12002 | 12001 | ) { |
12003 | 12002 | return $str_backup; |
12004 | 12003 | } |
@@ -12077,17 +12076,17 @@ discard block |
||
12077 | 12076 | return ''; |
12078 | 12077 | } |
12079 | 12078 | |
12080 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
12079 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
12081 | 12080 | |
12082 | 12081 | if ( |
12083 | 12082 | !isset($matches[0]) |
12084 | 12083 | || |
12085 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
12084 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
12086 | 12085 | ) { |
12087 | 12086 | return $str; |
12088 | 12087 | } |
12089 | 12088 | |
12090 | - return \rtrim($matches[0]) . $str_add_on; |
|
12089 | + return \rtrim($matches[0]).$str_add_on; |
|
12091 | 12090 | } |
12092 | 12091 | |
12093 | 12092 | /** |
@@ -12174,7 +12173,7 @@ discard block |
||
12174 | 12173 | } |
12175 | 12174 | } |
12176 | 12175 | |
12177 | - return $str_return . \implode('', $chars); |
|
12176 | + return $str_return.\implode('', $chars); |
|
12178 | 12177 | } |
12179 | 12178 | |
12180 | 12179 | /** |
@@ -12226,7 +12225,7 @@ discard block |
||
12226 | 12225 | $final_break = ''; |
12227 | 12226 | } |
12228 | 12227 | |
12229 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
12228 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
12230 | 12229 | } |
12231 | 12230 | |
12232 | 12231 | /** |
@@ -12448,7 +12447,7 @@ discard block |
||
12448 | 12447 | /** @noinspection PhpIncludeInspection */ |
12449 | 12448 | /** @noinspection UsingInclusionReturnValueInspection */ |
12450 | 12449 | /** @psalm-suppress UnresolvableInclude */ |
12451 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
12450 | + return include __DIR__.'/data/'.$file.'.php'; |
|
12452 | 12451 | } |
12453 | 12452 | |
12454 | 12453 | /** |
@@ -12463,7 +12462,7 @@ discard block |
||
12463 | 12462 | |
12464 | 12463 | \uksort( |
12465 | 12464 | self::$EMOJI, |
12466 | - static function (string $a, string $b): int { |
|
12465 | + static function(string $a, string $b): int { |
|
12467 | 12466 | return \strlen($b) <=> \strlen($a); |
12468 | 12467 | } |
12469 | 12468 | ); |
@@ -12473,7 +12472,7 @@ discard block |
||
12473 | 12472 | |
12474 | 12473 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
12475 | 12474 | $tmp_key = \crc32($key); |
12476 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
12475 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
12477 | 12476 | } |
12478 | 12477 | |
12479 | 12478 | return true; |
@@ -12499,7 +12498,7 @@ discard block |
||
12499 | 12498 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
12500 | 12499 | return \defined('MB_OVERLOAD_STRING') |
12501 | 12500 | && |
12502 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12501 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12503 | 12502 | } |
12504 | 12503 | |
12505 | 12504 | /** |
@@ -12556,7 +12555,7 @@ discard block |
||
12556 | 12555 | { |
12557 | 12556 | static $RX_CLASS_CACHE = []; |
12558 | 12557 | |
12559 | - $cache_key = $s . $class; |
|
12558 | + $cache_key = $s.$class; |
|
12560 | 12559 | |
12561 | 12560 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
12562 | 12561 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -12568,7 +12567,7 @@ discard block |
||
12568 | 12567 | /** @noinspection AlterInForeachInspection */ |
12569 | 12568 | foreach (self::str_split($s) as &$s) { |
12570 | 12569 | if ($s === '-') { |
12571 | - $class_array[0] = '-' . $class_array[0]; |
|
12570 | + $class_array[0] = '-'.$class_array[0]; |
|
12572 | 12571 | } elseif (!isset($s[2])) { |
12573 | 12572 | $class_array[0] .= \preg_quote($s, '/'); |
12574 | 12573 | } elseif (self::strlen($s) === 1) { |
@@ -12579,13 +12578,13 @@ discard block |
||
12579 | 12578 | } |
12580 | 12579 | |
12581 | 12580 | if ($class_array[0]) { |
12582 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
12581 | + $class_array[0] = '['.$class_array[0].']'; |
|
12583 | 12582 | } |
12584 | 12583 | |
12585 | 12584 | if (\count($class_array) === 1) { |
12586 | 12585 | $return = $class_array[0]; |
12587 | 12586 | } else { |
12588 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
12587 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
12589 | 12588 | } |
12590 | 12589 | |
12591 | 12590 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -12664,7 +12663,7 @@ discard block |
||
12664 | 12663 | |
12665 | 12664 | if ($delimiter === '-') { |
12666 | 12665 | /** @noinspection AlterInForeachInspection */ |
12667 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
12666 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
12668 | 12667 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12669 | 12668 | $continue = true; |
12670 | 12669 | } |
@@ -12672,7 +12671,7 @@ discard block |
||
12672 | 12671 | } |
12673 | 12672 | |
12674 | 12673 | /** @noinspection AlterInForeachInspection */ |
12675 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
12674 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
12676 | 12675 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12677 | 12676 | $continue = true; |
12678 | 12677 | } |
@@ -12735,8 +12734,8 @@ discard block |
||
12735 | 12734 | } else { |
12736 | 12735 | /** @noinspection OffsetOperationsInspection */ |
12737 | 12736 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
12738 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
12739 | - $buf .= $cc1 . $cc2; |
|
12737 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
12738 | + $buf .= $cc1.$cc2; |
|
12740 | 12739 | } |
12741 | 12740 | |
12742 | 12741 | return $buf; |
@@ -12753,7 +12752,7 @@ discard block |
||
12753 | 12752 | { |
12754 | 12753 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
12755 | 12754 | if (\preg_match($pattern, $str)) { |
12756 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
12755 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
12757 | 12756 | } |
12758 | 12757 | |
12759 | 12758 | return $str; |