@@ -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 | /** |
@@ -4561,14 +4561,14 @@ discard block |
||
4561 | 4561 | $is_xdigit = false; |
4562 | 4562 | |
4563 | 4563 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4564 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
4564 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
4565 | 4565 | $is_digit = true; |
4566 | - $start = (int) $var1; |
|
4566 | + $start = (int)$var1; |
|
4567 | 4567 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
4568 | 4568 | $is_xdigit = true; |
4569 | - $start = (int) self::hex_to_int($var1); |
|
4569 | + $start = (int)self::hex_to_int($var1); |
|
4570 | 4570 | } elseif (!$use_ctype && \is_numeric($var1)) { |
4571 | - $start = (int) $var1; |
|
4571 | + $start = (int)$var1; |
|
4572 | 4572 | } else { |
4573 | 4573 | $start = self::ord($var1); |
4574 | 4574 | } |
@@ -4578,11 +4578,11 @@ discard block |
||
4578 | 4578 | } |
4579 | 4579 | |
4580 | 4580 | if ($is_digit) { |
4581 | - $end = (int) $var2; |
|
4581 | + $end = (int)$var2; |
|
4582 | 4582 | } elseif ($is_xdigit) { |
4583 | - $end = (int) self::hex_to_int($var2); |
|
4583 | + $end = (int)self::hex_to_int($var2); |
|
4584 | 4584 | } elseif (!$use_ctype && \is_numeric($var2)) { |
4585 | - $end = (int) $var2; |
|
4585 | + $end = (int)$var2; |
|
4586 | 4586 | } else { |
4587 | 4587 | $end = self::ord($var2); |
4588 | 4588 | } |
@@ -4592,8 +4592,8 @@ discard block |
||
4592 | 4592 | } |
4593 | 4593 | |
4594 | 4594 | return \array_map( |
4595 | - static function (int $i) use ($encoding): string { |
|
4596 | - return (string) self::chr($i, $encoding); |
|
4595 | + static function(int $i) use ($encoding): string { |
|
4596 | + return (string)self::chr($i, $encoding); |
|
4597 | 4597 | }, |
4598 | 4598 | \range($start, $end) |
4599 | 4599 | ); |
@@ -4684,8 +4684,8 @@ discard block |
||
4684 | 4684 | $delimiter = '/'; |
4685 | 4685 | } |
4686 | 4686 | |
4687 | - return (string) \preg_replace( |
|
4688 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4687 | + return (string)\preg_replace( |
|
4688 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4689 | 4689 | $replacement, |
4690 | 4690 | $str |
4691 | 4691 | ); |
@@ -4727,9 +4727,9 @@ discard block |
||
4727 | 4727 | return ''; |
4728 | 4728 | } |
4729 | 4729 | |
4730 | - $strLength -= (int) $bomByteLength; |
|
4730 | + $strLength -= (int)$bomByteLength; |
|
4731 | 4731 | |
4732 | - $str = (string) $strTmp; |
|
4732 | + $str = (string)$strTmp; |
|
4733 | 4733 | } |
4734 | 4734 | } |
4735 | 4735 | |
@@ -4753,7 +4753,7 @@ discard block |
||
4753 | 4753 | if (\is_array($what) === true) { |
4754 | 4754 | /** @noinspection ForeachSourceInspection */ |
4755 | 4755 | foreach ($what as $item) { |
4756 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/u') . ')+/u', $item, $str); |
|
4756 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/u').')+/u', $item, $str); |
|
4757 | 4757 | } |
4758 | 4758 | } |
4759 | 4759 | |
@@ -4785,7 +4785,7 @@ discard block |
||
4785 | 4785 | */ |
4786 | 4786 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
4787 | 4787 | { |
4788 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4788 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4789 | 4789 | } |
4790 | 4790 | |
4791 | 4791 | /** |
@@ -4816,7 +4816,7 @@ discard block |
||
4816 | 4816 | $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
4817 | 4817 | |
4818 | 4818 | do { |
4819 | - $str = (string) \preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4819 | + $str = (string)\preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4820 | 4820 | } while ($count !== 0); |
4821 | 4821 | |
4822 | 4822 | return $str; |
@@ -4835,17 +4835,17 @@ discard block |
||
4835 | 4835 | { |
4836 | 4836 | if ($substring && \strpos($str, $substring) === 0) { |
4837 | 4837 | if ($encoding === 'UTF-8') { |
4838 | - return (string) \mb_substr( |
|
4838 | + return (string)\mb_substr( |
|
4839 | 4839 | $str, |
4840 | - (int) \mb_strlen($substring) |
|
4840 | + (int)\mb_strlen($substring) |
|
4841 | 4841 | ); |
4842 | 4842 | } |
4843 | 4843 | |
4844 | 4844 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4845 | 4845 | |
4846 | - return (string) self::substr( |
|
4846 | + return (string)self::substr( |
|
4847 | 4847 | $str, |
4848 | - (int) self::strlen($substring, $encoding), |
|
4848 | + (int)self::strlen($substring, $encoding), |
|
4849 | 4849 | null, |
4850 | 4850 | $encoding |
4851 | 4851 | ); |
@@ -4867,19 +4867,19 @@ discard block |
||
4867 | 4867 | { |
4868 | 4868 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
4869 | 4869 | if ($encoding === 'UTF-8') { |
4870 | - return (string) \mb_substr( |
|
4870 | + return (string)\mb_substr( |
|
4871 | 4871 | $str, |
4872 | 4872 | 0, |
4873 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
4873 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
4874 | 4874 | ); |
4875 | 4875 | } |
4876 | 4876 | |
4877 | 4877 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4878 | 4878 | |
4879 | - return (string) self::substr( |
|
4879 | + return (string)self::substr( |
|
4880 | 4880 | $str, |
4881 | 4881 | 0, |
4882 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
4882 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
4883 | 4883 | $encoding |
4884 | 4884 | ); |
4885 | 4885 | } |
@@ -4963,7 +4963,7 @@ discard block |
||
4963 | 4963 | $save = \mb_substitute_character(); |
4964 | 4964 | \mb_substitute_character($replacementCharHelper); |
4965 | 4965 | // the polyfill maybe return false, so cast to string |
4966 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4966 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4967 | 4967 | \mb_substitute_character($save); |
4968 | 4968 | } |
4969 | 4969 | |
@@ -5003,7 +5003,7 @@ discard block |
||
5003 | 5003 | |
5004 | 5004 | if (self::$SUPPORT['mbstring'] === true) { |
5005 | 5005 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5006 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
5006 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
5007 | 5007 | } |
5008 | 5008 | |
5009 | 5009 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -5018,7 +5018,7 @@ discard block |
||
5018 | 5018 | { |
5019 | 5019 | echo '<pre>'; |
5020 | 5020 | foreach (self::$SUPPORT as $key => &$value) { |
5021 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
5021 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
5022 | 5022 | } |
5023 | 5023 | unset($value); |
5024 | 5024 | echo '</pre>'; |
@@ -5047,7 +5047,7 @@ discard block |
||
5047 | 5047 | return $char; |
5048 | 5048 | } |
5049 | 5049 | |
5050 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
5050 | + return '&#'.self::ord($char, $encoding).';'; |
|
5051 | 5051 | } |
5052 | 5052 | |
5053 | 5053 | /** |
@@ -5138,18 +5138,18 @@ discard block |
||
5138 | 5138 | $lang, |
5139 | 5139 | $tryToKeepStringLength |
5140 | 5140 | ); |
5141 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5141 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5142 | 5142 | |
5143 | 5143 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5144 | 5144 | |
5145 | - $str = (string) \preg_replace_callback( |
|
5145 | + $str = (string)\preg_replace_callback( |
|
5146 | 5146 | '/[-_\\s]+(.)?/u', |
5147 | 5147 | /** |
5148 | 5148 | * @param array $match |
5149 | 5149 | * |
5150 | 5150 | * @return string |
5151 | 5151 | */ |
5152 | - static function (array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5152 | + static function(array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5153 | 5153 | if (isset($match[1])) { |
5154 | 5154 | if ($useMbFunction === true) { |
5155 | 5155 | if ($encoding === 'UTF-8') { |
@@ -5167,14 +5167,14 @@ discard block |
||
5167 | 5167 | $str |
5168 | 5168 | ); |
5169 | 5169 | |
5170 | - return (string) \preg_replace_callback( |
|
5170 | + return (string)\preg_replace_callback( |
|
5171 | 5171 | '/[\\p{N}]+(.)?/u', |
5172 | 5172 | /** |
5173 | 5173 | * @param array $match |
5174 | 5174 | * |
5175 | 5175 | * @return string |
5176 | 5176 | */ |
5177 | - static function (array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5177 | + static function(array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5178 | 5178 | if ($useMbFunction === true) { |
5179 | 5179 | if ($encoding === 'UTF-8') { |
5180 | 5180 | return \mb_strtoupper($match[0]); |
@@ -5352,7 +5352,7 @@ discard block |
||
5352 | 5352 | ): string { |
5353 | 5353 | if (self::$SUPPORT['mbstring'] === true) { |
5354 | 5354 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5355 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5355 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5356 | 5356 | |
5357 | 5357 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5358 | 5358 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5362,10 +5362,10 @@ discard block |
||
5362 | 5362 | } |
5363 | 5363 | |
5364 | 5364 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5365 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5365 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5366 | 5366 | } |
5367 | 5367 | |
5368 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5368 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5369 | 5369 | |
5370 | 5370 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5371 | 5371 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5374,7 +5374,7 @@ discard block |
||
5374 | 5374 | $str = self::strtolower($str, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
5375 | 5375 | } |
5376 | 5376 | |
5377 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5377 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5378 | 5378 | } |
5379 | 5379 | |
5380 | 5380 | /** |
@@ -5389,7 +5389,7 @@ discard block |
||
5389 | 5389 | public static function str_detect_encoding($str) |
5390 | 5390 | { |
5391 | 5391 | // init |
5392 | - $str = (string) $str; |
|
5392 | + $str = (string)$str; |
|
5393 | 5393 | |
5394 | 5394 | // |
5395 | 5395 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5456,7 +5456,7 @@ discard block |
||
5456 | 5456 | foreach (self::$ENCODINGS as $encodingTmp) { |
5457 | 5457 | // INFO: //IGNORE but still throw notice |
5458 | 5458 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5459 | - if ((string) @\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str) === $str) { |
|
5459 | + if ((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str) === $str) { |
|
5460 | 5460 | return $encodingTmp; |
5461 | 5461 | } |
5462 | 5462 | } |
@@ -5544,7 +5544,7 @@ discard block |
||
5544 | 5544 | return $str; |
5545 | 5545 | } |
5546 | 5546 | |
5547 | - return $substring . $str; |
|
5547 | + return $substring.$str; |
|
5548 | 5548 | } |
5549 | 5549 | |
5550 | 5550 | /** |
@@ -5798,27 +5798,27 @@ discard block |
||
5798 | 5798 | string $encoding = 'UTF-8' |
5799 | 5799 | ): string { |
5800 | 5800 | if ($encoding === 'UTF-8') { |
5801 | - $len = (int) \mb_strlen($str); |
|
5801 | + $len = (int)\mb_strlen($str); |
|
5802 | 5802 | if ($index > $len) { |
5803 | 5803 | return $str; |
5804 | 5804 | } |
5805 | 5805 | |
5806 | 5806 | /** @noinspection UnnecessaryCastingInspection */ |
5807 | - return (string) \mb_substr($str, 0, $index) . |
|
5808 | - $substring . |
|
5809 | - (string) \mb_substr($str, $index, $len); |
|
5807 | + return (string)\mb_substr($str, 0, $index). |
|
5808 | + $substring. |
|
5809 | + (string)\mb_substr($str, $index, $len); |
|
5810 | 5810 | } |
5811 | 5811 | |
5812 | 5812 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5813 | 5813 | |
5814 | - $len = (int) self::strlen($str, $encoding); |
|
5814 | + $len = (int)self::strlen($str, $encoding); |
|
5815 | 5815 | if ($index > $len) { |
5816 | 5816 | return $str; |
5817 | 5817 | } |
5818 | 5818 | |
5819 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
5820 | - $substring . |
|
5821 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5819 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
5820 | + $substring. |
|
5821 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
5822 | 5822 | } |
5823 | 5823 | |
5824 | 5824 | /** |
@@ -5848,15 +5848,15 @@ discard block |
||
5848 | 5848 | */ |
5849 | 5849 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5850 | 5850 | { |
5851 | - $search = (array) $search; |
|
5851 | + $search = (array)$search; |
|
5852 | 5852 | |
5853 | 5853 | /** @noinspection AlterInForeachInspection */ |
5854 | 5854 | foreach ($search as &$s) { |
5855 | - $s = (string) $s; |
|
5855 | + $s = (string)$s; |
|
5856 | 5856 | if ($s === '') { |
5857 | 5857 | $s = '/^(?<=.)$/'; |
5858 | 5858 | } else { |
5859 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5859 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5860 | 5860 | } |
5861 | 5861 | } |
5862 | 5862 | |
@@ -5888,11 +5888,11 @@ discard block |
||
5888 | 5888 | } |
5889 | 5889 | |
5890 | 5890 | if ($search === '') { |
5891 | - return $str . $replacement; |
|
5891 | + return $str.$replacement; |
|
5892 | 5892 | } |
5893 | 5893 | |
5894 | 5894 | if (\stripos($str, $search) === 0) { |
5895 | - return $replacement . \substr($str, \strlen($search)); |
|
5895 | + return $replacement.\substr($str, \strlen($search)); |
|
5896 | 5896 | } |
5897 | 5897 | |
5898 | 5898 | return $str; |
@@ -5920,11 +5920,11 @@ discard block |
||
5920 | 5920 | } |
5921 | 5921 | |
5922 | 5922 | if ($search === '') { |
5923 | - return $str . $replacement; |
|
5923 | + return $str.$replacement; |
|
5924 | 5924 | } |
5925 | 5925 | |
5926 | 5926 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
5927 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
5927 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
5928 | 5928 | } |
5929 | 5929 | |
5930 | 5930 | return $str; |
@@ -6001,15 +6001,15 @@ discard block |
||
6001 | 6001 | } |
6002 | 6002 | |
6003 | 6003 | if ($encoding === 'UTF-8') { |
6004 | - return (string) \mb_substr( |
|
6004 | + return (string)\mb_substr( |
|
6005 | 6005 | $str, |
6006 | - $offset + (int) \mb_strlen($separator) |
|
6006 | + $offset + (int)\mb_strlen($separator) |
|
6007 | 6007 | ); |
6008 | 6008 | } |
6009 | 6009 | |
6010 | - return (string) self::substr( |
|
6010 | + return (string)self::substr( |
|
6011 | 6011 | $str, |
6012 | - $offset + (int) self::strlen($separator, $encoding), |
|
6012 | + $offset + (int)self::strlen($separator, $encoding), |
|
6013 | 6013 | null, |
6014 | 6014 | $encoding |
6015 | 6015 | ); |
@@ -6036,15 +6036,15 @@ discard block |
||
6036 | 6036 | } |
6037 | 6037 | |
6038 | 6038 | if ($encoding === 'UTF-8') { |
6039 | - return (string) \mb_substr( |
|
6039 | + return (string)\mb_substr( |
|
6040 | 6040 | $str, |
6041 | - $offset + (int) self::strlen($separator) |
|
6041 | + $offset + (int)self::strlen($separator) |
|
6042 | 6042 | ); |
6043 | 6043 | } |
6044 | 6044 | |
6045 | - return (string) self::substr( |
|
6045 | + return (string)self::substr( |
|
6046 | 6046 | $str, |
6047 | - $offset + (int) self::strlen($separator, $encoding), |
|
6047 | + $offset + (int)self::strlen($separator, $encoding), |
|
6048 | 6048 | null, |
6049 | 6049 | $encoding |
6050 | 6050 | ); |
@@ -6071,10 +6071,10 @@ discard block |
||
6071 | 6071 | } |
6072 | 6072 | |
6073 | 6073 | if ($encoding === 'UTF-8') { |
6074 | - return (string) \mb_substr($str, 0, $offset); |
|
6074 | + return (string)\mb_substr($str, 0, $offset); |
|
6075 | 6075 | } |
6076 | 6076 | |
6077 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6077 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6078 | 6078 | } |
6079 | 6079 | |
6080 | 6080 | /** |
@@ -6098,7 +6098,7 @@ discard block |
||
6098 | 6098 | return ''; |
6099 | 6099 | } |
6100 | 6100 | |
6101 | - return (string) \mb_substr($str, 0, $offset); |
|
6101 | + return (string)\mb_substr($str, 0, $offset); |
|
6102 | 6102 | } |
6103 | 6103 | |
6104 | 6104 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6106,7 +6106,7 @@ discard block |
||
6106 | 6106 | return ''; |
6107 | 6107 | } |
6108 | 6108 | |
6109 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6109 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6110 | 6110 | } |
6111 | 6111 | |
6112 | 6112 | /** |
@@ -6194,12 +6194,12 @@ discard block |
||
6194 | 6194 | } |
6195 | 6195 | |
6196 | 6196 | if ($encoding === 'UTF-8') { |
6197 | - return (string) \mb_substr($str, -$n); |
|
6197 | + return (string)\mb_substr($str, -$n); |
|
6198 | 6198 | } |
6199 | 6199 | |
6200 | 6200 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6201 | 6201 | |
6202 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6202 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6203 | 6203 | } |
6204 | 6204 | |
6205 | 6205 | /** |
@@ -6223,21 +6223,21 @@ discard block |
||
6223 | 6223 | } |
6224 | 6224 | |
6225 | 6225 | if ($encoding === 'UTF-8') { |
6226 | - if ((int) \mb_strlen($str) <= $length) { |
|
6226 | + if ((int)\mb_strlen($str) <= $length) { |
|
6227 | 6227 | return $str; |
6228 | 6228 | } |
6229 | 6229 | |
6230 | 6230 | /** @noinspection UnnecessaryCastingInspection */ |
6231 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($strAddOn)) . $strAddOn; |
|
6231 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($strAddOn)).$strAddOn; |
|
6232 | 6232 | } |
6233 | 6233 | |
6234 | 6234 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6235 | 6235 | |
6236 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6236 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6237 | 6237 | return $str; |
6238 | 6238 | } |
6239 | 6239 | |
6240 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($strAddOn), $encoding)) . $strAddOn; |
|
6240 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($strAddOn), $encoding)).$strAddOn; |
|
6241 | 6241 | } |
6242 | 6242 | |
6243 | 6243 | /** |
@@ -6262,12 +6262,12 @@ discard block |
||
6262 | 6262 | |
6263 | 6263 | if ($encoding === 'UTF-8') { |
6264 | 6264 | /** @noinspection UnnecessaryCastingInspection */ |
6265 | - if ((int) \mb_strlen($str) <= $length) { |
|
6265 | + if ((int)\mb_strlen($str) <= $length) { |
|
6266 | 6266 | return $str; |
6267 | 6267 | } |
6268 | 6268 | |
6269 | 6269 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6270 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6270 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6271 | 6271 | } |
6272 | 6272 | |
6273 | 6273 | $str = \mb_substr($str, 0, $length); |
@@ -6277,20 +6277,20 @@ discard block |
||
6277 | 6277 | $new_str = \implode(' ', $array); |
6278 | 6278 | |
6279 | 6279 | if ($new_str === '') { |
6280 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6280 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6281 | 6281 | } |
6282 | 6282 | } else { |
6283 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6283 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6284 | 6284 | return $str; |
6285 | 6285 | } |
6286 | 6286 | |
6287 | 6287 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6288 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6288 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6289 | 6289 | } |
6290 | 6290 | |
6291 | 6291 | $str = self::substr($str, 0, $length, $encoding); |
6292 | 6292 | if ($str === false) { |
6293 | - return '' . $strAddOn; |
|
6293 | + return ''.$strAddOn; |
|
6294 | 6294 | } |
6295 | 6295 | |
6296 | 6296 | $array = \explode(' ', $str); |
@@ -6298,11 +6298,11 @@ discard block |
||
6298 | 6298 | $new_str = \implode(' ', $array); |
6299 | 6299 | |
6300 | 6300 | if ($new_str === '') { |
6301 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6301 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6302 | 6302 | } |
6303 | 6303 | } |
6304 | 6304 | |
6305 | - return $new_str . $strAddOn; |
|
6305 | + return $new_str.$strAddOn; |
|
6306 | 6306 | } |
6307 | 6307 | |
6308 | 6308 | /** |
@@ -6320,7 +6320,7 @@ discard block |
||
6320 | 6320 | $longestCommonPrefix = ''; |
6321 | 6321 | |
6322 | 6322 | if ($encoding === 'UTF-8') { |
6323 | - $maxLength = (int) \min( |
|
6323 | + $maxLength = (int)\min( |
|
6324 | 6324 | \mb_strlen($str), |
6325 | 6325 | \mb_strlen($otherStr) |
6326 | 6326 | ); |
@@ -6341,7 +6341,7 @@ discard block |
||
6341 | 6341 | } else { |
6342 | 6342 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6343 | 6343 | |
6344 | - $maxLength = (int) \min( |
|
6344 | + $maxLength = (int)\min( |
|
6345 | 6345 | self::strlen($str, $encoding), |
6346 | 6346 | self::strlen($otherStr, $encoding) |
6347 | 6347 | ); |
@@ -6384,13 +6384,13 @@ discard block |
||
6384 | 6384 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6385 | 6385 | |
6386 | 6386 | if ($encoding === 'UTF-8') { |
6387 | - $strLength = (int) \mb_strlen($str); |
|
6388 | - $otherLength = (int) \mb_strlen($otherStr); |
|
6387 | + $strLength = (int)\mb_strlen($str); |
|
6388 | + $otherLength = (int)\mb_strlen($otherStr); |
|
6389 | 6389 | } else { |
6390 | 6390 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6391 | 6391 | |
6392 | - $strLength = (int) self::strlen($str, $encoding); |
|
6393 | - $otherLength = (int) self::strlen($otherStr, $encoding); |
|
6392 | + $strLength = (int)self::strlen($str, $encoding); |
|
6393 | + $otherLength = (int)self::strlen($otherStr, $encoding); |
|
6394 | 6394 | } |
6395 | 6395 | |
6396 | 6396 | // Return if either string is empty |
@@ -6443,10 +6443,10 @@ discard block |
||
6443 | 6443 | } |
6444 | 6444 | |
6445 | 6445 | if ($encoding === 'UTF-8') { |
6446 | - return (string) \mb_substr($str, $end - $len, $len); |
|
6446 | + return (string)\mb_substr($str, $end - $len, $len); |
|
6447 | 6447 | } |
6448 | 6448 | |
6449 | - return (string) self::substr($str, $end - $len, $len, $encoding); |
|
6449 | + return (string)self::substr($str, $end - $len, $len, $encoding); |
|
6450 | 6450 | } |
6451 | 6451 | |
6452 | 6452 | /** |
@@ -6465,7 +6465,7 @@ discard block |
||
6465 | 6465 | } |
6466 | 6466 | |
6467 | 6467 | if ($encoding === 'UTF-8') { |
6468 | - $maxLength = (int) \min( |
|
6468 | + $maxLength = (int)\min( |
|
6469 | 6469 | \mb_strlen($str, $encoding), |
6470 | 6470 | \mb_strlen($otherStr, $encoding) |
6471 | 6471 | ); |
@@ -6479,7 +6479,7 @@ discard block |
||
6479 | 6479 | && |
6480 | 6480 | $char === \mb_substr($otherStr, -$i, 1) |
6481 | 6481 | ) { |
6482 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6482 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6483 | 6483 | } else { |
6484 | 6484 | break; |
6485 | 6485 | } |
@@ -6487,7 +6487,7 @@ discard block |
||
6487 | 6487 | } else { |
6488 | 6488 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6489 | 6489 | |
6490 | - $maxLength = (int) \min( |
|
6490 | + $maxLength = (int)\min( |
|
6491 | 6491 | self::strlen($str, $encoding), |
6492 | 6492 | self::strlen($otherStr, $encoding) |
6493 | 6493 | ); |
@@ -6501,7 +6501,7 @@ discard block |
||
6501 | 6501 | && |
6502 | 6502 | $char === self::substr($otherStr, -$i, 1, $encoding) |
6503 | 6503 | ) { |
6504 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6504 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6505 | 6505 | } else { |
6506 | 6506 | break; |
6507 | 6507 | } |
@@ -6521,7 +6521,7 @@ discard block |
||
6521 | 6521 | */ |
6522 | 6522 | public static function str_matches_pattern(string $str, string $pattern): bool |
6523 | 6523 | { |
6524 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6524 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6525 | 6525 | } |
6526 | 6526 | |
6527 | 6527 | /** |
@@ -6538,7 +6538,7 @@ discard block |
||
6538 | 6538 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6539 | 6539 | { |
6540 | 6540 | // init |
6541 | - $length = (int) self::strlen($str, $encoding); |
|
6541 | + $length = (int)self::strlen($str, $encoding); |
|
6542 | 6542 | |
6543 | 6543 | if ($offset >= 0) { |
6544 | 6544 | return $length > $offset; |
@@ -6564,7 +6564,7 @@ discard block |
||
6564 | 6564 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6565 | 6565 | { |
6566 | 6566 | // init |
6567 | - $length = (int) self::strlen($str); |
|
6567 | + $length = (int)self::strlen($str); |
|
6568 | 6568 | |
6569 | 6569 | if ( |
6570 | 6570 | ($index >= 0 && $length <= $index) |
@@ -6603,7 +6603,7 @@ discard block |
||
6603 | 6603 | return $str; |
6604 | 6604 | } |
6605 | 6605 | |
6606 | - if ($pad_type !== (int) $pad_type) { |
|
6606 | + if ($pad_type !== (int)$pad_type) { |
|
6607 | 6607 | if ($pad_type === 'left') { |
6608 | 6608 | $pad_type = \STR_PAD_LEFT; |
6609 | 6609 | } elseif ($pad_type === 'right') { |
@@ -6612,23 +6612,23 @@ discard block |
||
6612 | 6612 | $pad_type = \STR_PAD_BOTH; |
6613 | 6613 | } else { |
6614 | 6614 | throw new \InvalidArgumentException( |
6615 | - 'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6615 | + 'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6616 | 6616 | ); |
6617 | 6617 | } |
6618 | 6618 | } |
6619 | 6619 | |
6620 | 6620 | if ($encoding === 'UTF-8') { |
6621 | - $str_length = (int) \mb_strlen($str); |
|
6621 | + $str_length = (int)\mb_strlen($str); |
|
6622 | 6622 | |
6623 | 6623 | if ($pad_length >= $str_length) { |
6624 | 6624 | switch ($pad_type) { |
6625 | 6625 | case \STR_PAD_LEFT: |
6626 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6626 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6627 | 6627 | |
6628 | 6628 | $diff = ($pad_length - $str_length); |
6629 | 6629 | |
6630 | - $pre = (string) \mb_substr( |
|
6631 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6630 | + $pre = (string)\mb_substr( |
|
6631 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6632 | 6632 | 0, |
6633 | 6633 | $diff |
6634 | 6634 | ); |
@@ -6639,16 +6639,16 @@ discard block |
||
6639 | 6639 | case \STR_PAD_BOTH: |
6640 | 6640 | $diff = ($pad_length - $str_length); |
6641 | 6641 | |
6642 | - $ps_length_left = (int) \floor($diff / 2); |
|
6642 | + $ps_length_left = (int)\floor($diff / 2); |
|
6643 | 6643 | |
6644 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6644 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6645 | 6645 | |
6646 | - $pre = (string) \mb_substr( |
|
6646 | + $pre = (string)\mb_substr( |
|
6647 | 6647 | \str_repeat($pad_string, $ps_length_left), |
6648 | 6648 | 0, |
6649 | 6649 | $ps_length_left |
6650 | 6650 | ); |
6651 | - $post = (string) \mb_substr( |
|
6651 | + $post = (string)\mb_substr( |
|
6652 | 6652 | \str_repeat($pad_string, $ps_length_right), |
6653 | 6653 | 0, |
6654 | 6654 | $ps_length_right |
@@ -6658,19 +6658,19 @@ discard block |
||
6658 | 6658 | |
6659 | 6659 | case \STR_PAD_RIGHT: |
6660 | 6660 | default: |
6661 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6661 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6662 | 6662 | |
6663 | 6663 | $diff = ($pad_length - $str_length); |
6664 | 6664 | |
6665 | - $post = (string) \mb_substr( |
|
6666 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6665 | + $post = (string)\mb_substr( |
|
6666 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6667 | 6667 | 0, |
6668 | 6668 | $diff |
6669 | 6669 | ); |
6670 | 6670 | $pre = ''; |
6671 | 6671 | } |
6672 | 6672 | |
6673 | - return $pre . $str . $post; |
|
6673 | + return $pre.$str.$post; |
|
6674 | 6674 | } |
6675 | 6675 | |
6676 | 6676 | return $str; |
@@ -6678,17 +6678,17 @@ discard block |
||
6678 | 6678 | |
6679 | 6679 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6680 | 6680 | |
6681 | - $str_length = (int) self::strlen($str, $encoding); |
|
6681 | + $str_length = (int)self::strlen($str, $encoding); |
|
6682 | 6682 | |
6683 | 6683 | if ($pad_length >= $str_length) { |
6684 | 6684 | switch ($pad_type) { |
6685 | 6685 | case \STR_PAD_LEFT: |
6686 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6686 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6687 | 6687 | |
6688 | 6688 | $diff = ($pad_length - $str_length); |
6689 | 6689 | |
6690 | - $pre = (string) self::substr( |
|
6691 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6690 | + $pre = (string)self::substr( |
|
6691 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6692 | 6692 | 0, |
6693 | 6693 | $diff, |
6694 | 6694 | $encoding |
@@ -6700,17 +6700,17 @@ discard block |
||
6700 | 6700 | case \STR_PAD_BOTH: |
6701 | 6701 | $diff = ($pad_length - $str_length); |
6702 | 6702 | |
6703 | - $ps_length_left = (int) \floor($diff / 2); |
|
6703 | + $ps_length_left = (int)\floor($diff / 2); |
|
6704 | 6704 | |
6705 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6705 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6706 | 6706 | |
6707 | - $pre = (string) self::substr( |
|
6707 | + $pre = (string)self::substr( |
|
6708 | 6708 | \str_repeat($pad_string, $ps_length_left), |
6709 | 6709 | 0, |
6710 | 6710 | $ps_length_left, |
6711 | 6711 | $encoding |
6712 | 6712 | ); |
6713 | - $post = (string) self::substr( |
|
6713 | + $post = (string)self::substr( |
|
6714 | 6714 | \str_repeat($pad_string, $ps_length_right), |
6715 | 6715 | 0, |
6716 | 6716 | $ps_length_right, |
@@ -6721,12 +6721,12 @@ discard block |
||
6721 | 6721 | |
6722 | 6722 | case \STR_PAD_RIGHT: |
6723 | 6723 | default: |
6724 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6724 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6725 | 6725 | |
6726 | 6726 | $diff = ($pad_length - $str_length); |
6727 | 6727 | |
6728 | - $post = (string) self::substr( |
|
6729 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6728 | + $post = (string)self::substr( |
|
6729 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6730 | 6730 | 0, |
6731 | 6731 | $diff, |
6732 | 6732 | $encoding |
@@ -6734,7 +6734,7 @@ discard block |
||
6734 | 6734 | $pre = ''; |
6735 | 6735 | } |
6736 | 6736 | |
6737 | - return $pre . $str . $post; |
|
6737 | + return $pre.$str.$post; |
|
6738 | 6738 | } |
6739 | 6739 | |
6740 | 6740 | return $str; |
@@ -6893,11 +6893,11 @@ discard block |
||
6893 | 6893 | } |
6894 | 6894 | |
6895 | 6895 | if ($search === '') { |
6896 | - return $str . $replacement; |
|
6896 | + return $str.$replacement; |
|
6897 | 6897 | } |
6898 | 6898 | |
6899 | 6899 | if (\strpos($str, $search) === 0) { |
6900 | - return $replacement . \substr($str, \strlen($search)); |
|
6900 | + return $replacement.\substr($str, \strlen($search)); |
|
6901 | 6901 | } |
6902 | 6902 | |
6903 | 6903 | return $str; |
@@ -6925,11 +6925,11 @@ discard block |
||
6925 | 6925 | } |
6926 | 6926 | |
6927 | 6927 | if ($search === '') { |
6928 | - return $str . $replacement; |
|
6928 | + return $str.$replacement; |
|
6929 | 6929 | } |
6930 | 6930 | |
6931 | 6931 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6932 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6932 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6933 | 6933 | } |
6934 | 6934 | |
6935 | 6935 | return $str; |
@@ -6958,7 +6958,7 @@ discard block |
||
6958 | 6958 | $subject, |
6959 | 6959 | $replace, |
6960 | 6960 | $pos, |
6961 | - (int) self::strlen($search) |
|
6961 | + (int)self::strlen($search) |
|
6962 | 6962 | ); |
6963 | 6963 | } |
6964 | 6964 | |
@@ -6990,7 +6990,7 @@ discard block |
||
6990 | 6990 | $subject, |
6991 | 6991 | $replace, |
6992 | 6992 | $pos, |
6993 | - (int) self::strlen($search) |
|
6993 | + (int)self::strlen($search) |
|
6994 | 6994 | ); |
6995 | 6995 | } |
6996 | 6996 | |
@@ -7010,7 +7010,7 @@ discard block |
||
7010 | 7010 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
7011 | 7011 | { |
7012 | 7012 | if ($encoding === 'UTF-8') { |
7013 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
7013 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
7014 | 7014 | /** @noinspection NonSecureShuffleUsageInspection */ |
7015 | 7015 | \shuffle($indexes); |
7016 | 7016 | |
@@ -7026,7 +7026,7 @@ discard block |
||
7026 | 7026 | } else { |
7027 | 7027 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7028 | 7028 | |
7029 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
7029 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
7030 | 7030 | /** @noinspection NonSecureShuffleUsageInspection */ |
7031 | 7031 | \shuffle($indexes); |
7032 | 7032 | |
@@ -7067,11 +7067,11 @@ discard block |
||
7067 | 7067 | ) { |
7068 | 7068 | if ($encoding === 'UTF-8') { |
7069 | 7069 | if ($end === null) { |
7070 | - $length = (int) \mb_strlen($str); |
|
7070 | + $length = (int)\mb_strlen($str); |
|
7071 | 7071 | } elseif ($end >= 0 && $end <= $start) { |
7072 | 7072 | return ''; |
7073 | 7073 | } elseif ($end < 0) { |
7074 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7074 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7075 | 7075 | } else { |
7076 | 7076 | $length = $end - $start; |
7077 | 7077 | } |
@@ -7082,11 +7082,11 @@ discard block |
||
7082 | 7082 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7083 | 7083 | |
7084 | 7084 | if ($end === null) { |
7085 | - $length = (int) self::strlen($str, $encoding); |
|
7085 | + $length = (int)self::strlen($str, $encoding); |
|
7086 | 7086 | } elseif ($end >= 0 && $end <= $start) { |
7087 | 7087 | return ''; |
7088 | 7088 | } elseif ($end < 0) { |
7089 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7089 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7090 | 7090 | } else { |
7091 | 7091 | $length = $end - $start; |
7092 | 7092 | } |
@@ -7118,35 +7118,35 @@ discard block |
||
7118 | 7118 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7119 | 7119 | } |
7120 | 7120 | |
7121 | - $str = (string) \preg_replace_callback( |
|
7121 | + $str = (string)\preg_replace_callback( |
|
7122 | 7122 | '/([\\p{N}|\\p{Lu}])/u', |
7123 | 7123 | /** |
7124 | 7124 | * @param string[] $matches |
7125 | 7125 | * |
7126 | 7126 | * @return string |
7127 | 7127 | */ |
7128 | - static function (array $matches) use ($encoding): string { |
|
7128 | + static function(array $matches) use ($encoding): string { |
|
7129 | 7129 | $match = $matches[1]; |
7130 | - $matchInt = (int) $match; |
|
7130 | + $matchInt = (int)$match; |
|
7131 | 7131 | |
7132 | - if ((string) $matchInt === $match) { |
|
7133 | - return '_' . $match . '_'; |
|
7132 | + if ((string)$matchInt === $match) { |
|
7133 | + return '_'.$match.'_'; |
|
7134 | 7134 | } |
7135 | 7135 | |
7136 | 7136 | if ($encoding === 'UTF-8') { |
7137 | - return '_' . \mb_strtolower($match); |
|
7137 | + return '_'.\mb_strtolower($match); |
|
7138 | 7138 | } |
7139 | 7139 | |
7140 | - return '_' . self::strtolower($match, $encoding); |
|
7140 | + return '_'.self::strtolower($match, $encoding); |
|
7141 | 7141 | }, |
7142 | 7142 | $str |
7143 | 7143 | ); |
7144 | 7144 | |
7145 | - $str = (string) \preg_replace( |
|
7145 | + $str = (string)\preg_replace( |
|
7146 | 7146 | [ |
7147 | - '/\\s+/u', // convert spaces to "_" |
|
7147 | + '/\\s+/u', // convert spaces to "_" |
|
7148 | 7148 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
7149 | - '/_+/', // remove double "_" |
|
7149 | + '/_+/', // remove double "_" |
|
7150 | 7150 | ], |
7151 | 7151 | [ |
7152 | 7152 | '_', |
@@ -7222,7 +7222,7 @@ discard block |
||
7222 | 7222 | } |
7223 | 7223 | |
7224 | 7224 | // init |
7225 | - $str = (string) $str; |
|
7225 | + $str = (string)$str; |
|
7226 | 7226 | |
7227 | 7227 | if ($str === '') { |
7228 | 7228 | return []; |
@@ -7269,7 +7269,7 @@ discard block |
||
7269 | 7269 | ($str[$i] & "\xE0") === "\xC0" |
7270 | 7270 | ) { |
7271 | 7271 | if (($str[$i + 1] & "\xC0") === "\x80") { |
7272 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
7272 | + $ret[] = $str[$i].$str[$i + 1]; |
|
7273 | 7273 | |
7274 | 7274 | ++$i; |
7275 | 7275 | } |
@@ -7283,7 +7283,7 @@ discard block |
||
7283 | 7283 | && |
7284 | 7284 | ($str[$i + 2] & "\xC0") === "\x80" |
7285 | 7285 | ) { |
7286 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
7286 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
7287 | 7287 | |
7288 | 7288 | $i += 2; |
7289 | 7289 | } |
@@ -7299,7 +7299,7 @@ discard block |
||
7299 | 7299 | && |
7300 | 7300 | ($str[$i + 3] & "\xC0") === "\x80" |
7301 | 7301 | ) { |
7302 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
7302 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
7303 | 7303 | |
7304 | 7304 | $i += 3; |
7305 | 7305 | } |
@@ -7311,7 +7311,7 @@ discard block |
||
7311 | 7311 | $ret = \array_chunk($ret, $length); |
7312 | 7312 | |
7313 | 7313 | return \array_map( |
7314 | - static function (array &$item): string { |
|
7314 | + static function(array &$item): string { |
|
7315 | 7315 | return \implode('', $item); |
7316 | 7316 | }, |
7317 | 7317 | $ret |
@@ -7374,7 +7374,7 @@ discard block |
||
7374 | 7374 | $limit = -1; |
7375 | 7375 | } |
7376 | 7376 | |
7377 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7377 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7378 | 7378 | |
7379 | 7379 | if ($array === false) { |
7380 | 7380 | return []; |
@@ -7458,9 +7458,9 @@ discard block |
||
7458 | 7458 | return ''; |
7459 | 7459 | } |
7460 | 7460 | |
7461 | - return (string) \mb_substr( |
|
7461 | + return (string)\mb_substr( |
|
7462 | 7462 | $str, |
7463 | - $offset + (int) \mb_strlen($separator) |
|
7463 | + $offset + (int)\mb_strlen($separator) |
|
7464 | 7464 | ); |
7465 | 7465 | } |
7466 | 7466 | |
@@ -7469,9 +7469,9 @@ discard block |
||
7469 | 7469 | return ''; |
7470 | 7470 | } |
7471 | 7471 | |
7472 | - return (string) \mb_substr( |
|
7472 | + return (string)\mb_substr( |
|
7473 | 7473 | $str, |
7474 | - $offset + (int) self::strlen($separator, $encoding), |
|
7474 | + $offset + (int)self::strlen($separator, $encoding), |
|
7475 | 7475 | null, |
7476 | 7476 | $encoding |
7477 | 7477 | ); |
@@ -7498,9 +7498,9 @@ discard block |
||
7498 | 7498 | return ''; |
7499 | 7499 | } |
7500 | 7500 | |
7501 | - return (string) \mb_substr( |
|
7501 | + return (string)\mb_substr( |
|
7502 | 7502 | $str, |
7503 | - $offset + (int) \mb_strlen($separator) |
|
7503 | + $offset + (int)\mb_strlen($separator) |
|
7504 | 7504 | ); |
7505 | 7505 | } |
7506 | 7506 | |
@@ -7509,9 +7509,9 @@ discard block |
||
7509 | 7509 | return ''; |
7510 | 7510 | } |
7511 | 7511 | |
7512 | - return (string) self::substr( |
|
7512 | + return (string)self::substr( |
|
7513 | 7513 | $str, |
7514 | - $offset + (int) self::strlen($separator, $encoding), |
|
7514 | + $offset + (int)self::strlen($separator, $encoding), |
|
7515 | 7515 | null, |
7516 | 7516 | $encoding |
7517 | 7517 | ); |
@@ -7541,7 +7541,7 @@ discard block |
||
7541 | 7541 | return ''; |
7542 | 7542 | } |
7543 | 7543 | |
7544 | - return (string) \mb_substr( |
|
7544 | + return (string)\mb_substr( |
|
7545 | 7545 | $str, |
7546 | 7546 | 0, |
7547 | 7547 | $offset |
@@ -7553,7 +7553,7 @@ discard block |
||
7553 | 7553 | return ''; |
7554 | 7554 | } |
7555 | 7555 | |
7556 | - return (string) self::substr( |
|
7556 | + return (string)self::substr( |
|
7557 | 7557 | $str, |
7558 | 7558 | 0, |
7559 | 7559 | $offset, |
@@ -7582,7 +7582,7 @@ discard block |
||
7582 | 7582 | return ''; |
7583 | 7583 | } |
7584 | 7584 | |
7585 | - return (string) \mb_substr( |
|
7585 | + return (string)\mb_substr( |
|
7586 | 7586 | $str, |
7587 | 7587 | 0, |
7588 | 7588 | $offset |
@@ -7596,7 +7596,7 @@ discard block |
||
7596 | 7596 | |
7597 | 7597 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7598 | 7598 | |
7599 | - return (string) self::substr( |
|
7599 | + return (string)self::substr( |
|
7600 | 7600 | $str, |
7601 | 7601 | 0, |
7602 | 7602 | $offset, |
@@ -7704,7 +7704,7 @@ discard block |
||
7704 | 7704 | */ |
7705 | 7705 | public static function str_surround(string $str, string $substring): string |
7706 | 7706 | { |
7707 | - return $substring . $str . $substring; |
|
7707 | + return $substring.$str.$substring; |
|
7708 | 7708 | } |
7709 | 7709 | |
7710 | 7710 | /** |
@@ -7748,9 +7748,9 @@ discard block |
||
7748 | 7748 | |
7749 | 7749 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
7750 | 7750 | |
7751 | - return (string) \preg_replace_callback( |
|
7751 | + return (string)\preg_replace_callback( |
|
7752 | 7752 | '/([^\\s]+)/u', |
7753 | - static function (array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7753 | + static function(array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7754 | 7754 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
7755 | 7755 | return $match[0]; |
7756 | 7756 | } |
@@ -7836,16 +7836,16 @@ discard block |
||
7836 | 7836 | } |
7837 | 7837 | |
7838 | 7838 | // the main substitutions |
7839 | - $str = (string) \preg_replace_callback( |
|
7839 | + $str = (string)\preg_replace_callback( |
|
7840 | 7840 | '~\\b (_*) (?: # 1. Leading underscore and |
7841 | 7841 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
7842 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
7842 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
7843 | 7843 | | |
7844 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
7844 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
7845 | 7845 | | |
7846 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
7846 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
7847 | 7847 | | |
7848 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
7848 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
7849 | 7849 | ) (_*) \\b # 6. With trailing underscore |
7850 | 7850 | ~ux', |
7851 | 7851 | /** |
@@ -7853,7 +7853,7 @@ discard block |
||
7853 | 7853 | * |
7854 | 7854 | * @return string |
7855 | 7855 | */ |
7856 | - static function (array $matches) use ($encoding): string { |
|
7856 | + static function(array $matches) use ($encoding): string { |
|
7857 | 7857 | // preserve leading underscore |
7858 | 7858 | $str = $matches[1]; |
7859 | 7859 | if ($matches[2]) { |
@@ -7878,26 +7878,26 @@ discard block |
||
7878 | 7878 | ); |
7879 | 7879 | |
7880 | 7880 | // Exceptions for small words: capitalize at start of title... |
7881 | - $str = (string) \preg_replace_callback( |
|
7881 | + $str = (string)\preg_replace_callback( |
|
7882 | 7882 | '~( \\A [[:punct:]]* # start of title... |
7883 | 7883 | | [:.;?!][ ]+ # or of subsentence... |
7884 | 7884 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
7885 | - ( ' . $smallWordsRx . ' ) \\b # ...followed by small word |
|
7885 | + ( ' . $smallWordsRx.' ) \\b # ...followed by small word |
|
7886 | 7886 | ~uxi', |
7887 | 7887 | /** |
7888 | 7888 | * @param string[] $matches |
7889 | 7889 | * |
7890 | 7890 | * @return string |
7891 | 7891 | */ |
7892 | - static function (array $matches) use ($encoding): string { |
|
7893 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7892 | + static function(array $matches) use ($encoding): string { |
|
7893 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7894 | 7894 | }, |
7895 | 7895 | $str |
7896 | 7896 | ); |
7897 | 7897 | |
7898 | 7898 | // ...and end of title |
7899 | - $str = (string) \preg_replace_callback( |
|
7900 | - '~\\b ( ' . $smallWordsRx . ' ) # small word... |
|
7899 | + $str = (string)\preg_replace_callback( |
|
7900 | + '~\\b ( '.$smallWordsRx.' ) # small word... |
|
7901 | 7901 | (?= [[:punct:]]* \Z # ...at the end of the title... |
7902 | 7902 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
7903 | 7903 | ~uxi', |
@@ -7906,7 +7906,7 @@ discard block |
||
7906 | 7906 | * |
7907 | 7907 | * @return string |
7908 | 7908 | */ |
7909 | - static function (array $matches) use ($encoding): string { |
|
7909 | + static function(array $matches) use ($encoding): string { |
|
7910 | 7910 | return static::str_upper_first($matches[1], $encoding); |
7911 | 7911 | }, |
7912 | 7912 | $str |
@@ -7914,10 +7914,10 @@ discard block |
||
7914 | 7914 | |
7915 | 7915 | // Exceptions for small words in hyphenated compound words. |
7916 | 7916 | // e.g. "in-flight" -> In-Flight |
7917 | - $str = (string) \preg_replace_callback( |
|
7917 | + $str = (string)\preg_replace_callback( |
|
7918 | 7918 | '~\\b |
7919 | 7919 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
7920 | - ( ' . $smallWordsRx . ' ) |
|
7920 | + ( ' . $smallWordsRx.' ) |
|
7921 | 7921 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
7922 | 7922 | ~uxi', |
7923 | 7923 | /** |
@@ -7925,18 +7925,18 @@ discard block |
||
7925 | 7925 | * |
7926 | 7926 | * @return string |
7927 | 7927 | */ |
7928 | - static function (array $matches) use ($encoding): string { |
|
7928 | + static function(array $matches) use ($encoding): string { |
|
7929 | 7929 | return static::str_upper_first($matches[1], $encoding); |
7930 | 7930 | }, |
7931 | 7931 | $str |
7932 | 7932 | ); |
7933 | 7933 | |
7934 | 7934 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
7935 | - $str = (string) \preg_replace_callback( |
|
7935 | + $str = (string)\preg_replace_callback( |
|
7936 | 7936 | '~\\b |
7937 | 7937 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
7938 | 7938 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
7939 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
7939 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
7940 | 7940 | (?! - ) # Negative lookahead for another - |
7941 | 7941 | ~uxi', |
7942 | 7942 | /** |
@@ -7944,8 +7944,8 @@ discard block |
||
7944 | 7944 | * |
7945 | 7945 | * @return string |
7946 | 7946 | */ |
7947 | - static function (array $matches) use ($encoding): string { |
|
7948 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7947 | + static function(array $matches) use ($encoding): string { |
|
7948 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7949 | 7949 | }, |
7950 | 7950 | $str |
7951 | 7951 | ); |
@@ -8053,7 +8053,7 @@ discard block |
||
8053 | 8053 | ); |
8054 | 8054 | |
8055 | 8055 | foreach ($tmpReturn as &$item) { |
8056 | - $item = (string) $item; |
|
8056 | + $item = (string)$item; |
|
8057 | 8057 | } |
8058 | 8058 | |
8059 | 8059 | return $tmpReturn; |
@@ -8098,39 +8098,39 @@ discard block |
||
8098 | 8098 | } |
8099 | 8099 | |
8100 | 8100 | if ($encoding === 'UTF-8') { |
8101 | - if ($length >= (int) \mb_strlen($str)) { |
|
8101 | + if ($length >= (int)\mb_strlen($str)) { |
|
8102 | 8102 | return $str; |
8103 | 8103 | } |
8104 | 8104 | |
8105 | 8105 | if ($substring !== '') { |
8106 | - $length -= (int) \mb_strlen($substring); |
|
8106 | + $length -= (int)\mb_strlen($substring); |
|
8107 | 8107 | |
8108 | 8108 | /** @noinspection UnnecessaryCastingInspection */ |
8109 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8109 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8110 | 8110 | } |
8111 | 8111 | |
8112 | 8112 | /** @noinspection UnnecessaryCastingInspection */ |
8113 | - return (string) \mb_substr($str, 0, $length); |
|
8113 | + return (string)\mb_substr($str, 0, $length); |
|
8114 | 8114 | } |
8115 | 8115 | |
8116 | 8116 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8117 | 8117 | |
8118 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8118 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8119 | 8119 | return $str; |
8120 | 8120 | } |
8121 | 8121 | |
8122 | 8122 | if ($substring !== '') { |
8123 | - $length -= (int) self::strlen($substring, $encoding); |
|
8123 | + $length -= (int)self::strlen($substring, $encoding); |
|
8124 | 8124 | } |
8125 | 8125 | |
8126 | 8126 | return ( |
8127 | - (string) self::substr( |
|
8127 | + (string)self::substr( |
|
8128 | 8128 | $str, |
8129 | 8129 | 0, |
8130 | 8130 | $length, |
8131 | 8131 | $encoding |
8132 | 8132 | ) |
8133 | - ) . $substring; |
|
8133 | + ).$substring; |
|
8134 | 8134 | } |
8135 | 8135 | |
8136 | 8136 | /** |
@@ -8160,12 +8160,12 @@ discard block |
||
8160 | 8160 | } |
8161 | 8161 | |
8162 | 8162 | if ($encoding === 'UTF-8') { |
8163 | - if ($length >= (int) \mb_strlen($str)) { |
|
8163 | + if ($length >= (int)\mb_strlen($str)) { |
|
8164 | 8164 | return $str; |
8165 | 8165 | } |
8166 | 8166 | |
8167 | 8167 | // need to further trim the string so we can append the substring |
8168 | - $length -= (int) \mb_strlen($substring); |
|
8168 | + $length -= (int)\mb_strlen($substring); |
|
8169 | 8169 | if ($length <= 0) { |
8170 | 8170 | return $substring; |
8171 | 8171 | } |
@@ -8187,18 +8187,18 @@ discard block |
||
8187 | 8187 | || |
8188 | 8188 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8189 | 8189 | ) { |
8190 | - $truncated = (string) \mb_substr($truncated, 0, (int) $lastPos); |
|
8190 | + $truncated = (string)\mb_substr($truncated, 0, (int)$lastPos); |
|
8191 | 8191 | } |
8192 | 8192 | } |
8193 | 8193 | } else { |
8194 | 8194 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8195 | 8195 | |
8196 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8196 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8197 | 8197 | return $str; |
8198 | 8198 | } |
8199 | 8199 | |
8200 | 8200 | // need to further trim the string so we can append the substring |
8201 | - $length -= (int) self::strlen($substring, $encoding); |
|
8201 | + $length -= (int)self::strlen($substring, $encoding); |
|
8202 | 8202 | if ($length <= 0) { |
8203 | 8203 | return $substring; |
8204 | 8204 | } |
@@ -8220,12 +8220,12 @@ discard block |
||
8220 | 8220 | || |
8221 | 8221 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8222 | 8222 | ) { |
8223 | - $truncated = (string) self::substr($truncated, 0, (int) $lastPos, $encoding); |
|
8223 | + $truncated = (string)self::substr($truncated, 0, (int)$lastPos, $encoding); |
|
8224 | 8224 | } |
8225 | 8225 | } |
8226 | 8226 | } |
8227 | 8227 | |
8228 | - return $truncated . $substring; |
|
8228 | + return $truncated.$substring; |
|
8229 | 8229 | } |
8230 | 8230 | |
8231 | 8231 | /** |
@@ -8315,13 +8315,13 @@ discard block |
||
8315 | 8315 | } |
8316 | 8316 | } elseif ($format === 2) { |
8317 | 8317 | $numberOfWords = []; |
8318 | - $offset = (int) self::strlen($strParts[0]); |
|
8318 | + $offset = (int)self::strlen($strParts[0]); |
|
8319 | 8319 | for ($i = 1; $i < $len; $i += 2) { |
8320 | 8320 | $numberOfWords[$offset] = $strParts[$i]; |
8321 | - $offset += (int) self::strlen($strParts[$i]) + (int) self::strlen($strParts[$i + 1]); |
|
8321 | + $offset += (int)self::strlen($strParts[$i]) + (int)self::strlen($strParts[$i + 1]); |
|
8322 | 8322 | } |
8323 | 8323 | } else { |
8324 | - $numberOfWords = (int) (($len - 1) / 2); |
|
8324 | + $numberOfWords = (int)(($len - 1) / 2); |
|
8325 | 8325 | } |
8326 | 8326 | |
8327 | 8327 | return $numberOfWords; |
@@ -8418,21 +8418,21 @@ discard block |
||
8418 | 8418 | } |
8419 | 8419 | |
8420 | 8420 | if ($charList === '') { |
8421 | - return (int) self::strlen($str, $encoding); |
|
8421 | + return (int)self::strlen($str, $encoding); |
|
8422 | 8422 | } |
8423 | 8423 | |
8424 | 8424 | if ($offset !== null || $length !== null) { |
8425 | 8425 | if ($encoding === 'UTF-8') { |
8426 | 8426 | if ($length === null) { |
8427 | 8427 | /** @noinspection UnnecessaryCastingInspection */ |
8428 | - $strTmp = \mb_substr($str, (int) $offset); |
|
8428 | + $strTmp = \mb_substr($str, (int)$offset); |
|
8429 | 8429 | } else { |
8430 | 8430 | /** @noinspection UnnecessaryCastingInspection */ |
8431 | - $strTmp = \mb_substr($str, (int) $offset, $length); |
|
8431 | + $strTmp = \mb_substr($str, (int)$offset, $length); |
|
8432 | 8432 | } |
8433 | 8433 | } else { |
8434 | 8434 | /** @noinspection UnnecessaryCastingInspection */ |
8435 | - $strTmp = self::substr($str, (int) $offset, $length, $encoding); |
|
8435 | + $strTmp = self::substr($str, (int)$offset, $length, $encoding); |
|
8436 | 8436 | } |
8437 | 8437 | |
8438 | 8438 | if ($strTmp === false) { |
@@ -8447,7 +8447,7 @@ discard block |
||
8447 | 8447 | } |
8448 | 8448 | |
8449 | 8449 | $matches = []; |
8450 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $matches)) { |
|
8450 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $matches)) { |
|
8451 | 8451 | $return = self::strlen($matches[1], $encoding); |
8452 | 8452 | if ($return === false) { |
8453 | 8453 | return 0; |
@@ -8456,7 +8456,7 @@ discard block |
||
8456 | 8456 | return $return; |
8457 | 8457 | } |
8458 | 8458 | |
8459 | - return (int) self::strlen($str, $encoding); |
|
8459 | + return (int)self::strlen($str, $encoding); |
|
8460 | 8460 | } |
8461 | 8461 | |
8462 | 8462 | /** |
@@ -8578,7 +8578,7 @@ discard block |
||
8578 | 8578 | return ''; |
8579 | 8579 | } |
8580 | 8580 | |
8581 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
8581 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
8582 | 8582 | } |
8583 | 8583 | |
8584 | 8584 | /** |
@@ -8643,7 +8643,7 @@ discard block |
||
8643 | 8643 | // fallback for ascii only |
8644 | 8644 | // |
8645 | 8645 | |
8646 | - if (self::is_ascii($haystack . $needle)) { |
|
8646 | + if (self::is_ascii($haystack.$needle)) { |
|
8647 | 8647 | return \stripos($haystack, $needle, $offset); |
8648 | 8648 | } |
8649 | 8649 | |
@@ -8710,7 +8710,7 @@ discard block |
||
8710 | 8710 | && |
8711 | 8711 | self::$SUPPORT['mbstring'] === false |
8712 | 8712 | ) { |
8713 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8713 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8714 | 8714 | } |
8715 | 8715 | |
8716 | 8716 | if ( |
@@ -8724,11 +8724,11 @@ discard block |
||
8724 | 8724 | } |
8725 | 8725 | } |
8726 | 8726 | |
8727 | - if (self::is_ascii($needle . $haystack)) { |
|
8727 | + if (self::is_ascii($needle.$haystack)) { |
|
8728 | 8728 | return \stristr($haystack, $needle, $before_needle); |
8729 | 8729 | } |
8730 | 8730 | |
8731 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
8731 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
8732 | 8732 | |
8733 | 8733 | if (!isset($match[1])) { |
8734 | 8734 | return false; |
@@ -8738,7 +8738,7 @@ discard block |
||
8738 | 8738 | return $match[1]; |
8739 | 8739 | } |
8740 | 8740 | |
8741 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
8741 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
8742 | 8742 | } |
8743 | 8743 | |
8744 | 8744 | /** |
@@ -8805,7 +8805,7 @@ discard block |
||
8805 | 8805 | && |
8806 | 8806 | self::$SUPPORT['iconv'] === false |
8807 | 8807 | ) { |
8808 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8808 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8809 | 8809 | } |
8810 | 8810 | |
8811 | 8811 | // |
@@ -8921,8 +8921,8 @@ discard block |
||
8921 | 8921 | } |
8922 | 8922 | |
8923 | 8923 | return \strnatcmp( |
8924 | - (string) self::strtonatfold($str1), |
|
8925 | - (string) self::strtonatfold($str2) |
|
8924 | + (string)self::strtonatfold($str1), |
|
8925 | + (string)self::strtonatfold($str2) |
|
8926 | 8926 | ); |
8927 | 8927 | } |
8928 | 8928 | |
@@ -8980,11 +8980,11 @@ discard block |
||
8980 | 8980 | } |
8981 | 8981 | |
8982 | 8982 | if ($encoding === 'UTF-8') { |
8983 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
8984 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
8983 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
8984 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
8985 | 8985 | } else { |
8986 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
8987 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
8986 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
8987 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
8988 | 8988 | } |
8989 | 8989 | |
8990 | 8990 | return self::strcmp($str1, $str2); |
@@ -9006,8 +9006,8 @@ discard block |
||
9006 | 9006 | return false; |
9007 | 9007 | } |
9008 | 9008 | |
9009 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
9010 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
9009 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
9010 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
9011 | 9011 | } |
9012 | 9012 | |
9013 | 9013 | return false; |
@@ -9040,10 +9040,10 @@ discard block |
||
9040 | 9040 | } |
9041 | 9041 | |
9042 | 9042 | // iconv and mbstring do not support integer $needle |
9043 | - if ((int) $needle === $needle) { |
|
9044 | - $needle = (string) self::chr($needle); |
|
9043 | + if ((int)$needle === $needle) { |
|
9044 | + $needle = (string)self::chr($needle); |
|
9045 | 9045 | } |
9046 | - $needle = (string) $needle; |
|
9046 | + $needle = (string)$needle; |
|
9047 | 9047 | |
9048 | 9048 | if ($needle === '') { |
9049 | 9049 | return false; |
@@ -9090,7 +9090,7 @@ discard block |
||
9090 | 9090 | && |
9091 | 9091 | self::$SUPPORT['mbstring'] === false |
9092 | 9092 | ) { |
9093 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9093 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9094 | 9094 | } |
9095 | 9095 | |
9096 | 9096 | // |
@@ -9131,7 +9131,7 @@ discard block |
||
9131 | 9131 | // fallback for ascii only |
9132 | 9132 | // |
9133 | 9133 | |
9134 | - if (self::is_ascii($haystack . $needle)) { |
|
9134 | + if (self::is_ascii($haystack.$needle)) { |
|
9135 | 9135 | return \strpos($haystack, $needle, $offset); |
9136 | 9136 | } |
9137 | 9137 | |
@@ -9143,7 +9143,7 @@ discard block |
||
9143 | 9143 | if ($haystackTmp === false) { |
9144 | 9144 | $haystackTmp = ''; |
9145 | 9145 | } |
9146 | - $haystack = (string) $haystackTmp; |
|
9146 | + $haystack = (string)$haystackTmp; |
|
9147 | 9147 | |
9148 | 9148 | if ($offset < 0) { |
9149 | 9149 | $offset = 0; |
@@ -9155,7 +9155,7 @@ discard block |
||
9155 | 9155 | } |
9156 | 9156 | |
9157 | 9157 | if ($pos) { |
9158 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9158 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9159 | 9159 | } |
9160 | 9160 | |
9161 | 9161 | return $offset + 0; |
@@ -9266,7 +9266,7 @@ discard block |
||
9266 | 9266 | && |
9267 | 9267 | self::$SUPPORT['mbstring'] === false |
9268 | 9268 | ) { |
9269 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9269 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9270 | 9270 | } |
9271 | 9271 | |
9272 | 9272 | // |
@@ -9278,7 +9278,7 @@ discard block |
||
9278 | 9278 | if ($needleTmp === false) { |
9279 | 9279 | return false; |
9280 | 9280 | } |
9281 | - $needle = (string) $needleTmp; |
|
9281 | + $needle = (string)$needleTmp; |
|
9282 | 9282 | |
9283 | 9283 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
9284 | 9284 | if ($pos === false) { |
@@ -9300,7 +9300,7 @@ discard block |
||
9300 | 9300 | if ($needleTmp === false) { |
9301 | 9301 | return false; |
9302 | 9302 | } |
9303 | - $needle = (string) $needleTmp; |
|
9303 | + $needle = (string)$needleTmp; |
|
9304 | 9304 | |
9305 | 9305 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
9306 | 9306 | if ($pos === false) { |
@@ -9336,7 +9336,7 @@ discard block |
||
9336 | 9336 | if ($encoding === 'UTF-8') { |
9337 | 9337 | if (self::$SUPPORT['intl'] === true) { |
9338 | 9338 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
9339 | - $i = (int) \grapheme_strlen($str); |
|
9339 | + $i = (int)\grapheme_strlen($str); |
|
9340 | 9340 | while ($i--) { |
9341 | 9341 | $reversedTmp = \grapheme_substr($str, $i, 1); |
9342 | 9342 | if ($reversedTmp !== false) { |
@@ -9344,7 +9344,7 @@ discard block |
||
9344 | 9344 | } |
9345 | 9345 | } |
9346 | 9346 | } else { |
9347 | - $i = (int) \mb_strlen($str); |
|
9347 | + $i = (int)\mb_strlen($str); |
|
9348 | 9348 | while ($i--) { |
9349 | 9349 | $reversedTmp = \mb_substr($str, $i, 1); |
9350 | 9350 | if ($reversedTmp !== false) { |
@@ -9355,7 +9355,7 @@ discard block |
||
9355 | 9355 | } else { |
9356 | 9356 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9357 | 9357 | |
9358 | - $i = (int) self::strlen($str, $encoding); |
|
9358 | + $i = (int)self::strlen($str, $encoding); |
|
9359 | 9359 | while ($i--) { |
9360 | 9360 | $reversedTmp = self::substr($str, $i, 1, $encoding); |
9361 | 9361 | if ($reversedTmp !== false) { |
@@ -9429,7 +9429,7 @@ discard block |
||
9429 | 9429 | if ($needleTmp === false) { |
9430 | 9430 | return false; |
9431 | 9431 | } |
9432 | - $needle = (string) $needleTmp; |
|
9432 | + $needle = (string)$needleTmp; |
|
9433 | 9433 | |
9434 | 9434 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
9435 | 9435 | if ($pos === false) { |
@@ -9468,10 +9468,10 @@ discard block |
||
9468 | 9468 | } |
9469 | 9469 | |
9470 | 9470 | // iconv and mbstring do not support integer $needle |
9471 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9472 | - $needle = (string) self::chr($needle); |
|
9471 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9472 | + $needle = (string)self::chr($needle); |
|
9473 | 9473 | } |
9474 | - $needle = (string) $needle; |
|
9474 | + $needle = (string)$needle; |
|
9475 | 9475 | |
9476 | 9476 | if ($needle === '') { |
9477 | 9477 | return false; |
@@ -9516,7 +9516,7 @@ discard block |
||
9516 | 9516 | && |
9517 | 9517 | self::$SUPPORT['mbstring'] === false |
9518 | 9518 | ) { |
9519 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9519 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9520 | 9520 | } |
9521 | 9521 | |
9522 | 9522 | // |
@@ -9540,7 +9540,7 @@ discard block |
||
9540 | 9540 | // fallback for ascii only |
9541 | 9541 | // |
9542 | 9542 | |
9543 | - if (self::is_ascii($haystack . $needle)) { |
|
9543 | + if (self::is_ascii($haystack.$needle)) { |
|
9544 | 9544 | return \strripos($haystack, $needle, $offset); |
9545 | 9545 | } |
9546 | 9546 | |
@@ -9616,10 +9616,10 @@ discard block |
||
9616 | 9616 | } |
9617 | 9617 | |
9618 | 9618 | // iconv and mbstring do not support integer $needle |
9619 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9620 | - $needle = (string) self::chr($needle); |
|
9619 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9620 | + $needle = (string)self::chr($needle); |
|
9621 | 9621 | } |
9622 | - $needle = (string) $needle; |
|
9622 | + $needle = (string)$needle; |
|
9623 | 9623 | |
9624 | 9624 | if ($needle === '') { |
9625 | 9625 | return false; |
@@ -9664,7 +9664,7 @@ discard block |
||
9664 | 9664 | && |
9665 | 9665 | self::$SUPPORT['mbstring'] === false |
9666 | 9666 | ) { |
9667 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9667 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9668 | 9668 | } |
9669 | 9669 | |
9670 | 9670 | // |
@@ -9688,7 +9688,7 @@ discard block |
||
9688 | 9688 | // fallback for ascii only |
9689 | 9689 | // |
9690 | 9690 | |
9691 | - if (self::is_ascii($haystack . $needle)) { |
|
9691 | + if (self::is_ascii($haystack.$needle)) { |
|
9692 | 9692 | return \strrpos($haystack, $needle, $offset); |
9693 | 9693 | } |
9694 | 9694 | |
@@ -9708,7 +9708,7 @@ discard block |
||
9708 | 9708 | if ($haystackTmp === false) { |
9709 | 9709 | $haystackTmp = ''; |
9710 | 9710 | } |
9711 | - $haystack = (string) $haystackTmp; |
|
9711 | + $haystack = (string)$haystackTmp; |
|
9712 | 9712 | } |
9713 | 9713 | |
9714 | 9714 | $pos = \strrpos($haystack, $needle); |
@@ -9721,7 +9721,7 @@ discard block |
||
9721 | 9721 | return false; |
9722 | 9722 | } |
9723 | 9723 | |
9724 | - return $offset + (int) self::strlen($strTmp); |
|
9724 | + return $offset + (int)self::strlen($strTmp); |
|
9725 | 9725 | } |
9726 | 9726 | |
9727 | 9727 | /** |
@@ -9781,12 +9781,12 @@ discard block |
||
9781 | 9781 | if ($offset || $length !== null) { |
9782 | 9782 | if ($encoding === 'UTF-8') { |
9783 | 9783 | if ($length === null) { |
9784 | - $str = (string) \mb_substr($str, $offset); |
|
9784 | + $str = (string)\mb_substr($str, $offset); |
|
9785 | 9785 | } else { |
9786 | - $str = (string) \mb_substr($str, $offset, $length); |
|
9786 | + $str = (string)\mb_substr($str, $offset, $length); |
|
9787 | 9787 | } |
9788 | 9788 | } else { |
9789 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
9789 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
9790 | 9790 | } |
9791 | 9791 | } |
9792 | 9792 | |
@@ -9796,7 +9796,7 @@ discard block |
||
9796 | 9796 | |
9797 | 9797 | $matches = []; |
9798 | 9798 | |
9799 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
9799 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
9800 | 9800 | } |
9801 | 9801 | |
9802 | 9802 | /** |
@@ -9865,7 +9865,7 @@ discard block |
||
9865 | 9865 | && |
9866 | 9866 | self::$SUPPORT['mbstring'] === false |
9867 | 9867 | ) { |
9868 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9868 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9869 | 9869 | } |
9870 | 9870 | |
9871 | 9871 | // |
@@ -9887,7 +9887,7 @@ discard block |
||
9887 | 9887 | // fallback for ascii only |
9888 | 9888 | // |
9889 | 9889 | |
9890 | - if (self::is_ascii($haystack . $needle)) { |
|
9890 | + if (self::is_ascii($haystack.$needle)) { |
|
9891 | 9891 | return \strstr($haystack, $needle, $before_needle); |
9892 | 9892 | } |
9893 | 9893 | |
@@ -9895,7 +9895,7 @@ discard block |
||
9895 | 9895 | // fallback via vanilla php |
9896 | 9896 | // |
9897 | 9897 | |
9898 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
9898 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
9899 | 9899 | |
9900 | 9900 | if (!isset($match[1])) { |
9901 | 9901 | return false; |
@@ -9905,7 +9905,7 @@ discard block |
||
9905 | 9905 | return $match[1]; |
9906 | 9906 | } |
9907 | 9907 | |
9908 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
9908 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
9909 | 9909 | } |
9910 | 9910 | |
9911 | 9911 | /** |
@@ -10019,7 +10019,7 @@ discard block |
||
10019 | 10019 | bool $tryToKeepStringLength = false |
10020 | 10020 | ): string { |
10021 | 10021 | // init |
10022 | - $str = (string) $str; |
|
10022 | + $str = (string)$str; |
|
10023 | 10023 | |
10024 | 10024 | if ($str === '') { |
10025 | 10025 | return ''; |
@@ -10048,19 +10048,19 @@ discard block |
||
10048 | 10048 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10049 | 10049 | } |
10050 | 10050 | |
10051 | - $langCode = $lang . '-Lower'; |
|
10051 | + $langCode = $lang.'-Lower'; |
|
10052 | 10052 | if (!\in_array($langCode, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10053 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, \E_USER_WARNING); |
|
10053 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, \E_USER_WARNING); |
|
10054 | 10054 | |
10055 | 10055 | $langCode = 'Any-Lower'; |
10056 | 10056 | } |
10057 | 10057 | |
10058 | 10058 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10059 | 10059 | /** @noinspection UnnecessaryCastingInspection */ |
10060 | - return (string) \transliterator_transliterate($langCode, $str); |
|
10060 | + return (string)\transliterator_transliterate($langCode, $str); |
|
10061 | 10061 | } |
10062 | 10062 | |
10063 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
10063 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
10064 | 10064 | } |
10065 | 10065 | |
10066 | 10066 | // always fallback via symfony polyfill |
@@ -10089,7 +10089,7 @@ discard block |
||
10089 | 10089 | bool $tryToKeepStringLength = false |
10090 | 10090 | ): string { |
10091 | 10091 | // init |
10092 | - $str = (string) $str; |
|
10092 | + $str = (string)$str; |
|
10093 | 10093 | |
10094 | 10094 | if ($str === '') { |
10095 | 10095 | return ''; |
@@ -10118,19 +10118,19 @@ discard block |
||
10118 | 10118 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10119 | 10119 | } |
10120 | 10120 | |
10121 | - $langCode = $lang . '-Upper'; |
|
10121 | + $langCode = $lang.'-Upper'; |
|
10122 | 10122 | if (!\in_array($langCode, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10123 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
10123 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
10124 | 10124 | |
10125 | 10125 | $langCode = 'Any-Upper'; |
10126 | 10126 | } |
10127 | 10127 | |
10128 | 10128 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10129 | 10129 | /** @noinspection UnnecessaryCastingInspection */ |
10130 | - return (string) \transliterator_transliterate($langCode, $str); |
|
10130 | + return (string)\transliterator_transliterate($langCode, $str); |
|
10131 | 10131 | } |
10132 | 10132 | |
10133 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
10133 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
10134 | 10134 | } |
10135 | 10135 | |
10136 | 10136 | // always fallback via symfony polyfill |
@@ -10174,7 +10174,7 @@ discard block |
||
10174 | 10174 | |
10175 | 10175 | $from = \array_combine($from, $to); |
10176 | 10176 | if ($from === false) { |
10177 | - 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) . ')'); |
|
10177 | + 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).')'); |
|
10178 | 10178 | } |
10179 | 10179 | } |
10180 | 10180 | |
@@ -10231,9 +10231,9 @@ discard block |
||
10231 | 10231 | } |
10232 | 10232 | |
10233 | 10233 | $wide = 0; |
10234 | - $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); |
|
10234 | + $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); |
|
10235 | 10235 | |
10236 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
10236 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
10237 | 10237 | } |
10238 | 10238 | |
10239 | 10239 | /** |
@@ -10333,9 +10333,9 @@ discard block |
||
10333 | 10333 | } |
10334 | 10334 | |
10335 | 10335 | if ($length === null) { |
10336 | - $length = (int) $str_length; |
|
10336 | + $length = (int)$str_length; |
|
10337 | 10337 | } else { |
10338 | - $length = (int) $length; |
|
10338 | + $length = (int)$length; |
|
10339 | 10339 | } |
10340 | 10340 | |
10341 | 10341 | if ( |
@@ -10343,7 +10343,7 @@ discard block |
||
10343 | 10343 | && |
10344 | 10344 | self::$SUPPORT['mbstring'] === false |
10345 | 10345 | ) { |
10346 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10346 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10347 | 10347 | } |
10348 | 10348 | |
10349 | 10349 | // |
@@ -10431,16 +10431,16 @@ discard block |
||
10431 | 10431 | ) { |
10432 | 10432 | if ($encoding === 'UTF-8') { |
10433 | 10433 | if ($length === null) { |
10434 | - $str1 = (string) \mb_substr($str1, $offset); |
|
10434 | + $str1 = (string)\mb_substr($str1, $offset); |
|
10435 | 10435 | } else { |
10436 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
10436 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
10437 | 10437 | } |
10438 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
10438 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
10439 | 10439 | } else { |
10440 | 10440 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10441 | 10441 | |
10442 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
10443 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
10442 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
10443 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
10444 | 10444 | } |
10445 | 10445 | } |
10446 | 10446 | |
@@ -10502,13 +10502,13 @@ discard block |
||
10502 | 10502 | if ($lengthTmp === false) { |
10503 | 10503 | return false; |
10504 | 10504 | } |
10505 | - $length = (int) $lengthTmp; |
|
10505 | + $length = (int)$lengthTmp; |
|
10506 | 10506 | } |
10507 | 10507 | |
10508 | 10508 | if ($encoding === 'UTF-8') { |
10509 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
10509 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
10510 | 10510 | } else { |
10511 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
10511 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
10512 | 10512 | } |
10513 | 10513 | } |
10514 | 10514 | |
@@ -10517,7 +10517,7 @@ discard block |
||
10517 | 10517 | && |
10518 | 10518 | self::$SUPPORT['mbstring'] === false |
10519 | 10519 | ) { |
10520 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10520 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10521 | 10521 | } |
10522 | 10522 | |
10523 | 10523 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10528,7 +10528,7 @@ discard block |
||
10528 | 10528 | return \mb_substr_count($haystack, $needle, $encoding); |
10529 | 10529 | } |
10530 | 10530 | |
10531 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10531 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10532 | 10532 | |
10533 | 10533 | return \count($matches); |
10534 | 10534 | } |
@@ -10575,7 +10575,7 @@ discard block |
||
10575 | 10575 | if ($lengthTmp === false) { |
10576 | 10576 | return false; |
10577 | 10577 | } |
10578 | - $length = (int) $lengthTmp; |
|
10578 | + $length = (int)$lengthTmp; |
|
10579 | 10579 | } |
10580 | 10580 | |
10581 | 10581 | if ( |
@@ -10596,7 +10596,7 @@ discard block |
||
10596 | 10596 | if ($haystackTmp === false) { |
10597 | 10597 | $haystackTmp = ''; |
10598 | 10598 | } |
10599 | - $haystack = (string) $haystackTmp; |
|
10599 | + $haystack = (string)$haystackTmp; |
|
10600 | 10600 | } |
10601 | 10601 | |
10602 | 10602 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10635,10 +10635,10 @@ discard block |
||
10635 | 10635 | |
10636 | 10636 | if ($encoding === 'UTF-8') { |
10637 | 10637 | if ($caseSensitive) { |
10638 | - return (int) \mb_substr_count($str, $substring); |
|
10638 | + return (int)\mb_substr_count($str, $substring); |
|
10639 | 10639 | } |
10640 | 10640 | |
10641 | - return (int) \mb_substr_count( |
|
10641 | + return (int)\mb_substr_count( |
|
10642 | 10642 | \mb_strtoupper($str), |
10643 | 10643 | \mb_strtoupper($substring) |
10644 | 10644 | |
@@ -10648,10 +10648,10 @@ discard block |
||
10648 | 10648 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10649 | 10649 | |
10650 | 10650 | if ($caseSensitive) { |
10651 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
10651 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
10652 | 10652 | } |
10653 | 10653 | |
10654 | - return (int) \mb_substr_count( |
|
10654 | + return (int)\mb_substr_count( |
|
10655 | 10655 | self::strtocasefold($str, true, false, $encoding, null, false), |
10656 | 10656 | self::strtocasefold($substring, true, false, $encoding, null, false), |
10657 | 10657 | $encoding |
@@ -10677,7 +10677,7 @@ discard block |
||
10677 | 10677 | } |
10678 | 10678 | |
10679 | 10679 | if (self::str_istarts_with($haystack, $needle) === true) { |
10680 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10680 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10681 | 10681 | } |
10682 | 10682 | |
10683 | 10683 | return $haystack; |
@@ -10734,7 +10734,7 @@ discard block |
||
10734 | 10734 | } |
10735 | 10735 | |
10736 | 10736 | if (self::str_iends_with($haystack, $needle) === true) { |
10737 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
10737 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
10738 | 10738 | } |
10739 | 10739 | |
10740 | 10740 | return $haystack; |
@@ -10759,7 +10759,7 @@ discard block |
||
10759 | 10759 | } |
10760 | 10760 | |
10761 | 10761 | if (self::str_starts_with($haystack, $needle) === true) { |
10762 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10762 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10763 | 10763 | } |
10764 | 10764 | |
10765 | 10765 | return $haystack; |
@@ -10811,7 +10811,7 @@ discard block |
||
10811 | 10811 | if (\is_array($offset) === true) { |
10812 | 10812 | $offset = \array_slice($offset, 0, $num); |
10813 | 10813 | foreach ($offset as &$valueTmp) { |
10814 | - $valueTmp = (int) $valueTmp === $valueTmp ? $valueTmp : 0; |
|
10814 | + $valueTmp = (int)$valueTmp === $valueTmp ? $valueTmp : 0; |
|
10815 | 10815 | } |
10816 | 10816 | unset($valueTmp); |
10817 | 10817 | } else { |
@@ -10824,7 +10824,7 @@ discard block |
||
10824 | 10824 | } elseif (\is_array($length) === true) { |
10825 | 10825 | $length = \array_slice($length, 0, $num); |
10826 | 10826 | foreach ($length as &$valueTmpV2) { |
10827 | - $valueTmpV2 = (int) $valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10827 | + $valueTmpV2 = (int)$valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10828 | 10828 | } |
10829 | 10829 | unset($valueTmpV2); |
10830 | 10830 | } else { |
@@ -10844,8 +10844,8 @@ discard block |
||
10844 | 10844 | } |
10845 | 10845 | |
10846 | 10846 | // init |
10847 | - $str = (string) $str; |
|
10848 | - $replacement = (string) $replacement; |
|
10847 | + $str = (string)$str; |
|
10848 | + $replacement = (string)$replacement; |
|
10849 | 10849 | |
10850 | 10850 | if (\is_array($length) === true) { |
10851 | 10851 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -10860,16 +10860,16 @@ discard block |
||
10860 | 10860 | } |
10861 | 10861 | |
10862 | 10862 | if (self::$SUPPORT['mbstring'] === true) { |
10863 | - $string_length = (int) self::strlen($str, $encoding); |
|
10863 | + $string_length = (int)self::strlen($str, $encoding); |
|
10864 | 10864 | |
10865 | 10865 | if ($offset < 0) { |
10866 | - $offset = (int) \max(0, $string_length + $offset); |
|
10866 | + $offset = (int)\max(0, $string_length + $offset); |
|
10867 | 10867 | } elseif ($offset > $string_length) { |
10868 | 10868 | $offset = $string_length; |
10869 | 10869 | } |
10870 | 10870 | |
10871 | 10871 | if ($length !== null && $length < 0) { |
10872 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
10872 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
10873 | 10873 | } elseif ($length === null || $length > $string_length) { |
10874 | 10874 | $length = $string_length; |
10875 | 10875 | } |
@@ -10880,9 +10880,9 @@ discard block |
||
10880 | 10880 | } |
10881 | 10881 | |
10882 | 10882 | /** @noinspection AdditionOperationOnArraysInspection */ |
10883 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
10884 | - $replacement . |
|
10885 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10883 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
10884 | + $replacement. |
|
10885 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10886 | 10886 | } |
10887 | 10887 | |
10888 | 10888 | // |
@@ -10891,8 +10891,7 @@ discard block |
||
10891 | 10891 | |
10892 | 10892 | if (self::is_ascii($str)) { |
10893 | 10893 | return ($length === null) ? |
10894 | - \substr_replace($str, $replacement, $offset) : |
|
10895 | - \substr_replace($str, $replacement, $offset, $length); |
|
10894 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
10896 | 10895 | } |
10897 | 10896 | |
10898 | 10897 | // |
@@ -10908,7 +10907,7 @@ discard block |
||
10908 | 10907 | // e.g.: non mbstring support + invalid chars |
10909 | 10908 | return ''; |
10910 | 10909 | } |
10911 | - $length = (int) $lengthTmp; |
|
10910 | + $length = (int)$lengthTmp; |
|
10912 | 10911 | } |
10913 | 10912 | |
10914 | 10913 | \array_splice($smatches[0], $offset, $length, $rmatches[0]); |
@@ -10943,14 +10942,14 @@ discard block |
||
10943 | 10942 | && |
10944 | 10943 | \substr($haystack, -\strlen($needle)) === $needle |
10945 | 10944 | ) { |
10946 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
10945 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
10947 | 10946 | } |
10948 | 10947 | |
10949 | 10948 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
10950 | - return (string) self::substr( |
|
10949 | + return (string)self::substr( |
|
10951 | 10950 | $haystack, |
10952 | 10951 | 0, |
10953 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
10952 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
10954 | 10953 | $encoding |
10955 | 10954 | ); |
10956 | 10955 | } |
@@ -10980,10 +10979,10 @@ discard block |
||
10980 | 10979 | } |
10981 | 10980 | |
10982 | 10981 | if ($encoding === 'UTF-8') { |
10983 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10982 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10984 | 10983 | } |
10985 | 10984 | |
10986 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10985 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10987 | 10986 | } |
10988 | 10987 | |
10989 | 10988 | /** |
@@ -11175,7 +11174,7 @@ discard block |
||
11175 | 11174 | // INFO: https://unicode.org/cldr/utility/character.jsp?a=%E2%84%8C |
11176 | 11175 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11177 | 11176 | /** @noinspection UnnecessaryCastingInspection */ |
11178 | - $str = (string) \transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11177 | + $str = (string)\transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11179 | 11178 | |
11180 | 11179 | // check again, if we only have ASCII, now ... |
11181 | 11180 | if (self::is_ascii($str) === true) { |
@@ -11299,7 +11298,7 @@ discard block |
||
11299 | 11298 | public static function to_boolean($str): bool |
11300 | 11299 | { |
11301 | 11300 | // init |
11302 | - $str = (string) $str; |
|
11301 | + $str = (string)$str; |
|
11303 | 11302 | |
11304 | 11303 | if ($str === '') { |
11305 | 11304 | return false; |
@@ -11327,10 +11326,10 @@ discard block |
||
11327 | 11326 | } |
11328 | 11327 | |
11329 | 11328 | if (\is_numeric($str)) { |
11330 | - return ((float) $str + 0) > 0; |
|
11329 | + return ((float)$str + 0) > 0; |
|
11331 | 11330 | } |
11332 | 11331 | |
11333 | - return (bool) \trim($str); |
|
11332 | + return (bool)\trim($str); |
|
11334 | 11333 | } |
11335 | 11334 | |
11336 | 11335 | /** |
@@ -11351,11 +11350,11 @@ discard block |
||
11351 | 11350 | |
11352 | 11351 | $fallback_char_escaped = \preg_quote($fallback_char, '/'); |
11353 | 11352 | |
11354 | - $string = (string) \preg_replace( |
|
11353 | + $string = (string)\preg_replace( |
|
11355 | 11354 | [ |
11356 | - '/[^' . $fallback_char_escaped . '\\.\\-a-zA-Z0-9\\s]/', // 1) remove un-needed chars |
|
11357 | - '/[\\s]+/u', // 2) convert spaces to $fallback_char |
|
11358 | - '/[' . $fallback_char_escaped . ']+/u', // 3) remove double $fallback_char's |
|
11355 | + '/[^'.$fallback_char_escaped.'\\.\\-a-zA-Z0-9\\s]/', // 1) remove un-needed chars |
|
11356 | + '/[\\s]+/u', // 2) convert spaces to $fallback_char |
|
11357 | + '/['.$fallback_char_escaped.']+/u', // 3) remove double $fallback_char's |
|
11359 | 11358 | ], |
11360 | 11359 | [ |
11361 | 11360 | '', |
@@ -11386,7 +11385,7 @@ discard block |
||
11386 | 11385 | return $str; |
11387 | 11386 | } |
11388 | 11387 | |
11389 | - $str = (string) $str; |
|
11388 | + $str = (string)$str; |
|
11390 | 11389 | if ($str === '') { |
11391 | 11390 | return ''; |
11392 | 11391 | } |
@@ -11433,7 +11432,7 @@ discard block |
||
11433 | 11432 | return $str; |
11434 | 11433 | } |
11435 | 11434 | |
11436 | - $str = (string) $str; |
|
11435 | + $str = (string)$str; |
|
11437 | 11436 | if ($str === '') { |
11438 | 11437 | return $str; |
11439 | 11438 | } |
@@ -11451,7 +11450,7 @@ discard block |
||
11451 | 11450 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
11452 | 11451 | |
11453 | 11452 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11454 | - $buf .= $c1 . $c2; |
|
11453 | + $buf .= $c1.$c2; |
|
11455 | 11454 | ++$i; |
11456 | 11455 | } else { // not valid UTF8 - convert it |
11457 | 11456 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11462,7 +11461,7 @@ discard block |
||
11462 | 11461 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
11463 | 11462 | |
11464 | 11463 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11465 | - $buf .= $c1 . $c2 . $c3; |
|
11464 | + $buf .= $c1.$c2.$c3; |
|
11466 | 11465 | $i += 2; |
11467 | 11466 | } else { // not valid UTF8 - convert it |
11468 | 11467 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11474,7 +11473,7 @@ discard block |
||
11474 | 11473 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
11475 | 11474 | |
11476 | 11475 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11477 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
11476 | + $buf .= $c1.$c2.$c3.$c4; |
|
11478 | 11477 | $i += 3; |
11479 | 11478 | } else { // not valid UTF8 - convert it |
11480 | 11479 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11500,13 +11499,13 @@ discard block |
||
11500 | 11499 | * |
11501 | 11500 | * @return string |
11502 | 11501 | */ |
11503 | - static function (array $matches): string { |
|
11502 | + static function(array $matches): string { |
|
11504 | 11503 | if (isset($matches[3])) { |
11505 | - $cp = (int) \hexdec($matches[3]); |
|
11504 | + $cp = (int)\hexdec($matches[3]); |
|
11506 | 11505 | } else { |
11507 | 11506 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
11508 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
11509 | - + (int) \hexdec($matches[2]) |
|
11507 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
11508 | + + (int)\hexdec($matches[2]) |
|
11510 | 11509 | + 0x10000 |
11511 | 11510 | - (0xD800 << 10) |
11512 | 11511 | - 0xDC00; |
@@ -11517,12 +11516,12 @@ discard block |
||
11517 | 11516 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
11518 | 11517 | |
11519 | 11518 | if ($cp < 0x80) { |
11520 | - return (string) self::chr($cp); |
|
11519 | + return (string)self::chr($cp); |
|
11521 | 11520 | } |
11522 | 11521 | |
11523 | 11522 | if ($cp < 0xA0) { |
11524 | 11523 | /** @noinspection UnnecessaryCastingInspection */ |
11525 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
11524 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
11526 | 11525 | } |
11527 | 11526 | |
11528 | 11527 | return self::decimal_to_chr($cp); |
@@ -11570,7 +11569,7 @@ discard block |
||
11570 | 11569 | |
11571 | 11570 | if (self::$SUPPORT['mbstring'] === true) { |
11572 | 11571 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11573 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
11572 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
11574 | 11573 | } |
11575 | 11574 | |
11576 | 11575 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -11607,15 +11606,15 @@ discard block |
||
11607 | 11606 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
11608 | 11607 | |
11609 | 11608 | if ($encoding === 'UTF-8') { |
11610 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
11609 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
11611 | 11610 | |
11612 | 11611 | if ($useMbFunction === true) { |
11613 | 11612 | $strPartOne = \mb_strtoupper( |
11614 | - (string) \mb_substr($str, 0, 1) |
|
11613 | + (string)\mb_substr($str, 0, 1) |
|
11615 | 11614 | ); |
11616 | 11615 | } else { |
11617 | 11616 | $strPartOne = self::strtoupper( |
11618 | - (string) \mb_substr($str, 0, 1), |
|
11617 | + (string)\mb_substr($str, 0, 1), |
|
11619 | 11618 | $encoding, |
11620 | 11619 | false, |
11621 | 11620 | $lang, |
@@ -11625,16 +11624,16 @@ discard block |
||
11625 | 11624 | } else { |
11626 | 11625 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11627 | 11626 | |
11628 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
11627 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
11629 | 11628 | |
11630 | 11629 | if ($useMbFunction === true) { |
11631 | 11630 | $strPartOne = \mb_strtoupper( |
11632 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
11631 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
11633 | 11632 | $encoding |
11634 | 11633 | ); |
11635 | 11634 | } else { |
11636 | 11635 | $strPartOne = self::strtoupper( |
11637 | - (string) self::substr($str, 0, 1, $encoding), |
|
11636 | + (string)self::substr($str, 0, 1, $encoding), |
|
11638 | 11637 | $encoding, |
11639 | 11638 | false, |
11640 | 11639 | $lang, |
@@ -11643,7 +11642,7 @@ discard block |
||
11643 | 11642 | } |
11644 | 11643 | } |
11645 | 11644 | |
11646 | - return $strPartOne . $strPartTwo; |
|
11645 | + return $strPartOne.$strPartTwo; |
|
11647 | 11646 | } |
11648 | 11647 | |
11649 | 11648 | /** |
@@ -11694,7 +11693,7 @@ discard block |
||
11694 | 11693 | $str = self::clean($str); |
11695 | 11694 | } |
11696 | 11695 | |
11697 | - $usePhpDefaultFunctions = !(bool) ($charlist . \implode('', $exceptions)); |
|
11696 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
11698 | 11697 | |
11699 | 11698 | if ( |
11700 | 11699 | $usePhpDefaultFunctions === true |
@@ -12081,7 +12080,7 @@ discard block |
||
12081 | 12080 | if ( |
12082 | 12081 | $keepUtf8Chars === true |
12083 | 12082 | && |
12084 | - self::strlen($return) >= (int) self::strlen($str_backup) |
|
12083 | + self::strlen($return) >= (int)self::strlen($str_backup) |
|
12085 | 12084 | ) { |
12086 | 12085 | return $str_backup; |
12087 | 12086 | } |
@@ -12157,17 +12156,17 @@ discard block |
||
12157 | 12156 | return ''; |
12158 | 12157 | } |
12159 | 12158 | |
12160 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
12159 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
12161 | 12160 | |
12162 | 12161 | if ( |
12163 | 12162 | !isset($matches[0]) |
12164 | 12163 | || |
12165 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
12164 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
12166 | 12165 | ) { |
12167 | 12166 | return $str; |
12168 | 12167 | } |
12169 | 12168 | |
12170 | - return \rtrim($matches[0]) . $strAddOn; |
|
12169 | + return \rtrim($matches[0]).$strAddOn; |
|
12171 | 12170 | } |
12172 | 12171 | |
12173 | 12172 | /** |
@@ -12254,7 +12253,7 @@ discard block |
||
12254 | 12253 | } |
12255 | 12254 | } |
12256 | 12255 | |
12257 | - return $strReturn . \implode('', $chars); |
|
12256 | + return $strReturn.\implode('', $chars); |
|
12258 | 12257 | } |
12259 | 12258 | |
12260 | 12259 | /** |
@@ -12306,7 +12305,7 @@ discard block |
||
12306 | 12305 | $finalBreak = ''; |
12307 | 12306 | } |
12308 | 12307 | |
12309 | - return \implode($delimiter ?? "\n", $stringArray) . $finalBreak; |
|
12308 | + return \implode($delimiter ?? "\n", $stringArray).$finalBreak; |
|
12310 | 12309 | } |
12311 | 12310 | |
12312 | 12311 | /** |
@@ -12373,7 +12372,7 @@ discard block |
||
12373 | 12372 | /** @noinspection PhpIncludeInspection */ |
12374 | 12373 | /** @noinspection UsingInclusionReturnValueInspection */ |
12375 | 12374 | /** @psalm-suppress UnresolvableInclude */ |
12376 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
12375 | + return include __DIR__.'/data/'.$file.'.php'; |
|
12377 | 12376 | } |
12378 | 12377 | |
12379 | 12378 | /** |
@@ -12385,7 +12384,7 @@ discard block |
||
12385 | 12384 | */ |
12386 | 12385 | private static function getDataIfExists(string $file) |
12387 | 12386 | { |
12388 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
12387 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
12389 | 12388 | if (\file_exists($file)) { |
12390 | 12389 | /** @noinspection PhpIncludeInspection */ |
12391 | 12390 | /** @noinspection UsingInclusionReturnValueInspection */ |
@@ -12407,7 +12406,7 @@ discard block |
||
12407 | 12406 | |
12408 | 12407 | \uksort( |
12409 | 12408 | self::$EMOJI, |
12410 | - static function (string $a, string $b): int { |
|
12409 | + static function(string $a, string $b): int { |
|
12411 | 12410 | return \strlen($b) <=> \strlen($a); |
12412 | 12411 | } |
12413 | 12412 | ); |
@@ -12417,7 +12416,7 @@ discard block |
||
12417 | 12416 | |
12418 | 12417 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
12419 | 12418 | $tmpKey = \crc32($key); |
12420 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmpKey . '_-_' . \strrev((string) $tmpKey) . '_-_8FTU_ELBATROP_-_'; |
|
12419 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmpKey.'_-_'.\strrev((string)$tmpKey).'_-_8FTU_ELBATROP_-_'; |
|
12421 | 12420 | } |
12422 | 12421 | |
12423 | 12422 | return true; |
@@ -12441,7 +12440,7 @@ discard block |
||
12441 | 12440 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
12442 | 12441 | return \defined('MB_OVERLOAD_STRING') |
12443 | 12442 | && |
12444 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12443 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12445 | 12444 | } |
12446 | 12445 | |
12447 | 12446 | /** |
@@ -12491,7 +12490,7 @@ discard block |
||
12491 | 12490 | { |
12492 | 12491 | static $RX_CLASS_CACHE = []; |
12493 | 12492 | |
12494 | - $cacheKey = $s . $class; |
|
12493 | + $cacheKey = $s.$class; |
|
12495 | 12494 | |
12496 | 12495 | if (isset($RX_CLASS_CACHE[$cacheKey])) { |
12497 | 12496 | return $RX_CLASS_CACHE[$cacheKey]; |
@@ -12503,7 +12502,7 @@ discard block |
||
12503 | 12502 | /** @noinspection AlterInForeachInspection */ |
12504 | 12503 | foreach (self::str_split($s) as &$s) { |
12505 | 12504 | if ($s === '-') { |
12506 | - $classArray[0] = '-' . $classArray[0]; |
|
12505 | + $classArray[0] = '-'.$classArray[0]; |
|
12507 | 12506 | } elseif (!isset($s[2])) { |
12508 | 12507 | $classArray[0] .= \preg_quote($s, '/'); |
12509 | 12508 | } elseif (self::strlen($s) === 1) { |
@@ -12514,13 +12513,13 @@ discard block |
||
12514 | 12513 | } |
12515 | 12514 | |
12516 | 12515 | if ($classArray[0]) { |
12517 | - $classArray[0] = '[' . $classArray[0] . ']'; |
|
12516 | + $classArray[0] = '['.$classArray[0].']'; |
|
12518 | 12517 | } |
12519 | 12518 | |
12520 | 12519 | if (\count($classArray) === 1) { |
12521 | 12520 | $return = $classArray[0]; |
12522 | 12521 | } else { |
12523 | - $return = '(?:' . \implode('|', $classArray) . ')'; |
|
12522 | + $return = '(?:'.\implode('|', $classArray).')'; |
|
12524 | 12523 | } |
12525 | 12524 | |
12526 | 12525 | $RX_CLASS_CACHE[$cacheKey] = $return; |
@@ -12595,7 +12594,7 @@ discard block |
||
12595 | 12594 | |
12596 | 12595 | if ($delimiter === '-') { |
12597 | 12596 | /** @noinspection AlterInForeachInspection */ |
12598 | - foreach ((array) $specialCases['names'] as &$beginning) { |
|
12597 | + foreach ((array)$specialCases['names'] as &$beginning) { |
|
12599 | 12598 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12600 | 12599 | $continue = true; |
12601 | 12600 | } |
@@ -12603,7 +12602,7 @@ discard block |
||
12603 | 12602 | } |
12604 | 12603 | |
12605 | 12604 | /** @noinspection AlterInForeachInspection */ |
12606 | - foreach ((array) $specialCases['prefixes'] as &$beginning) { |
|
12605 | + foreach ((array)$specialCases['prefixes'] as &$beginning) { |
|
12607 | 12606 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12608 | 12607 | $continue = true; |
12609 | 12608 | } |
@@ -12663,8 +12662,8 @@ discard block |
||
12663 | 12662 | } else { |
12664 | 12663 | /** @noinspection OffsetOperationsInspection */ |
12665 | 12664 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
12666 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
12667 | - $buf .= $cc1 . $cc2; |
|
12665 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
12666 | + $buf .= $cc1.$cc2; |
|
12668 | 12667 | } |
12669 | 12668 | |
12670 | 12669 | return $buf; |
@@ -12679,7 +12678,7 @@ discard block |
||
12679 | 12678 | { |
12680 | 12679 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
12681 | 12680 | if (\preg_match($pattern, $str)) { |
12682 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
12681 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
12683 | 12682 | } |
12684 | 12683 | |
12685 | 12684 | return $str; |