@@ -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 | /** |
@@ -547,10 +547,10 @@ discard block |
||
547 | 547 | && |
548 | 548 | self::$SUPPORT['mbstring'] === false |
549 | 549 | ) { |
550 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
550 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
551 | 551 | } |
552 | 552 | |
553 | - $cacheKey = $code_point . $encoding; |
|
553 | + $cacheKey = $code_point.$encoding; |
|
554 | 554 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
555 | 555 | return $CHAR_CACHE[$cacheKey]; |
556 | 556 | } |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | if ($code_point <= 127) { // use "simple"-char only until "\x80" |
559 | 559 | |
560 | 560 | if (self::$CHR === null) { |
561 | - self::$CHR = (array) self::getData('chr'); |
|
561 | + self::$CHR = (array)self::getData('chr'); |
|
562 | 562 | } |
563 | 563 | |
564 | 564 | /** |
@@ -593,10 +593,10 @@ discard block |
||
593 | 593 | // |
594 | 594 | |
595 | 595 | if (self::$CHR === null) { |
596 | - self::$CHR = (array) self::getData('chr'); |
|
596 | + self::$CHR = (array)self::getData('chr'); |
|
597 | 597 | } |
598 | 598 | |
599 | - $code_point = (int) $code_point; |
|
599 | + $code_point = (int)$code_point; |
|
600 | 600 | if ($code_point <= 0x7F) { |
601 | 601 | /** |
602 | 602 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -606,22 +606,22 @@ discard block |
||
606 | 606 | /** |
607 | 607 | * @psalm-suppress PossiblyNullArrayAccess |
608 | 608 | */ |
609 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
609 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
610 | 610 | self::$CHR[($code_point & 0x3F) + 0x80]; |
611 | 611 | } elseif ($code_point <= 0xFFFF) { |
612 | 612 | /** |
613 | 613 | * @psalm-suppress PossiblyNullArrayAccess |
614 | 614 | */ |
615 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
616 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
615 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
616 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
617 | 617 | self::$CHR[($code_point & 0x3F) + 0x80]; |
618 | 618 | } else { |
619 | 619 | /** |
620 | 620 | * @psalm-suppress PossiblyNullArrayAccess |
621 | 621 | */ |
622 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
623 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
624 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
622 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
623 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
624 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
625 | 625 | self::$CHR[($code_point & 0x3F) + 0x80]; |
626 | 626 | } |
627 | 627 | |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | |
669 | 669 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
670 | 670 | return \array_map( |
671 | - static function (string $data): int { |
|
671 | + static function(string $data): int { |
|
672 | 672 | // "mb_" is available if overload is used, so use it ... |
673 | 673 | return \mb_strlen($data, 'CP850'); // 8-BIT |
674 | 674 | }, |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | $char = ''; |
737 | 737 | } |
738 | 738 | |
739 | - return self::int_to_hex(self::ord((string) $char), $pfix); |
|
739 | + return self::int_to_hex(self::ord((string)$char), $pfix); |
|
740 | 740 | } |
741 | 741 | |
742 | 742 | /** |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | | ( [\x80-\xBF] ) # invalid byte in range 10000000 - 10111111 |
811 | 811 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
812 | 812 | /x'; |
813 | - $str = (string) \preg_replace($regx, '$1', $str); |
|
813 | + $str = (string)\preg_replace($regx, '$1', $str); |
|
814 | 814 | |
815 | 815 | if ($replace_diamond_question_mark === true) { |
816 | 816 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | public static function cleanup($str): string |
846 | 846 | { |
847 | 847 | // init |
848 | - $str = (string) $str; |
|
848 | + $str = (string)$str; |
|
849 | 849 | |
850 | 850 | if ($str === '') { |
851 | 851 | return ''; |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | { |
929 | 929 | if (self::$SUPPORT['mbstring'] === true) { |
930 | 930 | /** @noinspection PhpComposerExtensionStubsInspection */ |
931 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
931 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
932 | 932 | } |
933 | 933 | |
934 | 934 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -968,7 +968,7 @@ discard block |
||
968 | 968 | */ |
969 | 969 | public static function css_stripe_media_queries(string $str): string |
970 | 970 | { |
971 | - return (string) \preg_replace( |
|
971 | + return (string)\preg_replace( |
|
972 | 972 | '#@media\\s+(?:only\\s)?(?:[\\s{\\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
973 | 973 | '', |
974 | 974 | $str |
@@ -995,7 +995,7 @@ discard block |
||
995 | 995 | */ |
996 | 996 | public static function decimal_to_chr($int): string |
997 | 997 | { |
998 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
998 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | /** |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | if ($toEncoding === 'JSON') { |
1075 | 1075 | $return = self::json_encode($str); |
1076 | 1076 | if ($return === false) { |
1077 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1077 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1078 | 1078 | } |
1079 | 1079 | |
1080 | 1080 | return $return; |
@@ -1160,7 +1160,7 @@ discard block |
||
1160 | 1160 | && |
1161 | 1161 | self::$SUPPORT['mbstring'] === false |
1162 | 1162 | ) { |
1163 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $toEncoding . '" encoding', \E_USER_WARNING); |
|
1163 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$toEncoding.'" encoding', \E_USER_WARNING); |
|
1164 | 1164 | } |
1165 | 1165 | |
1166 | 1166 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1254,31 +1254,31 @@ discard block |
||
1254 | 1254 | $trimChars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1255 | 1255 | |
1256 | 1256 | if ($length === null) { |
1257 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
1257 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
1258 | 1258 | } |
1259 | 1259 | |
1260 | 1260 | if ($search === '') { |
1261 | 1261 | if ($encoding === 'UTF-8') { |
1262 | 1262 | if ($length > 0) { |
1263 | - $stringLength = (int) \mb_strlen($str); |
|
1263 | + $stringLength = (int)\mb_strlen($str); |
|
1264 | 1264 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
1265 | 1265 | } else { |
1266 | 1266 | $end = 0; |
1267 | 1267 | } |
1268 | 1268 | |
1269 | - $pos = (int) \min( |
|
1269 | + $pos = (int)\min( |
|
1270 | 1270 | \mb_strpos($str, ' ', $end), |
1271 | 1271 | \mb_strpos($str, '.', $end) |
1272 | 1272 | ); |
1273 | 1273 | } else { |
1274 | 1274 | if ($length > 0) { |
1275 | - $stringLength = (int) self::strlen($str, $encoding); |
|
1275 | + $stringLength = (int)self::strlen($str, $encoding); |
|
1276 | 1276 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
1277 | 1277 | } else { |
1278 | 1278 | $end = 0; |
1279 | 1279 | } |
1280 | 1280 | |
1281 | - $pos = (int) \min( |
|
1281 | + $pos = (int)\min( |
|
1282 | 1282 | self::strpos($str, ' ', $end, $encoding), |
1283 | 1283 | self::strpos($str, '.', $end, $encoding) |
1284 | 1284 | ); |
@@ -1295,18 +1295,18 @@ discard block |
||
1295 | 1295 | return ''; |
1296 | 1296 | } |
1297 | 1297 | |
1298 | - return \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1298 | + return \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1299 | 1299 | } |
1300 | 1300 | |
1301 | 1301 | return $str; |
1302 | 1302 | } |
1303 | 1303 | |
1304 | 1304 | if ($encoding === 'UTF-8') { |
1305 | - $wordPos = (int) \mb_stripos($str, $search); |
|
1306 | - $halfSide = (int) ($wordPos - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1305 | + $wordPos = (int)\mb_stripos($str, $search); |
|
1306 | + $halfSide = (int)($wordPos - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1307 | 1307 | } else { |
1308 | - $wordPos = (int) self::stripos($str, $search, 0, $encoding); |
|
1309 | - $halfSide = (int) ($wordPos - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1308 | + $wordPos = (int)self::stripos($str, $search, 0, $encoding); |
|
1309 | + $halfSide = (int)($wordPos - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1310 | 1310 | } |
1311 | 1311 | |
1312 | 1312 | $pos_start = 0; |
@@ -1318,12 +1318,12 @@ discard block |
||
1318 | 1318 | } |
1319 | 1319 | if ($halfText !== false) { |
1320 | 1320 | if ($encoding === 'UTF-8') { |
1321 | - $pos_start = (int) \max( |
|
1321 | + $pos_start = (int)\max( |
|
1322 | 1322 | \mb_strrpos($halfText, ' '), |
1323 | 1323 | \mb_strrpos($halfText, '.') |
1324 | 1324 | ); |
1325 | 1325 | } else { |
1326 | - $pos_start = (int) \max( |
|
1326 | + $pos_start = (int)\max( |
|
1327 | 1327 | self::strrpos($halfText, ' ', 0, $encoding), |
1328 | 1328 | self::strrpos($halfText, '.', 0, $encoding) |
1329 | 1329 | ); |
@@ -1333,19 +1333,19 @@ discard block |
||
1333 | 1333 | |
1334 | 1334 | if ($wordPos && $halfSide > 0) { |
1335 | 1335 | $offset = $pos_start + $length - 1; |
1336 | - $realLength = (int) self::strlen($str, $encoding); |
|
1336 | + $realLength = (int)self::strlen($str, $encoding); |
|
1337 | 1337 | |
1338 | 1338 | if ($offset > $realLength) { |
1339 | 1339 | $offset = $realLength; |
1340 | 1340 | } |
1341 | 1341 | |
1342 | 1342 | if ($encoding === 'UTF-8') { |
1343 | - $pos_end = (int) \min( |
|
1343 | + $pos_end = (int)\min( |
|
1344 | 1344 | \mb_strpos($str, ' ', $offset), |
1345 | 1345 | \mb_strpos($str, '.', $offset) |
1346 | 1346 | ) - $pos_start; |
1347 | 1347 | } else { |
1348 | - $pos_end = (int) \min( |
|
1348 | + $pos_end = (int)\min( |
|
1349 | 1349 | self::strpos($str, ' ', $offset, $encoding), |
1350 | 1350 | self::strpos($str, '.', $offset, $encoding) |
1351 | 1351 | ) - $pos_start; |
@@ -1353,12 +1353,12 @@ discard block |
||
1353 | 1353 | |
1354 | 1354 | if (!$pos_end || $pos_end <= 0) { |
1355 | 1355 | if ($encoding === 'UTF-8') { |
1356 | - $strSub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1356 | + $strSub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1357 | 1357 | } else { |
1358 | - $strSub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1358 | + $strSub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1359 | 1359 | } |
1360 | 1360 | if ($strSub !== false) { |
1361 | - $extract = $replacerForSkippedText . \ltrim($strSub, $trimChars); |
|
1361 | + $extract = $replacerForSkippedText.\ltrim($strSub, $trimChars); |
|
1362 | 1362 | } else { |
1363 | 1363 | $extract = ''; |
1364 | 1364 | } |
@@ -1369,26 +1369,26 @@ discard block |
||
1369 | 1369 | $strSub = self::substr($str, $pos_start, $pos_end, $encoding); |
1370 | 1370 | } |
1371 | 1371 | if ($strSub !== false) { |
1372 | - $extract = $replacerForSkippedText . \trim($strSub, $trimChars) . $replacerForSkippedText; |
|
1372 | + $extract = $replacerForSkippedText.\trim($strSub, $trimChars).$replacerForSkippedText; |
|
1373 | 1373 | } else { |
1374 | 1374 | $extract = ''; |
1375 | 1375 | } |
1376 | 1376 | } |
1377 | 1377 | } else { |
1378 | 1378 | $offset = $length - 1; |
1379 | - $trueLength = (int) self::strlen($str, $encoding); |
|
1379 | + $trueLength = (int)self::strlen($str, $encoding); |
|
1380 | 1380 | |
1381 | 1381 | if ($offset > $trueLength) { |
1382 | 1382 | $offset = $trueLength; |
1383 | 1383 | } |
1384 | 1384 | |
1385 | 1385 | if ($encoding === 'UTF-8') { |
1386 | - $pos_end = (int) \min( |
|
1386 | + $pos_end = (int)\min( |
|
1387 | 1387 | \mb_strpos($str, ' ', $offset), |
1388 | 1388 | \mb_strpos($str, '.', $offset) |
1389 | 1389 | ); |
1390 | 1390 | } else { |
1391 | - $pos_end = (int) \min( |
|
1391 | + $pos_end = (int)\min( |
|
1392 | 1392 | self::strpos($str, ' ', $offset, $encoding), |
1393 | 1393 | self::strpos($str, '.', $offset, $encoding) |
1394 | 1394 | ); |
@@ -1401,7 +1401,7 @@ discard block |
||
1401 | 1401 | $strSub = self::substr($str, 0, $pos_end, $encoding); |
1402 | 1402 | } |
1403 | 1403 | if ($strSub !== false) { |
1404 | - $extract = \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1404 | + $extract = \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1405 | 1405 | } else { |
1406 | 1406 | $extract = ''; |
1407 | 1407 | } |
@@ -1525,7 +1525,7 @@ discard block |
||
1525 | 1525 | { |
1526 | 1526 | $file_content = \file_get_contents($file_path); |
1527 | 1527 | if ($file_content === false) { |
1528 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1528 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1529 | 1529 | } |
1530 | 1530 | |
1531 | 1531 | return self::string_has_bom($file_content); |
@@ -1586,7 +1586,7 @@ discard block |
||
1586 | 1586 | ) { |
1587 | 1587 | // Prevent leading combining chars |
1588 | 1588 | // for NFC-safe concatenations. |
1589 | - $var = $leading_combining . $var; |
|
1589 | + $var = $leading_combining.$var; |
|
1590 | 1590 | } |
1591 | 1591 | } |
1592 | 1592 | |
@@ -1825,10 +1825,10 @@ discard block |
||
1825 | 1825 | } |
1826 | 1826 | |
1827 | 1827 | if ($encoding === 'UTF-8') { |
1828 | - return (string) \mb_substr($str, 0, $n); |
|
1828 | + return (string)\mb_substr($str, 0, $n); |
|
1829 | 1829 | } |
1830 | 1830 | |
1831 | - return (string) self::substr($str, 0, $n, $encoding); |
|
1831 | + return (string)self::substr($str, 0, $n, $encoding); |
|
1832 | 1832 | } |
1833 | 1833 | |
1834 | 1834 | /** |
@@ -1903,7 +1903,7 @@ discard block |
||
1903 | 1903 | return $str; |
1904 | 1904 | } |
1905 | 1905 | |
1906 | - $str = (string) $str; |
|
1906 | + $str = (string)$str; |
|
1907 | 1907 | $last = ''; |
1908 | 1908 | while ($last !== $str) { |
1909 | 1909 | $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; |
@@ -6955,11 +6955,11 @@ discard block |
||
6955 | 6955 | } |
6956 | 6956 | |
6957 | 6957 | if ($search === '') { |
6958 | - return $str . $replacement; |
|
6958 | + return $str.$replacement; |
|
6959 | 6959 | } |
6960 | 6960 | |
6961 | 6961 | if (\strpos($str, $search) === 0) { |
6962 | - return $replacement . \substr($str, \strlen($search)); |
|
6962 | + return $replacement.\substr($str, \strlen($search)); |
|
6963 | 6963 | } |
6964 | 6964 | |
6965 | 6965 | return $str; |
@@ -6987,11 +6987,11 @@ discard block |
||
6987 | 6987 | } |
6988 | 6988 | |
6989 | 6989 | if ($search === '') { |
6990 | - return $str . $replacement; |
|
6990 | + return $str.$replacement; |
|
6991 | 6991 | } |
6992 | 6992 | |
6993 | 6993 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6994 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6994 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6995 | 6995 | } |
6996 | 6996 | |
6997 | 6997 | return $str; |
@@ -7020,7 +7020,7 @@ discard block |
||
7020 | 7020 | $subject, |
7021 | 7021 | $replace, |
7022 | 7022 | $pos, |
7023 | - (int) self::strlen($search) |
|
7023 | + (int)self::strlen($search) |
|
7024 | 7024 | ); |
7025 | 7025 | } |
7026 | 7026 | |
@@ -7052,7 +7052,7 @@ discard block |
||
7052 | 7052 | $subject, |
7053 | 7053 | $replace, |
7054 | 7054 | $pos, |
7055 | - (int) self::strlen($search) |
|
7055 | + (int)self::strlen($search) |
|
7056 | 7056 | ); |
7057 | 7057 | } |
7058 | 7058 | |
@@ -7072,7 +7072,7 @@ discard block |
||
7072 | 7072 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
7073 | 7073 | { |
7074 | 7074 | if ($encoding === 'UTF-8') { |
7075 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
7075 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
7076 | 7076 | /** @noinspection NonSecureShuffleUsageInspection */ |
7077 | 7077 | \shuffle($indexes); |
7078 | 7078 | |
@@ -7088,7 +7088,7 @@ discard block |
||
7088 | 7088 | } else { |
7089 | 7089 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7090 | 7090 | |
7091 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
7091 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
7092 | 7092 | /** @noinspection NonSecureShuffleUsageInspection */ |
7093 | 7093 | \shuffle($indexes); |
7094 | 7094 | |
@@ -7129,11 +7129,11 @@ discard block |
||
7129 | 7129 | ) { |
7130 | 7130 | if ($encoding === 'UTF-8') { |
7131 | 7131 | if ($end === null) { |
7132 | - $length = (int) \mb_strlen($str); |
|
7132 | + $length = (int)\mb_strlen($str); |
|
7133 | 7133 | } elseif ($end >= 0 && $end <= $start) { |
7134 | 7134 | return ''; |
7135 | 7135 | } elseif ($end < 0) { |
7136 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7136 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7137 | 7137 | } else { |
7138 | 7138 | $length = $end - $start; |
7139 | 7139 | } |
@@ -7144,11 +7144,11 @@ discard block |
||
7144 | 7144 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7145 | 7145 | |
7146 | 7146 | if ($end === null) { |
7147 | - $length = (int) self::strlen($str, $encoding); |
|
7147 | + $length = (int)self::strlen($str, $encoding); |
|
7148 | 7148 | } elseif ($end >= 0 && $end <= $start) { |
7149 | 7149 | return ''; |
7150 | 7150 | } elseif ($end < 0) { |
7151 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7151 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7152 | 7152 | } else { |
7153 | 7153 | $length = $end - $start; |
7154 | 7154 | } |
@@ -7180,35 +7180,35 @@ discard block |
||
7180 | 7180 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7181 | 7181 | } |
7182 | 7182 | |
7183 | - $str = (string) \preg_replace_callback( |
|
7183 | + $str = (string)\preg_replace_callback( |
|
7184 | 7184 | '/([\d|\p{Lu}])/u', |
7185 | 7185 | /** |
7186 | 7186 | * @param string[] $matches |
7187 | 7187 | * |
7188 | 7188 | * @return string |
7189 | 7189 | */ |
7190 | - static function (array $matches) use ($encoding): string { |
|
7190 | + static function(array $matches) use ($encoding): string { |
|
7191 | 7191 | $match = $matches[1]; |
7192 | - $matchInt = (int) $match; |
|
7192 | + $matchInt = (int)$match; |
|
7193 | 7193 | |
7194 | - if ((string) $matchInt === $match) { |
|
7195 | - return '_' . $match . '_'; |
|
7194 | + if ((string)$matchInt === $match) { |
|
7195 | + return '_'.$match.'_'; |
|
7196 | 7196 | } |
7197 | 7197 | |
7198 | 7198 | if ($encoding === 'UTF-8') { |
7199 | - return '_' . \mb_strtolower($match); |
|
7199 | + return '_'.\mb_strtolower($match); |
|
7200 | 7200 | } |
7201 | 7201 | |
7202 | - return '_' . self::strtolower($match, $encoding); |
|
7202 | + return '_'.self::strtolower($match, $encoding); |
|
7203 | 7203 | }, |
7204 | 7204 | $str |
7205 | 7205 | ); |
7206 | 7206 | |
7207 | - $str = (string) \preg_replace( |
|
7207 | + $str = (string)\preg_replace( |
|
7208 | 7208 | [ |
7209 | - '/\s+/u', // convert spaces to "_" |
|
7210 | - '/^\s+|\s+$/u', // trim leading & trailing spaces |
|
7211 | - '/_+/', // remove double "_" |
|
7209 | + '/\s+/u', // convert spaces to "_" |
|
7210 | + '/^\s+|\s+$/u', // trim leading & trailing spaces |
|
7211 | + '/_+/', // remove double "_" |
|
7212 | 7212 | ], |
7213 | 7213 | [ |
7214 | 7214 | '_', |
@@ -7315,7 +7315,7 @@ discard block |
||
7315 | 7315 | $limit = -1; |
7316 | 7316 | } |
7317 | 7317 | |
7318 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7318 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7319 | 7319 | |
7320 | 7320 | if ($array === false) { |
7321 | 7321 | return []; |
@@ -7391,9 +7391,9 @@ discard block |
||
7391 | 7391 | return ''; |
7392 | 7392 | } |
7393 | 7393 | |
7394 | - return (string) \mb_substr( |
|
7394 | + return (string)\mb_substr( |
|
7395 | 7395 | $str, |
7396 | - $offset + (int) \mb_strlen($separator) |
|
7396 | + $offset + (int)\mb_strlen($separator) |
|
7397 | 7397 | ); |
7398 | 7398 | } |
7399 | 7399 | |
@@ -7402,9 +7402,9 @@ discard block |
||
7402 | 7402 | return ''; |
7403 | 7403 | } |
7404 | 7404 | |
7405 | - return (string) \mb_substr( |
|
7405 | + return (string)\mb_substr( |
|
7406 | 7406 | $str, |
7407 | - $offset + (int) self::strlen($separator, $encoding), |
|
7407 | + $offset + (int)self::strlen($separator, $encoding), |
|
7408 | 7408 | null, |
7409 | 7409 | $encoding |
7410 | 7410 | ); |
@@ -7431,9 +7431,9 @@ discard block |
||
7431 | 7431 | return ''; |
7432 | 7432 | } |
7433 | 7433 | |
7434 | - return (string) \mb_substr( |
|
7434 | + return (string)\mb_substr( |
|
7435 | 7435 | $str, |
7436 | - $offset + (int) \mb_strlen($separator) |
|
7436 | + $offset + (int)\mb_strlen($separator) |
|
7437 | 7437 | ); |
7438 | 7438 | } |
7439 | 7439 | |
@@ -7442,9 +7442,9 @@ discard block |
||
7442 | 7442 | return ''; |
7443 | 7443 | } |
7444 | 7444 | |
7445 | - return (string) self::substr( |
|
7445 | + return (string)self::substr( |
|
7446 | 7446 | $str, |
7447 | - $offset + (int) self::strlen($separator, $encoding), |
|
7447 | + $offset + (int)self::strlen($separator, $encoding), |
|
7448 | 7448 | null, |
7449 | 7449 | $encoding |
7450 | 7450 | ); |
@@ -7474,7 +7474,7 @@ discard block |
||
7474 | 7474 | return ''; |
7475 | 7475 | } |
7476 | 7476 | |
7477 | - return (string) \mb_substr( |
|
7477 | + return (string)\mb_substr( |
|
7478 | 7478 | $str, |
7479 | 7479 | 0, |
7480 | 7480 | $offset |
@@ -7486,7 +7486,7 @@ discard block |
||
7486 | 7486 | return ''; |
7487 | 7487 | } |
7488 | 7488 | |
7489 | - return (string) self::substr( |
|
7489 | + return (string)self::substr( |
|
7490 | 7490 | $str, |
7491 | 7491 | 0, |
7492 | 7492 | $offset, |
@@ -7515,7 +7515,7 @@ discard block |
||
7515 | 7515 | return ''; |
7516 | 7516 | } |
7517 | 7517 | |
7518 | - return (string) \mb_substr( |
|
7518 | + return (string)\mb_substr( |
|
7519 | 7519 | $str, |
7520 | 7520 | 0, |
7521 | 7521 | $offset |
@@ -7529,7 +7529,7 @@ discard block |
||
7529 | 7529 | |
7530 | 7530 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7531 | 7531 | |
7532 | - return (string) self::substr( |
|
7532 | + return (string)self::substr( |
|
7533 | 7533 | $str, |
7534 | 7534 | 0, |
7535 | 7535 | $offset, |
@@ -7637,7 +7637,7 @@ discard block |
||
7637 | 7637 | */ |
7638 | 7638 | public static function str_surround(string $str, string $substring): string |
7639 | 7639 | { |
7640 | - return $substring . $str . $substring; |
|
7640 | + return $substring.$str.$substring; |
|
7641 | 7641 | } |
7642 | 7642 | |
7643 | 7643 | /** |
@@ -7681,9 +7681,9 @@ discard block |
||
7681 | 7681 | |
7682 | 7682 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
7683 | 7683 | |
7684 | - return (string) \preg_replace_callback( |
|
7684 | + return (string)\preg_replace_callback( |
|
7685 | 7685 | '/([\S]+)/u', |
7686 | - static function (array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7686 | + static function(array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7687 | 7687 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
7688 | 7688 | return $match[0]; |
7689 | 7689 | } |
@@ -7769,16 +7769,16 @@ discard block |
||
7769 | 7769 | } |
7770 | 7770 | |
7771 | 7771 | // the main substitutions |
7772 | - $str = (string) \preg_replace_callback( |
|
7772 | + $str = (string)\preg_replace_callback( |
|
7773 | 7773 | '~\b (_*) (?: # 1. Leading underscore and |
7774 | 7774 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
7775 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
7775 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
7776 | 7776 | | |
7777 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
7777 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
7778 | 7778 | | |
7779 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
7779 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
7780 | 7780 | | |
7781 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
7781 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
7782 | 7782 | ) (_*) \b # 6. With trailing underscore |
7783 | 7783 | ~ux', |
7784 | 7784 | /** |
@@ -7786,7 +7786,7 @@ discard block |
||
7786 | 7786 | * |
7787 | 7787 | * @return string |
7788 | 7788 | */ |
7789 | - static function (array $matches) use ($encoding): string { |
|
7789 | + static function(array $matches) use ($encoding): string { |
|
7790 | 7790 | // preserve leading underscore |
7791 | 7791 | $str = $matches[1]; |
7792 | 7792 | if ($matches[2]) { |
@@ -7811,26 +7811,26 @@ discard block |
||
7811 | 7811 | ); |
7812 | 7812 | |
7813 | 7813 | // Exceptions for small words: capitalize at start of title... |
7814 | - $str = (string) \preg_replace_callback( |
|
7814 | + $str = (string)\preg_replace_callback( |
|
7815 | 7815 | '~( \A [[:punct:]]* # start of title... |
7816 | 7816 | | [:.;?!][ ]+ # or of subsentence... |
7817 | 7817 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
7818 | - ( ' . $smallWordsRx . ' ) \b # ...followed by small word |
|
7818 | + ( ' . $smallWordsRx.' ) \b # ...followed by small word |
|
7819 | 7819 | ~uxi', |
7820 | 7820 | /** |
7821 | 7821 | * @param string[] $matches |
7822 | 7822 | * |
7823 | 7823 | * @return string |
7824 | 7824 | */ |
7825 | - static function (array $matches) use ($encoding): string { |
|
7826 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7825 | + static function(array $matches) use ($encoding): string { |
|
7826 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7827 | 7827 | }, |
7828 | 7828 | $str |
7829 | 7829 | ); |
7830 | 7830 | |
7831 | 7831 | // ...and end of title |
7832 | - $str = (string) \preg_replace_callback( |
|
7833 | - '~\b ( ' . $smallWordsRx . ' ) # small word... |
|
7832 | + $str = (string)\preg_replace_callback( |
|
7833 | + '~\b ( '.$smallWordsRx.' ) # small word... |
|
7834 | 7834 | (?= [[:punct:]]* \Z # ...at the end of the title... |
7835 | 7835 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
7836 | 7836 | ~uxi', |
@@ -7839,7 +7839,7 @@ discard block |
||
7839 | 7839 | * |
7840 | 7840 | * @return string |
7841 | 7841 | */ |
7842 | - static function (array $matches) use ($encoding): string { |
|
7842 | + static function(array $matches) use ($encoding): string { |
|
7843 | 7843 | return static::str_upper_first($matches[1], $encoding); |
7844 | 7844 | }, |
7845 | 7845 | $str |
@@ -7847,10 +7847,10 @@ discard block |
||
7847 | 7847 | |
7848 | 7848 | // Exceptions for small words in hyphenated compound words. |
7849 | 7849 | // e.g. "in-flight" -> In-Flight |
7850 | - $str = (string) \preg_replace_callback( |
|
7850 | + $str = (string)\preg_replace_callback( |
|
7851 | 7851 | '~\b |
7852 | 7852 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
7853 | - ( ' . $smallWordsRx . ' ) |
|
7853 | + ( ' . $smallWordsRx.' ) |
|
7854 | 7854 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
7855 | 7855 | ~uxi', |
7856 | 7856 | /** |
@@ -7858,18 +7858,18 @@ discard block |
||
7858 | 7858 | * |
7859 | 7859 | * @return string |
7860 | 7860 | */ |
7861 | - static function (array $matches) use ($encoding): string { |
|
7861 | + static function(array $matches) use ($encoding): string { |
|
7862 | 7862 | return static::str_upper_first($matches[1], $encoding); |
7863 | 7863 | }, |
7864 | 7864 | $str |
7865 | 7865 | ); |
7866 | 7866 | |
7867 | 7867 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
7868 | - $str = (string) \preg_replace_callback( |
|
7868 | + $str = (string)\preg_replace_callback( |
|
7869 | 7869 | '~\b |
7870 | 7870 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
7871 | 7871 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
7872 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
7872 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
7873 | 7873 | (?! - ) # Negative lookahead for another - |
7874 | 7874 | ~uxi', |
7875 | 7875 | /** |
@@ -7877,8 +7877,8 @@ discard block |
||
7877 | 7877 | * |
7878 | 7878 | * @return string |
7879 | 7879 | */ |
7880 | - static function (array $matches) use ($encoding): string { |
|
7881 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7880 | + static function(array $matches) use ($encoding): string { |
|
7881 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7882 | 7882 | }, |
7883 | 7883 | $str |
7884 | 7884 | ); |
@@ -7981,7 +7981,7 @@ discard block |
||
7981 | 7981 | ); |
7982 | 7982 | |
7983 | 7983 | foreach ($tmpReturn as &$item) { |
7984 | - $item = (string) $item; |
|
7984 | + $item = (string)$item; |
|
7985 | 7985 | } |
7986 | 7986 | |
7987 | 7987 | return $tmpReturn; |
@@ -8026,39 +8026,39 @@ discard block |
||
8026 | 8026 | } |
8027 | 8027 | |
8028 | 8028 | if ($encoding === 'UTF-8') { |
8029 | - if ($length >= (int) \mb_strlen($str)) { |
|
8029 | + if ($length >= (int)\mb_strlen($str)) { |
|
8030 | 8030 | return $str; |
8031 | 8031 | } |
8032 | 8032 | |
8033 | 8033 | if ($substring !== '') { |
8034 | - $length -= (int) \mb_strlen($substring); |
|
8034 | + $length -= (int)\mb_strlen($substring); |
|
8035 | 8035 | |
8036 | 8036 | /** @noinspection UnnecessaryCastingInspection */ |
8037 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8037 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8038 | 8038 | } |
8039 | 8039 | |
8040 | 8040 | /** @noinspection UnnecessaryCastingInspection */ |
8041 | - return (string) \mb_substr($str, 0, $length); |
|
8041 | + return (string)\mb_substr($str, 0, $length); |
|
8042 | 8042 | } |
8043 | 8043 | |
8044 | 8044 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8045 | 8045 | |
8046 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8046 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8047 | 8047 | return $str; |
8048 | 8048 | } |
8049 | 8049 | |
8050 | 8050 | if ($substring !== '') { |
8051 | - $length -= (int) self::strlen($substring, $encoding); |
|
8051 | + $length -= (int)self::strlen($substring, $encoding); |
|
8052 | 8052 | } |
8053 | 8053 | |
8054 | 8054 | return ( |
8055 | - (string) self::substr( |
|
8055 | + (string)self::substr( |
|
8056 | 8056 | $str, |
8057 | 8057 | 0, |
8058 | 8058 | $length, |
8059 | 8059 | $encoding |
8060 | 8060 | ) |
8061 | - ) . $substring; |
|
8061 | + ).$substring; |
|
8062 | 8062 | } |
8063 | 8063 | |
8064 | 8064 | /** |
@@ -8088,12 +8088,12 @@ discard block |
||
8088 | 8088 | } |
8089 | 8089 | |
8090 | 8090 | if ($encoding === 'UTF-8') { |
8091 | - if ($length >= (int) \mb_strlen($str)) { |
|
8091 | + if ($length >= (int)\mb_strlen($str)) { |
|
8092 | 8092 | return $str; |
8093 | 8093 | } |
8094 | 8094 | |
8095 | 8095 | // need to further trim the string so we can append the substring |
8096 | - $length -= (int) \mb_strlen($substring); |
|
8096 | + $length -= (int)\mb_strlen($substring); |
|
8097 | 8097 | if ($length <= 0) { |
8098 | 8098 | return $substring; |
8099 | 8099 | } |
@@ -8115,18 +8115,18 @@ discard block |
||
8115 | 8115 | || |
8116 | 8116 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8117 | 8117 | ) { |
8118 | - $truncated = (string) \mb_substr($truncated, 0, (int) $lastPos); |
|
8118 | + $truncated = (string)\mb_substr($truncated, 0, (int)$lastPos); |
|
8119 | 8119 | } |
8120 | 8120 | } |
8121 | 8121 | } else { |
8122 | 8122 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8123 | 8123 | |
8124 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8124 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8125 | 8125 | return $str; |
8126 | 8126 | } |
8127 | 8127 | |
8128 | 8128 | // need to further trim the string so we can append the substring |
8129 | - $length -= (int) self::strlen($substring, $encoding); |
|
8129 | + $length -= (int)self::strlen($substring, $encoding); |
|
8130 | 8130 | if ($length <= 0) { |
8131 | 8131 | return $substring; |
8132 | 8132 | } |
@@ -8148,12 +8148,12 @@ discard block |
||
8148 | 8148 | || |
8149 | 8149 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8150 | 8150 | ) { |
8151 | - $truncated = (string) self::substr($truncated, 0, (int) $lastPos, $encoding); |
|
8151 | + $truncated = (string)self::substr($truncated, 0, (int)$lastPos, $encoding); |
|
8152 | 8152 | } |
8153 | 8153 | } |
8154 | 8154 | } |
8155 | 8155 | |
8156 | - return $truncated . $substring; |
|
8156 | + return $truncated.$substring; |
|
8157 | 8157 | } |
8158 | 8158 | |
8159 | 8159 | /** |
@@ -8243,13 +8243,13 @@ discard block |
||
8243 | 8243 | } |
8244 | 8244 | } elseif ($format === 2) { |
8245 | 8245 | $numberOfWords = []; |
8246 | - $offset = (int) self::strlen($strParts[0]); |
|
8246 | + $offset = (int)self::strlen($strParts[0]); |
|
8247 | 8247 | for ($i = 1; $i < $len; $i += 2) { |
8248 | 8248 | $numberOfWords[$offset] = $strParts[$i]; |
8249 | - $offset += (int) self::strlen($strParts[$i]) + (int) self::strlen($strParts[$i + 1]); |
|
8249 | + $offset += (int)self::strlen($strParts[$i]) + (int)self::strlen($strParts[$i + 1]); |
|
8250 | 8250 | } |
8251 | 8251 | } else { |
8252 | - $numberOfWords = (int) (($len - 1) / 2); |
|
8252 | + $numberOfWords = (int)(($len - 1) / 2); |
|
8253 | 8253 | } |
8254 | 8254 | |
8255 | 8255 | return $numberOfWords; |
@@ -8313,7 +8313,7 @@ discard block |
||
8313 | 8313 | */ |
8314 | 8314 | public static function strcmp(string $str1, string $str2): int |
8315 | 8315 | { |
8316 | - return $str1 . '' === $str2 . '' ? 0 : \strcmp( |
|
8316 | + return $str1.'' === $str2.'' ? 0 : \strcmp( |
|
8317 | 8317 | \Normalizer::normalize($str1, \Normalizer::NFD), |
8318 | 8318 | \Normalizer::normalize($str2, \Normalizer::NFD) |
8319 | 8319 | ); |
@@ -8342,21 +8342,21 @@ discard block |
||
8342 | 8342 | } |
8343 | 8343 | |
8344 | 8344 | if ($charList === '') { |
8345 | - return (int) self::strlen($str, $encoding); |
|
8345 | + return (int)self::strlen($str, $encoding); |
|
8346 | 8346 | } |
8347 | 8347 | |
8348 | 8348 | if ($offset !== null || $length !== null) { |
8349 | 8349 | if ($encoding === 'UTF-8') { |
8350 | 8350 | if ($length === null) { |
8351 | 8351 | /** @noinspection UnnecessaryCastingInspection */ |
8352 | - $strTmp = \mb_substr($str, (int) $offset); |
|
8352 | + $strTmp = \mb_substr($str, (int)$offset); |
|
8353 | 8353 | } else { |
8354 | 8354 | /** @noinspection UnnecessaryCastingInspection */ |
8355 | - $strTmp = \mb_substr($str, (int) $offset, $length); |
|
8355 | + $strTmp = \mb_substr($str, (int)$offset, $length); |
|
8356 | 8356 | } |
8357 | 8357 | } else { |
8358 | 8358 | /** @noinspection UnnecessaryCastingInspection */ |
8359 | - $strTmp = self::substr($str, (int) $offset, $length, $encoding); |
|
8359 | + $strTmp = self::substr($str, (int)$offset, $length, $encoding); |
|
8360 | 8360 | } |
8361 | 8361 | |
8362 | 8362 | if ($strTmp === false) { |
@@ -8371,7 +8371,7 @@ discard block |
||
8371 | 8371 | } |
8372 | 8372 | |
8373 | 8373 | $matches = []; |
8374 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $matches)) { |
|
8374 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $matches)) { |
|
8375 | 8375 | $return = self::strlen($matches[1], $encoding); |
8376 | 8376 | if ($return === false) { |
8377 | 8377 | return 0; |
@@ -8380,7 +8380,7 @@ discard block |
||
8380 | 8380 | return $return; |
8381 | 8381 | } |
8382 | 8382 | |
8383 | - return (int) self::strlen($str, $encoding); |
|
8383 | + return (int)self::strlen($str, $encoding); |
|
8384 | 8384 | } |
8385 | 8385 | |
8386 | 8386 | /** |
@@ -8502,7 +8502,7 @@ discard block |
||
8502 | 8502 | return ''; |
8503 | 8503 | } |
8504 | 8504 | |
8505 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
8505 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
8506 | 8506 | } |
8507 | 8507 | |
8508 | 8508 | /** |
@@ -8567,7 +8567,7 @@ discard block |
||
8567 | 8567 | // fallback for ascii only |
8568 | 8568 | // |
8569 | 8569 | |
8570 | - if (self::is_ascii($haystack . $needle)) { |
|
8570 | + if (self::is_ascii($haystack.$needle)) { |
|
8571 | 8571 | return \stripos($haystack, $needle, $offset); |
8572 | 8572 | } |
8573 | 8573 | |
@@ -8634,7 +8634,7 @@ discard block |
||
8634 | 8634 | && |
8635 | 8635 | self::$SUPPORT['mbstring'] === false |
8636 | 8636 | ) { |
8637 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8637 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8638 | 8638 | } |
8639 | 8639 | |
8640 | 8640 | if ( |
@@ -8648,11 +8648,11 @@ discard block |
||
8648 | 8648 | } |
8649 | 8649 | } |
8650 | 8650 | |
8651 | - if (self::is_ascii($needle . $haystack)) { |
|
8651 | + if (self::is_ascii($needle.$haystack)) { |
|
8652 | 8652 | return \stristr($haystack, $needle, $before_needle); |
8653 | 8653 | } |
8654 | 8654 | |
8655 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
8655 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
8656 | 8656 | |
8657 | 8657 | if (!isset($match[1])) { |
8658 | 8658 | return false; |
@@ -8662,7 +8662,7 @@ discard block |
||
8662 | 8662 | return $match[1]; |
8663 | 8663 | } |
8664 | 8664 | |
8665 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
8665 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
8666 | 8666 | } |
8667 | 8667 | |
8668 | 8668 | /** |
@@ -8729,7 +8729,7 @@ discard block |
||
8729 | 8729 | && |
8730 | 8730 | self::$SUPPORT['iconv'] === false |
8731 | 8731 | ) { |
8732 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8732 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8733 | 8733 | } |
8734 | 8734 | |
8735 | 8735 | // |
@@ -8840,7 +8840,7 @@ discard block |
||
8840 | 8840 | */ |
8841 | 8841 | public static function strnatcmp(string $str1, string $str2): int |
8842 | 8842 | { |
8843 | - return $str1 . '' === $str2 . '' ? 0 : \strnatcmp((string) self::strtonatfold($str1), (string) self::strtonatfold($str2)); |
|
8843 | + return $str1.'' === $str2.'' ? 0 : \strnatcmp((string)self::strtonatfold($str1), (string)self::strtonatfold($str2)); |
|
8844 | 8844 | } |
8845 | 8845 | |
8846 | 8846 | /** |
@@ -8897,11 +8897,11 @@ discard block |
||
8897 | 8897 | } |
8898 | 8898 | |
8899 | 8899 | if ($encoding === 'UTF-8') { |
8900 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
8901 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
8900 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
8901 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
8902 | 8902 | } else { |
8903 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
8904 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
8903 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
8904 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
8905 | 8905 | } |
8906 | 8906 | |
8907 | 8907 | return self::strcmp($str1, $str2); |
@@ -8923,8 +8923,8 @@ discard block |
||
8923 | 8923 | return false; |
8924 | 8924 | } |
8925 | 8925 | |
8926 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
8927 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
8926 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
8927 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
8928 | 8928 | } |
8929 | 8929 | |
8930 | 8930 | return false; |
@@ -8957,10 +8957,10 @@ discard block |
||
8957 | 8957 | } |
8958 | 8958 | |
8959 | 8959 | // iconv and mbstring do not support integer $needle |
8960 | - if ((int) $needle === $needle) { |
|
8961 | - $needle = (string) self::chr($needle); |
|
8960 | + if ((int)$needle === $needle) { |
|
8961 | + $needle = (string)self::chr($needle); |
|
8962 | 8962 | } |
8963 | - $needle = (string) $needle; |
|
8963 | + $needle = (string)$needle; |
|
8964 | 8964 | |
8965 | 8965 | if ($needle === '') { |
8966 | 8966 | return false; |
@@ -9007,7 +9007,7 @@ discard block |
||
9007 | 9007 | && |
9008 | 9008 | self::$SUPPORT['mbstring'] === false |
9009 | 9009 | ) { |
9010 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9010 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9011 | 9011 | } |
9012 | 9012 | |
9013 | 9013 | // |
@@ -9048,7 +9048,7 @@ discard block |
||
9048 | 9048 | // fallback for ascii only |
9049 | 9049 | // |
9050 | 9050 | |
9051 | - if (self::is_ascii($haystack . $needle)) { |
|
9051 | + if (self::is_ascii($haystack.$needle)) { |
|
9052 | 9052 | return \strpos($haystack, $needle, $offset); |
9053 | 9053 | } |
9054 | 9054 | |
@@ -9060,7 +9060,7 @@ discard block |
||
9060 | 9060 | if ($haystackTmp === false) { |
9061 | 9061 | $haystackTmp = ''; |
9062 | 9062 | } |
9063 | - $haystack = (string) $haystackTmp; |
|
9063 | + $haystack = (string)$haystackTmp; |
|
9064 | 9064 | |
9065 | 9065 | if ($offset < 0) { |
9066 | 9066 | $offset = 0; |
@@ -9072,7 +9072,7 @@ discard block |
||
9072 | 9072 | } |
9073 | 9073 | |
9074 | 9074 | if ($pos) { |
9075 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9075 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9076 | 9076 | } |
9077 | 9077 | |
9078 | 9078 | return $offset + 0; |
@@ -9183,7 +9183,7 @@ discard block |
||
9183 | 9183 | && |
9184 | 9184 | self::$SUPPORT['mbstring'] === false |
9185 | 9185 | ) { |
9186 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9186 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9187 | 9187 | } |
9188 | 9188 | |
9189 | 9189 | // |
@@ -9195,7 +9195,7 @@ discard block |
||
9195 | 9195 | if ($needleTmp === false) { |
9196 | 9196 | return false; |
9197 | 9197 | } |
9198 | - $needle = (string) $needleTmp; |
|
9198 | + $needle = (string)$needleTmp; |
|
9199 | 9199 | |
9200 | 9200 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
9201 | 9201 | if ($pos === false) { |
@@ -9217,7 +9217,7 @@ discard block |
||
9217 | 9217 | if ($needleTmp === false) { |
9218 | 9218 | return false; |
9219 | 9219 | } |
9220 | - $needle = (string) $needleTmp; |
|
9220 | + $needle = (string)$needleTmp; |
|
9221 | 9221 | |
9222 | 9222 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
9223 | 9223 | if ($pos === false) { |
@@ -9253,7 +9253,7 @@ discard block |
||
9253 | 9253 | if ($encoding === 'UTF-8') { |
9254 | 9254 | if (self::$SUPPORT['intl'] === true) { |
9255 | 9255 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
9256 | - $i = (int) \grapheme_strlen($str); |
|
9256 | + $i = (int)\grapheme_strlen($str); |
|
9257 | 9257 | while ($i--) { |
9258 | 9258 | $reversedTmp = \grapheme_substr($str, $i, 1); |
9259 | 9259 | if ($reversedTmp !== false) { |
@@ -9261,7 +9261,7 @@ discard block |
||
9261 | 9261 | } |
9262 | 9262 | } |
9263 | 9263 | } else { |
9264 | - $i = (int) \mb_strlen($str); |
|
9264 | + $i = (int)\mb_strlen($str); |
|
9265 | 9265 | while ($i--) { |
9266 | 9266 | $reversedTmp = \mb_substr($str, $i, 1); |
9267 | 9267 | if ($reversedTmp !== false) { |
@@ -9272,7 +9272,7 @@ discard block |
||
9272 | 9272 | } else { |
9273 | 9273 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9274 | 9274 | |
9275 | - $i = (int) self::strlen($str, $encoding); |
|
9275 | + $i = (int)self::strlen($str, $encoding); |
|
9276 | 9276 | while ($i--) { |
9277 | 9277 | $reversedTmp = self::substr($str, $i, 1, $encoding); |
9278 | 9278 | if ($reversedTmp !== false) { |
@@ -9346,7 +9346,7 @@ discard block |
||
9346 | 9346 | if ($needleTmp === false) { |
9347 | 9347 | return false; |
9348 | 9348 | } |
9349 | - $needle = (string) $needleTmp; |
|
9349 | + $needle = (string)$needleTmp; |
|
9350 | 9350 | |
9351 | 9351 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
9352 | 9352 | if ($pos === false) { |
@@ -9385,10 +9385,10 @@ discard block |
||
9385 | 9385 | } |
9386 | 9386 | |
9387 | 9387 | // iconv and mbstring do not support integer $needle |
9388 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9389 | - $needle = (string) self::chr($needle); |
|
9388 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9389 | + $needle = (string)self::chr($needle); |
|
9390 | 9390 | } |
9391 | - $needle = (string) $needle; |
|
9391 | + $needle = (string)$needle; |
|
9392 | 9392 | |
9393 | 9393 | if ($needle === '') { |
9394 | 9394 | return false; |
@@ -9433,7 +9433,7 @@ discard block |
||
9433 | 9433 | && |
9434 | 9434 | self::$SUPPORT['mbstring'] === false |
9435 | 9435 | ) { |
9436 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9436 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9437 | 9437 | } |
9438 | 9438 | |
9439 | 9439 | // |
@@ -9457,7 +9457,7 @@ discard block |
||
9457 | 9457 | // fallback for ascii only |
9458 | 9458 | // |
9459 | 9459 | |
9460 | - if (self::is_ascii($haystack . $needle)) { |
|
9460 | + if (self::is_ascii($haystack.$needle)) { |
|
9461 | 9461 | return \strripos($haystack, $needle, $offset); |
9462 | 9462 | } |
9463 | 9463 | |
@@ -9533,10 +9533,10 @@ discard block |
||
9533 | 9533 | } |
9534 | 9534 | |
9535 | 9535 | // iconv and mbstring do not support integer $needle |
9536 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9537 | - $needle = (string) self::chr($needle); |
|
9536 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9537 | + $needle = (string)self::chr($needle); |
|
9538 | 9538 | } |
9539 | - $needle = (string) $needle; |
|
9539 | + $needle = (string)$needle; |
|
9540 | 9540 | |
9541 | 9541 | if ($needle === '') { |
9542 | 9542 | return false; |
@@ -9581,7 +9581,7 @@ discard block |
||
9581 | 9581 | && |
9582 | 9582 | self::$SUPPORT['mbstring'] === false |
9583 | 9583 | ) { |
9584 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9584 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9585 | 9585 | } |
9586 | 9586 | |
9587 | 9587 | // |
@@ -9605,7 +9605,7 @@ discard block |
||
9605 | 9605 | // fallback for ascii only |
9606 | 9606 | // |
9607 | 9607 | |
9608 | - if (self::is_ascii($haystack . $needle)) { |
|
9608 | + if (self::is_ascii($haystack.$needle)) { |
|
9609 | 9609 | return \strrpos($haystack, $needle, $offset); |
9610 | 9610 | } |
9611 | 9611 | |
@@ -9625,7 +9625,7 @@ discard block |
||
9625 | 9625 | if ($haystackTmp === false) { |
9626 | 9626 | $haystackTmp = ''; |
9627 | 9627 | } |
9628 | - $haystack = (string) $haystackTmp; |
|
9628 | + $haystack = (string)$haystackTmp; |
|
9629 | 9629 | } |
9630 | 9630 | |
9631 | 9631 | $pos = \strrpos($haystack, $needle); |
@@ -9638,7 +9638,7 @@ discard block |
||
9638 | 9638 | return false; |
9639 | 9639 | } |
9640 | 9640 | |
9641 | - return $offset + (int) self::strlen($strTmp); |
|
9641 | + return $offset + (int)self::strlen($strTmp); |
|
9642 | 9642 | } |
9643 | 9643 | |
9644 | 9644 | /** |
@@ -9698,12 +9698,12 @@ discard block |
||
9698 | 9698 | if ($offset || $length !== null) { |
9699 | 9699 | if ($encoding === 'UTF-8') { |
9700 | 9700 | if ($length === null) { |
9701 | - $str = (string) \mb_substr($str, $offset); |
|
9701 | + $str = (string)\mb_substr($str, $offset); |
|
9702 | 9702 | } else { |
9703 | - $str = (string) \mb_substr($str, $offset, $length); |
|
9703 | + $str = (string)\mb_substr($str, $offset, $length); |
|
9704 | 9704 | } |
9705 | 9705 | } else { |
9706 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
9706 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
9707 | 9707 | } |
9708 | 9708 | } |
9709 | 9709 | |
@@ -9713,7 +9713,7 @@ discard block |
||
9713 | 9713 | |
9714 | 9714 | $matches = []; |
9715 | 9715 | |
9716 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
9716 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
9717 | 9717 | } |
9718 | 9718 | |
9719 | 9719 | /** |
@@ -9782,7 +9782,7 @@ discard block |
||
9782 | 9782 | && |
9783 | 9783 | self::$SUPPORT['mbstring'] === false |
9784 | 9784 | ) { |
9785 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9785 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9786 | 9786 | } |
9787 | 9787 | |
9788 | 9788 | // |
@@ -9804,7 +9804,7 @@ discard block |
||
9804 | 9804 | // fallback for ascii only |
9805 | 9805 | // |
9806 | 9806 | |
9807 | - if (self::is_ascii($haystack . $needle)) { |
|
9807 | + if (self::is_ascii($haystack.$needle)) { |
|
9808 | 9808 | return \strstr($haystack, $needle, $before_needle); |
9809 | 9809 | } |
9810 | 9810 | |
@@ -9812,7 +9812,7 @@ discard block |
||
9812 | 9812 | // fallback via vanilla php |
9813 | 9813 | // |
9814 | 9814 | |
9815 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
9815 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
9816 | 9816 | |
9817 | 9817 | if (!isset($match[1])) { |
9818 | 9818 | return false; |
@@ -9822,7 +9822,7 @@ discard block |
||
9822 | 9822 | return $match[1]; |
9823 | 9823 | } |
9824 | 9824 | |
9825 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
9825 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
9826 | 9826 | } |
9827 | 9827 | |
9828 | 9828 | /** |
@@ -9936,7 +9936,7 @@ discard block |
||
9936 | 9936 | bool $tryToKeepStringLength = false |
9937 | 9937 | ): string { |
9938 | 9938 | // init |
9939 | - $str = (string) $str; |
|
9939 | + $str = (string)$str; |
|
9940 | 9940 | |
9941 | 9941 | if ($str === '') { |
9942 | 9942 | return ''; |
@@ -9961,19 +9961,19 @@ discard block |
||
9961 | 9961 | |
9962 | 9962 | if ($lang !== null) { |
9963 | 9963 | if (self::$SUPPORT['intl'] === true) { |
9964 | - $langCode = $lang . '-Lower'; |
|
9964 | + $langCode = $lang.'-Lower'; |
|
9965 | 9965 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
9966 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, \E_USER_WARNING); |
|
9966 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, \E_USER_WARNING); |
|
9967 | 9967 | |
9968 | 9968 | $langCode = 'Any-Lower'; |
9969 | 9969 | } |
9970 | 9970 | |
9971 | 9971 | /** @noinspection PhpComposerExtensionStubsInspection */ |
9972 | 9972 | /** @noinspection UnnecessaryCastingInspection */ |
9973 | - return (string) \transliterator_transliterate($langCode, $str); |
|
9973 | + return (string)\transliterator_transliterate($langCode, $str); |
|
9974 | 9974 | } |
9975 | 9975 | |
9976 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
9976 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
9977 | 9977 | } |
9978 | 9978 | |
9979 | 9979 | // always fallback via symfony polyfill |
@@ -10002,7 +10002,7 @@ discard block |
||
10002 | 10002 | bool $tryToKeepStringLength = false |
10003 | 10003 | ): string { |
10004 | 10004 | // init |
10005 | - $str = (string) $str; |
|
10005 | + $str = (string)$str; |
|
10006 | 10006 | |
10007 | 10007 | if ($str === '') { |
10008 | 10008 | return ''; |
@@ -10027,19 +10027,19 @@ discard block |
||
10027 | 10027 | |
10028 | 10028 | if ($lang !== null) { |
10029 | 10029 | if (self::$SUPPORT['intl'] === true) { |
10030 | - $langCode = $lang . '-Upper'; |
|
10030 | + $langCode = $lang.'-Upper'; |
|
10031 | 10031 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
10032 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
10032 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
10033 | 10033 | |
10034 | 10034 | $langCode = 'Any-Upper'; |
10035 | 10035 | } |
10036 | 10036 | |
10037 | 10037 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10038 | 10038 | /** @noinspection UnnecessaryCastingInspection */ |
10039 | - return (string) \transliterator_transliterate($langCode, $str); |
|
10039 | + return (string)\transliterator_transliterate($langCode, $str); |
|
10040 | 10040 | } |
10041 | 10041 | |
10042 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
10042 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
10043 | 10043 | } |
10044 | 10044 | |
10045 | 10045 | // always fallback via symfony polyfill |
@@ -10083,7 +10083,7 @@ discard block |
||
10083 | 10083 | |
10084 | 10084 | $from = \array_combine($from, $to); |
10085 | 10085 | if ($from === false) { |
10086 | - 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) . ')'); |
|
10086 | + 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).')'); |
|
10087 | 10087 | } |
10088 | 10088 | } |
10089 | 10089 | |
@@ -10140,9 +10140,9 @@ discard block |
||
10140 | 10140 | } |
10141 | 10141 | |
10142 | 10142 | $wide = 0; |
10143 | - $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); |
|
10143 | + $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); |
|
10144 | 10144 | |
10145 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
10145 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
10146 | 10146 | } |
10147 | 10147 | |
10148 | 10148 | /** |
@@ -10242,9 +10242,9 @@ discard block |
||
10242 | 10242 | } |
10243 | 10243 | |
10244 | 10244 | if ($length === null) { |
10245 | - $length = (int) $str_length; |
|
10245 | + $length = (int)$str_length; |
|
10246 | 10246 | } else { |
10247 | - $length = (int) $length; |
|
10247 | + $length = (int)$length; |
|
10248 | 10248 | } |
10249 | 10249 | |
10250 | 10250 | if ( |
@@ -10252,7 +10252,7 @@ discard block |
||
10252 | 10252 | && |
10253 | 10253 | self::$SUPPORT['mbstring'] === false |
10254 | 10254 | ) { |
10255 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10255 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10256 | 10256 | } |
10257 | 10257 | |
10258 | 10258 | // |
@@ -10340,16 +10340,16 @@ discard block |
||
10340 | 10340 | ) { |
10341 | 10341 | if ($encoding === 'UTF-8') { |
10342 | 10342 | if ($length === null) { |
10343 | - $str1 = (string) \mb_substr($str1, $offset); |
|
10343 | + $str1 = (string)\mb_substr($str1, $offset); |
|
10344 | 10344 | } else { |
10345 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
10345 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
10346 | 10346 | } |
10347 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
10347 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
10348 | 10348 | } else { |
10349 | 10349 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10350 | 10350 | |
10351 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
10352 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
10351 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
10352 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
10353 | 10353 | } |
10354 | 10354 | } |
10355 | 10355 | |
@@ -10411,13 +10411,13 @@ discard block |
||
10411 | 10411 | if ($lengthTmp === false) { |
10412 | 10412 | return false; |
10413 | 10413 | } |
10414 | - $length = (int) $lengthTmp; |
|
10414 | + $length = (int)$lengthTmp; |
|
10415 | 10415 | } |
10416 | 10416 | |
10417 | 10417 | if ($encoding === 'UTF-8') { |
10418 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
10418 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
10419 | 10419 | } else { |
10420 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
10420 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
10421 | 10421 | } |
10422 | 10422 | } |
10423 | 10423 | |
@@ -10426,7 +10426,7 @@ discard block |
||
10426 | 10426 | && |
10427 | 10427 | self::$SUPPORT['mbstring'] === false |
10428 | 10428 | ) { |
10429 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10429 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10430 | 10430 | } |
10431 | 10431 | |
10432 | 10432 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10437,7 +10437,7 @@ discard block |
||
10437 | 10437 | return \mb_substr_count($haystack, $needle, $encoding); |
10438 | 10438 | } |
10439 | 10439 | |
10440 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10440 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10441 | 10441 | |
10442 | 10442 | return \count($matches); |
10443 | 10443 | } |
@@ -10484,7 +10484,7 @@ discard block |
||
10484 | 10484 | if ($lengthTmp === false) { |
10485 | 10485 | return false; |
10486 | 10486 | } |
10487 | - $length = (int) $lengthTmp; |
|
10487 | + $length = (int)$lengthTmp; |
|
10488 | 10488 | } |
10489 | 10489 | |
10490 | 10490 | if ( |
@@ -10505,7 +10505,7 @@ discard block |
||
10505 | 10505 | if ($haystackTmp === false) { |
10506 | 10506 | $haystackTmp = ''; |
10507 | 10507 | } |
10508 | - $haystack = (string) $haystackTmp; |
|
10508 | + $haystack = (string)$haystackTmp; |
|
10509 | 10509 | } |
10510 | 10510 | |
10511 | 10511 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10544,10 +10544,10 @@ discard block |
||
10544 | 10544 | |
10545 | 10545 | if ($encoding === 'UTF-8') { |
10546 | 10546 | if ($caseSensitive) { |
10547 | - return (int) \mb_substr_count($str, $substring); |
|
10547 | + return (int)\mb_substr_count($str, $substring); |
|
10548 | 10548 | } |
10549 | 10549 | |
10550 | - return (int) \mb_substr_count( |
|
10550 | + return (int)\mb_substr_count( |
|
10551 | 10551 | \mb_strtoupper($str), |
10552 | 10552 | \mb_strtoupper($substring) |
10553 | 10553 | |
@@ -10557,10 +10557,10 @@ discard block |
||
10557 | 10557 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10558 | 10558 | |
10559 | 10559 | if ($caseSensitive) { |
10560 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
10560 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
10561 | 10561 | } |
10562 | 10562 | |
10563 | - return (int) \mb_substr_count( |
|
10563 | + return (int)\mb_substr_count( |
|
10564 | 10564 | self::strtocasefold($str, true, false, $encoding, null, false), |
10565 | 10565 | self::strtocasefold($substring, true, false, $encoding, null, false), |
10566 | 10566 | $encoding |
@@ -10586,7 +10586,7 @@ discard block |
||
10586 | 10586 | } |
10587 | 10587 | |
10588 | 10588 | if (self::str_istarts_with($haystack, $needle) === true) { |
10589 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10589 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10590 | 10590 | } |
10591 | 10591 | |
10592 | 10592 | return $haystack; |
@@ -10643,7 +10643,7 @@ discard block |
||
10643 | 10643 | } |
10644 | 10644 | |
10645 | 10645 | if (self::str_iends_with($haystack, $needle) === true) { |
10646 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
10646 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
10647 | 10647 | } |
10648 | 10648 | |
10649 | 10649 | return $haystack; |
@@ -10668,7 +10668,7 @@ discard block |
||
10668 | 10668 | } |
10669 | 10669 | |
10670 | 10670 | if (self::str_starts_with($haystack, $needle) === true) { |
10671 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10671 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10672 | 10672 | } |
10673 | 10673 | |
10674 | 10674 | return $haystack; |
@@ -10720,7 +10720,7 @@ discard block |
||
10720 | 10720 | if (\is_array($offset) === true) { |
10721 | 10721 | $offset = \array_slice($offset, 0, $num); |
10722 | 10722 | foreach ($offset as &$valueTmp) { |
10723 | - $valueTmp = (int) $valueTmp === $valueTmp ? $valueTmp : 0; |
|
10723 | + $valueTmp = (int)$valueTmp === $valueTmp ? $valueTmp : 0; |
|
10724 | 10724 | } |
10725 | 10725 | unset($valueTmp); |
10726 | 10726 | } else { |
@@ -10733,7 +10733,7 @@ discard block |
||
10733 | 10733 | } elseif (\is_array($length) === true) { |
10734 | 10734 | $length = \array_slice($length, 0, $num); |
10735 | 10735 | foreach ($length as &$valueTmpV2) { |
10736 | - $valueTmpV2 = (int) $valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10736 | + $valueTmpV2 = (int)$valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10737 | 10737 | } |
10738 | 10738 | unset($valueTmpV2); |
10739 | 10739 | } else { |
@@ -10753,8 +10753,8 @@ discard block |
||
10753 | 10753 | } |
10754 | 10754 | |
10755 | 10755 | // init |
10756 | - $str = (string) $str; |
|
10757 | - $replacement = (string) $replacement; |
|
10756 | + $str = (string)$str; |
|
10757 | + $replacement = (string)$replacement; |
|
10758 | 10758 | |
10759 | 10759 | if (\is_array($length) === true) { |
10760 | 10760 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -10769,16 +10769,16 @@ discard block |
||
10769 | 10769 | } |
10770 | 10770 | |
10771 | 10771 | if (self::$SUPPORT['mbstring'] === true) { |
10772 | - $string_length = (int) self::strlen($str, $encoding); |
|
10772 | + $string_length = (int)self::strlen($str, $encoding); |
|
10773 | 10773 | |
10774 | 10774 | if ($offset < 0) { |
10775 | - $offset = (int) \max(0, $string_length + $offset); |
|
10775 | + $offset = (int)\max(0, $string_length + $offset); |
|
10776 | 10776 | } elseif ($offset > $string_length) { |
10777 | 10777 | $offset = $string_length; |
10778 | 10778 | } |
10779 | 10779 | |
10780 | 10780 | if ($length !== null && $length < 0) { |
10781 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
10781 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
10782 | 10782 | } elseif ($length === null || $length > $string_length) { |
10783 | 10783 | $length = $string_length; |
10784 | 10784 | } |
@@ -10789,9 +10789,9 @@ discard block |
||
10789 | 10789 | } |
10790 | 10790 | |
10791 | 10791 | /** @noinspection AdditionOperationOnArraysInspection */ |
10792 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
10793 | - $replacement . |
|
10794 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10792 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
10793 | + $replacement. |
|
10794 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10795 | 10795 | } |
10796 | 10796 | |
10797 | 10797 | // |
@@ -10800,8 +10800,7 @@ discard block |
||
10800 | 10800 | |
10801 | 10801 | if (self::is_ascii($str)) { |
10802 | 10802 | return ($length === null) ? |
10803 | - \substr_replace($str, $replacement, $offset) : |
|
10804 | - \substr_replace($str, $replacement, $offset, $length); |
|
10803 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
10805 | 10804 | } |
10806 | 10805 | |
10807 | 10806 | // |
@@ -10817,7 +10816,7 @@ discard block |
||
10817 | 10816 | // e.g.: non mbstring support + invalid chars |
10818 | 10817 | return ''; |
10819 | 10818 | } |
10820 | - $length = (int) $lengthTmp; |
|
10819 | + $length = (int)$lengthTmp; |
|
10821 | 10820 | } |
10822 | 10821 | |
10823 | 10822 | \array_splice($smatches[0], $offset, $length, $rmatches[0]); |
@@ -10852,14 +10851,14 @@ discard block |
||
10852 | 10851 | && |
10853 | 10852 | \substr($haystack, -\strlen($needle)) === $needle |
10854 | 10853 | ) { |
10855 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
10854 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
10856 | 10855 | } |
10857 | 10856 | |
10858 | 10857 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
10859 | - return (string) self::substr( |
|
10858 | + return (string)self::substr( |
|
10860 | 10859 | $haystack, |
10861 | 10860 | 0, |
10862 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
10861 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
10863 | 10862 | $encoding |
10864 | 10863 | ); |
10865 | 10864 | } |
@@ -10889,10 +10888,10 @@ discard block |
||
10889 | 10888 | } |
10890 | 10889 | |
10891 | 10890 | if ($encoding === 'UTF-8') { |
10892 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10891 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10893 | 10892 | } |
10894 | 10893 | |
10895 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10894 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10896 | 10895 | } |
10897 | 10896 | |
10898 | 10897 | /** |
@@ -11088,7 +11087,7 @@ discard block |
||
11088 | 11087 | // INFO: https://unicode.org/cldr/utility/character.jsp?a=%E2%84%8C |
11089 | 11088 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11090 | 11089 | /** @noinspection UnnecessaryCastingInspection */ |
11091 | - $str = (string) \transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11090 | + $str = (string)\transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11092 | 11091 | |
11093 | 11092 | // check again, if we only have ASCII, now ... |
11094 | 11093 | if (self::is_ascii($str) === true) { |
@@ -11211,7 +11210,7 @@ discard block |
||
11211 | 11210 | public static function to_boolean($str): bool |
11212 | 11211 | { |
11213 | 11212 | // init |
11214 | - $str = (string) $str; |
|
11213 | + $str = (string)$str; |
|
11215 | 11214 | |
11216 | 11215 | if ($str === '') { |
11217 | 11216 | return false; |
@@ -11239,10 +11238,10 @@ discard block |
||
11239 | 11238 | } |
11240 | 11239 | |
11241 | 11240 | if (\is_numeric($str)) { |
11242 | - return ((float) $str + 0) > 0; |
|
11241 | + return ((float)$str + 0) > 0; |
|
11243 | 11242 | } |
11244 | 11243 | |
11245 | - return (bool) \trim($str); |
|
11244 | + return (bool)\trim($str); |
|
11246 | 11245 | } |
11247 | 11246 | |
11248 | 11247 | /** |
@@ -11263,11 +11262,11 @@ discard block |
||
11263 | 11262 | |
11264 | 11263 | $fallback_char_escaped = \preg_quote($fallback_char, '/'); |
11265 | 11264 | |
11266 | - $string = (string) \preg_replace( |
|
11265 | + $string = (string)\preg_replace( |
|
11267 | 11266 | [ |
11268 | - '/[^' . $fallback_char_escaped . '\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
11269 | - '/[\s]+/u', // 2) convert spaces to $fallback_char |
|
11270 | - '/[' . $fallback_char_escaped . ']+/u', // 3) remove double $fallback_char's |
|
11267 | + '/[^'.$fallback_char_escaped.'\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
11268 | + '/[\s]+/u', // 2) convert spaces to $fallback_char |
|
11269 | + '/['.$fallback_char_escaped.']+/u', // 3) remove double $fallback_char's |
|
11271 | 11270 | ], |
11272 | 11271 | [ |
11273 | 11272 | '', |
@@ -11298,7 +11297,7 @@ discard block |
||
11298 | 11297 | return $str; |
11299 | 11298 | } |
11300 | 11299 | |
11301 | - $str = (string) $str; |
|
11300 | + $str = (string)$str; |
|
11302 | 11301 | if ($str === '') { |
11303 | 11302 | return ''; |
11304 | 11303 | } |
@@ -11345,7 +11344,7 @@ discard block |
||
11345 | 11344 | return $str; |
11346 | 11345 | } |
11347 | 11346 | |
11348 | - $str = (string) $str; |
|
11347 | + $str = (string)$str; |
|
11349 | 11348 | if ($str === '') { |
11350 | 11349 | return $str; |
11351 | 11350 | } |
@@ -11363,7 +11362,7 @@ discard block |
||
11363 | 11362 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
11364 | 11363 | |
11365 | 11364 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11366 | - $buf .= $c1 . $c2; |
|
11365 | + $buf .= $c1.$c2; |
|
11367 | 11366 | ++$i; |
11368 | 11367 | } else { // not valid UTF8 - convert it |
11369 | 11368 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11374,7 +11373,7 @@ discard block |
||
11374 | 11373 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
11375 | 11374 | |
11376 | 11375 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11377 | - $buf .= $c1 . $c2 . $c3; |
|
11376 | + $buf .= $c1.$c2.$c3; |
|
11378 | 11377 | $i += 2; |
11379 | 11378 | } else { // not valid UTF8 - convert it |
11380 | 11379 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11386,7 +11385,7 @@ discard block |
||
11386 | 11385 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
11387 | 11386 | |
11388 | 11387 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11389 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
11388 | + $buf .= $c1.$c2.$c3.$c4; |
|
11390 | 11389 | $i += 3; |
11391 | 11390 | } else { // not valid UTF8 - convert it |
11392 | 11391 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11412,13 +11411,13 @@ discard block |
||
11412 | 11411 | * |
11413 | 11412 | * @return string |
11414 | 11413 | */ |
11415 | - static function (array $matches): string { |
|
11414 | + static function(array $matches): string { |
|
11416 | 11415 | if (isset($matches[3])) { |
11417 | - $cp = (int) \hexdec($matches[3]); |
|
11416 | + $cp = (int)\hexdec($matches[3]); |
|
11418 | 11417 | } else { |
11419 | 11418 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
11420 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
11421 | - + (int) \hexdec($matches[2]) |
|
11419 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
11420 | + + (int)\hexdec($matches[2]) |
|
11422 | 11421 | + 0x10000 |
11423 | 11422 | - (0xD800 << 10) |
11424 | 11423 | - 0xDC00; |
@@ -11429,12 +11428,12 @@ discard block |
||
11429 | 11428 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
11430 | 11429 | |
11431 | 11430 | if ($cp < 0x80) { |
11432 | - return (string) self::chr($cp); |
|
11431 | + return (string)self::chr($cp); |
|
11433 | 11432 | } |
11434 | 11433 | |
11435 | 11434 | if ($cp < 0xA0) { |
11436 | 11435 | /** @noinspection UnnecessaryCastingInspection */ |
11437 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
11436 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
11438 | 11437 | } |
11439 | 11438 | |
11440 | 11439 | return self::decimal_to_chr($cp); |
@@ -11482,7 +11481,7 @@ discard block |
||
11482 | 11481 | |
11483 | 11482 | if (self::$SUPPORT['mbstring'] === true) { |
11484 | 11483 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11485 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
11484 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
11486 | 11485 | } |
11487 | 11486 | |
11488 | 11487 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -11519,15 +11518,15 @@ discard block |
||
11519 | 11518 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
11520 | 11519 | |
11521 | 11520 | if ($encoding === 'UTF-8') { |
11522 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
11521 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
11523 | 11522 | |
11524 | 11523 | if ($useMbFunction === true) { |
11525 | 11524 | $strPartOne = \mb_strtoupper( |
11526 | - (string) \mb_substr($str, 0, 1) |
|
11525 | + (string)\mb_substr($str, 0, 1) |
|
11527 | 11526 | ); |
11528 | 11527 | } else { |
11529 | 11528 | $strPartOne = self::strtoupper( |
11530 | - (string) \mb_substr($str, 0, 1), |
|
11529 | + (string)\mb_substr($str, 0, 1), |
|
11531 | 11530 | $encoding, |
11532 | 11531 | false, |
11533 | 11532 | $lang, |
@@ -11537,16 +11536,16 @@ discard block |
||
11537 | 11536 | } else { |
11538 | 11537 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11539 | 11538 | |
11540 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
11539 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
11541 | 11540 | |
11542 | 11541 | if ($useMbFunction === true) { |
11543 | 11542 | $strPartOne = \mb_strtoupper( |
11544 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
11543 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
11545 | 11544 | $encoding |
11546 | 11545 | ); |
11547 | 11546 | } else { |
11548 | 11547 | $strPartOne = self::strtoupper( |
11549 | - (string) self::substr($str, 0, 1, $encoding), |
|
11548 | + (string)self::substr($str, 0, 1, $encoding), |
|
11550 | 11549 | $encoding, |
11551 | 11550 | false, |
11552 | 11551 | $lang, |
@@ -11555,7 +11554,7 @@ discard block |
||
11555 | 11554 | } |
11556 | 11555 | } |
11557 | 11556 | |
11558 | - return $strPartOne . $strPartTwo; |
|
11557 | + return $strPartOne.$strPartTwo; |
|
11559 | 11558 | } |
11560 | 11559 | |
11561 | 11560 | /** |
@@ -11606,7 +11605,7 @@ discard block |
||
11606 | 11605 | $str = self::clean($str); |
11607 | 11606 | } |
11608 | 11607 | |
11609 | - $usePhpDefaultFunctions = !(bool) ($charlist . \implode('', $exceptions)); |
|
11608 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
11610 | 11609 | |
11611 | 11610 | if ( |
11612 | 11611 | $usePhpDefaultFunctions === true |
@@ -11675,7 +11674,7 @@ discard block |
||
11675 | 11674 | |
11676 | 11675 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
11677 | 11676 | if (\preg_match($pattern, $str)) { |
11678 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
11677 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
11679 | 11678 | } |
11680 | 11679 | |
11681 | 11680 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -12000,7 +11999,7 @@ discard block |
||
12000 | 11999 | if ( |
12001 | 12000 | $keepUtf8Chars === true |
12002 | 12001 | && |
12003 | - self::strlen($return) >= (int) self::strlen($str_backup) |
|
12002 | + self::strlen($return) >= (int)self::strlen($str_backup) |
|
12004 | 12003 | ) { |
12005 | 12004 | return $str_backup; |
12006 | 12005 | } |
@@ -12078,17 +12077,17 @@ discard block |
||
12078 | 12077 | return ''; |
12079 | 12078 | } |
12080 | 12079 | |
12081 | - \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches); |
|
12080 | + \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches); |
|
12082 | 12081 | |
12083 | 12082 | if ( |
12084 | 12083 | !isset($matches[0]) |
12085 | 12084 | || |
12086 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
12085 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
12087 | 12086 | ) { |
12088 | 12087 | return $str; |
12089 | 12088 | } |
12090 | 12089 | |
12091 | - return \rtrim($matches[0]) . $strAddOn; |
|
12090 | + return \rtrim($matches[0]).$strAddOn; |
|
12092 | 12091 | } |
12093 | 12092 | |
12094 | 12093 | /** |
@@ -12159,7 +12158,7 @@ discard block |
||
12159 | 12158 | $strReturn .= $break; |
12160 | 12159 | } |
12161 | 12160 | |
12162 | - return $strReturn . \implode('', $chars); |
|
12161 | + return $strReturn.\implode('', $chars); |
|
12163 | 12162 | } |
12164 | 12163 | |
12165 | 12164 | /** |
@@ -12172,7 +12171,7 @@ discard block |
||
12172 | 12171 | */ |
12173 | 12172 | public static function wordwrap_per_line(string $str, int $limit): string |
12174 | 12173 | { |
12175 | - $strings = (array) \preg_split('/\\r\\n|\\r|\\n/', $str); |
|
12174 | + $strings = (array)\preg_split('/\\r\\n|\\r|\\n/', $str); |
|
12176 | 12175 | |
12177 | 12176 | $string = ''; |
12178 | 12177 | foreach ($strings as &$value) { |
@@ -12209,7 +12208,7 @@ discard block |
||
12209 | 12208 | |
12210 | 12209 | \uksort( |
12211 | 12210 | self::$EMOJI, |
12212 | - static function (string $a, string $b): int { |
|
12211 | + static function(string $a, string $b): int { |
|
12213 | 12212 | return \strlen($b) <=> \strlen($a); |
12214 | 12213 | } |
12215 | 12214 | ); |
@@ -12219,7 +12218,7 @@ discard block |
||
12219 | 12218 | |
12220 | 12219 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
12221 | 12220 | $tmpKey = \crc32($key); |
12222 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmpKey . '_-_' . \strrev((string) $tmpKey) . '_-_8FTU_ELBATROP_-_'; |
|
12221 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmpKey.'_-_'.\strrev((string)$tmpKey).'_-_8FTU_ELBATROP_-_'; |
|
12223 | 12222 | } |
12224 | 12223 | |
12225 | 12224 | return true; |
@@ -12282,7 +12281,7 @@ discard block |
||
12282 | 12281 | /** @noinspection PhpIncludeInspection */ |
12283 | 12282 | /** @noinspection UsingInclusionReturnValueInspection */ |
12284 | 12283 | /** @psalm-suppress UnresolvableInclude */ |
12285 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
12284 | + return include __DIR__.'/data/'.$file.'.php'; |
|
12286 | 12285 | } |
12287 | 12286 | |
12288 | 12287 | /** |
@@ -12294,7 +12293,7 @@ discard block |
||
12294 | 12293 | */ |
12295 | 12294 | private static function getDataIfExists(string $file) |
12296 | 12295 | { |
12297 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
12296 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
12298 | 12297 | if (\file_exists($file)) { |
12299 | 12298 | /** @noinspection PhpIncludeInspection */ |
12300 | 12299 | /** @noinspection UsingInclusionReturnValueInspection */ |
@@ -12319,7 +12318,7 @@ discard block |
||
12319 | 12318 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
12320 | 12319 | return \defined('MB_OVERLOAD_STRING') |
12321 | 12320 | && |
12322 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12321 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12323 | 12322 | } |
12324 | 12323 | |
12325 | 12324 | /** |
@@ -12369,7 +12368,7 @@ discard block |
||
12369 | 12368 | { |
12370 | 12369 | static $RX_CLASS_CACHE = []; |
12371 | 12370 | |
12372 | - $cacheKey = $s . $class; |
|
12371 | + $cacheKey = $s.$class; |
|
12373 | 12372 | |
12374 | 12373 | if (isset($RX_CLASS_CACHE[$cacheKey])) { |
12375 | 12374 | return $RX_CLASS_CACHE[$cacheKey]; |
@@ -12381,7 +12380,7 @@ discard block |
||
12381 | 12380 | /** @noinspection AlterInForeachInspection */ |
12382 | 12381 | foreach (self::str_split($s) as &$s) { |
12383 | 12382 | if ($s === '-') { |
12384 | - $classArray[0] = '-' . $classArray[0]; |
|
12383 | + $classArray[0] = '-'.$classArray[0]; |
|
12385 | 12384 | } elseif (!isset($s[2])) { |
12386 | 12385 | $classArray[0] .= \preg_quote($s, '/'); |
12387 | 12386 | } elseif (self::strlen($s) === 1) { |
@@ -12392,13 +12391,13 @@ discard block |
||
12392 | 12391 | } |
12393 | 12392 | |
12394 | 12393 | if ($classArray[0]) { |
12395 | - $classArray[0] = '[' . $classArray[0] . ']'; |
|
12394 | + $classArray[0] = '['.$classArray[0].']'; |
|
12396 | 12395 | } |
12397 | 12396 | |
12398 | 12397 | if (\count($classArray) === 1) { |
12399 | 12398 | $return = $classArray[0]; |
12400 | 12399 | } else { |
12401 | - $return = '(?:' . \implode('|', $classArray) . ')'; |
|
12400 | + $return = '(?:'.\implode('|', $classArray).')'; |
|
12402 | 12401 | } |
12403 | 12402 | |
12404 | 12403 | $RX_CLASS_CACHE[$cacheKey] = $return; |
@@ -12472,7 +12471,7 @@ discard block |
||
12472 | 12471 | $continue = false; |
12473 | 12472 | |
12474 | 12473 | if ($delimiter === '-') { |
12475 | - foreach ((array) $specialCases['names'] as &$beginning) { |
|
12474 | + foreach ((array)$specialCases['names'] as &$beginning) { |
|
12476 | 12475 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12477 | 12476 | $continue = true; |
12478 | 12477 | } |
@@ -12480,7 +12479,7 @@ discard block |
||
12480 | 12479 | unset($beginning); |
12481 | 12480 | } |
12482 | 12481 | |
12483 | - foreach ((array) $specialCases['prefixes'] as &$beginning) { |
|
12482 | + foreach ((array)$specialCases['prefixes'] as &$beginning) { |
|
12484 | 12483 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12485 | 12484 | $continue = true; |
12486 | 12485 | } |
@@ -12540,8 +12539,8 @@ discard block |
||
12540 | 12539 | $buf .= self::$WIN1252_TO_UTF8[$ordC1]; |
12541 | 12540 | } else { |
12542 | 12541 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
12543 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
12544 | - $buf .= $cc1 . $cc2; |
|
12542 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
12543 | + $buf .= $cc1.$cc2; |
|
12545 | 12544 | } |
12546 | 12545 | |
12547 | 12546 | return $buf; |