@@ -255,10 +255,10 @@ discard block |
||
255 | 255 | } |
256 | 256 | |
257 | 257 | if ($encoding === 'UTF-8') { |
258 | - return (string) \mb_substr($str, $pos, 1); |
|
258 | + return (string)\mb_substr($str, $pos, 1); |
|
259 | 259 | } |
260 | 260 | |
261 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
261 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | /** |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | public static function add_bom_to_string(string $str): string |
274 | 274 | { |
275 | 275 | if (self::string_has_bom($str) === false) { |
276 | - $str = self::bom() . $str; |
|
276 | + $str = self::bom().$str; |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | return $str; |
@@ -302,8 +302,8 @@ discard block |
||
302 | 302 | $return = []; |
303 | 303 | foreach ($array as $key => &$value) { |
304 | 304 | $key = $case === \CASE_LOWER |
305 | - ? self::strtolower((string) $key, $encoding) |
|
306 | - : self::strtoupper((string) $key, $encoding); |
|
305 | + ? self::strtolower((string)$key, $encoding) |
|
306 | + : self::strtoupper((string)$key, $encoding); |
|
307 | 307 | |
308 | 308 | $return[$key] = $value; |
309 | 309 | } |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | return ''; |
338 | 338 | } |
339 | 339 | |
340 | - $substrIndex = $posStart + (int) \mb_strlen($start); |
|
340 | + $substrIndex = $posStart + (int)\mb_strlen($start); |
|
341 | 341 | $posEnd = \mb_strpos($str, $end, $substrIndex); |
342 | 342 | if ( |
343 | 343 | $posEnd === false |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | return ''; |
348 | 348 | } |
349 | 349 | |
350 | - return (string) \mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
350 | + return (string)\mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | return ''; |
358 | 358 | } |
359 | 359 | |
360 | - $substrIndex = $posStart + (int) self::strlen($start, $encoding); |
|
360 | + $substrIndex = $posStart + (int)self::strlen($start, $encoding); |
|
361 | 361 | $posEnd = self::strpos($str, $end, $substrIndex, $encoding); |
362 | 362 | if ( |
363 | 363 | $posEnd === false |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | return ''; |
368 | 368 | } |
369 | 369 | |
370 | - return (string) self::substr( |
|
370 | + return (string)self::substr( |
|
371 | 371 | $str, |
372 | 372 | $substrIndex, |
373 | 373 | $posEnd - $substrIndex, |
@@ -435,10 +435,10 @@ discard block |
||
435 | 435 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
436 | 436 | { |
437 | 437 | if ($encoding === 'UTF-8') { |
438 | - return (string) \mb_substr($str, $index, 1); |
|
438 | + return (string)\mb_substr($str, $index, 1); |
|
439 | 439 | } |
440 | 440 | |
441 | - return (string) self::substr($str, $index, 1, $encoding); |
|
441 | + return (string)self::substr($str, $index, 1, $encoding); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | /** |
@@ -543,10 +543,10 @@ discard block |
||
543 | 543 | && |
544 | 544 | self::$SUPPORT['mbstring'] === false |
545 | 545 | ) { |
546 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
546 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
547 | 547 | } |
548 | 548 | |
549 | - $cacheKey = $code_point . $encoding; |
|
549 | + $cacheKey = $code_point.$encoding; |
|
550 | 550 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
551 | 551 | return $CHAR_CACHE[$cacheKey]; |
552 | 552 | } |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | if ($code_point <= 127) { // use "simple"-char only until "\x80" |
555 | 555 | |
556 | 556 | if (self::$CHR === null) { |
557 | - self::$CHR = (array) self::getData('chr'); |
|
557 | + self::$CHR = (array)self::getData('chr'); |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | /** |
@@ -589,10 +589,10 @@ discard block |
||
589 | 589 | // |
590 | 590 | |
591 | 591 | if (self::$CHR === null) { |
592 | - self::$CHR = (array) self::getData('chr'); |
|
592 | + self::$CHR = (array)self::getData('chr'); |
|
593 | 593 | } |
594 | 594 | |
595 | - $code_point = (int) $code_point; |
|
595 | + $code_point = (int)$code_point; |
|
596 | 596 | if ($code_point <= 0x7F) { |
597 | 597 | /** |
598 | 598 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -602,22 +602,22 @@ discard block |
||
602 | 602 | /** |
603 | 603 | * @psalm-suppress PossiblyNullArrayAccess |
604 | 604 | */ |
605 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
605 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
606 | 606 | self::$CHR[($code_point & 0x3F) + 0x80]; |
607 | 607 | } elseif ($code_point <= 0xFFFF) { |
608 | 608 | /** |
609 | 609 | * @psalm-suppress PossiblyNullArrayAccess |
610 | 610 | */ |
611 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
612 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
611 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
612 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
613 | 613 | self::$CHR[($code_point & 0x3F) + 0x80]; |
614 | 614 | } else { |
615 | 615 | /** |
616 | 616 | * @psalm-suppress PossiblyNullArrayAccess |
617 | 617 | */ |
618 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
619 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
620 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
618 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
619 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
620 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
621 | 621 | self::$CHR[($code_point & 0x3F) + 0x80]; |
622 | 622 | } |
623 | 623 | |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | |
665 | 665 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
666 | 666 | return \array_map( |
667 | - static function (string $data): int { |
|
667 | + static function(string $data): int { |
|
668 | 668 | // "mb_" is available if overload is used, so use it ... |
669 | 669 | return \mb_strlen($data, 'CP850'); // 8-BIT |
670 | 670 | }, |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | $char = ''; |
733 | 733 | } |
734 | 734 | |
735 | - return self::int_to_hex(self::ord((string) $char), $pfix); |
|
735 | + return self::int_to_hex(self::ord((string)$char), $pfix); |
|
736 | 736 | } |
737 | 737 | |
738 | 738 | /** |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | | ( [\x80-\xBF] ) # invalid byte in range 10000000 - 10111111 |
807 | 807 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
808 | 808 | /x'; |
809 | - $str = (string) \preg_replace($regx, '$1', $str); |
|
809 | + $str = (string)\preg_replace($regx, '$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 | /** |
@@ -1070,7 +1070,7 @@ discard block |
||
1070 | 1070 | if ($toEncoding === 'JSON') { |
1071 | 1071 | $return = self::json_encode($str); |
1072 | 1072 | if ($return === false) { |
1073 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1073 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1074 | 1074 | } |
1075 | 1075 | |
1076 | 1076 | return $return; |
@@ -1156,7 +1156,7 @@ discard block |
||
1156 | 1156 | && |
1157 | 1157 | self::$SUPPORT['mbstring'] === false |
1158 | 1158 | ) { |
1159 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $toEncoding . '" encoding', \E_USER_WARNING); |
|
1159 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$toEncoding.'" encoding', \E_USER_WARNING); |
|
1160 | 1160 | } |
1161 | 1161 | |
1162 | 1162 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1250,31 +1250,31 @@ discard block |
||
1250 | 1250 | $trimChars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1251 | 1251 | |
1252 | 1252 | if ($length === null) { |
1253 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
1253 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
1254 | 1254 | } |
1255 | 1255 | |
1256 | 1256 | if ($search === '') { |
1257 | 1257 | if ($encoding === 'UTF-8') { |
1258 | 1258 | if ($length > 0) { |
1259 | - $stringLength = (int) \mb_strlen($str); |
|
1259 | + $stringLength = (int)\mb_strlen($str); |
|
1260 | 1260 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
1261 | 1261 | } else { |
1262 | 1262 | $end = 0; |
1263 | 1263 | } |
1264 | 1264 | |
1265 | - $pos = (int) \min( |
|
1265 | + $pos = (int)\min( |
|
1266 | 1266 | \mb_strpos($str, ' ', $end), |
1267 | 1267 | \mb_strpos($str, '.', $end) |
1268 | 1268 | ); |
1269 | 1269 | } else { |
1270 | 1270 | if ($length > 0) { |
1271 | - $stringLength = (int) self::strlen($str, $encoding); |
|
1271 | + $stringLength = (int)self::strlen($str, $encoding); |
|
1272 | 1272 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
1273 | 1273 | } else { |
1274 | 1274 | $end = 0; |
1275 | 1275 | } |
1276 | 1276 | |
1277 | - $pos = (int) \min( |
|
1277 | + $pos = (int)\min( |
|
1278 | 1278 | self::strpos($str, ' ', $end, $encoding), |
1279 | 1279 | self::strpos($str, '.', $end, $encoding) |
1280 | 1280 | ); |
@@ -1291,18 +1291,18 @@ discard block |
||
1291 | 1291 | return ''; |
1292 | 1292 | } |
1293 | 1293 | |
1294 | - return \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1294 | + return \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1295 | 1295 | } |
1296 | 1296 | |
1297 | 1297 | return $str; |
1298 | 1298 | } |
1299 | 1299 | |
1300 | 1300 | if ($encoding === 'UTF-8') { |
1301 | - $wordPos = (int) \mb_stripos($str, $search); |
|
1302 | - $halfSide = (int) ($wordPos - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1301 | + $wordPos = (int)\mb_stripos($str, $search); |
|
1302 | + $halfSide = (int)($wordPos - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1303 | 1303 | } else { |
1304 | - $wordPos = (int) self::stripos($str, $search, 0, $encoding); |
|
1305 | - $halfSide = (int) ($wordPos - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1304 | + $wordPos = (int)self::stripos($str, $search, 0, $encoding); |
|
1305 | + $halfSide = (int)($wordPos - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1306 | 1306 | } |
1307 | 1307 | |
1308 | 1308 | $pos_start = 0; |
@@ -1314,12 +1314,12 @@ discard block |
||
1314 | 1314 | } |
1315 | 1315 | if ($halfText !== false) { |
1316 | 1316 | if ($encoding === 'UTF-8') { |
1317 | - $pos_start = (int) \max( |
|
1317 | + $pos_start = (int)\max( |
|
1318 | 1318 | \mb_strrpos($halfText, ' '), |
1319 | 1319 | \mb_strrpos($halfText, '.') |
1320 | 1320 | ); |
1321 | 1321 | } else { |
1322 | - $pos_start = (int) \max( |
|
1322 | + $pos_start = (int)\max( |
|
1323 | 1323 | self::strrpos($halfText, ' ', 0, $encoding), |
1324 | 1324 | self::strrpos($halfText, '.', 0, $encoding) |
1325 | 1325 | ); |
@@ -1329,19 +1329,19 @@ discard block |
||
1329 | 1329 | |
1330 | 1330 | if ($wordPos && $halfSide > 0) { |
1331 | 1331 | $offset = $pos_start + $length - 1; |
1332 | - $realLength = (int) self::strlen($str, $encoding); |
|
1332 | + $realLength = (int)self::strlen($str, $encoding); |
|
1333 | 1333 | |
1334 | 1334 | if ($offset > $realLength) { |
1335 | 1335 | $offset = $realLength; |
1336 | 1336 | } |
1337 | 1337 | |
1338 | 1338 | if ($encoding === 'UTF-8') { |
1339 | - $pos_end = (int) \min( |
|
1339 | + $pos_end = (int)\min( |
|
1340 | 1340 | \mb_strpos($str, ' ', $offset), |
1341 | 1341 | \mb_strpos($str, '.', $offset) |
1342 | 1342 | ) - $pos_start; |
1343 | 1343 | } else { |
1344 | - $pos_end = (int) \min( |
|
1344 | + $pos_end = (int)\min( |
|
1345 | 1345 | self::strpos($str, ' ', $offset, $encoding), |
1346 | 1346 | self::strpos($str, '.', $offset, $encoding) |
1347 | 1347 | ) - $pos_start; |
@@ -1349,12 +1349,12 @@ discard block |
||
1349 | 1349 | |
1350 | 1350 | if (!$pos_end || $pos_end <= 0) { |
1351 | 1351 | if ($encoding === 'UTF-8') { |
1352 | - $strSub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1352 | + $strSub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1353 | 1353 | } else { |
1354 | - $strSub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1354 | + $strSub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1355 | 1355 | } |
1356 | 1356 | if ($strSub !== false) { |
1357 | - $extract = $replacerForSkippedText . \ltrim($strSub, $trimChars); |
|
1357 | + $extract = $replacerForSkippedText.\ltrim($strSub, $trimChars); |
|
1358 | 1358 | } else { |
1359 | 1359 | $extract = ''; |
1360 | 1360 | } |
@@ -1365,26 +1365,26 @@ discard block |
||
1365 | 1365 | $strSub = self::substr($str, $pos_start, $pos_end, $encoding); |
1366 | 1366 | } |
1367 | 1367 | if ($strSub !== false) { |
1368 | - $extract = $replacerForSkippedText . \trim($strSub, $trimChars) . $replacerForSkippedText; |
|
1368 | + $extract = $replacerForSkippedText.\trim($strSub, $trimChars).$replacerForSkippedText; |
|
1369 | 1369 | } else { |
1370 | 1370 | $extract = ''; |
1371 | 1371 | } |
1372 | 1372 | } |
1373 | 1373 | } else { |
1374 | 1374 | $offset = $length - 1; |
1375 | - $trueLength = (int) self::strlen($str, $encoding); |
|
1375 | + $trueLength = (int)self::strlen($str, $encoding); |
|
1376 | 1376 | |
1377 | 1377 | if ($offset > $trueLength) { |
1378 | 1378 | $offset = $trueLength; |
1379 | 1379 | } |
1380 | 1380 | |
1381 | 1381 | if ($encoding === 'UTF-8') { |
1382 | - $pos_end = (int) \min( |
|
1382 | + $pos_end = (int)\min( |
|
1383 | 1383 | \mb_strpos($str, ' ', $offset), |
1384 | 1384 | \mb_strpos($str, '.', $offset) |
1385 | 1385 | ); |
1386 | 1386 | } else { |
1387 | - $pos_end = (int) \min( |
|
1387 | + $pos_end = (int)\min( |
|
1388 | 1388 | self::strpos($str, ' ', $offset, $encoding), |
1389 | 1389 | self::strpos($str, '.', $offset, $encoding) |
1390 | 1390 | ); |
@@ -1397,7 +1397,7 @@ discard block |
||
1397 | 1397 | $strSub = self::substr($str, 0, $pos_end, $encoding); |
1398 | 1398 | } |
1399 | 1399 | if ($strSub !== false) { |
1400 | - $extract = \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1400 | + $extract = \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1401 | 1401 | } else { |
1402 | 1402 | $extract = ''; |
1403 | 1403 | } |
@@ -1521,7 +1521,7 @@ discard block |
||
1521 | 1521 | { |
1522 | 1522 | $file_content = \file_get_contents($file_path); |
1523 | 1523 | if ($file_content === false) { |
1524 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1524 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1525 | 1525 | } |
1526 | 1526 | |
1527 | 1527 | return self::string_has_bom($file_content); |
@@ -1582,7 +1582,7 @@ discard block |
||
1582 | 1582 | ) { |
1583 | 1583 | // Prevent leading combining chars |
1584 | 1584 | // for NFC-safe concatenations. |
1585 | - $var = $leading_combining . $var; |
|
1585 | + $var = $leading_combining.$var; |
|
1586 | 1586 | } |
1587 | 1587 | } |
1588 | 1588 | |
@@ -1821,10 +1821,10 @@ discard block |
||
1821 | 1821 | } |
1822 | 1822 | |
1823 | 1823 | if ($encoding === 'UTF-8') { |
1824 | - return (string) \mb_substr($str, 0, $n); |
|
1824 | + return (string)\mb_substr($str, 0, $n); |
|
1825 | 1825 | } |
1826 | 1826 | |
1827 | - return (string) self::substr($str, 0, $n, $encoding); |
|
1827 | + return (string)self::substr($str, 0, $n, $encoding); |
|
1828 | 1828 | } |
1829 | 1829 | |
1830 | 1830 | /** |
@@ -1899,7 +1899,7 @@ discard block |
||
1899 | 1899 | return $str; |
1900 | 1900 | } |
1901 | 1901 | |
1902 | - $str = (string) $str; |
|
1902 | + $str = (string)$str; |
|
1903 | 1903 | $last = ''; |
1904 | 1904 | while ($last !== $str) { |
1905 | 1905 | $last = $str; |
@@ -2085,7 +2085,7 @@ discard block |
||
2085 | 2085 | if ($str_info === false) { |
2086 | 2086 | return $fallback; |
2087 | 2087 | } |
2088 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2088 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2089 | 2089 | |
2090 | 2090 | // DEBUG |
2091 | 2091 | //var_dump($type_code); |
@@ -2174,7 +2174,7 @@ discard block |
||
2174 | 2174 | // |
2175 | 2175 | |
2176 | 2176 | if ($encoding === 'UTF-8') { |
2177 | - $maxlength = (int) \mb_strlen($possibleChars); |
|
2177 | + $maxlength = (int)\mb_strlen($possibleChars); |
|
2178 | 2178 | if ($maxlength === 0) { |
2179 | 2179 | return ''; |
2180 | 2180 | } |
@@ -2195,7 +2195,7 @@ discard block |
||
2195 | 2195 | } else { |
2196 | 2196 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2197 | 2197 | |
2198 | - $maxlength = (int) self::strlen($possibleChars, $encoding); |
|
2198 | + $maxlength = (int)self::strlen($possibleChars, $encoding); |
|
2199 | 2199 | if ($maxlength === 0) { |
2200 | 2200 | return ''; |
2201 | 2201 | } |
@@ -2226,16 +2226,16 @@ discard block |
||
2226 | 2226 | */ |
2227 | 2227 | public static function get_unique_string($entropyExtra = '', bool $md5 = true): string |
2228 | 2228 | { |
2229 | - $uniqueHelper = \random_int(0, \mt_getrandmax()) . |
|
2230 | - \session_id() . |
|
2231 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2232 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2229 | + $uniqueHelper = \random_int(0, \mt_getrandmax()). |
|
2230 | + \session_id(). |
|
2231 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2232 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2233 | 2233 | $entropyExtra; |
2234 | 2234 | |
2235 | 2235 | $uniqueString = \uniqid($uniqueHelper, true); |
2236 | 2236 | |
2237 | 2237 | if ($md5) { |
2238 | - $uniqueString = \md5($uniqueString . $uniqueHelper); |
|
2238 | + $uniqueString = \md5($uniqueString.$uniqueHelper); |
|
2239 | 2239 | } |
2240 | 2240 | |
2241 | 2241 | return $uniqueString; |
@@ -2315,7 +2315,7 @@ discard block |
||
2315 | 2315 | public static function hex_to_int($hexDec) |
2316 | 2316 | { |
2317 | 2317 | // init |
2318 | - $hexDec = (string) $hexDec; |
|
2318 | + $hexDec = (string)$hexDec; |
|
2319 | 2319 | |
2320 | 2320 | if ($hexDec === '') { |
2321 | 2321 | return false; |
@@ -2393,7 +2393,7 @@ discard block |
||
2393 | 2393 | return \implode( |
2394 | 2394 | '', |
2395 | 2395 | \array_map( |
2396 | - static function (string $chr) use ($keepAsciiChars, $encoding): string { |
|
2396 | + static function(string $chr) use ($keepAsciiChars, $encoding): string { |
|
2397 | 2397 | return self::single_chr_html_encode($chr, $keepAsciiChars, $encoding); |
2398 | 2398 | }, |
2399 | 2399 | self::str_split($str) |
@@ -2497,7 +2497,7 @@ discard block |
||
2497 | 2497 | && |
2498 | 2498 | self::$SUPPORT['mbstring'] === false |
2499 | 2499 | ) { |
2500 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2500 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2501 | 2501 | } |
2502 | 2502 | |
2503 | 2503 | do { |
@@ -2518,14 +2518,14 @@ discard block |
||
2518 | 2518 | ); |
2519 | 2519 | } |
2520 | 2520 | } else { |
2521 | - $str = (string) \preg_replace_callback( |
|
2521 | + $str = (string)\preg_replace_callback( |
|
2522 | 2522 | "/&#\d{2,6};/", |
2523 | 2523 | /** |
2524 | 2524 | * @param string[] $matches |
2525 | 2525 | * |
2526 | 2526 | * @return string |
2527 | 2527 | */ |
2528 | - static function (array $matches) use ($encoding): string { |
|
2528 | + static function(array $matches) use ($encoding): string { |
|
2529 | 2529 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
2530 | 2530 | if ($returnTmp !== '"' && $returnTmp !== "'") { |
2531 | 2531 | return $returnTmp; |
@@ -2540,7 +2540,7 @@ discard block |
||
2540 | 2540 | if (\strpos($str, '&') !== false) { |
2541 | 2541 | if (\strpos($str, '&#') !== false) { |
2542 | 2542 | // decode also numeric & UTF16 two byte entities |
2543 | - $str = (string) \preg_replace( |
|
2543 | + $str = (string)\preg_replace( |
|
2544 | 2544 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
2545 | 2545 | '$1;', |
2546 | 2546 | $str |
@@ -2586,7 +2586,7 @@ discard block |
||
2586 | 2586 | */ |
2587 | 2587 | public static function html_stripe_empty_tags(string $str): string |
2588 | 2588 | { |
2589 | - return (string) \preg_replace( |
|
2589 | + return (string)\preg_replace( |
|
2590 | 2590 | "/<[^\/>]*>(([\s]?)*|)<\/[^>]*>/u", |
2591 | 2591 | '', |
2592 | 2592 | $str |
@@ -2885,9 +2885,9 @@ discard block |
||
2885 | 2885 | { |
2886 | 2886 | $hex = \dechex($int); |
2887 | 2887 | |
2888 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
2888 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
2889 | 2889 | |
2890 | - return $pfix . $hex . ''; |
|
2890 | + return $pfix.$hex.''; |
|
2891 | 2891 | } |
2892 | 2892 | |
2893 | 2893 | /** |
@@ -3154,7 +3154,7 @@ discard block |
||
3154 | 3154 | */ |
3155 | 3155 | public static function is_binary($input, bool $strict = false): bool |
3156 | 3156 | { |
3157 | - $input = (string) $input; |
|
3157 | + $input = (string)$input; |
|
3158 | 3158 | if ($input === '') { |
3159 | 3159 | return false; |
3160 | 3160 | } |
@@ -3413,7 +3413,7 @@ discard block |
||
3413 | 3413 | public static function is_utf16($str, $checkIfStringIsBinary = true) |
3414 | 3414 | { |
3415 | 3415 | // init |
3416 | - $str = (string) $str; |
|
3416 | + $str = (string)$str; |
|
3417 | 3417 | $strChars = []; |
3418 | 3418 | |
3419 | 3419 | if ( |
@@ -3491,7 +3491,7 @@ discard block |
||
3491 | 3491 | public static function is_utf32($str, $checkIfStringIsBinary = true) |
3492 | 3492 | { |
3493 | 3493 | // init |
3494 | - $str = (string) $str; |
|
3494 | + $str = (string)$str; |
|
3495 | 3495 | $strChars = []; |
3496 | 3496 | |
3497 | 3497 | if ( |
@@ -3570,16 +3570,16 @@ discard block |
||
3570 | 3570 | self::initEmojiData(); |
3571 | 3571 | |
3572 | 3572 | if ($useReversibleStringMapping === true) { |
3573 | - return (string) \str_replace( |
|
3574 | - (array) self::$EMOJI_VALUES_CACHE, |
|
3575 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
3573 | + return (string)\str_replace( |
|
3574 | + (array)self::$EMOJI_VALUES_CACHE, |
|
3575 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
3576 | 3576 | $str |
3577 | 3577 | ); |
3578 | 3578 | } |
3579 | 3579 | |
3580 | - return (string) \str_replace( |
|
3581 | - (array) self::$EMOJI_VALUES_CACHE, |
|
3582 | - (array) self::$EMOJI_KEYS_CACHE, |
|
3580 | + return (string)\str_replace( |
|
3581 | + (array)self::$EMOJI_VALUES_CACHE, |
|
3582 | + (array)self::$EMOJI_KEYS_CACHE, |
|
3583 | 3583 | $str |
3584 | 3584 | ); |
3585 | 3585 | } |
@@ -3599,16 +3599,16 @@ discard block |
||
3599 | 3599 | self::initEmojiData(); |
3600 | 3600 | |
3601 | 3601 | if ($useReversibleStringMapping === true) { |
3602 | - return (string) \str_replace( |
|
3603 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
3604 | - (array) self::$EMOJI_VALUES_CACHE, |
|
3602 | + return (string)\str_replace( |
|
3603 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
3604 | + (array)self::$EMOJI_VALUES_CACHE, |
|
3605 | 3605 | $str |
3606 | 3606 | ); |
3607 | 3607 | } |
3608 | 3608 | |
3609 | - return (string) \str_replace( |
|
3610 | - (array) self::$EMOJI_KEYS_CACHE, |
|
3611 | - (array) self::$EMOJI_VALUES_CACHE, |
|
3609 | + return (string)\str_replace( |
|
3610 | + (array)self::$EMOJI_KEYS_CACHE, |
|
3611 | + (array)self::$EMOJI_VALUES_CACHE, |
|
3612 | 3612 | $str |
3613 | 3613 | ); |
3614 | 3614 | } |
@@ -3669,7 +3669,7 @@ discard block |
||
3669 | 3669 | self::$ORD = self::getData('ord'); |
3670 | 3670 | } |
3671 | 3671 | |
3672 | - $len = \strlen((string) $str); |
|
3672 | + $len = \strlen((string)$str); |
|
3673 | 3673 | /** @noinspection ForeachInvariantsInspection */ |
3674 | 3674 | for ($i = 0; $i < $len; ++$i) { |
3675 | 3675 | $in = self::$ORD[$str[$i]]; |
@@ -3906,15 +3906,15 @@ discard block |
||
3906 | 3906 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
3907 | 3907 | |
3908 | 3908 | if ($encoding === 'UTF-8') { |
3909 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
3909 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
3910 | 3910 | |
3911 | 3911 | if ($useMbFunction === true) { |
3912 | 3912 | $strPartOne = \mb_strtolower( |
3913 | - (string) \mb_substr($str, 0, 1) |
|
3913 | + (string)\mb_substr($str, 0, 1) |
|
3914 | 3914 | ); |
3915 | 3915 | } else { |
3916 | 3916 | $strPartOne = self::strtolower( |
3917 | - (string) \mb_substr($str, 0, 1), |
|
3917 | + (string)\mb_substr($str, 0, 1), |
|
3918 | 3918 | $encoding, |
3919 | 3919 | false, |
3920 | 3920 | $lang, |
@@ -3924,10 +3924,10 @@ discard block |
||
3924 | 3924 | } else { |
3925 | 3925 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
3926 | 3926 | |
3927 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
3927 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
3928 | 3928 | |
3929 | 3929 | $strPartOne = self::strtolower( |
3930 | - (string) self::substr($str, 0, 1, $encoding), |
|
3930 | + (string)self::substr($str, 0, 1, $encoding), |
|
3931 | 3931 | $encoding, |
3932 | 3932 | false, |
3933 | 3933 | $lang, |
@@ -3935,7 +3935,7 @@ discard block |
||
3935 | 3935 | ); |
3936 | 3936 | } |
3937 | 3937 | |
3938 | - return $strPartOne . $strPartTwo; |
|
3938 | + return $strPartOne.$strPartTwo; |
|
3939 | 3939 | } |
3940 | 3940 | |
3941 | 3941 | /** |
@@ -4054,7 +4054,7 @@ discard block |
||
4054 | 4054 | |
4055 | 4055 | if (self::$SUPPORT['mbstring'] === true) { |
4056 | 4056 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4057 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4057 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4058 | 4058 | } |
4059 | 4059 | |
4060 | 4060 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -4095,7 +4095,7 @@ discard block |
||
4095 | 4095 | { |
4096 | 4096 | $bytes = self::chr_size_list($str); |
4097 | 4097 | if (\count($bytes) > 0) { |
4098 | - return (int) \max($bytes); |
|
4098 | + return (int)\max($bytes); |
|
4099 | 4099 | } |
4100 | 4100 | |
4101 | 4101 | return 0; |
@@ -4165,7 +4165,7 @@ discard block |
||
4165 | 4165 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4166 | 4166 | |
4167 | 4167 | // init |
4168 | - $encoding = (string) $encoding; |
|
4168 | + $encoding = (string)$encoding; |
|
4169 | 4169 | |
4170 | 4170 | if (!$encoding) { |
4171 | 4171 | return $fallback; |
@@ -4219,7 +4219,7 @@ discard block |
||
4219 | 4219 | |
4220 | 4220 | $encodingOrig = $encoding; |
4221 | 4221 | $encoding = \strtoupper($encoding); |
4222 | - $encodingUpperHelper = (string) \preg_replace('/[^a-zA-Z0-9\s]/u', '', $encoding); |
|
4222 | + $encodingUpperHelper = (string)\preg_replace('/[^a-zA-Z0-9\s]/u', '', $encoding); |
|
4223 | 4223 | |
4224 | 4224 | $equivalences = [ |
4225 | 4225 | 'ISO8859' => 'ISO-8859-1', |
@@ -4377,7 +4377,7 @@ discard block |
||
4377 | 4377 | } |
4378 | 4378 | |
4379 | 4379 | static $WHITESPACE_CACHE = []; |
4380 | - $cacheKey = (int) $keepNonBreakingSpace; |
|
4380 | + $cacheKey = (int)$keepNonBreakingSpace; |
|
4381 | 4381 | |
4382 | 4382 | if (!isset($WHITESPACE_CACHE[$cacheKey])) { |
4383 | 4383 | $WHITESPACE_CACHE[$cacheKey] = self::$WHITESPACE_TABLE; |
@@ -4419,13 +4419,13 @@ discard block |
||
4419 | 4419 | static $CHAR_CACHE = []; |
4420 | 4420 | |
4421 | 4421 | // init |
4422 | - $chr = (string) $chr; |
|
4422 | + $chr = (string)$chr; |
|
4423 | 4423 | |
4424 | 4424 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4425 | 4425 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4426 | 4426 | } |
4427 | 4427 | |
4428 | - $cacheKey = $chr . $encoding; |
|
4428 | + $cacheKey = $chr.$encoding; |
|
4429 | 4429 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
4430 | 4430 | return $CHAR_CACHE[$cacheKey]; |
4431 | 4431 | } |
@@ -4460,22 +4460,22 @@ discard block |
||
4460 | 4460 | // |
4461 | 4461 | |
4462 | 4462 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
4463 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
4463 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
4464 | 4464 | $code = $chr ? $chr[1] : 0; |
4465 | 4465 | |
4466 | 4466 | if ($code >= 0xF0 && isset($chr[4])) { |
4467 | 4467 | /** @noinspection UnnecessaryCastingInspection */ |
4468 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4468 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4469 | 4469 | } |
4470 | 4470 | |
4471 | 4471 | if ($code >= 0xE0 && isset($chr[3])) { |
4472 | 4472 | /** @noinspection UnnecessaryCastingInspection */ |
4473 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4473 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4474 | 4474 | } |
4475 | 4475 | |
4476 | 4476 | if ($code >= 0xC0 && isset($chr[2])) { |
4477 | 4477 | /** @noinspection UnnecessaryCastingInspection */ |
4478 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4478 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4479 | 4479 | } |
4480 | 4480 | |
4481 | 4481 | return $CHAR_CACHE[$cacheKey] = $code; |
@@ -4524,7 +4524,7 @@ discard block |
||
4524 | 4524 | public static function pcre_utf8_support(): bool |
4525 | 4525 | { |
4526 | 4526 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4527 | - return (bool) @\preg_match('//u', ''); |
|
4527 | + return (bool)@\preg_match('//u', ''); |
|
4528 | 4528 | } |
4529 | 4529 | |
4530 | 4530 | /** |
@@ -4546,10 +4546,10 @@ discard block |
||
4546 | 4546 | } |
4547 | 4547 | |
4548 | 4548 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4549 | - if (\ctype_digit((string) $var1)) { |
|
4550 | - $start = (int) $var1; |
|
4549 | + if (\ctype_digit((string)$var1)) { |
|
4550 | + $start = (int)$var1; |
|
4551 | 4551 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var1)) { |
4552 | - $start = (int) self::hex_to_int($var1); |
|
4552 | + $start = (int)self::hex_to_int($var1); |
|
4553 | 4553 | } else { |
4554 | 4554 | $start = self::ord($var1); |
4555 | 4555 | } |
@@ -4559,10 +4559,10 @@ discard block |
||
4559 | 4559 | } |
4560 | 4560 | |
4561 | 4561 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4562 | - if (\ctype_digit((string) $var2)) { |
|
4563 | - $end = (int) $var2; |
|
4562 | + if (\ctype_digit((string)$var2)) { |
|
4563 | + $end = (int)$var2; |
|
4564 | 4564 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var2)) { |
4565 | - $end = (int) self::hex_to_int($var2); |
|
4565 | + $end = (int)self::hex_to_int($var2); |
|
4566 | 4566 | } else { |
4567 | 4567 | $end = self::ord($var2); |
4568 | 4568 | } |
@@ -4572,8 +4572,8 @@ discard block |
||
4572 | 4572 | } |
4573 | 4573 | |
4574 | 4574 | return \array_map( |
4575 | - static function (int $i): string { |
|
4576 | - return (string) self::chr($i); |
|
4575 | + static function(int $i): string { |
|
4576 | + return (string)self::chr($i); |
|
4577 | 4577 | }, |
4578 | 4578 | \range($start, $end) |
4579 | 4579 | ); |
@@ -4618,7 +4618,7 @@ discard block |
||
4618 | 4618 | |
4619 | 4619 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
4620 | 4620 | if (\preg_match($pattern, $str)) { |
4621 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
4621 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
4622 | 4622 | } |
4623 | 4623 | |
4624 | 4624 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -4671,8 +4671,8 @@ discard block |
||
4671 | 4671 | $delimiter = '/'; |
4672 | 4672 | } |
4673 | 4673 | |
4674 | - return (string) \preg_replace( |
|
4675 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4674 | + return (string)\preg_replace( |
|
4675 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4676 | 4676 | $replacement, |
4677 | 4677 | $str |
4678 | 4678 | ); |
@@ -4715,9 +4715,9 @@ discard block |
||
4715 | 4715 | return ''; |
4716 | 4716 | } |
4717 | 4717 | |
4718 | - $strLength -= (int) $bomByteLength; |
|
4718 | + $strLength -= (int)$bomByteLength; |
|
4719 | 4719 | |
4720 | - $str = (string) $strTmp; |
|
4720 | + $str = (string)$strTmp; |
|
4721 | 4721 | } |
4722 | 4722 | } |
4723 | 4723 | |
@@ -4741,7 +4741,7 @@ discard block |
||
4741 | 4741 | if (\is_array($what) === true) { |
4742 | 4742 | /** @noinspection ForeachSourceInspection */ |
4743 | 4743 | foreach ($what as $item) { |
4744 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
4744 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
4745 | 4745 | } |
4746 | 4746 | } |
4747 | 4747 | |
@@ -4773,7 +4773,7 @@ discard block |
||
4773 | 4773 | */ |
4774 | 4774 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
4775 | 4775 | { |
4776 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4776 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4777 | 4777 | } |
4778 | 4778 | |
4779 | 4779 | /** |
@@ -4804,7 +4804,7 @@ discard block |
||
4804 | 4804 | $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
4805 | 4805 | |
4806 | 4806 | do { |
4807 | - $str = (string) \preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4807 | + $str = (string)\preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4808 | 4808 | } while ($count !== 0); |
4809 | 4809 | |
4810 | 4810 | return $str; |
@@ -4823,17 +4823,17 @@ discard block |
||
4823 | 4823 | { |
4824 | 4824 | if ($substring && \strpos($str, $substring) === 0) { |
4825 | 4825 | if ($encoding === 'UTF-8') { |
4826 | - return (string) \mb_substr( |
|
4826 | + return (string)\mb_substr( |
|
4827 | 4827 | $str, |
4828 | - (int) \mb_strlen($substring) |
|
4828 | + (int)\mb_strlen($substring) |
|
4829 | 4829 | ); |
4830 | 4830 | } |
4831 | 4831 | |
4832 | 4832 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4833 | 4833 | |
4834 | - return (string) self::substr( |
|
4834 | + return (string)self::substr( |
|
4835 | 4835 | $str, |
4836 | - (int) self::strlen($substring, $encoding), |
|
4836 | + (int)self::strlen($substring, $encoding), |
|
4837 | 4837 | null, |
4838 | 4838 | $encoding |
4839 | 4839 | ); |
@@ -4855,19 +4855,19 @@ discard block |
||
4855 | 4855 | { |
4856 | 4856 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
4857 | 4857 | if ($encoding === 'UTF-8') { |
4858 | - return (string) \mb_substr( |
|
4858 | + return (string)\mb_substr( |
|
4859 | 4859 | $str, |
4860 | 4860 | 0, |
4861 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
4861 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
4862 | 4862 | ); |
4863 | 4863 | } |
4864 | 4864 | |
4865 | 4865 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4866 | 4866 | |
4867 | - return (string) self::substr( |
|
4867 | + return (string)self::substr( |
|
4868 | 4868 | $str, |
4869 | 4869 | 0, |
4870 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
4870 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
4871 | 4871 | $encoding |
4872 | 4872 | ); |
4873 | 4873 | } |
@@ -4951,7 +4951,7 @@ discard block |
||
4951 | 4951 | $save = \mb_substitute_character(); |
4952 | 4952 | \mb_substitute_character($replacementCharHelper); |
4953 | 4953 | // the polyfill maybe return false, so cast to string |
4954 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4954 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4955 | 4955 | \mb_substitute_character($save); |
4956 | 4956 | } |
4957 | 4957 | |
@@ -4991,7 +4991,7 @@ discard block |
||
4991 | 4991 | |
4992 | 4992 | if (self::$SUPPORT['mbstring'] === true) { |
4993 | 4993 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4994 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4994 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4995 | 4995 | } |
4996 | 4996 | |
4997 | 4997 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -5006,7 +5006,7 @@ discard block |
||
5006 | 5006 | { |
5007 | 5007 | echo '<pre>'; |
5008 | 5008 | foreach (self::$SUPPORT as $key => &$value) { |
5009 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
5009 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
5010 | 5010 | } |
5011 | 5011 | unset($value); |
5012 | 5012 | echo '</pre>'; |
@@ -5035,7 +5035,7 @@ discard block |
||
5035 | 5035 | return $char; |
5036 | 5036 | } |
5037 | 5037 | |
5038 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
5038 | + return '&#'.self::ord($char, $encoding).';'; |
|
5039 | 5039 | } |
5040 | 5040 | |
5041 | 5041 | /** |
@@ -5094,7 +5094,7 @@ discard block |
||
5094 | 5094 | } |
5095 | 5095 | |
5096 | 5096 | // init |
5097 | - $str = (string) $str; |
|
5097 | + $str = (string)$str; |
|
5098 | 5098 | |
5099 | 5099 | if ($str === '') { |
5100 | 5100 | return []; |
@@ -5141,7 +5141,7 @@ discard block |
||
5141 | 5141 | ($str[$i] & "\xE0") === "\xC0" |
5142 | 5142 | ) { |
5143 | 5143 | if (($str[$i + 1] & "\xC0") === "\x80") { |
5144 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
5144 | + $ret[] = $str[$i].$str[$i + 1]; |
|
5145 | 5145 | |
5146 | 5146 | ++$i; |
5147 | 5147 | } |
@@ -5155,7 +5155,7 @@ discard block |
||
5155 | 5155 | && |
5156 | 5156 | ($str[$i + 2] & "\xC0") === "\x80" |
5157 | 5157 | ) { |
5158 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
5158 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
5159 | 5159 | |
5160 | 5160 | $i += 2; |
5161 | 5161 | } |
@@ -5171,7 +5171,7 @@ discard block |
||
5171 | 5171 | && |
5172 | 5172 | ($str[$i + 3] & "\xC0") === "\x80" |
5173 | 5173 | ) { |
5174 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
5174 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
5175 | 5175 | |
5176 | 5176 | $i += 3; |
5177 | 5177 | } |
@@ -5183,7 +5183,7 @@ discard block |
||
5183 | 5183 | $ret = \array_chunk($ret, $length); |
5184 | 5184 | |
5185 | 5185 | return \array_map( |
5186 | - static function (array &$item): string { |
|
5186 | + static function(array &$item): string { |
|
5187 | 5187 | return \implode('', $item); |
5188 | 5188 | }, |
5189 | 5189 | $ret |
@@ -5232,18 +5232,18 @@ discard block |
||
5232 | 5232 | $lang, |
5233 | 5233 | $tryToKeepStringLength |
5234 | 5234 | ); |
5235 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5235 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5236 | 5236 | |
5237 | 5237 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5238 | 5238 | |
5239 | - $str = (string) \preg_replace_callback( |
|
5239 | + $str = (string)\preg_replace_callback( |
|
5240 | 5240 | '/[-_\s]+(.)?/u', |
5241 | 5241 | /** |
5242 | 5242 | * @param array $match |
5243 | 5243 | * |
5244 | 5244 | * @return string |
5245 | 5245 | */ |
5246 | - static function (array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5246 | + static function(array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5247 | 5247 | if (isset($match[1])) { |
5248 | 5248 | if ($useMbFunction === true) { |
5249 | 5249 | if ($encoding === 'UTF-8') { |
@@ -5261,14 +5261,14 @@ discard block |
||
5261 | 5261 | $str |
5262 | 5262 | ); |
5263 | 5263 | |
5264 | - return (string) \preg_replace_callback( |
|
5264 | + return (string)\preg_replace_callback( |
|
5265 | 5265 | '/[\d]+(.)?/u', |
5266 | 5266 | /** |
5267 | 5267 | * @param array $match |
5268 | 5268 | * |
5269 | 5269 | * @return string |
5270 | 5270 | */ |
5271 | - static function (array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5271 | + static function(array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5272 | 5272 | if ($useMbFunction === true) { |
5273 | 5273 | if ($encoding === 'UTF-8') { |
5274 | 5274 | return \mb_strtoupper($match[0]); |
@@ -5440,7 +5440,7 @@ discard block |
||
5440 | 5440 | ): string { |
5441 | 5441 | if (self::$SUPPORT['mbstring'] === true) { |
5442 | 5442 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5443 | - $str = (string) \mb_ereg_replace('\B(\p{Lu})', '-\1', \trim($str)); |
|
5443 | + $str = (string)\mb_ereg_replace('\B(\p{Lu})', '-\1', \trim($str)); |
|
5444 | 5444 | |
5445 | 5445 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5446 | 5446 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5450,10 +5450,10 @@ discard block |
||
5450 | 5450 | } |
5451 | 5451 | |
5452 | 5452 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5453 | - return (string) \mb_ereg_replace('[-_\s]+', $delimiter, $str); |
|
5453 | + return (string)\mb_ereg_replace('[-_\s]+', $delimiter, $str); |
|
5454 | 5454 | } |
5455 | 5455 | |
5456 | - $str = (string) \preg_replace('/\B(\p{Lu})/u', '-\1', \trim($str)); |
|
5456 | + $str = (string)\preg_replace('/\B(\p{Lu})/u', '-\1', \trim($str)); |
|
5457 | 5457 | |
5458 | 5458 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5459 | 5459 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5462,7 +5462,7 @@ discard block |
||
5462 | 5462 | $str = self::strtolower($str, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
5463 | 5463 | } |
5464 | 5464 | |
5465 | - return (string) \preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
5465 | + return (string)\preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
5466 | 5466 | } |
5467 | 5467 | |
5468 | 5468 | /** |
@@ -5477,7 +5477,7 @@ discard block |
||
5477 | 5477 | public static function str_detect_encoding($str) |
5478 | 5478 | { |
5479 | 5479 | // init |
5480 | - $str = (string) $str; |
|
5480 | + $str = (string)$str; |
|
5481 | 5481 | |
5482 | 5482 | // |
5483 | 5483 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5579,7 +5579,7 @@ discard block |
||
5579 | 5579 | foreach (self::$ENCODINGS as $encodingTmp) { |
5580 | 5580 | // INFO: //IGNORE but still throw notice |
5581 | 5581 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5582 | - if ((string) @\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str) === $str) { |
|
5582 | + if ((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str) === $str) { |
|
5583 | 5583 | return $encodingTmp; |
5584 | 5584 | } |
5585 | 5585 | } |
@@ -5644,7 +5644,7 @@ discard block |
||
5644 | 5644 | return $str; |
5645 | 5645 | } |
5646 | 5646 | |
5647 | - return $substring . $str; |
|
5647 | + return $substring.$str; |
|
5648 | 5648 | } |
5649 | 5649 | |
5650 | 5650 | /** |
@@ -5864,27 +5864,27 @@ discard block |
||
5864 | 5864 | string $encoding = 'UTF-8' |
5865 | 5865 | ): string { |
5866 | 5866 | if ($encoding === 'UTF-8') { |
5867 | - $len = (int) \mb_strlen($str); |
|
5867 | + $len = (int)\mb_strlen($str); |
|
5868 | 5868 | if ($index > $len) { |
5869 | 5869 | return $str; |
5870 | 5870 | } |
5871 | 5871 | |
5872 | 5872 | /** @noinspection UnnecessaryCastingInspection */ |
5873 | - return (string) \mb_substr($str, 0, $index) . |
|
5874 | - $substring . |
|
5875 | - (string) \mb_substr($str, $index, $len); |
|
5873 | + return (string)\mb_substr($str, 0, $index). |
|
5874 | + $substring. |
|
5875 | + (string)\mb_substr($str, $index, $len); |
|
5876 | 5876 | } |
5877 | 5877 | |
5878 | 5878 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5879 | 5879 | |
5880 | - $len = (int) self::strlen($str, $encoding); |
|
5880 | + $len = (int)self::strlen($str, $encoding); |
|
5881 | 5881 | if ($index > $len) { |
5882 | 5882 | return $str; |
5883 | 5883 | } |
5884 | 5884 | |
5885 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
5886 | - $substring . |
|
5887 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5885 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
5886 | + $substring. |
|
5887 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
5888 | 5888 | } |
5889 | 5889 | |
5890 | 5890 | /** |
@@ -5914,15 +5914,15 @@ discard block |
||
5914 | 5914 | */ |
5915 | 5915 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5916 | 5916 | { |
5917 | - $search = (array) $search; |
|
5917 | + $search = (array)$search; |
|
5918 | 5918 | |
5919 | 5919 | /** @noinspection AlterInForeachInspection */ |
5920 | 5920 | foreach ($search as &$s) { |
5921 | - $s = (string) $s; |
|
5921 | + $s = (string)$s; |
|
5922 | 5922 | if ($s === '') { |
5923 | 5923 | $s = '/^(?<=.)$/'; |
5924 | 5924 | } else { |
5925 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5925 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5926 | 5926 | } |
5927 | 5927 | } |
5928 | 5928 | |
@@ -5954,11 +5954,11 @@ discard block |
||
5954 | 5954 | } |
5955 | 5955 | |
5956 | 5956 | if ($search === '') { |
5957 | - return $str . $replacement; |
|
5957 | + return $str.$replacement; |
|
5958 | 5958 | } |
5959 | 5959 | |
5960 | 5960 | if (\stripos($str, $search) === 0) { |
5961 | - return $replacement . \substr($str, \strlen($search)); |
|
5961 | + return $replacement.\substr($str, \strlen($search)); |
|
5962 | 5962 | } |
5963 | 5963 | |
5964 | 5964 | return $str; |
@@ -5986,11 +5986,11 @@ discard block |
||
5986 | 5986 | } |
5987 | 5987 | |
5988 | 5988 | if ($search === '') { |
5989 | - return $str . $replacement; |
|
5989 | + return $str.$replacement; |
|
5990 | 5990 | } |
5991 | 5991 | |
5992 | 5992 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
5993 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
5993 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
5994 | 5994 | } |
5995 | 5995 | |
5996 | 5996 | return $str; |
@@ -6063,15 +6063,15 @@ discard block |
||
6063 | 6063 | } |
6064 | 6064 | |
6065 | 6065 | if ($encoding === 'UTF-8') { |
6066 | - return (string) \mb_substr( |
|
6066 | + return (string)\mb_substr( |
|
6067 | 6067 | $str, |
6068 | - $offset + (int) \mb_strlen($separator) |
|
6068 | + $offset + (int)\mb_strlen($separator) |
|
6069 | 6069 | ); |
6070 | 6070 | } |
6071 | 6071 | |
6072 | - return (string) self::substr( |
|
6072 | + return (string)self::substr( |
|
6073 | 6073 | $str, |
6074 | - $offset + (int) self::strlen($separator, $encoding), |
|
6074 | + $offset + (int)self::strlen($separator, $encoding), |
|
6075 | 6075 | null, |
6076 | 6076 | $encoding |
6077 | 6077 | ); |
@@ -6098,15 +6098,15 @@ discard block |
||
6098 | 6098 | } |
6099 | 6099 | |
6100 | 6100 | if ($encoding === 'UTF-8') { |
6101 | - return (string) \mb_substr( |
|
6101 | + return (string)\mb_substr( |
|
6102 | 6102 | $str, |
6103 | - $offset + (int) self::strlen($separator) |
|
6103 | + $offset + (int)self::strlen($separator) |
|
6104 | 6104 | ); |
6105 | 6105 | } |
6106 | 6106 | |
6107 | - return (string) self::substr( |
|
6107 | + return (string)self::substr( |
|
6108 | 6108 | $str, |
6109 | - $offset + (int) self::strlen($separator, $encoding), |
|
6109 | + $offset + (int)self::strlen($separator, $encoding), |
|
6110 | 6110 | null, |
6111 | 6111 | $encoding |
6112 | 6112 | ); |
@@ -6133,10 +6133,10 @@ discard block |
||
6133 | 6133 | } |
6134 | 6134 | |
6135 | 6135 | if ($encoding === 'UTF-8') { |
6136 | - return (string) \mb_substr($str, 0, $offset); |
|
6136 | + return (string)\mb_substr($str, 0, $offset); |
|
6137 | 6137 | } |
6138 | 6138 | |
6139 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6139 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6140 | 6140 | } |
6141 | 6141 | |
6142 | 6142 | /** |
@@ -6160,7 +6160,7 @@ discard block |
||
6160 | 6160 | return ''; |
6161 | 6161 | } |
6162 | 6162 | |
6163 | - return (string) \mb_substr($str, 0, $offset); |
|
6163 | + return (string)\mb_substr($str, 0, $offset); |
|
6164 | 6164 | } |
6165 | 6165 | |
6166 | 6166 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6168,7 +6168,7 @@ discard block |
||
6168 | 6168 | return ''; |
6169 | 6169 | } |
6170 | 6170 | |
6171 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6171 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6172 | 6172 | } |
6173 | 6173 | |
6174 | 6174 | /** |
@@ -6256,12 +6256,12 @@ discard block |
||
6256 | 6256 | } |
6257 | 6257 | |
6258 | 6258 | if ($encoding === 'UTF-8') { |
6259 | - return (string) \mb_substr($str, -$n); |
|
6259 | + return (string)\mb_substr($str, -$n); |
|
6260 | 6260 | } |
6261 | 6261 | |
6262 | 6262 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6263 | 6263 | |
6264 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6264 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6265 | 6265 | } |
6266 | 6266 | |
6267 | 6267 | /** |
@@ -6285,21 +6285,21 @@ discard block |
||
6285 | 6285 | } |
6286 | 6286 | |
6287 | 6287 | if ($encoding === 'UTF-8') { |
6288 | - if ((int) \mb_strlen($str) <= $length) { |
|
6288 | + if ((int)\mb_strlen($str) <= $length) { |
|
6289 | 6289 | return $str; |
6290 | 6290 | } |
6291 | 6291 | |
6292 | 6292 | /** @noinspection UnnecessaryCastingInspection */ |
6293 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($strAddOn)) . $strAddOn; |
|
6293 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($strAddOn)).$strAddOn; |
|
6294 | 6294 | } |
6295 | 6295 | |
6296 | 6296 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6297 | 6297 | |
6298 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6298 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6299 | 6299 | return $str; |
6300 | 6300 | } |
6301 | 6301 | |
6302 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($strAddOn), $encoding)) . $strAddOn; |
|
6302 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($strAddOn), $encoding)).$strAddOn; |
|
6303 | 6303 | } |
6304 | 6304 | |
6305 | 6305 | /** |
@@ -6324,12 +6324,12 @@ discard block |
||
6324 | 6324 | |
6325 | 6325 | if ($encoding === 'UTF-8') { |
6326 | 6326 | /** @noinspection UnnecessaryCastingInspection */ |
6327 | - if ((int) \mb_strlen($str) <= $length) { |
|
6327 | + if ((int)\mb_strlen($str) <= $length) { |
|
6328 | 6328 | return $str; |
6329 | 6329 | } |
6330 | 6330 | |
6331 | 6331 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6332 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6332 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6333 | 6333 | } |
6334 | 6334 | |
6335 | 6335 | $str = \mb_substr($str, 0, $length); |
@@ -6339,20 +6339,20 @@ discard block |
||
6339 | 6339 | $new_str = \implode(' ', $array); |
6340 | 6340 | |
6341 | 6341 | if ($new_str === '') { |
6342 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6342 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6343 | 6343 | } |
6344 | 6344 | } else { |
6345 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6345 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6346 | 6346 | return $str; |
6347 | 6347 | } |
6348 | 6348 | |
6349 | 6349 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6350 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6350 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6351 | 6351 | } |
6352 | 6352 | |
6353 | 6353 | $str = self::substr($str, 0, $length, $encoding); |
6354 | 6354 | if ($str === false) { |
6355 | - return '' . $strAddOn; |
|
6355 | + return ''.$strAddOn; |
|
6356 | 6356 | } |
6357 | 6357 | |
6358 | 6358 | $array = \explode(' ', $str); |
@@ -6360,11 +6360,11 @@ discard block |
||
6360 | 6360 | $new_str = \implode(' ', $array); |
6361 | 6361 | |
6362 | 6362 | if ($new_str === '') { |
6363 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6363 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6364 | 6364 | } |
6365 | 6365 | } |
6366 | 6366 | |
6367 | - return $new_str . $strAddOn; |
|
6367 | + return $new_str.$strAddOn; |
|
6368 | 6368 | } |
6369 | 6369 | |
6370 | 6370 | /** |
@@ -6382,7 +6382,7 @@ discard block |
||
6382 | 6382 | $longestCommonPrefix = ''; |
6383 | 6383 | |
6384 | 6384 | if ($encoding === 'UTF-8') { |
6385 | - $maxLength = (int) \min( |
|
6385 | + $maxLength = (int)\min( |
|
6386 | 6386 | \mb_strlen($str), |
6387 | 6387 | \mb_strlen($otherStr) |
6388 | 6388 | ); |
@@ -6403,7 +6403,7 @@ discard block |
||
6403 | 6403 | } else { |
6404 | 6404 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6405 | 6405 | |
6406 | - $maxLength = (int) \min( |
|
6406 | + $maxLength = (int)\min( |
|
6407 | 6407 | self::strlen($str, $encoding), |
6408 | 6408 | self::strlen($otherStr, $encoding) |
6409 | 6409 | ); |
@@ -6446,13 +6446,13 @@ discard block |
||
6446 | 6446 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6447 | 6447 | |
6448 | 6448 | if ($encoding === 'UTF-8') { |
6449 | - $strLength = (int) \mb_strlen($str); |
|
6450 | - $otherLength = (int) \mb_strlen($otherStr); |
|
6449 | + $strLength = (int)\mb_strlen($str); |
|
6450 | + $otherLength = (int)\mb_strlen($otherStr); |
|
6451 | 6451 | } else { |
6452 | 6452 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6453 | 6453 | |
6454 | - $strLength = (int) self::strlen($str, $encoding); |
|
6455 | - $otherLength = (int) self::strlen($otherStr, $encoding); |
|
6454 | + $strLength = (int)self::strlen($str, $encoding); |
|
6455 | + $otherLength = (int)self::strlen($otherStr, $encoding); |
|
6456 | 6456 | } |
6457 | 6457 | |
6458 | 6458 | // Return if either string is empty |
@@ -6505,10 +6505,10 @@ discard block |
||
6505 | 6505 | } |
6506 | 6506 | |
6507 | 6507 | if ($encoding === 'UTF-8') { |
6508 | - return (string) \mb_substr($str, $end - $len, $len); |
|
6508 | + return (string)\mb_substr($str, $end - $len, $len); |
|
6509 | 6509 | } |
6510 | 6510 | |
6511 | - return (string) self::substr($str, $end - $len, $len, $encoding); |
|
6511 | + return (string)self::substr($str, $end - $len, $len, $encoding); |
|
6512 | 6512 | } |
6513 | 6513 | |
6514 | 6514 | /** |
@@ -6527,7 +6527,7 @@ discard block |
||
6527 | 6527 | } |
6528 | 6528 | |
6529 | 6529 | if ($encoding === 'UTF-8') { |
6530 | - $maxLength = (int) \min( |
|
6530 | + $maxLength = (int)\min( |
|
6531 | 6531 | \mb_strlen($str, $encoding), |
6532 | 6532 | \mb_strlen($otherStr, $encoding) |
6533 | 6533 | ); |
@@ -6541,7 +6541,7 @@ discard block |
||
6541 | 6541 | && |
6542 | 6542 | $char === \mb_substr($otherStr, -$i, 1) |
6543 | 6543 | ) { |
6544 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6544 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6545 | 6545 | } else { |
6546 | 6546 | break; |
6547 | 6547 | } |
@@ -6549,7 +6549,7 @@ discard block |
||
6549 | 6549 | } else { |
6550 | 6550 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6551 | 6551 | |
6552 | - $maxLength = (int) \min( |
|
6552 | + $maxLength = (int)\min( |
|
6553 | 6553 | self::strlen($str, $encoding), |
6554 | 6554 | self::strlen($otherStr, $encoding) |
6555 | 6555 | ); |
@@ -6563,7 +6563,7 @@ discard block |
||
6563 | 6563 | && |
6564 | 6564 | $char === self::substr($otherStr, -$i, 1, $encoding) |
6565 | 6565 | ) { |
6566 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6566 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6567 | 6567 | } else { |
6568 | 6568 | break; |
6569 | 6569 | } |
@@ -6583,7 +6583,7 @@ discard block |
||
6583 | 6583 | */ |
6584 | 6584 | public static function str_matches_pattern(string $str, string $pattern): bool |
6585 | 6585 | { |
6586 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6586 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6587 | 6587 | } |
6588 | 6588 | |
6589 | 6589 | /** |
@@ -6600,7 +6600,7 @@ discard block |
||
6600 | 6600 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6601 | 6601 | { |
6602 | 6602 | // init |
6603 | - $length = (int) self::strlen($str, $encoding); |
|
6603 | + $length = (int)self::strlen($str, $encoding); |
|
6604 | 6604 | |
6605 | 6605 | if ($offset >= 0) { |
6606 | 6606 | return $length > $offset; |
@@ -6626,7 +6626,7 @@ discard block |
||
6626 | 6626 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6627 | 6627 | { |
6628 | 6628 | // init |
6629 | - $length = (int) self::strlen($str); |
|
6629 | + $length = (int)self::strlen($str); |
|
6630 | 6630 | |
6631 | 6631 | if ( |
6632 | 6632 | ($index >= 0 && $length <= $index) |
@@ -6665,7 +6665,7 @@ discard block |
||
6665 | 6665 | return $str; |
6666 | 6666 | } |
6667 | 6667 | |
6668 | - if ($pad_type !== (int) $pad_type) { |
|
6668 | + if ($pad_type !== (int)$pad_type) { |
|
6669 | 6669 | if ($pad_type === 'left') { |
6670 | 6670 | $pad_type = \STR_PAD_LEFT; |
6671 | 6671 | } elseif ($pad_type === 'right') { |
@@ -6674,23 +6674,23 @@ discard block |
||
6674 | 6674 | $pad_type = \STR_PAD_BOTH; |
6675 | 6675 | } else { |
6676 | 6676 | throw new \InvalidArgumentException( |
6677 | - 'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6677 | + 'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6678 | 6678 | ); |
6679 | 6679 | } |
6680 | 6680 | } |
6681 | 6681 | |
6682 | 6682 | if ($encoding === 'UTF-8') { |
6683 | - $str_length = (int) \mb_strlen($str); |
|
6683 | + $str_length = (int)\mb_strlen($str); |
|
6684 | 6684 | |
6685 | 6685 | if ($pad_length >= $str_length) { |
6686 | 6686 | switch ($pad_type) { |
6687 | 6687 | case \STR_PAD_LEFT: |
6688 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6688 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6689 | 6689 | |
6690 | 6690 | $diff = ($pad_length - $str_length); |
6691 | 6691 | |
6692 | - $pre = (string) \mb_substr( |
|
6693 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6692 | + $pre = (string)\mb_substr( |
|
6693 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6694 | 6694 | 0, |
6695 | 6695 | $diff |
6696 | 6696 | ); |
@@ -6701,16 +6701,16 @@ discard block |
||
6701 | 6701 | case \STR_PAD_BOTH: |
6702 | 6702 | $diff = ($pad_length - $str_length); |
6703 | 6703 | |
6704 | - $ps_length_left = (int) \floor($diff / 2); |
|
6704 | + $ps_length_left = (int)\floor($diff / 2); |
|
6705 | 6705 | |
6706 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6706 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6707 | 6707 | |
6708 | - $pre = (string) \mb_substr( |
|
6708 | + $pre = (string)\mb_substr( |
|
6709 | 6709 | \str_repeat($pad_string, $ps_length_left), |
6710 | 6710 | 0, |
6711 | 6711 | $ps_length_left |
6712 | 6712 | ); |
6713 | - $post = (string) \mb_substr( |
|
6713 | + $post = (string)\mb_substr( |
|
6714 | 6714 | \str_repeat($pad_string, $ps_length_right), |
6715 | 6715 | 0, |
6716 | 6716 | $ps_length_right |
@@ -6720,19 +6720,19 @@ discard block |
||
6720 | 6720 | |
6721 | 6721 | case \STR_PAD_RIGHT: |
6722 | 6722 | default: |
6723 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6723 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6724 | 6724 | |
6725 | 6725 | $diff = ($pad_length - $str_length); |
6726 | 6726 | |
6727 | - $post = (string) \mb_substr( |
|
6728 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6727 | + $post = (string)\mb_substr( |
|
6728 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6729 | 6729 | 0, |
6730 | 6730 | $diff |
6731 | 6731 | ); |
6732 | 6732 | $pre = ''; |
6733 | 6733 | } |
6734 | 6734 | |
6735 | - return $pre . $str . $post; |
|
6735 | + return $pre.$str.$post; |
|
6736 | 6736 | } |
6737 | 6737 | |
6738 | 6738 | return $str; |
@@ -6740,17 +6740,17 @@ discard block |
||
6740 | 6740 | |
6741 | 6741 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6742 | 6742 | |
6743 | - $str_length = (int) self::strlen($str, $encoding); |
|
6743 | + $str_length = (int)self::strlen($str, $encoding); |
|
6744 | 6744 | |
6745 | 6745 | if ($pad_length >= $str_length) { |
6746 | 6746 | switch ($pad_type) { |
6747 | 6747 | case \STR_PAD_LEFT: |
6748 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6748 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6749 | 6749 | |
6750 | 6750 | $diff = ($pad_length - $str_length); |
6751 | 6751 | |
6752 | - $pre = (string) self::substr( |
|
6753 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6752 | + $pre = (string)self::substr( |
|
6753 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6754 | 6754 | 0, |
6755 | 6755 | $diff, |
6756 | 6756 | $encoding |
@@ -6762,17 +6762,17 @@ discard block |
||
6762 | 6762 | case \STR_PAD_BOTH: |
6763 | 6763 | $diff = ($pad_length - $str_length); |
6764 | 6764 | |
6765 | - $ps_length_left = (int) \floor($diff / 2); |
|
6765 | + $ps_length_left = (int)\floor($diff / 2); |
|
6766 | 6766 | |
6767 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6767 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6768 | 6768 | |
6769 | - $pre = (string) self::substr( |
|
6769 | + $pre = (string)self::substr( |
|
6770 | 6770 | \str_repeat($pad_string, $ps_length_left), |
6771 | 6771 | 0, |
6772 | 6772 | $ps_length_left, |
6773 | 6773 | $encoding |
6774 | 6774 | ); |
6775 | - $post = (string) self::substr( |
|
6775 | + $post = (string)self::substr( |
|
6776 | 6776 | \str_repeat($pad_string, $ps_length_right), |
6777 | 6777 | 0, |
6778 | 6778 | $ps_length_right, |
@@ -6783,12 +6783,12 @@ discard block |
||
6783 | 6783 | |
6784 | 6784 | case \STR_PAD_RIGHT: |
6785 | 6785 | default: |
6786 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6786 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6787 | 6787 | |
6788 | 6788 | $diff = ($pad_length - $str_length); |
6789 | 6789 | |
6790 | - $post = (string) self::substr( |
|
6791 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6790 | + $post = (string)self::substr( |
|
6791 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6792 | 6792 | 0, |
6793 | 6793 | $diff, |
6794 | 6794 | $encoding |
@@ -6796,7 +6796,7 @@ discard block |
||
6796 | 6796 | $pre = ''; |
6797 | 6797 | } |
6798 | 6798 | |
6799 | - return $pre . $str . $post; |
|
6799 | + return $pre.$str.$post; |
|
6800 | 6800 | } |
6801 | 6801 | |
6802 | 6802 | return $str; |
@@ -6948,11 +6948,11 @@ discard block |
||
6948 | 6948 | } |
6949 | 6949 | |
6950 | 6950 | if ($search === '') { |
6951 | - return $str . $replacement; |
|
6951 | + return $str.$replacement; |
|
6952 | 6952 | } |
6953 | 6953 | |
6954 | 6954 | if (\strpos($str, $search) === 0) { |
6955 | - return $replacement . \substr($str, \strlen($search)); |
|
6955 | + return $replacement.\substr($str, \strlen($search)); |
|
6956 | 6956 | } |
6957 | 6957 | |
6958 | 6958 | return $str; |
@@ -6980,11 +6980,11 @@ discard block |
||
6980 | 6980 | } |
6981 | 6981 | |
6982 | 6982 | if ($search === '') { |
6983 | - return $str . $replacement; |
|
6983 | + return $str.$replacement; |
|
6984 | 6984 | } |
6985 | 6985 | |
6986 | 6986 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6987 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6987 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6988 | 6988 | } |
6989 | 6989 | |
6990 | 6990 | return $str; |
@@ -7007,7 +7007,7 @@ discard block |
||
7007 | 7007 | |
7008 | 7008 | if ($pos !== false) { |
7009 | 7009 | /** @psalm-suppress InvalidReturnStatement */ |
7010 | - return self::substr_replace($subject, $replace, $pos, (int) self::strlen($search)); |
|
7010 | + return self::substr_replace($subject, $replace, $pos, (int)self::strlen($search)); |
|
7011 | 7011 | } |
7012 | 7012 | |
7013 | 7013 | return $subject; |
@@ -7032,7 +7032,7 @@ discard block |
||
7032 | 7032 | $pos = self::strrpos($subject, $search); |
7033 | 7033 | if ($pos !== false) { |
7034 | 7034 | /** @psalm-suppress InvalidReturnStatement */ |
7035 | - return self::substr_replace($subject, $replace, $pos, (int) self::strlen($search)); |
|
7035 | + return self::substr_replace($subject, $replace, $pos, (int)self::strlen($search)); |
|
7036 | 7036 | } |
7037 | 7037 | |
7038 | 7038 | return $subject; |
@@ -7051,7 +7051,7 @@ discard block |
||
7051 | 7051 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
7052 | 7052 | { |
7053 | 7053 | if ($encoding === 'UTF-8') { |
7054 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
7054 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
7055 | 7055 | /** @noinspection NonSecureShuffleUsageInspection */ |
7056 | 7056 | \shuffle($indexes); |
7057 | 7057 | |
@@ -7067,7 +7067,7 @@ discard block |
||
7067 | 7067 | } else { |
7068 | 7068 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7069 | 7069 | |
7070 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
7070 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
7071 | 7071 | /** @noinspection NonSecureShuffleUsageInspection */ |
7072 | 7072 | \shuffle($indexes); |
7073 | 7073 | |
@@ -7108,11 +7108,11 @@ discard block |
||
7108 | 7108 | ) { |
7109 | 7109 | if ($encoding === 'UTF-8') { |
7110 | 7110 | if ($end === null) { |
7111 | - $length = (int) \mb_strlen($str); |
|
7111 | + $length = (int)\mb_strlen($str); |
|
7112 | 7112 | } elseif ($end >= 0 && $end <= $start) { |
7113 | 7113 | return ''; |
7114 | 7114 | } elseif ($end < 0) { |
7115 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7115 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7116 | 7116 | } else { |
7117 | 7117 | $length = $end - $start; |
7118 | 7118 | } |
@@ -7123,11 +7123,11 @@ discard block |
||
7123 | 7123 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7124 | 7124 | |
7125 | 7125 | if ($end === null) { |
7126 | - $length = (int) self::strlen($str, $encoding); |
|
7126 | + $length = (int)self::strlen($str, $encoding); |
|
7127 | 7127 | } elseif ($end >= 0 && $end <= $start) { |
7128 | 7128 | return ''; |
7129 | 7129 | } elseif ($end < 0) { |
7130 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7130 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7131 | 7131 | } else { |
7132 | 7132 | $length = $end - $start; |
7133 | 7133 | } |
@@ -7159,35 +7159,35 @@ discard block |
||
7159 | 7159 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7160 | 7160 | } |
7161 | 7161 | |
7162 | - $str = (string) \preg_replace_callback( |
|
7162 | + $str = (string)\preg_replace_callback( |
|
7163 | 7163 | '/([\d|\p{Lu}])/u', |
7164 | 7164 | /** |
7165 | 7165 | * @param string[] $matches |
7166 | 7166 | * |
7167 | 7167 | * @return string |
7168 | 7168 | */ |
7169 | - static function (array $matches) use ($encoding): string { |
|
7169 | + static function(array $matches) use ($encoding): string { |
|
7170 | 7170 | $match = $matches[1]; |
7171 | - $matchInt = (int) $match; |
|
7171 | + $matchInt = (int)$match; |
|
7172 | 7172 | |
7173 | - if ((string) $matchInt === $match) { |
|
7174 | - return '_' . $match . '_'; |
|
7173 | + if ((string)$matchInt === $match) { |
|
7174 | + return '_'.$match.'_'; |
|
7175 | 7175 | } |
7176 | 7176 | |
7177 | 7177 | if ($encoding === 'UTF-8') { |
7178 | - return '_' . \mb_strtolower($match); |
|
7178 | + return '_'.\mb_strtolower($match); |
|
7179 | 7179 | } |
7180 | 7180 | |
7181 | - return '_' . self::strtolower($match, $encoding); |
|
7181 | + return '_'.self::strtolower($match, $encoding); |
|
7182 | 7182 | }, |
7183 | 7183 | $str |
7184 | 7184 | ); |
7185 | 7185 | |
7186 | - $str = (string) \preg_replace( |
|
7186 | + $str = (string)\preg_replace( |
|
7187 | 7187 | [ |
7188 | - '/\s+/u', // convert spaces to "_" |
|
7189 | - '/^\s+|\s+$/u', // trim leading & trailing spaces |
|
7190 | - '/_+/', // remove double "_" |
|
7188 | + '/\s+/u', // convert spaces to "_" |
|
7189 | + '/^\s+|\s+$/u', // trim leading & trailing spaces |
|
7190 | + '/_+/', // remove double "_" |
|
7191 | 7191 | ], |
7192 | 7192 | [ |
7193 | 7193 | '_', |
@@ -7294,7 +7294,7 @@ discard block |
||
7294 | 7294 | $limit = -1; |
7295 | 7295 | } |
7296 | 7296 | |
7297 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7297 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7298 | 7298 | |
7299 | 7299 | if ($array === false) { |
7300 | 7300 | return []; |
@@ -7370,9 +7370,9 @@ discard block |
||
7370 | 7370 | return ''; |
7371 | 7371 | } |
7372 | 7372 | |
7373 | - return (string) \mb_substr( |
|
7373 | + return (string)\mb_substr( |
|
7374 | 7374 | $str, |
7375 | - $offset + (int) \mb_strlen($separator) |
|
7375 | + $offset + (int)\mb_strlen($separator) |
|
7376 | 7376 | ); |
7377 | 7377 | } |
7378 | 7378 | |
@@ -7381,9 +7381,9 @@ discard block |
||
7381 | 7381 | return ''; |
7382 | 7382 | } |
7383 | 7383 | |
7384 | - return (string) \mb_substr( |
|
7384 | + return (string)\mb_substr( |
|
7385 | 7385 | $str, |
7386 | - $offset + (int) self::strlen($separator, $encoding), |
|
7386 | + $offset + (int)self::strlen($separator, $encoding), |
|
7387 | 7387 | null, |
7388 | 7388 | $encoding |
7389 | 7389 | ); |
@@ -7410,9 +7410,9 @@ discard block |
||
7410 | 7410 | return ''; |
7411 | 7411 | } |
7412 | 7412 | |
7413 | - return (string) \mb_substr( |
|
7413 | + return (string)\mb_substr( |
|
7414 | 7414 | $str, |
7415 | - $offset + (int) \mb_strlen($separator) |
|
7415 | + $offset + (int)\mb_strlen($separator) |
|
7416 | 7416 | ); |
7417 | 7417 | } |
7418 | 7418 | |
@@ -7421,9 +7421,9 @@ discard block |
||
7421 | 7421 | return ''; |
7422 | 7422 | } |
7423 | 7423 | |
7424 | - return (string) self::substr( |
|
7424 | + return (string)self::substr( |
|
7425 | 7425 | $str, |
7426 | - $offset + (int) self::strlen($separator, $encoding), |
|
7426 | + $offset + (int)self::strlen($separator, $encoding), |
|
7427 | 7427 | null, |
7428 | 7428 | $encoding |
7429 | 7429 | ); |
@@ -7453,7 +7453,7 @@ discard block |
||
7453 | 7453 | return ''; |
7454 | 7454 | } |
7455 | 7455 | |
7456 | - return (string) \mb_substr( |
|
7456 | + return (string)\mb_substr( |
|
7457 | 7457 | $str, |
7458 | 7458 | 0, |
7459 | 7459 | $offset |
@@ -7465,7 +7465,7 @@ discard block |
||
7465 | 7465 | return ''; |
7466 | 7466 | } |
7467 | 7467 | |
7468 | - return (string) self::substr( |
|
7468 | + return (string)self::substr( |
|
7469 | 7469 | $str, |
7470 | 7470 | 0, |
7471 | 7471 | $offset, |
@@ -7494,7 +7494,7 @@ discard block |
||
7494 | 7494 | return ''; |
7495 | 7495 | } |
7496 | 7496 | |
7497 | - return (string) \mb_substr( |
|
7497 | + return (string)\mb_substr( |
|
7498 | 7498 | $str, |
7499 | 7499 | 0, |
7500 | 7500 | $offset |
@@ -7508,7 +7508,7 @@ discard block |
||
7508 | 7508 | |
7509 | 7509 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7510 | 7510 | |
7511 | - return (string) self::substr( |
|
7511 | + return (string)self::substr( |
|
7512 | 7512 | $str, |
7513 | 7513 | 0, |
7514 | 7514 | $offset, |
@@ -7616,7 +7616,7 @@ discard block |
||
7616 | 7616 | */ |
7617 | 7617 | public static function str_surround(string $str, string $substring): string |
7618 | 7618 | { |
7619 | - return $substring . $str . $substring; |
|
7619 | + return $substring.$str.$substring; |
|
7620 | 7620 | } |
7621 | 7621 | |
7622 | 7622 | /** |
@@ -7660,9 +7660,9 @@ discard block |
||
7660 | 7660 | |
7661 | 7661 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
7662 | 7662 | |
7663 | - return (string) \preg_replace_callback( |
|
7663 | + return (string)\preg_replace_callback( |
|
7664 | 7664 | '/([\S]+)/u', |
7665 | - static function (array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7665 | + static function(array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7666 | 7666 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
7667 | 7667 | return $match[0]; |
7668 | 7668 | } |
@@ -7748,16 +7748,16 @@ discard block |
||
7748 | 7748 | } |
7749 | 7749 | |
7750 | 7750 | // the main substitutions |
7751 | - $str = (string) \preg_replace_callback( |
|
7751 | + $str = (string)\preg_replace_callback( |
|
7752 | 7752 | '~\b (_*) (?: # 1. Leading underscore and |
7753 | 7753 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
7754 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
7754 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
7755 | 7755 | | |
7756 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
7756 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
7757 | 7757 | | |
7758 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
7758 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
7759 | 7759 | | |
7760 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
7760 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
7761 | 7761 | ) (_*) \b # 6. With trailing underscore |
7762 | 7762 | ~ux', |
7763 | 7763 | /** |
@@ -7765,7 +7765,7 @@ discard block |
||
7765 | 7765 | * |
7766 | 7766 | * @return string |
7767 | 7767 | */ |
7768 | - static function (array $matches) use ($encoding): string { |
|
7768 | + static function(array $matches) use ($encoding): string { |
|
7769 | 7769 | // preserve leading underscore |
7770 | 7770 | $str = $matches[1]; |
7771 | 7771 | if ($matches[2]) { |
@@ -7790,26 +7790,26 @@ discard block |
||
7790 | 7790 | ); |
7791 | 7791 | |
7792 | 7792 | // Exceptions for small words: capitalize at start of title... |
7793 | - $str = (string) \preg_replace_callback( |
|
7793 | + $str = (string)\preg_replace_callback( |
|
7794 | 7794 | '~( \A [[:punct:]]* # start of title... |
7795 | 7795 | | [:.;?!][ ]+ # or of subsentence... |
7796 | 7796 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
7797 | - ( ' . $smallWordsRx . ' ) \b # ...followed by small word |
|
7797 | + ( ' . $smallWordsRx.' ) \b # ...followed by small word |
|
7798 | 7798 | ~uxi', |
7799 | 7799 | /** |
7800 | 7800 | * @param string[] $matches |
7801 | 7801 | * |
7802 | 7802 | * @return string |
7803 | 7803 | */ |
7804 | - static function (array $matches) use ($encoding): string { |
|
7805 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7804 | + static function(array $matches) use ($encoding): string { |
|
7805 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7806 | 7806 | }, |
7807 | 7807 | $str |
7808 | 7808 | ); |
7809 | 7809 | |
7810 | 7810 | // ...and end of title |
7811 | - $str = (string) \preg_replace_callback( |
|
7812 | - '~\b ( ' . $smallWordsRx . ' ) # small word... |
|
7811 | + $str = (string)\preg_replace_callback( |
|
7812 | + '~\b ( '.$smallWordsRx.' ) # small word... |
|
7813 | 7813 | (?= [[:punct:]]* \Z # ...at the end of the title... |
7814 | 7814 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
7815 | 7815 | ~uxi', |
@@ -7818,7 +7818,7 @@ discard block |
||
7818 | 7818 | * |
7819 | 7819 | * @return string |
7820 | 7820 | */ |
7821 | - static function (array $matches) use ($encoding): string { |
|
7821 | + static function(array $matches) use ($encoding): string { |
|
7822 | 7822 | return static::str_upper_first($matches[1], $encoding); |
7823 | 7823 | }, |
7824 | 7824 | $str |
@@ -7826,10 +7826,10 @@ discard block |
||
7826 | 7826 | |
7827 | 7827 | // Exceptions for small words in hyphenated compound words. |
7828 | 7828 | // e.g. "in-flight" -> In-Flight |
7829 | - $str = (string) \preg_replace_callback( |
|
7829 | + $str = (string)\preg_replace_callback( |
|
7830 | 7830 | '~\b |
7831 | 7831 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
7832 | - ( ' . $smallWordsRx . ' ) |
|
7832 | + ( ' . $smallWordsRx.' ) |
|
7833 | 7833 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
7834 | 7834 | ~uxi', |
7835 | 7835 | /** |
@@ -7837,18 +7837,18 @@ discard block |
||
7837 | 7837 | * |
7838 | 7838 | * @return string |
7839 | 7839 | */ |
7840 | - static function (array $matches) use ($encoding): string { |
|
7840 | + static function(array $matches) use ($encoding): string { |
|
7841 | 7841 | return static::str_upper_first($matches[1], $encoding); |
7842 | 7842 | }, |
7843 | 7843 | $str |
7844 | 7844 | ); |
7845 | 7845 | |
7846 | 7846 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
7847 | - $str = (string) \preg_replace_callback( |
|
7847 | + $str = (string)\preg_replace_callback( |
|
7848 | 7848 | '~\b |
7849 | 7849 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
7850 | 7850 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
7851 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
7851 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
7852 | 7852 | (?! - ) # Negative lookahead for another - |
7853 | 7853 | ~uxi', |
7854 | 7854 | /** |
@@ -7856,8 +7856,8 @@ discard block |
||
7856 | 7856 | * |
7857 | 7857 | * @return string |
7858 | 7858 | */ |
7859 | - static function (array $matches) use ($encoding): string { |
|
7860 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7859 | + static function(array $matches) use ($encoding): string { |
|
7860 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7861 | 7861 | }, |
7862 | 7862 | $str |
7863 | 7863 | ); |
@@ -7960,7 +7960,7 @@ discard block |
||
7960 | 7960 | ); |
7961 | 7961 | |
7962 | 7962 | foreach ($tmpReturn as &$item) { |
7963 | - $item = (string) $item; |
|
7963 | + $item = (string)$item; |
|
7964 | 7964 | } |
7965 | 7965 | |
7966 | 7966 | return $tmpReturn; |
@@ -8005,39 +8005,39 @@ discard block |
||
8005 | 8005 | } |
8006 | 8006 | |
8007 | 8007 | if ($encoding === 'UTF-8') { |
8008 | - if ($length >= (int) \mb_strlen($str)) { |
|
8008 | + if ($length >= (int)\mb_strlen($str)) { |
|
8009 | 8009 | return $str; |
8010 | 8010 | } |
8011 | 8011 | |
8012 | 8012 | if ($substring !== '') { |
8013 | - $length -= (int) \mb_strlen($substring); |
|
8013 | + $length -= (int)\mb_strlen($substring); |
|
8014 | 8014 | |
8015 | 8015 | /** @noinspection UnnecessaryCastingInspection */ |
8016 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8016 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8017 | 8017 | } |
8018 | 8018 | |
8019 | 8019 | /** @noinspection UnnecessaryCastingInspection */ |
8020 | - return (string) \mb_substr($str, 0, $length); |
|
8020 | + return (string)\mb_substr($str, 0, $length); |
|
8021 | 8021 | } |
8022 | 8022 | |
8023 | 8023 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8024 | 8024 | |
8025 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8025 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8026 | 8026 | return $str; |
8027 | 8027 | } |
8028 | 8028 | |
8029 | 8029 | if ($substring !== '') { |
8030 | - $length -= (int) self::strlen($substring, $encoding); |
|
8030 | + $length -= (int)self::strlen($substring, $encoding); |
|
8031 | 8031 | } |
8032 | 8032 | |
8033 | 8033 | return ( |
8034 | - (string) self::substr( |
|
8034 | + (string)self::substr( |
|
8035 | 8035 | $str, |
8036 | 8036 | 0, |
8037 | 8037 | $length, |
8038 | 8038 | $encoding |
8039 | 8039 | ) |
8040 | - ) . $substring; |
|
8040 | + ).$substring; |
|
8041 | 8041 | } |
8042 | 8042 | |
8043 | 8043 | /** |
@@ -8067,12 +8067,12 @@ discard block |
||
8067 | 8067 | } |
8068 | 8068 | |
8069 | 8069 | if ($encoding === 'UTF-8') { |
8070 | - if ($length >= (int) \mb_strlen($str)) { |
|
8070 | + if ($length >= (int)\mb_strlen($str)) { |
|
8071 | 8071 | return $str; |
8072 | 8072 | } |
8073 | 8073 | |
8074 | 8074 | // need to further trim the string so we can append the substring |
8075 | - $length -= (int) \mb_strlen($substring); |
|
8075 | + $length -= (int)\mb_strlen($substring); |
|
8076 | 8076 | if ($length <= 0) { |
8077 | 8077 | return $substring; |
8078 | 8078 | } |
@@ -8094,18 +8094,18 @@ discard block |
||
8094 | 8094 | || |
8095 | 8095 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8096 | 8096 | ) { |
8097 | - $truncated = (string) \mb_substr($truncated, 0, (int) $lastPos); |
|
8097 | + $truncated = (string)\mb_substr($truncated, 0, (int)$lastPos); |
|
8098 | 8098 | } |
8099 | 8099 | } |
8100 | 8100 | } else { |
8101 | 8101 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8102 | 8102 | |
8103 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8103 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8104 | 8104 | return $str; |
8105 | 8105 | } |
8106 | 8106 | |
8107 | 8107 | // need to further trim the string so we can append the substring |
8108 | - $length -= (int) self::strlen($substring, $encoding); |
|
8108 | + $length -= (int)self::strlen($substring, $encoding); |
|
8109 | 8109 | if ($length <= 0) { |
8110 | 8110 | return $substring; |
8111 | 8111 | } |
@@ -8127,12 +8127,12 @@ discard block |
||
8127 | 8127 | || |
8128 | 8128 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8129 | 8129 | ) { |
8130 | - $truncated = (string) self::substr($truncated, 0, (int) $lastPos, $encoding); |
|
8130 | + $truncated = (string)self::substr($truncated, 0, (int)$lastPos, $encoding); |
|
8131 | 8131 | } |
8132 | 8132 | } |
8133 | 8133 | } |
8134 | 8134 | |
8135 | - return $truncated . $substring; |
|
8135 | + return $truncated.$substring; |
|
8136 | 8136 | } |
8137 | 8137 | |
8138 | 8138 | /** |
@@ -8222,13 +8222,13 @@ discard block |
||
8222 | 8222 | } |
8223 | 8223 | } elseif ($format === 2) { |
8224 | 8224 | $numberOfWords = []; |
8225 | - $offset = (int) self::strlen($strParts[0]); |
|
8225 | + $offset = (int)self::strlen($strParts[0]); |
|
8226 | 8226 | for ($i = 1; $i < $len; $i += 2) { |
8227 | 8227 | $numberOfWords[$offset] = $strParts[$i]; |
8228 | - $offset += (int) self::strlen($strParts[$i]) + (int) self::strlen($strParts[$i + 1]); |
|
8228 | + $offset += (int)self::strlen($strParts[$i]) + (int)self::strlen($strParts[$i + 1]); |
|
8229 | 8229 | } |
8230 | 8230 | } else { |
8231 | - $numberOfWords = (int) (($len - 1) / 2); |
|
8231 | + $numberOfWords = (int)(($len - 1) / 2); |
|
8232 | 8232 | } |
8233 | 8233 | |
8234 | 8234 | return $numberOfWords; |
@@ -8292,7 +8292,7 @@ discard block |
||
8292 | 8292 | */ |
8293 | 8293 | public static function strcmp(string $str1, string $str2): int |
8294 | 8294 | { |
8295 | - return $str1 . '' === $str2 . '' ? 0 : \strcmp( |
|
8295 | + return $str1.'' === $str2.'' ? 0 : \strcmp( |
|
8296 | 8296 | \Normalizer::normalize($str1, \Normalizer::NFD), |
8297 | 8297 | \Normalizer::normalize($str2, \Normalizer::NFD) |
8298 | 8298 | ); |
@@ -8321,21 +8321,21 @@ discard block |
||
8321 | 8321 | } |
8322 | 8322 | |
8323 | 8323 | if ($charList === '') { |
8324 | - return (int) self::strlen($str, $encoding); |
|
8324 | + return (int)self::strlen($str, $encoding); |
|
8325 | 8325 | } |
8326 | 8326 | |
8327 | 8327 | if ($offset !== null || $length !== null) { |
8328 | 8328 | if ($encoding === 'UTF-8') { |
8329 | 8329 | if ($length === null) { |
8330 | 8330 | /** @noinspection UnnecessaryCastingInspection */ |
8331 | - $strTmp = \mb_substr($str, (int) $offset); |
|
8331 | + $strTmp = \mb_substr($str, (int)$offset); |
|
8332 | 8332 | } else { |
8333 | 8333 | /** @noinspection UnnecessaryCastingInspection */ |
8334 | - $strTmp = \mb_substr($str, (int) $offset, $length); |
|
8334 | + $strTmp = \mb_substr($str, (int)$offset, $length); |
|
8335 | 8335 | } |
8336 | 8336 | } else { |
8337 | 8337 | /** @noinspection UnnecessaryCastingInspection */ |
8338 | - $strTmp = self::substr($str, (int) $offset, $length, $encoding); |
|
8338 | + $strTmp = self::substr($str, (int)$offset, $length, $encoding); |
|
8339 | 8339 | } |
8340 | 8340 | if ($strTmp === false) { |
8341 | 8341 | return 0; |
@@ -8348,7 +8348,7 @@ discard block |
||
8348 | 8348 | } |
8349 | 8349 | |
8350 | 8350 | $matches = []; |
8351 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $matches)) { |
|
8351 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $matches)) { |
|
8352 | 8352 | $return = self::strlen($matches[1], $encoding); |
8353 | 8353 | if ($return === false) { |
8354 | 8354 | return 0; |
@@ -8357,7 +8357,7 @@ discard block |
||
8357 | 8357 | return $return; |
8358 | 8358 | } |
8359 | 8359 | |
8360 | - return (int) self::strlen($str, $encoding); |
|
8360 | + return (int)self::strlen($str, $encoding); |
|
8361 | 8361 | } |
8362 | 8362 | |
8363 | 8363 | /** |
@@ -8479,7 +8479,7 @@ discard block |
||
8479 | 8479 | return ''; |
8480 | 8480 | } |
8481 | 8481 | |
8482 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
8482 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
8483 | 8483 | } |
8484 | 8484 | |
8485 | 8485 | /** |
@@ -8544,7 +8544,7 @@ discard block |
||
8544 | 8544 | // fallback for ascii only |
8545 | 8545 | // |
8546 | 8546 | |
8547 | - if (self::is_ascii($haystack . $needle)) { |
|
8547 | + if (self::is_ascii($haystack.$needle)) { |
|
8548 | 8548 | return \stripos($haystack, $needle, $offset); |
8549 | 8549 | } |
8550 | 8550 | |
@@ -8611,7 +8611,7 @@ discard block |
||
8611 | 8611 | && |
8612 | 8612 | self::$SUPPORT['mbstring'] === false |
8613 | 8613 | ) { |
8614 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8614 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8615 | 8615 | } |
8616 | 8616 | |
8617 | 8617 | if ( |
@@ -8625,11 +8625,11 @@ discard block |
||
8625 | 8625 | } |
8626 | 8626 | } |
8627 | 8627 | |
8628 | - if (self::is_ascii($needle . $haystack)) { |
|
8628 | + if (self::is_ascii($needle.$haystack)) { |
|
8629 | 8629 | return \stristr($haystack, $needle, $before_needle); |
8630 | 8630 | } |
8631 | 8631 | |
8632 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
8632 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
8633 | 8633 | |
8634 | 8634 | if (!isset($match[1])) { |
8635 | 8635 | return false; |
@@ -8639,7 +8639,7 @@ discard block |
||
8639 | 8639 | return $match[1]; |
8640 | 8640 | } |
8641 | 8641 | |
8642 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
8642 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
8643 | 8643 | } |
8644 | 8644 | |
8645 | 8645 | /** |
@@ -8706,7 +8706,7 @@ discard block |
||
8706 | 8706 | && |
8707 | 8707 | self::$SUPPORT['iconv'] === false |
8708 | 8708 | ) { |
8709 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8709 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8710 | 8710 | } |
8711 | 8711 | |
8712 | 8712 | // |
@@ -8817,7 +8817,7 @@ discard block |
||
8817 | 8817 | */ |
8818 | 8818 | public static function strnatcmp(string $str1, string $str2): int |
8819 | 8819 | { |
8820 | - return $str1 . '' === $str2 . '' ? 0 : \strnatcmp((string) self::strtonatfold($str1), (string) self::strtonatfold($str2)); |
|
8820 | + return $str1.'' === $str2.'' ? 0 : \strnatcmp((string)self::strtonatfold($str1), (string)self::strtonatfold($str2)); |
|
8821 | 8821 | } |
8822 | 8822 | |
8823 | 8823 | /** |
@@ -8874,11 +8874,11 @@ discard block |
||
8874 | 8874 | } |
8875 | 8875 | |
8876 | 8876 | if ($encoding === 'UTF-8') { |
8877 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
8878 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
8877 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
8878 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
8879 | 8879 | } else { |
8880 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
8881 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
8880 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
8881 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
8882 | 8882 | } |
8883 | 8883 | |
8884 | 8884 | return self::strcmp($str1, $str2); |
@@ -8900,8 +8900,8 @@ discard block |
||
8900 | 8900 | return false; |
8901 | 8901 | } |
8902 | 8902 | |
8903 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
8904 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
8903 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
8904 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
8905 | 8905 | } |
8906 | 8906 | |
8907 | 8907 | return false; |
@@ -8934,10 +8934,10 @@ discard block |
||
8934 | 8934 | } |
8935 | 8935 | |
8936 | 8936 | // iconv and mbstring do not support integer $needle |
8937 | - if ((int) $needle === $needle) { |
|
8938 | - $needle = (string) self::chr($needle); |
|
8937 | + if ((int)$needle === $needle) { |
|
8938 | + $needle = (string)self::chr($needle); |
|
8939 | 8939 | } |
8940 | - $needle = (string) $needle; |
|
8940 | + $needle = (string)$needle; |
|
8941 | 8941 | |
8942 | 8942 | if ($needle === '') { |
8943 | 8943 | return false; |
@@ -8984,7 +8984,7 @@ discard block |
||
8984 | 8984 | && |
8985 | 8985 | self::$SUPPORT['mbstring'] === false |
8986 | 8986 | ) { |
8987 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8987 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8988 | 8988 | } |
8989 | 8989 | |
8990 | 8990 | // |
@@ -9025,7 +9025,7 @@ discard block |
||
9025 | 9025 | // fallback for ascii only |
9026 | 9026 | // |
9027 | 9027 | |
9028 | - if (self::is_ascii($haystack . $needle)) { |
|
9028 | + if (self::is_ascii($haystack.$needle)) { |
|
9029 | 9029 | return \strpos($haystack, $needle, $offset); |
9030 | 9030 | } |
9031 | 9031 | |
@@ -9037,7 +9037,7 @@ discard block |
||
9037 | 9037 | if ($haystackTmp === false) { |
9038 | 9038 | $haystackTmp = ''; |
9039 | 9039 | } |
9040 | - $haystack = (string) $haystackTmp; |
|
9040 | + $haystack = (string)$haystackTmp; |
|
9041 | 9041 | |
9042 | 9042 | if ($offset < 0) { |
9043 | 9043 | $offset = 0; |
@@ -9049,7 +9049,7 @@ discard block |
||
9049 | 9049 | } |
9050 | 9050 | |
9051 | 9051 | if ($pos) { |
9052 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9052 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9053 | 9053 | } |
9054 | 9054 | |
9055 | 9055 | return $offset + 0; |
@@ -9160,7 +9160,7 @@ discard block |
||
9160 | 9160 | && |
9161 | 9161 | self::$SUPPORT['mbstring'] === false |
9162 | 9162 | ) { |
9163 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9163 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9164 | 9164 | } |
9165 | 9165 | |
9166 | 9166 | // |
@@ -9172,7 +9172,7 @@ discard block |
||
9172 | 9172 | if ($needleTmp === false) { |
9173 | 9173 | return false; |
9174 | 9174 | } |
9175 | - $needle = (string) $needleTmp; |
|
9175 | + $needle = (string)$needleTmp; |
|
9176 | 9176 | |
9177 | 9177 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
9178 | 9178 | if ($pos === false) { |
@@ -9194,7 +9194,7 @@ discard block |
||
9194 | 9194 | if ($needleTmp === false) { |
9195 | 9195 | return false; |
9196 | 9196 | } |
9197 | - $needle = (string) $needleTmp; |
|
9197 | + $needle = (string)$needleTmp; |
|
9198 | 9198 | |
9199 | 9199 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
9200 | 9200 | if ($pos === false) { |
@@ -9230,7 +9230,7 @@ discard block |
||
9230 | 9230 | if ($encoding === 'UTF-8') { |
9231 | 9231 | if (self::$SUPPORT['intl'] === true) { |
9232 | 9232 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
9233 | - $i = (int) \grapheme_strlen($str); |
|
9233 | + $i = (int)\grapheme_strlen($str); |
|
9234 | 9234 | while ($i--) { |
9235 | 9235 | $reversedTmp = \grapheme_substr($str, $i, 1); |
9236 | 9236 | if ($reversedTmp !== false) { |
@@ -9238,7 +9238,7 @@ discard block |
||
9238 | 9238 | } |
9239 | 9239 | } |
9240 | 9240 | } else { |
9241 | - $i = (int) \mb_strlen($str); |
|
9241 | + $i = (int)\mb_strlen($str); |
|
9242 | 9242 | while ($i--) { |
9243 | 9243 | $reversedTmp = \mb_substr($str, $i, 1); |
9244 | 9244 | if ($reversedTmp !== false) { |
@@ -9249,7 +9249,7 @@ discard block |
||
9249 | 9249 | } else { |
9250 | 9250 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9251 | 9251 | |
9252 | - $i = (int) self::strlen($str, $encoding); |
|
9252 | + $i = (int)self::strlen($str, $encoding); |
|
9253 | 9253 | while ($i--) { |
9254 | 9254 | $reversedTmp = self::substr($str, $i, 1, $encoding); |
9255 | 9255 | if ($reversedTmp !== false) { |
@@ -9323,7 +9323,7 @@ discard block |
||
9323 | 9323 | if ($needleTmp === false) { |
9324 | 9324 | return false; |
9325 | 9325 | } |
9326 | - $needle = (string) $needleTmp; |
|
9326 | + $needle = (string)$needleTmp; |
|
9327 | 9327 | |
9328 | 9328 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
9329 | 9329 | if ($pos === false) { |
@@ -9362,10 +9362,10 @@ discard block |
||
9362 | 9362 | } |
9363 | 9363 | |
9364 | 9364 | // iconv and mbstring do not support integer $needle |
9365 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9366 | - $needle = (string) self::chr($needle); |
|
9365 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9366 | + $needle = (string)self::chr($needle); |
|
9367 | 9367 | } |
9368 | - $needle = (string) $needle; |
|
9368 | + $needle = (string)$needle; |
|
9369 | 9369 | |
9370 | 9370 | if ($needle === '') { |
9371 | 9371 | return false; |
@@ -9410,7 +9410,7 @@ discard block |
||
9410 | 9410 | && |
9411 | 9411 | self::$SUPPORT['mbstring'] === false |
9412 | 9412 | ) { |
9413 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9413 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9414 | 9414 | } |
9415 | 9415 | |
9416 | 9416 | // |
@@ -9434,7 +9434,7 @@ discard block |
||
9434 | 9434 | // fallback for ascii only |
9435 | 9435 | // |
9436 | 9436 | |
9437 | - if (self::is_ascii($haystack . $needle)) { |
|
9437 | + if (self::is_ascii($haystack.$needle)) { |
|
9438 | 9438 | return \strripos($haystack, $needle, $offset); |
9439 | 9439 | } |
9440 | 9440 | |
@@ -9510,10 +9510,10 @@ discard block |
||
9510 | 9510 | } |
9511 | 9511 | |
9512 | 9512 | // iconv and mbstring do not support integer $needle |
9513 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9514 | - $needle = (string) self::chr($needle); |
|
9513 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9514 | + $needle = (string)self::chr($needle); |
|
9515 | 9515 | } |
9516 | - $needle = (string) $needle; |
|
9516 | + $needle = (string)$needle; |
|
9517 | 9517 | |
9518 | 9518 | if ($needle === '') { |
9519 | 9519 | return false; |
@@ -9558,7 +9558,7 @@ discard block |
||
9558 | 9558 | && |
9559 | 9559 | self::$SUPPORT['mbstring'] === false |
9560 | 9560 | ) { |
9561 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9561 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9562 | 9562 | } |
9563 | 9563 | |
9564 | 9564 | // |
@@ -9582,7 +9582,7 @@ discard block |
||
9582 | 9582 | // fallback for ascii only |
9583 | 9583 | // |
9584 | 9584 | |
9585 | - if (self::is_ascii($haystack . $needle)) { |
|
9585 | + if (self::is_ascii($haystack.$needle)) { |
|
9586 | 9586 | return \strrpos($haystack, $needle, $offset); |
9587 | 9587 | } |
9588 | 9588 | |
@@ -9602,7 +9602,7 @@ discard block |
||
9602 | 9602 | if ($haystackTmp === false) { |
9603 | 9603 | $haystackTmp = ''; |
9604 | 9604 | } |
9605 | - $haystack = (string) $haystackTmp; |
|
9605 | + $haystack = (string)$haystackTmp; |
|
9606 | 9606 | } |
9607 | 9607 | |
9608 | 9608 | $pos = \strrpos($haystack, $needle); |
@@ -9615,7 +9615,7 @@ discard block |
||
9615 | 9615 | return false; |
9616 | 9616 | } |
9617 | 9617 | |
9618 | - return $offset + (int) self::strlen($strTmp); |
|
9618 | + return $offset + (int)self::strlen($strTmp); |
|
9619 | 9619 | } |
9620 | 9620 | |
9621 | 9621 | /** |
@@ -9675,12 +9675,12 @@ discard block |
||
9675 | 9675 | if ($offset || $length !== null) { |
9676 | 9676 | if ($encoding === 'UTF-8') { |
9677 | 9677 | if ($length === null) { |
9678 | - $str = (string) \mb_substr($str, $offset); |
|
9678 | + $str = (string)\mb_substr($str, $offset); |
|
9679 | 9679 | } else { |
9680 | - $str = (string) \mb_substr($str, $offset, $length); |
|
9680 | + $str = (string)\mb_substr($str, $offset, $length); |
|
9681 | 9681 | } |
9682 | 9682 | } else { |
9683 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
9683 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
9684 | 9684 | } |
9685 | 9685 | } |
9686 | 9686 | |
@@ -9690,7 +9690,7 @@ discard block |
||
9690 | 9690 | |
9691 | 9691 | $matches = []; |
9692 | 9692 | |
9693 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
9693 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
9694 | 9694 | } |
9695 | 9695 | |
9696 | 9696 | /** |
@@ -9759,7 +9759,7 @@ discard block |
||
9759 | 9759 | && |
9760 | 9760 | self::$SUPPORT['mbstring'] === false |
9761 | 9761 | ) { |
9762 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9762 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9763 | 9763 | } |
9764 | 9764 | |
9765 | 9765 | // |
@@ -9781,7 +9781,7 @@ discard block |
||
9781 | 9781 | // fallback for ascii only |
9782 | 9782 | // |
9783 | 9783 | |
9784 | - if (self::is_ascii($haystack . $needle)) { |
|
9784 | + if (self::is_ascii($haystack.$needle)) { |
|
9785 | 9785 | return \strstr($haystack, $needle, $before_needle); |
9786 | 9786 | } |
9787 | 9787 | |
@@ -9789,7 +9789,7 @@ discard block |
||
9789 | 9789 | // fallback via vanilla php |
9790 | 9790 | // |
9791 | 9791 | |
9792 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
9792 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
9793 | 9793 | |
9794 | 9794 | if (!isset($match[1])) { |
9795 | 9795 | return false; |
@@ -9799,7 +9799,7 @@ discard block |
||
9799 | 9799 | return $match[1]; |
9800 | 9800 | } |
9801 | 9801 | |
9802 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
9802 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
9803 | 9803 | } |
9804 | 9804 | |
9805 | 9805 | /** |
@@ -9913,7 +9913,7 @@ discard block |
||
9913 | 9913 | bool $tryToKeepStringLength = false |
9914 | 9914 | ): string { |
9915 | 9915 | // init |
9916 | - $str = (string) $str; |
|
9916 | + $str = (string)$str; |
|
9917 | 9917 | |
9918 | 9918 | if ($str === '') { |
9919 | 9919 | return ''; |
@@ -9938,19 +9938,19 @@ discard block |
||
9938 | 9938 | |
9939 | 9939 | if ($lang !== null) { |
9940 | 9940 | if (self::$SUPPORT['intl'] === true) { |
9941 | - $langCode = $lang . '-Lower'; |
|
9941 | + $langCode = $lang.'-Lower'; |
|
9942 | 9942 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
9943 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, \E_USER_WARNING); |
|
9943 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, \E_USER_WARNING); |
|
9944 | 9944 | |
9945 | 9945 | $langCode = 'Any-Lower'; |
9946 | 9946 | } |
9947 | 9947 | |
9948 | 9948 | /** @noinspection PhpComposerExtensionStubsInspection */ |
9949 | 9949 | /** @noinspection UnnecessaryCastingInspection */ |
9950 | - return (string) \transliterator_transliterate($langCode, $str); |
|
9950 | + return (string)\transliterator_transliterate($langCode, $str); |
|
9951 | 9951 | } |
9952 | 9952 | |
9953 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
9953 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
9954 | 9954 | } |
9955 | 9955 | |
9956 | 9956 | // always fallback via symfony polyfill |
@@ -9979,7 +9979,7 @@ discard block |
||
9979 | 9979 | bool $tryToKeepStringLength = false |
9980 | 9980 | ): string { |
9981 | 9981 | // init |
9982 | - $str = (string) $str; |
|
9982 | + $str = (string)$str; |
|
9983 | 9983 | |
9984 | 9984 | if ($str === '') { |
9985 | 9985 | return ''; |
@@ -10004,19 +10004,19 @@ discard block |
||
10004 | 10004 | |
10005 | 10005 | if ($lang !== null) { |
10006 | 10006 | if (self::$SUPPORT['intl'] === true) { |
10007 | - $langCode = $lang . '-Upper'; |
|
10007 | + $langCode = $lang.'-Upper'; |
|
10008 | 10008 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
10009 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
10009 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
10010 | 10010 | |
10011 | 10011 | $langCode = 'Any-Upper'; |
10012 | 10012 | } |
10013 | 10013 | |
10014 | 10014 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10015 | 10015 | /** @noinspection UnnecessaryCastingInspection */ |
10016 | - return (string) \transliterator_transliterate($langCode, $str); |
|
10016 | + return (string)\transliterator_transliterate($langCode, $str); |
|
10017 | 10017 | } |
10018 | 10018 | |
10019 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
10019 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
10020 | 10020 | } |
10021 | 10021 | |
10022 | 10022 | // always fallback via symfony polyfill |
@@ -10060,7 +10060,7 @@ discard block |
||
10060 | 10060 | |
10061 | 10061 | $from = \array_combine($from, $to); |
10062 | 10062 | if ($from === false) { |
10063 | - 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) . ')'); |
|
10063 | + 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).')'); |
|
10064 | 10064 | } |
10065 | 10065 | } |
10066 | 10066 | |
@@ -10117,9 +10117,9 @@ discard block |
||
10117 | 10117 | } |
10118 | 10118 | |
10119 | 10119 | $wide = 0; |
10120 | - $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); |
|
10120 | + $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); |
|
10121 | 10121 | |
10122 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
10122 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
10123 | 10123 | } |
10124 | 10124 | |
10125 | 10125 | /** |
@@ -10219,9 +10219,9 @@ discard block |
||
10219 | 10219 | } |
10220 | 10220 | |
10221 | 10221 | if ($length === null) { |
10222 | - $length = (int) $str_length; |
|
10222 | + $length = (int)$str_length; |
|
10223 | 10223 | } else { |
10224 | - $length = (int) $length; |
|
10224 | + $length = (int)$length; |
|
10225 | 10225 | } |
10226 | 10226 | |
10227 | 10227 | if ( |
@@ -10229,7 +10229,7 @@ discard block |
||
10229 | 10229 | && |
10230 | 10230 | self::$SUPPORT['mbstring'] === false |
10231 | 10231 | ) { |
10232 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10232 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10233 | 10233 | } |
10234 | 10234 | |
10235 | 10235 | // |
@@ -10317,16 +10317,16 @@ discard block |
||
10317 | 10317 | ) { |
10318 | 10318 | if ($encoding === 'UTF-8') { |
10319 | 10319 | if ($length === null) { |
10320 | - $str1 = (string) \mb_substr($str1, $offset); |
|
10320 | + $str1 = (string)\mb_substr($str1, $offset); |
|
10321 | 10321 | } else { |
10322 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
10322 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
10323 | 10323 | } |
10324 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
10324 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
10325 | 10325 | } else { |
10326 | 10326 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10327 | 10327 | |
10328 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
10329 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
10328 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
10329 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
10330 | 10330 | } |
10331 | 10331 | } |
10332 | 10332 | |
@@ -10388,13 +10388,13 @@ discard block |
||
10388 | 10388 | if ($lengthTmp === false) { |
10389 | 10389 | return false; |
10390 | 10390 | } |
10391 | - $length = (int) $lengthTmp; |
|
10391 | + $length = (int)$lengthTmp; |
|
10392 | 10392 | } |
10393 | 10393 | |
10394 | 10394 | if ($encoding === 'UTF-8') { |
10395 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
10395 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
10396 | 10396 | } else { |
10397 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
10397 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
10398 | 10398 | } |
10399 | 10399 | } |
10400 | 10400 | |
@@ -10403,7 +10403,7 @@ discard block |
||
10403 | 10403 | && |
10404 | 10404 | self::$SUPPORT['mbstring'] === false |
10405 | 10405 | ) { |
10406 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10406 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10407 | 10407 | } |
10408 | 10408 | |
10409 | 10409 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10414,7 +10414,7 @@ discard block |
||
10414 | 10414 | return \mb_substr_count($haystack, $needle, $encoding); |
10415 | 10415 | } |
10416 | 10416 | |
10417 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10417 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10418 | 10418 | |
10419 | 10419 | return \count($matches); |
10420 | 10420 | } |
@@ -10461,7 +10461,7 @@ discard block |
||
10461 | 10461 | if ($lengthTmp === false) { |
10462 | 10462 | return false; |
10463 | 10463 | } |
10464 | - $length = (int) $lengthTmp; |
|
10464 | + $length = (int)$lengthTmp; |
|
10465 | 10465 | } |
10466 | 10466 | |
10467 | 10467 | if ( |
@@ -10482,7 +10482,7 @@ discard block |
||
10482 | 10482 | if ($haystackTmp === false) { |
10483 | 10483 | $haystackTmp = ''; |
10484 | 10484 | } |
10485 | - $haystack = (string) $haystackTmp; |
|
10485 | + $haystack = (string)$haystackTmp; |
|
10486 | 10486 | } |
10487 | 10487 | |
10488 | 10488 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10521,10 +10521,10 @@ discard block |
||
10521 | 10521 | |
10522 | 10522 | if ($encoding === 'UTF-8') { |
10523 | 10523 | if ($caseSensitive) { |
10524 | - return (int) \mb_substr_count($str, $substring); |
|
10524 | + return (int)\mb_substr_count($str, $substring); |
|
10525 | 10525 | } |
10526 | 10526 | |
10527 | - return (int) \mb_substr_count( |
|
10527 | + return (int)\mb_substr_count( |
|
10528 | 10528 | \mb_strtoupper($str), |
10529 | 10529 | \mb_strtoupper($substring) |
10530 | 10530 | |
@@ -10534,10 +10534,10 @@ discard block |
||
10534 | 10534 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10535 | 10535 | |
10536 | 10536 | if ($caseSensitive) { |
10537 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
10537 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
10538 | 10538 | } |
10539 | 10539 | |
10540 | - return (int) \mb_substr_count( |
|
10540 | + return (int)\mb_substr_count( |
|
10541 | 10541 | self::strtocasefold($str, true, false, $encoding, null, false), |
10542 | 10542 | self::strtocasefold($substring, true, false, $encoding, null, false), |
10543 | 10543 | $encoding |
@@ -10563,7 +10563,7 @@ discard block |
||
10563 | 10563 | } |
10564 | 10564 | |
10565 | 10565 | if (self::str_istarts_with($haystack, $needle) === true) { |
10566 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10566 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10567 | 10567 | } |
10568 | 10568 | |
10569 | 10569 | return $haystack; |
@@ -10620,7 +10620,7 @@ discard block |
||
10620 | 10620 | } |
10621 | 10621 | |
10622 | 10622 | if (self::str_iends_with($haystack, $needle) === true) { |
10623 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
10623 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
10624 | 10624 | } |
10625 | 10625 | |
10626 | 10626 | return $haystack; |
@@ -10645,7 +10645,7 @@ discard block |
||
10645 | 10645 | } |
10646 | 10646 | |
10647 | 10647 | if (self::str_starts_with($haystack, $needle) === true) { |
10648 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10648 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10649 | 10649 | } |
10650 | 10650 | |
10651 | 10651 | return $haystack; |
@@ -10697,7 +10697,7 @@ discard block |
||
10697 | 10697 | if (\is_array($offset) === true) { |
10698 | 10698 | $offset = \array_slice($offset, 0, $num); |
10699 | 10699 | foreach ($offset as &$valueTmp) { |
10700 | - $valueTmp = (int) $valueTmp === $valueTmp ? $valueTmp : 0; |
|
10700 | + $valueTmp = (int)$valueTmp === $valueTmp ? $valueTmp : 0; |
|
10701 | 10701 | } |
10702 | 10702 | unset($valueTmp); |
10703 | 10703 | } else { |
@@ -10710,7 +10710,7 @@ discard block |
||
10710 | 10710 | } elseif (\is_array($length) === true) { |
10711 | 10711 | $length = \array_slice($length, 0, $num); |
10712 | 10712 | foreach ($length as &$valueTmpV2) { |
10713 | - $valueTmpV2 = (int) $valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10713 | + $valueTmpV2 = (int)$valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10714 | 10714 | } |
10715 | 10715 | unset($valueTmpV2); |
10716 | 10716 | } else { |
@@ -10730,8 +10730,8 @@ discard block |
||
10730 | 10730 | } |
10731 | 10731 | |
10732 | 10732 | // init |
10733 | - $str = (string) $str; |
|
10734 | - $replacement = (string) $replacement; |
|
10733 | + $str = (string)$str; |
|
10734 | + $replacement = (string)$replacement; |
|
10735 | 10735 | |
10736 | 10736 | if (\is_array($length) === true) { |
10737 | 10737 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -10746,16 +10746,16 @@ discard block |
||
10746 | 10746 | } |
10747 | 10747 | |
10748 | 10748 | if (self::$SUPPORT['mbstring'] === true) { |
10749 | - $string_length = (int) self::strlen($str, $encoding); |
|
10749 | + $string_length = (int)self::strlen($str, $encoding); |
|
10750 | 10750 | |
10751 | 10751 | if ($offset < 0) { |
10752 | - $offset = (int) \max(0, $string_length + $offset); |
|
10752 | + $offset = (int)\max(0, $string_length + $offset); |
|
10753 | 10753 | } elseif ($offset > $string_length) { |
10754 | 10754 | $offset = $string_length; |
10755 | 10755 | } |
10756 | 10756 | |
10757 | 10757 | if ($length !== null && $length < 0) { |
10758 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
10758 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
10759 | 10759 | } elseif ($length === null || $length > $string_length) { |
10760 | 10760 | $length = $string_length; |
10761 | 10761 | } |
@@ -10766,9 +10766,9 @@ discard block |
||
10766 | 10766 | } |
10767 | 10767 | |
10768 | 10768 | /** @noinspection AdditionOperationOnArraysInspection */ |
10769 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
10770 | - $replacement . |
|
10771 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10769 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
10770 | + $replacement. |
|
10771 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10772 | 10772 | } |
10773 | 10773 | |
10774 | 10774 | // |
@@ -10777,8 +10777,7 @@ discard block |
||
10777 | 10777 | |
10778 | 10778 | if (self::is_ascii($str)) { |
10779 | 10779 | return ($length === null) ? |
10780 | - \substr_replace($str, $replacement, $offset) : |
|
10781 | - \substr_replace($str, $replacement, $offset, $length); |
|
10780 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
10782 | 10781 | } |
10783 | 10782 | |
10784 | 10783 | // |
@@ -10794,7 +10793,7 @@ discard block |
||
10794 | 10793 | // e.g.: non mbstring support + invalid chars |
10795 | 10794 | return ''; |
10796 | 10795 | } |
10797 | - $length = (int) $lengthTmp; |
|
10796 | + $length = (int)$lengthTmp; |
|
10798 | 10797 | } |
10799 | 10798 | |
10800 | 10799 | \array_splice($smatches[0], $offset, $length, $rmatches[0]); |
@@ -10829,14 +10828,14 @@ discard block |
||
10829 | 10828 | && |
10830 | 10829 | \substr($haystack, -\strlen($needle)) === $needle |
10831 | 10830 | ) { |
10832 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
10831 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
10833 | 10832 | } |
10834 | 10833 | |
10835 | 10834 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
10836 | - return (string) self::substr( |
|
10835 | + return (string)self::substr( |
|
10837 | 10836 | $haystack, |
10838 | 10837 | 0, |
10839 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
10838 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
10840 | 10839 | $encoding |
10841 | 10840 | ); |
10842 | 10841 | } |
@@ -10866,10 +10865,10 @@ discard block |
||
10866 | 10865 | } |
10867 | 10866 | |
10868 | 10867 | if ($encoding === 'UTF-8') { |
10869 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10868 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10870 | 10869 | } |
10871 | 10870 | |
10872 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10871 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10873 | 10872 | } |
10874 | 10873 | |
10875 | 10874 | /** |
@@ -11065,7 +11064,7 @@ discard block |
||
11065 | 11064 | // INFO: https://unicode.org/cldr/utility/character.jsp?a=%E2%84%8C |
11066 | 11065 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11067 | 11066 | /** @noinspection UnnecessaryCastingInspection */ |
11068 | - $str = (string) \transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11067 | + $str = (string)\transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11069 | 11068 | |
11070 | 11069 | // check again, if we only have ASCII, now ... |
11071 | 11070 | if (self::is_ascii($str) === true) { |
@@ -11188,7 +11187,7 @@ discard block |
||
11188 | 11187 | public static function to_boolean($str): bool |
11189 | 11188 | { |
11190 | 11189 | // init |
11191 | - $str = (string) $str; |
|
11190 | + $str = (string)$str; |
|
11192 | 11191 | |
11193 | 11192 | if ($str === '') { |
11194 | 11193 | return false; |
@@ -11216,10 +11215,10 @@ discard block |
||
11216 | 11215 | } |
11217 | 11216 | |
11218 | 11217 | if (\is_numeric($str)) { |
11219 | - return ((float) $str + 0) > 0; |
|
11218 | + return ((float)$str + 0) > 0; |
|
11220 | 11219 | } |
11221 | 11220 | |
11222 | - return (bool) \trim($str); |
|
11221 | + return (bool)\trim($str); |
|
11223 | 11222 | } |
11224 | 11223 | |
11225 | 11224 | /** |
@@ -11240,11 +11239,11 @@ discard block |
||
11240 | 11239 | |
11241 | 11240 | $fallback_char_escaped = \preg_quote($fallback_char, '/'); |
11242 | 11241 | |
11243 | - $string = (string) \preg_replace( |
|
11242 | + $string = (string)\preg_replace( |
|
11244 | 11243 | [ |
11245 | - '/[^' . $fallback_char_escaped . '\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
11246 | - '/[\s]+/u', // 2) convert spaces to $fallback_char |
|
11247 | - '/[' . $fallback_char_escaped . ']+/u', // 3) remove double $fallback_char's |
|
11244 | + '/[^'.$fallback_char_escaped.'\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
11245 | + '/[\s]+/u', // 2) convert spaces to $fallback_char |
|
11246 | + '/['.$fallback_char_escaped.']+/u', // 3) remove double $fallback_char's |
|
11248 | 11247 | ], |
11249 | 11248 | [ |
11250 | 11249 | '', |
@@ -11275,7 +11274,7 @@ discard block |
||
11275 | 11274 | return $str; |
11276 | 11275 | } |
11277 | 11276 | |
11278 | - $str = (string) $str; |
|
11277 | + $str = (string)$str; |
|
11279 | 11278 | if ($str === '') { |
11280 | 11279 | return ''; |
11281 | 11280 | } |
@@ -11322,7 +11321,7 @@ discard block |
||
11322 | 11321 | return $str; |
11323 | 11322 | } |
11324 | 11323 | |
11325 | - $str = (string) $str; |
|
11324 | + $str = (string)$str; |
|
11326 | 11325 | if ($str === '') { |
11327 | 11326 | return $str; |
11328 | 11327 | } |
@@ -11340,7 +11339,7 @@ discard block |
||
11340 | 11339 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
11341 | 11340 | |
11342 | 11341 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11343 | - $buf .= $c1 . $c2; |
|
11342 | + $buf .= $c1.$c2; |
|
11344 | 11343 | ++$i; |
11345 | 11344 | } else { // not valid UTF8 - convert it |
11346 | 11345 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11351,7 +11350,7 @@ discard block |
||
11351 | 11350 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
11352 | 11351 | |
11353 | 11352 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11354 | - $buf .= $c1 . $c2 . $c3; |
|
11353 | + $buf .= $c1.$c2.$c3; |
|
11355 | 11354 | $i += 2; |
11356 | 11355 | } else { // not valid UTF8 - convert it |
11357 | 11356 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11363,7 +11362,7 @@ discard block |
||
11363 | 11362 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
11364 | 11363 | |
11365 | 11364 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11366 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
11365 | + $buf .= $c1.$c2.$c3.$c4; |
|
11367 | 11366 | $i += 3; |
11368 | 11367 | } else { // not valid UTF8 - convert it |
11369 | 11368 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11389,13 +11388,13 @@ discard block |
||
11389 | 11388 | * |
11390 | 11389 | * @return string |
11391 | 11390 | */ |
11392 | - static function (array $matches): string { |
|
11391 | + static function(array $matches): string { |
|
11393 | 11392 | if (isset($matches[3])) { |
11394 | - $cp = (int) \hexdec($matches[3]); |
|
11393 | + $cp = (int)\hexdec($matches[3]); |
|
11395 | 11394 | } else { |
11396 | 11395 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
11397 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
11398 | - + (int) \hexdec($matches[2]) |
|
11396 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
11397 | + + (int)\hexdec($matches[2]) |
|
11399 | 11398 | + 0x10000 |
11400 | 11399 | - (0xD800 << 10) |
11401 | 11400 | - 0xDC00; |
@@ -11406,12 +11405,12 @@ discard block |
||
11406 | 11405 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
11407 | 11406 | |
11408 | 11407 | if ($cp < 0x80) { |
11409 | - return (string) self::chr($cp); |
|
11408 | + return (string)self::chr($cp); |
|
11410 | 11409 | } |
11411 | 11410 | |
11412 | 11411 | if ($cp < 0xA0) { |
11413 | 11412 | /** @noinspection UnnecessaryCastingInspection */ |
11414 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
11413 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
11415 | 11414 | } |
11416 | 11415 | |
11417 | 11416 | return self::decimal_to_chr($cp); |
@@ -11459,7 +11458,7 @@ discard block |
||
11459 | 11458 | |
11460 | 11459 | if (self::$SUPPORT['mbstring'] === true) { |
11461 | 11460 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11462 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
11461 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
11463 | 11462 | } |
11464 | 11463 | |
11465 | 11464 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -11496,15 +11495,15 @@ discard block |
||
11496 | 11495 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
11497 | 11496 | |
11498 | 11497 | if ($encoding === 'UTF-8') { |
11499 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
11498 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
11500 | 11499 | |
11501 | 11500 | if ($useMbFunction === true) { |
11502 | 11501 | $strPartOne = \mb_strtoupper( |
11503 | - (string) \mb_substr($str, 0, 1) |
|
11502 | + (string)\mb_substr($str, 0, 1) |
|
11504 | 11503 | ); |
11505 | 11504 | } else { |
11506 | 11505 | $strPartOne = self::strtoupper( |
11507 | - (string) \mb_substr($str, 0, 1), |
|
11506 | + (string)\mb_substr($str, 0, 1), |
|
11508 | 11507 | $encoding, |
11509 | 11508 | false, |
11510 | 11509 | $lang, |
@@ -11514,16 +11513,16 @@ discard block |
||
11514 | 11513 | } else { |
11515 | 11514 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11516 | 11515 | |
11517 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
11516 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
11518 | 11517 | |
11519 | 11518 | if ($useMbFunction === true) { |
11520 | 11519 | $strPartOne = \mb_strtoupper( |
11521 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
11520 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
11522 | 11521 | $encoding |
11523 | 11522 | ); |
11524 | 11523 | } else { |
11525 | 11524 | $strPartOne = self::strtoupper( |
11526 | - (string) self::substr($str, 0, 1, $encoding), |
|
11525 | + (string)self::substr($str, 0, 1, $encoding), |
|
11527 | 11526 | $encoding, |
11528 | 11527 | false, |
11529 | 11528 | $lang, |
@@ -11532,7 +11531,7 @@ discard block |
||
11532 | 11531 | } |
11533 | 11532 | } |
11534 | 11533 | |
11535 | - return $strPartOne . $strPartTwo; |
|
11534 | + return $strPartOne.$strPartTwo; |
|
11536 | 11535 | } |
11537 | 11536 | |
11538 | 11537 | /** |
@@ -11583,7 +11582,7 @@ discard block |
||
11583 | 11582 | $str = self::clean($str); |
11584 | 11583 | } |
11585 | 11584 | |
11586 | - $usePhpDefaultFunctions = !(bool) ($charlist . \implode('', $exceptions)); |
|
11585 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
11587 | 11586 | |
11588 | 11587 | if ( |
11589 | 11588 | $usePhpDefaultFunctions === true |
@@ -11652,7 +11651,7 @@ discard block |
||
11652 | 11651 | |
11653 | 11652 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
11654 | 11653 | if (\preg_match($pattern, $str)) { |
11655 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
11654 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
11656 | 11655 | } |
11657 | 11656 | |
11658 | 11657 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -11991,7 +11990,7 @@ discard block |
||
11991 | 11990 | if ( |
11992 | 11991 | $keepUtf8Chars === true |
11993 | 11992 | && |
11994 | - self::strlen($return) >= (int) self::strlen($str_backup) |
|
11993 | + self::strlen($return) >= (int)self::strlen($str_backup) |
|
11995 | 11994 | ) { |
11996 | 11995 | return $str_backup; |
11997 | 11996 | } |
@@ -12085,17 +12084,17 @@ discard block |
||
12085 | 12084 | return ''; |
12086 | 12085 | } |
12087 | 12086 | |
12088 | - \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches); |
|
12087 | + \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches); |
|
12089 | 12088 | |
12090 | 12089 | if ( |
12091 | 12090 | !isset($matches[0]) |
12092 | 12091 | || |
12093 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
12092 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
12094 | 12093 | ) { |
12095 | 12094 | return $str; |
12096 | 12095 | } |
12097 | 12096 | |
12098 | - return \rtrim($matches[0]) . $strAddOn; |
|
12097 | + return \rtrim($matches[0]).$strAddOn; |
|
12099 | 12098 | } |
12100 | 12099 | |
12101 | 12100 | /** |
@@ -12166,7 +12165,7 @@ discard block |
||
12166 | 12165 | $strReturn .= $break; |
12167 | 12166 | } |
12168 | 12167 | |
12169 | - return $strReturn . \implode('', $chars); |
|
12168 | + return $strReturn.\implode('', $chars); |
|
12170 | 12169 | } |
12171 | 12170 | |
12172 | 12171 | /** |
@@ -12179,7 +12178,7 @@ discard block |
||
12179 | 12178 | */ |
12180 | 12179 | public static function wordwrap_per_line(string $str, int $limit): string |
12181 | 12180 | { |
12182 | - $strings = (array) \preg_split('/\\r\\n|\\r|\\n/', $str); |
|
12181 | + $strings = (array)\preg_split('/\\r\\n|\\r|\\n/', $str); |
|
12183 | 12182 | |
12184 | 12183 | $string = ''; |
12185 | 12184 | foreach ($strings as &$value) { |
@@ -12216,7 +12215,7 @@ discard block |
||
12216 | 12215 | |
12217 | 12216 | \uksort( |
12218 | 12217 | self::$EMOJI, |
12219 | - static function (string $a, string $b): int { |
|
12218 | + static function(string $a, string $b): int { |
|
12220 | 12219 | return \strlen($b) <=> \strlen($a); |
12221 | 12220 | } |
12222 | 12221 | ); |
@@ -12226,7 +12225,7 @@ discard block |
||
12226 | 12225 | |
12227 | 12226 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
12228 | 12227 | $tmpKey = \crc32($key); |
12229 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmpKey . '_-_' . \strrev((string) $tmpKey) . '_-_8FTU_ELBATROP_-_'; |
|
12228 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmpKey.'_-_'.\strrev((string)$tmpKey).'_-_8FTU_ELBATROP_-_'; |
|
12230 | 12229 | } |
12231 | 12230 | } |
12232 | 12231 | } |
@@ -12285,7 +12284,7 @@ discard block |
||
12285 | 12284 | /** @noinspection PhpIncludeInspection */ |
12286 | 12285 | /** @noinspection UsingInclusionReturnValueInspection */ |
12287 | 12286 | /** @psalm-suppress UnresolvableInclude */ |
12288 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
12287 | + return include __DIR__.'/data/'.$file.'.php'; |
|
12289 | 12288 | } |
12290 | 12289 | |
12291 | 12290 | /** |
@@ -12297,7 +12296,7 @@ discard block |
||
12297 | 12296 | */ |
12298 | 12297 | private static function getDataIfExists(string $file) |
12299 | 12298 | { |
12300 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
12299 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
12301 | 12300 | if (\file_exists($file)) { |
12302 | 12301 | /** @noinspection PhpIncludeInspection */ |
12303 | 12302 | /** @noinspection UsingInclusionReturnValueInspection */ |
@@ -12322,7 +12321,7 @@ discard block |
||
12322 | 12321 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
12323 | 12322 | return \defined('MB_OVERLOAD_STRING') |
12324 | 12323 | && |
12325 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12324 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12326 | 12325 | } |
12327 | 12326 | |
12328 | 12327 | /** |
@@ -12372,7 +12371,7 @@ discard block |
||
12372 | 12371 | { |
12373 | 12372 | static $RX_CLASS_CACHE = []; |
12374 | 12373 | |
12375 | - $cacheKey = $s . $class; |
|
12374 | + $cacheKey = $s.$class; |
|
12376 | 12375 | |
12377 | 12376 | if (isset($RX_CLASS_CACHE[$cacheKey])) { |
12378 | 12377 | return $RX_CLASS_CACHE[$cacheKey]; |
@@ -12384,7 +12383,7 @@ discard block |
||
12384 | 12383 | /** @noinspection AlterInForeachInspection */ |
12385 | 12384 | foreach (self::str_split($s) as &$s) { |
12386 | 12385 | if ($s === '-') { |
12387 | - $classArray[0] = '-' . $classArray[0]; |
|
12386 | + $classArray[0] = '-'.$classArray[0]; |
|
12388 | 12387 | } elseif (!isset($s[2])) { |
12389 | 12388 | $classArray[0] .= \preg_quote($s, '/'); |
12390 | 12389 | } elseif (self::strlen($s) === 1) { |
@@ -12395,13 +12394,13 @@ discard block |
||
12395 | 12394 | } |
12396 | 12395 | |
12397 | 12396 | if ($classArray[0]) { |
12398 | - $classArray[0] = '[' . $classArray[0] . ']'; |
|
12397 | + $classArray[0] = '['.$classArray[0].']'; |
|
12399 | 12398 | } |
12400 | 12399 | |
12401 | 12400 | if (\count($classArray) === 1) { |
12402 | 12401 | $return = $classArray[0]; |
12403 | 12402 | } else { |
12404 | - $return = '(?:' . \implode('|', $classArray) . ')'; |
|
12403 | + $return = '(?:'.\implode('|', $classArray).')'; |
|
12405 | 12404 | } |
12406 | 12405 | |
12407 | 12406 | $RX_CLASS_CACHE[$cacheKey] = $return; |
@@ -12475,7 +12474,7 @@ discard block |
||
12475 | 12474 | $continue = false; |
12476 | 12475 | |
12477 | 12476 | if ($delimiter === '-') { |
12478 | - foreach ((array) $specialCases['names'] as &$beginning) { |
|
12477 | + foreach ((array)$specialCases['names'] as &$beginning) { |
|
12479 | 12478 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12480 | 12479 | $continue = true; |
12481 | 12480 | } |
@@ -12483,7 +12482,7 @@ discard block |
||
12483 | 12482 | unset($beginning); |
12484 | 12483 | } |
12485 | 12484 | |
12486 | - foreach ((array) $specialCases['prefixes'] as &$beginning) { |
|
12485 | + foreach ((array)$specialCases['prefixes'] as &$beginning) { |
|
12487 | 12486 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12488 | 12487 | $continue = true; |
12489 | 12488 | } |
@@ -12543,8 +12542,8 @@ discard block |
||
12543 | 12542 | $buf .= self::$WIN1252_TO_UTF8[$ordC1]; |
12544 | 12543 | } else { |
12545 | 12544 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
12546 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
12547 | - $buf .= $cc1 . $cc2; |
|
12545 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
12546 | + $buf .= $cc1.$cc2; |
|
12548 | 12547 | } |
12549 | 12548 | |
12550 | 12549 | return $buf; |