@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | } |
261 | 261 | |
262 | 262 | if ($encoding === 'UTF-8') { |
263 | - return (string) \mb_substr($str, $pos, 1); |
|
263 | + return (string)\mb_substr($str, $pos, 1); |
|
264 | 264 | } |
265 | 265 | |
266 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
266 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | public static function add_bom_to_string(string $str): string |
279 | 279 | { |
280 | 280 | if (self::string_has_bom($str) === false) { |
281 | - $str = self::bom() . $str; |
|
281 | + $str = self::bom().$str; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | return $str; |
@@ -307,8 +307,8 @@ discard block |
||
307 | 307 | $return = []; |
308 | 308 | foreach ($array as $key => &$value) { |
309 | 309 | $key = $case === \CASE_LOWER |
310 | - ? self::strtolower((string) $key, $encoding) |
|
311 | - : self::strtoupper((string) $key, $encoding); |
|
310 | + ? self::strtolower((string)$key, $encoding) |
|
311 | + : self::strtoupper((string)$key, $encoding); |
|
312 | 312 | |
313 | 313 | $return[$key] = $value; |
314 | 314 | } |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | return ''; |
343 | 343 | } |
344 | 344 | |
345 | - $substrIndex = $posStart + (int) \mb_strlen($start); |
|
345 | + $substrIndex = $posStart + (int)\mb_strlen($start); |
|
346 | 346 | $posEnd = \mb_strpos($str, $end, $substrIndex); |
347 | 347 | if ( |
348 | 348 | $posEnd === false |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | return ''; |
353 | 353 | } |
354 | 354 | |
355 | - return (string) \mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
355 | + return (string)\mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | return ''; |
363 | 363 | } |
364 | 364 | |
365 | - $substrIndex = $posStart + (int) self::strlen($start, $encoding); |
|
365 | + $substrIndex = $posStart + (int)self::strlen($start, $encoding); |
|
366 | 366 | $posEnd = self::strpos($str, $end, $substrIndex, $encoding); |
367 | 367 | if ( |
368 | 368 | $posEnd === false |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | return ''; |
373 | 373 | } |
374 | 374 | |
375 | - return (string) self::substr( |
|
375 | + return (string)self::substr( |
|
376 | 376 | $str, |
377 | 377 | $substrIndex, |
378 | 378 | $posEnd - $substrIndex, |
@@ -440,10 +440,10 @@ discard block |
||
440 | 440 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
441 | 441 | { |
442 | 442 | if ($encoding === 'UTF-8') { |
443 | - return (string) \mb_substr($str, $index, 1); |
|
443 | + return (string)\mb_substr($str, $index, 1); |
|
444 | 444 | } |
445 | 445 | |
446 | - return (string) self::substr($str, $index, 1, $encoding); |
|
446 | + return (string)self::substr($str, $index, 1, $encoding); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
@@ -542,10 +542,10 @@ discard block |
||
542 | 542 | && |
543 | 543 | self::$SUPPORT['mbstring'] === false |
544 | 544 | ) { |
545 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
545 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
546 | 546 | } |
547 | 547 | |
548 | - $cacheKey = $code_point . $encoding; |
|
548 | + $cacheKey = $code_point.$encoding; |
|
549 | 549 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
550 | 550 | return $CHAR_CACHE[$cacheKey]; |
551 | 551 | } |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | if ($code_point <= 127) { // use "simple"-char only until "\x80" |
554 | 554 | |
555 | 555 | if (self::$CHR === null) { |
556 | - self::$CHR = (array) self::getData('chr'); |
|
556 | + self::$CHR = (array)self::getData('chr'); |
|
557 | 557 | } |
558 | 558 | |
559 | 559 | /** |
@@ -588,10 +588,10 @@ discard block |
||
588 | 588 | // |
589 | 589 | |
590 | 590 | if (self::$CHR === null) { |
591 | - self::$CHR = (array) self::getData('chr'); |
|
591 | + self::$CHR = (array)self::getData('chr'); |
|
592 | 592 | } |
593 | 593 | |
594 | - $code_point = (int) $code_point; |
|
594 | + $code_point = (int)$code_point; |
|
595 | 595 | if ($code_point <= 0x7F) { |
596 | 596 | /** |
597 | 597 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -601,22 +601,22 @@ discard block |
||
601 | 601 | /** |
602 | 602 | * @psalm-suppress PossiblyNullArrayAccess |
603 | 603 | */ |
604 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
604 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
605 | 605 | self::$CHR[($code_point & 0x3F) + 0x80]; |
606 | 606 | } elseif ($code_point <= 0xFFFF) { |
607 | 607 | /** |
608 | 608 | * @psalm-suppress PossiblyNullArrayAccess |
609 | 609 | */ |
610 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
611 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
610 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
611 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
612 | 612 | self::$CHR[($code_point & 0x3F) + 0x80]; |
613 | 613 | } else { |
614 | 614 | /** |
615 | 615 | * @psalm-suppress PossiblyNullArrayAccess |
616 | 616 | */ |
617 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
618 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
619 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
617 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
618 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
619 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
620 | 620 | self::$CHR[($code_point & 0x3F) + 0x80]; |
621 | 621 | } |
622 | 622 | |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | |
664 | 664 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
665 | 665 | return \array_map( |
666 | - static function (string $data): int { |
|
666 | + static function(string $data): int { |
|
667 | 667 | // "mb_" is available if overload is used, so use it ... |
668 | 668 | return \mb_strlen($data, 'CP850'); // 8-BIT |
669 | 669 | }, |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | $char = ''; |
732 | 732 | } |
733 | 733 | |
734 | - return self::int_to_hex(self::ord((string) $char), $pfix); |
|
734 | + return self::int_to_hex(self::ord((string)$char), $pfix); |
|
735 | 735 | } |
736 | 736 | |
737 | 737 | /** |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | | ( [\x80-\xBF] ) # invalid byte in range 10000000 - 10111111 |
806 | 806 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
807 | 807 | /x'; |
808 | - $str = (string) \preg_replace($regx, '$1', $str); |
|
808 | + $str = (string)\preg_replace($regx, '$1', $str); |
|
809 | 809 | |
810 | 810 | if ($replace_diamond_question_mark === true) { |
811 | 811 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | public static function cleanup($str): string |
841 | 841 | { |
842 | 842 | // init |
843 | - $str = (string) $str; |
|
843 | + $str = (string)$str; |
|
844 | 844 | |
845 | 845 | if ($str === '') { |
846 | 846 | return ''; |
@@ -923,7 +923,7 @@ discard block |
||
923 | 923 | { |
924 | 924 | if (self::$SUPPORT['mbstring'] === true) { |
925 | 925 | /** @noinspection PhpComposerExtensionStubsInspection */ |
926 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
926 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
927 | 927 | } |
928 | 928 | |
929 | 929 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | */ |
964 | 964 | public static function css_stripe_media_queries(string $str): string |
965 | 965 | { |
966 | - return (string) \preg_replace( |
|
966 | + return (string)\preg_replace( |
|
967 | 967 | '#@media\\s+(?:only\\s)?(?:[\\s{\\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
968 | 968 | '', |
969 | 969 | $str |
@@ -990,7 +990,7 @@ discard block |
||
990 | 990 | */ |
991 | 991 | public static function decimal_to_chr($int): string |
992 | 992 | { |
993 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
993 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
994 | 994 | } |
995 | 995 | |
996 | 996 | /** |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | if ($toEncoding === 'JSON') { |
1070 | 1070 | $return = self::json_encode($str); |
1071 | 1071 | if ($return === false) { |
1072 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1072 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1073 | 1073 | } |
1074 | 1074 | |
1075 | 1075 | return $return; |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | && |
1156 | 1156 | self::$SUPPORT['mbstring'] === false |
1157 | 1157 | ) { |
1158 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $toEncoding . '" encoding', \E_USER_WARNING); |
|
1158 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$toEncoding.'" encoding', \E_USER_WARNING); |
|
1159 | 1159 | } |
1160 | 1160 | |
1161 | 1161 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1249,31 +1249,31 @@ discard block |
||
1249 | 1249 | $trimChars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1250 | 1250 | |
1251 | 1251 | if ($length === null) { |
1252 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
1252 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
1253 | 1253 | } |
1254 | 1254 | |
1255 | 1255 | if ($search === '') { |
1256 | 1256 | if ($encoding === 'UTF-8') { |
1257 | 1257 | if ($length > 0) { |
1258 | - $stringLength = (int) \mb_strlen($str); |
|
1258 | + $stringLength = (int)\mb_strlen($str); |
|
1259 | 1259 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
1260 | 1260 | } else { |
1261 | 1261 | $end = 0; |
1262 | 1262 | } |
1263 | 1263 | |
1264 | - $pos = (int) \min( |
|
1264 | + $pos = (int)\min( |
|
1265 | 1265 | \mb_strpos($str, ' ', $end), |
1266 | 1266 | \mb_strpos($str, '.', $end) |
1267 | 1267 | ); |
1268 | 1268 | } else { |
1269 | 1269 | if ($length > 0) { |
1270 | - $stringLength = (int) self::strlen($str, $encoding); |
|
1270 | + $stringLength = (int)self::strlen($str, $encoding); |
|
1271 | 1271 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
1272 | 1272 | } else { |
1273 | 1273 | $end = 0; |
1274 | 1274 | } |
1275 | 1275 | |
1276 | - $pos = (int) \min( |
|
1276 | + $pos = (int)\min( |
|
1277 | 1277 | self::strpos($str, ' ', $end, $encoding), |
1278 | 1278 | self::strpos($str, '.', $end, $encoding) |
1279 | 1279 | ); |
@@ -1290,18 +1290,18 @@ discard block |
||
1290 | 1290 | return ''; |
1291 | 1291 | } |
1292 | 1292 | |
1293 | - return \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1293 | + return \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1294 | 1294 | } |
1295 | 1295 | |
1296 | 1296 | return $str; |
1297 | 1297 | } |
1298 | 1298 | |
1299 | 1299 | if ($encoding === 'UTF-8') { |
1300 | - $wordPos = (int) \mb_stripos($str, $search); |
|
1301 | - $halfSide = (int) ($wordPos - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1300 | + $wordPos = (int)\mb_stripos($str, $search); |
|
1301 | + $halfSide = (int)($wordPos - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1302 | 1302 | } else { |
1303 | - $wordPos = (int) self::stripos($str, $search, 0, $encoding); |
|
1304 | - $halfSide = (int) ($wordPos - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1303 | + $wordPos = (int)self::stripos($str, $search, 0, $encoding); |
|
1304 | + $halfSide = (int)($wordPos - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1305 | 1305 | } |
1306 | 1306 | |
1307 | 1307 | $pos_start = 0; |
@@ -1313,12 +1313,12 @@ discard block |
||
1313 | 1313 | } |
1314 | 1314 | if ($halfText !== false) { |
1315 | 1315 | if ($encoding === 'UTF-8') { |
1316 | - $pos_start = (int) \max( |
|
1316 | + $pos_start = (int)\max( |
|
1317 | 1317 | \mb_strrpos($halfText, ' '), |
1318 | 1318 | \mb_strrpos($halfText, '.') |
1319 | 1319 | ); |
1320 | 1320 | } else { |
1321 | - $pos_start = (int) \max( |
|
1321 | + $pos_start = (int)\max( |
|
1322 | 1322 | self::strrpos($halfText, ' ', 0, $encoding), |
1323 | 1323 | self::strrpos($halfText, '.', 0, $encoding) |
1324 | 1324 | ); |
@@ -1328,19 +1328,19 @@ discard block |
||
1328 | 1328 | |
1329 | 1329 | if ($wordPos && $halfSide > 0) { |
1330 | 1330 | $offset = $pos_start + $length - 1; |
1331 | - $realLength = (int) self::strlen($str, $encoding); |
|
1331 | + $realLength = (int)self::strlen($str, $encoding); |
|
1332 | 1332 | |
1333 | 1333 | if ($offset > $realLength) { |
1334 | 1334 | $offset = $realLength; |
1335 | 1335 | } |
1336 | 1336 | |
1337 | 1337 | if ($encoding === 'UTF-8') { |
1338 | - $pos_end = (int) \min( |
|
1338 | + $pos_end = (int)\min( |
|
1339 | 1339 | \mb_strpos($str, ' ', $offset), |
1340 | 1340 | \mb_strpos($str, '.', $offset) |
1341 | 1341 | ) - $pos_start; |
1342 | 1342 | } else { |
1343 | - $pos_end = (int) \min( |
|
1343 | + $pos_end = (int)\min( |
|
1344 | 1344 | self::strpos($str, ' ', $offset, $encoding), |
1345 | 1345 | self::strpos($str, '.', $offset, $encoding) |
1346 | 1346 | ) - $pos_start; |
@@ -1348,12 +1348,12 @@ discard block |
||
1348 | 1348 | |
1349 | 1349 | if (!$pos_end || $pos_end <= 0) { |
1350 | 1350 | if ($encoding === 'UTF-8') { |
1351 | - $strSub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1351 | + $strSub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1352 | 1352 | } else { |
1353 | - $strSub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1353 | + $strSub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1354 | 1354 | } |
1355 | 1355 | if ($strSub !== false) { |
1356 | - $extract = $replacerForSkippedText . \ltrim($strSub, $trimChars); |
|
1356 | + $extract = $replacerForSkippedText.\ltrim($strSub, $trimChars); |
|
1357 | 1357 | } else { |
1358 | 1358 | $extract = ''; |
1359 | 1359 | } |
@@ -1364,26 +1364,26 @@ discard block |
||
1364 | 1364 | $strSub = self::substr($str, $pos_start, $pos_end, $encoding); |
1365 | 1365 | } |
1366 | 1366 | if ($strSub !== false) { |
1367 | - $extract = $replacerForSkippedText . \trim($strSub, $trimChars) . $replacerForSkippedText; |
|
1367 | + $extract = $replacerForSkippedText.\trim($strSub, $trimChars).$replacerForSkippedText; |
|
1368 | 1368 | } else { |
1369 | 1369 | $extract = ''; |
1370 | 1370 | } |
1371 | 1371 | } |
1372 | 1372 | } else { |
1373 | 1373 | $offset = $length - 1; |
1374 | - $trueLength = (int) self::strlen($str, $encoding); |
|
1374 | + $trueLength = (int)self::strlen($str, $encoding); |
|
1375 | 1375 | |
1376 | 1376 | if ($offset > $trueLength) { |
1377 | 1377 | $offset = $trueLength; |
1378 | 1378 | } |
1379 | 1379 | |
1380 | 1380 | if ($encoding === 'UTF-8') { |
1381 | - $pos_end = (int) \min( |
|
1381 | + $pos_end = (int)\min( |
|
1382 | 1382 | \mb_strpos($str, ' ', $offset), |
1383 | 1383 | \mb_strpos($str, '.', $offset) |
1384 | 1384 | ); |
1385 | 1385 | } else { |
1386 | - $pos_end = (int) \min( |
|
1386 | + $pos_end = (int)\min( |
|
1387 | 1387 | self::strpos($str, ' ', $offset, $encoding), |
1388 | 1388 | self::strpos($str, '.', $offset, $encoding) |
1389 | 1389 | ); |
@@ -1396,7 +1396,7 @@ discard block |
||
1396 | 1396 | $strSub = self::substr($str, 0, $pos_end, $encoding); |
1397 | 1397 | } |
1398 | 1398 | if ($strSub !== false) { |
1399 | - $extract = \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1399 | + $extract = \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1400 | 1400 | } else { |
1401 | 1401 | $extract = ''; |
1402 | 1402 | } |
@@ -1520,7 +1520,7 @@ discard block |
||
1520 | 1520 | { |
1521 | 1521 | $file_content = \file_get_contents($file_path); |
1522 | 1522 | if ($file_content === false) { |
1523 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1523 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1524 | 1524 | } |
1525 | 1525 | |
1526 | 1526 | return self::string_has_bom($file_content); |
@@ -1581,7 +1581,7 @@ discard block |
||
1581 | 1581 | ) { |
1582 | 1582 | // Prevent leading combining chars |
1583 | 1583 | // for NFC-safe concatenations. |
1584 | - $var = $leading_combining . $var; |
|
1584 | + $var = $leading_combining.$var; |
|
1585 | 1585 | } |
1586 | 1586 | } |
1587 | 1587 | |
@@ -1820,10 +1820,10 @@ discard block |
||
1820 | 1820 | } |
1821 | 1821 | |
1822 | 1822 | if ($encoding === 'UTF-8') { |
1823 | - return (string) \mb_substr($str, 0, $n); |
|
1823 | + return (string)\mb_substr($str, 0, $n); |
|
1824 | 1824 | } |
1825 | 1825 | |
1826 | - return (string) self::substr($str, 0, $n, $encoding); |
|
1826 | + return (string)self::substr($str, 0, $n, $encoding); |
|
1827 | 1827 | } |
1828 | 1828 | |
1829 | 1829 | /** |
@@ -1898,7 +1898,7 @@ discard block |
||
1898 | 1898 | return $str; |
1899 | 1899 | } |
1900 | 1900 | |
1901 | - $str = (string) $str; |
|
1901 | + $str = (string)$str; |
|
1902 | 1902 | $last = ''; |
1903 | 1903 | while ($last !== $str) { |
1904 | 1904 | $last = $str; |
@@ -2086,7 +2086,7 @@ discard block |
||
2086 | 2086 | if ($str_info === false) { |
2087 | 2087 | return $fallback; |
2088 | 2088 | } |
2089 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2089 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2090 | 2090 | |
2091 | 2091 | // DEBUG |
2092 | 2092 | //var_dump($type_code); |
@@ -2175,7 +2175,7 @@ discard block |
||
2175 | 2175 | // |
2176 | 2176 | |
2177 | 2177 | if ($encoding === 'UTF-8') { |
2178 | - $maxlength = (int) \mb_strlen($possibleChars); |
|
2178 | + $maxlength = (int)\mb_strlen($possibleChars); |
|
2179 | 2179 | if ($maxlength === 0) { |
2180 | 2180 | return ''; |
2181 | 2181 | } |
@@ -2196,7 +2196,7 @@ discard block |
||
2196 | 2196 | } else { |
2197 | 2197 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2198 | 2198 | |
2199 | - $maxlength = (int) self::strlen($possibleChars, $encoding); |
|
2199 | + $maxlength = (int)self::strlen($possibleChars, $encoding); |
|
2200 | 2200 | if ($maxlength === 0) { |
2201 | 2201 | return ''; |
2202 | 2202 | } |
@@ -2227,16 +2227,16 @@ discard block |
||
2227 | 2227 | */ |
2228 | 2228 | public static function get_unique_string($entropyExtra = '', bool $md5 = true): string |
2229 | 2229 | { |
2230 | - $uniqueHelper = \random_int(0, \mt_getrandmax()) . |
|
2231 | - \session_id() . |
|
2232 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2233 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2230 | + $uniqueHelper = \random_int(0, \mt_getrandmax()). |
|
2231 | + \session_id(). |
|
2232 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2233 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2234 | 2234 | $entropyExtra; |
2235 | 2235 | |
2236 | 2236 | $uniqueString = \uniqid($uniqueHelper, true); |
2237 | 2237 | |
2238 | 2238 | if ($md5) { |
2239 | - $uniqueString = \md5($uniqueString . $uniqueHelper); |
|
2239 | + $uniqueString = \md5($uniqueString.$uniqueHelper); |
|
2240 | 2240 | } |
2241 | 2241 | |
2242 | 2242 | return $uniqueString; |
@@ -2316,7 +2316,7 @@ discard block |
||
2316 | 2316 | public static function hex_to_int($hexDec) |
2317 | 2317 | { |
2318 | 2318 | // init |
2319 | - $hexDec = (string) $hexDec; |
|
2319 | + $hexDec = (string)$hexDec; |
|
2320 | 2320 | |
2321 | 2321 | if ($hexDec === '') { |
2322 | 2322 | return false; |
@@ -2394,7 +2394,7 @@ discard block |
||
2394 | 2394 | return \implode( |
2395 | 2395 | '', |
2396 | 2396 | \array_map( |
2397 | - static function (string $chr) use ($keepAsciiChars, $encoding): string { |
|
2397 | + static function(string $chr) use ($keepAsciiChars, $encoding): string { |
|
2398 | 2398 | return self::single_chr_html_encode($chr, $keepAsciiChars, $encoding); |
2399 | 2399 | }, |
2400 | 2400 | self::str_split($str) |
@@ -2498,7 +2498,7 @@ discard block |
||
2498 | 2498 | && |
2499 | 2499 | self::$SUPPORT['mbstring'] === false |
2500 | 2500 | ) { |
2501 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2501 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2502 | 2502 | } |
2503 | 2503 | |
2504 | 2504 | do { |
@@ -2519,14 +2519,14 @@ discard block |
||
2519 | 2519 | ); |
2520 | 2520 | } |
2521 | 2521 | } else { |
2522 | - $str = (string) \preg_replace_callback( |
|
2522 | + $str = (string)\preg_replace_callback( |
|
2523 | 2523 | "/&#\d{2,6};/", |
2524 | 2524 | /** |
2525 | 2525 | * @param string[] $matches |
2526 | 2526 | * |
2527 | 2527 | * @return string |
2528 | 2528 | */ |
2529 | - static function (array $matches) use ($encoding): string { |
|
2529 | + static function(array $matches) use ($encoding): string { |
|
2530 | 2530 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
2531 | 2531 | if ($returnTmp !== '"' && $returnTmp !== "'") { |
2532 | 2532 | return $returnTmp; |
@@ -2541,7 +2541,7 @@ discard block |
||
2541 | 2541 | if (\strpos($str, '&') !== false) { |
2542 | 2542 | if (\strpos($str, '&#') !== false) { |
2543 | 2543 | // decode also numeric & UTF16 two byte entities |
2544 | - $str = (string) \preg_replace( |
|
2544 | + $str = (string)\preg_replace( |
|
2545 | 2545 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
2546 | 2546 | '$1;', |
2547 | 2547 | $str |
@@ -2587,7 +2587,7 @@ discard block |
||
2587 | 2587 | */ |
2588 | 2588 | public static function html_stripe_empty_tags(string $str): string |
2589 | 2589 | { |
2590 | - return (string) \preg_replace( |
|
2590 | + return (string)\preg_replace( |
|
2591 | 2591 | "/<[^\/>]*>(([\s]?)*|)<\/[^>]*>/u", |
2592 | 2592 | '', |
2593 | 2593 | $str |
@@ -2886,9 +2886,9 @@ discard block |
||
2886 | 2886 | { |
2887 | 2887 | $hex = \dechex($int); |
2888 | 2888 | |
2889 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
2889 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
2890 | 2890 | |
2891 | - return $pfix . $hex . ''; |
|
2891 | + return $pfix.$hex.''; |
|
2892 | 2892 | } |
2893 | 2893 | |
2894 | 2894 | /** |
@@ -3155,7 +3155,7 @@ discard block |
||
3155 | 3155 | */ |
3156 | 3156 | public static function is_binary($input, bool $strict = false): bool |
3157 | 3157 | { |
3158 | - $input = (string) $input; |
|
3158 | + $input = (string)$input; |
|
3159 | 3159 | if ($input === '') { |
3160 | 3160 | return false; |
3161 | 3161 | } |
@@ -3414,7 +3414,7 @@ discard block |
||
3414 | 3414 | public static function is_utf16($str, $checkIfStringIsBinary = true) |
3415 | 3415 | { |
3416 | 3416 | // init |
3417 | - $str = (string) $str; |
|
3417 | + $str = (string)$str; |
|
3418 | 3418 | $strChars = []; |
3419 | 3419 | |
3420 | 3420 | if ( |
@@ -3492,7 +3492,7 @@ discard block |
||
3492 | 3492 | public static function is_utf32($str, $checkIfStringIsBinary = true) |
3493 | 3493 | { |
3494 | 3494 | // init |
3495 | - $str = (string) $str; |
|
3495 | + $str = (string)$str; |
|
3496 | 3496 | $strChars = []; |
3497 | 3497 | |
3498 | 3498 | if ( |
@@ -3571,16 +3571,16 @@ discard block |
||
3571 | 3571 | self::initEmojiData(); |
3572 | 3572 | |
3573 | 3573 | if ($useReversibleStringMapping === true) { |
3574 | - return (string) \str_replace( |
|
3575 | - (array) self::$EMOJI_VALUES_CACHE, |
|
3576 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
3574 | + return (string)\str_replace( |
|
3575 | + (array)self::$EMOJI_VALUES_CACHE, |
|
3576 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
3577 | 3577 | $str |
3578 | 3578 | ); |
3579 | 3579 | } |
3580 | 3580 | |
3581 | - return (string) \str_replace( |
|
3582 | - (array) self::$EMOJI_VALUES_CACHE, |
|
3583 | - (array) self::$EMOJI_KEYS_CACHE, |
|
3581 | + return (string)\str_replace( |
|
3582 | + (array)self::$EMOJI_VALUES_CACHE, |
|
3583 | + (array)self::$EMOJI_KEYS_CACHE, |
|
3584 | 3584 | $str |
3585 | 3585 | ); |
3586 | 3586 | } |
@@ -3600,16 +3600,16 @@ discard block |
||
3600 | 3600 | self::initEmojiData(); |
3601 | 3601 | |
3602 | 3602 | if ($useReversibleStringMapping === true) { |
3603 | - return (string) \str_replace( |
|
3604 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
3605 | - (array) self::$EMOJI_VALUES_CACHE, |
|
3603 | + return (string)\str_replace( |
|
3604 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
3605 | + (array)self::$EMOJI_VALUES_CACHE, |
|
3606 | 3606 | $str |
3607 | 3607 | ); |
3608 | 3608 | } |
3609 | 3609 | |
3610 | - return (string) \str_replace( |
|
3611 | - (array) self::$EMOJI_KEYS_CACHE, |
|
3612 | - (array) self::$EMOJI_VALUES_CACHE, |
|
3610 | + return (string)\str_replace( |
|
3611 | + (array)self::$EMOJI_KEYS_CACHE, |
|
3612 | + (array)self::$EMOJI_VALUES_CACHE, |
|
3613 | 3613 | $str |
3614 | 3614 | ); |
3615 | 3615 | } |
@@ -3670,7 +3670,7 @@ discard block |
||
3670 | 3670 | self::$ORD = self::getData('ord'); |
3671 | 3671 | } |
3672 | 3672 | |
3673 | - $len = \strlen((string) $str); |
|
3673 | + $len = \strlen((string)$str); |
|
3674 | 3674 | /** @noinspection ForeachInvariantsInspection */ |
3675 | 3675 | for ($i = 0; $i < $len; ++$i) { |
3676 | 3676 | $in = self::$ORD[$str[$i]]; |
@@ -3907,15 +3907,15 @@ discard block |
||
3907 | 3907 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
3908 | 3908 | |
3909 | 3909 | if ($encoding === 'UTF-8') { |
3910 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
3910 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
3911 | 3911 | |
3912 | 3912 | if ($useMbFunction === true) { |
3913 | 3913 | $strPartOne = \mb_strtolower( |
3914 | - (string) \mb_substr($str, 0, 1) |
|
3914 | + (string)\mb_substr($str, 0, 1) |
|
3915 | 3915 | ); |
3916 | 3916 | } else { |
3917 | 3917 | $strPartOne = self::strtolower( |
3918 | - (string) \mb_substr($str, 0, 1), |
|
3918 | + (string)\mb_substr($str, 0, 1), |
|
3919 | 3919 | $encoding, |
3920 | 3920 | false, |
3921 | 3921 | $lang, |
@@ -3925,10 +3925,10 @@ discard block |
||
3925 | 3925 | } else { |
3926 | 3926 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
3927 | 3927 | |
3928 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
3928 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
3929 | 3929 | |
3930 | 3930 | $strPartOne = self::strtolower( |
3931 | - (string) self::substr($str, 0, 1, $encoding), |
|
3931 | + (string)self::substr($str, 0, 1, $encoding), |
|
3932 | 3932 | $encoding, |
3933 | 3933 | false, |
3934 | 3934 | $lang, |
@@ -3936,7 +3936,7 @@ discard block |
||
3936 | 3936 | ); |
3937 | 3937 | } |
3938 | 3938 | |
3939 | - return $strPartOne . $strPartTwo; |
|
3939 | + return $strPartOne.$strPartTwo; |
|
3940 | 3940 | } |
3941 | 3941 | |
3942 | 3942 | /** |
@@ -4055,7 +4055,7 @@ discard block |
||
4055 | 4055 | |
4056 | 4056 | if (self::$SUPPORT['mbstring'] === true) { |
4057 | 4057 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4058 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4058 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4059 | 4059 | } |
4060 | 4060 | |
4061 | 4061 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -4096,7 +4096,7 @@ discard block |
||
4096 | 4096 | { |
4097 | 4097 | $bytes = self::chr_size_list($str); |
4098 | 4098 | if (\count($bytes) > 0) { |
4099 | - return (int) \max($bytes); |
|
4099 | + return (int)\max($bytes); |
|
4100 | 4100 | } |
4101 | 4101 | |
4102 | 4102 | return 0; |
@@ -4166,7 +4166,7 @@ discard block |
||
4166 | 4166 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4167 | 4167 | |
4168 | 4168 | // init |
4169 | - $encoding = (string) $encoding; |
|
4169 | + $encoding = (string)$encoding; |
|
4170 | 4170 | |
4171 | 4171 | if (!$encoding) { |
4172 | 4172 | return $fallback; |
@@ -4220,7 +4220,7 @@ discard block |
||
4220 | 4220 | |
4221 | 4221 | $encodingOrig = $encoding; |
4222 | 4222 | $encoding = \strtoupper($encoding); |
4223 | - $encodingUpperHelper = (string) \preg_replace('/[^a-zA-Z0-9\s]/u', '', $encoding); |
|
4223 | + $encodingUpperHelper = (string)\preg_replace('/[^a-zA-Z0-9\s]/u', '', $encoding); |
|
4224 | 4224 | |
4225 | 4225 | $equivalences = [ |
4226 | 4226 | 'ISO8859' => 'ISO-8859-1', |
@@ -4378,7 +4378,7 @@ discard block |
||
4378 | 4378 | } |
4379 | 4379 | |
4380 | 4380 | static $WHITESPACE_CACHE = []; |
4381 | - $cacheKey = (int) $keepNonBreakingSpace; |
|
4381 | + $cacheKey = (int)$keepNonBreakingSpace; |
|
4382 | 4382 | |
4383 | 4383 | if (!isset($WHITESPACE_CACHE[$cacheKey])) { |
4384 | 4384 | $WHITESPACE_CACHE[$cacheKey] = self::$WHITESPACE_TABLE; |
@@ -4420,13 +4420,13 @@ discard block |
||
4420 | 4420 | static $CHAR_CACHE = []; |
4421 | 4421 | |
4422 | 4422 | // init |
4423 | - $chr = (string) $chr; |
|
4423 | + $chr = (string)$chr; |
|
4424 | 4424 | |
4425 | 4425 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4426 | 4426 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4427 | 4427 | } |
4428 | 4428 | |
4429 | - $cacheKey = $chr . $encoding; |
|
4429 | + $cacheKey = $chr.$encoding; |
|
4430 | 4430 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
4431 | 4431 | return $CHAR_CACHE[$cacheKey]; |
4432 | 4432 | } |
@@ -4461,22 +4461,22 @@ discard block |
||
4461 | 4461 | // |
4462 | 4462 | |
4463 | 4463 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
4464 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
4464 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
4465 | 4465 | $code = $chr ? $chr[1] : 0; |
4466 | 4466 | |
4467 | 4467 | if ($code >= 0xF0 && isset($chr[4])) { |
4468 | 4468 | /** @noinspection UnnecessaryCastingInspection */ |
4469 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4469 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4470 | 4470 | } |
4471 | 4471 | |
4472 | 4472 | if ($code >= 0xE0 && isset($chr[3])) { |
4473 | 4473 | /** @noinspection UnnecessaryCastingInspection */ |
4474 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4474 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4475 | 4475 | } |
4476 | 4476 | |
4477 | 4477 | if ($code >= 0xC0 && isset($chr[2])) { |
4478 | 4478 | /** @noinspection UnnecessaryCastingInspection */ |
4479 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4479 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4480 | 4480 | } |
4481 | 4481 | |
4482 | 4482 | return $CHAR_CACHE[$cacheKey] = $code; |
@@ -4525,7 +4525,7 @@ discard block |
||
4525 | 4525 | public static function pcre_utf8_support(): bool |
4526 | 4526 | { |
4527 | 4527 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4528 | - return (bool) @\preg_match('//u', ''); |
|
4528 | + return (bool)@\preg_match('//u', ''); |
|
4529 | 4529 | } |
4530 | 4530 | |
4531 | 4531 | /** |
@@ -4547,10 +4547,10 @@ discard block |
||
4547 | 4547 | } |
4548 | 4548 | |
4549 | 4549 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4550 | - if (\ctype_digit((string) $var1)) { |
|
4551 | - $start = (int) $var1; |
|
4550 | + if (\ctype_digit((string)$var1)) { |
|
4551 | + $start = (int)$var1; |
|
4552 | 4552 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var1)) { |
4553 | - $start = (int) self::hex_to_int($var1); |
|
4553 | + $start = (int)self::hex_to_int($var1); |
|
4554 | 4554 | } else { |
4555 | 4555 | $start = self::ord($var1); |
4556 | 4556 | } |
@@ -4560,10 +4560,10 @@ discard block |
||
4560 | 4560 | } |
4561 | 4561 | |
4562 | 4562 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4563 | - if (\ctype_digit((string) $var2)) { |
|
4564 | - $end = (int) $var2; |
|
4563 | + if (\ctype_digit((string)$var2)) { |
|
4564 | + $end = (int)$var2; |
|
4565 | 4565 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var2)) { |
4566 | - $end = (int) self::hex_to_int($var2); |
|
4566 | + $end = (int)self::hex_to_int($var2); |
|
4567 | 4567 | } else { |
4568 | 4568 | $end = self::ord($var2); |
4569 | 4569 | } |
@@ -4573,8 +4573,8 @@ discard block |
||
4573 | 4573 | } |
4574 | 4574 | |
4575 | 4575 | return \array_map( |
4576 | - static function (int $i): string { |
|
4577 | - return (string) self::chr($i); |
|
4576 | + static function(int $i): string { |
|
4577 | + return (string)self::chr($i); |
|
4578 | 4578 | }, |
4579 | 4579 | \range($start, $end) |
4580 | 4580 | ); |
@@ -4665,8 +4665,8 @@ discard block |
||
4665 | 4665 | $delimiter = '/'; |
4666 | 4666 | } |
4667 | 4667 | |
4668 | - return (string) \preg_replace( |
|
4669 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4668 | + return (string)\preg_replace( |
|
4669 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4670 | 4670 | $replacement, |
4671 | 4671 | $str |
4672 | 4672 | ); |
@@ -4709,9 +4709,9 @@ discard block |
||
4709 | 4709 | return ''; |
4710 | 4710 | } |
4711 | 4711 | |
4712 | - $strLength -= (int) $bomByteLength; |
|
4712 | + $strLength -= (int)$bomByteLength; |
|
4713 | 4713 | |
4714 | - $str = (string) $strTmp; |
|
4714 | + $str = (string)$strTmp; |
|
4715 | 4715 | } |
4716 | 4716 | } |
4717 | 4717 | |
@@ -4735,7 +4735,7 @@ discard block |
||
4735 | 4735 | if (\is_array($what) === true) { |
4736 | 4736 | /** @noinspection ForeachSourceInspection */ |
4737 | 4737 | foreach ($what as $item) { |
4738 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
4738 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
4739 | 4739 | } |
4740 | 4740 | } |
4741 | 4741 | |
@@ -4767,7 +4767,7 @@ discard block |
||
4767 | 4767 | */ |
4768 | 4768 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
4769 | 4769 | { |
4770 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4770 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4771 | 4771 | } |
4772 | 4772 | |
4773 | 4773 | /** |
@@ -4798,7 +4798,7 @@ discard block |
||
4798 | 4798 | $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
4799 | 4799 | |
4800 | 4800 | do { |
4801 | - $str = (string) \preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4801 | + $str = (string)\preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4802 | 4802 | } while ($count !== 0); |
4803 | 4803 | |
4804 | 4804 | return $str; |
@@ -4817,17 +4817,17 @@ discard block |
||
4817 | 4817 | { |
4818 | 4818 | if ($substring && \strpos($str, $substring) === 0) { |
4819 | 4819 | if ($encoding === 'UTF-8') { |
4820 | - return (string) \mb_substr( |
|
4820 | + return (string)\mb_substr( |
|
4821 | 4821 | $str, |
4822 | - (int) \mb_strlen($substring) |
|
4822 | + (int)\mb_strlen($substring) |
|
4823 | 4823 | ); |
4824 | 4824 | } |
4825 | 4825 | |
4826 | 4826 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4827 | 4827 | |
4828 | - return (string) self::substr( |
|
4828 | + return (string)self::substr( |
|
4829 | 4829 | $str, |
4830 | - (int) self::strlen($substring, $encoding), |
|
4830 | + (int)self::strlen($substring, $encoding), |
|
4831 | 4831 | null, |
4832 | 4832 | $encoding |
4833 | 4833 | ); |
@@ -4849,19 +4849,19 @@ discard block |
||
4849 | 4849 | { |
4850 | 4850 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
4851 | 4851 | if ($encoding === 'UTF-8') { |
4852 | - return (string) \mb_substr( |
|
4852 | + return (string)\mb_substr( |
|
4853 | 4853 | $str, |
4854 | 4854 | 0, |
4855 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
4855 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
4856 | 4856 | ); |
4857 | 4857 | } |
4858 | 4858 | |
4859 | 4859 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4860 | 4860 | |
4861 | - return (string) self::substr( |
|
4861 | + return (string)self::substr( |
|
4862 | 4862 | $str, |
4863 | 4863 | 0, |
4864 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
4864 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
4865 | 4865 | $encoding |
4866 | 4866 | ); |
4867 | 4867 | } |
@@ -4945,7 +4945,7 @@ discard block |
||
4945 | 4945 | $save = \mb_substitute_character(); |
4946 | 4946 | \mb_substitute_character($replacementCharHelper); |
4947 | 4947 | // the polyfill maybe return false, so cast to string |
4948 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4948 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4949 | 4949 | \mb_substitute_character($save); |
4950 | 4950 | } |
4951 | 4951 | |
@@ -4985,7 +4985,7 @@ discard block |
||
4985 | 4985 | |
4986 | 4986 | if (self::$SUPPORT['mbstring'] === true) { |
4987 | 4987 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4988 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4988 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4989 | 4989 | } |
4990 | 4990 | |
4991 | 4991 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -5000,7 +5000,7 @@ discard block |
||
5000 | 5000 | { |
5001 | 5001 | echo '<pre>'; |
5002 | 5002 | foreach (self::$SUPPORT as $key => &$value) { |
5003 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
5003 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
5004 | 5004 | } |
5005 | 5005 | unset($value); |
5006 | 5006 | echo '</pre>'; |
@@ -5029,7 +5029,7 @@ discard block |
||
5029 | 5029 | return $char; |
5030 | 5030 | } |
5031 | 5031 | |
5032 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
5032 | + return '&#'.self::ord($char, $encoding).';'; |
|
5033 | 5033 | } |
5034 | 5034 | |
5035 | 5035 | /** |
@@ -5088,7 +5088,7 @@ discard block |
||
5088 | 5088 | } |
5089 | 5089 | |
5090 | 5090 | // init |
5091 | - $str = (string) $str; |
|
5091 | + $str = (string)$str; |
|
5092 | 5092 | |
5093 | 5093 | if ($str === '') { |
5094 | 5094 | return []; |
@@ -5135,7 +5135,7 @@ discard block |
||
5135 | 5135 | ($str[$i] & "\xE0") === "\xC0" |
5136 | 5136 | ) { |
5137 | 5137 | if (($str[$i + 1] & "\xC0") === "\x80") { |
5138 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
5138 | + $ret[] = $str[$i].$str[$i + 1]; |
|
5139 | 5139 | |
5140 | 5140 | ++$i; |
5141 | 5141 | } |
@@ -5149,7 +5149,7 @@ discard block |
||
5149 | 5149 | && |
5150 | 5150 | ($str[$i + 2] & "\xC0") === "\x80" |
5151 | 5151 | ) { |
5152 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
5152 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
5153 | 5153 | |
5154 | 5154 | $i += 2; |
5155 | 5155 | } |
@@ -5165,7 +5165,7 @@ discard block |
||
5165 | 5165 | && |
5166 | 5166 | ($str[$i + 3] & "\xC0") === "\x80" |
5167 | 5167 | ) { |
5168 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
5168 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
5169 | 5169 | |
5170 | 5170 | $i += 3; |
5171 | 5171 | } |
@@ -5177,7 +5177,7 @@ discard block |
||
5177 | 5177 | $ret = \array_chunk($ret, $length); |
5178 | 5178 | |
5179 | 5179 | return \array_map( |
5180 | - static function (array &$item): string { |
|
5180 | + static function(array &$item): string { |
|
5181 | 5181 | return \implode('', $item); |
5182 | 5182 | }, |
5183 | 5183 | $ret |
@@ -5226,18 +5226,18 @@ discard block |
||
5226 | 5226 | $lang, |
5227 | 5227 | $tryToKeepStringLength |
5228 | 5228 | ); |
5229 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5229 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5230 | 5230 | |
5231 | 5231 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5232 | 5232 | |
5233 | - $str = (string) \preg_replace_callback( |
|
5233 | + $str = (string)\preg_replace_callback( |
|
5234 | 5234 | '/[-_\s]+(.)?/u', |
5235 | 5235 | /** |
5236 | 5236 | * @param array $match |
5237 | 5237 | * |
5238 | 5238 | * @return string |
5239 | 5239 | */ |
5240 | - static function (array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5240 | + static function(array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5241 | 5241 | if (isset($match[1])) { |
5242 | 5242 | if ($useMbFunction === true) { |
5243 | 5243 | if ($encoding === 'UTF-8') { |
@@ -5255,14 +5255,14 @@ discard block |
||
5255 | 5255 | $str |
5256 | 5256 | ); |
5257 | 5257 | |
5258 | - return (string) \preg_replace_callback( |
|
5258 | + return (string)\preg_replace_callback( |
|
5259 | 5259 | '/[\d]+(.)?/u', |
5260 | 5260 | /** |
5261 | 5261 | * @param array $match |
5262 | 5262 | * |
5263 | 5263 | * @return string |
5264 | 5264 | */ |
5265 | - static function (array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5265 | + static function(array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5266 | 5266 | if ($useMbFunction === true) { |
5267 | 5267 | if ($encoding === 'UTF-8') { |
5268 | 5268 | return \mb_strtoupper($match[0]); |
@@ -5434,7 +5434,7 @@ discard block |
||
5434 | 5434 | ): string { |
5435 | 5435 | if (self::$SUPPORT['mbstring'] === true) { |
5436 | 5436 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5437 | - $str = (string) \mb_ereg_replace('\B(\p{Lu})', '-\1', \trim($str)); |
|
5437 | + $str = (string)\mb_ereg_replace('\B(\p{Lu})', '-\1', \trim($str)); |
|
5438 | 5438 | |
5439 | 5439 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5440 | 5440 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5444,10 +5444,10 @@ discard block |
||
5444 | 5444 | } |
5445 | 5445 | |
5446 | 5446 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5447 | - return (string) \mb_ereg_replace('[-_\s]+', $delimiter, $str); |
|
5447 | + return (string)\mb_ereg_replace('[-_\s]+', $delimiter, $str); |
|
5448 | 5448 | } |
5449 | 5449 | |
5450 | - $str = (string) \preg_replace('/\B(\p{Lu})/u', '-\1', \trim($str)); |
|
5450 | + $str = (string)\preg_replace('/\B(\p{Lu})/u', '-\1', \trim($str)); |
|
5451 | 5451 | |
5452 | 5452 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5453 | 5453 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5456,7 +5456,7 @@ discard block |
||
5456 | 5456 | $str = self::strtolower($str, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
5457 | 5457 | } |
5458 | 5458 | |
5459 | - return (string) \preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
5459 | + return (string)\preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
5460 | 5460 | } |
5461 | 5461 | |
5462 | 5462 | /** |
@@ -5471,7 +5471,7 @@ discard block |
||
5471 | 5471 | public static function str_detect_encoding($str) |
5472 | 5472 | { |
5473 | 5473 | // init |
5474 | - $str = (string) $str; |
|
5474 | + $str = (string)$str; |
|
5475 | 5475 | |
5476 | 5476 | // |
5477 | 5477 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5573,7 +5573,7 @@ discard block |
||
5573 | 5573 | foreach (self::$ENCODINGS as $encodingTmp) { |
5574 | 5574 | // INFO: //IGNORE but still throw notice |
5575 | 5575 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5576 | - if ((string) @\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str) === $str) { |
|
5576 | + if ((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str) === $str) { |
|
5577 | 5577 | return $encodingTmp; |
5578 | 5578 | } |
5579 | 5579 | } |
@@ -5638,7 +5638,7 @@ discard block |
||
5638 | 5638 | return $str; |
5639 | 5639 | } |
5640 | 5640 | |
5641 | - return $substring . $str; |
|
5641 | + return $substring.$str; |
|
5642 | 5642 | } |
5643 | 5643 | |
5644 | 5644 | /** |
@@ -5858,27 +5858,27 @@ discard block |
||
5858 | 5858 | string $encoding = 'UTF-8' |
5859 | 5859 | ): string { |
5860 | 5860 | if ($encoding === 'UTF-8') { |
5861 | - $len = (int) \mb_strlen($str); |
|
5861 | + $len = (int)\mb_strlen($str); |
|
5862 | 5862 | if ($index > $len) { |
5863 | 5863 | return $str; |
5864 | 5864 | } |
5865 | 5865 | |
5866 | 5866 | /** @noinspection UnnecessaryCastingInspection */ |
5867 | - return (string) \mb_substr($str, 0, $index) . |
|
5868 | - $substring . |
|
5869 | - (string) \mb_substr($str, $index, $len); |
|
5867 | + return (string)\mb_substr($str, 0, $index). |
|
5868 | + $substring. |
|
5869 | + (string)\mb_substr($str, $index, $len); |
|
5870 | 5870 | } |
5871 | 5871 | |
5872 | 5872 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5873 | 5873 | |
5874 | - $len = (int) self::strlen($str, $encoding); |
|
5874 | + $len = (int)self::strlen($str, $encoding); |
|
5875 | 5875 | if ($index > $len) { |
5876 | 5876 | return $str; |
5877 | 5877 | } |
5878 | 5878 | |
5879 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
5880 | - $substring . |
|
5881 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5879 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
5880 | + $substring. |
|
5881 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
5882 | 5882 | } |
5883 | 5883 | |
5884 | 5884 | /** |
@@ -5908,15 +5908,15 @@ discard block |
||
5908 | 5908 | */ |
5909 | 5909 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5910 | 5910 | { |
5911 | - $search = (array) $search; |
|
5911 | + $search = (array)$search; |
|
5912 | 5912 | |
5913 | 5913 | /** @noinspection AlterInForeachInspection */ |
5914 | 5914 | foreach ($search as &$s) { |
5915 | - $s = (string) $s; |
|
5915 | + $s = (string)$s; |
|
5916 | 5916 | if ($s === '') { |
5917 | 5917 | $s = '/^(?<=.)$/'; |
5918 | 5918 | } else { |
5919 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5919 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5920 | 5920 | } |
5921 | 5921 | } |
5922 | 5922 | |
@@ -5948,11 +5948,11 @@ discard block |
||
5948 | 5948 | } |
5949 | 5949 | |
5950 | 5950 | if ($search === '') { |
5951 | - return $str . $replacement; |
|
5951 | + return $str.$replacement; |
|
5952 | 5952 | } |
5953 | 5953 | |
5954 | 5954 | if (\stripos($str, $search) === 0) { |
5955 | - return $replacement . \substr($str, \strlen($search)); |
|
5955 | + return $replacement.\substr($str, \strlen($search)); |
|
5956 | 5956 | } |
5957 | 5957 | |
5958 | 5958 | return $str; |
@@ -5980,11 +5980,11 @@ discard block |
||
5980 | 5980 | } |
5981 | 5981 | |
5982 | 5982 | if ($search === '') { |
5983 | - return $str . $replacement; |
|
5983 | + return $str.$replacement; |
|
5984 | 5984 | } |
5985 | 5985 | |
5986 | 5986 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
5987 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
5987 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
5988 | 5988 | } |
5989 | 5989 | |
5990 | 5990 | return $str; |
@@ -6057,15 +6057,15 @@ discard block |
||
6057 | 6057 | } |
6058 | 6058 | |
6059 | 6059 | if ($encoding === 'UTF-8') { |
6060 | - return (string) \mb_substr( |
|
6060 | + return (string)\mb_substr( |
|
6061 | 6061 | $str, |
6062 | - $offset + (int) \mb_strlen($separator) |
|
6062 | + $offset + (int)\mb_strlen($separator) |
|
6063 | 6063 | ); |
6064 | 6064 | } |
6065 | 6065 | |
6066 | - return (string) self::substr( |
|
6066 | + return (string)self::substr( |
|
6067 | 6067 | $str, |
6068 | - $offset + (int) self::strlen($separator, $encoding), |
|
6068 | + $offset + (int)self::strlen($separator, $encoding), |
|
6069 | 6069 | null, |
6070 | 6070 | $encoding |
6071 | 6071 | ); |
@@ -6092,15 +6092,15 @@ discard block |
||
6092 | 6092 | } |
6093 | 6093 | |
6094 | 6094 | if ($encoding === 'UTF-8') { |
6095 | - return (string) \mb_substr( |
|
6095 | + return (string)\mb_substr( |
|
6096 | 6096 | $str, |
6097 | - $offset + (int) self::strlen($separator) |
|
6097 | + $offset + (int)self::strlen($separator) |
|
6098 | 6098 | ); |
6099 | 6099 | } |
6100 | 6100 | |
6101 | - return (string) self::substr( |
|
6101 | + return (string)self::substr( |
|
6102 | 6102 | $str, |
6103 | - $offset + (int) self::strlen($separator, $encoding), |
|
6103 | + $offset + (int)self::strlen($separator, $encoding), |
|
6104 | 6104 | null, |
6105 | 6105 | $encoding |
6106 | 6106 | ); |
@@ -6127,10 +6127,10 @@ discard block |
||
6127 | 6127 | } |
6128 | 6128 | |
6129 | 6129 | if ($encoding === 'UTF-8') { |
6130 | - return (string) \mb_substr($str, 0, $offset); |
|
6130 | + return (string)\mb_substr($str, 0, $offset); |
|
6131 | 6131 | } |
6132 | 6132 | |
6133 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6133 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6134 | 6134 | } |
6135 | 6135 | |
6136 | 6136 | /** |
@@ -6154,7 +6154,7 @@ discard block |
||
6154 | 6154 | return ''; |
6155 | 6155 | } |
6156 | 6156 | |
6157 | - return (string) \mb_substr($str, 0, $offset); |
|
6157 | + return (string)\mb_substr($str, 0, $offset); |
|
6158 | 6158 | } |
6159 | 6159 | |
6160 | 6160 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6162,7 +6162,7 @@ discard block |
||
6162 | 6162 | return ''; |
6163 | 6163 | } |
6164 | 6164 | |
6165 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6165 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6166 | 6166 | } |
6167 | 6167 | |
6168 | 6168 | /** |
@@ -6250,12 +6250,12 @@ discard block |
||
6250 | 6250 | } |
6251 | 6251 | |
6252 | 6252 | if ($encoding === 'UTF-8') { |
6253 | - return (string) \mb_substr($str, -$n); |
|
6253 | + return (string)\mb_substr($str, -$n); |
|
6254 | 6254 | } |
6255 | 6255 | |
6256 | 6256 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6257 | 6257 | |
6258 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6258 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6259 | 6259 | } |
6260 | 6260 | |
6261 | 6261 | /** |
@@ -6279,21 +6279,21 @@ discard block |
||
6279 | 6279 | } |
6280 | 6280 | |
6281 | 6281 | if ($encoding === 'UTF-8') { |
6282 | - if ((int) \mb_strlen($str) <= $length) { |
|
6282 | + if ((int)\mb_strlen($str) <= $length) { |
|
6283 | 6283 | return $str; |
6284 | 6284 | } |
6285 | 6285 | |
6286 | 6286 | /** @noinspection UnnecessaryCastingInspection */ |
6287 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($strAddOn)) . $strAddOn; |
|
6287 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($strAddOn)).$strAddOn; |
|
6288 | 6288 | } |
6289 | 6289 | |
6290 | 6290 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6291 | 6291 | |
6292 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6292 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6293 | 6293 | return $str; |
6294 | 6294 | } |
6295 | 6295 | |
6296 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($strAddOn), $encoding)) . $strAddOn; |
|
6296 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($strAddOn), $encoding)).$strAddOn; |
|
6297 | 6297 | } |
6298 | 6298 | |
6299 | 6299 | /** |
@@ -6318,12 +6318,12 @@ discard block |
||
6318 | 6318 | |
6319 | 6319 | if ($encoding === 'UTF-8') { |
6320 | 6320 | /** @noinspection UnnecessaryCastingInspection */ |
6321 | - if ((int) \mb_strlen($str) <= $length) { |
|
6321 | + if ((int)\mb_strlen($str) <= $length) { |
|
6322 | 6322 | return $str; |
6323 | 6323 | } |
6324 | 6324 | |
6325 | 6325 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6326 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6326 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6327 | 6327 | } |
6328 | 6328 | |
6329 | 6329 | $str = \mb_substr($str, 0, $length); |
@@ -6333,20 +6333,20 @@ discard block |
||
6333 | 6333 | $new_str = \implode(' ', $array); |
6334 | 6334 | |
6335 | 6335 | if ($new_str === '') { |
6336 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6336 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6337 | 6337 | } |
6338 | 6338 | } else { |
6339 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6339 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6340 | 6340 | return $str; |
6341 | 6341 | } |
6342 | 6342 | |
6343 | 6343 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6344 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6344 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6345 | 6345 | } |
6346 | 6346 | |
6347 | 6347 | $str = self::substr($str, 0, $length, $encoding); |
6348 | 6348 | if ($str === false) { |
6349 | - return '' . $strAddOn; |
|
6349 | + return ''.$strAddOn; |
|
6350 | 6350 | } |
6351 | 6351 | |
6352 | 6352 | $array = \explode(' ', $str); |
@@ -6354,11 +6354,11 @@ discard block |
||
6354 | 6354 | $new_str = \implode(' ', $array); |
6355 | 6355 | |
6356 | 6356 | if ($new_str === '') { |
6357 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6357 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6358 | 6358 | } |
6359 | 6359 | } |
6360 | 6360 | |
6361 | - return $new_str . $strAddOn; |
|
6361 | + return $new_str.$strAddOn; |
|
6362 | 6362 | } |
6363 | 6363 | |
6364 | 6364 | /** |
@@ -6376,7 +6376,7 @@ discard block |
||
6376 | 6376 | $longestCommonPrefix = ''; |
6377 | 6377 | |
6378 | 6378 | if ($encoding === 'UTF-8') { |
6379 | - $maxLength = (int) \min( |
|
6379 | + $maxLength = (int)\min( |
|
6380 | 6380 | \mb_strlen($str), |
6381 | 6381 | \mb_strlen($otherStr) |
6382 | 6382 | ); |
@@ -6397,7 +6397,7 @@ discard block |
||
6397 | 6397 | } else { |
6398 | 6398 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6399 | 6399 | |
6400 | - $maxLength = (int) \min( |
|
6400 | + $maxLength = (int)\min( |
|
6401 | 6401 | self::strlen($str, $encoding), |
6402 | 6402 | self::strlen($otherStr, $encoding) |
6403 | 6403 | ); |
@@ -6440,13 +6440,13 @@ discard block |
||
6440 | 6440 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6441 | 6441 | |
6442 | 6442 | if ($encoding === 'UTF-8') { |
6443 | - $strLength = (int) \mb_strlen($str); |
|
6444 | - $otherLength = (int) \mb_strlen($otherStr); |
|
6443 | + $strLength = (int)\mb_strlen($str); |
|
6444 | + $otherLength = (int)\mb_strlen($otherStr); |
|
6445 | 6445 | } else { |
6446 | 6446 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6447 | 6447 | |
6448 | - $strLength = (int) self::strlen($str, $encoding); |
|
6449 | - $otherLength = (int) self::strlen($otherStr, $encoding); |
|
6448 | + $strLength = (int)self::strlen($str, $encoding); |
|
6449 | + $otherLength = (int)self::strlen($otherStr, $encoding); |
|
6450 | 6450 | } |
6451 | 6451 | |
6452 | 6452 | // Return if either string is empty |
@@ -6499,10 +6499,10 @@ discard block |
||
6499 | 6499 | } |
6500 | 6500 | |
6501 | 6501 | if ($encoding === 'UTF-8') { |
6502 | - return (string) \mb_substr($str, $end - $len, $len); |
|
6502 | + return (string)\mb_substr($str, $end - $len, $len); |
|
6503 | 6503 | } |
6504 | 6504 | |
6505 | - return (string) self::substr($str, $end - $len, $len, $encoding); |
|
6505 | + return (string)self::substr($str, $end - $len, $len, $encoding); |
|
6506 | 6506 | } |
6507 | 6507 | |
6508 | 6508 | /** |
@@ -6521,7 +6521,7 @@ discard block |
||
6521 | 6521 | } |
6522 | 6522 | |
6523 | 6523 | if ($encoding === 'UTF-8') { |
6524 | - $maxLength = (int) \min( |
|
6524 | + $maxLength = (int)\min( |
|
6525 | 6525 | \mb_strlen($str, $encoding), |
6526 | 6526 | \mb_strlen($otherStr, $encoding) |
6527 | 6527 | ); |
@@ -6535,7 +6535,7 @@ discard block |
||
6535 | 6535 | && |
6536 | 6536 | $char === \mb_substr($otherStr, -$i, 1) |
6537 | 6537 | ) { |
6538 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6538 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6539 | 6539 | } else { |
6540 | 6540 | break; |
6541 | 6541 | } |
@@ -6543,7 +6543,7 @@ discard block |
||
6543 | 6543 | } else { |
6544 | 6544 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6545 | 6545 | |
6546 | - $maxLength = (int) \min( |
|
6546 | + $maxLength = (int)\min( |
|
6547 | 6547 | self::strlen($str, $encoding), |
6548 | 6548 | self::strlen($otherStr, $encoding) |
6549 | 6549 | ); |
@@ -6557,7 +6557,7 @@ discard block |
||
6557 | 6557 | && |
6558 | 6558 | $char === self::substr($otherStr, -$i, 1, $encoding) |
6559 | 6559 | ) { |
6560 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6560 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6561 | 6561 | } else { |
6562 | 6562 | break; |
6563 | 6563 | } |
@@ -6577,7 +6577,7 @@ discard block |
||
6577 | 6577 | */ |
6578 | 6578 | public static function str_matches_pattern(string $str, string $pattern): bool |
6579 | 6579 | { |
6580 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6580 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6581 | 6581 | } |
6582 | 6582 | |
6583 | 6583 | /** |
@@ -6594,7 +6594,7 @@ discard block |
||
6594 | 6594 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6595 | 6595 | { |
6596 | 6596 | // init |
6597 | - $length = (int) self::strlen($str, $encoding); |
|
6597 | + $length = (int)self::strlen($str, $encoding); |
|
6598 | 6598 | |
6599 | 6599 | if ($offset >= 0) { |
6600 | 6600 | return $length > $offset; |
@@ -6620,7 +6620,7 @@ discard block |
||
6620 | 6620 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6621 | 6621 | { |
6622 | 6622 | // init |
6623 | - $length = (int) self::strlen($str); |
|
6623 | + $length = (int)self::strlen($str); |
|
6624 | 6624 | |
6625 | 6625 | if ( |
6626 | 6626 | ($index >= 0 && $length <= $index) |
@@ -6659,7 +6659,7 @@ discard block |
||
6659 | 6659 | return $str; |
6660 | 6660 | } |
6661 | 6661 | |
6662 | - if ($pad_type !== (int) $pad_type) { |
|
6662 | + if ($pad_type !== (int)$pad_type) { |
|
6663 | 6663 | if ($pad_type === 'left') { |
6664 | 6664 | $pad_type = \STR_PAD_LEFT; |
6665 | 6665 | } elseif ($pad_type === 'right') { |
@@ -6668,23 +6668,23 @@ discard block |
||
6668 | 6668 | $pad_type = \STR_PAD_BOTH; |
6669 | 6669 | } else { |
6670 | 6670 | throw new \InvalidArgumentException( |
6671 | - 'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6671 | + 'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6672 | 6672 | ); |
6673 | 6673 | } |
6674 | 6674 | } |
6675 | 6675 | |
6676 | 6676 | if ($encoding === 'UTF-8') { |
6677 | - $str_length = (int) \mb_strlen($str); |
|
6677 | + $str_length = (int)\mb_strlen($str); |
|
6678 | 6678 | |
6679 | 6679 | if ($pad_length >= $str_length) { |
6680 | 6680 | switch ($pad_type) { |
6681 | 6681 | case \STR_PAD_LEFT: |
6682 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6682 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6683 | 6683 | |
6684 | 6684 | $diff = ($pad_length - $str_length); |
6685 | 6685 | |
6686 | - $pre = (string) \mb_substr( |
|
6687 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6686 | + $pre = (string)\mb_substr( |
|
6687 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6688 | 6688 | 0, |
6689 | 6689 | $diff |
6690 | 6690 | ); |
@@ -6695,16 +6695,16 @@ discard block |
||
6695 | 6695 | case \STR_PAD_BOTH: |
6696 | 6696 | $diff = ($pad_length - $str_length); |
6697 | 6697 | |
6698 | - $ps_length_left = (int) \floor($diff / 2); |
|
6698 | + $ps_length_left = (int)\floor($diff / 2); |
|
6699 | 6699 | |
6700 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6700 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6701 | 6701 | |
6702 | - $pre = (string) \mb_substr( |
|
6702 | + $pre = (string)\mb_substr( |
|
6703 | 6703 | \str_repeat($pad_string, $ps_length_left), |
6704 | 6704 | 0, |
6705 | 6705 | $ps_length_left |
6706 | 6706 | ); |
6707 | - $post = (string) \mb_substr( |
|
6707 | + $post = (string)\mb_substr( |
|
6708 | 6708 | \str_repeat($pad_string, $ps_length_right), |
6709 | 6709 | 0, |
6710 | 6710 | $ps_length_right |
@@ -6714,19 +6714,19 @@ discard block |
||
6714 | 6714 | |
6715 | 6715 | case \STR_PAD_RIGHT: |
6716 | 6716 | default: |
6717 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6717 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6718 | 6718 | |
6719 | 6719 | $diff = ($pad_length - $str_length); |
6720 | 6720 | |
6721 | - $post = (string) \mb_substr( |
|
6722 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6721 | + $post = (string)\mb_substr( |
|
6722 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6723 | 6723 | 0, |
6724 | 6724 | $diff |
6725 | 6725 | ); |
6726 | 6726 | $pre = ''; |
6727 | 6727 | } |
6728 | 6728 | |
6729 | - return $pre . $str . $post; |
|
6729 | + return $pre.$str.$post; |
|
6730 | 6730 | } |
6731 | 6731 | |
6732 | 6732 | return $str; |
@@ -6734,17 +6734,17 @@ discard block |
||
6734 | 6734 | |
6735 | 6735 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6736 | 6736 | |
6737 | - $str_length = (int) self::strlen($str, $encoding); |
|
6737 | + $str_length = (int)self::strlen($str, $encoding); |
|
6738 | 6738 | |
6739 | 6739 | if ($pad_length >= $str_length) { |
6740 | 6740 | switch ($pad_type) { |
6741 | 6741 | case \STR_PAD_LEFT: |
6742 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6742 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6743 | 6743 | |
6744 | 6744 | $diff = ($pad_length - $str_length); |
6745 | 6745 | |
6746 | - $pre = (string) self::substr( |
|
6747 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6746 | + $pre = (string)self::substr( |
|
6747 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6748 | 6748 | 0, |
6749 | 6749 | $diff, |
6750 | 6750 | $encoding |
@@ -6756,17 +6756,17 @@ discard block |
||
6756 | 6756 | case \STR_PAD_BOTH: |
6757 | 6757 | $diff = ($pad_length - $str_length); |
6758 | 6758 | |
6759 | - $ps_length_left = (int) \floor($diff / 2); |
|
6759 | + $ps_length_left = (int)\floor($diff / 2); |
|
6760 | 6760 | |
6761 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6761 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6762 | 6762 | |
6763 | - $pre = (string) self::substr( |
|
6763 | + $pre = (string)self::substr( |
|
6764 | 6764 | \str_repeat($pad_string, $ps_length_left), |
6765 | 6765 | 0, |
6766 | 6766 | $ps_length_left, |
6767 | 6767 | $encoding |
6768 | 6768 | ); |
6769 | - $post = (string) self::substr( |
|
6769 | + $post = (string)self::substr( |
|
6770 | 6770 | \str_repeat($pad_string, $ps_length_right), |
6771 | 6771 | 0, |
6772 | 6772 | $ps_length_right, |
@@ -6777,12 +6777,12 @@ discard block |
||
6777 | 6777 | |
6778 | 6778 | case \STR_PAD_RIGHT: |
6779 | 6779 | default: |
6780 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6780 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6781 | 6781 | |
6782 | 6782 | $diff = ($pad_length - $str_length); |
6783 | 6783 | |
6784 | - $post = (string) self::substr( |
|
6785 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6784 | + $post = (string)self::substr( |
|
6785 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6786 | 6786 | 0, |
6787 | 6787 | $diff, |
6788 | 6788 | $encoding |
@@ -6790,7 +6790,7 @@ discard block |
||
6790 | 6790 | $pre = ''; |
6791 | 6791 | } |
6792 | 6792 | |
6793 | - return $pre . $str . $post; |
|
6793 | + return $pre.$str.$post; |
|
6794 | 6794 | } |
6795 | 6795 | |
6796 | 6796 | return $str; |
@@ -6949,11 +6949,11 @@ discard block |
||
6949 | 6949 | } |
6950 | 6950 | |
6951 | 6951 | if ($search === '') { |
6952 | - return $str . $replacement; |
|
6952 | + return $str.$replacement; |
|
6953 | 6953 | } |
6954 | 6954 | |
6955 | 6955 | if (\strpos($str, $search) === 0) { |
6956 | - return $replacement . \substr($str, \strlen($search)); |
|
6956 | + return $replacement.\substr($str, \strlen($search)); |
|
6957 | 6957 | } |
6958 | 6958 | |
6959 | 6959 | return $str; |
@@ -6981,11 +6981,11 @@ discard block |
||
6981 | 6981 | } |
6982 | 6982 | |
6983 | 6983 | if ($search === '') { |
6984 | - return $str . $replacement; |
|
6984 | + return $str.$replacement; |
|
6985 | 6985 | } |
6986 | 6986 | |
6987 | 6987 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6988 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6988 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6989 | 6989 | } |
6990 | 6990 | |
6991 | 6991 | return $str; |
@@ -7014,7 +7014,7 @@ discard block |
||
7014 | 7014 | $subject, |
7015 | 7015 | $replace, |
7016 | 7016 | $pos, |
7017 | - (int) self::strlen($search) |
|
7017 | + (int)self::strlen($search) |
|
7018 | 7018 | ); |
7019 | 7019 | } |
7020 | 7020 | |
@@ -7046,7 +7046,7 @@ discard block |
||
7046 | 7046 | $subject, |
7047 | 7047 | $replace, |
7048 | 7048 | $pos, |
7049 | - (int) self::strlen($search) |
|
7049 | + (int)self::strlen($search) |
|
7050 | 7050 | ); |
7051 | 7051 | } |
7052 | 7052 | |
@@ -7066,7 +7066,7 @@ discard block |
||
7066 | 7066 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
7067 | 7067 | { |
7068 | 7068 | if ($encoding === 'UTF-8') { |
7069 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
7069 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
7070 | 7070 | /** @noinspection NonSecureShuffleUsageInspection */ |
7071 | 7071 | \shuffle($indexes); |
7072 | 7072 | |
@@ -7082,7 +7082,7 @@ discard block |
||
7082 | 7082 | } else { |
7083 | 7083 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7084 | 7084 | |
7085 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
7085 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
7086 | 7086 | /** @noinspection NonSecureShuffleUsageInspection */ |
7087 | 7087 | \shuffle($indexes); |
7088 | 7088 | |
@@ -7123,11 +7123,11 @@ discard block |
||
7123 | 7123 | ) { |
7124 | 7124 | if ($encoding === 'UTF-8') { |
7125 | 7125 | if ($end === null) { |
7126 | - $length = (int) \mb_strlen($str); |
|
7126 | + $length = (int)\mb_strlen($str); |
|
7127 | 7127 | } elseif ($end >= 0 && $end <= $start) { |
7128 | 7128 | return ''; |
7129 | 7129 | } elseif ($end < 0) { |
7130 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7130 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7131 | 7131 | } else { |
7132 | 7132 | $length = $end - $start; |
7133 | 7133 | } |
@@ -7138,11 +7138,11 @@ discard block |
||
7138 | 7138 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7139 | 7139 | |
7140 | 7140 | if ($end === null) { |
7141 | - $length = (int) self::strlen($str, $encoding); |
|
7141 | + $length = (int)self::strlen($str, $encoding); |
|
7142 | 7142 | } elseif ($end >= 0 && $end <= $start) { |
7143 | 7143 | return ''; |
7144 | 7144 | } elseif ($end < 0) { |
7145 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7145 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7146 | 7146 | } else { |
7147 | 7147 | $length = $end - $start; |
7148 | 7148 | } |
@@ -7174,35 +7174,35 @@ discard block |
||
7174 | 7174 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7175 | 7175 | } |
7176 | 7176 | |
7177 | - $str = (string) \preg_replace_callback( |
|
7177 | + $str = (string)\preg_replace_callback( |
|
7178 | 7178 | '/([\d|\p{Lu}])/u', |
7179 | 7179 | /** |
7180 | 7180 | * @param string[] $matches |
7181 | 7181 | * |
7182 | 7182 | * @return string |
7183 | 7183 | */ |
7184 | - static function (array $matches) use ($encoding): string { |
|
7184 | + static function(array $matches) use ($encoding): string { |
|
7185 | 7185 | $match = $matches[1]; |
7186 | - $matchInt = (int) $match; |
|
7186 | + $matchInt = (int)$match; |
|
7187 | 7187 | |
7188 | - if ((string) $matchInt === $match) { |
|
7189 | - return '_' . $match . '_'; |
|
7188 | + if ((string)$matchInt === $match) { |
|
7189 | + return '_'.$match.'_'; |
|
7190 | 7190 | } |
7191 | 7191 | |
7192 | 7192 | if ($encoding === 'UTF-8') { |
7193 | - return '_' . \mb_strtolower($match); |
|
7193 | + return '_'.\mb_strtolower($match); |
|
7194 | 7194 | } |
7195 | 7195 | |
7196 | - return '_' . self::strtolower($match, $encoding); |
|
7196 | + return '_'.self::strtolower($match, $encoding); |
|
7197 | 7197 | }, |
7198 | 7198 | $str |
7199 | 7199 | ); |
7200 | 7200 | |
7201 | - $str = (string) \preg_replace( |
|
7201 | + $str = (string)\preg_replace( |
|
7202 | 7202 | [ |
7203 | - '/\s+/u', // convert spaces to "_" |
|
7204 | - '/^\s+|\s+$/u', // trim leading & trailing spaces |
|
7205 | - '/_+/', // remove double "_" |
|
7203 | + '/\s+/u', // convert spaces to "_" |
|
7204 | + '/^\s+|\s+$/u', // trim leading & trailing spaces |
|
7205 | + '/_+/', // remove double "_" |
|
7206 | 7206 | ], |
7207 | 7207 | [ |
7208 | 7208 | '_', |
@@ -7309,7 +7309,7 @@ discard block |
||
7309 | 7309 | $limit = -1; |
7310 | 7310 | } |
7311 | 7311 | |
7312 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7312 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7313 | 7313 | |
7314 | 7314 | if ($array === false) { |
7315 | 7315 | return []; |
@@ -7385,9 +7385,9 @@ discard block |
||
7385 | 7385 | return ''; |
7386 | 7386 | } |
7387 | 7387 | |
7388 | - return (string) \mb_substr( |
|
7388 | + return (string)\mb_substr( |
|
7389 | 7389 | $str, |
7390 | - $offset + (int) \mb_strlen($separator) |
|
7390 | + $offset + (int)\mb_strlen($separator) |
|
7391 | 7391 | ); |
7392 | 7392 | } |
7393 | 7393 | |
@@ -7396,9 +7396,9 @@ discard block |
||
7396 | 7396 | return ''; |
7397 | 7397 | } |
7398 | 7398 | |
7399 | - return (string) \mb_substr( |
|
7399 | + return (string)\mb_substr( |
|
7400 | 7400 | $str, |
7401 | - $offset + (int) self::strlen($separator, $encoding), |
|
7401 | + $offset + (int)self::strlen($separator, $encoding), |
|
7402 | 7402 | null, |
7403 | 7403 | $encoding |
7404 | 7404 | ); |
@@ -7425,9 +7425,9 @@ discard block |
||
7425 | 7425 | return ''; |
7426 | 7426 | } |
7427 | 7427 | |
7428 | - return (string) \mb_substr( |
|
7428 | + return (string)\mb_substr( |
|
7429 | 7429 | $str, |
7430 | - $offset + (int) \mb_strlen($separator) |
|
7430 | + $offset + (int)\mb_strlen($separator) |
|
7431 | 7431 | ); |
7432 | 7432 | } |
7433 | 7433 | |
@@ -7436,9 +7436,9 @@ discard block |
||
7436 | 7436 | return ''; |
7437 | 7437 | } |
7438 | 7438 | |
7439 | - return (string) self::substr( |
|
7439 | + return (string)self::substr( |
|
7440 | 7440 | $str, |
7441 | - $offset + (int) self::strlen($separator, $encoding), |
|
7441 | + $offset + (int)self::strlen($separator, $encoding), |
|
7442 | 7442 | null, |
7443 | 7443 | $encoding |
7444 | 7444 | ); |
@@ -7468,7 +7468,7 @@ discard block |
||
7468 | 7468 | return ''; |
7469 | 7469 | } |
7470 | 7470 | |
7471 | - return (string) \mb_substr( |
|
7471 | + return (string)\mb_substr( |
|
7472 | 7472 | $str, |
7473 | 7473 | 0, |
7474 | 7474 | $offset |
@@ -7480,7 +7480,7 @@ discard block |
||
7480 | 7480 | return ''; |
7481 | 7481 | } |
7482 | 7482 | |
7483 | - return (string) self::substr( |
|
7483 | + return (string)self::substr( |
|
7484 | 7484 | $str, |
7485 | 7485 | 0, |
7486 | 7486 | $offset, |
@@ -7509,7 +7509,7 @@ discard block |
||
7509 | 7509 | return ''; |
7510 | 7510 | } |
7511 | 7511 | |
7512 | - return (string) \mb_substr( |
|
7512 | + return (string)\mb_substr( |
|
7513 | 7513 | $str, |
7514 | 7514 | 0, |
7515 | 7515 | $offset |
@@ -7523,7 +7523,7 @@ discard block |
||
7523 | 7523 | |
7524 | 7524 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7525 | 7525 | |
7526 | - return (string) self::substr( |
|
7526 | + return (string)self::substr( |
|
7527 | 7527 | $str, |
7528 | 7528 | 0, |
7529 | 7529 | $offset, |
@@ -7631,7 +7631,7 @@ discard block |
||
7631 | 7631 | */ |
7632 | 7632 | public static function str_surround(string $str, string $substring): string |
7633 | 7633 | { |
7634 | - return $substring . $str . $substring; |
|
7634 | + return $substring.$str.$substring; |
|
7635 | 7635 | } |
7636 | 7636 | |
7637 | 7637 | /** |
@@ -7675,9 +7675,9 @@ discard block |
||
7675 | 7675 | |
7676 | 7676 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
7677 | 7677 | |
7678 | - return (string) \preg_replace_callback( |
|
7678 | + return (string)\preg_replace_callback( |
|
7679 | 7679 | '/([\S]+)/u', |
7680 | - static function (array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7680 | + static function(array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7681 | 7681 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
7682 | 7682 | return $match[0]; |
7683 | 7683 | } |
@@ -7763,16 +7763,16 @@ discard block |
||
7763 | 7763 | } |
7764 | 7764 | |
7765 | 7765 | // the main substitutions |
7766 | - $str = (string) \preg_replace_callback( |
|
7766 | + $str = (string)\preg_replace_callback( |
|
7767 | 7767 | '~\b (_*) (?: # 1. Leading underscore and |
7768 | 7768 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
7769 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
7769 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
7770 | 7770 | | |
7771 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
7771 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
7772 | 7772 | | |
7773 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
7773 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
7774 | 7774 | | |
7775 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
7775 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
7776 | 7776 | ) (_*) \b # 6. With trailing underscore |
7777 | 7777 | ~ux', |
7778 | 7778 | /** |
@@ -7780,7 +7780,7 @@ discard block |
||
7780 | 7780 | * |
7781 | 7781 | * @return string |
7782 | 7782 | */ |
7783 | - static function (array $matches) use ($encoding): string { |
|
7783 | + static function(array $matches) use ($encoding): string { |
|
7784 | 7784 | // preserve leading underscore |
7785 | 7785 | $str = $matches[1]; |
7786 | 7786 | if ($matches[2]) { |
@@ -7805,26 +7805,26 @@ discard block |
||
7805 | 7805 | ); |
7806 | 7806 | |
7807 | 7807 | // Exceptions for small words: capitalize at start of title... |
7808 | - $str = (string) \preg_replace_callback( |
|
7808 | + $str = (string)\preg_replace_callback( |
|
7809 | 7809 | '~( \A [[:punct:]]* # start of title... |
7810 | 7810 | | [:.;?!][ ]+ # or of subsentence... |
7811 | 7811 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
7812 | - ( ' . $smallWordsRx . ' ) \b # ...followed by small word |
|
7812 | + ( ' . $smallWordsRx.' ) \b # ...followed by small word |
|
7813 | 7813 | ~uxi', |
7814 | 7814 | /** |
7815 | 7815 | * @param string[] $matches |
7816 | 7816 | * |
7817 | 7817 | * @return string |
7818 | 7818 | */ |
7819 | - static function (array $matches) use ($encoding): string { |
|
7820 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7819 | + static function(array $matches) use ($encoding): string { |
|
7820 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7821 | 7821 | }, |
7822 | 7822 | $str |
7823 | 7823 | ); |
7824 | 7824 | |
7825 | 7825 | // ...and end of title |
7826 | - $str = (string) \preg_replace_callback( |
|
7827 | - '~\b ( ' . $smallWordsRx . ' ) # small word... |
|
7826 | + $str = (string)\preg_replace_callback( |
|
7827 | + '~\b ( '.$smallWordsRx.' ) # small word... |
|
7828 | 7828 | (?= [[:punct:]]* \Z # ...at the end of the title... |
7829 | 7829 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
7830 | 7830 | ~uxi', |
@@ -7833,7 +7833,7 @@ discard block |
||
7833 | 7833 | * |
7834 | 7834 | * @return string |
7835 | 7835 | */ |
7836 | - static function (array $matches) use ($encoding): string { |
|
7836 | + static function(array $matches) use ($encoding): string { |
|
7837 | 7837 | return static::str_upper_first($matches[1], $encoding); |
7838 | 7838 | }, |
7839 | 7839 | $str |
@@ -7841,10 +7841,10 @@ discard block |
||
7841 | 7841 | |
7842 | 7842 | // Exceptions for small words in hyphenated compound words. |
7843 | 7843 | // e.g. "in-flight" -> In-Flight |
7844 | - $str = (string) \preg_replace_callback( |
|
7844 | + $str = (string)\preg_replace_callback( |
|
7845 | 7845 | '~\b |
7846 | 7846 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
7847 | - ( ' . $smallWordsRx . ' ) |
|
7847 | + ( ' . $smallWordsRx.' ) |
|
7848 | 7848 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
7849 | 7849 | ~uxi', |
7850 | 7850 | /** |
@@ -7852,18 +7852,18 @@ discard block |
||
7852 | 7852 | * |
7853 | 7853 | * @return string |
7854 | 7854 | */ |
7855 | - static function (array $matches) use ($encoding): string { |
|
7855 | + static function(array $matches) use ($encoding): string { |
|
7856 | 7856 | return static::str_upper_first($matches[1], $encoding); |
7857 | 7857 | }, |
7858 | 7858 | $str |
7859 | 7859 | ); |
7860 | 7860 | |
7861 | 7861 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
7862 | - $str = (string) \preg_replace_callback( |
|
7862 | + $str = (string)\preg_replace_callback( |
|
7863 | 7863 | '~\b |
7864 | 7864 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
7865 | 7865 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
7866 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
7866 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
7867 | 7867 | (?! - ) # Negative lookahead for another - |
7868 | 7868 | ~uxi', |
7869 | 7869 | /** |
@@ -7871,8 +7871,8 @@ discard block |
||
7871 | 7871 | * |
7872 | 7872 | * @return string |
7873 | 7873 | */ |
7874 | - static function (array $matches) use ($encoding): string { |
|
7875 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7874 | + static function(array $matches) use ($encoding): string { |
|
7875 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7876 | 7876 | }, |
7877 | 7877 | $str |
7878 | 7878 | ); |
@@ -7975,7 +7975,7 @@ discard block |
||
7975 | 7975 | ); |
7976 | 7976 | |
7977 | 7977 | foreach ($tmpReturn as &$item) { |
7978 | - $item = (string) $item; |
|
7978 | + $item = (string)$item; |
|
7979 | 7979 | } |
7980 | 7980 | |
7981 | 7981 | return $tmpReturn; |
@@ -8020,39 +8020,39 @@ discard block |
||
8020 | 8020 | } |
8021 | 8021 | |
8022 | 8022 | if ($encoding === 'UTF-8') { |
8023 | - if ($length >= (int) \mb_strlen($str)) { |
|
8023 | + if ($length >= (int)\mb_strlen($str)) { |
|
8024 | 8024 | return $str; |
8025 | 8025 | } |
8026 | 8026 | |
8027 | 8027 | if ($substring !== '') { |
8028 | - $length -= (int) \mb_strlen($substring); |
|
8028 | + $length -= (int)\mb_strlen($substring); |
|
8029 | 8029 | |
8030 | 8030 | /** @noinspection UnnecessaryCastingInspection */ |
8031 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8031 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8032 | 8032 | } |
8033 | 8033 | |
8034 | 8034 | /** @noinspection UnnecessaryCastingInspection */ |
8035 | - return (string) \mb_substr($str, 0, $length); |
|
8035 | + return (string)\mb_substr($str, 0, $length); |
|
8036 | 8036 | } |
8037 | 8037 | |
8038 | 8038 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8039 | 8039 | |
8040 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8040 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8041 | 8041 | return $str; |
8042 | 8042 | } |
8043 | 8043 | |
8044 | 8044 | if ($substring !== '') { |
8045 | - $length -= (int) self::strlen($substring, $encoding); |
|
8045 | + $length -= (int)self::strlen($substring, $encoding); |
|
8046 | 8046 | } |
8047 | 8047 | |
8048 | 8048 | return ( |
8049 | - (string) self::substr( |
|
8049 | + (string)self::substr( |
|
8050 | 8050 | $str, |
8051 | 8051 | 0, |
8052 | 8052 | $length, |
8053 | 8053 | $encoding |
8054 | 8054 | ) |
8055 | - ) . $substring; |
|
8055 | + ).$substring; |
|
8056 | 8056 | } |
8057 | 8057 | |
8058 | 8058 | /** |
@@ -8082,12 +8082,12 @@ discard block |
||
8082 | 8082 | } |
8083 | 8083 | |
8084 | 8084 | if ($encoding === 'UTF-8') { |
8085 | - if ($length >= (int) \mb_strlen($str)) { |
|
8085 | + if ($length >= (int)\mb_strlen($str)) { |
|
8086 | 8086 | return $str; |
8087 | 8087 | } |
8088 | 8088 | |
8089 | 8089 | // need to further trim the string so we can append the substring |
8090 | - $length -= (int) \mb_strlen($substring); |
|
8090 | + $length -= (int)\mb_strlen($substring); |
|
8091 | 8091 | if ($length <= 0) { |
8092 | 8092 | return $substring; |
8093 | 8093 | } |
@@ -8109,18 +8109,18 @@ discard block |
||
8109 | 8109 | || |
8110 | 8110 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8111 | 8111 | ) { |
8112 | - $truncated = (string) \mb_substr($truncated, 0, (int) $lastPos); |
|
8112 | + $truncated = (string)\mb_substr($truncated, 0, (int)$lastPos); |
|
8113 | 8113 | } |
8114 | 8114 | } |
8115 | 8115 | } else { |
8116 | 8116 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8117 | 8117 | |
8118 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8118 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8119 | 8119 | return $str; |
8120 | 8120 | } |
8121 | 8121 | |
8122 | 8122 | // need to further trim the string so we can append the substring |
8123 | - $length -= (int) self::strlen($substring, $encoding); |
|
8123 | + $length -= (int)self::strlen($substring, $encoding); |
|
8124 | 8124 | if ($length <= 0) { |
8125 | 8125 | return $substring; |
8126 | 8126 | } |
@@ -8142,12 +8142,12 @@ discard block |
||
8142 | 8142 | || |
8143 | 8143 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8144 | 8144 | ) { |
8145 | - $truncated = (string) self::substr($truncated, 0, (int) $lastPos, $encoding); |
|
8145 | + $truncated = (string)self::substr($truncated, 0, (int)$lastPos, $encoding); |
|
8146 | 8146 | } |
8147 | 8147 | } |
8148 | 8148 | } |
8149 | 8149 | |
8150 | - return $truncated . $substring; |
|
8150 | + return $truncated.$substring; |
|
8151 | 8151 | } |
8152 | 8152 | |
8153 | 8153 | /** |
@@ -8237,13 +8237,13 @@ discard block |
||
8237 | 8237 | } |
8238 | 8238 | } elseif ($format === 2) { |
8239 | 8239 | $numberOfWords = []; |
8240 | - $offset = (int) self::strlen($strParts[0]); |
|
8240 | + $offset = (int)self::strlen($strParts[0]); |
|
8241 | 8241 | for ($i = 1; $i < $len; $i += 2) { |
8242 | 8242 | $numberOfWords[$offset] = $strParts[$i]; |
8243 | - $offset += (int) self::strlen($strParts[$i]) + (int) self::strlen($strParts[$i + 1]); |
|
8243 | + $offset += (int)self::strlen($strParts[$i]) + (int)self::strlen($strParts[$i + 1]); |
|
8244 | 8244 | } |
8245 | 8245 | } else { |
8246 | - $numberOfWords = (int) (($len - 1) / 2); |
|
8246 | + $numberOfWords = (int)(($len - 1) / 2); |
|
8247 | 8247 | } |
8248 | 8248 | |
8249 | 8249 | return $numberOfWords; |
@@ -8307,7 +8307,7 @@ discard block |
||
8307 | 8307 | */ |
8308 | 8308 | public static function strcmp(string $str1, string $str2): int |
8309 | 8309 | { |
8310 | - return $str1 . '' === $str2 . '' ? 0 : \strcmp( |
|
8310 | + return $str1.'' === $str2.'' ? 0 : \strcmp( |
|
8311 | 8311 | \Normalizer::normalize($str1, \Normalizer::NFD), |
8312 | 8312 | \Normalizer::normalize($str2, \Normalizer::NFD) |
8313 | 8313 | ); |
@@ -8336,21 +8336,21 @@ discard block |
||
8336 | 8336 | } |
8337 | 8337 | |
8338 | 8338 | if ($charList === '') { |
8339 | - return (int) self::strlen($str, $encoding); |
|
8339 | + return (int)self::strlen($str, $encoding); |
|
8340 | 8340 | } |
8341 | 8341 | |
8342 | 8342 | if ($offset !== null || $length !== null) { |
8343 | 8343 | if ($encoding === 'UTF-8') { |
8344 | 8344 | if ($length === null) { |
8345 | 8345 | /** @noinspection UnnecessaryCastingInspection */ |
8346 | - $strTmp = \mb_substr($str, (int) $offset); |
|
8346 | + $strTmp = \mb_substr($str, (int)$offset); |
|
8347 | 8347 | } else { |
8348 | 8348 | /** @noinspection UnnecessaryCastingInspection */ |
8349 | - $strTmp = \mb_substr($str, (int) $offset, $length); |
|
8349 | + $strTmp = \mb_substr($str, (int)$offset, $length); |
|
8350 | 8350 | } |
8351 | 8351 | } else { |
8352 | 8352 | /** @noinspection UnnecessaryCastingInspection */ |
8353 | - $strTmp = self::substr($str, (int) $offset, $length, $encoding); |
|
8353 | + $strTmp = self::substr($str, (int)$offset, $length, $encoding); |
|
8354 | 8354 | } |
8355 | 8355 | |
8356 | 8356 | if ($strTmp === false) { |
@@ -8365,7 +8365,7 @@ discard block |
||
8365 | 8365 | } |
8366 | 8366 | |
8367 | 8367 | $matches = []; |
8368 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $matches)) { |
|
8368 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $matches)) { |
|
8369 | 8369 | $return = self::strlen($matches[1], $encoding); |
8370 | 8370 | if ($return === false) { |
8371 | 8371 | return 0; |
@@ -8374,7 +8374,7 @@ discard block |
||
8374 | 8374 | return $return; |
8375 | 8375 | } |
8376 | 8376 | |
8377 | - return (int) self::strlen($str, $encoding); |
|
8377 | + return (int)self::strlen($str, $encoding); |
|
8378 | 8378 | } |
8379 | 8379 | |
8380 | 8380 | /** |
@@ -8496,7 +8496,7 @@ discard block |
||
8496 | 8496 | return ''; |
8497 | 8497 | } |
8498 | 8498 | |
8499 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
8499 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
8500 | 8500 | } |
8501 | 8501 | |
8502 | 8502 | /** |
@@ -8561,7 +8561,7 @@ discard block |
||
8561 | 8561 | // fallback for ascii only |
8562 | 8562 | // |
8563 | 8563 | |
8564 | - if (self::is_ascii($haystack . $needle)) { |
|
8564 | + if (self::is_ascii($haystack.$needle)) { |
|
8565 | 8565 | return \stripos($haystack, $needle, $offset); |
8566 | 8566 | } |
8567 | 8567 | |
@@ -8628,7 +8628,7 @@ discard block |
||
8628 | 8628 | && |
8629 | 8629 | self::$SUPPORT['mbstring'] === false |
8630 | 8630 | ) { |
8631 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8631 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8632 | 8632 | } |
8633 | 8633 | |
8634 | 8634 | if ( |
@@ -8642,11 +8642,11 @@ discard block |
||
8642 | 8642 | } |
8643 | 8643 | } |
8644 | 8644 | |
8645 | - if (self::is_ascii($needle . $haystack)) { |
|
8645 | + if (self::is_ascii($needle.$haystack)) { |
|
8646 | 8646 | return \stristr($haystack, $needle, $before_needle); |
8647 | 8647 | } |
8648 | 8648 | |
8649 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
8649 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
8650 | 8650 | |
8651 | 8651 | if (!isset($match[1])) { |
8652 | 8652 | return false; |
@@ -8656,7 +8656,7 @@ discard block |
||
8656 | 8656 | return $match[1]; |
8657 | 8657 | } |
8658 | 8658 | |
8659 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
8659 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
8660 | 8660 | } |
8661 | 8661 | |
8662 | 8662 | /** |
@@ -8723,7 +8723,7 @@ discard block |
||
8723 | 8723 | && |
8724 | 8724 | self::$SUPPORT['iconv'] === false |
8725 | 8725 | ) { |
8726 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8726 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8727 | 8727 | } |
8728 | 8728 | |
8729 | 8729 | // |
@@ -8834,7 +8834,7 @@ discard block |
||
8834 | 8834 | */ |
8835 | 8835 | public static function strnatcmp(string $str1, string $str2): int |
8836 | 8836 | { |
8837 | - return $str1 . '' === $str2 . '' ? 0 : \strnatcmp((string) self::strtonatfold($str1), (string) self::strtonatfold($str2)); |
|
8837 | + return $str1.'' === $str2.'' ? 0 : \strnatcmp((string)self::strtonatfold($str1), (string)self::strtonatfold($str2)); |
|
8838 | 8838 | } |
8839 | 8839 | |
8840 | 8840 | /** |
@@ -8891,11 +8891,11 @@ discard block |
||
8891 | 8891 | } |
8892 | 8892 | |
8893 | 8893 | if ($encoding === 'UTF-8') { |
8894 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
8895 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
8894 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
8895 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
8896 | 8896 | } else { |
8897 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
8898 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
8897 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
8898 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
8899 | 8899 | } |
8900 | 8900 | |
8901 | 8901 | return self::strcmp($str1, $str2); |
@@ -8917,8 +8917,8 @@ discard block |
||
8917 | 8917 | return false; |
8918 | 8918 | } |
8919 | 8919 | |
8920 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
8921 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
8920 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
8921 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
8922 | 8922 | } |
8923 | 8923 | |
8924 | 8924 | return false; |
@@ -8951,10 +8951,10 @@ discard block |
||
8951 | 8951 | } |
8952 | 8952 | |
8953 | 8953 | // iconv and mbstring do not support integer $needle |
8954 | - if ((int) $needle === $needle) { |
|
8955 | - $needle = (string) self::chr($needle); |
|
8954 | + if ((int)$needle === $needle) { |
|
8955 | + $needle = (string)self::chr($needle); |
|
8956 | 8956 | } |
8957 | - $needle = (string) $needle; |
|
8957 | + $needle = (string)$needle; |
|
8958 | 8958 | |
8959 | 8959 | if ($needle === '') { |
8960 | 8960 | return false; |
@@ -9001,7 +9001,7 @@ discard block |
||
9001 | 9001 | && |
9002 | 9002 | self::$SUPPORT['mbstring'] === false |
9003 | 9003 | ) { |
9004 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9004 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9005 | 9005 | } |
9006 | 9006 | |
9007 | 9007 | // |
@@ -9042,7 +9042,7 @@ discard block |
||
9042 | 9042 | // fallback for ascii only |
9043 | 9043 | // |
9044 | 9044 | |
9045 | - if (self::is_ascii($haystack . $needle)) { |
|
9045 | + if (self::is_ascii($haystack.$needle)) { |
|
9046 | 9046 | return \strpos($haystack, $needle, $offset); |
9047 | 9047 | } |
9048 | 9048 | |
@@ -9054,7 +9054,7 @@ discard block |
||
9054 | 9054 | if ($haystackTmp === false) { |
9055 | 9055 | $haystackTmp = ''; |
9056 | 9056 | } |
9057 | - $haystack = (string) $haystackTmp; |
|
9057 | + $haystack = (string)$haystackTmp; |
|
9058 | 9058 | |
9059 | 9059 | if ($offset < 0) { |
9060 | 9060 | $offset = 0; |
@@ -9066,7 +9066,7 @@ discard block |
||
9066 | 9066 | } |
9067 | 9067 | |
9068 | 9068 | if ($pos) { |
9069 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9069 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9070 | 9070 | } |
9071 | 9071 | |
9072 | 9072 | return $offset + 0; |
@@ -9177,7 +9177,7 @@ discard block |
||
9177 | 9177 | && |
9178 | 9178 | self::$SUPPORT['mbstring'] === false |
9179 | 9179 | ) { |
9180 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9180 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9181 | 9181 | } |
9182 | 9182 | |
9183 | 9183 | // |
@@ -9189,7 +9189,7 @@ discard block |
||
9189 | 9189 | if ($needleTmp === false) { |
9190 | 9190 | return false; |
9191 | 9191 | } |
9192 | - $needle = (string) $needleTmp; |
|
9192 | + $needle = (string)$needleTmp; |
|
9193 | 9193 | |
9194 | 9194 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
9195 | 9195 | if ($pos === false) { |
@@ -9211,7 +9211,7 @@ discard block |
||
9211 | 9211 | if ($needleTmp === false) { |
9212 | 9212 | return false; |
9213 | 9213 | } |
9214 | - $needle = (string) $needleTmp; |
|
9214 | + $needle = (string)$needleTmp; |
|
9215 | 9215 | |
9216 | 9216 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
9217 | 9217 | if ($pos === false) { |
@@ -9247,7 +9247,7 @@ discard block |
||
9247 | 9247 | if ($encoding === 'UTF-8') { |
9248 | 9248 | if (self::$SUPPORT['intl'] === true) { |
9249 | 9249 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
9250 | - $i = (int) \grapheme_strlen($str); |
|
9250 | + $i = (int)\grapheme_strlen($str); |
|
9251 | 9251 | while ($i--) { |
9252 | 9252 | $reversedTmp = \grapheme_substr($str, $i, 1); |
9253 | 9253 | if ($reversedTmp !== false) { |
@@ -9255,7 +9255,7 @@ discard block |
||
9255 | 9255 | } |
9256 | 9256 | } |
9257 | 9257 | } else { |
9258 | - $i = (int) \mb_strlen($str); |
|
9258 | + $i = (int)\mb_strlen($str); |
|
9259 | 9259 | while ($i--) { |
9260 | 9260 | $reversedTmp = \mb_substr($str, $i, 1); |
9261 | 9261 | if ($reversedTmp !== false) { |
@@ -9266,7 +9266,7 @@ discard block |
||
9266 | 9266 | } else { |
9267 | 9267 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9268 | 9268 | |
9269 | - $i = (int) self::strlen($str, $encoding); |
|
9269 | + $i = (int)self::strlen($str, $encoding); |
|
9270 | 9270 | while ($i--) { |
9271 | 9271 | $reversedTmp = self::substr($str, $i, 1, $encoding); |
9272 | 9272 | if ($reversedTmp !== false) { |
@@ -9340,7 +9340,7 @@ discard block |
||
9340 | 9340 | if ($needleTmp === false) { |
9341 | 9341 | return false; |
9342 | 9342 | } |
9343 | - $needle = (string) $needleTmp; |
|
9343 | + $needle = (string)$needleTmp; |
|
9344 | 9344 | |
9345 | 9345 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
9346 | 9346 | if ($pos === false) { |
@@ -9379,10 +9379,10 @@ discard block |
||
9379 | 9379 | } |
9380 | 9380 | |
9381 | 9381 | // iconv and mbstring do not support integer $needle |
9382 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9383 | - $needle = (string) self::chr($needle); |
|
9382 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9383 | + $needle = (string)self::chr($needle); |
|
9384 | 9384 | } |
9385 | - $needle = (string) $needle; |
|
9385 | + $needle = (string)$needle; |
|
9386 | 9386 | |
9387 | 9387 | if ($needle === '') { |
9388 | 9388 | return false; |
@@ -9427,7 +9427,7 @@ discard block |
||
9427 | 9427 | && |
9428 | 9428 | self::$SUPPORT['mbstring'] === false |
9429 | 9429 | ) { |
9430 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9430 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9431 | 9431 | } |
9432 | 9432 | |
9433 | 9433 | // |
@@ -9451,7 +9451,7 @@ discard block |
||
9451 | 9451 | // fallback for ascii only |
9452 | 9452 | // |
9453 | 9453 | |
9454 | - if (self::is_ascii($haystack . $needle)) { |
|
9454 | + if (self::is_ascii($haystack.$needle)) { |
|
9455 | 9455 | return \strripos($haystack, $needle, $offset); |
9456 | 9456 | } |
9457 | 9457 | |
@@ -9527,10 +9527,10 @@ discard block |
||
9527 | 9527 | } |
9528 | 9528 | |
9529 | 9529 | // iconv and mbstring do not support integer $needle |
9530 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9531 | - $needle = (string) self::chr($needle); |
|
9530 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9531 | + $needle = (string)self::chr($needle); |
|
9532 | 9532 | } |
9533 | - $needle = (string) $needle; |
|
9533 | + $needle = (string)$needle; |
|
9534 | 9534 | |
9535 | 9535 | if ($needle === '') { |
9536 | 9536 | return false; |
@@ -9575,7 +9575,7 @@ discard block |
||
9575 | 9575 | && |
9576 | 9576 | self::$SUPPORT['mbstring'] === false |
9577 | 9577 | ) { |
9578 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9578 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9579 | 9579 | } |
9580 | 9580 | |
9581 | 9581 | // |
@@ -9599,7 +9599,7 @@ discard block |
||
9599 | 9599 | // fallback for ascii only |
9600 | 9600 | // |
9601 | 9601 | |
9602 | - if (self::is_ascii($haystack . $needle)) { |
|
9602 | + if (self::is_ascii($haystack.$needle)) { |
|
9603 | 9603 | return \strrpos($haystack, $needle, $offset); |
9604 | 9604 | } |
9605 | 9605 | |
@@ -9619,7 +9619,7 @@ discard block |
||
9619 | 9619 | if ($haystackTmp === false) { |
9620 | 9620 | $haystackTmp = ''; |
9621 | 9621 | } |
9622 | - $haystack = (string) $haystackTmp; |
|
9622 | + $haystack = (string)$haystackTmp; |
|
9623 | 9623 | } |
9624 | 9624 | |
9625 | 9625 | $pos = \strrpos($haystack, $needle); |
@@ -9632,7 +9632,7 @@ discard block |
||
9632 | 9632 | return false; |
9633 | 9633 | } |
9634 | 9634 | |
9635 | - return $offset + (int) self::strlen($strTmp); |
|
9635 | + return $offset + (int)self::strlen($strTmp); |
|
9636 | 9636 | } |
9637 | 9637 | |
9638 | 9638 | /** |
@@ -9692,12 +9692,12 @@ discard block |
||
9692 | 9692 | if ($offset || $length !== null) { |
9693 | 9693 | if ($encoding === 'UTF-8') { |
9694 | 9694 | if ($length === null) { |
9695 | - $str = (string) \mb_substr($str, $offset); |
|
9695 | + $str = (string)\mb_substr($str, $offset); |
|
9696 | 9696 | } else { |
9697 | - $str = (string) \mb_substr($str, $offset, $length); |
|
9697 | + $str = (string)\mb_substr($str, $offset, $length); |
|
9698 | 9698 | } |
9699 | 9699 | } else { |
9700 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
9700 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
9701 | 9701 | } |
9702 | 9702 | } |
9703 | 9703 | |
@@ -9707,7 +9707,7 @@ discard block |
||
9707 | 9707 | |
9708 | 9708 | $matches = []; |
9709 | 9709 | |
9710 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
9710 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
9711 | 9711 | } |
9712 | 9712 | |
9713 | 9713 | /** |
@@ -9776,7 +9776,7 @@ discard block |
||
9776 | 9776 | && |
9777 | 9777 | self::$SUPPORT['mbstring'] === false |
9778 | 9778 | ) { |
9779 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9779 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9780 | 9780 | } |
9781 | 9781 | |
9782 | 9782 | // |
@@ -9798,7 +9798,7 @@ discard block |
||
9798 | 9798 | // fallback for ascii only |
9799 | 9799 | // |
9800 | 9800 | |
9801 | - if (self::is_ascii($haystack . $needle)) { |
|
9801 | + if (self::is_ascii($haystack.$needle)) { |
|
9802 | 9802 | return \strstr($haystack, $needle, $before_needle); |
9803 | 9803 | } |
9804 | 9804 | |
@@ -9806,7 +9806,7 @@ discard block |
||
9806 | 9806 | // fallback via vanilla php |
9807 | 9807 | // |
9808 | 9808 | |
9809 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
9809 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
9810 | 9810 | |
9811 | 9811 | if (!isset($match[1])) { |
9812 | 9812 | return false; |
@@ -9816,7 +9816,7 @@ discard block |
||
9816 | 9816 | return $match[1]; |
9817 | 9817 | } |
9818 | 9818 | |
9819 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
9819 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
9820 | 9820 | } |
9821 | 9821 | |
9822 | 9822 | /** |
@@ -9930,7 +9930,7 @@ discard block |
||
9930 | 9930 | bool $tryToKeepStringLength = false |
9931 | 9931 | ): string { |
9932 | 9932 | // init |
9933 | - $str = (string) $str; |
|
9933 | + $str = (string)$str; |
|
9934 | 9934 | |
9935 | 9935 | if ($str === '') { |
9936 | 9936 | return ''; |
@@ -9959,19 +9959,19 @@ discard block |
||
9959 | 9959 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
9960 | 9960 | } |
9961 | 9961 | |
9962 | - $langCode = $lang . '-Lower'; |
|
9962 | + $langCode = $lang.'-Lower'; |
|
9963 | 9963 | if (!\in_array($langCode, self::$INTL_TRANSLITERATOR_LIST, true)) { |
9964 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, \E_USER_WARNING); |
|
9964 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, \E_USER_WARNING); |
|
9965 | 9965 | |
9966 | 9966 | $langCode = 'Any-Lower'; |
9967 | 9967 | } |
9968 | 9968 | |
9969 | 9969 | /** @noinspection PhpComposerExtensionStubsInspection */ |
9970 | 9970 | /** @noinspection UnnecessaryCastingInspection */ |
9971 | - return (string) \transliterator_transliterate($langCode, $str); |
|
9971 | + return (string)\transliterator_transliterate($langCode, $str); |
|
9972 | 9972 | } |
9973 | 9973 | |
9974 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
9974 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
9975 | 9975 | } |
9976 | 9976 | |
9977 | 9977 | // always fallback via symfony polyfill |
@@ -10000,7 +10000,7 @@ discard block |
||
10000 | 10000 | bool $tryToKeepStringLength = false |
10001 | 10001 | ): string { |
10002 | 10002 | // init |
10003 | - $str = (string) $str; |
|
10003 | + $str = (string)$str; |
|
10004 | 10004 | |
10005 | 10005 | if ($str === '') { |
10006 | 10006 | return ''; |
@@ -10029,19 +10029,19 @@ discard block |
||
10029 | 10029 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
10030 | 10030 | } |
10031 | 10031 | |
10032 | - $langCode = $lang . '-Upper'; |
|
10032 | + $langCode = $lang.'-Upper'; |
|
10033 | 10033 | if (!\in_array($langCode, self::$INTL_TRANSLITERATOR_LIST, true)) { |
10034 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
10034 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
10035 | 10035 | |
10036 | 10036 | $langCode = 'Any-Upper'; |
10037 | 10037 | } |
10038 | 10038 | |
10039 | 10039 | /** @noinspection PhpComposerExtensionStubsInspection */ |
10040 | 10040 | /** @noinspection UnnecessaryCastingInspection */ |
10041 | - return (string) \transliterator_transliterate($langCode, $str); |
|
10041 | + return (string)\transliterator_transliterate($langCode, $str); |
|
10042 | 10042 | } |
10043 | 10043 | |
10044 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
10044 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
10045 | 10045 | } |
10046 | 10046 | |
10047 | 10047 | // always fallback via symfony polyfill |
@@ -10085,7 +10085,7 @@ discard block |
||
10085 | 10085 | |
10086 | 10086 | $from = \array_combine($from, $to); |
10087 | 10087 | if ($from === false) { |
10088 | - 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) . ')'); |
|
10088 | + 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).')'); |
|
10089 | 10089 | } |
10090 | 10090 | } |
10091 | 10091 | |
@@ -10142,9 +10142,9 @@ discard block |
||
10142 | 10142 | } |
10143 | 10143 | |
10144 | 10144 | $wide = 0; |
10145 | - $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); |
|
10145 | + $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); |
|
10146 | 10146 | |
10147 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
10147 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
10148 | 10148 | } |
10149 | 10149 | |
10150 | 10150 | /** |
@@ -10244,9 +10244,9 @@ discard block |
||
10244 | 10244 | } |
10245 | 10245 | |
10246 | 10246 | if ($length === null) { |
10247 | - $length = (int) $str_length; |
|
10247 | + $length = (int)$str_length; |
|
10248 | 10248 | } else { |
10249 | - $length = (int) $length; |
|
10249 | + $length = (int)$length; |
|
10250 | 10250 | } |
10251 | 10251 | |
10252 | 10252 | if ( |
@@ -10254,7 +10254,7 @@ discard block |
||
10254 | 10254 | && |
10255 | 10255 | self::$SUPPORT['mbstring'] === false |
10256 | 10256 | ) { |
10257 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10257 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10258 | 10258 | } |
10259 | 10259 | |
10260 | 10260 | // |
@@ -10342,16 +10342,16 @@ discard block |
||
10342 | 10342 | ) { |
10343 | 10343 | if ($encoding === 'UTF-8') { |
10344 | 10344 | if ($length === null) { |
10345 | - $str1 = (string) \mb_substr($str1, $offset); |
|
10345 | + $str1 = (string)\mb_substr($str1, $offset); |
|
10346 | 10346 | } else { |
10347 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
10347 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
10348 | 10348 | } |
10349 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
10349 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
10350 | 10350 | } else { |
10351 | 10351 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10352 | 10352 | |
10353 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
10354 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
10353 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
10354 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
10355 | 10355 | } |
10356 | 10356 | } |
10357 | 10357 | |
@@ -10413,13 +10413,13 @@ discard block |
||
10413 | 10413 | if ($lengthTmp === false) { |
10414 | 10414 | return false; |
10415 | 10415 | } |
10416 | - $length = (int) $lengthTmp; |
|
10416 | + $length = (int)$lengthTmp; |
|
10417 | 10417 | } |
10418 | 10418 | |
10419 | 10419 | if ($encoding === 'UTF-8') { |
10420 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
10420 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
10421 | 10421 | } else { |
10422 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
10422 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
10423 | 10423 | } |
10424 | 10424 | } |
10425 | 10425 | |
@@ -10428,7 +10428,7 @@ discard block |
||
10428 | 10428 | && |
10429 | 10429 | self::$SUPPORT['mbstring'] === false |
10430 | 10430 | ) { |
10431 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10431 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10432 | 10432 | } |
10433 | 10433 | |
10434 | 10434 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10439,7 +10439,7 @@ discard block |
||
10439 | 10439 | return \mb_substr_count($haystack, $needle, $encoding); |
10440 | 10440 | } |
10441 | 10441 | |
10442 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10442 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10443 | 10443 | |
10444 | 10444 | return \count($matches); |
10445 | 10445 | } |
@@ -10486,7 +10486,7 @@ discard block |
||
10486 | 10486 | if ($lengthTmp === false) { |
10487 | 10487 | return false; |
10488 | 10488 | } |
10489 | - $length = (int) $lengthTmp; |
|
10489 | + $length = (int)$lengthTmp; |
|
10490 | 10490 | } |
10491 | 10491 | |
10492 | 10492 | if ( |
@@ -10507,7 +10507,7 @@ discard block |
||
10507 | 10507 | if ($haystackTmp === false) { |
10508 | 10508 | $haystackTmp = ''; |
10509 | 10509 | } |
10510 | - $haystack = (string) $haystackTmp; |
|
10510 | + $haystack = (string)$haystackTmp; |
|
10511 | 10511 | } |
10512 | 10512 | |
10513 | 10513 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10546,10 +10546,10 @@ discard block |
||
10546 | 10546 | |
10547 | 10547 | if ($encoding === 'UTF-8') { |
10548 | 10548 | if ($caseSensitive) { |
10549 | - return (int) \mb_substr_count($str, $substring); |
|
10549 | + return (int)\mb_substr_count($str, $substring); |
|
10550 | 10550 | } |
10551 | 10551 | |
10552 | - return (int) \mb_substr_count( |
|
10552 | + return (int)\mb_substr_count( |
|
10553 | 10553 | \mb_strtoupper($str), |
10554 | 10554 | \mb_strtoupper($substring) |
10555 | 10555 | |
@@ -10559,10 +10559,10 @@ discard block |
||
10559 | 10559 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10560 | 10560 | |
10561 | 10561 | if ($caseSensitive) { |
10562 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
10562 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
10563 | 10563 | } |
10564 | 10564 | |
10565 | - return (int) \mb_substr_count( |
|
10565 | + return (int)\mb_substr_count( |
|
10566 | 10566 | self::strtocasefold($str, true, false, $encoding, null, false), |
10567 | 10567 | self::strtocasefold($substring, true, false, $encoding, null, false), |
10568 | 10568 | $encoding |
@@ -10588,7 +10588,7 @@ discard block |
||
10588 | 10588 | } |
10589 | 10589 | |
10590 | 10590 | if (self::str_istarts_with($haystack, $needle) === true) { |
10591 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10591 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10592 | 10592 | } |
10593 | 10593 | |
10594 | 10594 | return $haystack; |
@@ -10645,7 +10645,7 @@ discard block |
||
10645 | 10645 | } |
10646 | 10646 | |
10647 | 10647 | if (self::str_iends_with($haystack, $needle) === true) { |
10648 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
10648 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
10649 | 10649 | } |
10650 | 10650 | |
10651 | 10651 | return $haystack; |
@@ -10670,7 +10670,7 @@ discard block |
||
10670 | 10670 | } |
10671 | 10671 | |
10672 | 10672 | if (self::str_starts_with($haystack, $needle) === true) { |
10673 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10673 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10674 | 10674 | } |
10675 | 10675 | |
10676 | 10676 | return $haystack; |
@@ -10722,7 +10722,7 @@ discard block |
||
10722 | 10722 | if (\is_array($offset) === true) { |
10723 | 10723 | $offset = \array_slice($offset, 0, $num); |
10724 | 10724 | foreach ($offset as &$valueTmp) { |
10725 | - $valueTmp = (int) $valueTmp === $valueTmp ? $valueTmp : 0; |
|
10725 | + $valueTmp = (int)$valueTmp === $valueTmp ? $valueTmp : 0; |
|
10726 | 10726 | } |
10727 | 10727 | unset($valueTmp); |
10728 | 10728 | } else { |
@@ -10735,7 +10735,7 @@ discard block |
||
10735 | 10735 | } elseif (\is_array($length) === true) { |
10736 | 10736 | $length = \array_slice($length, 0, $num); |
10737 | 10737 | foreach ($length as &$valueTmpV2) { |
10738 | - $valueTmpV2 = (int) $valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10738 | + $valueTmpV2 = (int)$valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10739 | 10739 | } |
10740 | 10740 | unset($valueTmpV2); |
10741 | 10741 | } else { |
@@ -10755,8 +10755,8 @@ discard block |
||
10755 | 10755 | } |
10756 | 10756 | |
10757 | 10757 | // init |
10758 | - $str = (string) $str; |
|
10759 | - $replacement = (string) $replacement; |
|
10758 | + $str = (string)$str; |
|
10759 | + $replacement = (string)$replacement; |
|
10760 | 10760 | |
10761 | 10761 | if (\is_array($length) === true) { |
10762 | 10762 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -10771,16 +10771,16 @@ discard block |
||
10771 | 10771 | } |
10772 | 10772 | |
10773 | 10773 | if (self::$SUPPORT['mbstring'] === true) { |
10774 | - $string_length = (int) self::strlen($str, $encoding); |
|
10774 | + $string_length = (int)self::strlen($str, $encoding); |
|
10775 | 10775 | |
10776 | 10776 | if ($offset < 0) { |
10777 | - $offset = (int) \max(0, $string_length + $offset); |
|
10777 | + $offset = (int)\max(0, $string_length + $offset); |
|
10778 | 10778 | } elseif ($offset > $string_length) { |
10779 | 10779 | $offset = $string_length; |
10780 | 10780 | } |
10781 | 10781 | |
10782 | 10782 | if ($length !== null && $length < 0) { |
10783 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
10783 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
10784 | 10784 | } elseif ($length === null || $length > $string_length) { |
10785 | 10785 | $length = $string_length; |
10786 | 10786 | } |
@@ -10791,9 +10791,9 @@ discard block |
||
10791 | 10791 | } |
10792 | 10792 | |
10793 | 10793 | /** @noinspection AdditionOperationOnArraysInspection */ |
10794 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
10795 | - $replacement . |
|
10796 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10794 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
10795 | + $replacement. |
|
10796 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10797 | 10797 | } |
10798 | 10798 | |
10799 | 10799 | // |
@@ -10802,8 +10802,7 @@ discard block |
||
10802 | 10802 | |
10803 | 10803 | if (self::is_ascii($str)) { |
10804 | 10804 | return ($length === null) ? |
10805 | - \substr_replace($str, $replacement, $offset) : |
|
10806 | - \substr_replace($str, $replacement, $offset, $length); |
|
10805 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
10807 | 10806 | } |
10808 | 10807 | |
10809 | 10808 | // |
@@ -10819,7 +10818,7 @@ discard block |
||
10819 | 10818 | // e.g.: non mbstring support + invalid chars |
10820 | 10819 | return ''; |
10821 | 10820 | } |
10822 | - $length = (int) $lengthTmp; |
|
10821 | + $length = (int)$lengthTmp; |
|
10823 | 10822 | } |
10824 | 10823 | |
10825 | 10824 | \array_splice($smatches[0], $offset, $length, $rmatches[0]); |
@@ -10854,14 +10853,14 @@ discard block |
||
10854 | 10853 | && |
10855 | 10854 | \substr($haystack, -\strlen($needle)) === $needle |
10856 | 10855 | ) { |
10857 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
10856 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
10858 | 10857 | } |
10859 | 10858 | |
10860 | 10859 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
10861 | - return (string) self::substr( |
|
10860 | + return (string)self::substr( |
|
10862 | 10861 | $haystack, |
10863 | 10862 | 0, |
10864 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
10863 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
10865 | 10864 | $encoding |
10866 | 10865 | ); |
10867 | 10866 | } |
@@ -10891,10 +10890,10 @@ discard block |
||
10891 | 10890 | } |
10892 | 10891 | |
10893 | 10892 | if ($encoding === 'UTF-8') { |
10894 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10893 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10895 | 10894 | } |
10896 | 10895 | |
10897 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10896 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10898 | 10897 | } |
10899 | 10898 | |
10900 | 10899 | /** |
@@ -11090,7 +11089,7 @@ discard block |
||
11090 | 11089 | // INFO: https://unicode.org/cldr/utility/character.jsp?a=%E2%84%8C |
11091 | 11090 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11092 | 11091 | /** @noinspection UnnecessaryCastingInspection */ |
11093 | - $str = (string) \transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11092 | + $str = (string)\transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11094 | 11093 | |
11095 | 11094 | // check again, if we only have ASCII, now ... |
11096 | 11095 | if (self::is_ascii($str) === true) { |
@@ -11213,7 +11212,7 @@ discard block |
||
11213 | 11212 | public static function to_boolean($str): bool |
11214 | 11213 | { |
11215 | 11214 | // init |
11216 | - $str = (string) $str; |
|
11215 | + $str = (string)$str; |
|
11217 | 11216 | |
11218 | 11217 | if ($str === '') { |
11219 | 11218 | return false; |
@@ -11241,10 +11240,10 @@ discard block |
||
11241 | 11240 | } |
11242 | 11241 | |
11243 | 11242 | if (\is_numeric($str)) { |
11244 | - return ((float) $str + 0) > 0; |
|
11243 | + return ((float)$str + 0) > 0; |
|
11245 | 11244 | } |
11246 | 11245 | |
11247 | - return (bool) \trim($str); |
|
11246 | + return (bool)\trim($str); |
|
11248 | 11247 | } |
11249 | 11248 | |
11250 | 11249 | /** |
@@ -11265,11 +11264,11 @@ discard block |
||
11265 | 11264 | |
11266 | 11265 | $fallback_char_escaped = \preg_quote($fallback_char, '/'); |
11267 | 11266 | |
11268 | - $string = (string) \preg_replace( |
|
11267 | + $string = (string)\preg_replace( |
|
11269 | 11268 | [ |
11270 | - '/[^' . $fallback_char_escaped . '\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
11271 | - '/[\s]+/u', // 2) convert spaces to $fallback_char |
|
11272 | - '/[' . $fallback_char_escaped . ']+/u', // 3) remove double $fallback_char's |
|
11269 | + '/[^'.$fallback_char_escaped.'\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
11270 | + '/[\s]+/u', // 2) convert spaces to $fallback_char |
|
11271 | + '/['.$fallback_char_escaped.']+/u', // 3) remove double $fallback_char's |
|
11273 | 11272 | ], |
11274 | 11273 | [ |
11275 | 11274 | '', |
@@ -11300,7 +11299,7 @@ discard block |
||
11300 | 11299 | return $str; |
11301 | 11300 | } |
11302 | 11301 | |
11303 | - $str = (string) $str; |
|
11302 | + $str = (string)$str; |
|
11304 | 11303 | if ($str === '') { |
11305 | 11304 | return ''; |
11306 | 11305 | } |
@@ -11347,7 +11346,7 @@ discard block |
||
11347 | 11346 | return $str; |
11348 | 11347 | } |
11349 | 11348 | |
11350 | - $str = (string) $str; |
|
11349 | + $str = (string)$str; |
|
11351 | 11350 | if ($str === '') { |
11352 | 11351 | return $str; |
11353 | 11352 | } |
@@ -11365,7 +11364,7 @@ discard block |
||
11365 | 11364 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
11366 | 11365 | |
11367 | 11366 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11368 | - $buf .= $c1 . $c2; |
|
11367 | + $buf .= $c1.$c2; |
|
11369 | 11368 | ++$i; |
11370 | 11369 | } else { // not valid UTF8 - convert it |
11371 | 11370 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11376,7 +11375,7 @@ discard block |
||
11376 | 11375 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
11377 | 11376 | |
11378 | 11377 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11379 | - $buf .= $c1 . $c2 . $c3; |
|
11378 | + $buf .= $c1.$c2.$c3; |
|
11380 | 11379 | $i += 2; |
11381 | 11380 | } else { // not valid UTF8 - convert it |
11382 | 11381 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11388,7 +11387,7 @@ discard block |
||
11388 | 11387 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
11389 | 11388 | |
11390 | 11389 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11391 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
11390 | + $buf .= $c1.$c2.$c3.$c4; |
|
11392 | 11391 | $i += 3; |
11393 | 11392 | } else { // not valid UTF8 - convert it |
11394 | 11393 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11414,13 +11413,13 @@ discard block |
||
11414 | 11413 | * |
11415 | 11414 | * @return string |
11416 | 11415 | */ |
11417 | - static function (array $matches): string { |
|
11416 | + static function(array $matches): string { |
|
11418 | 11417 | if (isset($matches[3])) { |
11419 | - $cp = (int) \hexdec($matches[3]); |
|
11418 | + $cp = (int)\hexdec($matches[3]); |
|
11420 | 11419 | } else { |
11421 | 11420 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
11422 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
11423 | - + (int) \hexdec($matches[2]) |
|
11421 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
11422 | + + (int)\hexdec($matches[2]) |
|
11424 | 11423 | + 0x10000 |
11425 | 11424 | - (0xD800 << 10) |
11426 | 11425 | - 0xDC00; |
@@ -11431,12 +11430,12 @@ discard block |
||
11431 | 11430 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
11432 | 11431 | |
11433 | 11432 | if ($cp < 0x80) { |
11434 | - return (string) self::chr($cp); |
|
11433 | + return (string)self::chr($cp); |
|
11435 | 11434 | } |
11436 | 11435 | |
11437 | 11436 | if ($cp < 0xA0) { |
11438 | 11437 | /** @noinspection UnnecessaryCastingInspection */ |
11439 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
11438 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
11440 | 11439 | } |
11441 | 11440 | |
11442 | 11441 | return self::decimal_to_chr($cp); |
@@ -11484,7 +11483,7 @@ discard block |
||
11484 | 11483 | |
11485 | 11484 | if (self::$SUPPORT['mbstring'] === true) { |
11486 | 11485 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11487 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
11486 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
11488 | 11487 | } |
11489 | 11488 | |
11490 | 11489 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -11521,15 +11520,15 @@ discard block |
||
11521 | 11520 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
11522 | 11521 | |
11523 | 11522 | if ($encoding === 'UTF-8') { |
11524 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
11523 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
11525 | 11524 | |
11526 | 11525 | if ($useMbFunction === true) { |
11527 | 11526 | $strPartOne = \mb_strtoupper( |
11528 | - (string) \mb_substr($str, 0, 1) |
|
11527 | + (string)\mb_substr($str, 0, 1) |
|
11529 | 11528 | ); |
11530 | 11529 | } else { |
11531 | 11530 | $strPartOne = self::strtoupper( |
11532 | - (string) \mb_substr($str, 0, 1), |
|
11531 | + (string)\mb_substr($str, 0, 1), |
|
11533 | 11532 | $encoding, |
11534 | 11533 | false, |
11535 | 11534 | $lang, |
@@ -11539,16 +11538,16 @@ discard block |
||
11539 | 11538 | } else { |
11540 | 11539 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11541 | 11540 | |
11542 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
11541 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
11543 | 11542 | |
11544 | 11543 | if ($useMbFunction === true) { |
11545 | 11544 | $strPartOne = \mb_strtoupper( |
11546 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
11545 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
11547 | 11546 | $encoding |
11548 | 11547 | ); |
11549 | 11548 | } else { |
11550 | 11549 | $strPartOne = self::strtoupper( |
11551 | - (string) self::substr($str, 0, 1, $encoding), |
|
11550 | + (string)self::substr($str, 0, 1, $encoding), |
|
11552 | 11551 | $encoding, |
11553 | 11552 | false, |
11554 | 11553 | $lang, |
@@ -11557,7 +11556,7 @@ discard block |
||
11557 | 11556 | } |
11558 | 11557 | } |
11559 | 11558 | |
11560 | - return $strPartOne . $strPartTwo; |
|
11559 | + return $strPartOne.$strPartTwo; |
|
11561 | 11560 | } |
11562 | 11561 | |
11563 | 11562 | /** |
@@ -11608,7 +11607,7 @@ discard block |
||
11608 | 11607 | $str = self::clean($str); |
11609 | 11608 | } |
11610 | 11609 | |
11611 | - $usePhpDefaultFunctions = !(bool) ($charlist . \implode('', $exceptions)); |
|
11610 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
11612 | 11611 | |
11613 | 11612 | if ( |
11614 | 11613 | $usePhpDefaultFunctions === true |
@@ -12010,7 +12009,7 @@ discard block |
||
12010 | 12009 | if ( |
12011 | 12010 | $keepUtf8Chars === true |
12012 | 12011 | && |
12013 | - self::strlen($return) >= (int) self::strlen($str_backup) |
|
12012 | + self::strlen($return) >= (int)self::strlen($str_backup) |
|
12014 | 12013 | ) { |
12015 | 12014 | return $str_backup; |
12016 | 12015 | } |
@@ -12088,17 +12087,17 @@ discard block |
||
12088 | 12087 | return ''; |
12089 | 12088 | } |
12090 | 12089 | |
12091 | - \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches); |
|
12090 | + \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches); |
|
12092 | 12091 | |
12093 | 12092 | if ( |
12094 | 12093 | !isset($matches[0]) |
12095 | 12094 | || |
12096 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
12095 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
12097 | 12096 | ) { |
12098 | 12097 | return $str; |
12099 | 12098 | } |
12100 | 12099 | |
12101 | - return \rtrim($matches[0]) . $strAddOn; |
|
12100 | + return \rtrim($matches[0]).$strAddOn; |
|
12102 | 12101 | } |
12103 | 12102 | |
12104 | 12103 | /** |
@@ -12169,7 +12168,7 @@ discard block |
||
12169 | 12168 | $strReturn .= $break; |
12170 | 12169 | } |
12171 | 12170 | |
12172 | - return $strReturn . \implode('', $chars); |
|
12171 | + return $strReturn.\implode('', $chars); |
|
12173 | 12172 | } |
12174 | 12173 | |
12175 | 12174 | /** |
@@ -12182,7 +12181,7 @@ discard block |
||
12182 | 12181 | */ |
12183 | 12182 | public static function wordwrap_per_line(string $str, int $limit): string |
12184 | 12183 | { |
12185 | - $strings = (array) \preg_split('/\\r\\n|\\r|\\n/', $str); |
|
12184 | + $strings = (array)\preg_split('/\\r\\n|\\r|\\n/', $str); |
|
12186 | 12185 | |
12187 | 12186 | $string = ''; |
12188 | 12187 | foreach ($strings as &$value) { |
@@ -12219,7 +12218,7 @@ discard block |
||
12219 | 12218 | |
12220 | 12219 | \uksort( |
12221 | 12220 | self::$EMOJI, |
12222 | - static function (string $a, string $b): int { |
|
12221 | + static function(string $a, string $b): int { |
|
12223 | 12222 | return \strlen($b) <=> \strlen($a); |
12224 | 12223 | } |
12225 | 12224 | ); |
@@ -12229,7 +12228,7 @@ discard block |
||
12229 | 12228 | |
12230 | 12229 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
12231 | 12230 | $tmpKey = \crc32($key); |
12232 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmpKey . '_-_' . \strrev((string) $tmpKey) . '_-_8FTU_ELBATROP_-_'; |
|
12231 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmpKey.'_-_'.\strrev((string)$tmpKey).'_-_8FTU_ELBATROP_-_'; |
|
12233 | 12232 | } |
12234 | 12233 | |
12235 | 12234 | return true; |
@@ -12292,7 +12291,7 @@ discard block |
||
12292 | 12291 | /** @noinspection PhpIncludeInspection */ |
12293 | 12292 | /** @noinspection UsingInclusionReturnValueInspection */ |
12294 | 12293 | /** @psalm-suppress UnresolvableInclude */ |
12295 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
12294 | + return include __DIR__.'/data/'.$file.'.php'; |
|
12296 | 12295 | } |
12297 | 12296 | |
12298 | 12297 | /** |
@@ -12304,7 +12303,7 @@ discard block |
||
12304 | 12303 | */ |
12305 | 12304 | private static function getDataIfExists(string $file) |
12306 | 12305 | { |
12307 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
12306 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
12308 | 12307 | if (\file_exists($file)) { |
12309 | 12308 | /** @noinspection PhpIncludeInspection */ |
12310 | 12309 | /** @noinspection UsingInclusionReturnValueInspection */ |
@@ -12329,7 +12328,7 @@ discard block |
||
12329 | 12328 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
12330 | 12329 | return \defined('MB_OVERLOAD_STRING') |
12331 | 12330 | && |
12332 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12331 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12333 | 12332 | } |
12334 | 12333 | |
12335 | 12334 | /** |
@@ -12379,7 +12378,7 @@ discard block |
||
12379 | 12378 | { |
12380 | 12379 | static $RX_CLASS_CACHE = []; |
12381 | 12380 | |
12382 | - $cacheKey = $s . $class; |
|
12381 | + $cacheKey = $s.$class; |
|
12383 | 12382 | |
12384 | 12383 | if (isset($RX_CLASS_CACHE[$cacheKey])) { |
12385 | 12384 | return $RX_CLASS_CACHE[$cacheKey]; |
@@ -12391,7 +12390,7 @@ discard block |
||
12391 | 12390 | /** @noinspection AlterInForeachInspection */ |
12392 | 12391 | foreach (self::str_split($s) as &$s) { |
12393 | 12392 | if ($s === '-') { |
12394 | - $classArray[0] = '-' . $classArray[0]; |
|
12393 | + $classArray[0] = '-'.$classArray[0]; |
|
12395 | 12394 | } elseif (!isset($s[2])) { |
12396 | 12395 | $classArray[0] .= \preg_quote($s, '/'); |
12397 | 12396 | } elseif (self::strlen($s) === 1) { |
@@ -12402,13 +12401,13 @@ discard block |
||
12402 | 12401 | } |
12403 | 12402 | |
12404 | 12403 | if ($classArray[0]) { |
12405 | - $classArray[0] = '[' . $classArray[0] . ']'; |
|
12404 | + $classArray[0] = '['.$classArray[0].']'; |
|
12406 | 12405 | } |
12407 | 12406 | |
12408 | 12407 | if (\count($classArray) === 1) { |
12409 | 12408 | $return = $classArray[0]; |
12410 | 12409 | } else { |
12411 | - $return = '(?:' . \implode('|', $classArray) . ')'; |
|
12410 | + $return = '(?:'.\implode('|', $classArray).')'; |
|
12412 | 12411 | } |
12413 | 12412 | |
12414 | 12413 | $RX_CLASS_CACHE[$cacheKey] = $return; |
@@ -12482,7 +12481,7 @@ discard block |
||
12482 | 12481 | $continue = false; |
12483 | 12482 | |
12484 | 12483 | if ($delimiter === '-') { |
12485 | - foreach ((array) $specialCases['names'] as &$beginning) { |
|
12484 | + foreach ((array)$specialCases['names'] as &$beginning) { |
|
12486 | 12485 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12487 | 12486 | $continue = true; |
12488 | 12487 | } |
@@ -12490,7 +12489,7 @@ discard block |
||
12490 | 12489 | unset($beginning); |
12491 | 12490 | } |
12492 | 12491 | |
12493 | - foreach ((array) $specialCases['prefixes'] as &$beginning) { |
|
12492 | + foreach ((array)$specialCases['prefixes'] as &$beginning) { |
|
12494 | 12493 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12495 | 12494 | $continue = true; |
12496 | 12495 | } |
@@ -12550,8 +12549,8 @@ discard block |
||
12550 | 12549 | $buf .= self::$WIN1252_TO_UTF8[$ordC1]; |
12551 | 12550 | } else { |
12552 | 12551 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
12553 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
12554 | - $buf .= $cc1 . $cc2; |
|
12552 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
12553 | + $buf .= $cc1.$cc2; |
|
12555 | 12554 | } |
12556 | 12555 | |
12557 | 12556 | return $buf; |