@@ -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 | /** |
@@ -4562,11 +4562,11 @@ discard block |
||
4562 | 4562 | |
4563 | 4563 | if ($step !== 1) { |
4564 | 4564 | if (!\is_numeric($step)) { |
4565 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
4565 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
4566 | 4566 | } |
4567 | 4567 | |
4568 | 4568 | if ($step <= 0) { |
4569 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
4569 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
4570 | 4570 | } |
4571 | 4571 | } |
4572 | 4572 | |
@@ -4578,14 +4578,14 @@ discard block |
||
4578 | 4578 | $is_xdigit = false; |
4579 | 4579 | |
4580 | 4580 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4581 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
4581 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
4582 | 4582 | $is_digit = true; |
4583 | - $start = (int) $var1; |
|
4583 | + $start = (int)$var1; |
|
4584 | 4584 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
4585 | 4585 | $is_xdigit = true; |
4586 | - $start = (int) self::hex_to_int($var1); |
|
4586 | + $start = (int)self::hex_to_int($var1); |
|
4587 | 4587 | } elseif (!$use_ctype && \is_numeric($var1)) { |
4588 | - $start = (int) $var1; |
|
4588 | + $start = (int)$var1; |
|
4589 | 4589 | } else { |
4590 | 4590 | $start = self::ord($var1); |
4591 | 4591 | } |
@@ -4595,11 +4595,11 @@ discard block |
||
4595 | 4595 | } |
4596 | 4596 | |
4597 | 4597 | if ($is_digit) { |
4598 | - $end = (int) $var2; |
|
4598 | + $end = (int)$var2; |
|
4599 | 4599 | } elseif ($is_xdigit) { |
4600 | - $end = (int) self::hex_to_int($var2); |
|
4600 | + $end = (int)self::hex_to_int($var2); |
|
4601 | 4601 | } elseif (!$use_ctype && \is_numeric($var2)) { |
4602 | - $end = (int) $var2; |
|
4602 | + $end = (int)$var2; |
|
4603 | 4603 | } else { |
4604 | 4604 | $end = self::ord($var2); |
4605 | 4605 | } |
@@ -4610,7 +4610,7 @@ discard block |
||
4610 | 4610 | |
4611 | 4611 | $array = []; |
4612 | 4612 | foreach (\range($start, $end, $step) as $i) { |
4613 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
4613 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
4614 | 4614 | } |
4615 | 4615 | |
4616 | 4616 | return $array; |
@@ -4701,8 +4701,8 @@ discard block |
||
4701 | 4701 | $delimiter = '/'; |
4702 | 4702 | } |
4703 | 4703 | |
4704 | - return (string) \preg_replace( |
|
4705 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4704 | + return (string)\preg_replace( |
|
4705 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4706 | 4706 | $replacement, |
4707 | 4707 | $str |
4708 | 4708 | ); |
@@ -4744,9 +4744,9 @@ discard block |
||
4744 | 4744 | return ''; |
4745 | 4745 | } |
4746 | 4746 | |
4747 | - $strLength -= (int) $bomByteLength; |
|
4747 | + $strLength -= (int)$bomByteLength; |
|
4748 | 4748 | |
4749 | - $str = (string) $strTmp; |
|
4749 | + $str = (string)$strTmp; |
|
4750 | 4750 | } |
4751 | 4751 | } |
4752 | 4752 | |
@@ -4770,7 +4770,7 @@ discard block |
||
4770 | 4770 | if (\is_array($what) === true) { |
4771 | 4771 | /** @noinspection ForeachSourceInspection */ |
4772 | 4772 | foreach ($what as $item) { |
4773 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/u') . ')+/u', $item, $str); |
|
4773 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/u').')+/u', $item, $str); |
|
4774 | 4774 | } |
4775 | 4775 | } |
4776 | 4776 | |
@@ -4802,7 +4802,7 @@ discard block |
||
4802 | 4802 | */ |
4803 | 4803 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
4804 | 4804 | { |
4805 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4805 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4806 | 4806 | } |
4807 | 4807 | |
4808 | 4808 | /** |
@@ -4833,7 +4833,7 @@ discard block |
||
4833 | 4833 | $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
4834 | 4834 | |
4835 | 4835 | do { |
4836 | - $str = (string) \preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4836 | + $str = (string)\preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4837 | 4837 | } while ($count !== 0); |
4838 | 4838 | |
4839 | 4839 | return $str; |
@@ -4852,17 +4852,17 @@ discard block |
||
4852 | 4852 | { |
4853 | 4853 | if ($substring && \strpos($str, $substring) === 0) { |
4854 | 4854 | if ($encoding === 'UTF-8') { |
4855 | - return (string) \mb_substr( |
|
4855 | + return (string)\mb_substr( |
|
4856 | 4856 | $str, |
4857 | - (int) \mb_strlen($substring) |
|
4857 | + (int)\mb_strlen($substring) |
|
4858 | 4858 | ); |
4859 | 4859 | } |
4860 | 4860 | |
4861 | 4861 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4862 | 4862 | |
4863 | - return (string) self::substr( |
|
4863 | + return (string)self::substr( |
|
4864 | 4864 | $str, |
4865 | - (int) self::strlen($substring, $encoding), |
|
4865 | + (int)self::strlen($substring, $encoding), |
|
4866 | 4866 | null, |
4867 | 4867 | $encoding |
4868 | 4868 | ); |
@@ -4884,19 +4884,19 @@ discard block |
||
4884 | 4884 | { |
4885 | 4885 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
4886 | 4886 | if ($encoding === 'UTF-8') { |
4887 | - return (string) \mb_substr( |
|
4887 | + return (string)\mb_substr( |
|
4888 | 4888 | $str, |
4889 | 4889 | 0, |
4890 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
4890 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
4891 | 4891 | ); |
4892 | 4892 | } |
4893 | 4893 | |
4894 | 4894 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4895 | 4895 | |
4896 | - return (string) self::substr( |
|
4896 | + return (string)self::substr( |
|
4897 | 4897 | $str, |
4898 | 4898 | 0, |
4899 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
4899 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
4900 | 4900 | $encoding |
4901 | 4901 | ); |
4902 | 4902 | } |
@@ -4980,7 +4980,7 @@ discard block |
||
4980 | 4980 | $save = \mb_substitute_character(); |
4981 | 4981 | \mb_substitute_character($replacementCharHelper); |
4982 | 4982 | // the polyfill maybe return false, so cast to string |
4983 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4983 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4984 | 4984 | \mb_substitute_character($save); |
4985 | 4985 | } |
4986 | 4986 | |
@@ -5020,7 +5020,7 @@ discard block |
||
5020 | 5020 | |
5021 | 5021 | if (self::$SUPPORT['mbstring'] === true) { |
5022 | 5022 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5023 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
5023 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
5024 | 5024 | } |
5025 | 5025 | |
5026 | 5026 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -5035,7 +5035,7 @@ discard block |
||
5035 | 5035 | { |
5036 | 5036 | echo '<pre>'; |
5037 | 5037 | foreach (self::$SUPPORT as $key => &$value) { |
5038 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
5038 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
5039 | 5039 | } |
5040 | 5040 | unset($value); |
5041 | 5041 | echo '</pre>'; |
@@ -5064,7 +5064,7 @@ discard block |
||
5064 | 5064 | return $char; |
5065 | 5065 | } |
5066 | 5066 | |
5067 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
5067 | + return '&#'.self::ord($char, $encoding).';'; |
|
5068 | 5068 | } |
5069 | 5069 | |
5070 | 5070 | /** |
@@ -5155,18 +5155,18 @@ discard block |
||
5155 | 5155 | $lang, |
5156 | 5156 | $tryToKeepStringLength |
5157 | 5157 | ); |
5158 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5158 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5159 | 5159 | |
5160 | 5160 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5161 | 5161 | |
5162 | - $str = (string) \preg_replace_callback( |
|
5162 | + $str = (string)\preg_replace_callback( |
|
5163 | 5163 | '/[-_\\s]+(.)?/u', |
5164 | 5164 | /** |
5165 | 5165 | * @param array $match |
5166 | 5166 | * |
5167 | 5167 | * @return string |
5168 | 5168 | */ |
5169 | - static function (array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5169 | + static function(array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5170 | 5170 | if (isset($match[1])) { |
5171 | 5171 | if ($useMbFunction === true) { |
5172 | 5172 | if ($encoding === 'UTF-8') { |
@@ -5184,14 +5184,14 @@ discard block |
||
5184 | 5184 | $str |
5185 | 5185 | ); |
5186 | 5186 | |
5187 | - return (string) \preg_replace_callback( |
|
5187 | + return (string)\preg_replace_callback( |
|
5188 | 5188 | '/[\\p{N}]+(.)?/u', |
5189 | 5189 | /** |
5190 | 5190 | * @param array $match |
5191 | 5191 | * |
5192 | 5192 | * @return string |
5193 | 5193 | */ |
5194 | - static function (array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5194 | + static function(array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5195 | 5195 | if ($useMbFunction === true) { |
5196 | 5196 | if ($encoding === 'UTF-8') { |
5197 | 5197 | return \mb_strtoupper($match[0]); |
@@ -5369,7 +5369,7 @@ discard block |
||
5369 | 5369 | ): string { |
5370 | 5370 | if (self::$SUPPORT['mbstring'] === true) { |
5371 | 5371 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5372 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5372 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5373 | 5373 | |
5374 | 5374 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5375 | 5375 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5379,10 +5379,10 @@ discard block |
||
5379 | 5379 | } |
5380 | 5380 | |
5381 | 5381 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5382 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5382 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5383 | 5383 | } |
5384 | 5384 | |
5385 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5385 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5386 | 5386 | |
5387 | 5387 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5388 | 5388 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5391,7 +5391,7 @@ discard block |
||
5391 | 5391 | $str = self::strtolower($str, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
5392 | 5392 | } |
5393 | 5393 | |
5394 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5394 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5395 | 5395 | } |
5396 | 5396 | |
5397 | 5397 | /** |
@@ -5406,7 +5406,7 @@ discard block |
||
5406 | 5406 | public static function str_detect_encoding($str) |
5407 | 5407 | { |
5408 | 5408 | // init |
5409 | - $str = (string) $str; |
|
5409 | + $str = (string)$str; |
|
5410 | 5410 | |
5411 | 5411 | // |
5412 | 5412 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5508,7 +5508,7 @@ discard block |
||
5508 | 5508 | foreach (self::$ENCODINGS as $encodingTmp) { |
5509 | 5509 | // INFO: //IGNORE but still throw notice |
5510 | 5510 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5511 | - if ((string) @\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str) === $str) { |
|
5511 | + if ((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str) === $str) { |
|
5512 | 5512 | return $encodingTmp; |
5513 | 5513 | } |
5514 | 5514 | } |
@@ -5596,7 +5596,7 @@ discard block |
||
5596 | 5596 | return $str; |
5597 | 5597 | } |
5598 | 5598 | |
5599 | - return $substring . $str; |
|
5599 | + return $substring.$str; |
|
5600 | 5600 | } |
5601 | 5601 | |
5602 | 5602 | /** |
@@ -5850,27 +5850,27 @@ discard block |
||
5850 | 5850 | string $encoding = 'UTF-8' |
5851 | 5851 | ): string { |
5852 | 5852 | if ($encoding === 'UTF-8') { |
5853 | - $len = (int) \mb_strlen($str); |
|
5853 | + $len = (int)\mb_strlen($str); |
|
5854 | 5854 | if ($index > $len) { |
5855 | 5855 | return $str; |
5856 | 5856 | } |
5857 | 5857 | |
5858 | 5858 | /** @noinspection UnnecessaryCastingInspection */ |
5859 | - return (string) \mb_substr($str, 0, $index) . |
|
5860 | - $substring . |
|
5861 | - (string) \mb_substr($str, $index, $len); |
|
5859 | + return (string)\mb_substr($str, 0, $index). |
|
5860 | + $substring. |
|
5861 | + (string)\mb_substr($str, $index, $len); |
|
5862 | 5862 | } |
5863 | 5863 | |
5864 | 5864 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5865 | 5865 | |
5866 | - $len = (int) self::strlen($str, $encoding); |
|
5866 | + $len = (int)self::strlen($str, $encoding); |
|
5867 | 5867 | if ($index > $len) { |
5868 | 5868 | return $str; |
5869 | 5869 | } |
5870 | 5870 | |
5871 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
5872 | - $substring . |
|
5873 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5871 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
5872 | + $substring. |
|
5873 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
5874 | 5874 | } |
5875 | 5875 | |
5876 | 5876 | /** |
@@ -5900,15 +5900,15 @@ discard block |
||
5900 | 5900 | */ |
5901 | 5901 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5902 | 5902 | { |
5903 | - $search = (array) $search; |
|
5903 | + $search = (array)$search; |
|
5904 | 5904 | |
5905 | 5905 | /** @noinspection AlterInForeachInspection */ |
5906 | 5906 | foreach ($search as &$s) { |
5907 | - $s = (string) $s; |
|
5907 | + $s = (string)$s; |
|
5908 | 5908 | if ($s === '') { |
5909 | 5909 | $s = '/^(?<=.)$/'; |
5910 | 5910 | } else { |
5911 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5911 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5912 | 5912 | } |
5913 | 5913 | } |
5914 | 5914 | |
@@ -5940,11 +5940,11 @@ discard block |
||
5940 | 5940 | } |
5941 | 5941 | |
5942 | 5942 | if ($search === '') { |
5943 | - return $str . $replacement; |
|
5943 | + return $str.$replacement; |
|
5944 | 5944 | } |
5945 | 5945 | |
5946 | 5946 | if (\stripos($str, $search) === 0) { |
5947 | - return $replacement . \substr($str, \strlen($search)); |
|
5947 | + return $replacement.\substr($str, \strlen($search)); |
|
5948 | 5948 | } |
5949 | 5949 | |
5950 | 5950 | return $str; |
@@ -5972,11 +5972,11 @@ discard block |
||
5972 | 5972 | } |
5973 | 5973 | |
5974 | 5974 | if ($search === '') { |
5975 | - return $str . $replacement; |
|
5975 | + return $str.$replacement; |
|
5976 | 5976 | } |
5977 | 5977 | |
5978 | 5978 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
5979 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
5979 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
5980 | 5980 | } |
5981 | 5981 | |
5982 | 5982 | return $str; |
@@ -6053,15 +6053,15 @@ discard block |
||
6053 | 6053 | } |
6054 | 6054 | |
6055 | 6055 | if ($encoding === 'UTF-8') { |
6056 | - return (string) \mb_substr( |
|
6056 | + return (string)\mb_substr( |
|
6057 | 6057 | $str, |
6058 | - $offset + (int) \mb_strlen($separator) |
|
6058 | + $offset + (int)\mb_strlen($separator) |
|
6059 | 6059 | ); |
6060 | 6060 | } |
6061 | 6061 | |
6062 | - return (string) self::substr( |
|
6062 | + return (string)self::substr( |
|
6063 | 6063 | $str, |
6064 | - $offset + (int) self::strlen($separator, $encoding), |
|
6064 | + $offset + (int)self::strlen($separator, $encoding), |
|
6065 | 6065 | null, |
6066 | 6066 | $encoding |
6067 | 6067 | ); |
@@ -6088,15 +6088,15 @@ discard block |
||
6088 | 6088 | } |
6089 | 6089 | |
6090 | 6090 | if ($encoding === 'UTF-8') { |
6091 | - return (string) \mb_substr( |
|
6091 | + return (string)\mb_substr( |
|
6092 | 6092 | $str, |
6093 | - $offset + (int) self::strlen($separator) |
|
6093 | + $offset + (int)self::strlen($separator) |
|
6094 | 6094 | ); |
6095 | 6095 | } |
6096 | 6096 | |
6097 | - return (string) self::substr( |
|
6097 | + return (string)self::substr( |
|
6098 | 6098 | $str, |
6099 | - $offset + (int) self::strlen($separator, $encoding), |
|
6099 | + $offset + (int)self::strlen($separator, $encoding), |
|
6100 | 6100 | null, |
6101 | 6101 | $encoding |
6102 | 6102 | ); |
@@ -6123,10 +6123,10 @@ discard block |
||
6123 | 6123 | } |
6124 | 6124 | |
6125 | 6125 | if ($encoding === 'UTF-8') { |
6126 | - return (string) \mb_substr($str, 0, $offset); |
|
6126 | + return (string)\mb_substr($str, 0, $offset); |
|
6127 | 6127 | } |
6128 | 6128 | |
6129 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6129 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6130 | 6130 | } |
6131 | 6131 | |
6132 | 6132 | /** |
@@ -6150,7 +6150,7 @@ discard block |
||
6150 | 6150 | return ''; |
6151 | 6151 | } |
6152 | 6152 | |
6153 | - return (string) \mb_substr($str, 0, $offset); |
|
6153 | + return (string)\mb_substr($str, 0, $offset); |
|
6154 | 6154 | } |
6155 | 6155 | |
6156 | 6156 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6158,7 +6158,7 @@ discard block |
||
6158 | 6158 | return ''; |
6159 | 6159 | } |
6160 | 6160 | |
6161 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6161 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6162 | 6162 | } |
6163 | 6163 | |
6164 | 6164 | /** |
@@ -6246,12 +6246,12 @@ discard block |
||
6246 | 6246 | } |
6247 | 6247 | |
6248 | 6248 | if ($encoding === 'UTF-8') { |
6249 | - return (string) \mb_substr($str, -$n); |
|
6249 | + return (string)\mb_substr($str, -$n); |
|
6250 | 6250 | } |
6251 | 6251 | |
6252 | 6252 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6253 | 6253 | |
6254 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6254 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6255 | 6255 | } |
6256 | 6256 | |
6257 | 6257 | /** |
@@ -6275,21 +6275,21 @@ discard block |
||
6275 | 6275 | } |
6276 | 6276 | |
6277 | 6277 | if ($encoding === 'UTF-8') { |
6278 | - if ((int) \mb_strlen($str) <= $length) { |
|
6278 | + if ((int)\mb_strlen($str) <= $length) { |
|
6279 | 6279 | return $str; |
6280 | 6280 | } |
6281 | 6281 | |
6282 | 6282 | /** @noinspection UnnecessaryCastingInspection */ |
6283 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($strAddOn)) . $strAddOn; |
|
6283 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($strAddOn)).$strAddOn; |
|
6284 | 6284 | } |
6285 | 6285 | |
6286 | 6286 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6287 | 6287 | |
6288 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6288 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6289 | 6289 | return $str; |
6290 | 6290 | } |
6291 | 6291 | |
6292 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($strAddOn), $encoding)) . $strAddOn; |
|
6292 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($strAddOn), $encoding)).$strAddOn; |
|
6293 | 6293 | } |
6294 | 6294 | |
6295 | 6295 | /** |
@@ -6314,12 +6314,12 @@ discard block |
||
6314 | 6314 | |
6315 | 6315 | if ($encoding === 'UTF-8') { |
6316 | 6316 | /** @noinspection UnnecessaryCastingInspection */ |
6317 | - if ((int) \mb_strlen($str) <= $length) { |
|
6317 | + if ((int)\mb_strlen($str) <= $length) { |
|
6318 | 6318 | return $str; |
6319 | 6319 | } |
6320 | 6320 | |
6321 | 6321 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6322 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6322 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6323 | 6323 | } |
6324 | 6324 | |
6325 | 6325 | $str = \mb_substr($str, 0, $length); |
@@ -6329,20 +6329,20 @@ discard block |
||
6329 | 6329 | $new_str = \implode(' ', $array); |
6330 | 6330 | |
6331 | 6331 | if ($new_str === '') { |
6332 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6332 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6333 | 6333 | } |
6334 | 6334 | } else { |
6335 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6335 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6336 | 6336 | return $str; |
6337 | 6337 | } |
6338 | 6338 | |
6339 | 6339 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6340 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6340 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6341 | 6341 | } |
6342 | 6342 | |
6343 | 6343 | $str = self::substr($str, 0, $length, $encoding); |
6344 | 6344 | if ($str === false) { |
6345 | - return '' . $strAddOn; |
|
6345 | + return ''.$strAddOn; |
|
6346 | 6346 | } |
6347 | 6347 | |
6348 | 6348 | $array = \explode(' ', $str); |
@@ -6350,11 +6350,11 @@ discard block |
||
6350 | 6350 | $new_str = \implode(' ', $array); |
6351 | 6351 | |
6352 | 6352 | if ($new_str === '') { |
6353 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6353 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6354 | 6354 | } |
6355 | 6355 | } |
6356 | 6356 | |
6357 | - return $new_str . $strAddOn; |
|
6357 | + return $new_str.$strAddOn; |
|
6358 | 6358 | } |
6359 | 6359 | |
6360 | 6360 | /** |
@@ -6372,7 +6372,7 @@ discard block |
||
6372 | 6372 | $longestCommonPrefix = ''; |
6373 | 6373 | |
6374 | 6374 | if ($encoding === 'UTF-8') { |
6375 | - $maxLength = (int) \min( |
|
6375 | + $maxLength = (int)\min( |
|
6376 | 6376 | \mb_strlen($str), |
6377 | 6377 | \mb_strlen($otherStr) |
6378 | 6378 | ); |
@@ -6393,7 +6393,7 @@ discard block |
||
6393 | 6393 | } else { |
6394 | 6394 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6395 | 6395 | |
6396 | - $maxLength = (int) \min( |
|
6396 | + $maxLength = (int)\min( |
|
6397 | 6397 | self::strlen($str, $encoding), |
6398 | 6398 | self::strlen($otherStr, $encoding) |
6399 | 6399 | ); |
@@ -6436,13 +6436,13 @@ discard block |
||
6436 | 6436 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6437 | 6437 | |
6438 | 6438 | if ($encoding === 'UTF-8') { |
6439 | - $strLength = (int) \mb_strlen($str); |
|
6440 | - $otherLength = (int) \mb_strlen($otherStr); |
|
6439 | + $strLength = (int)\mb_strlen($str); |
|
6440 | + $otherLength = (int)\mb_strlen($otherStr); |
|
6441 | 6441 | } else { |
6442 | 6442 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6443 | 6443 | |
6444 | - $strLength = (int) self::strlen($str, $encoding); |
|
6445 | - $otherLength = (int) self::strlen($otherStr, $encoding); |
|
6444 | + $strLength = (int)self::strlen($str, $encoding); |
|
6445 | + $otherLength = (int)self::strlen($otherStr, $encoding); |
|
6446 | 6446 | } |
6447 | 6447 | |
6448 | 6448 | // Return if either string is empty |
@@ -6495,10 +6495,10 @@ discard block |
||
6495 | 6495 | } |
6496 | 6496 | |
6497 | 6497 | if ($encoding === 'UTF-8') { |
6498 | - return (string) \mb_substr($str, $end - $len, $len); |
|
6498 | + return (string)\mb_substr($str, $end - $len, $len); |
|
6499 | 6499 | } |
6500 | 6500 | |
6501 | - return (string) self::substr($str, $end - $len, $len, $encoding); |
|
6501 | + return (string)self::substr($str, $end - $len, $len, $encoding); |
|
6502 | 6502 | } |
6503 | 6503 | |
6504 | 6504 | /** |
@@ -6517,7 +6517,7 @@ discard block |
||
6517 | 6517 | } |
6518 | 6518 | |
6519 | 6519 | if ($encoding === 'UTF-8') { |
6520 | - $maxLength = (int) \min( |
|
6520 | + $maxLength = (int)\min( |
|
6521 | 6521 | \mb_strlen($str, $encoding), |
6522 | 6522 | \mb_strlen($otherStr, $encoding) |
6523 | 6523 | ); |
@@ -6531,7 +6531,7 @@ discard block |
||
6531 | 6531 | && |
6532 | 6532 | $char === \mb_substr($otherStr, -$i, 1) |
6533 | 6533 | ) { |
6534 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6534 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6535 | 6535 | } else { |
6536 | 6536 | break; |
6537 | 6537 | } |
@@ -6539,7 +6539,7 @@ discard block |
||
6539 | 6539 | } else { |
6540 | 6540 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6541 | 6541 | |
6542 | - $maxLength = (int) \min( |
|
6542 | + $maxLength = (int)\min( |
|
6543 | 6543 | self::strlen($str, $encoding), |
6544 | 6544 | self::strlen($otherStr, $encoding) |
6545 | 6545 | ); |
@@ -6553,7 +6553,7 @@ discard block |
||
6553 | 6553 | && |
6554 | 6554 | $char === self::substr($otherStr, -$i, 1, $encoding) |
6555 | 6555 | ) { |
6556 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6556 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6557 | 6557 | } else { |
6558 | 6558 | break; |
6559 | 6559 | } |
@@ -6573,7 +6573,7 @@ discard block |
||
6573 | 6573 | */ |
6574 | 6574 | public static function str_matches_pattern(string $str, string $pattern): bool |
6575 | 6575 | { |
6576 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6576 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6577 | 6577 | } |
6578 | 6578 | |
6579 | 6579 | /** |
@@ -6590,7 +6590,7 @@ discard block |
||
6590 | 6590 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6591 | 6591 | { |
6592 | 6592 | // init |
6593 | - $length = (int) self::strlen($str, $encoding); |
|
6593 | + $length = (int)self::strlen($str, $encoding); |
|
6594 | 6594 | |
6595 | 6595 | if ($offset >= 0) { |
6596 | 6596 | return $length > $offset; |
@@ -6616,7 +6616,7 @@ discard block |
||
6616 | 6616 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6617 | 6617 | { |
6618 | 6618 | // init |
6619 | - $length = (int) self::strlen($str); |
|
6619 | + $length = (int)self::strlen($str); |
|
6620 | 6620 | |
6621 | 6621 | if ( |
6622 | 6622 | ($index >= 0 && $length <= $index) |
@@ -6655,7 +6655,7 @@ discard block |
||
6655 | 6655 | return $str; |
6656 | 6656 | } |
6657 | 6657 | |
6658 | - if ($pad_type !== (int) $pad_type) { |
|
6658 | + if ($pad_type !== (int)$pad_type) { |
|
6659 | 6659 | if ($pad_type === 'left') { |
6660 | 6660 | $pad_type = \STR_PAD_LEFT; |
6661 | 6661 | } elseif ($pad_type === 'right') { |
@@ -6664,23 +6664,23 @@ discard block |
||
6664 | 6664 | $pad_type = \STR_PAD_BOTH; |
6665 | 6665 | } else { |
6666 | 6666 | throw new \InvalidArgumentException( |
6667 | - 'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6667 | + 'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6668 | 6668 | ); |
6669 | 6669 | } |
6670 | 6670 | } |
6671 | 6671 | |
6672 | 6672 | if ($encoding === 'UTF-8') { |
6673 | - $str_length = (int) \mb_strlen($str); |
|
6673 | + $str_length = (int)\mb_strlen($str); |
|
6674 | 6674 | |
6675 | 6675 | if ($pad_length >= $str_length) { |
6676 | 6676 | switch ($pad_type) { |
6677 | 6677 | case \STR_PAD_LEFT: |
6678 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6678 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6679 | 6679 | |
6680 | 6680 | $diff = ($pad_length - $str_length); |
6681 | 6681 | |
6682 | - $pre = (string) \mb_substr( |
|
6683 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6682 | + $pre = (string)\mb_substr( |
|
6683 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6684 | 6684 | 0, |
6685 | 6685 | $diff |
6686 | 6686 | ); |
@@ -6691,16 +6691,16 @@ discard block |
||
6691 | 6691 | case \STR_PAD_BOTH: |
6692 | 6692 | $diff = ($pad_length - $str_length); |
6693 | 6693 | |
6694 | - $ps_length_left = (int) \floor($diff / 2); |
|
6694 | + $ps_length_left = (int)\floor($diff / 2); |
|
6695 | 6695 | |
6696 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6696 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6697 | 6697 | |
6698 | - $pre = (string) \mb_substr( |
|
6698 | + $pre = (string)\mb_substr( |
|
6699 | 6699 | \str_repeat($pad_string, $ps_length_left), |
6700 | 6700 | 0, |
6701 | 6701 | $ps_length_left |
6702 | 6702 | ); |
6703 | - $post = (string) \mb_substr( |
|
6703 | + $post = (string)\mb_substr( |
|
6704 | 6704 | \str_repeat($pad_string, $ps_length_right), |
6705 | 6705 | 0, |
6706 | 6706 | $ps_length_right |
@@ -6710,19 +6710,19 @@ discard block |
||
6710 | 6710 | |
6711 | 6711 | case \STR_PAD_RIGHT: |
6712 | 6712 | default: |
6713 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6713 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6714 | 6714 | |
6715 | 6715 | $diff = ($pad_length - $str_length); |
6716 | 6716 | |
6717 | - $post = (string) \mb_substr( |
|
6718 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6717 | + $post = (string)\mb_substr( |
|
6718 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6719 | 6719 | 0, |
6720 | 6720 | $diff |
6721 | 6721 | ); |
6722 | 6722 | $pre = ''; |
6723 | 6723 | } |
6724 | 6724 | |
6725 | - return $pre . $str . $post; |
|
6725 | + return $pre.$str.$post; |
|
6726 | 6726 | } |
6727 | 6727 | |
6728 | 6728 | return $str; |
@@ -6730,17 +6730,17 @@ discard block |
||
6730 | 6730 | |
6731 | 6731 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6732 | 6732 | |
6733 | - $str_length = (int) self::strlen($str, $encoding); |
|
6733 | + $str_length = (int)self::strlen($str, $encoding); |
|
6734 | 6734 | |
6735 | 6735 | if ($pad_length >= $str_length) { |
6736 | 6736 | switch ($pad_type) { |
6737 | 6737 | case \STR_PAD_LEFT: |
6738 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6738 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6739 | 6739 | |
6740 | 6740 | $diff = ($pad_length - $str_length); |
6741 | 6741 | |
6742 | - $pre = (string) self::substr( |
|
6743 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6742 | + $pre = (string)self::substr( |
|
6743 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6744 | 6744 | 0, |
6745 | 6745 | $diff, |
6746 | 6746 | $encoding |
@@ -6752,17 +6752,17 @@ discard block |
||
6752 | 6752 | case \STR_PAD_BOTH: |
6753 | 6753 | $diff = ($pad_length - $str_length); |
6754 | 6754 | |
6755 | - $ps_length_left = (int) \floor($diff / 2); |
|
6755 | + $ps_length_left = (int)\floor($diff / 2); |
|
6756 | 6756 | |
6757 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6757 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6758 | 6758 | |
6759 | - $pre = (string) self::substr( |
|
6759 | + $pre = (string)self::substr( |
|
6760 | 6760 | \str_repeat($pad_string, $ps_length_left), |
6761 | 6761 | 0, |
6762 | 6762 | $ps_length_left, |
6763 | 6763 | $encoding |
6764 | 6764 | ); |
6765 | - $post = (string) self::substr( |
|
6765 | + $post = (string)self::substr( |
|
6766 | 6766 | \str_repeat($pad_string, $ps_length_right), |
6767 | 6767 | 0, |
6768 | 6768 | $ps_length_right, |
@@ -6773,12 +6773,12 @@ discard block |
||
6773 | 6773 | |
6774 | 6774 | case \STR_PAD_RIGHT: |
6775 | 6775 | default: |
6776 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6776 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6777 | 6777 | |
6778 | 6778 | $diff = ($pad_length - $str_length); |
6779 | 6779 | |
6780 | - $post = (string) self::substr( |
|
6781 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6780 | + $post = (string)self::substr( |
|
6781 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6782 | 6782 | 0, |
6783 | 6783 | $diff, |
6784 | 6784 | $encoding |
@@ -6786,7 +6786,7 @@ discard block |
||
6786 | 6786 | $pre = ''; |
6787 | 6787 | } |
6788 | 6788 | |
6789 | - return $pre . $str . $post; |
|
6789 | + return $pre.$str.$post; |
|
6790 | 6790 | } |
6791 | 6791 | |
6792 | 6792 | return $str; |
@@ -6945,11 +6945,11 @@ discard block |
||
6945 | 6945 | } |
6946 | 6946 | |
6947 | 6947 | if ($search === '') { |
6948 | - return $str . $replacement; |
|
6948 | + return $str.$replacement; |
|
6949 | 6949 | } |
6950 | 6950 | |
6951 | 6951 | if (\strpos($str, $search) === 0) { |
6952 | - return $replacement . \substr($str, \strlen($search)); |
|
6952 | + return $replacement.\substr($str, \strlen($search)); |
|
6953 | 6953 | } |
6954 | 6954 | |
6955 | 6955 | return $str; |
@@ -6977,11 +6977,11 @@ discard block |
||
6977 | 6977 | } |
6978 | 6978 | |
6979 | 6979 | if ($search === '') { |
6980 | - return $str . $replacement; |
|
6980 | + return $str.$replacement; |
|
6981 | 6981 | } |
6982 | 6982 | |
6983 | 6983 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6984 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6984 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6985 | 6985 | } |
6986 | 6986 | |
6987 | 6987 | return $str; |
@@ -7010,7 +7010,7 @@ discard block |
||
7010 | 7010 | $subject, |
7011 | 7011 | $replace, |
7012 | 7012 | $pos, |
7013 | - (int) self::strlen($search) |
|
7013 | + (int)self::strlen($search) |
|
7014 | 7014 | ); |
7015 | 7015 | } |
7016 | 7016 | |
@@ -7042,7 +7042,7 @@ discard block |
||
7042 | 7042 | $subject, |
7043 | 7043 | $replace, |
7044 | 7044 | $pos, |
7045 | - (int) self::strlen($search) |
|
7045 | + (int)self::strlen($search) |
|
7046 | 7046 | ); |
7047 | 7047 | } |
7048 | 7048 | |
@@ -7062,7 +7062,7 @@ discard block |
||
7062 | 7062 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
7063 | 7063 | { |
7064 | 7064 | if ($encoding === 'UTF-8') { |
7065 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
7065 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
7066 | 7066 | /** @noinspection NonSecureShuffleUsageInspection */ |
7067 | 7067 | \shuffle($indexes); |
7068 | 7068 | |
@@ -7078,7 +7078,7 @@ discard block |
||
7078 | 7078 | } else { |
7079 | 7079 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7080 | 7080 | |
7081 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
7081 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
7082 | 7082 | /** @noinspection NonSecureShuffleUsageInspection */ |
7083 | 7083 | \shuffle($indexes); |
7084 | 7084 | |
@@ -7119,11 +7119,11 @@ discard block |
||
7119 | 7119 | ) { |
7120 | 7120 | if ($encoding === 'UTF-8') { |
7121 | 7121 | if ($end === null) { |
7122 | - $length = (int) \mb_strlen($str); |
|
7122 | + $length = (int)\mb_strlen($str); |
|
7123 | 7123 | } elseif ($end >= 0 && $end <= $start) { |
7124 | 7124 | return ''; |
7125 | 7125 | } elseif ($end < 0) { |
7126 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7126 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7127 | 7127 | } else { |
7128 | 7128 | $length = $end - $start; |
7129 | 7129 | } |
@@ -7134,11 +7134,11 @@ discard block |
||
7134 | 7134 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7135 | 7135 | |
7136 | 7136 | if ($end === null) { |
7137 | - $length = (int) self::strlen($str, $encoding); |
|
7137 | + $length = (int)self::strlen($str, $encoding); |
|
7138 | 7138 | } elseif ($end >= 0 && $end <= $start) { |
7139 | 7139 | return ''; |
7140 | 7140 | } elseif ($end < 0) { |
7141 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7141 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7142 | 7142 | } else { |
7143 | 7143 | $length = $end - $start; |
7144 | 7144 | } |
@@ -7170,35 +7170,35 @@ discard block |
||
7170 | 7170 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7171 | 7171 | } |
7172 | 7172 | |
7173 | - $str = (string) \preg_replace_callback( |
|
7173 | + $str = (string)\preg_replace_callback( |
|
7174 | 7174 | '/([\\p{N}|\\p{Lu}])/u', |
7175 | 7175 | /** |
7176 | 7176 | * @param string[] $matches |
7177 | 7177 | * |
7178 | 7178 | * @return string |
7179 | 7179 | */ |
7180 | - static function (array $matches) use ($encoding): string { |
|
7180 | + static function(array $matches) use ($encoding): string { |
|
7181 | 7181 | $match = $matches[1]; |
7182 | - $matchInt = (int) $match; |
|
7182 | + $matchInt = (int)$match; |
|
7183 | 7183 | |
7184 | - if ((string) $matchInt === $match) { |
|
7185 | - return '_' . $match . '_'; |
|
7184 | + if ((string)$matchInt === $match) { |
|
7185 | + return '_'.$match.'_'; |
|
7186 | 7186 | } |
7187 | 7187 | |
7188 | 7188 | if ($encoding === 'UTF-8') { |
7189 | - return '_' . \mb_strtolower($match); |
|
7189 | + return '_'.\mb_strtolower($match); |
|
7190 | 7190 | } |
7191 | 7191 | |
7192 | - return '_' . self::strtolower($match, $encoding); |
|
7192 | + return '_'.self::strtolower($match, $encoding); |
|
7193 | 7193 | }, |
7194 | 7194 | $str |
7195 | 7195 | ); |
7196 | 7196 | |
7197 | - $str = (string) \preg_replace( |
|
7197 | + $str = (string)\preg_replace( |
|
7198 | 7198 | [ |
7199 | - '/\\s+/u', // convert spaces to "_" |
|
7199 | + '/\\s+/u', // convert spaces to "_" |
|
7200 | 7200 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
7201 | - '/_+/', // remove double "_" |
|
7201 | + '/_+/', // remove double "_" |
|
7202 | 7202 | ], |
7203 | 7203 | [ |
7204 | 7204 | '_', |
@@ -7274,7 +7274,7 @@ discard block |
||
7274 | 7274 | } |
7275 | 7275 | |
7276 | 7276 | // init |
7277 | - $str = (string) $str; |
|
7277 | + $str = (string)$str; |
|
7278 | 7278 | |
7279 | 7279 | if ($str === '') { |
7280 | 7280 | return []; |
@@ -7321,7 +7321,7 @@ discard block |
||
7321 | 7321 | ($str[$i] & "\xE0") === "\xC0" |
7322 | 7322 | ) { |
7323 | 7323 | if (($str[$i + 1] & "\xC0") === "\x80") { |
7324 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
7324 | + $ret[] = $str[$i].$str[$i + 1]; |
|
7325 | 7325 | |
7326 | 7326 | ++$i; |
7327 | 7327 | } |
@@ -7335,7 +7335,7 @@ discard block |
||
7335 | 7335 | && |
7336 | 7336 | ($str[$i + 2] & "\xC0") === "\x80" |
7337 | 7337 | ) { |
7338 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
7338 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
7339 | 7339 | |
7340 | 7340 | $i += 2; |
7341 | 7341 | } |
@@ -7351,7 +7351,7 @@ discard block |
||
7351 | 7351 | && |
7352 | 7352 | ($str[$i + 3] & "\xC0") === "\x80" |
7353 | 7353 | ) { |
7354 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
7354 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
7355 | 7355 | |
7356 | 7356 | $i += 3; |
7357 | 7357 | } |
@@ -7363,7 +7363,7 @@ discard block |
||
7363 | 7363 | $ret = \array_chunk($ret, $length); |
7364 | 7364 | |
7365 | 7365 | return \array_map( |
7366 | - static function (array &$item): string { |
|
7366 | + static function(array &$item): string { |
|
7367 | 7367 | return \implode('', $item); |
7368 | 7368 | }, |
7369 | 7369 | $ret |
@@ -7426,7 +7426,7 @@ discard block |
||
7426 | 7426 | $limit = -1; |
7427 | 7427 | } |
7428 | 7428 | |
7429 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7429 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7430 | 7430 | |
7431 | 7431 | if ($array === false) { |
7432 | 7432 | return []; |
@@ -7510,9 +7510,9 @@ discard block |
||
7510 | 7510 | return ''; |
7511 | 7511 | } |
7512 | 7512 | |
7513 | - return (string) \mb_substr( |
|
7513 | + return (string)\mb_substr( |
|
7514 | 7514 | $str, |
7515 | - $offset + (int) \mb_strlen($separator) |
|
7515 | + $offset + (int)\mb_strlen($separator) |
|
7516 | 7516 | ); |
7517 | 7517 | } |
7518 | 7518 | |
@@ -7521,9 +7521,9 @@ discard block |
||
7521 | 7521 | return ''; |
7522 | 7522 | } |
7523 | 7523 | |
7524 | - return (string) \mb_substr( |
|
7524 | + return (string)\mb_substr( |
|
7525 | 7525 | $str, |
7526 | - $offset + (int) self::strlen($separator, $encoding), |
|
7526 | + $offset + (int)self::strlen($separator, $encoding), |
|
7527 | 7527 | null, |
7528 | 7528 | $encoding |
7529 | 7529 | ); |
@@ -7550,9 +7550,9 @@ discard block |
||
7550 | 7550 | return ''; |
7551 | 7551 | } |
7552 | 7552 | |
7553 | - return (string) \mb_substr( |
|
7553 | + return (string)\mb_substr( |
|
7554 | 7554 | $str, |
7555 | - $offset + (int) \mb_strlen($separator) |
|
7555 | + $offset + (int)\mb_strlen($separator) |
|
7556 | 7556 | ); |
7557 | 7557 | } |
7558 | 7558 | |
@@ -7561,9 +7561,9 @@ discard block |
||
7561 | 7561 | return ''; |
7562 | 7562 | } |
7563 | 7563 | |
7564 | - return (string) self::substr( |
|
7564 | + return (string)self::substr( |
|
7565 | 7565 | $str, |
7566 | - $offset + (int) self::strlen($separator, $encoding), |
|
7566 | + $offset + (int)self::strlen($separator, $encoding), |
|
7567 | 7567 | null, |
7568 | 7568 | $encoding |
7569 | 7569 | ); |
@@ -7593,7 +7593,7 @@ discard block |
||
7593 | 7593 | return ''; |
7594 | 7594 | } |
7595 | 7595 | |
7596 | - return (string) \mb_substr( |
|
7596 | + return (string)\mb_substr( |
|
7597 | 7597 | $str, |
7598 | 7598 | 0, |
7599 | 7599 | $offset |
@@ -7605,7 +7605,7 @@ discard block |
||
7605 | 7605 | return ''; |
7606 | 7606 | } |
7607 | 7607 | |
7608 | - return (string) self::substr( |
|
7608 | + return (string)self::substr( |
|
7609 | 7609 | $str, |
7610 | 7610 | 0, |
7611 | 7611 | $offset, |
@@ -7634,7 +7634,7 @@ discard block |
||
7634 | 7634 | return ''; |
7635 | 7635 | } |
7636 | 7636 | |
7637 | - return (string) \mb_substr( |
|
7637 | + return (string)\mb_substr( |
|
7638 | 7638 | $str, |
7639 | 7639 | 0, |
7640 | 7640 | $offset |
@@ -7648,7 +7648,7 @@ discard block |
||
7648 | 7648 | |
7649 | 7649 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7650 | 7650 | |
7651 | - return (string) self::substr( |
|
7651 | + return (string)self::substr( |
|
7652 | 7652 | $str, |
7653 | 7653 | 0, |
7654 | 7654 | $offset, |
@@ -7756,7 +7756,7 @@ discard block |
||
7756 | 7756 | */ |
7757 | 7757 | public static function str_surround(string $str, string $substring): string |
7758 | 7758 | { |
7759 | - return $substring . $str . $substring; |
|
7759 | + return $substring.$str.$substring; |
|
7760 | 7760 | } |
7761 | 7761 | |
7762 | 7762 | /** |
@@ -7800,9 +7800,9 @@ discard block |
||
7800 | 7800 | |
7801 | 7801 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
7802 | 7802 | |
7803 | - return (string) \preg_replace_callback( |
|
7803 | + return (string)\preg_replace_callback( |
|
7804 | 7804 | '/([^\\s]+)/u', |
7805 | - static function (array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7805 | + static function(array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7806 | 7806 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
7807 | 7807 | return $match[0]; |
7808 | 7808 | } |
@@ -7888,16 +7888,16 @@ discard block |
||
7888 | 7888 | } |
7889 | 7889 | |
7890 | 7890 | // the main substitutions |
7891 | - $str = (string) \preg_replace_callback( |
|
7891 | + $str = (string)\preg_replace_callback( |
|
7892 | 7892 | '~\\b (_*) (?: # 1. Leading underscore and |
7893 | 7893 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
7894 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
7894 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
7895 | 7895 | | |
7896 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
7896 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
7897 | 7897 | | |
7898 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
7898 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
7899 | 7899 | | |
7900 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
7900 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
7901 | 7901 | ) (_*) \\b # 6. With trailing underscore |
7902 | 7902 | ~ux', |
7903 | 7903 | /** |
@@ -7905,7 +7905,7 @@ discard block |
||
7905 | 7905 | * |
7906 | 7906 | * @return string |
7907 | 7907 | */ |
7908 | - static function (array $matches) use ($encoding): string { |
|
7908 | + static function(array $matches) use ($encoding): string { |
|
7909 | 7909 | // preserve leading underscore |
7910 | 7910 | $str = $matches[1]; |
7911 | 7911 | if ($matches[2]) { |
@@ -7930,26 +7930,26 @@ discard block |
||
7930 | 7930 | ); |
7931 | 7931 | |
7932 | 7932 | // Exceptions for small words: capitalize at start of title... |
7933 | - $str = (string) \preg_replace_callback( |
|
7933 | + $str = (string)\preg_replace_callback( |
|
7934 | 7934 | '~( \\A [[:punct:]]* # start of title... |
7935 | 7935 | | [:.;?!][ ]+ # or of subsentence... |
7936 | 7936 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
7937 | - ( ' . $smallWordsRx . ' ) \\b # ...followed by small word |
|
7937 | + ( ' . $smallWordsRx.' ) \\b # ...followed by small word |
|
7938 | 7938 | ~uxi', |
7939 | 7939 | /** |
7940 | 7940 | * @param string[] $matches |
7941 | 7941 | * |
7942 | 7942 | * @return string |
7943 | 7943 | */ |
7944 | - static function (array $matches) use ($encoding): string { |
|
7945 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7944 | + static function(array $matches) use ($encoding): string { |
|
7945 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7946 | 7946 | }, |
7947 | 7947 | $str |
7948 | 7948 | ); |
7949 | 7949 | |
7950 | 7950 | // ...and end of title |
7951 | - $str = (string) \preg_replace_callback( |
|
7952 | - '~\\b ( ' . $smallWordsRx . ' ) # small word... |
|
7951 | + $str = (string)\preg_replace_callback( |
|
7952 | + '~\\b ( '.$smallWordsRx.' ) # small word... |
|
7953 | 7953 | (?= [[:punct:]]* \Z # ...at the end of the title... |
7954 | 7954 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
7955 | 7955 | ~uxi', |
@@ -7958,7 +7958,7 @@ discard block |
||
7958 | 7958 | * |
7959 | 7959 | * @return string |
7960 | 7960 | */ |
7961 | - static function (array $matches) use ($encoding): string { |
|
7961 | + static function(array $matches) use ($encoding): string { |
|
7962 | 7962 | return static::str_upper_first($matches[1], $encoding); |
7963 | 7963 | }, |
7964 | 7964 | $str |
@@ -7966,10 +7966,10 @@ discard block |
||
7966 | 7966 | |
7967 | 7967 | // Exceptions for small words in hyphenated compound words. |
7968 | 7968 | // e.g. "in-flight" -> In-Flight |
7969 | - $str = (string) \preg_replace_callback( |
|
7969 | + $str = (string)\preg_replace_callback( |
|
7970 | 7970 | '~\\b |
7971 | 7971 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
7972 | - ( ' . $smallWordsRx . ' ) |
|
7972 | + ( ' . $smallWordsRx.' ) |
|
7973 | 7973 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
7974 | 7974 | ~uxi', |
7975 | 7975 | /** |
@@ -7977,18 +7977,18 @@ discard block |
||
7977 | 7977 | * |
7978 | 7978 | * @return string |
7979 | 7979 | */ |
7980 | - static function (array $matches) use ($encoding): string { |
|
7980 | + static function(array $matches) use ($encoding): string { |
|
7981 | 7981 | return static::str_upper_first($matches[1], $encoding); |
7982 | 7982 | }, |
7983 | 7983 | $str |
7984 | 7984 | ); |
7985 | 7985 | |
7986 | 7986 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
7987 | - $str = (string) \preg_replace_callback( |
|
7987 | + $str = (string)\preg_replace_callback( |
|
7988 | 7988 | '~\\b |
7989 | 7989 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
7990 | 7990 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
7991 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
7991 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
7992 | 7992 | (?! - ) # Negative lookahead for another - |
7993 | 7993 | ~uxi', |
7994 | 7994 | /** |
@@ -7996,8 +7996,8 @@ discard block |
||
7996 | 7996 | * |
7997 | 7997 | * @return string |
7998 | 7998 | */ |
7999 | - static function (array $matches) use ($encoding): string { |
|
8000 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7999 | + static function(array $matches) use ($encoding): string { |
|
8000 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
8001 | 8001 | }, |
8002 | 8002 | $str |
8003 | 8003 | ); |
@@ -8105,7 +8105,7 @@ discard block |
||
8105 | 8105 | ); |
8106 | 8106 | |
8107 | 8107 | foreach ($tmpReturn as &$item) { |
8108 | - $item = (string) $item; |
|
8108 | + $item = (string)$item; |
|
8109 | 8109 | } |
8110 | 8110 | |
8111 | 8111 | return $tmpReturn; |
@@ -8150,39 +8150,39 @@ discard block |
||
8150 | 8150 | } |
8151 | 8151 | |
8152 | 8152 | if ($encoding === 'UTF-8') { |
8153 | - if ($length >= (int) \mb_strlen($str)) { |
|
8153 | + if ($length >= (int)\mb_strlen($str)) { |
|
8154 | 8154 | return $str; |
8155 | 8155 | } |
8156 | 8156 | |
8157 | 8157 | if ($substring !== '') { |
8158 | - $length -= (int) \mb_strlen($substring); |
|
8158 | + $length -= (int)\mb_strlen($substring); |
|
8159 | 8159 | |
8160 | 8160 | /** @noinspection UnnecessaryCastingInspection */ |
8161 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8161 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8162 | 8162 | } |
8163 | 8163 | |
8164 | 8164 | /** @noinspection UnnecessaryCastingInspection */ |
8165 | - return (string) \mb_substr($str, 0, $length); |
|
8165 | + return (string)\mb_substr($str, 0, $length); |
|
8166 | 8166 | } |
8167 | 8167 | |
8168 | 8168 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8169 | 8169 | |
8170 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8170 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8171 | 8171 | return $str; |
8172 | 8172 | } |
8173 | 8173 | |
8174 | 8174 | if ($substring !== '') { |
8175 | - $length -= (int) self::strlen($substring, $encoding); |
|
8175 | + $length -= (int)self::strlen($substring, $encoding); |
|
8176 | 8176 | } |
8177 | 8177 | |
8178 | 8178 | return ( |
8179 | - (string) self::substr( |
|
8179 | + (string)self::substr( |
|
8180 | 8180 | $str, |
8181 | 8181 | 0, |
8182 | 8182 | $length, |
8183 | 8183 | $encoding |
8184 | 8184 | ) |
8185 | - ) . $substring; |
|
8185 | + ).$substring; |
|
8186 | 8186 | } |
8187 | 8187 | |
8188 | 8188 | /** |
@@ -8212,12 +8212,12 @@ discard block |
||
8212 | 8212 | } |
8213 | 8213 | |
8214 | 8214 | if ($encoding === 'UTF-8') { |
8215 | - if ($length >= (int) \mb_strlen($str)) { |
|
8215 | + if ($length >= (int)\mb_strlen($str)) { |
|
8216 | 8216 | return $str; |
8217 | 8217 | } |
8218 | 8218 | |
8219 | 8219 | // need to further trim the string so we can append the substring |
8220 | - $length -= (int) \mb_strlen($substring); |
|
8220 | + $length -= (int)\mb_strlen($substring); |
|
8221 | 8221 | if ($length <= 0) { |
8222 | 8222 | return $substring; |
8223 | 8223 | } |
@@ -8239,18 +8239,18 @@ discard block |
||
8239 | 8239 | || |
8240 | 8240 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8241 | 8241 | ) { |
8242 | - $truncated = (string) \mb_substr($truncated, 0, (int) $lastPos); |
|
8242 | + $truncated = (string)\mb_substr($truncated, 0, (int)$lastPos); |
|
8243 | 8243 | } |
8244 | 8244 | } |
8245 | 8245 | } else { |
8246 | 8246 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8247 | 8247 | |
8248 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8248 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8249 | 8249 | return $str; |
8250 | 8250 | } |
8251 | 8251 | |
8252 | 8252 | // need to further trim the string so we can append the substring |
8253 | - $length -= (int) self::strlen($substring, $encoding); |
|
8253 | + $length -= (int)self::strlen($substring, $encoding); |
|
8254 | 8254 | if ($length <= 0) { |
8255 | 8255 | return $substring; |
8256 | 8256 | } |
@@ -8272,12 +8272,12 @@ discard block |
||
8272 | 8272 | || |
8273 | 8273 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8274 | 8274 | ) { |
8275 | - $truncated = (string) self::substr($truncated, 0, (int) $lastPos, $encoding); |
|
8275 | + $truncated = (string)self::substr($truncated, 0, (int)$lastPos, $encoding); |
|
8276 | 8276 | } |
8277 | 8277 | } |
8278 | 8278 | } |
8279 | 8279 | |
8280 | - return $truncated . $substring; |
|
8280 | + return $truncated.$substring; |
|
8281 | 8281 | } |
8282 | 8282 | |
8283 | 8283 | /** |
@@ -8367,13 +8367,13 @@ discard block |
||
8367 | 8367 | } |
8368 | 8368 | } elseif ($format === 2) { |
8369 | 8369 | $numberOfWords = []; |
8370 | - $offset = (int) self::strlen($strParts[0]); |
|
8370 | + $offset = (int)self::strlen($strParts[0]); |
|
8371 | 8371 | for ($i = 1; $i < $len; $i += 2) { |
8372 | 8372 | $numberOfWords[$offset] = $strParts[$i]; |
8373 | - $offset += (int) self::strlen($strParts[$i]) + (int) self::strlen($strParts[$i + 1]); |
|
8373 | + $offset += (int)self::strlen($strParts[$i]) + (int)self::strlen($strParts[$i + 1]); |
|
8374 | 8374 | } |
8375 | 8375 | } else { |
8376 | - $numberOfWords = (int) (($len - 1) / 2); |
|
8376 | + $numberOfWords = (int)(($len - 1) / 2); |
|
8377 | 8377 | } |
8378 | 8378 | |
8379 | 8379 | return $numberOfWords; |
@@ -8470,21 +8470,21 @@ discard block |
||
8470 | 8470 | } |
8471 | 8471 | |
8472 | 8472 | if ($charList === '') { |
8473 | - return (int) self::strlen($str, $encoding); |
|
8473 | + return (int)self::strlen($str, $encoding); |
|
8474 | 8474 | } |
8475 | 8475 | |
8476 | 8476 | if ($offset !== null || $length !== null) { |
8477 | 8477 | if ($encoding === 'UTF-8') { |
8478 | 8478 | if ($length === null) { |
8479 | 8479 | /** @noinspection UnnecessaryCastingInspection */ |
8480 | - $strTmp = \mb_substr($str, (int) $offset); |
|
8480 | + $strTmp = \mb_substr($str, (int)$offset); |
|
8481 | 8481 | } else { |
8482 | 8482 | /** @noinspection UnnecessaryCastingInspection */ |
8483 | - $strTmp = \mb_substr($str, (int) $offset, $length); |
|
8483 | + $strTmp = \mb_substr($str, (int)$offset, $length); |
|
8484 | 8484 | } |
8485 | 8485 | } else { |
8486 | 8486 | /** @noinspection UnnecessaryCastingInspection */ |
8487 | - $strTmp = self::substr($str, (int) $offset, $length, $encoding); |
|
8487 | + $strTmp = self::substr($str, (int)$offset, $length, $encoding); |
|
8488 | 8488 | } |
8489 | 8489 | |
8490 | 8490 | if ($strTmp === false) { |
@@ -8499,7 +8499,7 @@ discard block |
||
8499 | 8499 | } |
8500 | 8500 | |
8501 | 8501 | $matches = []; |
8502 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $matches)) { |
|
8502 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $matches)) { |
|
8503 | 8503 | $return = self::strlen($matches[1], $encoding); |
8504 | 8504 | if ($return === false) { |
8505 | 8505 | return 0; |
@@ -8508,7 +8508,7 @@ discard block |
||
8508 | 8508 | return $return; |
8509 | 8509 | } |
8510 | 8510 | |
8511 | - return (int) self::strlen($str, $encoding); |
|
8511 | + return (int)self::strlen($str, $encoding); |
|
8512 | 8512 | } |
8513 | 8513 | |
8514 | 8514 | /** |
@@ -8630,7 +8630,7 @@ discard block |
||
8630 | 8630 | return ''; |
8631 | 8631 | } |
8632 | 8632 | |
8633 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
8633 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
8634 | 8634 | } |
8635 | 8635 | |
8636 | 8636 | /** |
@@ -8695,7 +8695,7 @@ discard block |
||
8695 | 8695 | // fallback for ascii only |
8696 | 8696 | // |
8697 | 8697 | |
8698 | - if (self::is_ascii($haystack . $needle)) { |
|
8698 | + if (self::is_ascii($haystack.$needle)) { |
|
8699 | 8699 | return \stripos($haystack, $needle, $offset); |
8700 | 8700 | } |
8701 | 8701 | |
@@ -8762,7 +8762,7 @@ discard block |
||
8762 | 8762 | && |
8763 | 8763 | self::$SUPPORT['mbstring'] === false |
8764 | 8764 | ) { |
8765 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8765 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8766 | 8766 | } |
8767 | 8767 | |
8768 | 8768 | if ( |
@@ -8776,11 +8776,11 @@ discard block |
||
8776 | 8776 | } |
8777 | 8777 | } |
8778 | 8778 | |
8779 | - if (self::is_ascii($needle . $haystack)) { |
|
8779 | + if (self::is_ascii($needle.$haystack)) { |
|
8780 | 8780 | return \stristr($haystack, $needle, $before_needle); |
8781 | 8781 | } |
8782 | 8782 | |
8783 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
8783 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
8784 | 8784 | |
8785 | 8785 | if (!isset($match[1])) { |
8786 | 8786 | return false; |
@@ -8790,7 +8790,7 @@ discard block |
||
8790 | 8790 | return $match[1]; |
8791 | 8791 | } |
8792 | 8792 | |
8793 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
8793 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
8794 | 8794 | } |
8795 | 8795 | |
8796 | 8796 | /** |
@@ -8857,7 +8857,7 @@ discard block |
||
8857 | 8857 | && |
8858 | 8858 | self::$SUPPORT['iconv'] === false |
8859 | 8859 | ) { |
8860 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8860 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8861 | 8861 | } |
8862 | 8862 | |
8863 | 8863 | // |
@@ -8973,8 +8973,8 @@ discard block |
||
8973 | 8973 | } |
8974 | 8974 | |
8975 | 8975 | return \strnatcmp( |
8976 | - (string) self::strtonatfold($str1), |
|
8977 | - (string) self::strtonatfold($str2) |
|
8976 | + (string)self::strtonatfold($str1), |
|
8977 | + (string)self::strtonatfold($str2) |
|
8978 | 8978 | ); |
8979 | 8979 | } |
8980 | 8980 | |
@@ -9032,11 +9032,11 @@ discard block |
||
9032 | 9032 | } |
9033 | 9033 | |
9034 | 9034 | if ($encoding === 'UTF-8') { |
9035 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
9036 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
9035 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
9036 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
9037 | 9037 | } else { |
9038 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
9039 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
9038 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
9039 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
9040 | 9040 | } |
9041 | 9041 | |
9042 | 9042 | return self::strcmp($str1, $str2); |
@@ -9058,8 +9058,8 @@ discard block |
||
9058 | 9058 | return false; |
9059 | 9059 | } |
9060 | 9060 | |
9061 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
9062 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
9061 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
9062 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
9063 | 9063 | } |
9064 | 9064 | |
9065 | 9065 | return false; |
@@ -9092,10 +9092,10 @@ discard block |
||
9092 | 9092 | } |
9093 | 9093 | |
9094 | 9094 | // iconv and mbstring do not support integer $needle |
9095 | - if ((int) $needle === $needle) { |
|
9096 | - $needle = (string) self::chr($needle); |
|
9095 | + if ((int)$needle === $needle) { |
|
9096 | + $needle = (string)self::chr($needle); |
|
9097 | 9097 | } |
9098 | - $needle = (string) $needle; |
|
9098 | + $needle = (string)$needle; |
|
9099 | 9099 | |
9100 | 9100 | if ($needle === '') { |
9101 | 9101 | return false; |
@@ -9142,7 +9142,7 @@ discard block |
||
9142 | 9142 | && |
9143 | 9143 | self::$SUPPORT['mbstring'] === false |
9144 | 9144 | ) { |
9145 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9145 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9146 | 9146 | } |
9147 | 9147 | |
9148 | 9148 | // |
@@ -9183,7 +9183,7 @@ discard block |
||
9183 | 9183 | // fallback for ascii only |
9184 | 9184 | // |
9185 | 9185 | |
9186 | - if (self::is_ascii($haystack . $needle)) { |
|
9186 | + if (self::is_ascii($haystack.$needle)) { |
|
9187 | 9187 | return \strpos($haystack, $needle, $offset); |
9188 | 9188 | } |
9189 | 9189 | |
@@ -9195,7 +9195,7 @@ discard block |
||
9195 | 9195 | if ($haystackTmp === false) { |
9196 | 9196 | $haystackTmp = ''; |
9197 | 9197 | } |
9198 | - $haystack = (string) $haystackTmp; |
|
9198 | + $haystack = (string)$haystackTmp; |
|
9199 | 9199 | |
9200 | 9200 | if ($offset < 0) { |
9201 | 9201 | $offset = 0; |
@@ -9207,7 +9207,7 @@ discard block |
||
9207 | 9207 | } |
9208 | 9208 | |
9209 | 9209 | if ($pos) { |
9210 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9210 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9211 | 9211 | } |
9212 | 9212 | |
9213 | 9213 | return $offset + 0; |
@@ -9318,7 +9318,7 @@ discard block |
||
9318 | 9318 | && |
9319 | 9319 | self::$SUPPORT['mbstring'] === false |
9320 | 9320 | ) { |
9321 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9321 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9322 | 9322 | } |
9323 | 9323 | |
9324 | 9324 | // |
@@ -9330,7 +9330,7 @@ discard block |
||
9330 | 9330 | if ($needleTmp === false) { |
9331 | 9331 | return false; |
9332 | 9332 | } |
9333 | - $needle = (string) $needleTmp; |
|
9333 | + $needle = (string)$needleTmp; |
|
9334 | 9334 | |
9335 | 9335 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
9336 | 9336 | if ($pos === false) { |
@@ -9352,7 +9352,7 @@ discard block |
||
9352 | 9352 | if ($needleTmp === false) { |
9353 | 9353 | return false; |
9354 | 9354 | } |
9355 | - $needle = (string) $needleTmp; |
|
9355 | + $needle = (string)$needleTmp; |
|
9356 | 9356 | |
9357 | 9357 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
9358 | 9358 | if ($pos === false) { |
@@ -9388,7 +9388,7 @@ discard block |
||
9388 | 9388 | if ($encoding === 'UTF-8') { |
9389 | 9389 | if (self::$SUPPORT['intl'] === true) { |
9390 | 9390 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
9391 | - $i = (int) \grapheme_strlen($str); |
|
9391 | + $i = (int)\grapheme_strlen($str); |
|
9392 | 9392 | while ($i--) { |
9393 | 9393 | $reversedTmp = \grapheme_substr($str, $i, 1); |
9394 | 9394 | if ($reversedTmp !== false) { |
@@ -9396,7 +9396,7 @@ discard block |
||
9396 | 9396 | } |
9397 | 9397 | } |
9398 | 9398 | } else { |
9399 | - $i = (int) \mb_strlen($str); |
|
9399 | + $i = (int)\mb_strlen($str); |
|
9400 | 9400 | while ($i--) { |
9401 | 9401 | $reversedTmp = \mb_substr($str, $i, 1); |
9402 | 9402 | if ($reversedTmp !== false) { |
@@ -9407,7 +9407,7 @@ discard block |
||
9407 | 9407 | } else { |
9408 | 9408 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9409 | 9409 | |
9410 | - $i = (int) self::strlen($str, $encoding); |
|
9410 | + $i = (int)self::strlen($str, $encoding); |
|
9411 | 9411 | while ($i--) { |
9412 | 9412 | $reversedTmp = self::substr($str, $i, 1, $encoding); |
9413 | 9413 | if ($reversedTmp !== false) { |
@@ -9481,7 +9481,7 @@ discard block |
||
9481 | 9481 | if ($needleTmp === false) { |
9482 | 9482 | return false; |
9483 | 9483 | } |
9484 | - $needle = (string) $needleTmp; |
|
9484 | + $needle = (string)$needleTmp; |
|
9485 | 9485 | |
9486 | 9486 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
9487 | 9487 | if ($pos === false) { |
@@ -9520,10 +9520,10 @@ discard block |
||
9520 | 9520 | } |
9521 | 9521 | |
9522 | 9522 | // iconv and mbstring do not support integer $needle |
9523 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9524 | - $needle = (string) self::chr($needle); |
|
9523 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9524 | + $needle = (string)self::chr($needle); |
|
9525 | 9525 | } |
9526 | - $needle = (string) $needle; |
|
9526 | + $needle = (string)$needle; |
|
9527 | 9527 | |
9528 | 9528 | if ($needle === '') { |
9529 | 9529 | return false; |
@@ -9568,7 +9568,7 @@ discard block |
||
9568 | 9568 | && |
9569 | 9569 | self::$SUPPORT['mbstring'] === false |
9570 | 9570 | ) { |
9571 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9571 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9572 | 9572 | } |
9573 | 9573 | |
9574 | 9574 | // |
@@ -9592,7 +9592,7 @@ discard block |
||
9592 | 9592 | // fallback for ascii only |
9593 | 9593 | // |
9594 | 9594 | |
9595 | - if (self::is_ascii($haystack . $needle)) { |
|
9595 | + if (self::is_ascii($haystack.$needle)) { |
|
9596 | 9596 | return \strripos($haystack, $needle, $offset); |
9597 | 9597 | } |
9598 | 9598 | |
@@ -9668,10 +9668,10 @@ discard block |
||
9668 | 9668 | } |
9669 | 9669 | |
9670 | 9670 | // iconv and mbstring do not support integer $needle |
9671 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9672 | - $needle = (string) self::chr($needle); |
|
9671 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9672 | + $needle = (string)self::chr($needle); |
|
9673 | 9673 | } |
9674 | - $needle = (string) $needle; |
|
9674 | + $needle = (string)$needle; |
|
9675 | 9675 | |
9676 | 9676 | if ($needle === '') { |
9677 | 9677 | return false; |
@@ -9716,7 +9716,7 @@ discard block |
||
9716 | 9716 | && |
9717 | 9717 | self::$SUPPORT['mbstring'] === false |
9718 | 9718 | ) { |
9719 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9719 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9720 | 9720 | } |
9721 | 9721 | |
9722 | 9722 | // |
@@ -9740,7 +9740,7 @@ discard block |
||
9740 | 9740 | // fallback for ascii only |
9741 | 9741 | // |
9742 | 9742 | |
9743 | - if (self::is_ascii($haystack . $needle)) { |
|
9743 | + if (self::is_ascii($haystack.$needle)) { |
|
9744 | 9744 | return \strrpos($haystack, $needle, $offset); |
9745 | 9745 | } |
9746 | 9746 | |
@@ -9760,7 +9760,7 @@ discard block |
||
9760 | 9760 | if ($haystackTmp === false) { |
9761 | 9761 | $haystackTmp = ''; |
9762 | 9762 | } |
9763 | - $haystack = (string) $haystackTmp; |
|
9763 | + $haystack = (string)$haystackTmp; |
|
9764 | 9764 | } |
9765 | 9765 | |
9766 | 9766 | $pos = \strrpos($haystack, $needle); |
@@ -9773,7 +9773,7 @@ discard block |
||
9773 | 9773 | return false; |
9774 | 9774 | } |
9775 | 9775 | |
9776 | - return $offset + (int) self::strlen($strTmp); |
|
9776 | + return $offset + (int)self::strlen($strTmp); |
|
9777 | 9777 | } |
9778 | 9778 | |
9779 | 9779 | /** |
@@ -9833,12 +9833,12 @@ discard block |
||
9833 | 9833 | if ($offset || $length !== null) { |
9834 | 9834 | if ($encoding === 'UTF-8') { |
9835 | 9835 | if ($length === null) { |
9836 | - $str = (string) \mb_substr($str, $offset); |
|
9836 | + $str = (string)\mb_substr($str, $offset); |
|
9837 | 9837 | } else { |
9838 | - $str = (string) \mb_substr($str, $offset, $length); |
|
9838 | + $str = (string)\mb_substr($str, $offset, $length); |
|
9839 | 9839 | } |
9840 | 9840 | } else { |
9841 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
9841 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
9842 | 9842 | } |
9843 | 9843 | } |
9844 | 9844 | |
@@ -9848,7 +9848,7 @@ discard block |
||
9848 | 9848 | |
9849 | 9849 | $matches = []; |
9850 | 9850 | |
9851 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
9851 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
9852 | 9852 | } |
9853 | 9853 | |
9854 | 9854 | /** |
@@ -9917,7 +9917,7 @@ discard block |
||
9917 | 9917 | && |
9918 | 9918 | self::$SUPPORT['mbstring'] === false |
9919 | 9919 | ) { |
9920 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9920 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9921 | 9921 | } |
9922 | 9922 | |
9923 | 9923 | // |
@@ -9939,7 +9939,7 @@ discard block |
||
9939 | 9939 | // fallback for ascii only |
9940 | 9940 | // |
9941 | 9941 | |
9942 | - if (self::is_ascii($haystack . $needle)) { |
|
9942 | + if (self::is_ascii($haystack.$needle)) { |
|
9943 | 9943 | return \strstr($haystack, $needle, $before_needle); |
9944 | 9944 | } |
9945 | 9945 | |
@@ -9947,7 +9947,7 @@ discard block |
||
9947 | 9947 | // fallback via vanilla php |
9948 | 9948 | // |
9949 | 9949 | |
9950 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
9950 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
9951 | 9951 | |
9952 | 9952 | if (!isset($match[1])) { |
9953 | 9953 | return false; |
@@ -9957,7 +9957,7 @@ discard block |
||
9957 | 9957 | return $match[1]; |
9958 | 9958 | } |
9959 | 9959 | |
9960 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
9960 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
9961 | 9961 | } |
9962 | 9962 | |
9963 | 9963 | /** |
@@ -10071,7 +10071,7 @@ discard block |
||
10071 | 10071 | bool $tryToKeepStringLength = false |
10072 | 10072 | ): string { |
10073 | 10073 | // init |
10074 | - $str = (string) $str; |
|
10074 | + $str = (string)$str; |
|
10075 | 10075 | |
10076 | 10076 | if ($str === '') { |
10077 | 10077 | return ''; |
@@ -10100,19 +10100,19 @@ discard block |
||
10100 | 10100 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10101 | 10101 | } |
10102 | 10102 | |
10103 | - $langCode = $lang . '-Lower'; |
|
10103 | + $langCode = $lang.'-Lower'; |
|
10104 | 10104 | if (!\in_array($langCode, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10105 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, \E_USER_WARNING); |
|
10105 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, \E_USER_WARNING); |
|
10106 | 10106 | |
10107 | 10107 | $langCode = 'Any-Lower'; |
10108 | 10108 | } |
10109 | 10109 | |
10110 | 10110 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10111 | 10111 | /** @noinspection UnnecessaryCastingInspection */ |
10112 | - return (string) \transliterator_transliterate($langCode, $str); |
|
10112 | + return (string)\transliterator_transliterate($langCode, $str); |
|
10113 | 10113 | } |
10114 | 10114 | |
10115 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
10115 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
10116 | 10116 | } |
10117 | 10117 | |
10118 | 10118 | // always fallback via symfony polyfill |
@@ -10141,7 +10141,7 @@ discard block |
||
10141 | 10141 | bool $tryToKeepStringLength = false |
10142 | 10142 | ): string { |
10143 | 10143 | // init |
10144 | - $str = (string) $str; |
|
10144 | + $str = (string)$str; |
|
10145 | 10145 | |
10146 | 10146 | if ($str === '') { |
10147 | 10147 | return ''; |
@@ -10170,19 +10170,19 @@ discard block |
||
10170 | 10170 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10171 | 10171 | } |
10172 | 10172 | |
10173 | - $langCode = $lang . '-Upper'; |
|
10173 | + $langCode = $lang.'-Upper'; |
|
10174 | 10174 | if (!\in_array($langCode, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10175 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
10175 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
10176 | 10176 | |
10177 | 10177 | $langCode = 'Any-Upper'; |
10178 | 10178 | } |
10179 | 10179 | |
10180 | 10180 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10181 | 10181 | /** @noinspection UnnecessaryCastingInspection */ |
10182 | - return (string) \transliterator_transliterate($langCode, $str); |
|
10182 | + return (string)\transliterator_transliterate($langCode, $str); |
|
10183 | 10183 | } |
10184 | 10184 | |
10185 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
10185 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
10186 | 10186 | } |
10187 | 10187 | |
10188 | 10188 | // always fallback via symfony polyfill |
@@ -10226,7 +10226,7 @@ discard block |
||
10226 | 10226 | |
10227 | 10227 | $from = \array_combine($from, $to); |
10228 | 10228 | if ($from === false) { |
10229 | - 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) . ')'); |
|
10229 | + 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).')'); |
|
10230 | 10230 | } |
10231 | 10231 | } |
10232 | 10232 | |
@@ -10283,9 +10283,9 @@ discard block |
||
10283 | 10283 | } |
10284 | 10284 | |
10285 | 10285 | $wide = 0; |
10286 | - $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); |
|
10286 | + $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); |
|
10287 | 10287 | |
10288 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
10288 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
10289 | 10289 | } |
10290 | 10290 | |
10291 | 10291 | /** |
@@ -10385,9 +10385,9 @@ discard block |
||
10385 | 10385 | } |
10386 | 10386 | |
10387 | 10387 | if ($length === null) { |
10388 | - $length = (int) $str_length; |
|
10388 | + $length = (int)$str_length; |
|
10389 | 10389 | } else { |
10390 | - $length = (int) $length; |
|
10390 | + $length = (int)$length; |
|
10391 | 10391 | } |
10392 | 10392 | |
10393 | 10393 | if ( |
@@ -10395,7 +10395,7 @@ discard block |
||
10395 | 10395 | && |
10396 | 10396 | self::$SUPPORT['mbstring'] === false |
10397 | 10397 | ) { |
10398 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10398 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10399 | 10399 | } |
10400 | 10400 | |
10401 | 10401 | // |
@@ -10483,16 +10483,16 @@ discard block |
||
10483 | 10483 | ) { |
10484 | 10484 | if ($encoding === 'UTF-8') { |
10485 | 10485 | if ($length === null) { |
10486 | - $str1 = (string) \mb_substr($str1, $offset); |
|
10486 | + $str1 = (string)\mb_substr($str1, $offset); |
|
10487 | 10487 | } else { |
10488 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
10488 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
10489 | 10489 | } |
10490 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
10490 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
10491 | 10491 | } else { |
10492 | 10492 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10493 | 10493 | |
10494 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
10495 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
10494 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
10495 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
10496 | 10496 | } |
10497 | 10497 | } |
10498 | 10498 | |
@@ -10554,13 +10554,13 @@ discard block |
||
10554 | 10554 | if ($lengthTmp === false) { |
10555 | 10555 | return false; |
10556 | 10556 | } |
10557 | - $length = (int) $lengthTmp; |
|
10557 | + $length = (int)$lengthTmp; |
|
10558 | 10558 | } |
10559 | 10559 | |
10560 | 10560 | if ($encoding === 'UTF-8') { |
10561 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
10561 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
10562 | 10562 | } else { |
10563 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
10563 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
10564 | 10564 | } |
10565 | 10565 | } |
10566 | 10566 | |
@@ -10569,7 +10569,7 @@ discard block |
||
10569 | 10569 | && |
10570 | 10570 | self::$SUPPORT['mbstring'] === false |
10571 | 10571 | ) { |
10572 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10572 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10573 | 10573 | } |
10574 | 10574 | |
10575 | 10575 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10580,7 +10580,7 @@ discard block |
||
10580 | 10580 | return \mb_substr_count($haystack, $needle, $encoding); |
10581 | 10581 | } |
10582 | 10582 | |
10583 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10583 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10584 | 10584 | |
10585 | 10585 | return \count($matches); |
10586 | 10586 | } |
@@ -10627,7 +10627,7 @@ discard block |
||
10627 | 10627 | if ($lengthTmp === false) { |
10628 | 10628 | return false; |
10629 | 10629 | } |
10630 | - $length = (int) $lengthTmp; |
|
10630 | + $length = (int)$lengthTmp; |
|
10631 | 10631 | } |
10632 | 10632 | |
10633 | 10633 | if ( |
@@ -10648,7 +10648,7 @@ discard block |
||
10648 | 10648 | if ($haystackTmp === false) { |
10649 | 10649 | $haystackTmp = ''; |
10650 | 10650 | } |
10651 | - $haystack = (string) $haystackTmp; |
|
10651 | + $haystack = (string)$haystackTmp; |
|
10652 | 10652 | } |
10653 | 10653 | |
10654 | 10654 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10687,10 +10687,10 @@ discard block |
||
10687 | 10687 | |
10688 | 10688 | if ($encoding === 'UTF-8') { |
10689 | 10689 | if ($caseSensitive) { |
10690 | - return (int) \mb_substr_count($str, $substring); |
|
10690 | + return (int)\mb_substr_count($str, $substring); |
|
10691 | 10691 | } |
10692 | 10692 | |
10693 | - return (int) \mb_substr_count( |
|
10693 | + return (int)\mb_substr_count( |
|
10694 | 10694 | \mb_strtoupper($str), |
10695 | 10695 | \mb_strtoupper($substring) |
10696 | 10696 | |
@@ -10700,10 +10700,10 @@ discard block |
||
10700 | 10700 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10701 | 10701 | |
10702 | 10702 | if ($caseSensitive) { |
10703 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
10703 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
10704 | 10704 | } |
10705 | 10705 | |
10706 | - return (int) \mb_substr_count( |
|
10706 | + return (int)\mb_substr_count( |
|
10707 | 10707 | self::strtocasefold($str, true, false, $encoding, null, false), |
10708 | 10708 | self::strtocasefold($substring, true, false, $encoding, null, false), |
10709 | 10709 | $encoding |
@@ -10729,7 +10729,7 @@ discard block |
||
10729 | 10729 | } |
10730 | 10730 | |
10731 | 10731 | if (self::str_istarts_with($haystack, $needle) === true) { |
10732 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10732 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10733 | 10733 | } |
10734 | 10734 | |
10735 | 10735 | return $haystack; |
@@ -10786,7 +10786,7 @@ discard block |
||
10786 | 10786 | } |
10787 | 10787 | |
10788 | 10788 | if (self::str_iends_with($haystack, $needle) === true) { |
10789 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
10789 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
10790 | 10790 | } |
10791 | 10791 | |
10792 | 10792 | return $haystack; |
@@ -10811,7 +10811,7 @@ discard block |
||
10811 | 10811 | } |
10812 | 10812 | |
10813 | 10813 | if (self::str_starts_with($haystack, $needle) === true) { |
10814 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10814 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10815 | 10815 | } |
10816 | 10816 | |
10817 | 10817 | return $haystack; |
@@ -10863,7 +10863,7 @@ discard block |
||
10863 | 10863 | if (\is_array($offset) === true) { |
10864 | 10864 | $offset = \array_slice($offset, 0, $num); |
10865 | 10865 | foreach ($offset as &$valueTmp) { |
10866 | - $valueTmp = (int) $valueTmp === $valueTmp ? $valueTmp : 0; |
|
10866 | + $valueTmp = (int)$valueTmp === $valueTmp ? $valueTmp : 0; |
|
10867 | 10867 | } |
10868 | 10868 | unset($valueTmp); |
10869 | 10869 | } else { |
@@ -10876,7 +10876,7 @@ discard block |
||
10876 | 10876 | } elseif (\is_array($length) === true) { |
10877 | 10877 | $length = \array_slice($length, 0, $num); |
10878 | 10878 | foreach ($length as &$valueTmpV2) { |
10879 | - $valueTmpV2 = (int) $valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10879 | + $valueTmpV2 = (int)$valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10880 | 10880 | } |
10881 | 10881 | unset($valueTmpV2); |
10882 | 10882 | } else { |
@@ -10896,8 +10896,8 @@ discard block |
||
10896 | 10896 | } |
10897 | 10897 | |
10898 | 10898 | // init |
10899 | - $str = (string) $str; |
|
10900 | - $replacement = (string) $replacement; |
|
10899 | + $str = (string)$str; |
|
10900 | + $replacement = (string)$replacement; |
|
10901 | 10901 | |
10902 | 10902 | if (\is_array($length) === true) { |
10903 | 10903 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -10912,16 +10912,16 @@ discard block |
||
10912 | 10912 | } |
10913 | 10913 | |
10914 | 10914 | if (self::$SUPPORT['mbstring'] === true) { |
10915 | - $string_length = (int) self::strlen($str, $encoding); |
|
10915 | + $string_length = (int)self::strlen($str, $encoding); |
|
10916 | 10916 | |
10917 | 10917 | if ($offset < 0) { |
10918 | - $offset = (int) \max(0, $string_length + $offset); |
|
10918 | + $offset = (int)\max(0, $string_length + $offset); |
|
10919 | 10919 | } elseif ($offset > $string_length) { |
10920 | 10920 | $offset = $string_length; |
10921 | 10921 | } |
10922 | 10922 | |
10923 | 10923 | if ($length !== null && $length < 0) { |
10924 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
10924 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
10925 | 10925 | } elseif ($length === null || $length > $string_length) { |
10926 | 10926 | $length = $string_length; |
10927 | 10927 | } |
@@ -10932,9 +10932,9 @@ discard block |
||
10932 | 10932 | } |
10933 | 10933 | |
10934 | 10934 | /** @noinspection AdditionOperationOnArraysInspection */ |
10935 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
10936 | - $replacement . |
|
10937 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10935 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
10936 | + $replacement. |
|
10937 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10938 | 10938 | } |
10939 | 10939 | |
10940 | 10940 | // |
@@ -10943,8 +10943,7 @@ discard block |
||
10943 | 10943 | |
10944 | 10944 | if (self::is_ascii($str)) { |
10945 | 10945 | return ($length === null) ? |
10946 | - \substr_replace($str, $replacement, $offset) : |
|
10947 | - \substr_replace($str, $replacement, $offset, $length); |
|
10946 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
10948 | 10947 | } |
10949 | 10948 | |
10950 | 10949 | // |
@@ -10960,7 +10959,7 @@ discard block |
||
10960 | 10959 | // e.g.: non mbstring support + invalid chars |
10961 | 10960 | return ''; |
10962 | 10961 | } |
10963 | - $length = (int) $lengthTmp; |
|
10962 | + $length = (int)$lengthTmp; |
|
10964 | 10963 | } |
10965 | 10964 | |
10966 | 10965 | \array_splice($smatches[0], $offset, $length, $rmatches[0]); |
@@ -10995,14 +10994,14 @@ discard block |
||
10995 | 10994 | && |
10996 | 10995 | \substr($haystack, -\strlen($needle)) === $needle |
10997 | 10996 | ) { |
10998 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
10997 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
10999 | 10998 | } |
11000 | 10999 | |
11001 | 11000 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
11002 | - return (string) self::substr( |
|
11001 | + return (string)self::substr( |
|
11003 | 11002 | $haystack, |
11004 | 11003 | 0, |
11005 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
11004 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
11006 | 11005 | $encoding |
11007 | 11006 | ); |
11008 | 11007 | } |
@@ -11032,10 +11031,10 @@ discard block |
||
11032 | 11031 | } |
11033 | 11032 | |
11034 | 11033 | if ($encoding === 'UTF-8') { |
11035 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
11034 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
11036 | 11035 | } |
11037 | 11036 | |
11038 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
11037 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
11039 | 11038 | } |
11040 | 11039 | |
11041 | 11040 | /** |
@@ -11227,7 +11226,7 @@ discard block |
||
11227 | 11226 | // INFO: https://unicode.org/cldr/utility/character.jsp?a=%E2%84%8C |
11228 | 11227 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11229 | 11228 | /** @noinspection UnnecessaryCastingInspection */ |
11230 | - $str = (string) \transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11229 | + $str = (string)\transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11231 | 11230 | |
11232 | 11231 | // check again, if we only have ASCII, now ... |
11233 | 11232 | if (self::is_ascii($str) === true) { |
@@ -11351,7 +11350,7 @@ discard block |
||
11351 | 11350 | public static function to_boolean($str): bool |
11352 | 11351 | { |
11353 | 11352 | // init |
11354 | - $str = (string) $str; |
|
11353 | + $str = (string)$str; |
|
11355 | 11354 | |
11356 | 11355 | if ($str === '') { |
11357 | 11356 | return false; |
@@ -11379,10 +11378,10 @@ discard block |
||
11379 | 11378 | } |
11380 | 11379 | |
11381 | 11380 | if (\is_numeric($str)) { |
11382 | - return ((float) $str + 0) > 0; |
|
11381 | + return ((float)$str + 0) > 0; |
|
11383 | 11382 | } |
11384 | 11383 | |
11385 | - return (bool) \trim($str); |
|
11384 | + return (bool)\trim($str); |
|
11386 | 11385 | } |
11387 | 11386 | |
11388 | 11387 | /** |
@@ -11403,11 +11402,11 @@ discard block |
||
11403 | 11402 | |
11404 | 11403 | $fallback_char_escaped = \preg_quote($fallback_char, '/'); |
11405 | 11404 | |
11406 | - $string = (string) \preg_replace( |
|
11405 | + $string = (string)\preg_replace( |
|
11407 | 11406 | [ |
11408 | - '/[^' . $fallback_char_escaped . '\\.\\-a-zA-Z0-9\\s]/', // 1) remove un-needed chars |
|
11409 | - '/[\\s]+/u', // 2) convert spaces to $fallback_char |
|
11410 | - '/[' . $fallback_char_escaped . ']+/u', // 3) remove double $fallback_char's |
|
11407 | + '/[^'.$fallback_char_escaped.'\\.\\-a-zA-Z0-9\\s]/', // 1) remove un-needed chars |
|
11408 | + '/[\\s]+/u', // 2) convert spaces to $fallback_char |
|
11409 | + '/['.$fallback_char_escaped.']+/u', // 3) remove double $fallback_char's |
|
11411 | 11410 | ], |
11412 | 11411 | [ |
11413 | 11412 | '', |
@@ -11438,7 +11437,7 @@ discard block |
||
11438 | 11437 | return $str; |
11439 | 11438 | } |
11440 | 11439 | |
11441 | - $str = (string) $str; |
|
11440 | + $str = (string)$str; |
|
11442 | 11441 | if ($str === '') { |
11443 | 11442 | return ''; |
11444 | 11443 | } |
@@ -11485,7 +11484,7 @@ discard block |
||
11485 | 11484 | return $str; |
11486 | 11485 | } |
11487 | 11486 | |
11488 | - $str = (string) $str; |
|
11487 | + $str = (string)$str; |
|
11489 | 11488 | if ($str === '') { |
11490 | 11489 | return $str; |
11491 | 11490 | } |
@@ -11503,7 +11502,7 @@ discard block |
||
11503 | 11502 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
11504 | 11503 | |
11505 | 11504 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11506 | - $buf .= $c1 . $c2; |
|
11505 | + $buf .= $c1.$c2; |
|
11507 | 11506 | ++$i; |
11508 | 11507 | } else { // not valid UTF8 - convert it |
11509 | 11508 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11514,7 +11513,7 @@ discard block |
||
11514 | 11513 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
11515 | 11514 | |
11516 | 11515 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11517 | - $buf .= $c1 . $c2 . $c3; |
|
11516 | + $buf .= $c1.$c2.$c3; |
|
11518 | 11517 | $i += 2; |
11519 | 11518 | } else { // not valid UTF8 - convert it |
11520 | 11519 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11526,7 +11525,7 @@ discard block |
||
11526 | 11525 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
11527 | 11526 | |
11528 | 11527 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11529 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
11528 | + $buf .= $c1.$c2.$c3.$c4; |
|
11530 | 11529 | $i += 3; |
11531 | 11530 | } else { // not valid UTF8 - convert it |
11532 | 11531 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11552,13 +11551,13 @@ discard block |
||
11552 | 11551 | * |
11553 | 11552 | * @return string |
11554 | 11553 | */ |
11555 | - static function (array $matches): string { |
|
11554 | + static function(array $matches): string { |
|
11556 | 11555 | if (isset($matches[3])) { |
11557 | - $cp = (int) \hexdec($matches[3]); |
|
11556 | + $cp = (int)\hexdec($matches[3]); |
|
11558 | 11557 | } else { |
11559 | 11558 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
11560 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
11561 | - + (int) \hexdec($matches[2]) |
|
11559 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
11560 | + + (int)\hexdec($matches[2]) |
|
11562 | 11561 | + 0x10000 |
11563 | 11562 | - (0xD800 << 10) |
11564 | 11563 | - 0xDC00; |
@@ -11569,12 +11568,12 @@ discard block |
||
11569 | 11568 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
11570 | 11569 | |
11571 | 11570 | if ($cp < 0x80) { |
11572 | - return (string) self::chr($cp); |
|
11571 | + return (string)self::chr($cp); |
|
11573 | 11572 | } |
11574 | 11573 | |
11575 | 11574 | if ($cp < 0xA0) { |
11576 | 11575 | /** @noinspection UnnecessaryCastingInspection */ |
11577 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
11576 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
11578 | 11577 | } |
11579 | 11578 | |
11580 | 11579 | return self::decimal_to_chr($cp); |
@@ -11622,7 +11621,7 @@ discard block |
||
11622 | 11621 | |
11623 | 11622 | if (self::$SUPPORT['mbstring'] === true) { |
11624 | 11623 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11625 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
11624 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
11626 | 11625 | } |
11627 | 11626 | |
11628 | 11627 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -11659,15 +11658,15 @@ discard block |
||
11659 | 11658 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
11660 | 11659 | |
11661 | 11660 | if ($encoding === 'UTF-8') { |
11662 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
11661 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
11663 | 11662 | |
11664 | 11663 | if ($useMbFunction === true) { |
11665 | 11664 | $strPartOne = \mb_strtoupper( |
11666 | - (string) \mb_substr($str, 0, 1) |
|
11665 | + (string)\mb_substr($str, 0, 1) |
|
11667 | 11666 | ); |
11668 | 11667 | } else { |
11669 | 11668 | $strPartOne = self::strtoupper( |
11670 | - (string) \mb_substr($str, 0, 1), |
|
11669 | + (string)\mb_substr($str, 0, 1), |
|
11671 | 11670 | $encoding, |
11672 | 11671 | false, |
11673 | 11672 | $lang, |
@@ -11677,16 +11676,16 @@ discard block |
||
11677 | 11676 | } else { |
11678 | 11677 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11679 | 11678 | |
11680 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
11679 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
11681 | 11680 | |
11682 | 11681 | if ($useMbFunction === true) { |
11683 | 11682 | $strPartOne = \mb_strtoupper( |
11684 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
11683 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
11685 | 11684 | $encoding |
11686 | 11685 | ); |
11687 | 11686 | } else { |
11688 | 11687 | $strPartOne = self::strtoupper( |
11689 | - (string) self::substr($str, 0, 1, $encoding), |
|
11688 | + (string)self::substr($str, 0, 1, $encoding), |
|
11690 | 11689 | $encoding, |
11691 | 11690 | false, |
11692 | 11691 | $lang, |
@@ -11695,7 +11694,7 @@ discard block |
||
11695 | 11694 | } |
11696 | 11695 | } |
11697 | 11696 | |
11698 | - return $strPartOne . $strPartTwo; |
|
11697 | + return $strPartOne.$strPartTwo; |
|
11699 | 11698 | } |
11700 | 11699 | |
11701 | 11700 | /** |
@@ -11746,7 +11745,7 @@ discard block |
||
11746 | 11745 | $str = self::clean($str); |
11747 | 11746 | } |
11748 | 11747 | |
11749 | - $usePhpDefaultFunctions = !(bool) ($charlist . \implode('', $exceptions)); |
|
11748 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
11750 | 11749 | |
11751 | 11750 | if ( |
11752 | 11751 | $usePhpDefaultFunctions === true |
@@ -12133,7 +12132,7 @@ discard block |
||
12133 | 12132 | if ( |
12134 | 12133 | $keepUtf8Chars === true |
12135 | 12134 | && |
12136 | - self::strlen($return) >= (int) self::strlen($str_backup) |
|
12135 | + self::strlen($return) >= (int)self::strlen($str_backup) |
|
12137 | 12136 | ) { |
12138 | 12137 | return $str_backup; |
12139 | 12138 | } |
@@ -12209,17 +12208,17 @@ discard block |
||
12209 | 12208 | return ''; |
12210 | 12209 | } |
12211 | 12210 | |
12212 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
12211 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
12213 | 12212 | |
12214 | 12213 | if ( |
12215 | 12214 | !isset($matches[0]) |
12216 | 12215 | || |
12217 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
12216 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
12218 | 12217 | ) { |
12219 | 12218 | return $str; |
12220 | 12219 | } |
12221 | 12220 | |
12222 | - return \rtrim($matches[0]) . $strAddOn; |
|
12221 | + return \rtrim($matches[0]).$strAddOn; |
|
12223 | 12222 | } |
12224 | 12223 | |
12225 | 12224 | /** |
@@ -12306,7 +12305,7 @@ discard block |
||
12306 | 12305 | } |
12307 | 12306 | } |
12308 | 12307 | |
12309 | - return $strReturn . \implode('', $chars); |
|
12308 | + return $strReturn.\implode('', $chars); |
|
12310 | 12309 | } |
12311 | 12310 | |
12312 | 12311 | /** |
@@ -12358,7 +12357,7 @@ discard block |
||
12358 | 12357 | $finalBreak = ''; |
12359 | 12358 | } |
12360 | 12359 | |
12361 | - return \implode($delimiter ?? "\n", $stringArray) . $finalBreak; |
|
12360 | + return \implode($delimiter ?? "\n", $stringArray).$finalBreak; |
|
12362 | 12361 | } |
12363 | 12362 | |
12364 | 12363 | /** |
@@ -12425,7 +12424,7 @@ discard block |
||
12425 | 12424 | /** @noinspection PhpIncludeInspection */ |
12426 | 12425 | /** @noinspection UsingInclusionReturnValueInspection */ |
12427 | 12426 | /** @psalm-suppress UnresolvableInclude */ |
12428 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
12427 | + return include __DIR__.'/data/'.$file.'.php'; |
|
12429 | 12428 | } |
12430 | 12429 | |
12431 | 12430 | /** |
@@ -12437,7 +12436,7 @@ discard block |
||
12437 | 12436 | */ |
12438 | 12437 | private static function getDataIfExists(string $file) |
12439 | 12438 | { |
12440 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
12439 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
12441 | 12440 | if (\file_exists($file)) { |
12442 | 12441 | /** @noinspection PhpIncludeInspection */ |
12443 | 12442 | /** @noinspection UsingInclusionReturnValueInspection */ |
@@ -12459,7 +12458,7 @@ discard block |
||
12459 | 12458 | |
12460 | 12459 | \uksort( |
12461 | 12460 | self::$EMOJI, |
12462 | - static function (string $a, string $b): int { |
|
12461 | + static function(string $a, string $b): int { |
|
12463 | 12462 | return \strlen($b) <=> \strlen($a); |
12464 | 12463 | } |
12465 | 12464 | ); |
@@ -12469,7 +12468,7 @@ discard block |
||
12469 | 12468 | |
12470 | 12469 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
12471 | 12470 | $tmpKey = \crc32($key); |
12472 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmpKey . '_-_' . \strrev((string) $tmpKey) . '_-_8FTU_ELBATROP_-_'; |
|
12471 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmpKey.'_-_'.\strrev((string)$tmpKey).'_-_8FTU_ELBATROP_-_'; |
|
12473 | 12472 | } |
12474 | 12473 | |
12475 | 12474 | return true; |
@@ -12493,7 +12492,7 @@ discard block |
||
12493 | 12492 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
12494 | 12493 | return \defined('MB_OVERLOAD_STRING') |
12495 | 12494 | && |
12496 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12495 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12497 | 12496 | } |
12498 | 12497 | |
12499 | 12498 | /** |
@@ -12543,7 +12542,7 @@ discard block |
||
12543 | 12542 | { |
12544 | 12543 | static $RX_CLASS_CACHE = []; |
12545 | 12544 | |
12546 | - $cacheKey = $s . $class; |
|
12545 | + $cacheKey = $s.$class; |
|
12547 | 12546 | |
12548 | 12547 | if (isset($RX_CLASS_CACHE[$cacheKey])) { |
12549 | 12548 | return $RX_CLASS_CACHE[$cacheKey]; |
@@ -12555,7 +12554,7 @@ discard block |
||
12555 | 12554 | /** @noinspection AlterInForeachInspection */ |
12556 | 12555 | foreach (self::str_split($s) as &$s) { |
12557 | 12556 | if ($s === '-') { |
12558 | - $classArray[0] = '-' . $classArray[0]; |
|
12557 | + $classArray[0] = '-'.$classArray[0]; |
|
12559 | 12558 | } elseif (!isset($s[2])) { |
12560 | 12559 | $classArray[0] .= \preg_quote($s, '/'); |
12561 | 12560 | } elseif (self::strlen($s) === 1) { |
@@ -12566,13 +12565,13 @@ discard block |
||
12566 | 12565 | } |
12567 | 12566 | |
12568 | 12567 | if ($classArray[0]) { |
12569 | - $classArray[0] = '[' . $classArray[0] . ']'; |
|
12568 | + $classArray[0] = '['.$classArray[0].']'; |
|
12570 | 12569 | } |
12571 | 12570 | |
12572 | 12571 | if (\count($classArray) === 1) { |
12573 | 12572 | $return = $classArray[0]; |
12574 | 12573 | } else { |
12575 | - $return = '(?:' . \implode('|', $classArray) . ')'; |
|
12574 | + $return = '(?:'.\implode('|', $classArray).')'; |
|
12576 | 12575 | } |
12577 | 12576 | |
12578 | 12577 | $RX_CLASS_CACHE[$cacheKey] = $return; |
@@ -12647,7 +12646,7 @@ discard block |
||
12647 | 12646 | |
12648 | 12647 | if ($delimiter === '-') { |
12649 | 12648 | /** @noinspection AlterInForeachInspection */ |
12650 | - foreach ((array) $specialCases['names'] as &$beginning) { |
|
12649 | + foreach ((array)$specialCases['names'] as &$beginning) { |
|
12651 | 12650 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12652 | 12651 | $continue = true; |
12653 | 12652 | } |
@@ -12655,7 +12654,7 @@ discard block |
||
12655 | 12654 | } |
12656 | 12655 | |
12657 | 12656 | /** @noinspection AlterInForeachInspection */ |
12658 | - foreach ((array) $specialCases['prefixes'] as &$beginning) { |
|
12657 | + foreach ((array)$specialCases['prefixes'] as &$beginning) { |
|
12659 | 12658 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12660 | 12659 | $continue = true; |
12661 | 12660 | } |
@@ -12715,8 +12714,8 @@ discard block |
||
12715 | 12714 | } else { |
12716 | 12715 | /** @noinspection OffsetOperationsInspection */ |
12717 | 12716 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
12718 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
12719 | - $buf .= $cc1 . $cc2; |
|
12717 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
12718 | + $buf .= $cc1.$cc2; |
|
12720 | 12719 | } |
12721 | 12720 | |
12722 | 12721 | return $buf; |
@@ -12731,7 +12730,7 @@ discard block |
||
12731 | 12730 | { |
12732 | 12731 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
12733 | 12732 | if (\preg_match($pattern, $str)) { |
12734 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
12733 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
12735 | 12734 | } |
12736 | 12735 | |
12737 | 12736 | return $str; |