@@ -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; |
@@ -2148,7 +2148,7 @@ discard block |
||
2148 | 2148 | return $fallback; |
2149 | 2149 | } |
2150 | 2150 | /** @noinspection OffsetOperationsInspection */ |
2151 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2151 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2152 | 2152 | |
2153 | 2153 | // DEBUG |
2154 | 2154 | //var_dump($type_code); |
@@ -2203,7 +2203,7 @@ discard block |
||
2203 | 2203 | // |
2204 | 2204 | |
2205 | 2205 | if ($encoding === 'UTF-8') { |
2206 | - $maxlength = (int) \mb_strlen($possibleChars); |
|
2206 | + $maxlength = (int)\mb_strlen($possibleChars); |
|
2207 | 2207 | if ($maxlength === 0) { |
2208 | 2208 | return ''; |
2209 | 2209 | } |
@@ -2224,7 +2224,7 @@ discard block |
||
2224 | 2224 | } else { |
2225 | 2225 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2226 | 2226 | |
2227 | - $maxlength = (int) self::strlen($possibleChars, $encoding); |
|
2227 | + $maxlength = (int)self::strlen($possibleChars, $encoding); |
|
2228 | 2228 | if ($maxlength === 0) { |
2229 | 2229 | return ''; |
2230 | 2230 | } |
@@ -2255,16 +2255,16 @@ discard block |
||
2255 | 2255 | */ |
2256 | 2256 | public static function get_unique_string($entropyExtra = '', bool $md5 = true): string |
2257 | 2257 | { |
2258 | - $uniqueHelper = \random_int(0, \mt_getrandmax()) . |
|
2259 | - \session_id() . |
|
2260 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2261 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2258 | + $uniqueHelper = \random_int(0, \mt_getrandmax()). |
|
2259 | + \session_id(). |
|
2260 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2261 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2262 | 2262 | $entropyExtra; |
2263 | 2263 | |
2264 | 2264 | $uniqueString = \uniqid($uniqueHelper, true); |
2265 | 2265 | |
2266 | 2266 | if ($md5) { |
2267 | - $uniqueString = \md5($uniqueString . $uniqueHelper); |
|
2267 | + $uniqueString = \md5($uniqueString.$uniqueHelper); |
|
2268 | 2268 | } |
2269 | 2269 | |
2270 | 2270 | return $uniqueString; |
@@ -2343,7 +2343,7 @@ discard block |
||
2343 | 2343 | public static function hex_to_int($hexDec) |
2344 | 2344 | { |
2345 | 2345 | // init |
2346 | - $hexDec = (string) $hexDec; |
|
2346 | + $hexDec = (string)$hexDec; |
|
2347 | 2347 | |
2348 | 2348 | if ($hexDec === '') { |
2349 | 2349 | return false; |
@@ -2421,7 +2421,7 @@ discard block |
||
2421 | 2421 | return \implode( |
2422 | 2422 | '', |
2423 | 2423 | \array_map( |
2424 | - static function (string $chr) use ($keepAsciiChars, $encoding): string { |
|
2424 | + static function(string $chr) use ($keepAsciiChars, $encoding): string { |
|
2425 | 2425 | return self::single_chr_html_encode($chr, $keepAsciiChars, $encoding); |
2426 | 2426 | }, |
2427 | 2427 | self::str_split($str) |
@@ -2525,7 +2525,7 @@ discard block |
||
2525 | 2525 | && |
2526 | 2526 | self::$SUPPORT['mbstring'] === false |
2527 | 2527 | ) { |
2528 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2528 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2529 | 2529 | } |
2530 | 2530 | |
2531 | 2531 | do { |
@@ -2546,14 +2546,14 @@ discard block |
||
2546 | 2546 | ); |
2547 | 2547 | } |
2548 | 2548 | } else { |
2549 | - $str = (string) \preg_replace_callback( |
|
2549 | + $str = (string)\preg_replace_callback( |
|
2550 | 2550 | "/&#\d{2,6};/", |
2551 | 2551 | /** |
2552 | 2552 | * @param string[] $matches |
2553 | 2553 | * |
2554 | 2554 | * @return string |
2555 | 2555 | */ |
2556 | - static function (array $matches) use ($encoding): string { |
|
2556 | + static function(array $matches) use ($encoding): string { |
|
2557 | 2557 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
2558 | 2558 | if ($returnTmp !== '"' && $returnTmp !== "'") { |
2559 | 2559 | return $returnTmp; |
@@ -2568,7 +2568,7 @@ discard block |
||
2568 | 2568 | if (\strpos($str, '&') !== false) { |
2569 | 2569 | if (\strpos($str, '&#') !== false) { |
2570 | 2570 | // decode also numeric & UTF16 two byte entities |
2571 | - $str = (string) \preg_replace( |
|
2571 | + $str = (string)\preg_replace( |
|
2572 | 2572 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
2573 | 2573 | '$1;', |
2574 | 2574 | $str |
@@ -2614,7 +2614,7 @@ discard block |
||
2614 | 2614 | */ |
2615 | 2615 | public static function html_stripe_empty_tags(string $str): string |
2616 | 2616 | { |
2617 | - return (string) \preg_replace( |
|
2617 | + return (string)\preg_replace( |
|
2618 | 2618 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
2619 | 2619 | '', |
2620 | 2620 | $str |
@@ -2913,9 +2913,9 @@ discard block |
||
2913 | 2913 | { |
2914 | 2914 | $hex = \dechex($int); |
2915 | 2915 | |
2916 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
2916 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
2917 | 2917 | |
2918 | - return $pfix . $hex . ''; |
|
2918 | + return $pfix.$hex.''; |
|
2919 | 2919 | } |
2920 | 2920 | |
2921 | 2921 | /** |
@@ -3173,7 +3173,7 @@ discard block |
||
3173 | 3173 | */ |
3174 | 3174 | public static function is_binary($input, bool $strict = false): bool |
3175 | 3175 | { |
3176 | - $input = (string) $input; |
|
3176 | + $input = (string)$input; |
|
3177 | 3177 | if ($input === '') { |
3178 | 3178 | return false; |
3179 | 3179 | } |
@@ -3434,7 +3434,7 @@ discard block |
||
3434 | 3434 | public static function is_utf16($str, $checkIfStringIsBinary = true) |
3435 | 3435 | { |
3436 | 3436 | // init |
3437 | - $str = (string) $str; |
|
3437 | + $str = (string)$str; |
|
3438 | 3438 | $strChars = []; |
3439 | 3439 | |
3440 | 3440 | if ( |
@@ -3512,7 +3512,7 @@ discard block |
||
3512 | 3512 | public static function is_utf32($str, $checkIfStringIsBinary = true) |
3513 | 3513 | { |
3514 | 3514 | // init |
3515 | - $str = (string) $str; |
|
3515 | + $str = (string)$str; |
|
3516 | 3516 | $strChars = []; |
3517 | 3517 | |
3518 | 3518 | if ( |
@@ -3596,7 +3596,7 @@ discard block |
||
3596 | 3596 | return true; |
3597 | 3597 | } |
3598 | 3598 | |
3599 | - return self::is_utf8_string((string) $str, $strict); |
|
3599 | + return self::is_utf8_string((string)$str, $strict); |
|
3600 | 3600 | } |
3601 | 3601 | |
3602 | 3602 | /** |
@@ -3736,15 +3736,15 @@ discard block |
||
3736 | 3736 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
3737 | 3737 | |
3738 | 3738 | if ($encoding === 'UTF-8') { |
3739 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
3739 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
3740 | 3740 | |
3741 | 3741 | if ($useMbFunction === true) { |
3742 | 3742 | $strPartOne = \mb_strtolower( |
3743 | - (string) \mb_substr($str, 0, 1) |
|
3743 | + (string)\mb_substr($str, 0, 1) |
|
3744 | 3744 | ); |
3745 | 3745 | } else { |
3746 | 3746 | $strPartOne = self::strtolower( |
3747 | - (string) \mb_substr($str, 0, 1), |
|
3747 | + (string)\mb_substr($str, 0, 1), |
|
3748 | 3748 | $encoding, |
3749 | 3749 | false, |
3750 | 3750 | $lang, |
@@ -3754,10 +3754,10 @@ discard block |
||
3754 | 3754 | } else { |
3755 | 3755 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
3756 | 3756 | |
3757 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
3757 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
3758 | 3758 | |
3759 | 3759 | $strPartOne = self::strtolower( |
3760 | - (string) self::substr($str, 0, 1, $encoding), |
|
3760 | + (string)self::substr($str, 0, 1, $encoding), |
|
3761 | 3761 | $encoding, |
3762 | 3762 | false, |
3763 | 3763 | $lang, |
@@ -3765,7 +3765,7 @@ discard block |
||
3765 | 3765 | ); |
3766 | 3766 | } |
3767 | 3767 | |
3768 | - return $strPartOne . $strPartTwo; |
|
3768 | + return $strPartOne.$strPartTwo; |
|
3769 | 3769 | } |
3770 | 3770 | |
3771 | 3771 | /** |
@@ -3884,7 +3884,7 @@ discard block |
||
3884 | 3884 | |
3885 | 3885 | if (self::$SUPPORT['mbstring'] === true) { |
3886 | 3886 | /** @noinspection PhpComposerExtensionStubsInspection */ |
3887 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
3887 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
3888 | 3888 | } |
3889 | 3889 | |
3890 | 3890 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -3925,7 +3925,7 @@ discard block |
||
3925 | 3925 | { |
3926 | 3926 | $bytes = self::chr_size_list($str); |
3927 | 3927 | if (\count($bytes) > 0) { |
3928 | - return (int) \max($bytes); |
|
3928 | + return (int)\max($bytes); |
|
3929 | 3929 | } |
3930 | 3930 | |
3931 | 3931 | return 0; |
@@ -3994,7 +3994,7 @@ discard block |
||
3994 | 3994 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
3995 | 3995 | |
3996 | 3996 | // init |
3997 | - $encoding = (string) $encoding; |
|
3997 | + $encoding = (string)$encoding; |
|
3998 | 3998 | |
3999 | 3999 | if (!$encoding) { |
4000 | 4000 | return $fallback; |
@@ -4048,7 +4048,7 @@ discard block |
||
4048 | 4048 | |
4049 | 4049 | $encodingOrig = $encoding; |
4050 | 4050 | $encoding = \strtoupper($encoding); |
4051 | - $encodingUpperHelper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4051 | + $encodingUpperHelper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4052 | 4052 | |
4053 | 4053 | $equivalences = [ |
4054 | 4054 | 'ISO8859' => 'ISO-8859-1', |
@@ -4206,7 +4206,7 @@ discard block |
||
4206 | 4206 | } |
4207 | 4207 | |
4208 | 4208 | static $WHITESPACE_CACHE = []; |
4209 | - $cacheKey = (int) $keepNonBreakingSpace; |
|
4209 | + $cacheKey = (int)$keepNonBreakingSpace; |
|
4210 | 4210 | |
4211 | 4211 | if (!isset($WHITESPACE_CACHE[$cacheKey])) { |
4212 | 4212 | $WHITESPACE_CACHE[$cacheKey] = self::$WHITESPACE_TABLE; |
@@ -4248,13 +4248,13 @@ discard block |
||
4248 | 4248 | static $CHAR_CACHE = []; |
4249 | 4249 | |
4250 | 4250 | // init |
4251 | - $chr = (string) $chr; |
|
4251 | + $chr = (string)$chr; |
|
4252 | 4252 | |
4253 | 4253 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4254 | 4254 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4255 | 4255 | } |
4256 | 4256 | |
4257 | - $cacheKey = $chr . $encoding; |
|
4257 | + $cacheKey = $chr.$encoding; |
|
4258 | 4258 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
4259 | 4259 | return $CHAR_CACHE[$cacheKey]; |
4260 | 4260 | } |
@@ -4289,7 +4289,7 @@ discard block |
||
4289 | 4289 | // |
4290 | 4290 | |
4291 | 4291 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
4292 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
4292 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
4293 | 4293 | /** @noinspection OffsetOperationsInspection */ |
4294 | 4294 | $code = $chr ? $chr[1] : 0; |
4295 | 4295 | |
@@ -4297,21 +4297,21 @@ discard block |
||
4297 | 4297 | if ($code >= 0xF0 && isset($chr[4])) { |
4298 | 4298 | /** @noinspection UnnecessaryCastingInspection */ |
4299 | 4299 | /** @noinspection OffsetOperationsInspection */ |
4300 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4300 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4301 | 4301 | } |
4302 | 4302 | |
4303 | 4303 | /** @noinspection OffsetOperationsInspection */ |
4304 | 4304 | if ($code >= 0xE0 && isset($chr[3])) { |
4305 | 4305 | /** @noinspection UnnecessaryCastingInspection */ |
4306 | 4306 | /** @noinspection OffsetOperationsInspection */ |
4307 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4307 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4308 | 4308 | } |
4309 | 4309 | |
4310 | 4310 | /** @noinspection OffsetOperationsInspection */ |
4311 | 4311 | if ($code >= 0xC0 && isset($chr[2])) { |
4312 | 4312 | /** @noinspection UnnecessaryCastingInspection */ |
4313 | 4313 | /** @noinspection OffsetOperationsInspection */ |
4314 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4314 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4315 | 4315 | } |
4316 | 4316 | |
4317 | 4317 | return $CHAR_CACHE[$cacheKey] = $code; |
@@ -4360,7 +4360,7 @@ discard block |
||
4360 | 4360 | public static function pcre_utf8_support(): bool |
4361 | 4361 | { |
4362 | 4362 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4363 | - return (bool) @\preg_match('//u', ''); |
|
4363 | + return (bool)@\preg_match('//u', ''); |
|
4364 | 4364 | } |
4365 | 4365 | |
4366 | 4366 | /** |
@@ -4392,11 +4392,11 @@ discard block |
||
4392 | 4392 | |
4393 | 4393 | if ($step !== 1) { |
4394 | 4394 | if (!\is_numeric($step)) { |
4395 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
4395 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
4396 | 4396 | } |
4397 | 4397 | |
4398 | 4398 | if ($step <= 0) { |
4399 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
4399 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
4400 | 4400 | } |
4401 | 4401 | } |
4402 | 4402 | |
@@ -4408,14 +4408,14 @@ discard block |
||
4408 | 4408 | $is_xdigit = false; |
4409 | 4409 | |
4410 | 4410 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4411 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
4411 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
4412 | 4412 | $is_digit = true; |
4413 | - $start = (int) $var1; |
|
4413 | + $start = (int)$var1; |
|
4414 | 4414 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
4415 | 4415 | $is_xdigit = true; |
4416 | - $start = (int) self::hex_to_int($var1); |
|
4416 | + $start = (int)self::hex_to_int($var1); |
|
4417 | 4417 | } elseif (!$use_ctype && \is_numeric($var1)) { |
4418 | - $start = (int) $var1; |
|
4418 | + $start = (int)$var1; |
|
4419 | 4419 | } else { |
4420 | 4420 | $start = self::ord($var1); |
4421 | 4421 | } |
@@ -4425,11 +4425,11 @@ discard block |
||
4425 | 4425 | } |
4426 | 4426 | |
4427 | 4427 | if ($is_digit) { |
4428 | - $end = (int) $var2; |
|
4428 | + $end = (int)$var2; |
|
4429 | 4429 | } elseif ($is_xdigit) { |
4430 | - $end = (int) self::hex_to_int($var2); |
|
4430 | + $end = (int)self::hex_to_int($var2); |
|
4431 | 4431 | } elseif (!$use_ctype && \is_numeric($var2)) { |
4432 | - $end = (int) $var2; |
|
4432 | + $end = (int)$var2; |
|
4433 | 4433 | } else { |
4434 | 4434 | $end = self::ord($var2); |
4435 | 4435 | } |
@@ -4440,7 +4440,7 @@ discard block |
||
4440 | 4440 | |
4441 | 4441 | $array = []; |
4442 | 4442 | foreach (\range($start, $end, $step) as $i) { |
4443 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
4443 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
4444 | 4444 | } |
4445 | 4445 | |
4446 | 4446 | return $array; |
@@ -4531,8 +4531,8 @@ discard block |
||
4531 | 4531 | $delimiter = '/'; |
4532 | 4532 | } |
4533 | 4533 | |
4534 | - return (string) \preg_replace( |
|
4535 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4534 | + return (string)\preg_replace( |
|
4535 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4536 | 4536 | $replacement, |
4537 | 4537 | $str |
4538 | 4538 | ); |
@@ -4574,9 +4574,9 @@ discard block |
||
4574 | 4574 | return ''; |
4575 | 4575 | } |
4576 | 4576 | |
4577 | - $strLength -= (int) $bomByteLength; |
|
4577 | + $strLength -= (int)$bomByteLength; |
|
4578 | 4578 | |
4579 | - $str = (string) $strTmp; |
|
4579 | + $str = (string)$strTmp; |
|
4580 | 4580 | } |
4581 | 4581 | } |
4582 | 4582 | |
@@ -4600,7 +4600,7 @@ discard block |
||
4600 | 4600 | if (\is_array($what) === true) { |
4601 | 4601 | /** @noinspection ForeachSourceInspection */ |
4602 | 4602 | foreach ($what as $item) { |
4603 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/u') . ')+/u', $item, $str); |
|
4603 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/u').')+/u', $item, $str); |
|
4604 | 4604 | } |
4605 | 4605 | } |
4606 | 4606 | |
@@ -4632,7 +4632,7 @@ discard block |
||
4632 | 4632 | */ |
4633 | 4633 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
4634 | 4634 | { |
4635 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4635 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4636 | 4636 | } |
4637 | 4637 | |
4638 | 4638 | /** |
@@ -4663,7 +4663,7 @@ discard block |
||
4663 | 4663 | $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
4664 | 4664 | |
4665 | 4665 | do { |
4666 | - $str = (string) \preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4666 | + $str = (string)\preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4667 | 4667 | } while ($count !== 0); |
4668 | 4668 | |
4669 | 4669 | return $str; |
@@ -4682,17 +4682,17 @@ discard block |
||
4682 | 4682 | { |
4683 | 4683 | if ($substring && \strpos($str, $substring) === 0) { |
4684 | 4684 | if ($encoding === 'UTF-8') { |
4685 | - return (string) \mb_substr( |
|
4685 | + return (string)\mb_substr( |
|
4686 | 4686 | $str, |
4687 | - (int) \mb_strlen($substring) |
|
4687 | + (int)\mb_strlen($substring) |
|
4688 | 4688 | ); |
4689 | 4689 | } |
4690 | 4690 | |
4691 | 4691 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4692 | 4692 | |
4693 | - return (string) self::substr( |
|
4693 | + return (string)self::substr( |
|
4694 | 4694 | $str, |
4695 | - (int) self::strlen($substring, $encoding), |
|
4695 | + (int)self::strlen($substring, $encoding), |
|
4696 | 4696 | null, |
4697 | 4697 | $encoding |
4698 | 4698 | ); |
@@ -4714,19 +4714,19 @@ discard block |
||
4714 | 4714 | { |
4715 | 4715 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
4716 | 4716 | if ($encoding === 'UTF-8') { |
4717 | - return (string) \mb_substr( |
|
4717 | + return (string)\mb_substr( |
|
4718 | 4718 | $str, |
4719 | 4719 | 0, |
4720 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
4720 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
4721 | 4721 | ); |
4722 | 4722 | } |
4723 | 4723 | |
4724 | 4724 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4725 | 4725 | |
4726 | - return (string) self::substr( |
|
4726 | + return (string)self::substr( |
|
4727 | 4727 | $str, |
4728 | 4728 | 0, |
4729 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
4729 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
4730 | 4730 | $encoding |
4731 | 4731 | ); |
4732 | 4732 | } |
@@ -4810,7 +4810,7 @@ discard block |
||
4810 | 4810 | $save = \mb_substitute_character(); |
4811 | 4811 | \mb_substitute_character($replacementCharHelper); |
4812 | 4812 | // the polyfill maybe return false, so cast to string |
4813 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4813 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4814 | 4814 | \mb_substitute_character($save); |
4815 | 4815 | } |
4816 | 4816 | |
@@ -4850,7 +4850,7 @@ discard block |
||
4850 | 4850 | |
4851 | 4851 | if (self::$SUPPORT['mbstring'] === true) { |
4852 | 4852 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4853 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4853 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4854 | 4854 | } |
4855 | 4855 | |
4856 | 4856 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -4865,7 +4865,7 @@ discard block |
||
4865 | 4865 | { |
4866 | 4866 | echo '<pre>'; |
4867 | 4867 | foreach (self::$SUPPORT as $key => &$value) { |
4868 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
4868 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
4869 | 4869 | } |
4870 | 4870 | unset($value); |
4871 | 4871 | echo '</pre>'; |
@@ -4894,7 +4894,7 @@ discard block |
||
4894 | 4894 | return $char; |
4895 | 4895 | } |
4896 | 4896 | |
4897 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
4897 | + return '&#'.self::ord($char, $encoding).';'; |
|
4898 | 4898 | } |
4899 | 4899 | |
4900 | 4900 | /** |
@@ -4985,18 +4985,18 @@ discard block |
||
4985 | 4985 | $lang, |
4986 | 4986 | $tryToKeepStringLength |
4987 | 4987 | ); |
4988 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
4988 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
4989 | 4989 | |
4990 | 4990 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
4991 | 4991 | |
4992 | - $str = (string) \preg_replace_callback( |
|
4992 | + $str = (string)\preg_replace_callback( |
|
4993 | 4993 | '/[-_\\s]+(.)?/u', |
4994 | 4994 | /** |
4995 | 4995 | * @param array $match |
4996 | 4996 | * |
4997 | 4997 | * @return string |
4998 | 4998 | */ |
4999 | - static function (array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
4999 | + static function(array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5000 | 5000 | if (isset($match[1])) { |
5001 | 5001 | if ($useMbFunction === true) { |
5002 | 5002 | if ($encoding === 'UTF-8') { |
@@ -5014,14 +5014,14 @@ discard block |
||
5014 | 5014 | $str |
5015 | 5015 | ); |
5016 | 5016 | |
5017 | - return (string) \preg_replace_callback( |
|
5017 | + return (string)\preg_replace_callback( |
|
5018 | 5018 | '/[\\p{N}]+(.)?/u', |
5019 | 5019 | /** |
5020 | 5020 | * @param array $match |
5021 | 5021 | * |
5022 | 5022 | * @return string |
5023 | 5023 | */ |
5024 | - static function (array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5024 | + static function(array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5025 | 5025 | if ($useMbFunction === true) { |
5026 | 5026 | if ($encoding === 'UTF-8') { |
5027 | 5027 | return \mb_strtoupper($match[0]); |
@@ -5199,7 +5199,7 @@ discard block |
||
5199 | 5199 | ): string { |
5200 | 5200 | if (self::$SUPPORT['mbstring'] === true) { |
5201 | 5201 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5202 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5202 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5203 | 5203 | |
5204 | 5204 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5205 | 5205 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5209,10 +5209,10 @@ discard block |
||
5209 | 5209 | } |
5210 | 5210 | |
5211 | 5211 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5212 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5212 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5213 | 5213 | } |
5214 | 5214 | |
5215 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5215 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5216 | 5216 | |
5217 | 5217 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5218 | 5218 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5221,7 +5221,7 @@ discard block |
||
5221 | 5221 | $str = self::strtolower($str, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
5222 | 5222 | } |
5223 | 5223 | |
5224 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5224 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5225 | 5225 | } |
5226 | 5226 | |
5227 | 5227 | /** |
@@ -5236,7 +5236,7 @@ discard block |
||
5236 | 5236 | public static function str_detect_encoding($str) |
5237 | 5237 | { |
5238 | 5238 | // init |
5239 | - $str = (string) $str; |
|
5239 | + $str = (string)$str; |
|
5240 | 5240 | |
5241 | 5241 | // |
5242 | 5242 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5338,7 +5338,7 @@ discard block |
||
5338 | 5338 | foreach (self::$ENCODINGS as $encodingTmp) { |
5339 | 5339 | // INFO: //IGNORE but still throw notice |
5340 | 5340 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5341 | - if ((string) @\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str) === $str) { |
|
5341 | + if ((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str) === $str) { |
|
5342 | 5342 | return $encodingTmp; |
5343 | 5343 | } |
5344 | 5344 | } |
@@ -5426,7 +5426,7 @@ discard block |
||
5426 | 5426 | return $str; |
5427 | 5427 | } |
5428 | 5428 | |
5429 | - return $substring . $str; |
|
5429 | + return $substring.$str; |
|
5430 | 5430 | } |
5431 | 5431 | |
5432 | 5432 | /** |
@@ -5680,27 +5680,27 @@ discard block |
||
5680 | 5680 | string $encoding = 'UTF-8' |
5681 | 5681 | ): string { |
5682 | 5682 | if ($encoding === 'UTF-8') { |
5683 | - $len = (int) \mb_strlen($str); |
|
5683 | + $len = (int)\mb_strlen($str); |
|
5684 | 5684 | if ($index > $len) { |
5685 | 5685 | return $str; |
5686 | 5686 | } |
5687 | 5687 | |
5688 | 5688 | /** @noinspection UnnecessaryCastingInspection */ |
5689 | - return (string) \mb_substr($str, 0, $index) . |
|
5690 | - $substring . |
|
5691 | - (string) \mb_substr($str, $index, $len); |
|
5689 | + return (string)\mb_substr($str, 0, $index). |
|
5690 | + $substring. |
|
5691 | + (string)\mb_substr($str, $index, $len); |
|
5692 | 5692 | } |
5693 | 5693 | |
5694 | 5694 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5695 | 5695 | |
5696 | - $len = (int) self::strlen($str, $encoding); |
|
5696 | + $len = (int)self::strlen($str, $encoding); |
|
5697 | 5697 | if ($index > $len) { |
5698 | 5698 | return $str; |
5699 | 5699 | } |
5700 | 5700 | |
5701 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
5702 | - $substring . |
|
5703 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5701 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
5702 | + $substring. |
|
5703 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
5704 | 5704 | } |
5705 | 5705 | |
5706 | 5706 | /** |
@@ -5730,15 +5730,15 @@ discard block |
||
5730 | 5730 | */ |
5731 | 5731 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5732 | 5732 | { |
5733 | - $search = (array) $search; |
|
5733 | + $search = (array)$search; |
|
5734 | 5734 | |
5735 | 5735 | /** @noinspection AlterInForeachInspection */ |
5736 | 5736 | foreach ($search as &$s) { |
5737 | - $s = (string) $s; |
|
5737 | + $s = (string)$s; |
|
5738 | 5738 | if ($s === '') { |
5739 | 5739 | $s = '/^(?<=.)$/'; |
5740 | 5740 | } else { |
5741 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5741 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5742 | 5742 | } |
5743 | 5743 | } |
5744 | 5744 | |
@@ -5770,11 +5770,11 @@ discard block |
||
5770 | 5770 | } |
5771 | 5771 | |
5772 | 5772 | if ($search === '') { |
5773 | - return $str . $replacement; |
|
5773 | + return $str.$replacement; |
|
5774 | 5774 | } |
5775 | 5775 | |
5776 | 5776 | if (\stripos($str, $search) === 0) { |
5777 | - return $replacement . \substr($str, \strlen($search)); |
|
5777 | + return $replacement.\substr($str, \strlen($search)); |
|
5778 | 5778 | } |
5779 | 5779 | |
5780 | 5780 | return $str; |
@@ -5802,11 +5802,11 @@ discard block |
||
5802 | 5802 | } |
5803 | 5803 | |
5804 | 5804 | if ($search === '') { |
5805 | - return $str . $replacement; |
|
5805 | + return $str.$replacement; |
|
5806 | 5806 | } |
5807 | 5807 | |
5808 | 5808 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
5809 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
5809 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
5810 | 5810 | } |
5811 | 5811 | |
5812 | 5812 | return $str; |
@@ -5883,15 +5883,15 @@ discard block |
||
5883 | 5883 | } |
5884 | 5884 | |
5885 | 5885 | if ($encoding === 'UTF-8') { |
5886 | - return (string) \mb_substr( |
|
5886 | + return (string)\mb_substr( |
|
5887 | 5887 | $str, |
5888 | - $offset + (int) \mb_strlen($separator) |
|
5888 | + $offset + (int)\mb_strlen($separator) |
|
5889 | 5889 | ); |
5890 | 5890 | } |
5891 | 5891 | |
5892 | - return (string) self::substr( |
|
5892 | + return (string)self::substr( |
|
5893 | 5893 | $str, |
5894 | - $offset + (int) self::strlen($separator, $encoding), |
|
5894 | + $offset + (int)self::strlen($separator, $encoding), |
|
5895 | 5895 | null, |
5896 | 5896 | $encoding |
5897 | 5897 | ); |
@@ -5918,15 +5918,15 @@ discard block |
||
5918 | 5918 | } |
5919 | 5919 | |
5920 | 5920 | if ($encoding === 'UTF-8') { |
5921 | - return (string) \mb_substr( |
|
5921 | + return (string)\mb_substr( |
|
5922 | 5922 | $str, |
5923 | - $offset + (int) self::strlen($separator) |
|
5923 | + $offset + (int)self::strlen($separator) |
|
5924 | 5924 | ); |
5925 | 5925 | } |
5926 | 5926 | |
5927 | - return (string) self::substr( |
|
5927 | + return (string)self::substr( |
|
5928 | 5928 | $str, |
5929 | - $offset + (int) self::strlen($separator, $encoding), |
|
5929 | + $offset + (int)self::strlen($separator, $encoding), |
|
5930 | 5930 | null, |
5931 | 5931 | $encoding |
5932 | 5932 | ); |
@@ -5953,10 +5953,10 @@ discard block |
||
5953 | 5953 | } |
5954 | 5954 | |
5955 | 5955 | if ($encoding === 'UTF-8') { |
5956 | - return (string) \mb_substr($str, 0, $offset); |
|
5956 | + return (string)\mb_substr($str, 0, $offset); |
|
5957 | 5957 | } |
5958 | 5958 | |
5959 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
5959 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
5960 | 5960 | } |
5961 | 5961 | |
5962 | 5962 | /** |
@@ -5980,7 +5980,7 @@ discard block |
||
5980 | 5980 | return ''; |
5981 | 5981 | } |
5982 | 5982 | |
5983 | - return (string) \mb_substr($str, 0, $offset); |
|
5983 | + return (string)\mb_substr($str, 0, $offset); |
|
5984 | 5984 | } |
5985 | 5985 | |
5986 | 5986 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -5988,7 +5988,7 @@ discard block |
||
5988 | 5988 | return ''; |
5989 | 5989 | } |
5990 | 5990 | |
5991 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
5991 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
5992 | 5992 | } |
5993 | 5993 | |
5994 | 5994 | /** |
@@ -6076,12 +6076,12 @@ discard block |
||
6076 | 6076 | } |
6077 | 6077 | |
6078 | 6078 | if ($encoding === 'UTF-8') { |
6079 | - return (string) \mb_substr($str, -$n); |
|
6079 | + return (string)\mb_substr($str, -$n); |
|
6080 | 6080 | } |
6081 | 6081 | |
6082 | 6082 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6083 | 6083 | |
6084 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6084 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6085 | 6085 | } |
6086 | 6086 | |
6087 | 6087 | /** |
@@ -6105,21 +6105,21 @@ discard block |
||
6105 | 6105 | } |
6106 | 6106 | |
6107 | 6107 | if ($encoding === 'UTF-8') { |
6108 | - if ((int) \mb_strlen($str) <= $length) { |
|
6108 | + if ((int)\mb_strlen($str) <= $length) { |
|
6109 | 6109 | return $str; |
6110 | 6110 | } |
6111 | 6111 | |
6112 | 6112 | /** @noinspection UnnecessaryCastingInspection */ |
6113 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($strAddOn)) . $strAddOn; |
|
6113 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($strAddOn)).$strAddOn; |
|
6114 | 6114 | } |
6115 | 6115 | |
6116 | 6116 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6117 | 6117 | |
6118 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6118 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6119 | 6119 | return $str; |
6120 | 6120 | } |
6121 | 6121 | |
6122 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($strAddOn), $encoding)) . $strAddOn; |
|
6122 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($strAddOn), $encoding)).$strAddOn; |
|
6123 | 6123 | } |
6124 | 6124 | |
6125 | 6125 | /** |
@@ -6144,12 +6144,12 @@ discard block |
||
6144 | 6144 | |
6145 | 6145 | if ($encoding === 'UTF-8') { |
6146 | 6146 | /** @noinspection UnnecessaryCastingInspection */ |
6147 | - if ((int) \mb_strlen($str) <= $length) { |
|
6147 | + if ((int)\mb_strlen($str) <= $length) { |
|
6148 | 6148 | return $str; |
6149 | 6149 | } |
6150 | 6150 | |
6151 | 6151 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6152 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6152 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6153 | 6153 | } |
6154 | 6154 | |
6155 | 6155 | $str = \mb_substr($str, 0, $length); |
@@ -6159,20 +6159,20 @@ discard block |
||
6159 | 6159 | $new_str = \implode(' ', $array); |
6160 | 6160 | |
6161 | 6161 | if ($new_str === '') { |
6162 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6162 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6163 | 6163 | } |
6164 | 6164 | } else { |
6165 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6165 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6166 | 6166 | return $str; |
6167 | 6167 | } |
6168 | 6168 | |
6169 | 6169 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6170 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6170 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6171 | 6171 | } |
6172 | 6172 | |
6173 | 6173 | $str = self::substr($str, 0, $length, $encoding); |
6174 | 6174 | if ($str === false) { |
6175 | - return '' . $strAddOn; |
|
6175 | + return ''.$strAddOn; |
|
6176 | 6176 | } |
6177 | 6177 | |
6178 | 6178 | $array = \explode(' ', $str); |
@@ -6180,11 +6180,11 @@ discard block |
||
6180 | 6180 | $new_str = \implode(' ', $array); |
6181 | 6181 | |
6182 | 6182 | if ($new_str === '') { |
6183 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6183 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6184 | 6184 | } |
6185 | 6185 | } |
6186 | 6186 | |
6187 | - return $new_str . $strAddOn; |
|
6187 | + return $new_str.$strAddOn; |
|
6188 | 6188 | } |
6189 | 6189 | |
6190 | 6190 | /** |
@@ -6202,7 +6202,7 @@ discard block |
||
6202 | 6202 | $longestCommonPrefix = ''; |
6203 | 6203 | |
6204 | 6204 | if ($encoding === 'UTF-8') { |
6205 | - $maxLength = (int) \min( |
|
6205 | + $maxLength = (int)\min( |
|
6206 | 6206 | \mb_strlen($str), |
6207 | 6207 | \mb_strlen($otherStr) |
6208 | 6208 | ); |
@@ -6223,7 +6223,7 @@ discard block |
||
6223 | 6223 | } else { |
6224 | 6224 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6225 | 6225 | |
6226 | - $maxLength = (int) \min( |
|
6226 | + $maxLength = (int)\min( |
|
6227 | 6227 | self::strlen($str, $encoding), |
6228 | 6228 | self::strlen($otherStr, $encoding) |
6229 | 6229 | ); |
@@ -6266,13 +6266,13 @@ discard block |
||
6266 | 6266 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6267 | 6267 | |
6268 | 6268 | if ($encoding === 'UTF-8') { |
6269 | - $strLength = (int) \mb_strlen($str); |
|
6270 | - $otherLength = (int) \mb_strlen($otherStr); |
|
6269 | + $strLength = (int)\mb_strlen($str); |
|
6270 | + $otherLength = (int)\mb_strlen($otherStr); |
|
6271 | 6271 | } else { |
6272 | 6272 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6273 | 6273 | |
6274 | - $strLength = (int) self::strlen($str, $encoding); |
|
6275 | - $otherLength = (int) self::strlen($otherStr, $encoding); |
|
6274 | + $strLength = (int)self::strlen($str, $encoding); |
|
6275 | + $otherLength = (int)self::strlen($otherStr, $encoding); |
|
6276 | 6276 | } |
6277 | 6277 | |
6278 | 6278 | // Return if either string is empty |
@@ -6325,10 +6325,10 @@ discard block |
||
6325 | 6325 | } |
6326 | 6326 | |
6327 | 6327 | if ($encoding === 'UTF-8') { |
6328 | - return (string) \mb_substr($str, $end - $len, $len); |
|
6328 | + return (string)\mb_substr($str, $end - $len, $len); |
|
6329 | 6329 | } |
6330 | 6330 | |
6331 | - return (string) self::substr($str, $end - $len, $len, $encoding); |
|
6331 | + return (string)self::substr($str, $end - $len, $len, $encoding); |
|
6332 | 6332 | } |
6333 | 6333 | |
6334 | 6334 | /** |
@@ -6347,7 +6347,7 @@ discard block |
||
6347 | 6347 | } |
6348 | 6348 | |
6349 | 6349 | if ($encoding === 'UTF-8') { |
6350 | - $maxLength = (int) \min( |
|
6350 | + $maxLength = (int)\min( |
|
6351 | 6351 | \mb_strlen($str, $encoding), |
6352 | 6352 | \mb_strlen($otherStr, $encoding) |
6353 | 6353 | ); |
@@ -6361,7 +6361,7 @@ discard block |
||
6361 | 6361 | && |
6362 | 6362 | $char === \mb_substr($otherStr, -$i, 1) |
6363 | 6363 | ) { |
6364 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6364 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6365 | 6365 | } else { |
6366 | 6366 | break; |
6367 | 6367 | } |
@@ -6369,7 +6369,7 @@ discard block |
||
6369 | 6369 | } else { |
6370 | 6370 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6371 | 6371 | |
6372 | - $maxLength = (int) \min( |
|
6372 | + $maxLength = (int)\min( |
|
6373 | 6373 | self::strlen($str, $encoding), |
6374 | 6374 | self::strlen($otherStr, $encoding) |
6375 | 6375 | ); |
@@ -6383,7 +6383,7 @@ discard block |
||
6383 | 6383 | && |
6384 | 6384 | $char === self::substr($otherStr, -$i, 1, $encoding) |
6385 | 6385 | ) { |
6386 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6386 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6387 | 6387 | } else { |
6388 | 6388 | break; |
6389 | 6389 | } |
@@ -6403,7 +6403,7 @@ discard block |
||
6403 | 6403 | */ |
6404 | 6404 | public static function str_matches_pattern(string $str, string $pattern): bool |
6405 | 6405 | { |
6406 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6406 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6407 | 6407 | } |
6408 | 6408 | |
6409 | 6409 | /** |
@@ -6420,7 +6420,7 @@ discard block |
||
6420 | 6420 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6421 | 6421 | { |
6422 | 6422 | // init |
6423 | - $length = (int) self::strlen($str, $encoding); |
|
6423 | + $length = (int)self::strlen($str, $encoding); |
|
6424 | 6424 | |
6425 | 6425 | if ($offset >= 0) { |
6426 | 6426 | return $length > $offset; |
@@ -6446,7 +6446,7 @@ discard block |
||
6446 | 6446 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6447 | 6447 | { |
6448 | 6448 | // init |
6449 | - $length = (int) self::strlen($str); |
|
6449 | + $length = (int)self::strlen($str); |
|
6450 | 6450 | |
6451 | 6451 | if ( |
6452 | 6452 | ($index >= 0 && $length <= $index) |
@@ -6485,7 +6485,7 @@ discard block |
||
6485 | 6485 | return $str; |
6486 | 6486 | } |
6487 | 6487 | |
6488 | - if ($pad_type !== (int) $pad_type) { |
|
6488 | + if ($pad_type !== (int)$pad_type) { |
|
6489 | 6489 | if ($pad_type === 'left') { |
6490 | 6490 | $pad_type = \STR_PAD_LEFT; |
6491 | 6491 | } elseif ($pad_type === 'right') { |
@@ -6494,23 +6494,23 @@ discard block |
||
6494 | 6494 | $pad_type = \STR_PAD_BOTH; |
6495 | 6495 | } else { |
6496 | 6496 | throw new \InvalidArgumentException( |
6497 | - 'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6497 | + 'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6498 | 6498 | ); |
6499 | 6499 | } |
6500 | 6500 | } |
6501 | 6501 | |
6502 | 6502 | if ($encoding === 'UTF-8') { |
6503 | - $str_length = (int) \mb_strlen($str); |
|
6503 | + $str_length = (int)\mb_strlen($str); |
|
6504 | 6504 | |
6505 | 6505 | if ($pad_length >= $str_length) { |
6506 | 6506 | switch ($pad_type) { |
6507 | 6507 | case \STR_PAD_LEFT: |
6508 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6508 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6509 | 6509 | |
6510 | 6510 | $diff = ($pad_length - $str_length); |
6511 | 6511 | |
6512 | - $pre = (string) \mb_substr( |
|
6513 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6512 | + $pre = (string)\mb_substr( |
|
6513 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6514 | 6514 | 0, |
6515 | 6515 | $diff |
6516 | 6516 | ); |
@@ -6521,16 +6521,16 @@ discard block |
||
6521 | 6521 | case \STR_PAD_BOTH: |
6522 | 6522 | $diff = ($pad_length - $str_length); |
6523 | 6523 | |
6524 | - $ps_length_left = (int) \floor($diff / 2); |
|
6524 | + $ps_length_left = (int)\floor($diff / 2); |
|
6525 | 6525 | |
6526 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6526 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6527 | 6527 | |
6528 | - $pre = (string) \mb_substr( |
|
6528 | + $pre = (string)\mb_substr( |
|
6529 | 6529 | \str_repeat($pad_string, $ps_length_left), |
6530 | 6530 | 0, |
6531 | 6531 | $ps_length_left |
6532 | 6532 | ); |
6533 | - $post = (string) \mb_substr( |
|
6533 | + $post = (string)\mb_substr( |
|
6534 | 6534 | \str_repeat($pad_string, $ps_length_right), |
6535 | 6535 | 0, |
6536 | 6536 | $ps_length_right |
@@ -6540,19 +6540,19 @@ discard block |
||
6540 | 6540 | |
6541 | 6541 | case \STR_PAD_RIGHT: |
6542 | 6542 | default: |
6543 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6543 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6544 | 6544 | |
6545 | 6545 | $diff = ($pad_length - $str_length); |
6546 | 6546 | |
6547 | - $post = (string) \mb_substr( |
|
6548 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6547 | + $post = (string)\mb_substr( |
|
6548 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6549 | 6549 | 0, |
6550 | 6550 | $diff |
6551 | 6551 | ); |
6552 | 6552 | $pre = ''; |
6553 | 6553 | } |
6554 | 6554 | |
6555 | - return $pre . $str . $post; |
|
6555 | + return $pre.$str.$post; |
|
6556 | 6556 | } |
6557 | 6557 | |
6558 | 6558 | return $str; |
@@ -6560,17 +6560,17 @@ discard block |
||
6560 | 6560 | |
6561 | 6561 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6562 | 6562 | |
6563 | - $str_length = (int) self::strlen($str, $encoding); |
|
6563 | + $str_length = (int)self::strlen($str, $encoding); |
|
6564 | 6564 | |
6565 | 6565 | if ($pad_length >= $str_length) { |
6566 | 6566 | switch ($pad_type) { |
6567 | 6567 | case \STR_PAD_LEFT: |
6568 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6568 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6569 | 6569 | |
6570 | 6570 | $diff = ($pad_length - $str_length); |
6571 | 6571 | |
6572 | - $pre = (string) self::substr( |
|
6573 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6572 | + $pre = (string)self::substr( |
|
6573 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6574 | 6574 | 0, |
6575 | 6575 | $diff, |
6576 | 6576 | $encoding |
@@ -6582,17 +6582,17 @@ discard block |
||
6582 | 6582 | case \STR_PAD_BOTH: |
6583 | 6583 | $diff = ($pad_length - $str_length); |
6584 | 6584 | |
6585 | - $ps_length_left = (int) \floor($diff / 2); |
|
6585 | + $ps_length_left = (int)\floor($diff / 2); |
|
6586 | 6586 | |
6587 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6587 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6588 | 6588 | |
6589 | - $pre = (string) self::substr( |
|
6589 | + $pre = (string)self::substr( |
|
6590 | 6590 | \str_repeat($pad_string, $ps_length_left), |
6591 | 6591 | 0, |
6592 | 6592 | $ps_length_left, |
6593 | 6593 | $encoding |
6594 | 6594 | ); |
6595 | - $post = (string) self::substr( |
|
6595 | + $post = (string)self::substr( |
|
6596 | 6596 | \str_repeat($pad_string, $ps_length_right), |
6597 | 6597 | 0, |
6598 | 6598 | $ps_length_right, |
@@ -6603,12 +6603,12 @@ discard block |
||
6603 | 6603 | |
6604 | 6604 | case \STR_PAD_RIGHT: |
6605 | 6605 | default: |
6606 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6606 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6607 | 6607 | |
6608 | 6608 | $diff = ($pad_length - $str_length); |
6609 | 6609 | |
6610 | - $post = (string) self::substr( |
|
6611 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6610 | + $post = (string)self::substr( |
|
6611 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6612 | 6612 | 0, |
6613 | 6613 | $diff, |
6614 | 6614 | $encoding |
@@ -6616,7 +6616,7 @@ discard block |
||
6616 | 6616 | $pre = ''; |
6617 | 6617 | } |
6618 | 6618 | |
6619 | - return $pre . $str . $post; |
|
6619 | + return $pre.$str.$post; |
|
6620 | 6620 | } |
6621 | 6621 | |
6622 | 6622 | return $str; |
@@ -6775,11 +6775,11 @@ discard block |
||
6775 | 6775 | } |
6776 | 6776 | |
6777 | 6777 | if ($search === '') { |
6778 | - return $str . $replacement; |
|
6778 | + return $str.$replacement; |
|
6779 | 6779 | } |
6780 | 6780 | |
6781 | 6781 | if (\strpos($str, $search) === 0) { |
6782 | - return $replacement . \substr($str, \strlen($search)); |
|
6782 | + return $replacement.\substr($str, \strlen($search)); |
|
6783 | 6783 | } |
6784 | 6784 | |
6785 | 6785 | return $str; |
@@ -6807,11 +6807,11 @@ discard block |
||
6807 | 6807 | } |
6808 | 6808 | |
6809 | 6809 | if ($search === '') { |
6810 | - return $str . $replacement; |
|
6810 | + return $str.$replacement; |
|
6811 | 6811 | } |
6812 | 6812 | |
6813 | 6813 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6814 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6814 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6815 | 6815 | } |
6816 | 6816 | |
6817 | 6817 | return $str; |
@@ -6840,7 +6840,7 @@ discard block |
||
6840 | 6840 | $subject, |
6841 | 6841 | $replace, |
6842 | 6842 | $pos, |
6843 | - (int) self::strlen($search) |
|
6843 | + (int)self::strlen($search) |
|
6844 | 6844 | ); |
6845 | 6845 | } |
6846 | 6846 | |
@@ -6872,7 +6872,7 @@ discard block |
||
6872 | 6872 | $subject, |
6873 | 6873 | $replace, |
6874 | 6874 | $pos, |
6875 | - (int) self::strlen($search) |
|
6875 | + (int)self::strlen($search) |
|
6876 | 6876 | ); |
6877 | 6877 | } |
6878 | 6878 | |
@@ -6892,7 +6892,7 @@ discard block |
||
6892 | 6892 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
6893 | 6893 | { |
6894 | 6894 | if ($encoding === 'UTF-8') { |
6895 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
6895 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
6896 | 6896 | /** @noinspection NonSecureShuffleUsageInspection */ |
6897 | 6897 | \shuffle($indexes); |
6898 | 6898 | |
@@ -6908,7 +6908,7 @@ discard block |
||
6908 | 6908 | } else { |
6909 | 6909 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6910 | 6910 | |
6911 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
6911 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
6912 | 6912 | /** @noinspection NonSecureShuffleUsageInspection */ |
6913 | 6913 | \shuffle($indexes); |
6914 | 6914 | |
@@ -6949,11 +6949,11 @@ discard block |
||
6949 | 6949 | ) { |
6950 | 6950 | if ($encoding === 'UTF-8') { |
6951 | 6951 | if ($end === null) { |
6952 | - $length = (int) \mb_strlen($str); |
|
6952 | + $length = (int)\mb_strlen($str); |
|
6953 | 6953 | } elseif ($end >= 0 && $end <= $start) { |
6954 | 6954 | return ''; |
6955 | 6955 | } elseif ($end < 0) { |
6956 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
6956 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
6957 | 6957 | } else { |
6958 | 6958 | $length = $end - $start; |
6959 | 6959 | } |
@@ -6964,11 +6964,11 @@ discard block |
||
6964 | 6964 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6965 | 6965 | |
6966 | 6966 | if ($end === null) { |
6967 | - $length = (int) self::strlen($str, $encoding); |
|
6967 | + $length = (int)self::strlen($str, $encoding); |
|
6968 | 6968 | } elseif ($end >= 0 && $end <= $start) { |
6969 | 6969 | return ''; |
6970 | 6970 | } elseif ($end < 0) { |
6971 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
6971 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
6972 | 6972 | } else { |
6973 | 6973 | $length = $end - $start; |
6974 | 6974 | } |
@@ -7000,35 +7000,35 @@ discard block |
||
7000 | 7000 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7001 | 7001 | } |
7002 | 7002 | |
7003 | - $str = (string) \preg_replace_callback( |
|
7003 | + $str = (string)\preg_replace_callback( |
|
7004 | 7004 | '/([\\p{N}|\\p{Lu}])/u', |
7005 | 7005 | /** |
7006 | 7006 | * @param string[] $matches |
7007 | 7007 | * |
7008 | 7008 | * @return string |
7009 | 7009 | */ |
7010 | - static function (array $matches) use ($encoding): string { |
|
7010 | + static function(array $matches) use ($encoding): string { |
|
7011 | 7011 | $match = $matches[1]; |
7012 | - $matchInt = (int) $match; |
|
7012 | + $matchInt = (int)$match; |
|
7013 | 7013 | |
7014 | - if ((string) $matchInt === $match) { |
|
7015 | - return '_' . $match . '_'; |
|
7014 | + if ((string)$matchInt === $match) { |
|
7015 | + return '_'.$match.'_'; |
|
7016 | 7016 | } |
7017 | 7017 | |
7018 | 7018 | if ($encoding === 'UTF-8') { |
7019 | - return '_' . \mb_strtolower($match); |
|
7019 | + return '_'.\mb_strtolower($match); |
|
7020 | 7020 | } |
7021 | 7021 | |
7022 | - return '_' . self::strtolower($match, $encoding); |
|
7022 | + return '_'.self::strtolower($match, $encoding); |
|
7023 | 7023 | }, |
7024 | 7024 | $str |
7025 | 7025 | ); |
7026 | 7026 | |
7027 | - $str = (string) \preg_replace( |
|
7027 | + $str = (string)\preg_replace( |
|
7028 | 7028 | [ |
7029 | - '/\\s+/u', // convert spaces to "_" |
|
7029 | + '/\\s+/u', // convert spaces to "_" |
|
7030 | 7030 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
7031 | - '/_+/', // remove double "_" |
|
7031 | + '/_+/', // remove double "_" |
|
7032 | 7032 | ], |
7033 | 7033 | [ |
7034 | 7034 | '_', |
@@ -7104,7 +7104,7 @@ discard block |
||
7104 | 7104 | } |
7105 | 7105 | |
7106 | 7106 | // init |
7107 | - $str = (string) $str; |
|
7107 | + $str = (string)$str; |
|
7108 | 7108 | |
7109 | 7109 | if ($str === '') { |
7110 | 7110 | return []; |
@@ -7151,7 +7151,7 @@ discard block |
||
7151 | 7151 | ($str[$i] & "\xE0") === "\xC0" |
7152 | 7152 | ) { |
7153 | 7153 | if (($str[$i + 1] & "\xC0") === "\x80") { |
7154 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
7154 | + $ret[] = $str[$i].$str[$i + 1]; |
|
7155 | 7155 | |
7156 | 7156 | ++$i; |
7157 | 7157 | } |
@@ -7165,7 +7165,7 @@ discard block |
||
7165 | 7165 | && |
7166 | 7166 | ($str[$i + 2] & "\xC0") === "\x80" |
7167 | 7167 | ) { |
7168 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
7168 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
7169 | 7169 | |
7170 | 7170 | $i += 2; |
7171 | 7171 | } |
@@ -7181,7 +7181,7 @@ discard block |
||
7181 | 7181 | && |
7182 | 7182 | ($str[$i + 3] & "\xC0") === "\x80" |
7183 | 7183 | ) { |
7184 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
7184 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
7185 | 7185 | |
7186 | 7186 | $i += 3; |
7187 | 7187 | } |
@@ -7193,7 +7193,7 @@ discard block |
||
7193 | 7193 | $ret = \array_chunk($ret, $length); |
7194 | 7194 | |
7195 | 7195 | return \array_map( |
7196 | - static function (array &$item): string { |
|
7196 | + static function(array &$item): string { |
|
7197 | 7197 | return \implode('', $item); |
7198 | 7198 | }, |
7199 | 7199 | $ret |
@@ -7256,7 +7256,7 @@ discard block |
||
7256 | 7256 | $limit = -1; |
7257 | 7257 | } |
7258 | 7258 | |
7259 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7259 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7260 | 7260 | |
7261 | 7261 | if ($array === false) { |
7262 | 7262 | return []; |
@@ -7340,9 +7340,9 @@ discard block |
||
7340 | 7340 | return ''; |
7341 | 7341 | } |
7342 | 7342 | |
7343 | - return (string) \mb_substr( |
|
7343 | + return (string)\mb_substr( |
|
7344 | 7344 | $str, |
7345 | - $offset + (int) \mb_strlen($separator) |
|
7345 | + $offset + (int)\mb_strlen($separator) |
|
7346 | 7346 | ); |
7347 | 7347 | } |
7348 | 7348 | |
@@ -7351,9 +7351,9 @@ discard block |
||
7351 | 7351 | return ''; |
7352 | 7352 | } |
7353 | 7353 | |
7354 | - return (string) \mb_substr( |
|
7354 | + return (string)\mb_substr( |
|
7355 | 7355 | $str, |
7356 | - $offset + (int) self::strlen($separator, $encoding), |
|
7356 | + $offset + (int)self::strlen($separator, $encoding), |
|
7357 | 7357 | null, |
7358 | 7358 | $encoding |
7359 | 7359 | ); |
@@ -7380,9 +7380,9 @@ discard block |
||
7380 | 7380 | return ''; |
7381 | 7381 | } |
7382 | 7382 | |
7383 | - return (string) \mb_substr( |
|
7383 | + return (string)\mb_substr( |
|
7384 | 7384 | $str, |
7385 | - $offset + (int) \mb_strlen($separator) |
|
7385 | + $offset + (int)\mb_strlen($separator) |
|
7386 | 7386 | ); |
7387 | 7387 | } |
7388 | 7388 | |
@@ -7391,9 +7391,9 @@ discard block |
||
7391 | 7391 | return ''; |
7392 | 7392 | } |
7393 | 7393 | |
7394 | - return (string) self::substr( |
|
7394 | + return (string)self::substr( |
|
7395 | 7395 | $str, |
7396 | - $offset + (int) self::strlen($separator, $encoding), |
|
7396 | + $offset + (int)self::strlen($separator, $encoding), |
|
7397 | 7397 | null, |
7398 | 7398 | $encoding |
7399 | 7399 | ); |
@@ -7423,7 +7423,7 @@ discard block |
||
7423 | 7423 | return ''; |
7424 | 7424 | } |
7425 | 7425 | |
7426 | - return (string) \mb_substr( |
|
7426 | + return (string)\mb_substr( |
|
7427 | 7427 | $str, |
7428 | 7428 | 0, |
7429 | 7429 | $offset |
@@ -7435,7 +7435,7 @@ discard block |
||
7435 | 7435 | return ''; |
7436 | 7436 | } |
7437 | 7437 | |
7438 | - return (string) self::substr( |
|
7438 | + return (string)self::substr( |
|
7439 | 7439 | $str, |
7440 | 7440 | 0, |
7441 | 7441 | $offset, |
@@ -7464,7 +7464,7 @@ discard block |
||
7464 | 7464 | return ''; |
7465 | 7465 | } |
7466 | 7466 | |
7467 | - return (string) \mb_substr( |
|
7467 | + return (string)\mb_substr( |
|
7468 | 7468 | $str, |
7469 | 7469 | 0, |
7470 | 7470 | $offset |
@@ -7478,7 +7478,7 @@ discard block |
||
7478 | 7478 | |
7479 | 7479 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7480 | 7480 | |
7481 | - return (string) self::substr( |
|
7481 | + return (string)self::substr( |
|
7482 | 7482 | $str, |
7483 | 7483 | 0, |
7484 | 7484 | $offset, |
@@ -7586,7 +7586,7 @@ discard block |
||
7586 | 7586 | */ |
7587 | 7587 | public static function str_surround(string $str, string $substring): string |
7588 | 7588 | { |
7589 | - return $substring . $str . $substring; |
|
7589 | + return $substring.$str.$substring; |
|
7590 | 7590 | } |
7591 | 7591 | |
7592 | 7592 | /** |
@@ -7640,9 +7640,9 @@ discard block |
||
7640 | 7640 | $word_define_chars = ''; |
7641 | 7641 | } |
7642 | 7642 | |
7643 | - $str = (string) \preg_replace_callback( |
|
7644 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
7645 | - static function (array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7643 | + $str = (string)\preg_replace_callback( |
|
7644 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
7645 | + static function(array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7646 | 7646 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
7647 | 7647 | return $match[0]; |
7648 | 7648 | } |
@@ -7733,16 +7733,16 @@ discard block |
||
7733 | 7733 | } |
7734 | 7734 | |
7735 | 7735 | // the main substitutions |
7736 | - $str = (string) \preg_replace_callback( |
|
7736 | + $str = (string)\preg_replace_callback( |
|
7737 | 7737 | '~\\b (_*) (?: # 1. Leading underscore and |
7738 | 7738 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
7739 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
7739 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
7740 | 7740 | | |
7741 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
7741 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
7742 | 7742 | | |
7743 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
7743 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
7744 | 7744 | | |
7745 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
7745 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
7746 | 7746 | ) (_*) \\b # 6. With trailing underscore |
7747 | 7747 | ~ux', |
7748 | 7748 | /** |
@@ -7750,7 +7750,7 @@ discard block |
||
7750 | 7750 | * |
7751 | 7751 | * @return string |
7752 | 7752 | */ |
7753 | - static function (array $matches) use ($encoding): string { |
|
7753 | + static function(array $matches) use ($encoding): string { |
|
7754 | 7754 | // preserve leading underscore |
7755 | 7755 | $str = $matches[1]; |
7756 | 7756 | if ($matches[2]) { |
@@ -7775,26 +7775,26 @@ discard block |
||
7775 | 7775 | ); |
7776 | 7776 | |
7777 | 7777 | // Exceptions for small words: capitalize at start of title... |
7778 | - $str = (string) \preg_replace_callback( |
|
7778 | + $str = (string)\preg_replace_callback( |
|
7779 | 7779 | '~( \\A [[:punct:]]* # start of title... |
7780 | 7780 | | [:.;?!][ ]+ # or of subsentence... |
7781 | 7781 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
7782 | - ( ' . $smallWordsRx . ' ) \\b # ...followed by small word |
|
7782 | + ( ' . $smallWordsRx.' ) \\b # ...followed by small word |
|
7783 | 7783 | ~uxi', |
7784 | 7784 | /** |
7785 | 7785 | * @param string[] $matches |
7786 | 7786 | * |
7787 | 7787 | * @return string |
7788 | 7788 | */ |
7789 | - static function (array $matches) use ($encoding): string { |
|
7790 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7789 | + static function(array $matches) use ($encoding): string { |
|
7790 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7791 | 7791 | }, |
7792 | 7792 | $str |
7793 | 7793 | ); |
7794 | 7794 | |
7795 | 7795 | // ...and end of title |
7796 | - $str = (string) \preg_replace_callback( |
|
7797 | - '~\\b ( ' . $smallWordsRx . ' ) # small word... |
|
7796 | + $str = (string)\preg_replace_callback( |
|
7797 | + '~\\b ( '.$smallWordsRx.' ) # small word... |
|
7798 | 7798 | (?= [[:punct:]]* \Z # ...at the end of the title... |
7799 | 7799 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
7800 | 7800 | ~uxi', |
@@ -7803,7 +7803,7 @@ discard block |
||
7803 | 7803 | * |
7804 | 7804 | * @return string |
7805 | 7805 | */ |
7806 | - static function (array $matches) use ($encoding): string { |
|
7806 | + static function(array $matches) use ($encoding): string { |
|
7807 | 7807 | return static::str_upper_first($matches[1], $encoding); |
7808 | 7808 | }, |
7809 | 7809 | $str |
@@ -7811,10 +7811,10 @@ discard block |
||
7811 | 7811 | |
7812 | 7812 | // Exceptions for small words in hyphenated compound words. |
7813 | 7813 | // e.g. "in-flight" -> In-Flight |
7814 | - $str = (string) \preg_replace_callback( |
|
7814 | + $str = (string)\preg_replace_callback( |
|
7815 | 7815 | '~\\b |
7816 | 7816 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
7817 | - ( ' . $smallWordsRx . ' ) |
|
7817 | + ( ' . $smallWordsRx.' ) |
|
7818 | 7818 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
7819 | 7819 | ~uxi', |
7820 | 7820 | /** |
@@ -7822,18 +7822,18 @@ discard block |
||
7822 | 7822 | * |
7823 | 7823 | * @return string |
7824 | 7824 | */ |
7825 | - static function (array $matches) use ($encoding): string { |
|
7825 | + static function(array $matches) use ($encoding): string { |
|
7826 | 7826 | return static::str_upper_first($matches[1], $encoding); |
7827 | 7827 | }, |
7828 | 7828 | $str |
7829 | 7829 | ); |
7830 | 7830 | |
7831 | 7831 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
7832 | - $str = (string) \preg_replace_callback( |
|
7832 | + $str = (string)\preg_replace_callback( |
|
7833 | 7833 | '~\\b |
7834 | 7834 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
7835 | 7835 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
7836 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
7836 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
7837 | 7837 | (?! - ) # Negative lookahead for another - |
7838 | 7838 | ~uxi', |
7839 | 7839 | /** |
@@ -7841,8 +7841,8 @@ discard block |
||
7841 | 7841 | * |
7842 | 7842 | * @return string |
7843 | 7843 | */ |
7844 | - static function (array $matches) use ($encoding): string { |
|
7845 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7844 | + static function(array $matches) use ($encoding): string { |
|
7845 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7846 | 7846 | }, |
7847 | 7847 | $str |
7848 | 7848 | ); |
@@ -7950,7 +7950,7 @@ discard block |
||
7950 | 7950 | ); |
7951 | 7951 | |
7952 | 7952 | foreach ($tmpReturn as &$item) { |
7953 | - $item = (string) $item; |
|
7953 | + $item = (string)$item; |
|
7954 | 7954 | } |
7955 | 7955 | |
7956 | 7956 | return $tmpReturn; |
@@ -7995,39 +7995,39 @@ discard block |
||
7995 | 7995 | } |
7996 | 7996 | |
7997 | 7997 | if ($encoding === 'UTF-8') { |
7998 | - if ($length >= (int) \mb_strlen($str)) { |
|
7998 | + if ($length >= (int)\mb_strlen($str)) { |
|
7999 | 7999 | return $str; |
8000 | 8000 | } |
8001 | 8001 | |
8002 | 8002 | if ($substring !== '') { |
8003 | - $length -= (int) \mb_strlen($substring); |
|
8003 | + $length -= (int)\mb_strlen($substring); |
|
8004 | 8004 | |
8005 | 8005 | /** @noinspection UnnecessaryCastingInspection */ |
8006 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8006 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8007 | 8007 | } |
8008 | 8008 | |
8009 | 8009 | /** @noinspection UnnecessaryCastingInspection */ |
8010 | - return (string) \mb_substr($str, 0, $length); |
|
8010 | + return (string)\mb_substr($str, 0, $length); |
|
8011 | 8011 | } |
8012 | 8012 | |
8013 | 8013 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8014 | 8014 | |
8015 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8015 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8016 | 8016 | return $str; |
8017 | 8017 | } |
8018 | 8018 | |
8019 | 8019 | if ($substring !== '') { |
8020 | - $length -= (int) self::strlen($substring, $encoding); |
|
8020 | + $length -= (int)self::strlen($substring, $encoding); |
|
8021 | 8021 | } |
8022 | 8022 | |
8023 | 8023 | return ( |
8024 | - (string) self::substr( |
|
8024 | + (string)self::substr( |
|
8025 | 8025 | $str, |
8026 | 8026 | 0, |
8027 | 8027 | $length, |
8028 | 8028 | $encoding |
8029 | 8029 | ) |
8030 | - ) . $substring; |
|
8030 | + ).$substring; |
|
8031 | 8031 | } |
8032 | 8032 | |
8033 | 8033 | /** |
@@ -8057,12 +8057,12 @@ discard block |
||
8057 | 8057 | } |
8058 | 8058 | |
8059 | 8059 | if ($encoding === 'UTF-8') { |
8060 | - if ($length >= (int) \mb_strlen($str)) { |
|
8060 | + if ($length >= (int)\mb_strlen($str)) { |
|
8061 | 8061 | return $str; |
8062 | 8062 | } |
8063 | 8063 | |
8064 | 8064 | // need to further trim the string so we can append the substring |
8065 | - $length -= (int) \mb_strlen($substring); |
|
8065 | + $length -= (int)\mb_strlen($substring); |
|
8066 | 8066 | if ($length <= 0) { |
8067 | 8067 | return $substring; |
8068 | 8068 | } |
@@ -8084,18 +8084,18 @@ discard block |
||
8084 | 8084 | || |
8085 | 8085 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8086 | 8086 | ) { |
8087 | - $truncated = (string) \mb_substr($truncated, 0, (int) $lastPos); |
|
8087 | + $truncated = (string)\mb_substr($truncated, 0, (int)$lastPos); |
|
8088 | 8088 | } |
8089 | 8089 | } |
8090 | 8090 | } else { |
8091 | 8091 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8092 | 8092 | |
8093 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8093 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8094 | 8094 | return $str; |
8095 | 8095 | } |
8096 | 8096 | |
8097 | 8097 | // need to further trim the string so we can append the substring |
8098 | - $length -= (int) self::strlen($substring, $encoding); |
|
8098 | + $length -= (int)self::strlen($substring, $encoding); |
|
8099 | 8099 | if ($length <= 0) { |
8100 | 8100 | return $substring; |
8101 | 8101 | } |
@@ -8117,12 +8117,12 @@ discard block |
||
8117 | 8117 | || |
8118 | 8118 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8119 | 8119 | ) { |
8120 | - $truncated = (string) self::substr($truncated, 0, (int) $lastPos, $encoding); |
|
8120 | + $truncated = (string)self::substr($truncated, 0, (int)$lastPos, $encoding); |
|
8121 | 8121 | } |
8122 | 8122 | } |
8123 | 8123 | } |
8124 | 8124 | |
8125 | - return $truncated . $substring; |
|
8125 | + return $truncated.$substring; |
|
8126 | 8126 | } |
8127 | 8127 | |
8128 | 8128 | /** |
@@ -8212,13 +8212,13 @@ discard block |
||
8212 | 8212 | } |
8213 | 8213 | } elseif ($format === 2) { |
8214 | 8214 | $numberOfWords = []; |
8215 | - $offset = (int) self::strlen($strParts[0]); |
|
8215 | + $offset = (int)self::strlen($strParts[0]); |
|
8216 | 8216 | for ($i = 1; $i < $len; $i += 2) { |
8217 | 8217 | $numberOfWords[$offset] = $strParts[$i]; |
8218 | - $offset += (int) self::strlen($strParts[$i]) + (int) self::strlen($strParts[$i + 1]); |
|
8218 | + $offset += (int)self::strlen($strParts[$i]) + (int)self::strlen($strParts[$i + 1]); |
|
8219 | 8219 | } |
8220 | 8220 | } else { |
8221 | - $numberOfWords = (int) (($len - 1) / 2); |
|
8221 | + $numberOfWords = (int)(($len - 1) / 2); |
|
8222 | 8222 | } |
8223 | 8223 | |
8224 | 8224 | return $numberOfWords; |
@@ -8315,21 +8315,21 @@ discard block |
||
8315 | 8315 | } |
8316 | 8316 | |
8317 | 8317 | if ($charList === '') { |
8318 | - return (int) self::strlen($str, $encoding); |
|
8318 | + return (int)self::strlen($str, $encoding); |
|
8319 | 8319 | } |
8320 | 8320 | |
8321 | 8321 | if ($offset !== null || $length !== null) { |
8322 | 8322 | if ($encoding === 'UTF-8') { |
8323 | 8323 | if ($length === null) { |
8324 | 8324 | /** @noinspection UnnecessaryCastingInspection */ |
8325 | - $strTmp = \mb_substr($str, (int) $offset); |
|
8325 | + $strTmp = \mb_substr($str, (int)$offset); |
|
8326 | 8326 | } else { |
8327 | 8327 | /** @noinspection UnnecessaryCastingInspection */ |
8328 | - $strTmp = \mb_substr($str, (int) $offset, $length); |
|
8328 | + $strTmp = \mb_substr($str, (int)$offset, $length); |
|
8329 | 8329 | } |
8330 | 8330 | } else { |
8331 | 8331 | /** @noinspection UnnecessaryCastingInspection */ |
8332 | - $strTmp = self::substr($str, (int) $offset, $length, $encoding); |
|
8332 | + $strTmp = self::substr($str, (int)$offset, $length, $encoding); |
|
8333 | 8333 | } |
8334 | 8334 | |
8335 | 8335 | if ($strTmp === false) { |
@@ -8344,7 +8344,7 @@ discard block |
||
8344 | 8344 | } |
8345 | 8345 | |
8346 | 8346 | $matches = []; |
8347 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $matches)) { |
|
8347 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $matches)) { |
|
8348 | 8348 | $return = self::strlen($matches[1], $encoding); |
8349 | 8349 | if ($return === false) { |
8350 | 8350 | return 0; |
@@ -8353,7 +8353,7 @@ discard block |
||
8353 | 8353 | return $return; |
8354 | 8354 | } |
8355 | 8355 | |
8356 | - return (int) self::strlen($str, $encoding); |
|
8356 | + return (int)self::strlen($str, $encoding); |
|
8357 | 8357 | } |
8358 | 8358 | |
8359 | 8359 | /** |
@@ -8475,7 +8475,7 @@ discard block |
||
8475 | 8475 | return ''; |
8476 | 8476 | } |
8477 | 8477 | |
8478 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
8478 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
8479 | 8479 | } |
8480 | 8480 | |
8481 | 8481 | /** |
@@ -8540,7 +8540,7 @@ discard block |
||
8540 | 8540 | // fallback for ascii only |
8541 | 8541 | // |
8542 | 8542 | |
8543 | - if (self::is_ascii($haystack . $needle)) { |
|
8543 | + if (self::is_ascii($haystack.$needle)) { |
|
8544 | 8544 | return \stripos($haystack, $needle, $offset); |
8545 | 8545 | } |
8546 | 8546 | |
@@ -8607,7 +8607,7 @@ discard block |
||
8607 | 8607 | && |
8608 | 8608 | self::$SUPPORT['mbstring'] === false |
8609 | 8609 | ) { |
8610 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8610 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8611 | 8611 | } |
8612 | 8612 | |
8613 | 8613 | if ( |
@@ -8621,11 +8621,11 @@ discard block |
||
8621 | 8621 | } |
8622 | 8622 | } |
8623 | 8623 | |
8624 | - if (self::is_ascii($needle . $haystack)) { |
|
8624 | + if (self::is_ascii($needle.$haystack)) { |
|
8625 | 8625 | return \stristr($haystack, $needle, $before_needle); |
8626 | 8626 | } |
8627 | 8627 | |
8628 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
8628 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
8629 | 8629 | |
8630 | 8630 | if (!isset($match[1])) { |
8631 | 8631 | return false; |
@@ -8635,7 +8635,7 @@ discard block |
||
8635 | 8635 | return $match[1]; |
8636 | 8636 | } |
8637 | 8637 | |
8638 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
8638 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
8639 | 8639 | } |
8640 | 8640 | |
8641 | 8641 | /** |
@@ -8702,7 +8702,7 @@ discard block |
||
8702 | 8702 | && |
8703 | 8703 | self::$SUPPORT['iconv'] === false |
8704 | 8704 | ) { |
8705 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8705 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8706 | 8706 | } |
8707 | 8707 | |
8708 | 8708 | // |
@@ -8818,8 +8818,8 @@ discard block |
||
8818 | 8818 | } |
8819 | 8819 | |
8820 | 8820 | return \strnatcmp( |
8821 | - (string) self::strtonatfold($str1), |
|
8822 | - (string) self::strtonatfold($str2) |
|
8821 | + (string)self::strtonatfold($str1), |
|
8822 | + (string)self::strtonatfold($str2) |
|
8823 | 8823 | ); |
8824 | 8824 | } |
8825 | 8825 | |
@@ -8877,11 +8877,11 @@ discard block |
||
8877 | 8877 | } |
8878 | 8878 | |
8879 | 8879 | if ($encoding === 'UTF-8') { |
8880 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
8881 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
8880 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
8881 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
8882 | 8882 | } else { |
8883 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
8884 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
8883 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
8884 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
8885 | 8885 | } |
8886 | 8886 | |
8887 | 8887 | return self::strcmp($str1, $str2); |
@@ -8903,8 +8903,8 @@ discard block |
||
8903 | 8903 | return false; |
8904 | 8904 | } |
8905 | 8905 | |
8906 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
8907 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
8906 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
8907 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
8908 | 8908 | } |
8909 | 8909 | |
8910 | 8910 | return false; |
@@ -8937,10 +8937,10 @@ discard block |
||
8937 | 8937 | } |
8938 | 8938 | |
8939 | 8939 | // iconv and mbstring do not support integer $needle |
8940 | - if ((int) $needle === $needle) { |
|
8941 | - $needle = (string) self::chr($needle); |
|
8940 | + if ((int)$needle === $needle) { |
|
8941 | + $needle = (string)self::chr($needle); |
|
8942 | 8942 | } |
8943 | - $needle = (string) $needle; |
|
8943 | + $needle = (string)$needle; |
|
8944 | 8944 | |
8945 | 8945 | if ($needle === '') { |
8946 | 8946 | return false; |
@@ -8987,7 +8987,7 @@ discard block |
||
8987 | 8987 | && |
8988 | 8988 | self::$SUPPORT['mbstring'] === false |
8989 | 8989 | ) { |
8990 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8990 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8991 | 8991 | } |
8992 | 8992 | |
8993 | 8993 | // |
@@ -9028,7 +9028,7 @@ discard block |
||
9028 | 9028 | // fallback for ascii only |
9029 | 9029 | // |
9030 | 9030 | |
9031 | - if (self::is_ascii($haystack . $needle)) { |
|
9031 | + if (self::is_ascii($haystack.$needle)) { |
|
9032 | 9032 | return \strpos($haystack, $needle, $offset); |
9033 | 9033 | } |
9034 | 9034 | |
@@ -9040,7 +9040,7 @@ discard block |
||
9040 | 9040 | if ($haystackTmp === false) { |
9041 | 9041 | $haystackTmp = ''; |
9042 | 9042 | } |
9043 | - $haystack = (string) $haystackTmp; |
|
9043 | + $haystack = (string)$haystackTmp; |
|
9044 | 9044 | |
9045 | 9045 | if ($offset < 0) { |
9046 | 9046 | $offset = 0; |
@@ -9052,7 +9052,7 @@ discard block |
||
9052 | 9052 | } |
9053 | 9053 | |
9054 | 9054 | if ($pos) { |
9055 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9055 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9056 | 9056 | } |
9057 | 9057 | |
9058 | 9058 | return $offset + 0; |
@@ -9163,7 +9163,7 @@ discard block |
||
9163 | 9163 | && |
9164 | 9164 | self::$SUPPORT['mbstring'] === false |
9165 | 9165 | ) { |
9166 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9166 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9167 | 9167 | } |
9168 | 9168 | |
9169 | 9169 | // |
@@ -9175,7 +9175,7 @@ discard block |
||
9175 | 9175 | if ($needleTmp === false) { |
9176 | 9176 | return false; |
9177 | 9177 | } |
9178 | - $needle = (string) $needleTmp; |
|
9178 | + $needle = (string)$needleTmp; |
|
9179 | 9179 | |
9180 | 9180 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
9181 | 9181 | if ($pos === false) { |
@@ -9197,7 +9197,7 @@ discard block |
||
9197 | 9197 | if ($needleTmp === false) { |
9198 | 9198 | return false; |
9199 | 9199 | } |
9200 | - $needle = (string) $needleTmp; |
|
9200 | + $needle = (string)$needleTmp; |
|
9201 | 9201 | |
9202 | 9202 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
9203 | 9203 | if ($pos === false) { |
@@ -9233,7 +9233,7 @@ discard block |
||
9233 | 9233 | if ($encoding === 'UTF-8') { |
9234 | 9234 | if (self::$SUPPORT['intl'] === true) { |
9235 | 9235 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
9236 | - $i = (int) \grapheme_strlen($str); |
|
9236 | + $i = (int)\grapheme_strlen($str); |
|
9237 | 9237 | while ($i--) { |
9238 | 9238 | $reversedTmp = \grapheme_substr($str, $i, 1); |
9239 | 9239 | if ($reversedTmp !== false) { |
@@ -9241,7 +9241,7 @@ discard block |
||
9241 | 9241 | } |
9242 | 9242 | } |
9243 | 9243 | } else { |
9244 | - $i = (int) \mb_strlen($str); |
|
9244 | + $i = (int)\mb_strlen($str); |
|
9245 | 9245 | while ($i--) { |
9246 | 9246 | $reversedTmp = \mb_substr($str, $i, 1); |
9247 | 9247 | if ($reversedTmp !== false) { |
@@ -9252,7 +9252,7 @@ discard block |
||
9252 | 9252 | } else { |
9253 | 9253 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9254 | 9254 | |
9255 | - $i = (int) self::strlen($str, $encoding); |
|
9255 | + $i = (int)self::strlen($str, $encoding); |
|
9256 | 9256 | while ($i--) { |
9257 | 9257 | $reversedTmp = self::substr($str, $i, 1, $encoding); |
9258 | 9258 | if ($reversedTmp !== false) { |
@@ -9326,7 +9326,7 @@ discard block |
||
9326 | 9326 | if ($needleTmp === false) { |
9327 | 9327 | return false; |
9328 | 9328 | } |
9329 | - $needle = (string) $needleTmp; |
|
9329 | + $needle = (string)$needleTmp; |
|
9330 | 9330 | |
9331 | 9331 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
9332 | 9332 | if ($pos === false) { |
@@ -9365,10 +9365,10 @@ discard block |
||
9365 | 9365 | } |
9366 | 9366 | |
9367 | 9367 | // iconv and mbstring do not support integer $needle |
9368 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9369 | - $needle = (string) self::chr($needle); |
|
9368 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9369 | + $needle = (string)self::chr($needle); |
|
9370 | 9370 | } |
9371 | - $needle = (string) $needle; |
|
9371 | + $needle = (string)$needle; |
|
9372 | 9372 | |
9373 | 9373 | if ($needle === '') { |
9374 | 9374 | return false; |
@@ -9413,7 +9413,7 @@ discard block |
||
9413 | 9413 | && |
9414 | 9414 | self::$SUPPORT['mbstring'] === false |
9415 | 9415 | ) { |
9416 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9416 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9417 | 9417 | } |
9418 | 9418 | |
9419 | 9419 | // |
@@ -9437,7 +9437,7 @@ discard block |
||
9437 | 9437 | // fallback for ascii only |
9438 | 9438 | // |
9439 | 9439 | |
9440 | - if (self::is_ascii($haystack . $needle)) { |
|
9440 | + if (self::is_ascii($haystack.$needle)) { |
|
9441 | 9441 | return \strripos($haystack, $needle, $offset); |
9442 | 9442 | } |
9443 | 9443 | |
@@ -9513,10 +9513,10 @@ discard block |
||
9513 | 9513 | } |
9514 | 9514 | |
9515 | 9515 | // iconv and mbstring do not support integer $needle |
9516 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9517 | - $needle = (string) self::chr($needle); |
|
9516 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9517 | + $needle = (string)self::chr($needle); |
|
9518 | 9518 | } |
9519 | - $needle = (string) $needle; |
|
9519 | + $needle = (string)$needle; |
|
9520 | 9520 | |
9521 | 9521 | if ($needle === '') { |
9522 | 9522 | return false; |
@@ -9561,7 +9561,7 @@ discard block |
||
9561 | 9561 | && |
9562 | 9562 | self::$SUPPORT['mbstring'] === false |
9563 | 9563 | ) { |
9564 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9564 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9565 | 9565 | } |
9566 | 9566 | |
9567 | 9567 | // |
@@ -9585,7 +9585,7 @@ discard block |
||
9585 | 9585 | // fallback for ascii only |
9586 | 9586 | // |
9587 | 9587 | |
9588 | - if (self::is_ascii($haystack . $needle)) { |
|
9588 | + if (self::is_ascii($haystack.$needle)) { |
|
9589 | 9589 | return \strrpos($haystack, $needle, $offset); |
9590 | 9590 | } |
9591 | 9591 | |
@@ -9605,7 +9605,7 @@ discard block |
||
9605 | 9605 | if ($haystackTmp === false) { |
9606 | 9606 | $haystackTmp = ''; |
9607 | 9607 | } |
9608 | - $haystack = (string) $haystackTmp; |
|
9608 | + $haystack = (string)$haystackTmp; |
|
9609 | 9609 | } |
9610 | 9610 | |
9611 | 9611 | $pos = \strrpos($haystack, $needle); |
@@ -9618,7 +9618,7 @@ discard block |
||
9618 | 9618 | return false; |
9619 | 9619 | } |
9620 | 9620 | |
9621 | - return $offset + (int) self::strlen($strTmp); |
|
9621 | + return $offset + (int)self::strlen($strTmp); |
|
9622 | 9622 | } |
9623 | 9623 | |
9624 | 9624 | /** |
@@ -9678,12 +9678,12 @@ discard block |
||
9678 | 9678 | if ($offset || $length !== null) { |
9679 | 9679 | if ($encoding === 'UTF-8') { |
9680 | 9680 | if ($length === null) { |
9681 | - $str = (string) \mb_substr($str, $offset); |
|
9681 | + $str = (string)\mb_substr($str, $offset); |
|
9682 | 9682 | } else { |
9683 | - $str = (string) \mb_substr($str, $offset, $length); |
|
9683 | + $str = (string)\mb_substr($str, $offset, $length); |
|
9684 | 9684 | } |
9685 | 9685 | } else { |
9686 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
9686 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
9687 | 9687 | } |
9688 | 9688 | } |
9689 | 9689 | |
@@ -9693,7 +9693,7 @@ discard block |
||
9693 | 9693 | |
9694 | 9694 | $matches = []; |
9695 | 9695 | |
9696 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
9696 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
9697 | 9697 | } |
9698 | 9698 | |
9699 | 9699 | /** |
@@ -9762,7 +9762,7 @@ discard block |
||
9762 | 9762 | && |
9763 | 9763 | self::$SUPPORT['mbstring'] === false |
9764 | 9764 | ) { |
9765 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9765 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9766 | 9766 | } |
9767 | 9767 | |
9768 | 9768 | // |
@@ -9784,7 +9784,7 @@ discard block |
||
9784 | 9784 | // fallback for ascii only |
9785 | 9785 | // |
9786 | 9786 | |
9787 | - if (self::is_ascii($haystack . $needle)) { |
|
9787 | + if (self::is_ascii($haystack.$needle)) { |
|
9788 | 9788 | return \strstr($haystack, $needle, $before_needle); |
9789 | 9789 | } |
9790 | 9790 | |
@@ -9792,7 +9792,7 @@ discard block |
||
9792 | 9792 | // fallback via vanilla php |
9793 | 9793 | // |
9794 | 9794 | |
9795 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
9795 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
9796 | 9796 | |
9797 | 9797 | if (!isset($match[1])) { |
9798 | 9798 | return false; |
@@ -9802,7 +9802,7 @@ discard block |
||
9802 | 9802 | return $match[1]; |
9803 | 9803 | } |
9804 | 9804 | |
9805 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
9805 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
9806 | 9806 | } |
9807 | 9807 | |
9808 | 9808 | /** |
@@ -9916,7 +9916,7 @@ discard block |
||
9916 | 9916 | bool $tryToKeepStringLength = false |
9917 | 9917 | ): string { |
9918 | 9918 | // init |
9919 | - $str = (string) $str; |
|
9919 | + $str = (string)$str; |
|
9920 | 9920 | |
9921 | 9921 | if ($str === '') { |
9922 | 9922 | return ''; |
@@ -9945,19 +9945,19 @@ discard block |
||
9945 | 9945 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
9946 | 9946 | } |
9947 | 9947 | |
9948 | - $langCode = $lang . '-Lower'; |
|
9948 | + $langCode = $lang.'-Lower'; |
|
9949 | 9949 | if (!\in_array($langCode, self::$INTL_TRANSLITERATOR_LIST, true)) { |
9950 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
9950 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
9951 | 9951 | |
9952 | 9952 | $langCode = 'Any-Lower'; |
9953 | 9953 | } |
9954 | 9954 | |
9955 | 9955 | /** @noinspection PhpComposerExtensionStubsInspection */ |
9956 | 9956 | /** @noinspection UnnecessaryCastingInspection */ |
9957 | - return (string) \transliterator_transliterate($langCode, $str); |
|
9957 | + return (string)\transliterator_transliterate($langCode, $str); |
|
9958 | 9958 | } |
9959 | 9959 | |
9960 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
9960 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
9961 | 9961 | } |
9962 | 9962 | |
9963 | 9963 | // always fallback via symfony polyfill |
@@ -9986,7 +9986,7 @@ discard block |
||
9986 | 9986 | bool $tryToKeepStringLength = false |
9987 | 9987 | ): string { |
9988 | 9988 | // init |
9989 | - $str = (string) $str; |
|
9989 | + $str = (string)$str; |
|
9990 | 9990 | |
9991 | 9991 | if ($str === '') { |
9992 | 9992 | return ''; |
@@ -10015,19 +10015,19 @@ discard block |
||
10015 | 10015 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10016 | 10016 | } |
10017 | 10017 | |
10018 | - $langCode = $lang . '-Upper'; |
|
10018 | + $langCode = $lang.'-Upper'; |
|
10019 | 10019 | if (!\in_array($langCode, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10020 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
10020 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
10021 | 10021 | |
10022 | 10022 | $langCode = 'Any-Upper'; |
10023 | 10023 | } |
10024 | 10024 | |
10025 | 10025 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10026 | 10026 | /** @noinspection UnnecessaryCastingInspection */ |
10027 | - return (string) \transliterator_transliterate($langCode, $str); |
|
10027 | + return (string)\transliterator_transliterate($langCode, $str); |
|
10028 | 10028 | } |
10029 | 10029 | |
10030 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
10030 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
10031 | 10031 | } |
10032 | 10032 | |
10033 | 10033 | // always fallback via symfony polyfill |
@@ -10071,7 +10071,7 @@ discard block |
||
10071 | 10071 | |
10072 | 10072 | $from = \array_combine($from, $to); |
10073 | 10073 | if ($from === false) { |
10074 | - 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) . ')'); |
|
10074 | + 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).')'); |
|
10075 | 10075 | } |
10076 | 10076 | } |
10077 | 10077 | |
@@ -10128,9 +10128,9 @@ discard block |
||
10128 | 10128 | } |
10129 | 10129 | |
10130 | 10130 | $wide = 0; |
10131 | - $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); |
|
10131 | + $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); |
|
10132 | 10132 | |
10133 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
10133 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
10134 | 10134 | } |
10135 | 10135 | |
10136 | 10136 | /** |
@@ -10230,9 +10230,9 @@ discard block |
||
10230 | 10230 | } |
10231 | 10231 | |
10232 | 10232 | if ($length === null) { |
10233 | - $length = (int) $str_length; |
|
10233 | + $length = (int)$str_length; |
|
10234 | 10234 | } else { |
10235 | - $length = (int) $length; |
|
10235 | + $length = (int)$length; |
|
10236 | 10236 | } |
10237 | 10237 | |
10238 | 10238 | if ( |
@@ -10240,7 +10240,7 @@ discard block |
||
10240 | 10240 | && |
10241 | 10241 | self::$SUPPORT['mbstring'] === false |
10242 | 10242 | ) { |
10243 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10243 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10244 | 10244 | } |
10245 | 10245 | |
10246 | 10246 | // |
@@ -10328,16 +10328,16 @@ discard block |
||
10328 | 10328 | ) { |
10329 | 10329 | if ($encoding === 'UTF-8') { |
10330 | 10330 | if ($length === null) { |
10331 | - $str1 = (string) \mb_substr($str1, $offset); |
|
10331 | + $str1 = (string)\mb_substr($str1, $offset); |
|
10332 | 10332 | } else { |
10333 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
10333 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
10334 | 10334 | } |
10335 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
10335 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
10336 | 10336 | } else { |
10337 | 10337 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10338 | 10338 | |
10339 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
10340 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
10339 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
10340 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
10341 | 10341 | } |
10342 | 10342 | } |
10343 | 10343 | |
@@ -10399,13 +10399,13 @@ discard block |
||
10399 | 10399 | if ($lengthTmp === false) { |
10400 | 10400 | return false; |
10401 | 10401 | } |
10402 | - $length = (int) $lengthTmp; |
|
10402 | + $length = (int)$lengthTmp; |
|
10403 | 10403 | } |
10404 | 10404 | |
10405 | 10405 | if ($encoding === 'UTF-8') { |
10406 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
10406 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
10407 | 10407 | } else { |
10408 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
10408 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
10409 | 10409 | } |
10410 | 10410 | } |
10411 | 10411 | |
@@ -10414,7 +10414,7 @@ discard block |
||
10414 | 10414 | && |
10415 | 10415 | self::$SUPPORT['mbstring'] === false |
10416 | 10416 | ) { |
10417 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10417 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10418 | 10418 | } |
10419 | 10419 | |
10420 | 10420 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10425,7 +10425,7 @@ discard block |
||
10425 | 10425 | return \mb_substr_count($haystack, $needle, $encoding); |
10426 | 10426 | } |
10427 | 10427 | |
10428 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10428 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10429 | 10429 | |
10430 | 10430 | return \count($matches); |
10431 | 10431 | } |
@@ -10472,7 +10472,7 @@ discard block |
||
10472 | 10472 | if ($lengthTmp === false) { |
10473 | 10473 | return false; |
10474 | 10474 | } |
10475 | - $length = (int) $lengthTmp; |
|
10475 | + $length = (int)$lengthTmp; |
|
10476 | 10476 | } |
10477 | 10477 | |
10478 | 10478 | if ( |
@@ -10493,7 +10493,7 @@ discard block |
||
10493 | 10493 | if ($haystackTmp === false) { |
10494 | 10494 | $haystackTmp = ''; |
10495 | 10495 | } |
10496 | - $haystack = (string) $haystackTmp; |
|
10496 | + $haystack = (string)$haystackTmp; |
|
10497 | 10497 | } |
10498 | 10498 | |
10499 | 10499 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10532,10 +10532,10 @@ discard block |
||
10532 | 10532 | |
10533 | 10533 | if ($encoding === 'UTF-8') { |
10534 | 10534 | if ($caseSensitive) { |
10535 | - return (int) \mb_substr_count($str, $substring); |
|
10535 | + return (int)\mb_substr_count($str, $substring); |
|
10536 | 10536 | } |
10537 | 10537 | |
10538 | - return (int) \mb_substr_count( |
|
10538 | + return (int)\mb_substr_count( |
|
10539 | 10539 | \mb_strtoupper($str), |
10540 | 10540 | \mb_strtoupper($substring) |
10541 | 10541 | |
@@ -10545,10 +10545,10 @@ discard block |
||
10545 | 10545 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10546 | 10546 | |
10547 | 10547 | if ($caseSensitive) { |
10548 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
10548 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
10549 | 10549 | } |
10550 | 10550 | |
10551 | - return (int) \mb_substr_count( |
|
10551 | + return (int)\mb_substr_count( |
|
10552 | 10552 | self::strtocasefold($str, true, false, $encoding, null, false), |
10553 | 10553 | self::strtocasefold($substring, true, false, $encoding, null, false), |
10554 | 10554 | $encoding |
@@ -10574,7 +10574,7 @@ discard block |
||
10574 | 10574 | } |
10575 | 10575 | |
10576 | 10576 | if (self::str_istarts_with($haystack, $needle) === true) { |
10577 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10577 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10578 | 10578 | } |
10579 | 10579 | |
10580 | 10580 | return $haystack; |
@@ -10631,7 +10631,7 @@ discard block |
||
10631 | 10631 | } |
10632 | 10632 | |
10633 | 10633 | if (self::str_iends_with($haystack, $needle) === true) { |
10634 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
10634 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
10635 | 10635 | } |
10636 | 10636 | |
10637 | 10637 | return $haystack; |
@@ -10656,7 +10656,7 @@ discard block |
||
10656 | 10656 | } |
10657 | 10657 | |
10658 | 10658 | if (self::str_starts_with($haystack, $needle) === true) { |
10659 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10659 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10660 | 10660 | } |
10661 | 10661 | |
10662 | 10662 | return $haystack; |
@@ -10708,7 +10708,7 @@ discard block |
||
10708 | 10708 | if (\is_array($offset) === true) { |
10709 | 10709 | $offset = \array_slice($offset, 0, $num); |
10710 | 10710 | foreach ($offset as &$valueTmp) { |
10711 | - $valueTmp = (int) $valueTmp === $valueTmp ? $valueTmp : 0; |
|
10711 | + $valueTmp = (int)$valueTmp === $valueTmp ? $valueTmp : 0; |
|
10712 | 10712 | } |
10713 | 10713 | unset($valueTmp); |
10714 | 10714 | } else { |
@@ -10721,7 +10721,7 @@ discard block |
||
10721 | 10721 | } elseif (\is_array($length) === true) { |
10722 | 10722 | $length = \array_slice($length, 0, $num); |
10723 | 10723 | foreach ($length as &$valueTmpV2) { |
10724 | - $valueTmpV2 = (int) $valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10724 | + $valueTmpV2 = (int)$valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10725 | 10725 | } |
10726 | 10726 | unset($valueTmpV2); |
10727 | 10727 | } else { |
@@ -10741,8 +10741,8 @@ discard block |
||
10741 | 10741 | } |
10742 | 10742 | |
10743 | 10743 | // init |
10744 | - $str = (string) $str; |
|
10745 | - $replacement = (string) $replacement; |
|
10744 | + $str = (string)$str; |
|
10745 | + $replacement = (string)$replacement; |
|
10746 | 10746 | |
10747 | 10747 | if (\is_array($length) === true) { |
10748 | 10748 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -10757,16 +10757,16 @@ discard block |
||
10757 | 10757 | } |
10758 | 10758 | |
10759 | 10759 | if (self::$SUPPORT['mbstring'] === true) { |
10760 | - $string_length = (int) self::strlen($str, $encoding); |
|
10760 | + $string_length = (int)self::strlen($str, $encoding); |
|
10761 | 10761 | |
10762 | 10762 | if ($offset < 0) { |
10763 | - $offset = (int) \max(0, $string_length + $offset); |
|
10763 | + $offset = (int)\max(0, $string_length + $offset); |
|
10764 | 10764 | } elseif ($offset > $string_length) { |
10765 | 10765 | $offset = $string_length; |
10766 | 10766 | } |
10767 | 10767 | |
10768 | 10768 | if ($length !== null && $length < 0) { |
10769 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
10769 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
10770 | 10770 | } elseif ($length === null || $length > $string_length) { |
10771 | 10771 | $length = $string_length; |
10772 | 10772 | } |
@@ -10777,9 +10777,9 @@ discard block |
||
10777 | 10777 | } |
10778 | 10778 | |
10779 | 10779 | /** @noinspection AdditionOperationOnArraysInspection */ |
10780 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
10781 | - $replacement . |
|
10782 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10780 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
10781 | + $replacement. |
|
10782 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10783 | 10783 | } |
10784 | 10784 | |
10785 | 10785 | // |
@@ -10788,8 +10788,7 @@ discard block |
||
10788 | 10788 | |
10789 | 10789 | if (self::is_ascii($str)) { |
10790 | 10790 | return ($length === null) ? |
10791 | - \substr_replace($str, $replacement, $offset) : |
|
10792 | - \substr_replace($str, $replacement, $offset, $length); |
|
10791 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
10793 | 10792 | } |
10794 | 10793 | |
10795 | 10794 | // |
@@ -10805,7 +10804,7 @@ discard block |
||
10805 | 10804 | // e.g.: non mbstring support + invalid chars |
10806 | 10805 | return ''; |
10807 | 10806 | } |
10808 | - $length = (int) $lengthTmp; |
|
10807 | + $length = (int)$lengthTmp; |
|
10809 | 10808 | } |
10810 | 10809 | |
10811 | 10810 | \array_splice($smatches[0], $offset, $length, $rmatches[0]); |
@@ -10840,14 +10839,14 @@ discard block |
||
10840 | 10839 | && |
10841 | 10840 | \substr($haystack, -\strlen($needle)) === $needle |
10842 | 10841 | ) { |
10843 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
10842 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
10844 | 10843 | } |
10845 | 10844 | |
10846 | 10845 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
10847 | - return (string) self::substr( |
|
10846 | + return (string)self::substr( |
|
10848 | 10847 | $haystack, |
10849 | 10848 | 0, |
10850 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
10849 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
10851 | 10850 | $encoding |
10852 | 10851 | ); |
10853 | 10852 | } |
@@ -10877,10 +10876,10 @@ discard block |
||
10877 | 10876 | } |
10878 | 10877 | |
10879 | 10878 | if ($encoding === 'UTF-8') { |
10880 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10879 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10881 | 10880 | } |
10882 | 10881 | |
10883 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10882 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10884 | 10883 | } |
10885 | 10884 | |
10886 | 10885 | /** |
@@ -11080,7 +11079,7 @@ discard block |
||
11080 | 11079 | // INFO: https://unicode.org/cldr/utility/character.jsp?a=%E2%84%8C |
11081 | 11080 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11082 | 11081 | /** @noinspection UnnecessaryCastingInspection */ |
11083 | - $str = (string) \transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11082 | + $str = (string)\transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11084 | 11083 | |
11085 | 11084 | // check again, if we only have ASCII, now ... |
11086 | 11085 | if (self::is_ascii($str) === true) { |
@@ -11204,7 +11203,7 @@ discard block |
||
11204 | 11203 | public static function to_boolean($str): bool |
11205 | 11204 | { |
11206 | 11205 | // init |
11207 | - $str = (string) $str; |
|
11206 | + $str = (string)$str; |
|
11208 | 11207 | |
11209 | 11208 | if ($str === '') { |
11210 | 11209 | return false; |
@@ -11232,10 +11231,10 @@ discard block |
||
11232 | 11231 | } |
11233 | 11232 | |
11234 | 11233 | if (\is_numeric($str)) { |
11235 | - return ((float) $str + 0) > 0; |
|
11234 | + return ((float)$str + 0) > 0; |
|
11236 | 11235 | } |
11237 | 11236 | |
11238 | - return (bool) \trim($str); |
|
11237 | + return (bool)\trim($str); |
|
11239 | 11238 | } |
11240 | 11239 | |
11241 | 11240 | /** |
@@ -11256,11 +11255,11 @@ discard block |
||
11256 | 11255 | |
11257 | 11256 | $fallback_char_escaped = \preg_quote($fallback_char, '/'); |
11258 | 11257 | |
11259 | - $string = (string) \preg_replace( |
|
11258 | + $string = (string)\preg_replace( |
|
11260 | 11259 | [ |
11261 | - '/[^' . $fallback_char_escaped . '\\.\\-a-zA-Z0-9\\s]/', // 1) remove un-needed chars |
|
11262 | - '/[\\s]+/u', // 2) convert spaces to $fallback_char |
|
11263 | - '/[' . $fallback_char_escaped . ']+/u', // 3) remove double $fallback_char's |
|
11260 | + '/[^'.$fallback_char_escaped.'\\.\\-a-zA-Z0-9\\s]/', // 1) remove un-needed chars |
|
11261 | + '/[\\s]+/u', // 2) convert spaces to $fallback_char |
|
11262 | + '/['.$fallback_char_escaped.']+/u', // 3) remove double $fallback_char's |
|
11264 | 11263 | ], |
11265 | 11264 | [ |
11266 | 11265 | '', |
@@ -11291,7 +11290,7 @@ discard block |
||
11291 | 11290 | return $str; |
11292 | 11291 | } |
11293 | 11292 | |
11294 | - $str = (string) $str; |
|
11293 | + $str = (string)$str; |
|
11295 | 11294 | if ($str === '') { |
11296 | 11295 | return ''; |
11297 | 11296 | } |
@@ -11338,7 +11337,7 @@ discard block |
||
11338 | 11337 | return $str; |
11339 | 11338 | } |
11340 | 11339 | |
11341 | - $str = (string) $str; |
|
11340 | + $str = (string)$str; |
|
11342 | 11341 | if ($str === '') { |
11343 | 11342 | return $str; |
11344 | 11343 | } |
@@ -11356,7 +11355,7 @@ discard block |
||
11356 | 11355 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
11357 | 11356 | |
11358 | 11357 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11359 | - $buf .= $c1 . $c2; |
|
11358 | + $buf .= $c1.$c2; |
|
11360 | 11359 | ++$i; |
11361 | 11360 | } else { // not valid UTF8 - convert it |
11362 | 11361 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11367,7 +11366,7 @@ discard block |
||
11367 | 11366 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
11368 | 11367 | |
11369 | 11368 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11370 | - $buf .= $c1 . $c2 . $c3; |
|
11369 | + $buf .= $c1.$c2.$c3; |
|
11371 | 11370 | $i += 2; |
11372 | 11371 | } else { // not valid UTF8 - convert it |
11373 | 11372 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11379,7 +11378,7 @@ discard block |
||
11379 | 11378 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
11380 | 11379 | |
11381 | 11380 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11382 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
11381 | + $buf .= $c1.$c2.$c3.$c4; |
|
11383 | 11382 | $i += 3; |
11384 | 11383 | } else { // not valid UTF8 - convert it |
11385 | 11384 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11405,13 +11404,13 @@ discard block |
||
11405 | 11404 | * |
11406 | 11405 | * @return string |
11407 | 11406 | */ |
11408 | - static function (array $matches): string { |
|
11407 | + static function(array $matches): string { |
|
11409 | 11408 | if (isset($matches[3])) { |
11410 | - $cp = (int) \hexdec($matches[3]); |
|
11409 | + $cp = (int)\hexdec($matches[3]); |
|
11411 | 11410 | } else { |
11412 | 11411 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
11413 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
11414 | - + (int) \hexdec($matches[2]) |
|
11412 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
11413 | + + (int)\hexdec($matches[2]) |
|
11415 | 11414 | + 0x10000 |
11416 | 11415 | - (0xD800 << 10) |
11417 | 11416 | - 0xDC00; |
@@ -11422,12 +11421,12 @@ discard block |
||
11422 | 11421 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
11423 | 11422 | |
11424 | 11423 | if ($cp < 0x80) { |
11425 | - return (string) self::chr($cp); |
|
11424 | + return (string)self::chr($cp); |
|
11426 | 11425 | } |
11427 | 11426 | |
11428 | 11427 | if ($cp < 0xA0) { |
11429 | 11428 | /** @noinspection UnnecessaryCastingInspection */ |
11430 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
11429 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
11431 | 11430 | } |
11432 | 11431 | |
11433 | 11432 | return self::decimal_to_chr($cp); |
@@ -11475,7 +11474,7 @@ discard block |
||
11475 | 11474 | |
11476 | 11475 | if (self::$SUPPORT['mbstring'] === true) { |
11477 | 11476 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11478 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
11477 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
11479 | 11478 | } |
11480 | 11479 | |
11481 | 11480 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -11512,15 +11511,15 @@ discard block |
||
11512 | 11511 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
11513 | 11512 | |
11514 | 11513 | if ($encoding === 'UTF-8') { |
11515 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
11514 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
11516 | 11515 | |
11517 | 11516 | if ($useMbFunction === true) { |
11518 | 11517 | $strPartOne = \mb_strtoupper( |
11519 | - (string) \mb_substr($str, 0, 1) |
|
11518 | + (string)\mb_substr($str, 0, 1) |
|
11520 | 11519 | ); |
11521 | 11520 | } else { |
11522 | 11521 | $strPartOne = self::strtoupper( |
11523 | - (string) \mb_substr($str, 0, 1), |
|
11522 | + (string)\mb_substr($str, 0, 1), |
|
11524 | 11523 | $encoding, |
11525 | 11524 | false, |
11526 | 11525 | $lang, |
@@ -11530,16 +11529,16 @@ discard block |
||
11530 | 11529 | } else { |
11531 | 11530 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11532 | 11531 | |
11533 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
11532 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
11534 | 11533 | |
11535 | 11534 | if ($useMbFunction === true) { |
11536 | 11535 | $strPartOne = \mb_strtoupper( |
11537 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
11536 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
11538 | 11537 | $encoding |
11539 | 11538 | ); |
11540 | 11539 | } else { |
11541 | 11540 | $strPartOne = self::strtoupper( |
11542 | - (string) self::substr($str, 0, 1, $encoding), |
|
11541 | + (string)self::substr($str, 0, 1, $encoding), |
|
11543 | 11542 | $encoding, |
11544 | 11543 | false, |
11545 | 11544 | $lang, |
@@ -11548,7 +11547,7 @@ discard block |
||
11548 | 11547 | } |
11549 | 11548 | } |
11550 | 11549 | |
11551 | - return $strPartOne . $strPartTwo; |
|
11550 | + return $strPartOne.$strPartTwo; |
|
11552 | 11551 | } |
11553 | 11552 | |
11554 | 11553 | /** |
@@ -11599,7 +11598,7 @@ discard block |
||
11599 | 11598 | $str = self::clean($str); |
11600 | 11599 | } |
11601 | 11600 | |
11602 | - $usePhpDefaultFunctions = !(bool) ($charlist . \implode('', $exceptions)); |
|
11601 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
11603 | 11602 | |
11604 | 11603 | if ( |
11605 | 11604 | $usePhpDefaultFunctions === true |
@@ -11986,7 +11985,7 @@ discard block |
||
11986 | 11985 | if ( |
11987 | 11986 | $keepUtf8Chars === true |
11988 | 11987 | && |
11989 | - self::strlen($return) >= (int) self::strlen($str_backup) |
|
11988 | + self::strlen($return) >= (int)self::strlen($str_backup) |
|
11990 | 11989 | ) { |
11991 | 11990 | return $str_backup; |
11992 | 11991 | } |
@@ -12062,17 +12061,17 @@ discard block |
||
12062 | 12061 | return ''; |
12063 | 12062 | } |
12064 | 12063 | |
12065 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
12064 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
12066 | 12065 | |
12067 | 12066 | if ( |
12068 | 12067 | !isset($matches[0]) |
12069 | 12068 | || |
12070 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
12069 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
12071 | 12070 | ) { |
12072 | 12071 | return $str; |
12073 | 12072 | } |
12074 | 12073 | |
12075 | - return \rtrim($matches[0]) . $strAddOn; |
|
12074 | + return \rtrim($matches[0]).$strAddOn; |
|
12076 | 12075 | } |
12077 | 12076 | |
12078 | 12077 | /** |
@@ -12159,7 +12158,7 @@ discard block |
||
12159 | 12158 | } |
12160 | 12159 | } |
12161 | 12160 | |
12162 | - return $strReturn . \implode('', $chars); |
|
12161 | + return $strReturn.\implode('', $chars); |
|
12163 | 12162 | } |
12164 | 12163 | |
12165 | 12164 | /** |
@@ -12211,7 +12210,7 @@ discard block |
||
12211 | 12210 | $finalBreak = ''; |
12212 | 12211 | } |
12213 | 12212 | |
12214 | - return \implode($delimiter ?? "\n", $stringArray) . $finalBreak; |
|
12213 | + return \implode($delimiter ?? "\n", $stringArray).$finalBreak; |
|
12215 | 12214 | } |
12216 | 12215 | |
12217 | 12216 | /** |
@@ -12269,7 +12268,7 @@ discard block |
||
12269 | 12268 | self::$ORD = self::getData('ord'); |
12270 | 12269 | } |
12271 | 12270 | |
12272 | - $len = \strlen((string) $str); |
|
12271 | + $len = \strlen((string)$str); |
|
12273 | 12272 | /** @noinspection ForeachInvariantsInspection */ |
12274 | 12273 | for ($i = 0; $i < $len; ++$i) { |
12275 | 12274 | $in = self::$ORD[$str[$i]]; |
@@ -12424,7 +12423,7 @@ discard block |
||
12424 | 12423 | /** @noinspection PhpIncludeInspection */ |
12425 | 12424 | /** @noinspection UsingInclusionReturnValueInspection */ |
12426 | 12425 | /** @psalm-suppress UnresolvableInclude */ |
12427 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
12426 | + return include __DIR__.'/data/'.$file.'.php'; |
|
12428 | 12427 | } |
12429 | 12428 | |
12430 | 12429 | /** |
@@ -12436,7 +12435,7 @@ discard block |
||
12436 | 12435 | */ |
12437 | 12436 | private static function getDataIfExists(string $file) |
12438 | 12437 | { |
12439 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
12438 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
12440 | 12439 | if (\file_exists($file)) { |
12441 | 12440 | /** @noinspection PhpIncludeInspection */ |
12442 | 12441 | /** @noinspection UsingInclusionReturnValueInspection */ |
@@ -12458,7 +12457,7 @@ discard block |
||
12458 | 12457 | |
12459 | 12458 | \uksort( |
12460 | 12459 | self::$EMOJI, |
12461 | - static function (string $a, string $b): int { |
|
12460 | + static function(string $a, string $b): int { |
|
12462 | 12461 | return \strlen($b) <=> \strlen($a); |
12463 | 12462 | } |
12464 | 12463 | ); |
@@ -12468,7 +12467,7 @@ discard block |
||
12468 | 12467 | |
12469 | 12468 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
12470 | 12469 | $tmpKey = \crc32($key); |
12471 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmpKey . '_-_' . \strrev((string) $tmpKey) . '_-_8FTU_ELBATROP_-_'; |
|
12470 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmpKey.'_-_'.\strrev((string)$tmpKey).'_-_8FTU_ELBATROP_-_'; |
|
12472 | 12471 | } |
12473 | 12472 | |
12474 | 12473 | return true; |
@@ -12492,7 +12491,7 @@ discard block |
||
12492 | 12491 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
12493 | 12492 | return \defined('MB_OVERLOAD_STRING') |
12494 | 12493 | && |
12495 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12494 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12496 | 12495 | } |
12497 | 12496 | |
12498 | 12497 | /** |
@@ -12542,7 +12541,7 @@ discard block |
||
12542 | 12541 | { |
12543 | 12542 | static $RX_CLASS_CACHE = []; |
12544 | 12543 | |
12545 | - $cacheKey = $s . $class; |
|
12544 | + $cacheKey = $s.$class; |
|
12546 | 12545 | |
12547 | 12546 | if (isset($RX_CLASS_CACHE[$cacheKey])) { |
12548 | 12547 | return $RX_CLASS_CACHE[$cacheKey]; |
@@ -12554,7 +12553,7 @@ discard block |
||
12554 | 12553 | /** @noinspection AlterInForeachInspection */ |
12555 | 12554 | foreach (self::str_split($s) as &$s) { |
12556 | 12555 | if ($s === '-') { |
12557 | - $classArray[0] = '-' . $classArray[0]; |
|
12556 | + $classArray[0] = '-'.$classArray[0]; |
|
12558 | 12557 | } elseif (!isset($s[2])) { |
12559 | 12558 | $classArray[0] .= \preg_quote($s, '/'); |
12560 | 12559 | } elseif (self::strlen($s) === 1) { |
@@ -12565,13 +12564,13 @@ discard block |
||
12565 | 12564 | } |
12566 | 12565 | |
12567 | 12566 | if ($classArray[0]) { |
12568 | - $classArray[0] = '[' . $classArray[0] . ']'; |
|
12567 | + $classArray[0] = '['.$classArray[0].']'; |
|
12569 | 12568 | } |
12570 | 12569 | |
12571 | 12570 | if (\count($classArray) === 1) { |
12572 | 12571 | $return = $classArray[0]; |
12573 | 12572 | } else { |
12574 | - $return = '(?:' . \implode('|', $classArray) . ')'; |
|
12573 | + $return = '(?:'.\implode('|', $classArray).')'; |
|
12575 | 12574 | } |
12576 | 12575 | |
12577 | 12576 | $RX_CLASS_CACHE[$cacheKey] = $return; |
@@ -12646,7 +12645,7 @@ discard block |
||
12646 | 12645 | |
12647 | 12646 | if ($delimiter === '-') { |
12648 | 12647 | /** @noinspection AlterInForeachInspection */ |
12649 | - foreach ((array) $specialCases['names'] as &$beginning) { |
|
12648 | + foreach ((array)$specialCases['names'] as &$beginning) { |
|
12650 | 12649 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12651 | 12650 | $continue = true; |
12652 | 12651 | } |
@@ -12654,7 +12653,7 @@ discard block |
||
12654 | 12653 | } |
12655 | 12654 | |
12656 | 12655 | /** @noinspection AlterInForeachInspection */ |
12657 | - foreach ((array) $specialCases['prefixes'] as &$beginning) { |
|
12656 | + foreach ((array)$specialCases['prefixes'] as &$beginning) { |
|
12658 | 12657 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12659 | 12658 | $continue = true; |
12660 | 12659 | } |
@@ -12714,8 +12713,8 @@ discard block |
||
12714 | 12713 | } else { |
12715 | 12714 | /** @noinspection OffsetOperationsInspection */ |
12716 | 12715 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
12717 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
12718 | - $buf .= $cc1 . $cc2; |
|
12716 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
12717 | + $buf .= $cc1.$cc2; |
|
12719 | 12718 | } |
12720 | 12719 | |
12721 | 12720 | return $buf; |
@@ -12730,7 +12729,7 @@ discard block |
||
12730 | 12729 | { |
12731 | 12730 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
12732 | 12731 | if (\preg_match($pattern, $str)) { |
12733 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
12732 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
12734 | 12733 | } |
12735 | 12734 | |
12736 | 12735 | return $str; |