@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | } |
261 | 261 | |
262 | 262 | if ($encoding === 'UTF-8') { |
263 | - return (string) \mb_substr($str, $pos, 1); |
|
263 | + return (string)\mb_substr($str, $pos, 1); |
|
264 | 264 | } |
265 | 265 | |
266 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
266 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | public static function add_bom_to_string(string $str): string |
279 | 279 | { |
280 | 280 | if (self::string_has_bom($str) === false) { |
281 | - $str = self::bom() . $str; |
|
281 | + $str = self::bom().$str; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | return $str; |
@@ -307,8 +307,8 @@ discard block |
||
307 | 307 | $return = []; |
308 | 308 | foreach ($array as $key => &$value) { |
309 | 309 | $key = $case === \CASE_LOWER |
310 | - ? self::strtolower((string) $key, $encoding) |
|
311 | - : self::strtoupper((string) $key, $encoding); |
|
310 | + ? self::strtolower((string)$key, $encoding) |
|
311 | + : self::strtoupper((string)$key, $encoding); |
|
312 | 312 | |
313 | 313 | $return[$key] = $value; |
314 | 314 | } |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | return ''; |
343 | 343 | } |
344 | 344 | |
345 | - $substrIndex = $posStart + (int) \mb_strlen($start); |
|
345 | + $substrIndex = $posStart + (int)\mb_strlen($start); |
|
346 | 346 | $posEnd = \mb_strpos($str, $end, $substrIndex); |
347 | 347 | if ( |
348 | 348 | $posEnd === false |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | return ''; |
353 | 353 | } |
354 | 354 | |
355 | - return (string) \mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
355 | + return (string)\mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | return ''; |
363 | 363 | } |
364 | 364 | |
365 | - $substrIndex = $posStart + (int) self::strlen($start, $encoding); |
|
365 | + $substrIndex = $posStart + (int)self::strlen($start, $encoding); |
|
366 | 366 | $posEnd = self::strpos($str, $end, $substrIndex, $encoding); |
367 | 367 | if ( |
368 | 368 | $posEnd === false |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | return ''; |
373 | 373 | } |
374 | 374 | |
375 | - return (string) self::substr( |
|
375 | + return (string)self::substr( |
|
376 | 376 | $str, |
377 | 377 | $substrIndex, |
378 | 378 | $posEnd - $substrIndex, |
@@ -440,10 +440,10 @@ discard block |
||
440 | 440 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
441 | 441 | { |
442 | 442 | if ($encoding === 'UTF-8') { |
443 | - return (string) \mb_substr($str, $index, 1); |
|
443 | + return (string)\mb_substr($str, $index, 1); |
|
444 | 444 | } |
445 | 445 | |
446 | - return (string) self::substr($str, $index, 1, $encoding); |
|
446 | + return (string)self::substr($str, $index, 1, $encoding); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
@@ -542,10 +542,10 @@ discard block |
||
542 | 542 | && |
543 | 543 | self::$SUPPORT['mbstring'] === false |
544 | 544 | ) { |
545 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
545 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
546 | 546 | } |
547 | 547 | |
548 | - $cacheKey = $code_point . $encoding; |
|
548 | + $cacheKey = $code_point.$encoding; |
|
549 | 549 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
550 | 550 | return $CHAR_CACHE[$cacheKey]; |
551 | 551 | } |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | self::$CHR = self::getData('chr'); |
592 | 592 | } |
593 | 593 | |
594 | - $code_point = (int) $code_point; |
|
594 | + $code_point = (int)$code_point; |
|
595 | 595 | if ($code_point <= 0x7F) { |
596 | 596 | /** |
597 | 597 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -601,22 +601,22 @@ discard block |
||
601 | 601 | /** |
602 | 602 | * @psalm-suppress PossiblyNullArrayAccess |
603 | 603 | */ |
604 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
604 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
605 | 605 | self::$CHR[($code_point & 0x3F) + 0x80]; |
606 | 606 | } elseif ($code_point <= 0xFFFF) { |
607 | 607 | /** |
608 | 608 | * @psalm-suppress PossiblyNullArrayAccess |
609 | 609 | */ |
610 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
611 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
610 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
611 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
612 | 612 | self::$CHR[($code_point & 0x3F) + 0x80]; |
613 | 613 | } else { |
614 | 614 | /** |
615 | 615 | * @psalm-suppress PossiblyNullArrayAccess |
616 | 616 | */ |
617 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
618 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
619 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
617 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
618 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
619 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
620 | 620 | self::$CHR[($code_point & 0x3F) + 0x80]; |
621 | 621 | } |
622 | 622 | |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | |
664 | 664 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
665 | 665 | return \array_map( |
666 | - static function (string $data): int { |
|
666 | + static function(string $data): int { |
|
667 | 667 | // "mb_" is available if overload is used, so use it ... |
668 | 668 | return \mb_strlen($data, 'CP850'); // 8-BIT |
669 | 669 | }, |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | $char = ''; |
732 | 732 | } |
733 | 733 | |
734 | - return self::int_to_hex(self::ord((string) $char), $pfix); |
|
734 | + return self::int_to_hex(self::ord((string)$char), $pfix); |
|
735 | 735 | } |
736 | 736 | |
737 | 737 | /** |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
807 | 807 | /x'; |
808 | 808 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
809 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
809 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
810 | 810 | |
811 | 811 | if ($replace_diamond_question_mark === true) { |
812 | 812 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | public static function cleanup($str): string |
842 | 842 | { |
843 | 843 | // init |
844 | - $str = (string) $str; |
|
844 | + $str = (string)$str; |
|
845 | 845 | |
846 | 846 | if ($str === '') { |
847 | 847 | return ''; |
@@ -924,7 +924,7 @@ discard block |
||
924 | 924 | { |
925 | 925 | if (self::$SUPPORT['mbstring'] === true) { |
926 | 926 | /** @noinspection PhpComposerExtensionStubsInspection */ |
927 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
927 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
928 | 928 | } |
929 | 929 | |
930 | 930 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -964,7 +964,7 @@ discard block |
||
964 | 964 | */ |
965 | 965 | public static function css_stripe_media_queries(string $str): string |
966 | 966 | { |
967 | - return (string) \preg_replace( |
|
967 | + return (string)\preg_replace( |
|
968 | 968 | '#@media\\s+(?:only\\s)?(?:[\\s{\\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
969 | 969 | '', |
970 | 970 | $str |
@@ -991,7 +991,7 @@ discard block |
||
991 | 991 | */ |
992 | 992 | public static function decimal_to_chr($int): string |
993 | 993 | { |
994 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
994 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
995 | 995 | } |
996 | 996 | |
997 | 997 | /** |
@@ -1036,16 +1036,16 @@ discard block |
||
1036 | 1036 | self::initEmojiData(); |
1037 | 1037 | |
1038 | 1038 | if ($useReversibleStringMapping === true) { |
1039 | - return (string) \str_replace( |
|
1040 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1041 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1039 | + return (string)\str_replace( |
|
1040 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1041 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1042 | 1042 | $str |
1043 | 1043 | ); |
1044 | 1044 | } |
1045 | 1045 | |
1046 | - return (string) \str_replace( |
|
1047 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1048 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1046 | + return (string)\str_replace( |
|
1047 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1048 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1049 | 1049 | $str |
1050 | 1050 | ); |
1051 | 1051 | } |
@@ -1065,16 +1065,16 @@ discard block |
||
1065 | 1065 | self::initEmojiData(); |
1066 | 1066 | |
1067 | 1067 | if ($useReversibleStringMapping === true) { |
1068 | - return (string) \str_replace( |
|
1069 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1070 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1068 | + return (string)\str_replace( |
|
1069 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1070 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1071 | 1071 | $str |
1072 | 1072 | ); |
1073 | 1073 | } |
1074 | 1074 | |
1075 | - return (string) \str_replace( |
|
1076 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1077 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1075 | + return (string)\str_replace( |
|
1076 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1077 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1078 | 1078 | $str |
1079 | 1079 | ); |
1080 | 1080 | } |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | if ($toEncoding === 'JSON') { |
1129 | 1129 | $return = self::json_encode($str); |
1130 | 1130 | if ($return === false) { |
1131 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1131 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1132 | 1132 | } |
1133 | 1133 | |
1134 | 1134 | 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 "' . $toEncoding . '" encoding', \E_USER_WARNING); |
|
1217 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$toEncoding.'" encoding', \E_USER_WARNING); |
|
1218 | 1218 | } |
1219 | 1219 | |
1220 | 1220 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1308,31 +1308,31 @@ discard block |
||
1308 | 1308 | $trimChars = "\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 | - $stringLength = (int) \mb_strlen($str); |
|
1317 | + $stringLength = (int)\mb_strlen($str); |
|
1318 | 1318 | $end = ($length - 1) > $stringLength ? $stringLength : ($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 | - $stringLength = (int) self::strlen($str, $encoding); |
|
1329 | + $stringLength = (int)self::strlen($str, $encoding); |
|
1330 | 1330 | $end = ($length - 1) > $stringLength ? $stringLength : ($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($strSub, $trimChars) . $replacerForSkippedText; |
|
1352 | + return \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1353 | 1353 | } |
1354 | 1354 | |
1355 | 1355 | return $str; |
1356 | 1356 | } |
1357 | 1357 | |
1358 | 1358 | if ($encoding === 'UTF-8') { |
1359 | - $wordPos = (int) \mb_stripos($str, $search); |
|
1360 | - $halfSide = (int) ($wordPos - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1359 | + $wordPos = (int)\mb_stripos($str, $search); |
|
1360 | + $halfSide = (int)($wordPos - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1361 | 1361 | } else { |
1362 | - $wordPos = (int) self::stripos($str, $search, 0, $encoding); |
|
1363 | - $halfSide = (int) ($wordPos - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1362 | + $wordPos = (int)self::stripos($str, $search, 0, $encoding); |
|
1363 | + $halfSide = (int)($wordPos - $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 ($halfText !== false) { |
1374 | 1374 | if ($encoding === 'UTF-8') { |
1375 | - $pos_start = (int) \max( |
|
1375 | + $pos_start = (int)\max( |
|
1376 | 1376 | \mb_strrpos($halfText, ' '), |
1377 | 1377 | \mb_strrpos($halfText, '.') |
1378 | 1378 | ); |
1379 | 1379 | } else { |
1380 | - $pos_start = (int) \max( |
|
1380 | + $pos_start = (int)\max( |
|
1381 | 1381 | self::strrpos($halfText, ' ', 0, $encoding), |
1382 | 1382 | self::strrpos($halfText, '.', 0, $encoding) |
1383 | 1383 | ); |
@@ -1387,19 +1387,19 @@ discard block |
||
1387 | 1387 | |
1388 | 1388 | if ($wordPos && $halfSide > 0) { |
1389 | 1389 | $offset = $pos_start + $length - 1; |
1390 | - $realLength = (int) self::strlen($str, $encoding); |
|
1390 | + $realLength = (int)self::strlen($str, $encoding); |
|
1391 | 1391 | |
1392 | 1392 | if ($offset > $realLength) { |
1393 | 1393 | $offset = $realLength; |
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 | - $strSub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1410 | + $strSub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1411 | 1411 | } else { |
1412 | - $strSub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1412 | + $strSub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1413 | 1413 | } |
1414 | 1414 | if ($strSub !== false) { |
1415 | - $extract = $replacerForSkippedText . \ltrim($strSub, $trimChars); |
|
1415 | + $extract = $replacerForSkippedText.\ltrim($strSub, $trimChars); |
|
1416 | 1416 | } else { |
1417 | 1417 | $extract = ''; |
1418 | 1418 | } |
@@ -1423,26 +1423,26 @@ discard block |
||
1423 | 1423 | $strSub = self::substr($str, $pos_start, $pos_end, $encoding); |
1424 | 1424 | } |
1425 | 1425 | if ($strSub !== false) { |
1426 | - $extract = $replacerForSkippedText . \trim($strSub, $trimChars) . $replacerForSkippedText; |
|
1426 | + $extract = $replacerForSkippedText.\trim($strSub, $trimChars).$replacerForSkippedText; |
|
1427 | 1427 | } else { |
1428 | 1428 | $extract = ''; |
1429 | 1429 | } |
1430 | 1430 | } |
1431 | 1431 | } else { |
1432 | 1432 | $offset = $length - 1; |
1433 | - $trueLength = (int) self::strlen($str, $encoding); |
|
1433 | + $trueLength = (int)self::strlen($str, $encoding); |
|
1434 | 1434 | |
1435 | 1435 | if ($offset > $trueLength) { |
1436 | 1436 | $offset = $trueLength; |
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 | $strSub = self::substr($str, 0, $pos_end, $encoding); |
1456 | 1456 | } |
1457 | 1457 | if ($strSub !== false) { |
1458 | - $extract = \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1458 | + $extract = \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1459 | 1459 | } else { |
1460 | 1460 | $extract = ''; |
1461 | 1461 | } |
@@ -1576,7 +1576,7 @@ discard block |
||
1576 | 1576 | { |
1577 | 1577 | $file_content = \file_get_contents($file_path); |
1578 | 1578 | if ($file_content === false) { |
1579 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1579 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1580 | 1580 | } |
1581 | 1581 | |
1582 | 1582 | return self::string_has_bom($file_content); |
@@ -1639,7 +1639,7 @@ discard block |
||
1639 | 1639 | ) { |
1640 | 1640 | // Prevent leading combining chars |
1641 | 1641 | // for NFC-safe concatenations. |
1642 | - $var = $leading_combining . $var; |
|
1642 | + $var = $leading_combining.$var; |
|
1643 | 1643 | } |
1644 | 1644 | } |
1645 | 1645 | |
@@ -1878,10 +1878,10 @@ discard block |
||
1878 | 1878 | } |
1879 | 1879 | |
1880 | 1880 | if ($encoding === 'UTF-8') { |
1881 | - return (string) \mb_substr($str, 0, $n); |
|
1881 | + return (string)\mb_substr($str, 0, $n); |
|
1882 | 1882 | } |
1883 | 1883 | |
1884 | - return (string) self::substr($str, 0, $n, $encoding); |
|
1884 | + return (string)self::substr($str, 0, $n, $encoding); |
|
1885 | 1885 | } |
1886 | 1886 | |
1887 | 1887 | /** |
@@ -1956,7 +1956,7 @@ discard block |
||
1956 | 1956 | return $str; |
1957 | 1957 | } |
1958 | 1958 | |
1959 | - $str = (string) $str; |
|
1959 | + $str = (string)$str; |
|
1960 | 1960 | $last = ''; |
1961 | 1961 | while ($last !== $str) { |
1962 | 1962 | $last = $str; |
@@ -2145,7 +2145,7 @@ discard block |
||
2145 | 2145 | return $fallback; |
2146 | 2146 | } |
2147 | 2147 | /** @noinspection OffsetOperationsInspection */ |
2148 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2148 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2149 | 2149 | |
2150 | 2150 | // DEBUG |
2151 | 2151 | //var_dump($type_code); |
@@ -2240,7 +2240,7 @@ discard block |
||
2240 | 2240 | // |
2241 | 2241 | |
2242 | 2242 | if ($encoding === 'UTF-8') { |
2243 | - $maxlength = (int) \mb_strlen($possibleChars); |
|
2243 | + $maxlength = (int)\mb_strlen($possibleChars); |
|
2244 | 2244 | if ($maxlength === 0) { |
2245 | 2245 | return ''; |
2246 | 2246 | } |
@@ -2261,7 +2261,7 @@ discard block |
||
2261 | 2261 | } else { |
2262 | 2262 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2263 | 2263 | |
2264 | - $maxlength = (int) self::strlen($possibleChars, $encoding); |
|
2264 | + $maxlength = (int)self::strlen($possibleChars, $encoding); |
|
2265 | 2265 | if ($maxlength === 0) { |
2266 | 2266 | return ''; |
2267 | 2267 | } |
@@ -2292,16 +2292,16 @@ discard block |
||
2292 | 2292 | */ |
2293 | 2293 | public static function get_unique_string($entropyExtra = '', bool $md5 = true): string |
2294 | 2294 | { |
2295 | - $uniqueHelper = \random_int(0, \mt_getrandmax()) . |
|
2296 | - \session_id() . |
|
2297 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2298 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2295 | + $uniqueHelper = \random_int(0, \mt_getrandmax()). |
|
2296 | + \session_id(). |
|
2297 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2298 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2299 | 2299 | $entropyExtra; |
2300 | 2300 | |
2301 | 2301 | $uniqueString = \uniqid($uniqueHelper, true); |
2302 | 2302 | |
2303 | 2303 | if ($md5) { |
2304 | - $uniqueString = \md5($uniqueString . $uniqueHelper); |
|
2304 | + $uniqueString = \md5($uniqueString.$uniqueHelper); |
|
2305 | 2305 | } |
2306 | 2306 | |
2307 | 2307 | return $uniqueString; |
@@ -2380,7 +2380,7 @@ discard block |
||
2380 | 2380 | public static function hex_to_int($hexDec) |
2381 | 2381 | { |
2382 | 2382 | // init |
2383 | - $hexDec = (string) $hexDec; |
|
2383 | + $hexDec = (string)$hexDec; |
|
2384 | 2384 | |
2385 | 2385 | if ($hexDec === '') { |
2386 | 2386 | return false; |
@@ -2458,7 +2458,7 @@ discard block |
||
2458 | 2458 | return \implode( |
2459 | 2459 | '', |
2460 | 2460 | \array_map( |
2461 | - static function (string $chr) use ($keepAsciiChars, $encoding): string { |
|
2461 | + static function(string $chr) use ($keepAsciiChars, $encoding): string { |
|
2462 | 2462 | return self::single_chr_html_encode($chr, $keepAsciiChars, $encoding); |
2463 | 2463 | }, |
2464 | 2464 | self::str_split($str) |
@@ -2562,7 +2562,7 @@ discard block |
||
2562 | 2562 | && |
2563 | 2563 | self::$SUPPORT['mbstring'] === false |
2564 | 2564 | ) { |
2565 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2565 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2566 | 2566 | } |
2567 | 2567 | |
2568 | 2568 | do { |
@@ -2583,14 +2583,14 @@ discard block |
||
2583 | 2583 | ); |
2584 | 2584 | } |
2585 | 2585 | } else { |
2586 | - $str = (string) \preg_replace_callback( |
|
2586 | + $str = (string)\preg_replace_callback( |
|
2587 | 2587 | "/&#\d{2,6};/", |
2588 | 2588 | /** |
2589 | 2589 | * @param string[] $matches |
2590 | 2590 | * |
2591 | 2591 | * @return string |
2592 | 2592 | */ |
2593 | - static function (array $matches) use ($encoding): string { |
|
2593 | + static function(array $matches) use ($encoding): string { |
|
2594 | 2594 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
2595 | 2595 | if ($returnTmp !== '"' && $returnTmp !== "'") { |
2596 | 2596 | return $returnTmp; |
@@ -2605,7 +2605,7 @@ discard block |
||
2605 | 2605 | if (\strpos($str, '&') !== false) { |
2606 | 2606 | if (\strpos($str, '&#') !== false) { |
2607 | 2607 | // decode also numeric & UTF16 two byte entities |
2608 | - $str = (string) \preg_replace( |
|
2608 | + $str = (string)\preg_replace( |
|
2609 | 2609 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
2610 | 2610 | '$1;', |
2611 | 2611 | $str |
@@ -2651,7 +2651,7 @@ discard block |
||
2651 | 2651 | */ |
2652 | 2652 | public static function html_stripe_empty_tags(string $str): string |
2653 | 2653 | { |
2654 | - return (string) \preg_replace( |
|
2654 | + return (string)\preg_replace( |
|
2655 | 2655 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
2656 | 2656 | '', |
2657 | 2657 | $str |
@@ -2950,9 +2950,9 @@ discard block |
||
2950 | 2950 | { |
2951 | 2951 | $hex = \dechex($int); |
2952 | 2952 | |
2953 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
2953 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
2954 | 2954 | |
2955 | - return $pfix . $hex . ''; |
|
2955 | + return $pfix.$hex.''; |
|
2956 | 2956 | } |
2957 | 2957 | |
2958 | 2958 | /** |
@@ -3210,7 +3210,7 @@ discard block |
||
3210 | 3210 | */ |
3211 | 3211 | public static function is_binary($input, bool $strict = false): bool |
3212 | 3212 | { |
3213 | - $input = (string) $input; |
|
3213 | + $input = (string)$input; |
|
3214 | 3214 | if ($input === '') { |
3215 | 3215 | return false; |
3216 | 3216 | } |
@@ -3471,7 +3471,7 @@ discard block |
||
3471 | 3471 | public static function is_utf16($str, $checkIfStringIsBinary = true) |
3472 | 3472 | { |
3473 | 3473 | // init |
3474 | - $str = (string) $str; |
|
3474 | + $str = (string)$str; |
|
3475 | 3475 | $strChars = []; |
3476 | 3476 | |
3477 | 3477 | if ( |
@@ -3549,7 +3549,7 @@ discard block |
||
3549 | 3549 | public static function is_utf32($str, $checkIfStringIsBinary = true) |
3550 | 3550 | { |
3551 | 3551 | // init |
3552 | - $str = (string) $str; |
|
3552 | + $str = (string)$str; |
|
3553 | 3553 | $strChars = []; |
3554 | 3554 | |
3555 | 3555 | if ( |
@@ -3669,7 +3669,7 @@ discard block |
||
3669 | 3669 | self::$ORD = self::getData('ord'); |
3670 | 3670 | } |
3671 | 3671 | |
3672 | - $len = \strlen((string) $str); |
|
3672 | + $len = \strlen((string)$str); |
|
3673 | 3673 | /** @noinspection ForeachInvariantsInspection */ |
3674 | 3674 | for ($i = 0; $i < $len; ++$i) { |
3675 | 3675 | $in = self::$ORD[$str[$i]]; |
@@ -3906,15 +3906,15 @@ discard block |
||
3906 | 3906 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
3907 | 3907 | |
3908 | 3908 | if ($encoding === 'UTF-8') { |
3909 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
3909 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
3910 | 3910 | |
3911 | 3911 | if ($useMbFunction === true) { |
3912 | 3912 | $strPartOne = \mb_strtolower( |
3913 | - (string) \mb_substr($str, 0, 1) |
|
3913 | + (string)\mb_substr($str, 0, 1) |
|
3914 | 3914 | ); |
3915 | 3915 | } else { |
3916 | 3916 | $strPartOne = self::strtolower( |
3917 | - (string) \mb_substr($str, 0, 1), |
|
3917 | + (string)\mb_substr($str, 0, 1), |
|
3918 | 3918 | $encoding, |
3919 | 3919 | false, |
3920 | 3920 | $lang, |
@@ -3924,10 +3924,10 @@ discard block |
||
3924 | 3924 | } else { |
3925 | 3925 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
3926 | 3926 | |
3927 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
3927 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
3928 | 3928 | |
3929 | 3929 | $strPartOne = self::strtolower( |
3930 | - (string) self::substr($str, 0, 1, $encoding), |
|
3930 | + (string)self::substr($str, 0, 1, $encoding), |
|
3931 | 3931 | $encoding, |
3932 | 3932 | false, |
3933 | 3933 | $lang, |
@@ -3935,7 +3935,7 @@ discard block |
||
3935 | 3935 | ); |
3936 | 3936 | } |
3937 | 3937 | |
3938 | - return $strPartOne . $strPartTwo; |
|
3938 | + return $strPartOne.$strPartTwo; |
|
3939 | 3939 | } |
3940 | 3940 | |
3941 | 3941 | /** |
@@ -4054,7 +4054,7 @@ discard block |
||
4054 | 4054 | |
4055 | 4055 | if (self::$SUPPORT['mbstring'] === true) { |
4056 | 4056 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4057 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4057 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4058 | 4058 | } |
4059 | 4059 | |
4060 | 4060 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -4095,7 +4095,7 @@ discard block |
||
4095 | 4095 | { |
4096 | 4096 | $bytes = self::chr_size_list($str); |
4097 | 4097 | if (\count($bytes) > 0) { |
4098 | - return (int) \max($bytes); |
|
4098 | + return (int)\max($bytes); |
|
4099 | 4099 | } |
4100 | 4100 | |
4101 | 4101 | return 0; |
@@ -4164,7 +4164,7 @@ discard block |
||
4164 | 4164 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4165 | 4165 | |
4166 | 4166 | // init |
4167 | - $encoding = (string) $encoding; |
|
4167 | + $encoding = (string)$encoding; |
|
4168 | 4168 | |
4169 | 4169 | if (!$encoding) { |
4170 | 4170 | return $fallback; |
@@ -4218,7 +4218,7 @@ discard block |
||
4218 | 4218 | |
4219 | 4219 | $encodingOrig = $encoding; |
4220 | 4220 | $encoding = \strtoupper($encoding); |
4221 | - $encodingUpperHelper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4221 | + $encodingUpperHelper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4222 | 4222 | |
4223 | 4223 | $equivalences = [ |
4224 | 4224 | 'ISO8859' => 'ISO-8859-1', |
@@ -4376,7 +4376,7 @@ discard block |
||
4376 | 4376 | } |
4377 | 4377 | |
4378 | 4378 | static $WHITESPACE_CACHE = []; |
4379 | - $cacheKey = (int) $keepNonBreakingSpace; |
|
4379 | + $cacheKey = (int)$keepNonBreakingSpace; |
|
4380 | 4380 | |
4381 | 4381 | if (!isset($WHITESPACE_CACHE[$cacheKey])) { |
4382 | 4382 | $WHITESPACE_CACHE[$cacheKey] = self::$WHITESPACE_TABLE; |
@@ -4418,13 +4418,13 @@ discard block |
||
4418 | 4418 | static $CHAR_CACHE = []; |
4419 | 4419 | |
4420 | 4420 | // init |
4421 | - $chr = (string) $chr; |
|
4421 | + $chr = (string)$chr; |
|
4422 | 4422 | |
4423 | 4423 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4424 | 4424 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4425 | 4425 | } |
4426 | 4426 | |
4427 | - $cacheKey = $chr . $encoding; |
|
4427 | + $cacheKey = $chr.$encoding; |
|
4428 | 4428 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
4429 | 4429 | return $CHAR_CACHE[$cacheKey]; |
4430 | 4430 | } |
@@ -4459,7 +4459,7 @@ discard block |
||
4459 | 4459 | // |
4460 | 4460 | |
4461 | 4461 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
4462 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
4462 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
4463 | 4463 | /** @noinspection OffsetOperationsInspection */ |
4464 | 4464 | $code = $chr ? $chr[1] : 0; |
4465 | 4465 | |
@@ -4467,21 +4467,21 @@ discard block |
||
4467 | 4467 | if ($code >= 0xF0 && isset($chr[4])) { |
4468 | 4468 | /** @noinspection UnnecessaryCastingInspection */ |
4469 | 4469 | /** @noinspection OffsetOperationsInspection */ |
4470 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4470 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4471 | 4471 | } |
4472 | 4472 | |
4473 | 4473 | /** @noinspection OffsetOperationsInspection */ |
4474 | 4474 | if ($code >= 0xE0 && isset($chr[3])) { |
4475 | 4475 | /** @noinspection UnnecessaryCastingInspection */ |
4476 | 4476 | /** @noinspection OffsetOperationsInspection */ |
4477 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4477 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4478 | 4478 | } |
4479 | 4479 | |
4480 | 4480 | /** @noinspection OffsetOperationsInspection */ |
4481 | 4481 | if ($code >= 0xC0 && isset($chr[2])) { |
4482 | 4482 | /** @noinspection UnnecessaryCastingInspection */ |
4483 | 4483 | /** @noinspection OffsetOperationsInspection */ |
4484 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4484 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4485 | 4485 | } |
4486 | 4486 | |
4487 | 4487 | return $CHAR_CACHE[$cacheKey] = $code; |
@@ -4530,7 +4530,7 @@ discard block |
||
4530 | 4530 | public static function pcre_utf8_support(): bool |
4531 | 4531 | { |
4532 | 4532 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4533 | - return (bool) @\preg_match('//u', ''); |
|
4533 | + return (bool)@\preg_match('//u', ''); |
|
4534 | 4534 | } |
4535 | 4535 | |
4536 | 4536 | /** |
@@ -4552,10 +4552,10 @@ discard block |
||
4552 | 4552 | } |
4553 | 4553 | |
4554 | 4554 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4555 | - if (\ctype_digit((string) $var1)) { |
|
4556 | - $start = (int) $var1; |
|
4555 | + if (\ctype_digit((string)$var1)) { |
|
4556 | + $start = (int)$var1; |
|
4557 | 4557 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var1)) { |
4558 | - $start = (int) self::hex_to_int($var1); |
|
4558 | + $start = (int)self::hex_to_int($var1); |
|
4559 | 4559 | } else { |
4560 | 4560 | $start = self::ord($var1); |
4561 | 4561 | } |
@@ -4565,10 +4565,10 @@ discard block |
||
4565 | 4565 | } |
4566 | 4566 | |
4567 | 4567 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4568 | - if (\ctype_digit((string) $var2)) { |
|
4569 | - $end = (int) $var2; |
|
4568 | + if (\ctype_digit((string)$var2)) { |
|
4569 | + $end = (int)$var2; |
|
4570 | 4570 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var2)) { |
4571 | - $end = (int) self::hex_to_int($var2); |
|
4571 | + $end = (int)self::hex_to_int($var2); |
|
4572 | 4572 | } else { |
4573 | 4573 | $end = self::ord($var2); |
4574 | 4574 | } |
@@ -4578,8 +4578,8 @@ discard block |
||
4578 | 4578 | } |
4579 | 4579 | |
4580 | 4580 | return \array_map( |
4581 | - static function (int $i): string { |
|
4582 | - return (string) self::chr($i); |
|
4581 | + static function(int $i): string { |
|
4582 | + return (string)self::chr($i); |
|
4583 | 4583 | }, |
4584 | 4584 | \range($start, $end) |
4585 | 4585 | ); |
@@ -4670,8 +4670,8 @@ discard block |
||
4670 | 4670 | $delimiter = '/'; |
4671 | 4671 | } |
4672 | 4672 | |
4673 | - return (string) \preg_replace( |
|
4674 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4673 | + return (string)\preg_replace( |
|
4674 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4675 | 4675 | $replacement, |
4676 | 4676 | $str |
4677 | 4677 | ); |
@@ -4713,9 +4713,9 @@ discard block |
||
4713 | 4713 | return ''; |
4714 | 4714 | } |
4715 | 4715 | |
4716 | - $strLength -= (int) $bomByteLength; |
|
4716 | + $strLength -= (int)$bomByteLength; |
|
4717 | 4717 | |
4718 | - $str = (string) $strTmp; |
|
4718 | + $str = (string)$strTmp; |
|
4719 | 4719 | } |
4720 | 4720 | } |
4721 | 4721 | |
@@ -4739,7 +4739,7 @@ discard block |
||
4739 | 4739 | if (\is_array($what) === true) { |
4740 | 4740 | /** @noinspection ForeachSourceInspection */ |
4741 | 4741 | foreach ($what as $item) { |
4742 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/u') . ')+/u', $item, $str); |
|
4742 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/u').')+/u', $item, $str); |
|
4743 | 4743 | } |
4744 | 4744 | } |
4745 | 4745 | |
@@ -4771,7 +4771,7 @@ discard block |
||
4771 | 4771 | */ |
4772 | 4772 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
4773 | 4773 | { |
4774 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4774 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4775 | 4775 | } |
4776 | 4776 | |
4777 | 4777 | /** |
@@ -4802,7 +4802,7 @@ discard block |
||
4802 | 4802 | $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
4803 | 4803 | |
4804 | 4804 | do { |
4805 | - $str = (string) \preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4805 | + $str = (string)\preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4806 | 4806 | } while ($count !== 0); |
4807 | 4807 | |
4808 | 4808 | return $str; |
@@ -4821,17 +4821,17 @@ discard block |
||
4821 | 4821 | { |
4822 | 4822 | if ($substring && \strpos($str, $substring) === 0) { |
4823 | 4823 | if ($encoding === 'UTF-8') { |
4824 | - return (string) \mb_substr( |
|
4824 | + return (string)\mb_substr( |
|
4825 | 4825 | $str, |
4826 | - (int) \mb_strlen($substring) |
|
4826 | + (int)\mb_strlen($substring) |
|
4827 | 4827 | ); |
4828 | 4828 | } |
4829 | 4829 | |
4830 | 4830 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4831 | 4831 | |
4832 | - return (string) self::substr( |
|
4832 | + return (string)self::substr( |
|
4833 | 4833 | $str, |
4834 | - (int) self::strlen($substring, $encoding), |
|
4834 | + (int)self::strlen($substring, $encoding), |
|
4835 | 4835 | null, |
4836 | 4836 | $encoding |
4837 | 4837 | ); |
@@ -4853,19 +4853,19 @@ discard block |
||
4853 | 4853 | { |
4854 | 4854 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
4855 | 4855 | if ($encoding === 'UTF-8') { |
4856 | - return (string) \mb_substr( |
|
4856 | + return (string)\mb_substr( |
|
4857 | 4857 | $str, |
4858 | 4858 | 0, |
4859 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
4859 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
4860 | 4860 | ); |
4861 | 4861 | } |
4862 | 4862 | |
4863 | 4863 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4864 | 4864 | |
4865 | - return (string) self::substr( |
|
4865 | + return (string)self::substr( |
|
4866 | 4866 | $str, |
4867 | 4867 | 0, |
4868 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
4868 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
4869 | 4869 | $encoding |
4870 | 4870 | ); |
4871 | 4871 | } |
@@ -4949,7 +4949,7 @@ discard block |
||
4949 | 4949 | $save = \mb_substitute_character(); |
4950 | 4950 | \mb_substitute_character($replacementCharHelper); |
4951 | 4951 | // the polyfill maybe return false, so cast to string |
4952 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4952 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4953 | 4953 | \mb_substitute_character($save); |
4954 | 4954 | } |
4955 | 4955 | |
@@ -4989,7 +4989,7 @@ discard block |
||
4989 | 4989 | |
4990 | 4990 | if (self::$SUPPORT['mbstring'] === true) { |
4991 | 4991 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4992 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4992 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4993 | 4993 | } |
4994 | 4994 | |
4995 | 4995 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -5004,7 +5004,7 @@ discard block |
||
5004 | 5004 | { |
5005 | 5005 | echo '<pre>'; |
5006 | 5006 | foreach (self::$SUPPORT as $key => &$value) { |
5007 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
5007 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
5008 | 5008 | } |
5009 | 5009 | unset($value); |
5010 | 5010 | echo '</pre>'; |
@@ -5033,7 +5033,7 @@ discard block |
||
5033 | 5033 | return $char; |
5034 | 5034 | } |
5035 | 5035 | |
5036 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
5036 | + return '&#'.self::ord($char, $encoding).';'; |
|
5037 | 5037 | } |
5038 | 5038 | |
5039 | 5039 | /** |
@@ -5124,18 +5124,18 @@ discard block |
||
5124 | 5124 | $lang, |
5125 | 5125 | $tryToKeepStringLength |
5126 | 5126 | ); |
5127 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5127 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5128 | 5128 | |
5129 | 5129 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5130 | 5130 | |
5131 | - $str = (string) \preg_replace_callback( |
|
5131 | + $str = (string)\preg_replace_callback( |
|
5132 | 5132 | '/[-_\\s]+(.)?/u', |
5133 | 5133 | /** |
5134 | 5134 | * @param array $match |
5135 | 5135 | * |
5136 | 5136 | * @return string |
5137 | 5137 | */ |
5138 | - static function (array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5138 | + static function(array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5139 | 5139 | if (isset($match[1])) { |
5140 | 5140 | if ($useMbFunction === true) { |
5141 | 5141 | if ($encoding === 'UTF-8') { |
@@ -5153,14 +5153,14 @@ discard block |
||
5153 | 5153 | $str |
5154 | 5154 | ); |
5155 | 5155 | |
5156 | - return (string) \preg_replace_callback( |
|
5156 | + return (string)\preg_replace_callback( |
|
5157 | 5157 | '/[\\p{N}]+(.)?/u', |
5158 | 5158 | /** |
5159 | 5159 | * @param array $match |
5160 | 5160 | * |
5161 | 5161 | * @return string |
5162 | 5162 | */ |
5163 | - static function (array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5163 | + static function(array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5164 | 5164 | if ($useMbFunction === true) { |
5165 | 5165 | if ($encoding === 'UTF-8') { |
5166 | 5166 | return \mb_strtoupper($match[0]); |
@@ -5338,7 +5338,7 @@ discard block |
||
5338 | 5338 | ): string { |
5339 | 5339 | if (self::$SUPPORT['mbstring'] === true) { |
5340 | 5340 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5341 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5341 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5342 | 5342 | |
5343 | 5343 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5344 | 5344 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5348,10 +5348,10 @@ discard block |
||
5348 | 5348 | } |
5349 | 5349 | |
5350 | 5350 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5351 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5351 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5352 | 5352 | } |
5353 | 5353 | |
5354 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5354 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5355 | 5355 | |
5356 | 5356 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5357 | 5357 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5360,7 +5360,7 @@ discard block |
||
5360 | 5360 | $str = self::strtolower($str, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
5361 | 5361 | } |
5362 | 5362 | |
5363 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5363 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5364 | 5364 | } |
5365 | 5365 | |
5366 | 5366 | /** |
@@ -5375,7 +5375,7 @@ discard block |
||
5375 | 5375 | public static function str_detect_encoding($str) |
5376 | 5376 | { |
5377 | 5377 | // init |
5378 | - $str = (string) $str; |
|
5378 | + $str = (string)$str; |
|
5379 | 5379 | |
5380 | 5380 | // |
5381 | 5381 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5442,7 +5442,7 @@ discard block |
||
5442 | 5442 | foreach (self::$ENCODINGS as $encodingTmp) { |
5443 | 5443 | // INFO: //IGNORE but still throw notice |
5444 | 5444 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5445 | - if ((string) @\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str) === $str) { |
|
5445 | + if ((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str) === $str) { |
|
5446 | 5446 | return $encodingTmp; |
5447 | 5447 | } |
5448 | 5448 | } |
@@ -5530,7 +5530,7 @@ discard block |
||
5530 | 5530 | return $str; |
5531 | 5531 | } |
5532 | 5532 | |
5533 | - return $substring . $str; |
|
5533 | + return $substring.$str; |
|
5534 | 5534 | } |
5535 | 5535 | |
5536 | 5536 | /** |
@@ -5784,27 +5784,27 @@ discard block |
||
5784 | 5784 | string $encoding = 'UTF-8' |
5785 | 5785 | ): string { |
5786 | 5786 | if ($encoding === 'UTF-8') { |
5787 | - $len = (int) \mb_strlen($str); |
|
5787 | + $len = (int)\mb_strlen($str); |
|
5788 | 5788 | if ($index > $len) { |
5789 | 5789 | return $str; |
5790 | 5790 | } |
5791 | 5791 | |
5792 | 5792 | /** @noinspection UnnecessaryCastingInspection */ |
5793 | - return (string) \mb_substr($str, 0, $index) . |
|
5794 | - $substring . |
|
5795 | - (string) \mb_substr($str, $index, $len); |
|
5793 | + return (string)\mb_substr($str, 0, $index). |
|
5794 | + $substring. |
|
5795 | + (string)\mb_substr($str, $index, $len); |
|
5796 | 5796 | } |
5797 | 5797 | |
5798 | 5798 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5799 | 5799 | |
5800 | - $len = (int) self::strlen($str, $encoding); |
|
5800 | + $len = (int)self::strlen($str, $encoding); |
|
5801 | 5801 | if ($index > $len) { |
5802 | 5802 | return $str; |
5803 | 5803 | } |
5804 | 5804 | |
5805 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
5806 | - $substring . |
|
5807 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5805 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
5806 | + $substring. |
|
5807 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
5808 | 5808 | } |
5809 | 5809 | |
5810 | 5810 | /** |
@@ -5834,15 +5834,15 @@ discard block |
||
5834 | 5834 | */ |
5835 | 5835 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5836 | 5836 | { |
5837 | - $search = (array) $search; |
|
5837 | + $search = (array)$search; |
|
5838 | 5838 | |
5839 | 5839 | /** @noinspection AlterInForeachInspection */ |
5840 | 5840 | foreach ($search as &$s) { |
5841 | - $s = (string) $s; |
|
5841 | + $s = (string)$s; |
|
5842 | 5842 | if ($s === '') { |
5843 | 5843 | $s = '/^(?<=.)$/'; |
5844 | 5844 | } else { |
5845 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5845 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5846 | 5846 | } |
5847 | 5847 | } |
5848 | 5848 | |
@@ -5874,11 +5874,11 @@ discard block |
||
5874 | 5874 | } |
5875 | 5875 | |
5876 | 5876 | if ($search === '') { |
5877 | - return $str . $replacement; |
|
5877 | + return $str.$replacement; |
|
5878 | 5878 | } |
5879 | 5879 | |
5880 | 5880 | if (\stripos($str, $search) === 0) { |
5881 | - return $replacement . \substr($str, \strlen($search)); |
|
5881 | + return $replacement.\substr($str, \strlen($search)); |
|
5882 | 5882 | } |
5883 | 5883 | |
5884 | 5884 | return $str; |
@@ -5906,11 +5906,11 @@ discard block |
||
5906 | 5906 | } |
5907 | 5907 | |
5908 | 5908 | if ($search === '') { |
5909 | - return $str . $replacement; |
|
5909 | + return $str.$replacement; |
|
5910 | 5910 | } |
5911 | 5911 | |
5912 | 5912 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
5913 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
5913 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
5914 | 5914 | } |
5915 | 5915 | |
5916 | 5916 | return $str; |
@@ -5987,15 +5987,15 @@ discard block |
||
5987 | 5987 | } |
5988 | 5988 | |
5989 | 5989 | if ($encoding === 'UTF-8') { |
5990 | - return (string) \mb_substr( |
|
5990 | + return (string)\mb_substr( |
|
5991 | 5991 | $str, |
5992 | - $offset + (int) \mb_strlen($separator) |
|
5992 | + $offset + (int)\mb_strlen($separator) |
|
5993 | 5993 | ); |
5994 | 5994 | } |
5995 | 5995 | |
5996 | - return (string) self::substr( |
|
5996 | + return (string)self::substr( |
|
5997 | 5997 | $str, |
5998 | - $offset + (int) self::strlen($separator, $encoding), |
|
5998 | + $offset + (int)self::strlen($separator, $encoding), |
|
5999 | 5999 | null, |
6000 | 6000 | $encoding |
6001 | 6001 | ); |
@@ -6022,15 +6022,15 @@ discard block |
||
6022 | 6022 | } |
6023 | 6023 | |
6024 | 6024 | if ($encoding === 'UTF-8') { |
6025 | - return (string) \mb_substr( |
|
6025 | + return (string)\mb_substr( |
|
6026 | 6026 | $str, |
6027 | - $offset + (int) self::strlen($separator) |
|
6027 | + $offset + (int)self::strlen($separator) |
|
6028 | 6028 | ); |
6029 | 6029 | } |
6030 | 6030 | |
6031 | - return (string) self::substr( |
|
6031 | + return (string)self::substr( |
|
6032 | 6032 | $str, |
6033 | - $offset + (int) self::strlen($separator, $encoding), |
|
6033 | + $offset + (int)self::strlen($separator, $encoding), |
|
6034 | 6034 | null, |
6035 | 6035 | $encoding |
6036 | 6036 | ); |
@@ -6057,10 +6057,10 @@ discard block |
||
6057 | 6057 | } |
6058 | 6058 | |
6059 | 6059 | if ($encoding === 'UTF-8') { |
6060 | - return (string) \mb_substr($str, 0, $offset); |
|
6060 | + return (string)\mb_substr($str, 0, $offset); |
|
6061 | 6061 | } |
6062 | 6062 | |
6063 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6063 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6064 | 6064 | } |
6065 | 6065 | |
6066 | 6066 | /** |
@@ -6084,7 +6084,7 @@ discard block |
||
6084 | 6084 | return ''; |
6085 | 6085 | } |
6086 | 6086 | |
6087 | - return (string) \mb_substr($str, 0, $offset); |
|
6087 | + return (string)\mb_substr($str, 0, $offset); |
|
6088 | 6088 | } |
6089 | 6089 | |
6090 | 6090 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6092,7 +6092,7 @@ discard block |
||
6092 | 6092 | return ''; |
6093 | 6093 | } |
6094 | 6094 | |
6095 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6095 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6096 | 6096 | } |
6097 | 6097 | |
6098 | 6098 | /** |
@@ -6180,12 +6180,12 @@ discard block |
||
6180 | 6180 | } |
6181 | 6181 | |
6182 | 6182 | if ($encoding === 'UTF-8') { |
6183 | - return (string) \mb_substr($str, -$n); |
|
6183 | + return (string)\mb_substr($str, -$n); |
|
6184 | 6184 | } |
6185 | 6185 | |
6186 | 6186 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6187 | 6187 | |
6188 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6188 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6189 | 6189 | } |
6190 | 6190 | |
6191 | 6191 | /** |
@@ -6209,21 +6209,21 @@ discard block |
||
6209 | 6209 | } |
6210 | 6210 | |
6211 | 6211 | if ($encoding === 'UTF-8') { |
6212 | - if ((int) \mb_strlen($str) <= $length) { |
|
6212 | + if ((int)\mb_strlen($str) <= $length) { |
|
6213 | 6213 | return $str; |
6214 | 6214 | } |
6215 | 6215 | |
6216 | 6216 | /** @noinspection UnnecessaryCastingInspection */ |
6217 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($strAddOn)) . $strAddOn; |
|
6217 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($strAddOn)).$strAddOn; |
|
6218 | 6218 | } |
6219 | 6219 | |
6220 | 6220 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6221 | 6221 | |
6222 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6222 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6223 | 6223 | return $str; |
6224 | 6224 | } |
6225 | 6225 | |
6226 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($strAddOn), $encoding)) . $strAddOn; |
|
6226 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($strAddOn), $encoding)).$strAddOn; |
|
6227 | 6227 | } |
6228 | 6228 | |
6229 | 6229 | /** |
@@ -6248,12 +6248,12 @@ discard block |
||
6248 | 6248 | |
6249 | 6249 | if ($encoding === 'UTF-8') { |
6250 | 6250 | /** @noinspection UnnecessaryCastingInspection */ |
6251 | - if ((int) \mb_strlen($str) <= $length) { |
|
6251 | + if ((int)\mb_strlen($str) <= $length) { |
|
6252 | 6252 | return $str; |
6253 | 6253 | } |
6254 | 6254 | |
6255 | 6255 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6256 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6256 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6257 | 6257 | } |
6258 | 6258 | |
6259 | 6259 | $str = \mb_substr($str, 0, $length); |
@@ -6263,20 +6263,20 @@ discard block |
||
6263 | 6263 | $new_str = \implode(' ', $array); |
6264 | 6264 | |
6265 | 6265 | if ($new_str === '') { |
6266 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6266 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6267 | 6267 | } |
6268 | 6268 | } else { |
6269 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6269 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6270 | 6270 | return $str; |
6271 | 6271 | } |
6272 | 6272 | |
6273 | 6273 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6274 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6274 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6275 | 6275 | } |
6276 | 6276 | |
6277 | 6277 | $str = self::substr($str, 0, $length, $encoding); |
6278 | 6278 | if ($str === false) { |
6279 | - return '' . $strAddOn; |
|
6279 | + return ''.$strAddOn; |
|
6280 | 6280 | } |
6281 | 6281 | |
6282 | 6282 | $array = \explode(' ', $str); |
@@ -6284,11 +6284,11 @@ discard block |
||
6284 | 6284 | $new_str = \implode(' ', $array); |
6285 | 6285 | |
6286 | 6286 | if ($new_str === '') { |
6287 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6287 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6288 | 6288 | } |
6289 | 6289 | } |
6290 | 6290 | |
6291 | - return $new_str . $strAddOn; |
|
6291 | + return $new_str.$strAddOn; |
|
6292 | 6292 | } |
6293 | 6293 | |
6294 | 6294 | /** |
@@ -6306,7 +6306,7 @@ discard block |
||
6306 | 6306 | $longestCommonPrefix = ''; |
6307 | 6307 | |
6308 | 6308 | if ($encoding === 'UTF-8') { |
6309 | - $maxLength = (int) \min( |
|
6309 | + $maxLength = (int)\min( |
|
6310 | 6310 | \mb_strlen($str), |
6311 | 6311 | \mb_strlen($otherStr) |
6312 | 6312 | ); |
@@ -6327,7 +6327,7 @@ discard block |
||
6327 | 6327 | } else { |
6328 | 6328 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6329 | 6329 | |
6330 | - $maxLength = (int) \min( |
|
6330 | + $maxLength = (int)\min( |
|
6331 | 6331 | self::strlen($str, $encoding), |
6332 | 6332 | self::strlen($otherStr, $encoding) |
6333 | 6333 | ); |
@@ -6370,13 +6370,13 @@ discard block |
||
6370 | 6370 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6371 | 6371 | |
6372 | 6372 | if ($encoding === 'UTF-8') { |
6373 | - $strLength = (int) \mb_strlen($str); |
|
6374 | - $otherLength = (int) \mb_strlen($otherStr); |
|
6373 | + $strLength = (int)\mb_strlen($str); |
|
6374 | + $otherLength = (int)\mb_strlen($otherStr); |
|
6375 | 6375 | } else { |
6376 | 6376 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6377 | 6377 | |
6378 | - $strLength = (int) self::strlen($str, $encoding); |
|
6379 | - $otherLength = (int) self::strlen($otherStr, $encoding); |
|
6378 | + $strLength = (int)self::strlen($str, $encoding); |
|
6379 | + $otherLength = (int)self::strlen($otherStr, $encoding); |
|
6380 | 6380 | } |
6381 | 6381 | |
6382 | 6382 | // Return if either string is empty |
@@ -6429,10 +6429,10 @@ discard block |
||
6429 | 6429 | } |
6430 | 6430 | |
6431 | 6431 | if ($encoding === 'UTF-8') { |
6432 | - return (string) \mb_substr($str, $end - $len, $len); |
|
6432 | + return (string)\mb_substr($str, $end - $len, $len); |
|
6433 | 6433 | } |
6434 | 6434 | |
6435 | - return (string) self::substr($str, $end - $len, $len, $encoding); |
|
6435 | + return (string)self::substr($str, $end - $len, $len, $encoding); |
|
6436 | 6436 | } |
6437 | 6437 | |
6438 | 6438 | /** |
@@ -6451,7 +6451,7 @@ discard block |
||
6451 | 6451 | } |
6452 | 6452 | |
6453 | 6453 | if ($encoding === 'UTF-8') { |
6454 | - $maxLength = (int) \min( |
|
6454 | + $maxLength = (int)\min( |
|
6455 | 6455 | \mb_strlen($str, $encoding), |
6456 | 6456 | \mb_strlen($otherStr, $encoding) |
6457 | 6457 | ); |
@@ -6465,7 +6465,7 @@ discard block |
||
6465 | 6465 | && |
6466 | 6466 | $char === \mb_substr($otherStr, -$i, 1) |
6467 | 6467 | ) { |
6468 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6468 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6469 | 6469 | } else { |
6470 | 6470 | break; |
6471 | 6471 | } |
@@ -6473,7 +6473,7 @@ discard block |
||
6473 | 6473 | } else { |
6474 | 6474 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6475 | 6475 | |
6476 | - $maxLength = (int) \min( |
|
6476 | + $maxLength = (int)\min( |
|
6477 | 6477 | self::strlen($str, $encoding), |
6478 | 6478 | self::strlen($otherStr, $encoding) |
6479 | 6479 | ); |
@@ -6487,7 +6487,7 @@ discard block |
||
6487 | 6487 | && |
6488 | 6488 | $char === self::substr($otherStr, -$i, 1, $encoding) |
6489 | 6489 | ) { |
6490 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6490 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6491 | 6491 | } else { |
6492 | 6492 | break; |
6493 | 6493 | } |
@@ -6507,7 +6507,7 @@ discard block |
||
6507 | 6507 | */ |
6508 | 6508 | public static function str_matches_pattern(string $str, string $pattern): bool |
6509 | 6509 | { |
6510 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6510 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6511 | 6511 | } |
6512 | 6512 | |
6513 | 6513 | /** |
@@ -6524,7 +6524,7 @@ discard block |
||
6524 | 6524 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6525 | 6525 | { |
6526 | 6526 | // init |
6527 | - $length = (int) self::strlen($str, $encoding); |
|
6527 | + $length = (int)self::strlen($str, $encoding); |
|
6528 | 6528 | |
6529 | 6529 | if ($offset >= 0) { |
6530 | 6530 | return $length > $offset; |
@@ -6550,7 +6550,7 @@ discard block |
||
6550 | 6550 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6551 | 6551 | { |
6552 | 6552 | // init |
6553 | - $length = (int) self::strlen($str); |
|
6553 | + $length = (int)self::strlen($str); |
|
6554 | 6554 | |
6555 | 6555 | if ( |
6556 | 6556 | ($index >= 0 && $length <= $index) |
@@ -6589,7 +6589,7 @@ discard block |
||
6589 | 6589 | return $str; |
6590 | 6590 | } |
6591 | 6591 | |
6592 | - if ($pad_type !== (int) $pad_type) { |
|
6592 | + if ($pad_type !== (int)$pad_type) { |
|
6593 | 6593 | if ($pad_type === 'left') { |
6594 | 6594 | $pad_type = \STR_PAD_LEFT; |
6595 | 6595 | } elseif ($pad_type === 'right') { |
@@ -6598,23 +6598,23 @@ discard block |
||
6598 | 6598 | $pad_type = \STR_PAD_BOTH; |
6599 | 6599 | } else { |
6600 | 6600 | throw new \InvalidArgumentException( |
6601 | - 'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6601 | + 'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6602 | 6602 | ); |
6603 | 6603 | } |
6604 | 6604 | } |
6605 | 6605 | |
6606 | 6606 | if ($encoding === 'UTF-8') { |
6607 | - $str_length = (int) \mb_strlen($str); |
|
6607 | + $str_length = (int)\mb_strlen($str); |
|
6608 | 6608 | |
6609 | 6609 | if ($pad_length >= $str_length) { |
6610 | 6610 | switch ($pad_type) { |
6611 | 6611 | case \STR_PAD_LEFT: |
6612 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6612 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6613 | 6613 | |
6614 | 6614 | $diff = ($pad_length - $str_length); |
6615 | 6615 | |
6616 | - $pre = (string) \mb_substr( |
|
6617 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6616 | + $pre = (string)\mb_substr( |
|
6617 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6618 | 6618 | 0, |
6619 | 6619 | $diff |
6620 | 6620 | ); |
@@ -6625,16 +6625,16 @@ discard block |
||
6625 | 6625 | case \STR_PAD_BOTH: |
6626 | 6626 | $diff = ($pad_length - $str_length); |
6627 | 6627 | |
6628 | - $ps_length_left = (int) \floor($diff / 2); |
|
6628 | + $ps_length_left = (int)\floor($diff / 2); |
|
6629 | 6629 | |
6630 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6630 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6631 | 6631 | |
6632 | - $pre = (string) \mb_substr( |
|
6632 | + $pre = (string)\mb_substr( |
|
6633 | 6633 | \str_repeat($pad_string, $ps_length_left), |
6634 | 6634 | 0, |
6635 | 6635 | $ps_length_left |
6636 | 6636 | ); |
6637 | - $post = (string) \mb_substr( |
|
6637 | + $post = (string)\mb_substr( |
|
6638 | 6638 | \str_repeat($pad_string, $ps_length_right), |
6639 | 6639 | 0, |
6640 | 6640 | $ps_length_right |
@@ -6644,19 +6644,19 @@ discard block |
||
6644 | 6644 | |
6645 | 6645 | case \STR_PAD_RIGHT: |
6646 | 6646 | default: |
6647 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6647 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6648 | 6648 | |
6649 | 6649 | $diff = ($pad_length - $str_length); |
6650 | 6650 | |
6651 | - $post = (string) \mb_substr( |
|
6652 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6651 | + $post = (string)\mb_substr( |
|
6652 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6653 | 6653 | 0, |
6654 | 6654 | $diff |
6655 | 6655 | ); |
6656 | 6656 | $pre = ''; |
6657 | 6657 | } |
6658 | 6658 | |
6659 | - return $pre . $str . $post; |
|
6659 | + return $pre.$str.$post; |
|
6660 | 6660 | } |
6661 | 6661 | |
6662 | 6662 | return $str; |
@@ -6664,17 +6664,17 @@ discard block |
||
6664 | 6664 | |
6665 | 6665 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6666 | 6666 | |
6667 | - $str_length = (int) self::strlen($str, $encoding); |
|
6667 | + $str_length = (int)self::strlen($str, $encoding); |
|
6668 | 6668 | |
6669 | 6669 | if ($pad_length >= $str_length) { |
6670 | 6670 | switch ($pad_type) { |
6671 | 6671 | case \STR_PAD_LEFT: |
6672 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6672 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6673 | 6673 | |
6674 | 6674 | $diff = ($pad_length - $str_length); |
6675 | 6675 | |
6676 | - $pre = (string) self::substr( |
|
6677 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6676 | + $pre = (string)self::substr( |
|
6677 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6678 | 6678 | 0, |
6679 | 6679 | $diff, |
6680 | 6680 | $encoding |
@@ -6686,17 +6686,17 @@ discard block |
||
6686 | 6686 | case \STR_PAD_BOTH: |
6687 | 6687 | $diff = ($pad_length - $str_length); |
6688 | 6688 | |
6689 | - $ps_length_left = (int) \floor($diff / 2); |
|
6689 | + $ps_length_left = (int)\floor($diff / 2); |
|
6690 | 6690 | |
6691 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6691 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6692 | 6692 | |
6693 | - $pre = (string) self::substr( |
|
6693 | + $pre = (string)self::substr( |
|
6694 | 6694 | \str_repeat($pad_string, $ps_length_left), |
6695 | 6695 | 0, |
6696 | 6696 | $ps_length_left, |
6697 | 6697 | $encoding |
6698 | 6698 | ); |
6699 | - $post = (string) self::substr( |
|
6699 | + $post = (string)self::substr( |
|
6700 | 6700 | \str_repeat($pad_string, $ps_length_right), |
6701 | 6701 | 0, |
6702 | 6702 | $ps_length_right, |
@@ -6707,12 +6707,12 @@ discard block |
||
6707 | 6707 | |
6708 | 6708 | case \STR_PAD_RIGHT: |
6709 | 6709 | default: |
6710 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6710 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6711 | 6711 | |
6712 | 6712 | $diff = ($pad_length - $str_length); |
6713 | 6713 | |
6714 | - $post = (string) self::substr( |
|
6715 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6714 | + $post = (string)self::substr( |
|
6715 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6716 | 6716 | 0, |
6717 | 6717 | $diff, |
6718 | 6718 | $encoding |
@@ -6720,7 +6720,7 @@ discard block |
||
6720 | 6720 | $pre = ''; |
6721 | 6721 | } |
6722 | 6722 | |
6723 | - return $pre . $str . $post; |
|
6723 | + return $pre.$str.$post; |
|
6724 | 6724 | } |
6725 | 6725 | |
6726 | 6726 | return $str; |
@@ -6879,11 +6879,11 @@ discard block |
||
6879 | 6879 | } |
6880 | 6880 | |
6881 | 6881 | if ($search === '') { |
6882 | - return $str . $replacement; |
|
6882 | + return $str.$replacement; |
|
6883 | 6883 | } |
6884 | 6884 | |
6885 | 6885 | if (\strpos($str, $search) === 0) { |
6886 | - return $replacement . \substr($str, \strlen($search)); |
|
6886 | + return $replacement.\substr($str, \strlen($search)); |
|
6887 | 6887 | } |
6888 | 6888 | |
6889 | 6889 | return $str; |
@@ -6911,11 +6911,11 @@ discard block |
||
6911 | 6911 | } |
6912 | 6912 | |
6913 | 6913 | if ($search === '') { |
6914 | - return $str . $replacement; |
|
6914 | + return $str.$replacement; |
|
6915 | 6915 | } |
6916 | 6916 | |
6917 | 6917 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6918 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6918 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6919 | 6919 | } |
6920 | 6920 | |
6921 | 6921 | return $str; |
@@ -6944,7 +6944,7 @@ discard block |
||
6944 | 6944 | $subject, |
6945 | 6945 | $replace, |
6946 | 6946 | $pos, |
6947 | - (int) self::strlen($search) |
|
6947 | + (int)self::strlen($search) |
|
6948 | 6948 | ); |
6949 | 6949 | } |
6950 | 6950 | |
@@ -6976,7 +6976,7 @@ discard block |
||
6976 | 6976 | $subject, |
6977 | 6977 | $replace, |
6978 | 6978 | $pos, |
6979 | - (int) self::strlen($search) |
|
6979 | + (int)self::strlen($search) |
|
6980 | 6980 | ); |
6981 | 6981 | } |
6982 | 6982 | |
@@ -6996,7 +6996,7 @@ discard block |
||
6996 | 6996 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
6997 | 6997 | { |
6998 | 6998 | if ($encoding === 'UTF-8') { |
6999 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
6999 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
7000 | 7000 | /** @noinspection NonSecureShuffleUsageInspection */ |
7001 | 7001 | \shuffle($indexes); |
7002 | 7002 | |
@@ -7012,7 +7012,7 @@ discard block |
||
7012 | 7012 | } else { |
7013 | 7013 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7014 | 7014 | |
7015 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
7015 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
7016 | 7016 | /** @noinspection NonSecureShuffleUsageInspection */ |
7017 | 7017 | \shuffle($indexes); |
7018 | 7018 | |
@@ -7053,11 +7053,11 @@ discard block |
||
7053 | 7053 | ) { |
7054 | 7054 | if ($encoding === 'UTF-8') { |
7055 | 7055 | if ($end === null) { |
7056 | - $length = (int) \mb_strlen($str); |
|
7056 | + $length = (int)\mb_strlen($str); |
|
7057 | 7057 | } elseif ($end >= 0 && $end <= $start) { |
7058 | 7058 | return ''; |
7059 | 7059 | } elseif ($end < 0) { |
7060 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7060 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7061 | 7061 | } else { |
7062 | 7062 | $length = $end - $start; |
7063 | 7063 | } |
@@ -7068,11 +7068,11 @@ discard block |
||
7068 | 7068 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7069 | 7069 | |
7070 | 7070 | if ($end === null) { |
7071 | - $length = (int) self::strlen($str, $encoding); |
|
7071 | + $length = (int)self::strlen($str, $encoding); |
|
7072 | 7072 | } elseif ($end >= 0 && $end <= $start) { |
7073 | 7073 | return ''; |
7074 | 7074 | } elseif ($end < 0) { |
7075 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7075 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7076 | 7076 | } else { |
7077 | 7077 | $length = $end - $start; |
7078 | 7078 | } |
@@ -7104,35 +7104,35 @@ discard block |
||
7104 | 7104 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7105 | 7105 | } |
7106 | 7106 | |
7107 | - $str = (string) \preg_replace_callback( |
|
7107 | + $str = (string)\preg_replace_callback( |
|
7108 | 7108 | '/([\\p{N}|\\p{Lu}])/u', |
7109 | 7109 | /** |
7110 | 7110 | * @param string[] $matches |
7111 | 7111 | * |
7112 | 7112 | * @return string |
7113 | 7113 | */ |
7114 | - static function (array $matches) use ($encoding): string { |
|
7114 | + static function(array $matches) use ($encoding): string { |
|
7115 | 7115 | $match = $matches[1]; |
7116 | - $matchInt = (int) $match; |
|
7116 | + $matchInt = (int)$match; |
|
7117 | 7117 | |
7118 | - if ((string) $matchInt === $match) { |
|
7119 | - return '_' . $match . '_'; |
|
7118 | + if ((string)$matchInt === $match) { |
|
7119 | + return '_'.$match.'_'; |
|
7120 | 7120 | } |
7121 | 7121 | |
7122 | 7122 | if ($encoding === 'UTF-8') { |
7123 | - return '_' . \mb_strtolower($match); |
|
7123 | + return '_'.\mb_strtolower($match); |
|
7124 | 7124 | } |
7125 | 7125 | |
7126 | - return '_' . self::strtolower($match, $encoding); |
|
7126 | + return '_'.self::strtolower($match, $encoding); |
|
7127 | 7127 | }, |
7128 | 7128 | $str |
7129 | 7129 | ); |
7130 | 7130 | |
7131 | - $str = (string) \preg_replace( |
|
7131 | + $str = (string)\preg_replace( |
|
7132 | 7132 | [ |
7133 | - '/\\s+/u', // convert spaces to "_" |
|
7133 | + '/\\s+/u', // convert spaces to "_" |
|
7134 | 7134 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
7135 | - '/_+/', // remove double "_" |
|
7135 | + '/_+/', // remove double "_" |
|
7136 | 7136 | ], |
7137 | 7137 | [ |
7138 | 7138 | '_', |
@@ -7208,7 +7208,7 @@ discard block |
||
7208 | 7208 | } |
7209 | 7209 | |
7210 | 7210 | // init |
7211 | - $str = (string) $str; |
|
7211 | + $str = (string)$str; |
|
7212 | 7212 | |
7213 | 7213 | if ($str === '') { |
7214 | 7214 | return []; |
@@ -7255,7 +7255,7 @@ discard block |
||
7255 | 7255 | ($str[$i] & "\xE0") === "\xC0" |
7256 | 7256 | ) { |
7257 | 7257 | if (($str[$i + 1] & "\xC0") === "\x80") { |
7258 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
7258 | + $ret[] = $str[$i].$str[$i + 1]; |
|
7259 | 7259 | |
7260 | 7260 | ++$i; |
7261 | 7261 | } |
@@ -7269,7 +7269,7 @@ discard block |
||
7269 | 7269 | && |
7270 | 7270 | ($str[$i + 2] & "\xC0") === "\x80" |
7271 | 7271 | ) { |
7272 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
7272 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
7273 | 7273 | |
7274 | 7274 | $i += 2; |
7275 | 7275 | } |
@@ -7285,7 +7285,7 @@ discard block |
||
7285 | 7285 | && |
7286 | 7286 | ($str[$i + 3] & "\xC0") === "\x80" |
7287 | 7287 | ) { |
7288 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
7288 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
7289 | 7289 | |
7290 | 7290 | $i += 3; |
7291 | 7291 | } |
@@ -7297,7 +7297,7 @@ discard block |
||
7297 | 7297 | $ret = \array_chunk($ret, $length); |
7298 | 7298 | |
7299 | 7299 | return \array_map( |
7300 | - static function (array &$item): string { |
|
7300 | + static function(array &$item): string { |
|
7301 | 7301 | return \implode('', $item); |
7302 | 7302 | }, |
7303 | 7303 | $ret |
@@ -7360,7 +7360,7 @@ discard block |
||
7360 | 7360 | $limit = -1; |
7361 | 7361 | } |
7362 | 7362 | |
7363 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7363 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7364 | 7364 | |
7365 | 7365 | if ($array === false) { |
7366 | 7366 | return []; |
@@ -7444,9 +7444,9 @@ discard block |
||
7444 | 7444 | return ''; |
7445 | 7445 | } |
7446 | 7446 | |
7447 | - return (string) \mb_substr( |
|
7447 | + return (string)\mb_substr( |
|
7448 | 7448 | $str, |
7449 | - $offset + (int) \mb_strlen($separator) |
|
7449 | + $offset + (int)\mb_strlen($separator) |
|
7450 | 7450 | ); |
7451 | 7451 | } |
7452 | 7452 | |
@@ -7455,9 +7455,9 @@ discard block |
||
7455 | 7455 | return ''; |
7456 | 7456 | } |
7457 | 7457 | |
7458 | - return (string) \mb_substr( |
|
7458 | + return (string)\mb_substr( |
|
7459 | 7459 | $str, |
7460 | - $offset + (int) self::strlen($separator, $encoding), |
|
7460 | + $offset + (int)self::strlen($separator, $encoding), |
|
7461 | 7461 | null, |
7462 | 7462 | $encoding |
7463 | 7463 | ); |
@@ -7484,9 +7484,9 @@ discard block |
||
7484 | 7484 | return ''; |
7485 | 7485 | } |
7486 | 7486 | |
7487 | - return (string) \mb_substr( |
|
7487 | + return (string)\mb_substr( |
|
7488 | 7488 | $str, |
7489 | - $offset + (int) \mb_strlen($separator) |
|
7489 | + $offset + (int)\mb_strlen($separator) |
|
7490 | 7490 | ); |
7491 | 7491 | } |
7492 | 7492 | |
@@ -7495,9 +7495,9 @@ discard block |
||
7495 | 7495 | return ''; |
7496 | 7496 | } |
7497 | 7497 | |
7498 | - return (string) self::substr( |
|
7498 | + return (string)self::substr( |
|
7499 | 7499 | $str, |
7500 | - $offset + (int) self::strlen($separator, $encoding), |
|
7500 | + $offset + (int)self::strlen($separator, $encoding), |
|
7501 | 7501 | null, |
7502 | 7502 | $encoding |
7503 | 7503 | ); |
@@ -7527,7 +7527,7 @@ discard block |
||
7527 | 7527 | return ''; |
7528 | 7528 | } |
7529 | 7529 | |
7530 | - return (string) \mb_substr( |
|
7530 | + return (string)\mb_substr( |
|
7531 | 7531 | $str, |
7532 | 7532 | 0, |
7533 | 7533 | $offset |
@@ -7539,7 +7539,7 @@ discard block |
||
7539 | 7539 | return ''; |
7540 | 7540 | } |
7541 | 7541 | |
7542 | - return (string) self::substr( |
|
7542 | + return (string)self::substr( |
|
7543 | 7543 | $str, |
7544 | 7544 | 0, |
7545 | 7545 | $offset, |
@@ -7568,7 +7568,7 @@ discard block |
||
7568 | 7568 | return ''; |
7569 | 7569 | } |
7570 | 7570 | |
7571 | - return (string) \mb_substr( |
|
7571 | + return (string)\mb_substr( |
|
7572 | 7572 | $str, |
7573 | 7573 | 0, |
7574 | 7574 | $offset |
@@ -7582,7 +7582,7 @@ discard block |
||
7582 | 7582 | |
7583 | 7583 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7584 | 7584 | |
7585 | - return (string) self::substr( |
|
7585 | + return (string)self::substr( |
|
7586 | 7586 | $str, |
7587 | 7587 | 0, |
7588 | 7588 | $offset, |
@@ -7690,7 +7690,7 @@ discard block |
||
7690 | 7690 | */ |
7691 | 7691 | public static function str_surround(string $str, string $substring): string |
7692 | 7692 | { |
7693 | - return $substring . $str . $substring; |
|
7693 | + return $substring.$str.$substring; |
|
7694 | 7694 | } |
7695 | 7695 | |
7696 | 7696 | /** |
@@ -7734,9 +7734,9 @@ discard block |
||
7734 | 7734 | |
7735 | 7735 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
7736 | 7736 | |
7737 | - return (string) \preg_replace_callback( |
|
7737 | + return (string)\preg_replace_callback( |
|
7738 | 7738 | '/([^\\s]+)/u', |
7739 | - static function (array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7739 | + static function(array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7740 | 7740 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
7741 | 7741 | return $match[0]; |
7742 | 7742 | } |
@@ -7822,16 +7822,16 @@ discard block |
||
7822 | 7822 | } |
7823 | 7823 | |
7824 | 7824 | // the main substitutions |
7825 | - $str = (string) \preg_replace_callback( |
|
7825 | + $str = (string)\preg_replace_callback( |
|
7826 | 7826 | '~\\b (_*) (?: # 1. Leading underscore and |
7827 | 7827 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
7828 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
7828 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
7829 | 7829 | | |
7830 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
7830 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
7831 | 7831 | | |
7832 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
7832 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
7833 | 7833 | | |
7834 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
7834 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
7835 | 7835 | ) (_*) \\b # 6. With trailing underscore |
7836 | 7836 | ~ux', |
7837 | 7837 | /** |
@@ -7839,7 +7839,7 @@ discard block |
||
7839 | 7839 | * |
7840 | 7840 | * @return string |
7841 | 7841 | */ |
7842 | - static function (array $matches) use ($encoding): string { |
|
7842 | + static function(array $matches) use ($encoding): string { |
|
7843 | 7843 | // preserve leading underscore |
7844 | 7844 | $str = $matches[1]; |
7845 | 7845 | if ($matches[2]) { |
@@ -7864,26 +7864,26 @@ discard block |
||
7864 | 7864 | ); |
7865 | 7865 | |
7866 | 7866 | // Exceptions for small words: capitalize at start of title... |
7867 | - $str = (string) \preg_replace_callback( |
|
7867 | + $str = (string)\preg_replace_callback( |
|
7868 | 7868 | '~( \\A [[:punct:]]* # start of title... |
7869 | 7869 | | [:.;?!][ ]+ # or of subsentence... |
7870 | 7870 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
7871 | - ( ' . $smallWordsRx . ' ) \\b # ...followed by small word |
|
7871 | + ( ' . $smallWordsRx.' ) \\b # ...followed by small word |
|
7872 | 7872 | ~uxi', |
7873 | 7873 | /** |
7874 | 7874 | * @param string[] $matches |
7875 | 7875 | * |
7876 | 7876 | * @return string |
7877 | 7877 | */ |
7878 | - static function (array $matches) use ($encoding): string { |
|
7879 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7878 | + static function(array $matches) use ($encoding): string { |
|
7879 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7880 | 7880 | }, |
7881 | 7881 | $str |
7882 | 7882 | ); |
7883 | 7883 | |
7884 | 7884 | // ...and end of title |
7885 | - $str = (string) \preg_replace_callback( |
|
7886 | - '~\\b ( ' . $smallWordsRx . ' ) # small word... |
|
7885 | + $str = (string)\preg_replace_callback( |
|
7886 | + '~\\b ( '.$smallWordsRx.' ) # small word... |
|
7887 | 7887 | (?= [[:punct:]]* \Z # ...at the end of the title... |
7888 | 7888 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
7889 | 7889 | ~uxi', |
@@ -7892,7 +7892,7 @@ discard block |
||
7892 | 7892 | * |
7893 | 7893 | * @return string |
7894 | 7894 | */ |
7895 | - static function (array $matches) use ($encoding): string { |
|
7895 | + static function(array $matches) use ($encoding): string { |
|
7896 | 7896 | return static::str_upper_first($matches[1], $encoding); |
7897 | 7897 | }, |
7898 | 7898 | $str |
@@ -7900,10 +7900,10 @@ discard block |
||
7900 | 7900 | |
7901 | 7901 | // Exceptions for small words in hyphenated compound words. |
7902 | 7902 | // e.g. "in-flight" -> In-Flight |
7903 | - $str = (string) \preg_replace_callback( |
|
7903 | + $str = (string)\preg_replace_callback( |
|
7904 | 7904 | '~\\b |
7905 | 7905 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
7906 | - ( ' . $smallWordsRx . ' ) |
|
7906 | + ( ' . $smallWordsRx.' ) |
|
7907 | 7907 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
7908 | 7908 | ~uxi', |
7909 | 7909 | /** |
@@ -7911,18 +7911,18 @@ discard block |
||
7911 | 7911 | * |
7912 | 7912 | * @return string |
7913 | 7913 | */ |
7914 | - static function (array $matches) use ($encoding): string { |
|
7914 | + static function(array $matches) use ($encoding): string { |
|
7915 | 7915 | return static::str_upper_first($matches[1], $encoding); |
7916 | 7916 | }, |
7917 | 7917 | $str |
7918 | 7918 | ); |
7919 | 7919 | |
7920 | 7920 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
7921 | - $str = (string) \preg_replace_callback( |
|
7921 | + $str = (string)\preg_replace_callback( |
|
7922 | 7922 | '~\\b |
7923 | 7923 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
7924 | 7924 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
7925 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
7925 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
7926 | 7926 | (?! - ) # Negative lookahead for another - |
7927 | 7927 | ~uxi', |
7928 | 7928 | /** |
@@ -7930,8 +7930,8 @@ discard block |
||
7930 | 7930 | * |
7931 | 7931 | * @return string |
7932 | 7932 | */ |
7933 | - static function (array $matches) use ($encoding): string { |
|
7934 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7933 | + static function(array $matches) use ($encoding): string { |
|
7934 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7935 | 7935 | }, |
7936 | 7936 | $str |
7937 | 7937 | ); |
@@ -8039,7 +8039,7 @@ discard block |
||
8039 | 8039 | ); |
8040 | 8040 | |
8041 | 8041 | foreach ($tmpReturn as &$item) { |
8042 | - $item = (string) $item; |
|
8042 | + $item = (string)$item; |
|
8043 | 8043 | } |
8044 | 8044 | |
8045 | 8045 | return $tmpReturn; |
@@ -8084,39 +8084,39 @@ discard block |
||
8084 | 8084 | } |
8085 | 8085 | |
8086 | 8086 | if ($encoding === 'UTF-8') { |
8087 | - if ($length >= (int) \mb_strlen($str)) { |
|
8087 | + if ($length >= (int)\mb_strlen($str)) { |
|
8088 | 8088 | return $str; |
8089 | 8089 | } |
8090 | 8090 | |
8091 | 8091 | if ($substring !== '') { |
8092 | - $length -= (int) \mb_strlen($substring); |
|
8092 | + $length -= (int)\mb_strlen($substring); |
|
8093 | 8093 | |
8094 | 8094 | /** @noinspection UnnecessaryCastingInspection */ |
8095 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8095 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8096 | 8096 | } |
8097 | 8097 | |
8098 | 8098 | /** @noinspection UnnecessaryCastingInspection */ |
8099 | - return (string) \mb_substr($str, 0, $length); |
|
8099 | + return (string)\mb_substr($str, 0, $length); |
|
8100 | 8100 | } |
8101 | 8101 | |
8102 | 8102 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8103 | 8103 | |
8104 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8104 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8105 | 8105 | return $str; |
8106 | 8106 | } |
8107 | 8107 | |
8108 | 8108 | if ($substring !== '') { |
8109 | - $length -= (int) self::strlen($substring, $encoding); |
|
8109 | + $length -= (int)self::strlen($substring, $encoding); |
|
8110 | 8110 | } |
8111 | 8111 | |
8112 | 8112 | return ( |
8113 | - (string) self::substr( |
|
8113 | + (string)self::substr( |
|
8114 | 8114 | $str, |
8115 | 8115 | 0, |
8116 | 8116 | $length, |
8117 | 8117 | $encoding |
8118 | 8118 | ) |
8119 | - ) . $substring; |
|
8119 | + ).$substring; |
|
8120 | 8120 | } |
8121 | 8121 | |
8122 | 8122 | /** |
@@ -8146,12 +8146,12 @@ discard block |
||
8146 | 8146 | } |
8147 | 8147 | |
8148 | 8148 | if ($encoding === 'UTF-8') { |
8149 | - if ($length >= (int) \mb_strlen($str)) { |
|
8149 | + if ($length >= (int)\mb_strlen($str)) { |
|
8150 | 8150 | return $str; |
8151 | 8151 | } |
8152 | 8152 | |
8153 | 8153 | // need to further trim the string so we can append the substring |
8154 | - $length -= (int) \mb_strlen($substring); |
|
8154 | + $length -= (int)\mb_strlen($substring); |
|
8155 | 8155 | if ($length <= 0) { |
8156 | 8156 | return $substring; |
8157 | 8157 | } |
@@ -8173,18 +8173,18 @@ discard block |
||
8173 | 8173 | || |
8174 | 8174 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8175 | 8175 | ) { |
8176 | - $truncated = (string) \mb_substr($truncated, 0, (int) $lastPos); |
|
8176 | + $truncated = (string)\mb_substr($truncated, 0, (int)$lastPos); |
|
8177 | 8177 | } |
8178 | 8178 | } |
8179 | 8179 | } else { |
8180 | 8180 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8181 | 8181 | |
8182 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8182 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8183 | 8183 | return $str; |
8184 | 8184 | } |
8185 | 8185 | |
8186 | 8186 | // need to further trim the string so we can append the substring |
8187 | - $length -= (int) self::strlen($substring, $encoding); |
|
8187 | + $length -= (int)self::strlen($substring, $encoding); |
|
8188 | 8188 | if ($length <= 0) { |
8189 | 8189 | return $substring; |
8190 | 8190 | } |
@@ -8206,12 +8206,12 @@ discard block |
||
8206 | 8206 | || |
8207 | 8207 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8208 | 8208 | ) { |
8209 | - $truncated = (string) self::substr($truncated, 0, (int) $lastPos, $encoding); |
|
8209 | + $truncated = (string)self::substr($truncated, 0, (int)$lastPos, $encoding); |
|
8210 | 8210 | } |
8211 | 8211 | } |
8212 | 8212 | } |
8213 | 8213 | |
8214 | - return $truncated . $substring; |
|
8214 | + return $truncated.$substring; |
|
8215 | 8215 | } |
8216 | 8216 | |
8217 | 8217 | /** |
@@ -8301,13 +8301,13 @@ discard block |
||
8301 | 8301 | } |
8302 | 8302 | } elseif ($format === 2) { |
8303 | 8303 | $numberOfWords = []; |
8304 | - $offset = (int) self::strlen($strParts[0]); |
|
8304 | + $offset = (int)self::strlen($strParts[0]); |
|
8305 | 8305 | for ($i = 1; $i < $len; $i += 2) { |
8306 | 8306 | $numberOfWords[$offset] = $strParts[$i]; |
8307 | - $offset += (int) self::strlen($strParts[$i]) + (int) self::strlen($strParts[$i + 1]); |
|
8307 | + $offset += (int)self::strlen($strParts[$i]) + (int)self::strlen($strParts[$i + 1]); |
|
8308 | 8308 | } |
8309 | 8309 | } else { |
8310 | - $numberOfWords = (int) (($len - 1) / 2); |
|
8310 | + $numberOfWords = (int)(($len - 1) / 2); |
|
8311 | 8311 | } |
8312 | 8312 | |
8313 | 8313 | return $numberOfWords; |
@@ -8404,21 +8404,21 @@ discard block |
||
8404 | 8404 | } |
8405 | 8405 | |
8406 | 8406 | if ($charList === '') { |
8407 | - return (int) self::strlen($str, $encoding); |
|
8407 | + return (int)self::strlen($str, $encoding); |
|
8408 | 8408 | } |
8409 | 8409 | |
8410 | 8410 | if ($offset !== null || $length !== null) { |
8411 | 8411 | if ($encoding === 'UTF-8') { |
8412 | 8412 | if ($length === null) { |
8413 | 8413 | /** @noinspection UnnecessaryCastingInspection */ |
8414 | - $strTmp = \mb_substr($str, (int) $offset); |
|
8414 | + $strTmp = \mb_substr($str, (int)$offset); |
|
8415 | 8415 | } else { |
8416 | 8416 | /** @noinspection UnnecessaryCastingInspection */ |
8417 | - $strTmp = \mb_substr($str, (int) $offset, $length); |
|
8417 | + $strTmp = \mb_substr($str, (int)$offset, $length); |
|
8418 | 8418 | } |
8419 | 8419 | } else { |
8420 | 8420 | /** @noinspection UnnecessaryCastingInspection */ |
8421 | - $strTmp = self::substr($str, (int) $offset, $length, $encoding); |
|
8421 | + $strTmp = self::substr($str, (int)$offset, $length, $encoding); |
|
8422 | 8422 | } |
8423 | 8423 | |
8424 | 8424 | if ($strTmp === false) { |
@@ -8433,7 +8433,7 @@ discard block |
||
8433 | 8433 | } |
8434 | 8434 | |
8435 | 8435 | $matches = []; |
8436 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $matches)) { |
|
8436 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $matches)) { |
|
8437 | 8437 | $return = self::strlen($matches[1], $encoding); |
8438 | 8438 | if ($return === false) { |
8439 | 8439 | return 0; |
@@ -8442,7 +8442,7 @@ discard block |
||
8442 | 8442 | return $return; |
8443 | 8443 | } |
8444 | 8444 | |
8445 | - return (int) self::strlen($str, $encoding); |
|
8445 | + return (int)self::strlen($str, $encoding); |
|
8446 | 8446 | } |
8447 | 8447 | |
8448 | 8448 | /** |
@@ -8564,7 +8564,7 @@ discard block |
||
8564 | 8564 | return ''; |
8565 | 8565 | } |
8566 | 8566 | |
8567 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
8567 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
8568 | 8568 | } |
8569 | 8569 | |
8570 | 8570 | /** |
@@ -8629,7 +8629,7 @@ discard block |
||
8629 | 8629 | // fallback for ascii only |
8630 | 8630 | // |
8631 | 8631 | |
8632 | - if (self::is_ascii($haystack . $needle)) { |
|
8632 | + if (self::is_ascii($haystack.$needle)) { |
|
8633 | 8633 | return \stripos($haystack, $needle, $offset); |
8634 | 8634 | } |
8635 | 8635 | |
@@ -8696,7 +8696,7 @@ discard block |
||
8696 | 8696 | && |
8697 | 8697 | self::$SUPPORT['mbstring'] === false |
8698 | 8698 | ) { |
8699 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8699 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8700 | 8700 | } |
8701 | 8701 | |
8702 | 8702 | if ( |
@@ -8710,11 +8710,11 @@ discard block |
||
8710 | 8710 | } |
8711 | 8711 | } |
8712 | 8712 | |
8713 | - if (self::is_ascii($needle . $haystack)) { |
|
8713 | + if (self::is_ascii($needle.$haystack)) { |
|
8714 | 8714 | return \stristr($haystack, $needle, $before_needle); |
8715 | 8715 | } |
8716 | 8716 | |
8717 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
8717 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
8718 | 8718 | |
8719 | 8719 | if (!isset($match[1])) { |
8720 | 8720 | return false; |
@@ -8724,7 +8724,7 @@ discard block |
||
8724 | 8724 | return $match[1]; |
8725 | 8725 | } |
8726 | 8726 | |
8727 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
8727 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
8728 | 8728 | } |
8729 | 8729 | |
8730 | 8730 | /** |
@@ -8791,7 +8791,7 @@ discard block |
||
8791 | 8791 | && |
8792 | 8792 | self::$SUPPORT['iconv'] === false |
8793 | 8793 | ) { |
8794 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8794 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8795 | 8795 | } |
8796 | 8796 | |
8797 | 8797 | // |
@@ -8907,8 +8907,8 @@ discard block |
||
8907 | 8907 | } |
8908 | 8908 | |
8909 | 8909 | return \strnatcmp( |
8910 | - (string) self::strtonatfold($str1), |
|
8911 | - (string) self::strtonatfold($str2) |
|
8910 | + (string)self::strtonatfold($str1), |
|
8911 | + (string)self::strtonatfold($str2) |
|
8912 | 8912 | ); |
8913 | 8913 | } |
8914 | 8914 | |
@@ -8966,11 +8966,11 @@ discard block |
||
8966 | 8966 | } |
8967 | 8967 | |
8968 | 8968 | if ($encoding === 'UTF-8') { |
8969 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
8970 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
8969 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
8970 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
8971 | 8971 | } else { |
8972 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
8973 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
8972 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
8973 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
8974 | 8974 | } |
8975 | 8975 | |
8976 | 8976 | return self::strcmp($str1, $str2); |
@@ -8992,8 +8992,8 @@ discard block |
||
8992 | 8992 | return false; |
8993 | 8993 | } |
8994 | 8994 | |
8995 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
8996 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
8995 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
8996 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
8997 | 8997 | } |
8998 | 8998 | |
8999 | 8999 | return false; |
@@ -9026,10 +9026,10 @@ discard block |
||
9026 | 9026 | } |
9027 | 9027 | |
9028 | 9028 | // iconv and mbstring do not support integer $needle |
9029 | - if ((int) $needle === $needle) { |
|
9030 | - $needle = (string) self::chr($needle); |
|
9029 | + if ((int)$needle === $needle) { |
|
9030 | + $needle = (string)self::chr($needle); |
|
9031 | 9031 | } |
9032 | - $needle = (string) $needle; |
|
9032 | + $needle = (string)$needle; |
|
9033 | 9033 | |
9034 | 9034 | if ($needle === '') { |
9035 | 9035 | return false; |
@@ -9076,7 +9076,7 @@ discard block |
||
9076 | 9076 | && |
9077 | 9077 | self::$SUPPORT['mbstring'] === false |
9078 | 9078 | ) { |
9079 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9079 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9080 | 9080 | } |
9081 | 9081 | |
9082 | 9082 | // |
@@ -9117,7 +9117,7 @@ discard block |
||
9117 | 9117 | // fallback for ascii only |
9118 | 9118 | // |
9119 | 9119 | |
9120 | - if (self::is_ascii($haystack . $needle)) { |
|
9120 | + if (self::is_ascii($haystack.$needle)) { |
|
9121 | 9121 | return \strpos($haystack, $needle, $offset); |
9122 | 9122 | } |
9123 | 9123 | |
@@ -9129,7 +9129,7 @@ discard block |
||
9129 | 9129 | if ($haystackTmp === false) { |
9130 | 9130 | $haystackTmp = ''; |
9131 | 9131 | } |
9132 | - $haystack = (string) $haystackTmp; |
|
9132 | + $haystack = (string)$haystackTmp; |
|
9133 | 9133 | |
9134 | 9134 | if ($offset < 0) { |
9135 | 9135 | $offset = 0; |
@@ -9141,7 +9141,7 @@ discard block |
||
9141 | 9141 | } |
9142 | 9142 | |
9143 | 9143 | if ($pos) { |
9144 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9144 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9145 | 9145 | } |
9146 | 9146 | |
9147 | 9147 | return $offset + 0; |
@@ -9252,7 +9252,7 @@ discard block |
||
9252 | 9252 | && |
9253 | 9253 | self::$SUPPORT['mbstring'] === false |
9254 | 9254 | ) { |
9255 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9255 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9256 | 9256 | } |
9257 | 9257 | |
9258 | 9258 | // |
@@ -9264,7 +9264,7 @@ discard block |
||
9264 | 9264 | if ($needleTmp === false) { |
9265 | 9265 | return false; |
9266 | 9266 | } |
9267 | - $needle = (string) $needleTmp; |
|
9267 | + $needle = (string)$needleTmp; |
|
9268 | 9268 | |
9269 | 9269 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
9270 | 9270 | if ($pos === false) { |
@@ -9286,7 +9286,7 @@ discard block |
||
9286 | 9286 | if ($needleTmp === false) { |
9287 | 9287 | return false; |
9288 | 9288 | } |
9289 | - $needle = (string) $needleTmp; |
|
9289 | + $needle = (string)$needleTmp; |
|
9290 | 9290 | |
9291 | 9291 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
9292 | 9292 | if ($pos === false) { |
@@ -9322,7 +9322,7 @@ discard block |
||
9322 | 9322 | if ($encoding === 'UTF-8') { |
9323 | 9323 | if (self::$SUPPORT['intl'] === true) { |
9324 | 9324 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
9325 | - $i = (int) \grapheme_strlen($str); |
|
9325 | + $i = (int)\grapheme_strlen($str); |
|
9326 | 9326 | while ($i--) { |
9327 | 9327 | $reversedTmp = \grapheme_substr($str, $i, 1); |
9328 | 9328 | if ($reversedTmp !== false) { |
@@ -9330,7 +9330,7 @@ discard block |
||
9330 | 9330 | } |
9331 | 9331 | } |
9332 | 9332 | } else { |
9333 | - $i = (int) \mb_strlen($str); |
|
9333 | + $i = (int)\mb_strlen($str); |
|
9334 | 9334 | while ($i--) { |
9335 | 9335 | $reversedTmp = \mb_substr($str, $i, 1); |
9336 | 9336 | if ($reversedTmp !== false) { |
@@ -9341,7 +9341,7 @@ discard block |
||
9341 | 9341 | } else { |
9342 | 9342 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9343 | 9343 | |
9344 | - $i = (int) self::strlen($str, $encoding); |
|
9344 | + $i = (int)self::strlen($str, $encoding); |
|
9345 | 9345 | while ($i--) { |
9346 | 9346 | $reversedTmp = self::substr($str, $i, 1, $encoding); |
9347 | 9347 | if ($reversedTmp !== false) { |
@@ -9415,7 +9415,7 @@ discard block |
||
9415 | 9415 | if ($needleTmp === false) { |
9416 | 9416 | return false; |
9417 | 9417 | } |
9418 | - $needle = (string) $needleTmp; |
|
9418 | + $needle = (string)$needleTmp; |
|
9419 | 9419 | |
9420 | 9420 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
9421 | 9421 | if ($pos === false) { |
@@ -9454,10 +9454,10 @@ discard block |
||
9454 | 9454 | } |
9455 | 9455 | |
9456 | 9456 | // iconv and mbstring do not support integer $needle |
9457 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9458 | - $needle = (string) self::chr($needle); |
|
9457 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9458 | + $needle = (string)self::chr($needle); |
|
9459 | 9459 | } |
9460 | - $needle = (string) $needle; |
|
9460 | + $needle = (string)$needle; |
|
9461 | 9461 | |
9462 | 9462 | if ($needle === '') { |
9463 | 9463 | return false; |
@@ -9502,7 +9502,7 @@ discard block |
||
9502 | 9502 | && |
9503 | 9503 | self::$SUPPORT['mbstring'] === false |
9504 | 9504 | ) { |
9505 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9505 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9506 | 9506 | } |
9507 | 9507 | |
9508 | 9508 | // |
@@ -9526,7 +9526,7 @@ discard block |
||
9526 | 9526 | // fallback for ascii only |
9527 | 9527 | // |
9528 | 9528 | |
9529 | - if (self::is_ascii($haystack . $needle)) { |
|
9529 | + if (self::is_ascii($haystack.$needle)) { |
|
9530 | 9530 | return \strripos($haystack, $needle, $offset); |
9531 | 9531 | } |
9532 | 9532 | |
@@ -9602,10 +9602,10 @@ discard block |
||
9602 | 9602 | } |
9603 | 9603 | |
9604 | 9604 | // iconv and mbstring do not support integer $needle |
9605 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9606 | - $needle = (string) self::chr($needle); |
|
9605 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9606 | + $needle = (string)self::chr($needle); |
|
9607 | 9607 | } |
9608 | - $needle = (string) $needle; |
|
9608 | + $needle = (string)$needle; |
|
9609 | 9609 | |
9610 | 9610 | if ($needle === '') { |
9611 | 9611 | return false; |
@@ -9650,7 +9650,7 @@ discard block |
||
9650 | 9650 | && |
9651 | 9651 | self::$SUPPORT['mbstring'] === false |
9652 | 9652 | ) { |
9653 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9653 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9654 | 9654 | } |
9655 | 9655 | |
9656 | 9656 | // |
@@ -9674,7 +9674,7 @@ discard block |
||
9674 | 9674 | // fallback for ascii only |
9675 | 9675 | // |
9676 | 9676 | |
9677 | - if (self::is_ascii($haystack . $needle)) { |
|
9677 | + if (self::is_ascii($haystack.$needle)) { |
|
9678 | 9678 | return \strrpos($haystack, $needle, $offset); |
9679 | 9679 | } |
9680 | 9680 | |
@@ -9694,7 +9694,7 @@ discard block |
||
9694 | 9694 | if ($haystackTmp === false) { |
9695 | 9695 | $haystackTmp = ''; |
9696 | 9696 | } |
9697 | - $haystack = (string) $haystackTmp; |
|
9697 | + $haystack = (string)$haystackTmp; |
|
9698 | 9698 | } |
9699 | 9699 | |
9700 | 9700 | $pos = \strrpos($haystack, $needle); |
@@ -9707,7 +9707,7 @@ discard block |
||
9707 | 9707 | return false; |
9708 | 9708 | } |
9709 | 9709 | |
9710 | - return $offset + (int) self::strlen($strTmp); |
|
9710 | + return $offset + (int)self::strlen($strTmp); |
|
9711 | 9711 | } |
9712 | 9712 | |
9713 | 9713 | /** |
@@ -9767,12 +9767,12 @@ discard block |
||
9767 | 9767 | if ($offset || $length !== null) { |
9768 | 9768 | if ($encoding === 'UTF-8') { |
9769 | 9769 | if ($length === null) { |
9770 | - $str = (string) \mb_substr($str, $offset); |
|
9770 | + $str = (string)\mb_substr($str, $offset); |
|
9771 | 9771 | } else { |
9772 | - $str = (string) \mb_substr($str, $offset, $length); |
|
9772 | + $str = (string)\mb_substr($str, $offset, $length); |
|
9773 | 9773 | } |
9774 | 9774 | } else { |
9775 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
9775 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
9776 | 9776 | } |
9777 | 9777 | } |
9778 | 9778 | |
@@ -9782,7 +9782,7 @@ discard block |
||
9782 | 9782 | |
9783 | 9783 | $matches = []; |
9784 | 9784 | |
9785 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
9785 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
9786 | 9786 | } |
9787 | 9787 | |
9788 | 9788 | /** |
@@ -9851,7 +9851,7 @@ discard block |
||
9851 | 9851 | && |
9852 | 9852 | self::$SUPPORT['mbstring'] === false |
9853 | 9853 | ) { |
9854 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9854 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9855 | 9855 | } |
9856 | 9856 | |
9857 | 9857 | // |
@@ -9873,7 +9873,7 @@ discard block |
||
9873 | 9873 | // fallback for ascii only |
9874 | 9874 | // |
9875 | 9875 | |
9876 | - if (self::is_ascii($haystack . $needle)) { |
|
9876 | + if (self::is_ascii($haystack.$needle)) { |
|
9877 | 9877 | return \strstr($haystack, $needle, $before_needle); |
9878 | 9878 | } |
9879 | 9879 | |
@@ -9881,7 +9881,7 @@ discard block |
||
9881 | 9881 | // fallback via vanilla php |
9882 | 9882 | // |
9883 | 9883 | |
9884 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
9884 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
9885 | 9885 | |
9886 | 9886 | if (!isset($match[1])) { |
9887 | 9887 | return false; |
@@ -9891,7 +9891,7 @@ discard block |
||
9891 | 9891 | return $match[1]; |
9892 | 9892 | } |
9893 | 9893 | |
9894 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
9894 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
9895 | 9895 | } |
9896 | 9896 | |
9897 | 9897 | /** |
@@ -10005,7 +10005,7 @@ discard block |
||
10005 | 10005 | bool $tryToKeepStringLength = false |
10006 | 10006 | ): string { |
10007 | 10007 | // init |
10008 | - $str = (string) $str; |
|
10008 | + $str = (string)$str; |
|
10009 | 10009 | |
10010 | 10010 | if ($str === '') { |
10011 | 10011 | return ''; |
@@ -10034,19 +10034,19 @@ discard block |
||
10034 | 10034 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10035 | 10035 | } |
10036 | 10036 | |
10037 | - $langCode = $lang . '-Lower'; |
|
10037 | + $langCode = $lang.'-Lower'; |
|
10038 | 10038 | if (!\in_array($langCode, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10039 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, \E_USER_WARNING); |
|
10039 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, \E_USER_WARNING); |
|
10040 | 10040 | |
10041 | 10041 | $langCode = 'Any-Lower'; |
10042 | 10042 | } |
10043 | 10043 | |
10044 | 10044 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10045 | 10045 | /** @noinspection UnnecessaryCastingInspection */ |
10046 | - return (string) \transliterator_transliterate($langCode, $str); |
|
10046 | + return (string)\transliterator_transliterate($langCode, $str); |
|
10047 | 10047 | } |
10048 | 10048 | |
10049 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
10049 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
10050 | 10050 | } |
10051 | 10051 | |
10052 | 10052 | // always fallback via symfony polyfill |
@@ -10075,7 +10075,7 @@ discard block |
||
10075 | 10075 | bool $tryToKeepStringLength = false |
10076 | 10076 | ): string { |
10077 | 10077 | // init |
10078 | - $str = (string) $str; |
|
10078 | + $str = (string)$str; |
|
10079 | 10079 | |
10080 | 10080 | if ($str === '') { |
10081 | 10081 | return ''; |
@@ -10104,19 +10104,19 @@ discard block |
||
10104 | 10104 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10105 | 10105 | } |
10106 | 10106 | |
10107 | - $langCode = $lang . '-Upper'; |
|
10107 | + $langCode = $lang.'-Upper'; |
|
10108 | 10108 | if (!\in_array($langCode, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10109 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
10109 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
10110 | 10110 | |
10111 | 10111 | $langCode = 'Any-Upper'; |
10112 | 10112 | } |
10113 | 10113 | |
10114 | 10114 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10115 | 10115 | /** @noinspection UnnecessaryCastingInspection */ |
10116 | - return (string) \transliterator_transliterate($langCode, $str); |
|
10116 | + return (string)\transliterator_transliterate($langCode, $str); |
|
10117 | 10117 | } |
10118 | 10118 | |
10119 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
10119 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
10120 | 10120 | } |
10121 | 10121 | |
10122 | 10122 | // always fallback via symfony polyfill |
@@ -10160,7 +10160,7 @@ discard block |
||
10160 | 10160 | |
10161 | 10161 | $from = \array_combine($from, $to); |
10162 | 10162 | if ($from === false) { |
10163 | - 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) . ')'); |
|
10163 | + 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).')'); |
|
10164 | 10164 | } |
10165 | 10165 | } |
10166 | 10166 | |
@@ -10217,9 +10217,9 @@ discard block |
||
10217 | 10217 | } |
10218 | 10218 | |
10219 | 10219 | $wide = 0; |
10220 | - $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); |
|
10220 | + $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); |
|
10221 | 10221 | |
10222 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
10222 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
10223 | 10223 | } |
10224 | 10224 | |
10225 | 10225 | /** |
@@ -10319,9 +10319,9 @@ discard block |
||
10319 | 10319 | } |
10320 | 10320 | |
10321 | 10321 | if ($length === null) { |
10322 | - $length = (int) $str_length; |
|
10322 | + $length = (int)$str_length; |
|
10323 | 10323 | } else { |
10324 | - $length = (int) $length; |
|
10324 | + $length = (int)$length; |
|
10325 | 10325 | } |
10326 | 10326 | |
10327 | 10327 | if ( |
@@ -10329,7 +10329,7 @@ discard block |
||
10329 | 10329 | && |
10330 | 10330 | self::$SUPPORT['mbstring'] === false |
10331 | 10331 | ) { |
10332 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10332 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10333 | 10333 | } |
10334 | 10334 | |
10335 | 10335 | // |
@@ -10417,16 +10417,16 @@ discard block |
||
10417 | 10417 | ) { |
10418 | 10418 | if ($encoding === 'UTF-8') { |
10419 | 10419 | if ($length === null) { |
10420 | - $str1 = (string) \mb_substr($str1, $offset); |
|
10420 | + $str1 = (string)\mb_substr($str1, $offset); |
|
10421 | 10421 | } else { |
10422 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
10422 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
10423 | 10423 | } |
10424 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
10424 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
10425 | 10425 | } else { |
10426 | 10426 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10427 | 10427 | |
10428 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
10429 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
10428 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
10429 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
10430 | 10430 | } |
10431 | 10431 | } |
10432 | 10432 | |
@@ -10488,13 +10488,13 @@ discard block |
||
10488 | 10488 | if ($lengthTmp === false) { |
10489 | 10489 | return false; |
10490 | 10490 | } |
10491 | - $length = (int) $lengthTmp; |
|
10491 | + $length = (int)$lengthTmp; |
|
10492 | 10492 | } |
10493 | 10493 | |
10494 | 10494 | if ($encoding === 'UTF-8') { |
10495 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
10495 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
10496 | 10496 | } else { |
10497 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
10497 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
10498 | 10498 | } |
10499 | 10499 | } |
10500 | 10500 | |
@@ -10503,7 +10503,7 @@ discard block |
||
10503 | 10503 | && |
10504 | 10504 | self::$SUPPORT['mbstring'] === false |
10505 | 10505 | ) { |
10506 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10506 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10507 | 10507 | } |
10508 | 10508 | |
10509 | 10509 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10514,7 +10514,7 @@ discard block |
||
10514 | 10514 | return \mb_substr_count($haystack, $needle, $encoding); |
10515 | 10515 | } |
10516 | 10516 | |
10517 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10517 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10518 | 10518 | |
10519 | 10519 | return \count($matches); |
10520 | 10520 | } |
@@ -10561,7 +10561,7 @@ discard block |
||
10561 | 10561 | if ($lengthTmp === false) { |
10562 | 10562 | return false; |
10563 | 10563 | } |
10564 | - $length = (int) $lengthTmp; |
|
10564 | + $length = (int)$lengthTmp; |
|
10565 | 10565 | } |
10566 | 10566 | |
10567 | 10567 | if ( |
@@ -10582,7 +10582,7 @@ discard block |
||
10582 | 10582 | if ($haystackTmp === false) { |
10583 | 10583 | $haystackTmp = ''; |
10584 | 10584 | } |
10585 | - $haystack = (string) $haystackTmp; |
|
10585 | + $haystack = (string)$haystackTmp; |
|
10586 | 10586 | } |
10587 | 10587 | |
10588 | 10588 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10621,10 +10621,10 @@ discard block |
||
10621 | 10621 | |
10622 | 10622 | if ($encoding === 'UTF-8') { |
10623 | 10623 | if ($caseSensitive) { |
10624 | - return (int) \mb_substr_count($str, $substring); |
|
10624 | + return (int)\mb_substr_count($str, $substring); |
|
10625 | 10625 | } |
10626 | 10626 | |
10627 | - return (int) \mb_substr_count( |
|
10627 | + return (int)\mb_substr_count( |
|
10628 | 10628 | \mb_strtoupper($str), |
10629 | 10629 | \mb_strtoupper($substring) |
10630 | 10630 | |
@@ -10634,10 +10634,10 @@ discard block |
||
10634 | 10634 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10635 | 10635 | |
10636 | 10636 | if ($caseSensitive) { |
10637 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
10637 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
10638 | 10638 | } |
10639 | 10639 | |
10640 | - return (int) \mb_substr_count( |
|
10640 | + return (int)\mb_substr_count( |
|
10641 | 10641 | self::strtocasefold($str, true, false, $encoding, null, false), |
10642 | 10642 | self::strtocasefold($substring, true, false, $encoding, null, false), |
10643 | 10643 | $encoding |
@@ -10663,7 +10663,7 @@ discard block |
||
10663 | 10663 | } |
10664 | 10664 | |
10665 | 10665 | if (self::str_istarts_with($haystack, $needle) === true) { |
10666 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10666 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10667 | 10667 | } |
10668 | 10668 | |
10669 | 10669 | return $haystack; |
@@ -10720,7 +10720,7 @@ discard block |
||
10720 | 10720 | } |
10721 | 10721 | |
10722 | 10722 | if (self::str_iends_with($haystack, $needle) === true) { |
10723 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
10723 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
10724 | 10724 | } |
10725 | 10725 | |
10726 | 10726 | return $haystack; |
@@ -10745,7 +10745,7 @@ discard block |
||
10745 | 10745 | } |
10746 | 10746 | |
10747 | 10747 | if (self::str_starts_with($haystack, $needle) === true) { |
10748 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10748 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10749 | 10749 | } |
10750 | 10750 | |
10751 | 10751 | return $haystack; |
@@ -10797,7 +10797,7 @@ discard block |
||
10797 | 10797 | if (\is_array($offset) === true) { |
10798 | 10798 | $offset = \array_slice($offset, 0, $num); |
10799 | 10799 | foreach ($offset as &$valueTmp) { |
10800 | - $valueTmp = (int) $valueTmp === $valueTmp ? $valueTmp : 0; |
|
10800 | + $valueTmp = (int)$valueTmp === $valueTmp ? $valueTmp : 0; |
|
10801 | 10801 | } |
10802 | 10802 | unset($valueTmp); |
10803 | 10803 | } else { |
@@ -10810,7 +10810,7 @@ discard block |
||
10810 | 10810 | } elseif (\is_array($length) === true) { |
10811 | 10811 | $length = \array_slice($length, 0, $num); |
10812 | 10812 | foreach ($length as &$valueTmpV2) { |
10813 | - $valueTmpV2 = (int) $valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10813 | + $valueTmpV2 = (int)$valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10814 | 10814 | } |
10815 | 10815 | unset($valueTmpV2); |
10816 | 10816 | } else { |
@@ -10830,8 +10830,8 @@ discard block |
||
10830 | 10830 | } |
10831 | 10831 | |
10832 | 10832 | // init |
10833 | - $str = (string) $str; |
|
10834 | - $replacement = (string) $replacement; |
|
10833 | + $str = (string)$str; |
|
10834 | + $replacement = (string)$replacement; |
|
10835 | 10835 | |
10836 | 10836 | if (\is_array($length) === true) { |
10837 | 10837 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -10846,16 +10846,16 @@ discard block |
||
10846 | 10846 | } |
10847 | 10847 | |
10848 | 10848 | if (self::$SUPPORT['mbstring'] === true) { |
10849 | - $string_length = (int) self::strlen($str, $encoding); |
|
10849 | + $string_length = (int)self::strlen($str, $encoding); |
|
10850 | 10850 | |
10851 | 10851 | if ($offset < 0) { |
10852 | - $offset = (int) \max(0, $string_length + $offset); |
|
10852 | + $offset = (int)\max(0, $string_length + $offset); |
|
10853 | 10853 | } elseif ($offset > $string_length) { |
10854 | 10854 | $offset = $string_length; |
10855 | 10855 | } |
10856 | 10856 | |
10857 | 10857 | if ($length !== null && $length < 0) { |
10858 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
10858 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
10859 | 10859 | } elseif ($length === null || $length > $string_length) { |
10860 | 10860 | $length = $string_length; |
10861 | 10861 | } |
@@ -10866,9 +10866,9 @@ discard block |
||
10866 | 10866 | } |
10867 | 10867 | |
10868 | 10868 | /** @noinspection AdditionOperationOnArraysInspection */ |
10869 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
10870 | - $replacement . |
|
10871 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10869 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
10870 | + $replacement. |
|
10871 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10872 | 10872 | } |
10873 | 10873 | |
10874 | 10874 | // |
@@ -10877,8 +10877,7 @@ discard block |
||
10877 | 10877 | |
10878 | 10878 | if (self::is_ascii($str)) { |
10879 | 10879 | return ($length === null) ? |
10880 | - \substr_replace($str, $replacement, $offset) : |
|
10881 | - \substr_replace($str, $replacement, $offset, $length); |
|
10880 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
10882 | 10881 | } |
10883 | 10882 | |
10884 | 10883 | // |
@@ -10894,7 +10893,7 @@ discard block |
||
10894 | 10893 | // e.g.: non mbstring support + invalid chars |
10895 | 10894 | return ''; |
10896 | 10895 | } |
10897 | - $length = (int) $lengthTmp; |
|
10896 | + $length = (int)$lengthTmp; |
|
10898 | 10897 | } |
10899 | 10898 | |
10900 | 10899 | \array_splice($smatches[0], $offset, $length, $rmatches[0]); |
@@ -10929,14 +10928,14 @@ discard block |
||
10929 | 10928 | && |
10930 | 10929 | \substr($haystack, -\strlen($needle)) === $needle |
10931 | 10930 | ) { |
10932 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
10931 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
10933 | 10932 | } |
10934 | 10933 | |
10935 | 10934 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
10936 | - return (string) self::substr( |
|
10935 | + return (string)self::substr( |
|
10937 | 10936 | $haystack, |
10938 | 10937 | 0, |
10939 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
10938 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
10940 | 10939 | $encoding |
10941 | 10940 | ); |
10942 | 10941 | } |
@@ -10966,10 +10965,10 @@ discard block |
||
10966 | 10965 | } |
10967 | 10966 | |
10968 | 10967 | if ($encoding === 'UTF-8') { |
10969 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10968 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10970 | 10969 | } |
10971 | 10970 | |
10972 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10971 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10973 | 10972 | } |
10974 | 10973 | |
10975 | 10974 | /** |
@@ -11161,7 +11160,7 @@ discard block |
||
11161 | 11160 | // INFO: https://unicode.org/cldr/utility/character.jsp?a=%E2%84%8C |
11162 | 11161 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11163 | 11162 | /** @noinspection UnnecessaryCastingInspection */ |
11164 | - $str = (string) \transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11163 | + $str = (string)\transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11165 | 11164 | |
11166 | 11165 | // check again, if we only have ASCII, now ... |
11167 | 11166 | if (self::is_ascii($str) === true) { |
@@ -11285,7 +11284,7 @@ discard block |
||
11285 | 11284 | public static function to_boolean($str): bool |
11286 | 11285 | { |
11287 | 11286 | // init |
11288 | - $str = (string) $str; |
|
11287 | + $str = (string)$str; |
|
11289 | 11288 | |
11290 | 11289 | if ($str === '') { |
11291 | 11290 | return false; |
@@ -11313,10 +11312,10 @@ discard block |
||
11313 | 11312 | } |
11314 | 11313 | |
11315 | 11314 | if (\is_numeric($str)) { |
11316 | - return ((float) $str + 0) > 0; |
|
11315 | + return ((float)$str + 0) > 0; |
|
11317 | 11316 | } |
11318 | 11317 | |
11319 | - return (bool) \trim($str); |
|
11318 | + return (bool)\trim($str); |
|
11320 | 11319 | } |
11321 | 11320 | |
11322 | 11321 | /** |
@@ -11337,11 +11336,11 @@ discard block |
||
11337 | 11336 | |
11338 | 11337 | $fallback_char_escaped = \preg_quote($fallback_char, '/'); |
11339 | 11338 | |
11340 | - $string = (string) \preg_replace( |
|
11339 | + $string = (string)\preg_replace( |
|
11341 | 11340 | [ |
11342 | - '/[^' . $fallback_char_escaped . '\\.\\-a-zA-Z0-9\\s]/', // 1) remove un-needed chars |
|
11343 | - '/[\\s]+/u', // 2) convert spaces to $fallback_char |
|
11344 | - '/[' . $fallback_char_escaped . ']+/u', // 3) remove double $fallback_char's |
|
11341 | + '/[^'.$fallback_char_escaped.'\\.\\-a-zA-Z0-9\\s]/', // 1) remove un-needed chars |
|
11342 | + '/[\\s]+/u', // 2) convert spaces to $fallback_char |
|
11343 | + '/['.$fallback_char_escaped.']+/u', // 3) remove double $fallback_char's |
|
11345 | 11344 | ], |
11346 | 11345 | [ |
11347 | 11346 | '', |
@@ -11372,7 +11371,7 @@ discard block |
||
11372 | 11371 | return $str; |
11373 | 11372 | } |
11374 | 11373 | |
11375 | - $str = (string) $str; |
|
11374 | + $str = (string)$str; |
|
11376 | 11375 | if ($str === '') { |
11377 | 11376 | return ''; |
11378 | 11377 | } |
@@ -11419,7 +11418,7 @@ discard block |
||
11419 | 11418 | return $str; |
11420 | 11419 | } |
11421 | 11420 | |
11422 | - $str = (string) $str; |
|
11421 | + $str = (string)$str; |
|
11423 | 11422 | if ($str === '') { |
11424 | 11423 | return $str; |
11425 | 11424 | } |
@@ -11437,7 +11436,7 @@ discard block |
||
11437 | 11436 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
11438 | 11437 | |
11439 | 11438 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11440 | - $buf .= $c1 . $c2; |
|
11439 | + $buf .= $c1.$c2; |
|
11441 | 11440 | ++$i; |
11442 | 11441 | } else { // not valid UTF8 - convert it |
11443 | 11442 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11448,7 +11447,7 @@ discard block |
||
11448 | 11447 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
11449 | 11448 | |
11450 | 11449 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11451 | - $buf .= $c1 . $c2 . $c3; |
|
11450 | + $buf .= $c1.$c2.$c3; |
|
11452 | 11451 | $i += 2; |
11453 | 11452 | } else { // not valid UTF8 - convert it |
11454 | 11453 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11460,7 +11459,7 @@ discard block |
||
11460 | 11459 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
11461 | 11460 | |
11462 | 11461 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11463 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
11462 | + $buf .= $c1.$c2.$c3.$c4; |
|
11464 | 11463 | $i += 3; |
11465 | 11464 | } else { // not valid UTF8 - convert it |
11466 | 11465 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11486,13 +11485,13 @@ discard block |
||
11486 | 11485 | * |
11487 | 11486 | * @return string |
11488 | 11487 | */ |
11489 | - static function (array $matches): string { |
|
11488 | + static function(array $matches): string { |
|
11490 | 11489 | if (isset($matches[3])) { |
11491 | - $cp = (int) \hexdec($matches[3]); |
|
11490 | + $cp = (int)\hexdec($matches[3]); |
|
11492 | 11491 | } else { |
11493 | 11492 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
11494 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
11495 | - + (int) \hexdec($matches[2]) |
|
11493 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
11494 | + + (int)\hexdec($matches[2]) |
|
11496 | 11495 | + 0x10000 |
11497 | 11496 | - (0xD800 << 10) |
11498 | 11497 | - 0xDC00; |
@@ -11503,12 +11502,12 @@ discard block |
||
11503 | 11502 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
11504 | 11503 | |
11505 | 11504 | if ($cp < 0x80) { |
11506 | - return (string) self::chr($cp); |
|
11505 | + return (string)self::chr($cp); |
|
11507 | 11506 | } |
11508 | 11507 | |
11509 | 11508 | if ($cp < 0xA0) { |
11510 | 11509 | /** @noinspection UnnecessaryCastingInspection */ |
11511 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
11510 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
11512 | 11511 | } |
11513 | 11512 | |
11514 | 11513 | return self::decimal_to_chr($cp); |
@@ -11556,7 +11555,7 @@ discard block |
||
11556 | 11555 | |
11557 | 11556 | if (self::$SUPPORT['mbstring'] === true) { |
11558 | 11557 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11559 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
11558 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
11560 | 11559 | } |
11561 | 11560 | |
11562 | 11561 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -11593,15 +11592,15 @@ discard block |
||
11593 | 11592 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
11594 | 11593 | |
11595 | 11594 | if ($encoding === 'UTF-8') { |
11596 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
11595 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
11597 | 11596 | |
11598 | 11597 | if ($useMbFunction === true) { |
11599 | 11598 | $strPartOne = \mb_strtoupper( |
11600 | - (string) \mb_substr($str, 0, 1) |
|
11599 | + (string)\mb_substr($str, 0, 1) |
|
11601 | 11600 | ); |
11602 | 11601 | } else { |
11603 | 11602 | $strPartOne = self::strtoupper( |
11604 | - (string) \mb_substr($str, 0, 1), |
|
11603 | + (string)\mb_substr($str, 0, 1), |
|
11605 | 11604 | $encoding, |
11606 | 11605 | false, |
11607 | 11606 | $lang, |
@@ -11611,16 +11610,16 @@ discard block |
||
11611 | 11610 | } else { |
11612 | 11611 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11613 | 11612 | |
11614 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
11613 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
11615 | 11614 | |
11616 | 11615 | if ($useMbFunction === true) { |
11617 | 11616 | $strPartOne = \mb_strtoupper( |
11618 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
11617 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
11619 | 11618 | $encoding |
11620 | 11619 | ); |
11621 | 11620 | } else { |
11622 | 11621 | $strPartOne = self::strtoupper( |
11623 | - (string) self::substr($str, 0, 1, $encoding), |
|
11622 | + (string)self::substr($str, 0, 1, $encoding), |
|
11624 | 11623 | $encoding, |
11625 | 11624 | false, |
11626 | 11625 | $lang, |
@@ -11629,7 +11628,7 @@ discard block |
||
11629 | 11628 | } |
11630 | 11629 | } |
11631 | 11630 | |
11632 | - return $strPartOne . $strPartTwo; |
|
11631 | + return $strPartOne.$strPartTwo; |
|
11633 | 11632 | } |
11634 | 11633 | |
11635 | 11634 | /** |
@@ -11680,7 +11679,7 @@ discard block |
||
11680 | 11679 | $str = self::clean($str); |
11681 | 11680 | } |
11682 | 11681 | |
11683 | - $usePhpDefaultFunctions = !(bool) ($charlist . \implode('', $exceptions)); |
|
11682 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
11684 | 11683 | |
11685 | 11684 | if ( |
11686 | 11685 | $usePhpDefaultFunctions === true |
@@ -12067,7 +12066,7 @@ discard block |
||
12067 | 12066 | if ( |
12068 | 12067 | $keepUtf8Chars === true |
12069 | 12068 | && |
12070 | - self::strlen($return) >= (int) self::strlen($str_backup) |
|
12069 | + self::strlen($return) >= (int)self::strlen($str_backup) |
|
12071 | 12070 | ) { |
12072 | 12071 | return $str_backup; |
12073 | 12072 | } |
@@ -12143,17 +12142,17 @@ discard block |
||
12143 | 12142 | return ''; |
12144 | 12143 | } |
12145 | 12144 | |
12146 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
12145 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
12147 | 12146 | |
12148 | 12147 | if ( |
12149 | 12148 | !isset($matches[0]) |
12150 | 12149 | || |
12151 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
12150 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
12152 | 12151 | ) { |
12153 | 12152 | return $str; |
12154 | 12153 | } |
12155 | 12154 | |
12156 | - return \rtrim($matches[0]) . $strAddOn; |
|
12155 | + return \rtrim($matches[0]).$strAddOn; |
|
12157 | 12156 | } |
12158 | 12157 | |
12159 | 12158 | /** |
@@ -12240,7 +12239,7 @@ discard block |
||
12240 | 12239 | } |
12241 | 12240 | } |
12242 | 12241 | |
12243 | - return $strReturn . \implode('', $chars); |
|
12242 | + return $strReturn.\implode('', $chars); |
|
12244 | 12243 | } |
12245 | 12244 | |
12246 | 12245 | /** |
@@ -12292,7 +12291,7 @@ discard block |
||
12292 | 12291 | $finalBreak = ''; |
12293 | 12292 | } |
12294 | 12293 | |
12295 | - return \implode($delimiter ?? "\n", $stringArray) . $finalBreak; |
|
12294 | + return \implode($delimiter ?? "\n", $stringArray).$finalBreak; |
|
12296 | 12295 | } |
12297 | 12296 | |
12298 | 12297 | /** |
@@ -12359,7 +12358,7 @@ discard block |
||
12359 | 12358 | /** @noinspection PhpIncludeInspection */ |
12360 | 12359 | /** @noinspection UsingInclusionReturnValueInspection */ |
12361 | 12360 | /** @psalm-suppress UnresolvableInclude */ |
12362 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
12361 | + return include __DIR__.'/data/'.$file.'.php'; |
|
12363 | 12362 | } |
12364 | 12363 | |
12365 | 12364 | /** |
@@ -12371,7 +12370,7 @@ discard block |
||
12371 | 12370 | */ |
12372 | 12371 | private static function getDataIfExists(string $file) |
12373 | 12372 | { |
12374 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
12373 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
12375 | 12374 | if (\file_exists($file)) { |
12376 | 12375 | /** @noinspection PhpIncludeInspection */ |
12377 | 12376 | /** @noinspection UsingInclusionReturnValueInspection */ |
@@ -12393,7 +12392,7 @@ discard block |
||
12393 | 12392 | |
12394 | 12393 | \uksort( |
12395 | 12394 | self::$EMOJI, |
12396 | - static function (string $a, string $b): int { |
|
12395 | + static function(string $a, string $b): int { |
|
12397 | 12396 | return \strlen($b) <=> \strlen($a); |
12398 | 12397 | } |
12399 | 12398 | ); |
@@ -12403,7 +12402,7 @@ discard block |
||
12403 | 12402 | |
12404 | 12403 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
12405 | 12404 | $tmpKey = \crc32($key); |
12406 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmpKey . '_-_' . \strrev((string) $tmpKey) . '_-_8FTU_ELBATROP_-_'; |
|
12405 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmpKey.'_-_'.\strrev((string)$tmpKey).'_-_8FTU_ELBATROP_-_'; |
|
12407 | 12406 | } |
12408 | 12407 | |
12409 | 12408 | return true; |
@@ -12427,7 +12426,7 @@ discard block |
||
12427 | 12426 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
12428 | 12427 | return \defined('MB_OVERLOAD_STRING') |
12429 | 12428 | && |
12430 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12429 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12431 | 12430 | } |
12432 | 12431 | |
12433 | 12432 | /** |
@@ -12477,7 +12476,7 @@ discard block |
||
12477 | 12476 | { |
12478 | 12477 | static $RX_CLASS_CACHE = []; |
12479 | 12478 | |
12480 | - $cacheKey = $s . $class; |
|
12479 | + $cacheKey = $s.$class; |
|
12481 | 12480 | |
12482 | 12481 | if (isset($RX_CLASS_CACHE[$cacheKey])) { |
12483 | 12482 | return $RX_CLASS_CACHE[$cacheKey]; |
@@ -12489,7 +12488,7 @@ discard block |
||
12489 | 12488 | /** @noinspection AlterInForeachInspection */ |
12490 | 12489 | foreach (self::str_split($s) as &$s) { |
12491 | 12490 | if ($s === '-') { |
12492 | - $classArray[0] = '-' . $classArray[0]; |
|
12491 | + $classArray[0] = '-'.$classArray[0]; |
|
12493 | 12492 | } elseif (!isset($s[2])) { |
12494 | 12493 | $classArray[0] .= \preg_quote($s, '/'); |
12495 | 12494 | } elseif (self::strlen($s) === 1) { |
@@ -12500,13 +12499,13 @@ discard block |
||
12500 | 12499 | } |
12501 | 12500 | |
12502 | 12501 | if ($classArray[0]) { |
12503 | - $classArray[0] = '[' . $classArray[0] . ']'; |
|
12502 | + $classArray[0] = '['.$classArray[0].']'; |
|
12504 | 12503 | } |
12505 | 12504 | |
12506 | 12505 | if (\count($classArray) === 1) { |
12507 | 12506 | $return = $classArray[0]; |
12508 | 12507 | } else { |
12509 | - $return = '(?:' . \implode('|', $classArray) . ')'; |
|
12508 | + $return = '(?:'.\implode('|', $classArray).')'; |
|
12510 | 12509 | } |
12511 | 12510 | |
12512 | 12511 | $RX_CLASS_CACHE[$cacheKey] = $return; |
@@ -12581,7 +12580,7 @@ discard block |
||
12581 | 12580 | |
12582 | 12581 | if ($delimiter === '-') { |
12583 | 12582 | /** @noinspection AlterInForeachInspection */ |
12584 | - foreach ((array) $specialCases['names'] as &$beginning) { |
|
12583 | + foreach ((array)$specialCases['names'] as &$beginning) { |
|
12585 | 12584 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12586 | 12585 | $continue = true; |
12587 | 12586 | } |
@@ -12589,7 +12588,7 @@ discard block |
||
12589 | 12588 | } |
12590 | 12589 | |
12591 | 12590 | /** @noinspection AlterInForeachInspection */ |
12592 | - foreach ((array) $specialCases['prefixes'] as &$beginning) { |
|
12591 | + foreach ((array)$specialCases['prefixes'] as &$beginning) { |
|
12593 | 12592 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12594 | 12593 | $continue = true; |
12595 | 12594 | } |
@@ -12649,8 +12648,8 @@ discard block |
||
12649 | 12648 | } else { |
12650 | 12649 | /** @noinspection OffsetOperationsInspection */ |
12651 | 12650 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
12652 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
12653 | - $buf .= $cc1 . $cc2; |
|
12651 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
12652 | + $buf .= $cc1.$cc2; |
|
12654 | 12653 | } |
12655 | 12654 | |
12656 | 12655 | return $buf; |
@@ -12665,7 +12664,7 @@ discard block |
||
12665 | 12664 | { |
12666 | 12665 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
12667 | 12666 | if (\preg_match($pattern, $str)) { |
12668 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
12667 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
12669 | 12668 | } |
12670 | 12669 | |
12671 | 12670 | return $str; |