@@ -255,10 +255,10 @@ discard block |
||
255 | 255 | } |
256 | 256 | |
257 | 257 | if ($encoding === 'UTF-8') { |
258 | - return (string) \mb_substr($str, $pos, 1); |
|
258 | + return (string)\mb_substr($str, $pos, 1); |
|
259 | 259 | } |
260 | 260 | |
261 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
261 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | /** |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | public static function add_bom_to_string(string $str): string |
274 | 274 | { |
275 | 275 | if (self::string_has_bom($str) === false) { |
276 | - $str = self::bom() . $str; |
|
276 | + $str = self::bom().$str; |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | return $str; |
@@ -302,8 +302,8 @@ discard block |
||
302 | 302 | $return = []; |
303 | 303 | foreach ($array as $key => &$value) { |
304 | 304 | $key = $case === \CASE_LOWER |
305 | - ? self::strtolower((string) $key, $encoding) |
|
306 | - : self::strtoupper((string) $key, $encoding); |
|
305 | + ? self::strtolower((string)$key, $encoding) |
|
306 | + : self::strtoupper((string)$key, $encoding); |
|
307 | 307 | |
308 | 308 | $return[$key] = $value; |
309 | 309 | } |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | return ''; |
338 | 338 | } |
339 | 339 | |
340 | - $substrIndex = $posStart + (int) \mb_strlen($start); |
|
340 | + $substrIndex = $posStart + (int)\mb_strlen($start); |
|
341 | 341 | $posEnd = \mb_strpos($str, $end, $substrIndex); |
342 | 342 | if ( |
343 | 343 | $posEnd === false |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | return ''; |
348 | 348 | } |
349 | 349 | |
350 | - return (string) \mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
350 | + return (string)\mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | return ''; |
358 | 358 | } |
359 | 359 | |
360 | - $substrIndex = $posStart + (int) self::strlen($start, $encoding); |
|
360 | + $substrIndex = $posStart + (int)self::strlen($start, $encoding); |
|
361 | 361 | $posEnd = self::strpos($str, $end, $substrIndex, $encoding); |
362 | 362 | if ( |
363 | 363 | $posEnd === false |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | return ''; |
368 | 368 | } |
369 | 369 | |
370 | - return (string) self::substr( |
|
370 | + return (string)self::substr( |
|
371 | 371 | $str, |
372 | 372 | $substrIndex, |
373 | 373 | $posEnd - $substrIndex, |
@@ -435,10 +435,10 @@ discard block |
||
435 | 435 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
436 | 436 | { |
437 | 437 | if ($encoding === 'UTF-8') { |
438 | - return (string) \mb_substr($str, $index, 1); |
|
438 | + return (string)\mb_substr($str, $index, 1); |
|
439 | 439 | } |
440 | 440 | |
441 | - return (string) self::substr($str, $index, 1, $encoding); |
|
441 | + return (string)self::substr($str, $index, 1, $encoding); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | /** |
@@ -541,10 +541,10 @@ discard block |
||
541 | 541 | && |
542 | 542 | self::$SUPPORT['mbstring'] === false |
543 | 543 | ) { |
544 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
544 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
545 | 545 | } |
546 | 546 | |
547 | - $cacheKey = $code_point . $encoding; |
|
547 | + $cacheKey = $code_point.$encoding; |
|
548 | 548 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
549 | 549 | return $CHAR_CACHE[$cacheKey]; |
550 | 550 | } |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | if ($code_point <= 127) { // use "simple"-char only until "\x80" |
553 | 553 | |
554 | 554 | if (self::$CHR === null) { |
555 | - self::$CHR = (array) self::getData('chr'); |
|
555 | + self::$CHR = (array)self::getData('chr'); |
|
556 | 556 | } |
557 | 557 | |
558 | 558 | /** |
@@ -587,10 +587,10 @@ discard block |
||
587 | 587 | // |
588 | 588 | |
589 | 589 | if (self::$CHR === null) { |
590 | - self::$CHR = (array) self::getData('chr'); |
|
590 | + self::$CHR = (array)self::getData('chr'); |
|
591 | 591 | } |
592 | 592 | |
593 | - $code_point = (int) $code_point; |
|
593 | + $code_point = (int)$code_point; |
|
594 | 594 | if ($code_point <= 0x7F) { |
595 | 595 | /** |
596 | 596 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -600,22 +600,22 @@ discard block |
||
600 | 600 | /** |
601 | 601 | * @psalm-suppress PossiblyNullArrayAccess |
602 | 602 | */ |
603 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
603 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
604 | 604 | self::$CHR[($code_point & 0x3F) + 0x80]; |
605 | 605 | } elseif ($code_point <= 0xFFFF) { |
606 | 606 | /** |
607 | 607 | * @psalm-suppress PossiblyNullArrayAccess |
608 | 608 | */ |
609 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
610 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
609 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
610 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
611 | 611 | self::$CHR[($code_point & 0x3F) + 0x80]; |
612 | 612 | } else { |
613 | 613 | /** |
614 | 614 | * @psalm-suppress PossiblyNullArrayAccess |
615 | 615 | */ |
616 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
617 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
618 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
616 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
617 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
618 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
619 | 619 | self::$CHR[($code_point & 0x3F) + 0x80]; |
620 | 620 | } |
621 | 621 | |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | |
663 | 663 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
664 | 664 | return \array_map( |
665 | - static function (string $data): int { |
|
665 | + static function(string $data): int { |
|
666 | 666 | // "mb_" is available if overload is used, so use it ... |
667 | 667 | return \mb_strlen($data, 'CP850'); // 8-BIT |
668 | 668 | }, |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | $char = ''; |
731 | 731 | } |
732 | 732 | |
733 | - return self::int_to_hex(self::ord((string) $char), $pfix); |
|
733 | + return self::int_to_hex(self::ord((string)$char), $pfix); |
|
734 | 734 | } |
735 | 735 | |
736 | 736 | /** |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | | ( [\x80-\xBF] ) # invalid byte in range 10000000 - 10111111 |
805 | 805 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
806 | 806 | /x'; |
807 | - $str = (string) \preg_replace($regx, '$1', $str); |
|
807 | + $str = (string)\preg_replace($regx, '$1', $str); |
|
808 | 808 | |
809 | 809 | if ($replace_diamond_question_mark === true) { |
810 | 810 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | public static function cleanup($str): string |
840 | 840 | { |
841 | 841 | // init |
842 | - $str = (string) $str; |
|
842 | + $str = (string)$str; |
|
843 | 843 | |
844 | 844 | if ($str === '') { |
845 | 845 | return ''; |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | { |
923 | 923 | if (self::$SUPPORT['mbstring'] === true) { |
924 | 924 | /** @noinspection PhpComposerExtensionStubsInspection */ |
925 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
925 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | */ |
963 | 963 | public static function css_stripe_media_queries(string $str): string |
964 | 964 | { |
965 | - return (string) \preg_replace( |
|
965 | + return (string)\preg_replace( |
|
966 | 966 | '#@media\\s+(?:only\\s)?(?:[\\s{\\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#misU', |
967 | 967 | '', |
968 | 968 | $str |
@@ -989,7 +989,7 @@ discard block |
||
989 | 989 | */ |
990 | 990 | public static function decimal_to_chr($int): string |
991 | 991 | { |
992 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
992 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
993 | 993 | } |
994 | 994 | |
995 | 995 | /** |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | if ($toEncoding === 'JSON') { |
1069 | 1069 | $return = self::json_encode($str); |
1070 | 1070 | if ($return === false) { |
1071 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1071 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1072 | 1072 | } |
1073 | 1073 | |
1074 | 1074 | return $return; |
@@ -1154,7 +1154,7 @@ discard block |
||
1154 | 1154 | && |
1155 | 1155 | self::$SUPPORT['mbstring'] === false |
1156 | 1156 | ) { |
1157 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $toEncoding . '" encoding', \E_USER_WARNING); |
|
1157 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$toEncoding.'" encoding', \E_USER_WARNING); |
|
1158 | 1158 | } |
1159 | 1159 | |
1160 | 1160 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1248,31 +1248,31 @@ discard block |
||
1248 | 1248 | $trimChars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1249 | 1249 | |
1250 | 1250 | if ($length === null) { |
1251 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
1251 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
1252 | 1252 | } |
1253 | 1253 | |
1254 | 1254 | if ($search === '') { |
1255 | 1255 | if ($encoding === 'UTF-8') { |
1256 | 1256 | if ($length > 0) { |
1257 | - $stringLength = (int) \mb_strlen($str); |
|
1257 | + $stringLength = (int)\mb_strlen($str); |
|
1258 | 1258 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
1259 | 1259 | } else { |
1260 | 1260 | $end = 0; |
1261 | 1261 | } |
1262 | 1262 | |
1263 | - $pos = (int) \min( |
|
1263 | + $pos = (int)\min( |
|
1264 | 1264 | \mb_strpos($str, ' ', $end), |
1265 | 1265 | \mb_strpos($str, '.', $end) |
1266 | 1266 | ); |
1267 | 1267 | } else { |
1268 | 1268 | if ($length > 0) { |
1269 | - $stringLength = (int) self::strlen($str, $encoding); |
|
1269 | + $stringLength = (int)self::strlen($str, $encoding); |
|
1270 | 1270 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
1271 | 1271 | } else { |
1272 | 1272 | $end = 0; |
1273 | 1273 | } |
1274 | 1274 | |
1275 | - $pos = (int) \min( |
|
1275 | + $pos = (int)\min( |
|
1276 | 1276 | self::strpos($str, ' ', $end, $encoding), |
1277 | 1277 | self::strpos($str, '.', $end, $encoding) |
1278 | 1278 | ); |
@@ -1289,18 +1289,18 @@ discard block |
||
1289 | 1289 | return ''; |
1290 | 1290 | } |
1291 | 1291 | |
1292 | - return \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1292 | + return \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1293 | 1293 | } |
1294 | 1294 | |
1295 | 1295 | return $str; |
1296 | 1296 | } |
1297 | 1297 | |
1298 | 1298 | if ($encoding === 'UTF-8') { |
1299 | - $wordPos = (int) \mb_stripos($str, $search); |
|
1300 | - $halfSide = (int) ($wordPos - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1299 | + $wordPos = (int)\mb_stripos($str, $search); |
|
1300 | + $halfSide = (int)($wordPos - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1301 | 1301 | } else { |
1302 | - $wordPos = (int) self::stripos($str, $search, 0, $encoding); |
|
1303 | - $halfSide = (int) ($wordPos - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1302 | + $wordPos = (int)self::stripos($str, $search, 0, $encoding); |
|
1303 | + $halfSide = (int)($wordPos - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1304 | 1304 | } |
1305 | 1305 | |
1306 | 1306 | $pos_start = 0; |
@@ -1312,12 +1312,12 @@ discard block |
||
1312 | 1312 | } |
1313 | 1313 | if ($halfText !== false) { |
1314 | 1314 | if ($encoding === 'UTF-8') { |
1315 | - $pos_start = (int) \max( |
|
1315 | + $pos_start = (int)\max( |
|
1316 | 1316 | \mb_strrpos($halfText, ' '), |
1317 | 1317 | \mb_strrpos($halfText, '.') |
1318 | 1318 | ); |
1319 | 1319 | } else { |
1320 | - $pos_start = (int) \max( |
|
1320 | + $pos_start = (int)\max( |
|
1321 | 1321 | self::strrpos($halfText, ' ', 0, $encoding), |
1322 | 1322 | self::strrpos($halfText, '.', 0, $encoding) |
1323 | 1323 | ); |
@@ -1327,19 +1327,19 @@ discard block |
||
1327 | 1327 | |
1328 | 1328 | if ($wordPos && $halfSide > 0) { |
1329 | 1329 | $offset = $pos_start + $length - 1; |
1330 | - $realLength = (int) self::strlen($str, $encoding); |
|
1330 | + $realLength = (int)self::strlen($str, $encoding); |
|
1331 | 1331 | |
1332 | 1332 | if ($offset > $realLength) { |
1333 | 1333 | $offset = $realLength; |
1334 | 1334 | } |
1335 | 1335 | |
1336 | 1336 | if ($encoding === 'UTF-8') { |
1337 | - $pos_end = (int) \min( |
|
1337 | + $pos_end = (int)\min( |
|
1338 | 1338 | \mb_strpos($str, ' ', $offset), |
1339 | 1339 | \mb_strpos($str, '.', $offset) |
1340 | 1340 | ) - $pos_start; |
1341 | 1341 | } else { |
1342 | - $pos_end = (int) \min( |
|
1342 | + $pos_end = (int)\min( |
|
1343 | 1343 | self::strpos($str, ' ', $offset, $encoding), |
1344 | 1344 | self::strpos($str, '.', $offset, $encoding) |
1345 | 1345 | ) - $pos_start; |
@@ -1347,12 +1347,12 @@ discard block |
||
1347 | 1347 | |
1348 | 1348 | if (!$pos_end || $pos_end <= 0) { |
1349 | 1349 | if ($encoding === 'UTF-8') { |
1350 | - $strSub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1350 | + $strSub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1351 | 1351 | } else { |
1352 | - $strSub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1352 | + $strSub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1353 | 1353 | } |
1354 | 1354 | if ($strSub !== false) { |
1355 | - $extract = $replacerForSkippedText . \ltrim($strSub, $trimChars); |
|
1355 | + $extract = $replacerForSkippedText.\ltrim($strSub, $trimChars); |
|
1356 | 1356 | } else { |
1357 | 1357 | $extract = ''; |
1358 | 1358 | } |
@@ -1363,26 +1363,26 @@ discard block |
||
1363 | 1363 | $strSub = self::substr($str, $pos_start, $pos_end, $encoding); |
1364 | 1364 | } |
1365 | 1365 | if ($strSub !== false) { |
1366 | - $extract = $replacerForSkippedText . \trim($strSub, $trimChars) . $replacerForSkippedText; |
|
1366 | + $extract = $replacerForSkippedText.\trim($strSub, $trimChars).$replacerForSkippedText; |
|
1367 | 1367 | } else { |
1368 | 1368 | $extract = ''; |
1369 | 1369 | } |
1370 | 1370 | } |
1371 | 1371 | } else { |
1372 | 1372 | $offset = $length - 1; |
1373 | - $trueLength = (int) self::strlen($str, $encoding); |
|
1373 | + $trueLength = (int)self::strlen($str, $encoding); |
|
1374 | 1374 | |
1375 | 1375 | if ($offset > $trueLength) { |
1376 | 1376 | $offset = $trueLength; |
1377 | 1377 | } |
1378 | 1378 | |
1379 | 1379 | if ($encoding === 'UTF-8') { |
1380 | - $pos_end = (int) \min( |
|
1380 | + $pos_end = (int)\min( |
|
1381 | 1381 | \mb_strpos($str, ' ', $offset), |
1382 | 1382 | \mb_strpos($str, '.', $offset) |
1383 | 1383 | ); |
1384 | 1384 | } else { |
1385 | - $pos_end = (int) \min( |
|
1385 | + $pos_end = (int)\min( |
|
1386 | 1386 | self::strpos($str, ' ', $offset, $encoding), |
1387 | 1387 | self::strpos($str, '.', $offset, $encoding) |
1388 | 1388 | ); |
@@ -1395,7 +1395,7 @@ discard block |
||
1395 | 1395 | $strSub = self::substr($str, 0, $pos_end, $encoding); |
1396 | 1396 | } |
1397 | 1397 | if ($strSub !== false) { |
1398 | - $extract = \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1398 | + $extract = \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1399 | 1399 | } else { |
1400 | 1400 | $extract = ''; |
1401 | 1401 | } |
@@ -1515,7 +1515,7 @@ discard block |
||
1515 | 1515 | { |
1516 | 1516 | $file_content = \file_get_contents($file_path); |
1517 | 1517 | if ($file_content === false) { |
1518 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1518 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1519 | 1519 | } |
1520 | 1520 | |
1521 | 1521 | return self::string_has_bom($file_content); |
@@ -1576,7 +1576,7 @@ discard block |
||
1576 | 1576 | ) { |
1577 | 1577 | // Prevent leading combining chars |
1578 | 1578 | // for NFC-safe concatenations. |
1579 | - $var = $leading_combining . $var; |
|
1579 | + $var = $leading_combining.$var; |
|
1580 | 1580 | } |
1581 | 1581 | } |
1582 | 1582 | |
@@ -1815,10 +1815,10 @@ discard block |
||
1815 | 1815 | } |
1816 | 1816 | |
1817 | 1817 | if ($encoding === 'UTF-8') { |
1818 | - return (string) \mb_substr($str, 0, $n); |
|
1818 | + return (string)\mb_substr($str, 0, $n); |
|
1819 | 1819 | } |
1820 | 1820 | |
1821 | - return (string) self::substr($str, 0, $n, $encoding); |
|
1821 | + return (string)self::substr($str, 0, $n, $encoding); |
|
1822 | 1822 | } |
1823 | 1823 | |
1824 | 1824 | /** |
@@ -1893,7 +1893,7 @@ discard block |
||
1893 | 1893 | return $str; |
1894 | 1894 | } |
1895 | 1895 | |
1896 | - $str = (string) $str; |
|
1896 | + $str = (string)$str; |
|
1897 | 1897 | $last = ''; |
1898 | 1898 | while ($last !== $str) { |
1899 | 1899 | $last = $str; |
@@ -2076,7 +2076,7 @@ discard block |
||
2076 | 2076 | } |
2077 | 2077 | |
2078 | 2078 | $str_info = \unpack('C2chars', $str_info); |
2079 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2079 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2080 | 2080 | |
2081 | 2081 | // DEBUG |
2082 | 2082 | //var_dump($type_code); |
@@ -2165,7 +2165,7 @@ discard block |
||
2165 | 2165 | // |
2166 | 2166 | |
2167 | 2167 | if ($encoding === 'UTF-8') { |
2168 | - $maxlength = (int) \mb_strlen($possibleChars); |
|
2168 | + $maxlength = (int)\mb_strlen($possibleChars); |
|
2169 | 2169 | if ($maxlength === 0) { |
2170 | 2170 | return ''; |
2171 | 2171 | } |
@@ -2186,7 +2186,7 @@ discard block |
||
2186 | 2186 | } else { |
2187 | 2187 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2188 | 2188 | |
2189 | - $maxlength = (int) self::strlen($possibleChars, $encoding); |
|
2189 | + $maxlength = (int)self::strlen($possibleChars, $encoding); |
|
2190 | 2190 | if ($maxlength === 0) { |
2191 | 2191 | return ''; |
2192 | 2192 | } |
@@ -2217,16 +2217,16 @@ discard block |
||
2217 | 2217 | */ |
2218 | 2218 | public static function get_unique_string($entropyExtra = '', bool $md5 = true): string |
2219 | 2219 | { |
2220 | - $uniqueHelper = \random_int(0, \mt_getrandmax()) . |
|
2221 | - \session_id() . |
|
2222 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2223 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2220 | + $uniqueHelper = \random_int(0, \mt_getrandmax()). |
|
2221 | + \session_id(). |
|
2222 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2223 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2224 | 2224 | $entropyExtra; |
2225 | 2225 | |
2226 | 2226 | $uniqueString = \uniqid($uniqueHelper, true); |
2227 | 2227 | |
2228 | 2228 | if ($md5) { |
2229 | - $uniqueString = \md5($uniqueString . $uniqueHelper); |
|
2229 | + $uniqueString = \md5($uniqueString.$uniqueHelper); |
|
2230 | 2230 | } |
2231 | 2231 | |
2232 | 2232 | return $uniqueString; |
@@ -2306,7 +2306,7 @@ discard block |
||
2306 | 2306 | public static function hex_to_int($hexDec) |
2307 | 2307 | { |
2308 | 2308 | // init |
2309 | - $hexDec = (string) $hexDec; |
|
2309 | + $hexDec = (string)$hexDec; |
|
2310 | 2310 | |
2311 | 2311 | if ($hexDec === '') { |
2312 | 2312 | return false; |
@@ -2384,7 +2384,7 @@ discard block |
||
2384 | 2384 | return \implode( |
2385 | 2385 | '', |
2386 | 2386 | \array_map( |
2387 | - static function (string $chr) use ($keepAsciiChars, $encoding): string { |
|
2387 | + static function(string $chr) use ($keepAsciiChars, $encoding): string { |
|
2388 | 2388 | return self::single_chr_html_encode($chr, $keepAsciiChars, $encoding); |
2389 | 2389 | }, |
2390 | 2390 | self::str_split($str) |
@@ -2488,7 +2488,7 @@ discard block |
||
2488 | 2488 | && |
2489 | 2489 | self::$SUPPORT['mbstring'] === false |
2490 | 2490 | ) { |
2491 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2491 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2492 | 2492 | } |
2493 | 2493 | |
2494 | 2494 | do { |
@@ -2509,14 +2509,14 @@ discard block |
||
2509 | 2509 | ); |
2510 | 2510 | } |
2511 | 2511 | } else { |
2512 | - $str = (string) \preg_replace_callback( |
|
2512 | + $str = (string)\preg_replace_callback( |
|
2513 | 2513 | "/&#\d{2,6};/", |
2514 | 2514 | /** |
2515 | 2515 | * @param string[] $matches |
2516 | 2516 | * |
2517 | 2517 | * @return string |
2518 | 2518 | */ |
2519 | - static function (array $matches) use ($encoding): string { |
|
2519 | + static function(array $matches) use ($encoding): string { |
|
2520 | 2520 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
2521 | 2521 | if ($returnTmp !== '"' && $returnTmp !== "'") { |
2522 | 2522 | return $returnTmp; |
@@ -2531,7 +2531,7 @@ discard block |
||
2531 | 2531 | if (\strpos($str, '&') !== false) { |
2532 | 2532 | if (\strpos($str, '&#') !== false) { |
2533 | 2533 | // decode also numeric & UTF16 two byte entities |
2534 | - $str = (string) \preg_replace( |
|
2534 | + $str = (string)\preg_replace( |
|
2535 | 2535 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
2536 | 2536 | '$1;', |
2537 | 2537 | $str |
@@ -2577,7 +2577,7 @@ discard block |
||
2577 | 2577 | */ |
2578 | 2578 | public static function html_stripe_empty_tags(string $str): string |
2579 | 2579 | { |
2580 | - return (string) \preg_replace( |
|
2580 | + return (string)\preg_replace( |
|
2581 | 2581 | "/<[^\/>]*>(([\s]?)*|)<\/[^>]*>/iu", |
2582 | 2582 | '', |
2583 | 2583 | $str |
@@ -2876,9 +2876,9 @@ discard block |
||
2876 | 2876 | { |
2877 | 2877 | $hex = \dechex($int); |
2878 | 2878 | |
2879 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
2879 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
2880 | 2880 | |
2881 | - return $pfix . $hex . ''; |
|
2881 | + return $pfix.$hex.''; |
|
2882 | 2882 | } |
2883 | 2883 | |
2884 | 2884 | /** |
@@ -3145,7 +3145,7 @@ discard block |
||
3145 | 3145 | */ |
3146 | 3146 | public static function is_binary($input, bool $strict = false): bool |
3147 | 3147 | { |
3148 | - $input = (string) $input; |
|
3148 | + $input = (string)$input; |
|
3149 | 3149 | if ($input === '') { |
3150 | 3150 | return false; |
3151 | 3151 | } |
@@ -3404,7 +3404,7 @@ discard block |
||
3404 | 3404 | public static function is_utf16($str, $checkIfStringIsBinary = true) |
3405 | 3405 | { |
3406 | 3406 | // init |
3407 | - $str = (string) $str; |
|
3407 | + $str = (string)$str; |
|
3408 | 3408 | $strChars = []; |
3409 | 3409 | |
3410 | 3410 | if ( |
@@ -3482,7 +3482,7 @@ discard block |
||
3482 | 3482 | public static function is_utf32($str, $checkIfStringIsBinary = true) |
3483 | 3483 | { |
3484 | 3484 | // init |
3485 | - $str = (string) $str; |
|
3485 | + $str = (string)$str; |
|
3486 | 3486 | $strChars = []; |
3487 | 3487 | |
3488 | 3488 | if ( |
@@ -3559,14 +3559,14 @@ discard block |
||
3559 | 3559 | self::initEmojiData(); |
3560 | 3560 | |
3561 | 3561 | if ($useReversibleStringMapping === true) { |
3562 | - return (string) \str_replace( |
|
3562 | + return (string)\str_replace( |
|
3563 | 3563 | self::$EMOJI_VALUES_CACHE, |
3564 | 3564 | self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
3565 | 3565 | $str |
3566 | 3566 | ); |
3567 | 3567 | } |
3568 | 3568 | |
3569 | - return (string) \str_replace( |
|
3569 | + return (string)\str_replace( |
|
3570 | 3570 | self::$EMOJI_VALUES_CACHE, |
3571 | 3571 | self::$EMOJI_KEYS_CACHE, |
3572 | 3572 | $str |
@@ -3586,14 +3586,14 @@ discard block |
||
3586 | 3586 | self::initEmojiData(); |
3587 | 3587 | |
3588 | 3588 | if ($useReversibleStringMapping === true) { |
3589 | - return (string) \str_replace( |
|
3589 | + return (string)\str_replace( |
|
3590 | 3590 | self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
3591 | 3591 | self::$EMOJI_VALUES_CACHE, |
3592 | 3592 | $str |
3593 | 3593 | ); |
3594 | 3594 | } |
3595 | 3595 | |
3596 | - return (string) \str_replace( |
|
3596 | + return (string)\str_replace( |
|
3597 | 3597 | self::$EMOJI_KEYS_CACHE, |
3598 | 3598 | self::$EMOJI_VALUES_CACHE, |
3599 | 3599 | $str |
@@ -3656,7 +3656,7 @@ discard block |
||
3656 | 3656 | self::$ORD = self::getData('ord'); |
3657 | 3657 | } |
3658 | 3658 | |
3659 | - $len = \strlen((string) $str); |
|
3659 | + $len = \strlen((string)$str); |
|
3660 | 3660 | /** @noinspection ForeachInvariantsInspection */ |
3661 | 3661 | for ($i = 0; $i < $len; ++$i) { |
3662 | 3662 | $in = self::$ORD[$str[$i]]; |
@@ -3893,15 +3893,15 @@ discard block |
||
3893 | 3893 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
3894 | 3894 | |
3895 | 3895 | if ($encoding === 'UTF-8') { |
3896 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
3896 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
3897 | 3897 | |
3898 | 3898 | if ($useMbFunction === true) { |
3899 | 3899 | $strPartOne = \mb_strtolower( |
3900 | - (string) \mb_substr($str, 0, 1) |
|
3900 | + (string)\mb_substr($str, 0, 1) |
|
3901 | 3901 | ); |
3902 | 3902 | } else { |
3903 | 3903 | $strPartOne = self::strtolower( |
3904 | - (string) \mb_substr($str, 0, 1), |
|
3904 | + (string)\mb_substr($str, 0, 1), |
|
3905 | 3905 | $encoding, |
3906 | 3906 | false, |
3907 | 3907 | $lang, |
@@ -3911,10 +3911,10 @@ discard block |
||
3911 | 3911 | } else { |
3912 | 3912 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
3913 | 3913 | |
3914 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
3914 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
3915 | 3915 | |
3916 | 3916 | $strPartOne = self::strtolower( |
3917 | - (string) self::substr($str, 0, 1, $encoding), |
|
3917 | + (string)self::substr($str, 0, 1, $encoding), |
|
3918 | 3918 | $encoding, |
3919 | 3919 | false, |
3920 | 3920 | $lang, |
@@ -3922,7 +3922,7 @@ discard block |
||
3922 | 3922 | ); |
3923 | 3923 | } |
3924 | 3924 | |
3925 | - return $strPartOne . $strPartTwo; |
|
3925 | + return $strPartOne.$strPartTwo; |
|
3926 | 3926 | } |
3927 | 3927 | |
3928 | 3928 | /** |
@@ -4041,7 +4041,7 @@ discard block |
||
4041 | 4041 | |
4042 | 4042 | if (self::$SUPPORT['mbstring'] === true) { |
4043 | 4043 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4044 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4044 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4045 | 4045 | } |
4046 | 4046 | |
4047 | 4047 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -4082,7 +4082,7 @@ discard block |
||
4082 | 4082 | { |
4083 | 4083 | $bytes = self::chr_size_list($str); |
4084 | 4084 | if (\count($bytes) > 0) { |
4085 | - return (int) \max($bytes); |
|
4085 | + return (int)\max($bytes); |
|
4086 | 4086 | } |
4087 | 4087 | |
4088 | 4088 | return 0; |
@@ -4152,7 +4152,7 @@ discard block |
||
4152 | 4152 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4153 | 4153 | |
4154 | 4154 | // init |
4155 | - $encoding = (string) $encoding; |
|
4155 | + $encoding = (string)$encoding; |
|
4156 | 4156 | |
4157 | 4157 | if (!$encoding) { |
4158 | 4158 | return $fallback; |
@@ -4206,7 +4206,7 @@ discard block |
||
4206 | 4206 | |
4207 | 4207 | $encodingOrig = $encoding; |
4208 | 4208 | $encoding = \strtoupper($encoding); |
4209 | - $encodingUpperHelper = (string) \preg_replace('/[^a-zA-Z0-9\s]/', '', $encoding); |
|
4209 | + $encodingUpperHelper = (string)\preg_replace('/[^a-zA-Z0-9\s]/', '', $encoding); |
|
4210 | 4210 | |
4211 | 4211 | $equivalences = [ |
4212 | 4212 | 'ISO8859' => 'ISO-8859-1', |
@@ -4364,7 +4364,7 @@ discard block |
||
4364 | 4364 | } |
4365 | 4365 | |
4366 | 4366 | static $WHITESPACE_CACHE = []; |
4367 | - $cacheKey = (int) $keepNonBreakingSpace; |
|
4367 | + $cacheKey = (int)$keepNonBreakingSpace; |
|
4368 | 4368 | |
4369 | 4369 | if (!isset($WHITESPACE_CACHE[$cacheKey])) { |
4370 | 4370 | $WHITESPACE_CACHE[$cacheKey] = self::$WHITESPACE_TABLE; |
@@ -4406,13 +4406,13 @@ discard block |
||
4406 | 4406 | static $CHAR_CACHE = []; |
4407 | 4407 | |
4408 | 4408 | // init |
4409 | - $chr = (string) $chr; |
|
4409 | + $chr = (string)$chr; |
|
4410 | 4410 | |
4411 | 4411 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4412 | 4412 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4413 | 4413 | } |
4414 | 4414 | |
4415 | - $cacheKey = $chr . $encoding; |
|
4415 | + $cacheKey = $chr.$encoding; |
|
4416 | 4416 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
4417 | 4417 | return $CHAR_CACHE[$cacheKey]; |
4418 | 4418 | } |
@@ -4447,22 +4447,22 @@ discard block |
||
4447 | 4447 | // |
4448 | 4448 | |
4449 | 4449 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
4450 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
4450 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
4451 | 4451 | $code = $chr ? $chr[1] : 0; |
4452 | 4452 | |
4453 | 4453 | if ($code >= 0xF0 && isset($chr[4])) { |
4454 | 4454 | /** @noinspection UnnecessaryCastingInspection */ |
4455 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4455 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4456 | 4456 | } |
4457 | 4457 | |
4458 | 4458 | if ($code >= 0xE0 && isset($chr[3])) { |
4459 | 4459 | /** @noinspection UnnecessaryCastingInspection */ |
4460 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4460 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4461 | 4461 | } |
4462 | 4462 | |
4463 | 4463 | if ($code >= 0xC0 && isset($chr[2])) { |
4464 | 4464 | /** @noinspection UnnecessaryCastingInspection */ |
4465 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4465 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4466 | 4466 | } |
4467 | 4467 | |
4468 | 4468 | return $CHAR_CACHE[$cacheKey] = $code; |
@@ -4511,7 +4511,7 @@ discard block |
||
4511 | 4511 | public static function pcre_utf8_support(): bool |
4512 | 4512 | { |
4513 | 4513 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4514 | - return (bool) @\preg_match('//u', ''); |
|
4514 | + return (bool)@\preg_match('//u', ''); |
|
4515 | 4515 | } |
4516 | 4516 | |
4517 | 4517 | /** |
@@ -4533,10 +4533,10 @@ discard block |
||
4533 | 4533 | } |
4534 | 4534 | |
4535 | 4535 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4536 | - if (\ctype_digit((string) $var1)) { |
|
4537 | - $start = (int) $var1; |
|
4536 | + if (\ctype_digit((string)$var1)) { |
|
4537 | + $start = (int)$var1; |
|
4538 | 4538 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var1)) { |
4539 | - $start = (int) self::hex_to_int($var1); |
|
4539 | + $start = (int)self::hex_to_int($var1); |
|
4540 | 4540 | } else { |
4541 | 4541 | $start = self::ord($var1); |
4542 | 4542 | } |
@@ -4546,10 +4546,10 @@ discard block |
||
4546 | 4546 | } |
4547 | 4547 | |
4548 | 4548 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4549 | - if (\ctype_digit((string) $var2)) { |
|
4550 | - $end = (int) $var2; |
|
4549 | + if (\ctype_digit((string)$var2)) { |
|
4550 | + $end = (int)$var2; |
|
4551 | 4551 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var2)) { |
4552 | - $end = (int) self::hex_to_int($var2); |
|
4552 | + $end = (int)self::hex_to_int($var2); |
|
4553 | 4553 | } else { |
4554 | 4554 | $end = self::ord($var2); |
4555 | 4555 | } |
@@ -4559,8 +4559,8 @@ discard block |
||
4559 | 4559 | } |
4560 | 4560 | |
4561 | 4561 | return \array_map( |
4562 | - static function (int $i): string { |
|
4563 | - return (string) self::chr($i); |
|
4562 | + static function(int $i): string { |
|
4563 | + return (string)self::chr($i); |
|
4564 | 4564 | }, |
4565 | 4565 | \range($start, $end) |
4566 | 4566 | ); |
@@ -4593,7 +4593,7 @@ discard block |
||
4593 | 4593 | |
4594 | 4594 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
4595 | 4595 | if (\preg_match($pattern, $str)) { |
4596 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
4596 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
4597 | 4597 | } |
4598 | 4598 | |
4599 | 4599 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -4646,8 +4646,8 @@ discard block |
||
4646 | 4646 | $delimiter = '/'; |
4647 | 4647 | } |
4648 | 4648 | |
4649 | - return (string) \preg_replace( |
|
4650 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4649 | + return (string)\preg_replace( |
|
4650 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4651 | 4651 | $replacement, |
4652 | 4652 | $str |
4653 | 4653 | ); |
@@ -4690,9 +4690,9 @@ discard block |
||
4690 | 4690 | return ''; |
4691 | 4691 | } |
4692 | 4692 | |
4693 | - $strLength -= (int) $bomByteLength; |
|
4693 | + $strLength -= (int)$bomByteLength; |
|
4694 | 4694 | |
4695 | - $str = (string) $strTmp; |
|
4695 | + $str = (string)$strTmp; |
|
4696 | 4696 | } |
4697 | 4697 | } |
4698 | 4698 | |
@@ -4716,7 +4716,7 @@ discard block |
||
4716 | 4716 | if (\is_array($what) === true) { |
4717 | 4717 | /** @noinspection ForeachSourceInspection */ |
4718 | 4718 | foreach ($what as $item) { |
4719 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/', $item, $str); |
|
4719 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/', $item, $str); |
|
4720 | 4720 | } |
4721 | 4721 | } |
4722 | 4722 | |
@@ -4748,7 +4748,7 @@ discard block |
||
4748 | 4748 | */ |
4749 | 4749 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
4750 | 4750 | { |
4751 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4751 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4752 | 4752 | } |
4753 | 4753 | |
4754 | 4754 | /** |
@@ -4779,7 +4779,7 @@ discard block |
||
4779 | 4779 | $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
4780 | 4780 | |
4781 | 4781 | do { |
4782 | - $str = (string) \preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4782 | + $str = (string)\preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4783 | 4783 | } while ($count !== 0); |
4784 | 4784 | |
4785 | 4785 | return $str; |
@@ -4798,17 +4798,17 @@ discard block |
||
4798 | 4798 | { |
4799 | 4799 | if ($substring && \strpos($str, $substring) === 0) { |
4800 | 4800 | if ($encoding === 'UTF-8') { |
4801 | - return (string) \mb_substr( |
|
4801 | + return (string)\mb_substr( |
|
4802 | 4802 | $str, |
4803 | - (int) \mb_strlen($substring) |
|
4803 | + (int)\mb_strlen($substring) |
|
4804 | 4804 | ); |
4805 | 4805 | } |
4806 | 4806 | |
4807 | 4807 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4808 | 4808 | |
4809 | - return (string) self::substr( |
|
4809 | + return (string)self::substr( |
|
4810 | 4810 | $str, |
4811 | - (int) self::strlen($substring, $encoding), |
|
4811 | + (int)self::strlen($substring, $encoding), |
|
4812 | 4812 | null, |
4813 | 4813 | $encoding |
4814 | 4814 | ); |
@@ -4830,19 +4830,19 @@ discard block |
||
4830 | 4830 | { |
4831 | 4831 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
4832 | 4832 | if ($encoding === 'UTF-8') { |
4833 | - return (string) \mb_substr( |
|
4833 | + return (string)\mb_substr( |
|
4834 | 4834 | $str, |
4835 | 4835 | 0, |
4836 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
4836 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
4837 | 4837 | ); |
4838 | 4838 | } |
4839 | 4839 | |
4840 | 4840 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4841 | 4841 | |
4842 | - return (string) self::substr( |
|
4842 | + return (string)self::substr( |
|
4843 | 4843 | $str, |
4844 | 4844 | 0, |
4845 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
4845 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
4846 | 4846 | $encoding |
4847 | 4847 | ); |
4848 | 4848 | } |
@@ -4926,7 +4926,7 @@ discard block |
||
4926 | 4926 | $save = \mb_substitute_character(); |
4927 | 4927 | \mb_substitute_character($replacementCharHelper); |
4928 | 4928 | // the polyfill maybe return false, so cast to string |
4929 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4929 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
4930 | 4930 | \mb_substitute_character($save); |
4931 | 4931 | } |
4932 | 4932 | |
@@ -4966,7 +4966,7 @@ discard block |
||
4966 | 4966 | |
4967 | 4967 | if (self::$SUPPORT['mbstring'] === true) { |
4968 | 4968 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4969 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4969 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4970 | 4970 | } |
4971 | 4971 | |
4972 | 4972 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -4979,7 +4979,7 @@ discard block |
||
4979 | 4979 | { |
4980 | 4980 | echo '<pre>'; |
4981 | 4981 | foreach (self::$SUPPORT as $key => &$value) { |
4982 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
4982 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
4983 | 4983 | } |
4984 | 4984 | unset($value); |
4985 | 4985 | echo '</pre>'; |
@@ -5008,7 +5008,7 @@ discard block |
||
5008 | 5008 | return $char; |
5009 | 5009 | } |
5010 | 5010 | |
5011 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
5011 | + return '&#'.self::ord($char, $encoding).';'; |
|
5012 | 5012 | } |
5013 | 5013 | |
5014 | 5014 | /** |
@@ -5067,7 +5067,7 @@ discard block |
||
5067 | 5067 | } |
5068 | 5068 | |
5069 | 5069 | // init |
5070 | - $str = (string) $str; |
|
5070 | + $str = (string)$str; |
|
5071 | 5071 | |
5072 | 5072 | if ($str === '') { |
5073 | 5073 | return []; |
@@ -5114,7 +5114,7 @@ discard block |
||
5114 | 5114 | ($str[$i] & "\xE0") === "\xC0" |
5115 | 5115 | ) { |
5116 | 5116 | if (($str[$i + 1] & "\xC0") === "\x80") { |
5117 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
5117 | + $ret[] = $str[$i].$str[$i + 1]; |
|
5118 | 5118 | |
5119 | 5119 | ++$i; |
5120 | 5120 | } |
@@ -5128,7 +5128,7 @@ discard block |
||
5128 | 5128 | && |
5129 | 5129 | ($str[$i + 2] & "\xC0") === "\x80" |
5130 | 5130 | ) { |
5131 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
5131 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
5132 | 5132 | |
5133 | 5133 | $i += 2; |
5134 | 5134 | } |
@@ -5144,7 +5144,7 @@ discard block |
||
5144 | 5144 | && |
5145 | 5145 | ($str[$i + 3] & "\xC0") === "\x80" |
5146 | 5146 | ) { |
5147 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
5147 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
5148 | 5148 | |
5149 | 5149 | $i += 3; |
5150 | 5150 | } |
@@ -5156,7 +5156,7 @@ discard block |
||
5156 | 5156 | $ret = \array_chunk($ret, $length); |
5157 | 5157 | |
5158 | 5158 | return \array_map( |
5159 | - static function (array &$item): string { |
|
5159 | + static function(array &$item): string { |
|
5160 | 5160 | return \implode('', $item); |
5161 | 5161 | }, |
5162 | 5162 | $ret |
@@ -5205,18 +5205,18 @@ discard block |
||
5205 | 5205 | $lang, |
5206 | 5206 | $tryToKeepStringLength |
5207 | 5207 | ); |
5208 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5208 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5209 | 5209 | |
5210 | 5210 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5211 | 5211 | |
5212 | - $str = (string) \preg_replace_callback( |
|
5212 | + $str = (string)\preg_replace_callback( |
|
5213 | 5213 | '/[-_\s]+(.)?/u', |
5214 | 5214 | /** |
5215 | 5215 | * @param array $match |
5216 | 5216 | * |
5217 | 5217 | * @return string |
5218 | 5218 | */ |
5219 | - static function (array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5219 | + static function(array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
5220 | 5220 | if (isset($match[1])) { |
5221 | 5221 | if ($useMbFunction === true) { |
5222 | 5222 | if ($encoding === 'UTF-8') { |
@@ -5234,14 +5234,14 @@ discard block |
||
5234 | 5234 | $str |
5235 | 5235 | ); |
5236 | 5236 | |
5237 | - return (string) \preg_replace_callback( |
|
5237 | + return (string)\preg_replace_callback( |
|
5238 | 5238 | '/[\d]+(.)?/u', |
5239 | 5239 | /** |
5240 | 5240 | * @param array $match |
5241 | 5241 | * |
5242 | 5242 | * @return string |
5243 | 5243 | */ |
5244 | - static function (array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5244 | + static function(array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
5245 | 5245 | if ($useMbFunction === true) { |
5246 | 5246 | if ($encoding === 'UTF-8') { |
5247 | 5247 | return \mb_strtoupper($match[0]); |
@@ -5413,7 +5413,7 @@ discard block |
||
5413 | 5413 | ): string { |
5414 | 5414 | if (self::$SUPPORT['mbstring'] === true) { |
5415 | 5415 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5416 | - $str = (string) \mb_ereg_replace('\B([A-Z])', '-\1', \trim($str)); |
|
5416 | + $str = (string)\mb_ereg_replace('\B([A-Z])', '-\1', \trim($str)); |
|
5417 | 5417 | |
5418 | 5418 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5419 | 5419 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5423,10 +5423,10 @@ discard block |
||
5423 | 5423 | } |
5424 | 5424 | |
5425 | 5425 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5426 | - return (string) \mb_ereg_replace('[-_\s]+', $delimiter, $str); |
|
5426 | + return (string)\mb_ereg_replace('[-_\s]+', $delimiter, $str); |
|
5427 | 5427 | } |
5428 | 5428 | |
5429 | - $str = (string) \preg_replace('/\B([A-Z])/u', '-\1', \trim($str)); |
|
5429 | + $str = (string)\preg_replace('/\B([A-Z])/u', '-\1', \trim($str)); |
|
5430 | 5430 | |
5431 | 5431 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
5432 | 5432 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5435,7 +5435,7 @@ discard block |
||
5435 | 5435 | $str = self::strtolower($str, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
5436 | 5436 | } |
5437 | 5437 | |
5438 | - return (string) \preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
5438 | + return (string)\preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
5439 | 5439 | } |
5440 | 5440 | |
5441 | 5441 | /** |
@@ -5450,7 +5450,7 @@ discard block |
||
5450 | 5450 | public static function str_detect_encoding($str) |
5451 | 5451 | { |
5452 | 5452 | // init |
5453 | - $str = (string) $str; |
|
5453 | + $str = (string)$str; |
|
5454 | 5454 | |
5455 | 5455 | // |
5456 | 5456 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5552,7 +5552,7 @@ discard block |
||
5552 | 5552 | foreach (self::$ENCODINGS as $encodingTmp) { |
5553 | 5553 | // INFO: //IGNORE but still throw notice |
5554 | 5554 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5555 | - if ((string) @\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str) === $str) { |
|
5555 | + if ((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str) === $str) { |
|
5556 | 5556 | return $encodingTmp; |
5557 | 5557 | } |
5558 | 5558 | } |
@@ -5617,7 +5617,7 @@ discard block |
||
5617 | 5617 | return $str; |
5618 | 5618 | } |
5619 | 5619 | |
5620 | - return $substring . $str; |
|
5620 | + return $substring.$str; |
|
5621 | 5621 | } |
5622 | 5622 | |
5623 | 5623 | /** |
@@ -5837,27 +5837,27 @@ discard block |
||
5837 | 5837 | string $encoding = 'UTF-8' |
5838 | 5838 | ): string { |
5839 | 5839 | if ($encoding === 'UTF-8') { |
5840 | - $len = (int) \mb_strlen($str); |
|
5840 | + $len = (int)\mb_strlen($str); |
|
5841 | 5841 | if ($index > $len) { |
5842 | 5842 | return $str; |
5843 | 5843 | } |
5844 | 5844 | |
5845 | 5845 | /** @noinspection UnnecessaryCastingInspection */ |
5846 | - return (string) \mb_substr($str, 0, $index) . |
|
5847 | - $substring . |
|
5848 | - (string) \mb_substr($str, $index, $len); |
|
5846 | + return (string)\mb_substr($str, 0, $index). |
|
5847 | + $substring. |
|
5848 | + (string)\mb_substr($str, $index, $len); |
|
5849 | 5849 | } |
5850 | 5850 | |
5851 | 5851 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5852 | 5852 | |
5853 | - $len = (int) self::strlen($str, $encoding); |
|
5853 | + $len = (int)self::strlen($str, $encoding); |
|
5854 | 5854 | if ($index > $len) { |
5855 | 5855 | return $str; |
5856 | 5856 | } |
5857 | 5857 | |
5858 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
5859 | - $substring . |
|
5860 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
5858 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
5859 | + $substring. |
|
5860 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
5861 | 5861 | } |
5862 | 5862 | |
5863 | 5863 | /** |
@@ -5887,15 +5887,15 @@ discard block |
||
5887 | 5887 | */ |
5888 | 5888 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5889 | 5889 | { |
5890 | - $search = (array) $search; |
|
5890 | + $search = (array)$search; |
|
5891 | 5891 | |
5892 | 5892 | /** @noinspection AlterInForeachInspection */ |
5893 | 5893 | foreach ($search as &$s) { |
5894 | - $s = (string) $s; |
|
5894 | + $s = (string)$s; |
|
5895 | 5895 | if ($s === '') { |
5896 | 5896 | $s = '/^(?<=.)$/'; |
5897 | 5897 | } else { |
5898 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5898 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5899 | 5899 | } |
5900 | 5900 | } |
5901 | 5901 | |
@@ -5927,11 +5927,11 @@ discard block |
||
5927 | 5927 | } |
5928 | 5928 | |
5929 | 5929 | if ($search === '') { |
5930 | - return $str . $replacement; |
|
5930 | + return $str.$replacement; |
|
5931 | 5931 | } |
5932 | 5932 | |
5933 | 5933 | if (\stripos($str, $search) === 0) { |
5934 | - return $replacement . \substr($str, \strlen($search)); |
|
5934 | + return $replacement.\substr($str, \strlen($search)); |
|
5935 | 5935 | } |
5936 | 5936 | |
5937 | 5937 | return $str; |
@@ -5959,11 +5959,11 @@ discard block |
||
5959 | 5959 | } |
5960 | 5960 | |
5961 | 5961 | if ($search === '') { |
5962 | - return $str . $replacement; |
|
5962 | + return $str.$replacement; |
|
5963 | 5963 | } |
5964 | 5964 | |
5965 | 5965 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
5966 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
5966 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
5967 | 5967 | } |
5968 | 5968 | |
5969 | 5969 | return $str; |
@@ -6036,15 +6036,15 @@ discard block |
||
6036 | 6036 | } |
6037 | 6037 | |
6038 | 6038 | if ($encoding === 'UTF-8') { |
6039 | - return (string) \mb_substr( |
|
6039 | + return (string)\mb_substr( |
|
6040 | 6040 | $str, |
6041 | - $offset + (int) \mb_strlen($separator) |
|
6041 | + $offset + (int)\mb_strlen($separator) |
|
6042 | 6042 | ); |
6043 | 6043 | } |
6044 | 6044 | |
6045 | - return (string) self::substr( |
|
6045 | + return (string)self::substr( |
|
6046 | 6046 | $str, |
6047 | - $offset + (int) self::strlen($separator, $encoding), |
|
6047 | + $offset + (int)self::strlen($separator, $encoding), |
|
6048 | 6048 | null, |
6049 | 6049 | $encoding |
6050 | 6050 | ); |
@@ -6071,15 +6071,15 @@ discard block |
||
6071 | 6071 | } |
6072 | 6072 | |
6073 | 6073 | if ($encoding === 'UTF-8') { |
6074 | - return (string) \mb_substr( |
|
6074 | + return (string)\mb_substr( |
|
6075 | 6075 | $str, |
6076 | - $offset + (int) self::strlen($separator) |
|
6076 | + $offset + (int)self::strlen($separator) |
|
6077 | 6077 | ); |
6078 | 6078 | } |
6079 | 6079 | |
6080 | - return (string) self::substr( |
|
6080 | + return (string)self::substr( |
|
6081 | 6081 | $str, |
6082 | - $offset + (int) self::strlen($separator, $encoding), |
|
6082 | + $offset + (int)self::strlen($separator, $encoding), |
|
6083 | 6083 | null, |
6084 | 6084 | $encoding |
6085 | 6085 | ); |
@@ -6106,10 +6106,10 @@ discard block |
||
6106 | 6106 | } |
6107 | 6107 | |
6108 | 6108 | if ($encoding === 'UTF-8') { |
6109 | - return (string) \mb_substr($str, 0, $offset); |
|
6109 | + return (string)\mb_substr($str, 0, $offset); |
|
6110 | 6110 | } |
6111 | 6111 | |
6112 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6112 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6113 | 6113 | } |
6114 | 6114 | |
6115 | 6115 | /** |
@@ -6133,7 +6133,7 @@ discard block |
||
6133 | 6133 | return ''; |
6134 | 6134 | } |
6135 | 6135 | |
6136 | - return (string) \mb_substr($str, 0, $offset); |
|
6136 | + return (string)\mb_substr($str, 0, $offset); |
|
6137 | 6137 | } |
6138 | 6138 | |
6139 | 6139 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6141,7 +6141,7 @@ discard block |
||
6141 | 6141 | return ''; |
6142 | 6142 | } |
6143 | 6143 | |
6144 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6144 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6145 | 6145 | } |
6146 | 6146 | |
6147 | 6147 | /** |
@@ -6229,12 +6229,12 @@ discard block |
||
6229 | 6229 | } |
6230 | 6230 | |
6231 | 6231 | if ($encoding === 'UTF-8') { |
6232 | - return (string) \mb_substr($str, -$n); |
|
6232 | + return (string)\mb_substr($str, -$n); |
|
6233 | 6233 | } |
6234 | 6234 | |
6235 | 6235 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6236 | 6236 | |
6237 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6237 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6238 | 6238 | } |
6239 | 6239 | |
6240 | 6240 | /** |
@@ -6258,21 +6258,21 @@ discard block |
||
6258 | 6258 | } |
6259 | 6259 | |
6260 | 6260 | if ($encoding === 'UTF-8') { |
6261 | - if ((int) \mb_strlen($str) <= $length) { |
|
6261 | + if ((int)\mb_strlen($str) <= $length) { |
|
6262 | 6262 | return $str; |
6263 | 6263 | } |
6264 | 6264 | |
6265 | 6265 | /** @noinspection UnnecessaryCastingInspection */ |
6266 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($strAddOn)) . $strAddOn; |
|
6266 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($strAddOn)).$strAddOn; |
|
6267 | 6267 | } |
6268 | 6268 | |
6269 | 6269 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6270 | 6270 | |
6271 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6271 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6272 | 6272 | return $str; |
6273 | 6273 | } |
6274 | 6274 | |
6275 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($strAddOn), $encoding)) . $strAddOn; |
|
6275 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($strAddOn), $encoding)).$strAddOn; |
|
6276 | 6276 | } |
6277 | 6277 | |
6278 | 6278 | /** |
@@ -6297,12 +6297,12 @@ discard block |
||
6297 | 6297 | |
6298 | 6298 | if ($encoding === 'UTF-8') { |
6299 | 6299 | /** @noinspection UnnecessaryCastingInspection */ |
6300 | - if ((int) \mb_strlen($str) <= $length) { |
|
6300 | + if ((int)\mb_strlen($str) <= $length) { |
|
6301 | 6301 | return $str; |
6302 | 6302 | } |
6303 | 6303 | |
6304 | 6304 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6305 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6305 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6306 | 6306 | } |
6307 | 6307 | |
6308 | 6308 | $str = \mb_substr($str, 0, $length); |
@@ -6312,20 +6312,20 @@ discard block |
||
6312 | 6312 | $new_str = \implode(' ', $array); |
6313 | 6313 | |
6314 | 6314 | if ($new_str === '') { |
6315 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
6315 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
6316 | 6316 | } |
6317 | 6317 | } else { |
6318 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6318 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6319 | 6319 | return $str; |
6320 | 6320 | } |
6321 | 6321 | |
6322 | 6322 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6323 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6323 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6324 | 6324 | } |
6325 | 6325 | |
6326 | 6326 | $str = self::substr($str, 0, $length, $encoding); |
6327 | 6327 | if ($str === false) { |
6328 | - return '' . $strAddOn; |
|
6328 | + return ''.$strAddOn; |
|
6329 | 6329 | } |
6330 | 6330 | |
6331 | 6331 | $array = \explode(' ', $str); |
@@ -6333,11 +6333,11 @@ discard block |
||
6333 | 6333 | $new_str = \implode(' ', $array); |
6334 | 6334 | |
6335 | 6335 | if ($new_str === '') { |
6336 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
6336 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
6337 | 6337 | } |
6338 | 6338 | } |
6339 | 6339 | |
6340 | - return $new_str . $strAddOn; |
|
6340 | + return $new_str.$strAddOn; |
|
6341 | 6341 | } |
6342 | 6342 | |
6343 | 6343 | /** |
@@ -6355,7 +6355,7 @@ discard block |
||
6355 | 6355 | $longestCommonPrefix = ''; |
6356 | 6356 | |
6357 | 6357 | if ($encoding === 'UTF-8') { |
6358 | - $maxLength = (int) \min( |
|
6358 | + $maxLength = (int)\min( |
|
6359 | 6359 | \mb_strlen($str), |
6360 | 6360 | \mb_strlen($otherStr) |
6361 | 6361 | ); |
@@ -6376,7 +6376,7 @@ discard block |
||
6376 | 6376 | } else { |
6377 | 6377 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6378 | 6378 | |
6379 | - $maxLength = (int) \min( |
|
6379 | + $maxLength = (int)\min( |
|
6380 | 6380 | self::strlen($str, $encoding), |
6381 | 6381 | self::strlen($otherStr, $encoding) |
6382 | 6382 | ); |
@@ -6419,13 +6419,13 @@ discard block |
||
6419 | 6419 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6420 | 6420 | |
6421 | 6421 | if ($encoding === 'UTF-8') { |
6422 | - $strLength = (int) \mb_strlen($str); |
|
6423 | - $otherLength = (int) \mb_strlen($otherStr); |
|
6422 | + $strLength = (int)\mb_strlen($str); |
|
6423 | + $otherLength = (int)\mb_strlen($otherStr); |
|
6424 | 6424 | } else { |
6425 | 6425 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6426 | 6426 | |
6427 | - $strLength = (int) self::strlen($str, $encoding); |
|
6428 | - $otherLength = (int) self::strlen($otherStr, $encoding); |
|
6427 | + $strLength = (int)self::strlen($str, $encoding); |
|
6428 | + $otherLength = (int)self::strlen($otherStr, $encoding); |
|
6429 | 6429 | } |
6430 | 6430 | |
6431 | 6431 | // Return if either string is empty |
@@ -6478,10 +6478,10 @@ discard block |
||
6478 | 6478 | } |
6479 | 6479 | |
6480 | 6480 | if ($encoding === 'UTF-8') { |
6481 | - return (string) \mb_substr($str, $end - $len, $len); |
|
6481 | + return (string)\mb_substr($str, $end - $len, $len); |
|
6482 | 6482 | } |
6483 | 6483 | |
6484 | - return (string) self::substr($str, $end - $len, $len, $encoding); |
|
6484 | + return (string)self::substr($str, $end - $len, $len, $encoding); |
|
6485 | 6485 | } |
6486 | 6486 | |
6487 | 6487 | /** |
@@ -6500,7 +6500,7 @@ discard block |
||
6500 | 6500 | } |
6501 | 6501 | |
6502 | 6502 | if ($encoding === 'UTF-8') { |
6503 | - $maxLength = (int) \min( |
|
6503 | + $maxLength = (int)\min( |
|
6504 | 6504 | \mb_strlen($str, $encoding), |
6505 | 6505 | \mb_strlen($otherStr, $encoding) |
6506 | 6506 | ); |
@@ -6514,7 +6514,7 @@ discard block |
||
6514 | 6514 | && |
6515 | 6515 | $char === \mb_substr($otherStr, -$i, 1) |
6516 | 6516 | ) { |
6517 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6517 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6518 | 6518 | } else { |
6519 | 6519 | break; |
6520 | 6520 | } |
@@ -6522,7 +6522,7 @@ discard block |
||
6522 | 6522 | } else { |
6523 | 6523 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6524 | 6524 | |
6525 | - $maxLength = (int) \min( |
|
6525 | + $maxLength = (int)\min( |
|
6526 | 6526 | self::strlen($str, $encoding), |
6527 | 6527 | self::strlen($otherStr, $encoding) |
6528 | 6528 | ); |
@@ -6536,7 +6536,7 @@ discard block |
||
6536 | 6536 | && |
6537 | 6537 | $char === self::substr($otherStr, -$i, 1, $encoding) |
6538 | 6538 | ) { |
6539 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
6539 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
6540 | 6540 | } else { |
6541 | 6541 | break; |
6542 | 6542 | } |
@@ -6556,7 +6556,7 @@ discard block |
||
6556 | 6556 | */ |
6557 | 6557 | public static function str_matches_pattern(string $str, string $pattern): bool |
6558 | 6558 | { |
6559 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6559 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6560 | 6560 | } |
6561 | 6561 | |
6562 | 6562 | /** |
@@ -6573,7 +6573,7 @@ discard block |
||
6573 | 6573 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6574 | 6574 | { |
6575 | 6575 | // init |
6576 | - $length = (int) self::strlen($str, $encoding); |
|
6576 | + $length = (int)self::strlen($str, $encoding); |
|
6577 | 6577 | |
6578 | 6578 | if ($offset >= 0) { |
6579 | 6579 | return $length > $offset; |
@@ -6599,7 +6599,7 @@ discard block |
||
6599 | 6599 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6600 | 6600 | { |
6601 | 6601 | // init |
6602 | - $length = (int) self::strlen($str); |
|
6602 | + $length = (int)self::strlen($str); |
|
6603 | 6603 | |
6604 | 6604 | if ( |
6605 | 6605 | ($index >= 0 && $length <= $index) |
@@ -6638,7 +6638,7 @@ discard block |
||
6638 | 6638 | return $str; |
6639 | 6639 | } |
6640 | 6640 | |
6641 | - if ($pad_type !== (int) $pad_type) { |
|
6641 | + if ($pad_type !== (int)$pad_type) { |
|
6642 | 6642 | if ($pad_type === 'left') { |
6643 | 6643 | $pad_type = \STR_PAD_LEFT; |
6644 | 6644 | } elseif ($pad_type === 'right') { |
@@ -6647,23 +6647,23 @@ discard block |
||
6647 | 6647 | $pad_type = \STR_PAD_BOTH; |
6648 | 6648 | } else { |
6649 | 6649 | throw new \InvalidArgumentException( |
6650 | - 'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6650 | + 'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6651 | 6651 | ); |
6652 | 6652 | } |
6653 | 6653 | } |
6654 | 6654 | |
6655 | 6655 | if ($encoding === 'UTF-8') { |
6656 | - $str_length = (int) \mb_strlen($str); |
|
6656 | + $str_length = (int)\mb_strlen($str); |
|
6657 | 6657 | |
6658 | 6658 | if ($pad_length >= $str_length) { |
6659 | 6659 | switch ($pad_type) { |
6660 | 6660 | case \STR_PAD_LEFT: |
6661 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6661 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6662 | 6662 | |
6663 | 6663 | $diff = ($pad_length - $str_length); |
6664 | 6664 | |
6665 | - $pre = (string) \mb_substr( |
|
6666 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6665 | + $pre = (string)\mb_substr( |
|
6666 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6667 | 6667 | 0, |
6668 | 6668 | $diff |
6669 | 6669 | ); |
@@ -6674,16 +6674,16 @@ discard block |
||
6674 | 6674 | case \STR_PAD_BOTH: |
6675 | 6675 | $diff = ($pad_length - $str_length); |
6676 | 6676 | |
6677 | - $ps_length_left = (int) \floor($diff / 2); |
|
6677 | + $ps_length_left = (int)\floor($diff / 2); |
|
6678 | 6678 | |
6679 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6679 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6680 | 6680 | |
6681 | - $pre = (string) \mb_substr( |
|
6681 | + $pre = (string)\mb_substr( |
|
6682 | 6682 | \str_repeat($pad_string, $ps_length_left), |
6683 | 6683 | 0, |
6684 | 6684 | $ps_length_left |
6685 | 6685 | ); |
6686 | - $post = (string) \mb_substr( |
|
6686 | + $post = (string)\mb_substr( |
|
6687 | 6687 | \str_repeat($pad_string, $ps_length_right), |
6688 | 6688 | 0, |
6689 | 6689 | $ps_length_right |
@@ -6693,19 +6693,19 @@ discard block |
||
6693 | 6693 | |
6694 | 6694 | case \STR_PAD_RIGHT: |
6695 | 6695 | default: |
6696 | - $ps_length = (int) \mb_strlen($pad_string); |
|
6696 | + $ps_length = (int)\mb_strlen($pad_string); |
|
6697 | 6697 | |
6698 | 6698 | $diff = ($pad_length - $str_length); |
6699 | 6699 | |
6700 | - $post = (string) \mb_substr( |
|
6701 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6700 | + $post = (string)\mb_substr( |
|
6701 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6702 | 6702 | 0, |
6703 | 6703 | $diff |
6704 | 6704 | ); |
6705 | 6705 | $pre = ''; |
6706 | 6706 | } |
6707 | 6707 | |
6708 | - return $pre . $str . $post; |
|
6708 | + return $pre.$str.$post; |
|
6709 | 6709 | } |
6710 | 6710 | |
6711 | 6711 | return $str; |
@@ -6713,17 +6713,17 @@ discard block |
||
6713 | 6713 | |
6714 | 6714 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6715 | 6715 | |
6716 | - $str_length = (int) self::strlen($str, $encoding); |
|
6716 | + $str_length = (int)self::strlen($str, $encoding); |
|
6717 | 6717 | |
6718 | 6718 | if ($pad_length >= $str_length) { |
6719 | 6719 | switch ($pad_type) { |
6720 | 6720 | case \STR_PAD_LEFT: |
6721 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6721 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6722 | 6722 | |
6723 | 6723 | $diff = ($pad_length - $str_length); |
6724 | 6724 | |
6725 | - $pre = (string) self::substr( |
|
6726 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6725 | + $pre = (string)self::substr( |
|
6726 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6727 | 6727 | 0, |
6728 | 6728 | $diff, |
6729 | 6729 | $encoding |
@@ -6735,17 +6735,17 @@ discard block |
||
6735 | 6735 | case \STR_PAD_BOTH: |
6736 | 6736 | $diff = ($pad_length - $str_length); |
6737 | 6737 | |
6738 | - $ps_length_left = (int) \floor($diff / 2); |
|
6738 | + $ps_length_left = (int)\floor($diff / 2); |
|
6739 | 6739 | |
6740 | - $ps_length_right = (int) \ceil($diff / 2); |
|
6740 | + $ps_length_right = (int)\ceil($diff / 2); |
|
6741 | 6741 | |
6742 | - $pre = (string) self::substr( |
|
6742 | + $pre = (string)self::substr( |
|
6743 | 6743 | \str_repeat($pad_string, $ps_length_left), |
6744 | 6744 | 0, |
6745 | 6745 | $ps_length_left, |
6746 | 6746 | $encoding |
6747 | 6747 | ); |
6748 | - $post = (string) self::substr( |
|
6748 | + $post = (string)self::substr( |
|
6749 | 6749 | \str_repeat($pad_string, $ps_length_right), |
6750 | 6750 | 0, |
6751 | 6751 | $ps_length_right, |
@@ -6756,12 +6756,12 @@ discard block |
||
6756 | 6756 | |
6757 | 6757 | case \STR_PAD_RIGHT: |
6758 | 6758 | default: |
6759 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
6759 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
6760 | 6760 | |
6761 | 6761 | $diff = ($pad_length - $str_length); |
6762 | 6762 | |
6763 | - $post = (string) self::substr( |
|
6764 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
6763 | + $post = (string)self::substr( |
|
6764 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
6765 | 6765 | 0, |
6766 | 6766 | $diff, |
6767 | 6767 | $encoding |
@@ -6769,7 +6769,7 @@ discard block |
||
6769 | 6769 | $pre = ''; |
6770 | 6770 | } |
6771 | 6771 | |
6772 | - return $pre . $str . $post; |
|
6772 | + return $pre.$str.$post; |
|
6773 | 6773 | } |
6774 | 6774 | |
6775 | 6775 | return $str; |
@@ -6921,11 +6921,11 @@ discard block |
||
6921 | 6921 | } |
6922 | 6922 | |
6923 | 6923 | if ($search === '') { |
6924 | - return $str . $replacement; |
|
6924 | + return $str.$replacement; |
|
6925 | 6925 | } |
6926 | 6926 | |
6927 | 6927 | if (\strpos($str, $search) === 0) { |
6928 | - return $replacement . \substr($str, \strlen($search)); |
|
6928 | + return $replacement.\substr($str, \strlen($search)); |
|
6929 | 6929 | } |
6930 | 6930 | |
6931 | 6931 | return $str; |
@@ -6953,11 +6953,11 @@ discard block |
||
6953 | 6953 | } |
6954 | 6954 | |
6955 | 6955 | if ($search === '') { |
6956 | - return $str . $replacement; |
|
6956 | + return $str.$replacement; |
|
6957 | 6957 | } |
6958 | 6958 | |
6959 | 6959 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6960 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6960 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6961 | 6961 | } |
6962 | 6962 | |
6963 | 6963 | return $str; |
@@ -6980,7 +6980,7 @@ discard block |
||
6980 | 6980 | |
6981 | 6981 | if ($pos !== false) { |
6982 | 6982 | /** @psalm-suppress InvalidReturnStatement */ |
6983 | - return self::substr_replace($subject, $replace, $pos, (int) self::strlen($search)); |
|
6983 | + return self::substr_replace($subject, $replace, $pos, (int)self::strlen($search)); |
|
6984 | 6984 | } |
6985 | 6985 | |
6986 | 6986 | return $subject; |
@@ -7005,7 +7005,7 @@ discard block |
||
7005 | 7005 | $pos = self::strrpos($subject, $search); |
7006 | 7006 | if ($pos !== false) { |
7007 | 7007 | /** @psalm-suppress InvalidReturnStatement */ |
7008 | - return self::substr_replace($subject, $replace, $pos, (int) self::strlen($search)); |
|
7008 | + return self::substr_replace($subject, $replace, $pos, (int)self::strlen($search)); |
|
7009 | 7009 | } |
7010 | 7010 | |
7011 | 7011 | return $subject; |
@@ -7024,7 +7024,7 @@ discard block |
||
7024 | 7024 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
7025 | 7025 | { |
7026 | 7026 | if ($encoding === 'UTF-8') { |
7027 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
7027 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
7028 | 7028 | /** @noinspection NonSecureShuffleUsageInspection */ |
7029 | 7029 | \shuffle($indexes); |
7030 | 7030 | |
@@ -7040,7 +7040,7 @@ discard block |
||
7040 | 7040 | } else { |
7041 | 7041 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7042 | 7042 | |
7043 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
7043 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
7044 | 7044 | /** @noinspection NonSecureShuffleUsageInspection */ |
7045 | 7045 | \shuffle($indexes); |
7046 | 7046 | |
@@ -7081,11 +7081,11 @@ discard block |
||
7081 | 7081 | ) { |
7082 | 7082 | if ($encoding === 'UTF-8') { |
7083 | 7083 | if ($end === null) { |
7084 | - $length = (int) \mb_strlen($str); |
|
7084 | + $length = (int)\mb_strlen($str); |
|
7085 | 7085 | } elseif ($end >= 0 && $end <= $start) { |
7086 | 7086 | return ''; |
7087 | 7087 | } elseif ($end < 0) { |
7088 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7088 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7089 | 7089 | } else { |
7090 | 7090 | $length = $end - $start; |
7091 | 7091 | } |
@@ -7096,11 +7096,11 @@ discard block |
||
7096 | 7096 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7097 | 7097 | |
7098 | 7098 | if ($end === null) { |
7099 | - $length = (int) self::strlen($str, $encoding); |
|
7099 | + $length = (int)self::strlen($str, $encoding); |
|
7100 | 7100 | } elseif ($end >= 0 && $end <= $start) { |
7101 | 7101 | return ''; |
7102 | 7102 | } elseif ($end < 0) { |
7103 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7103 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7104 | 7104 | } else { |
7105 | 7105 | $length = $end - $start; |
7106 | 7106 | } |
@@ -7132,35 +7132,35 @@ discard block |
||
7132 | 7132 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7133 | 7133 | } |
7134 | 7134 | |
7135 | - $str = (string) \preg_replace_callback( |
|
7135 | + $str = (string)\preg_replace_callback( |
|
7136 | 7136 | '/([\d|A-Z])/u', |
7137 | 7137 | /** |
7138 | 7138 | * @param string[] $matches |
7139 | 7139 | * |
7140 | 7140 | * @return string |
7141 | 7141 | */ |
7142 | - static function (array $matches) use ($encoding): string { |
|
7142 | + static function(array $matches) use ($encoding): string { |
|
7143 | 7143 | $match = $matches[1]; |
7144 | - $matchInt = (int) $match; |
|
7144 | + $matchInt = (int)$match; |
|
7145 | 7145 | |
7146 | - if ((string) $matchInt === $match) { |
|
7147 | - return '_' . $match . '_'; |
|
7146 | + if ((string)$matchInt === $match) { |
|
7147 | + return '_'.$match.'_'; |
|
7148 | 7148 | } |
7149 | 7149 | |
7150 | 7150 | if ($encoding === 'UTF-8') { |
7151 | - return '_' . \mb_strtolower($match); |
|
7151 | + return '_'.\mb_strtolower($match); |
|
7152 | 7152 | } |
7153 | 7153 | |
7154 | - return '_' . self::strtolower($match, $encoding); |
|
7154 | + return '_'.self::strtolower($match, $encoding); |
|
7155 | 7155 | }, |
7156 | 7156 | $str |
7157 | 7157 | ); |
7158 | 7158 | |
7159 | - $str = (string) \preg_replace( |
|
7159 | + $str = (string)\preg_replace( |
|
7160 | 7160 | [ |
7161 | - '/\s+/', // convert spaces to "_" |
|
7162 | - '/^\s+|\s+$/', // trim leading & trailing spaces |
|
7163 | - '/_+/', // remove double "_" |
|
7161 | + '/\s+/', // convert spaces to "_" |
|
7162 | + '/^\s+|\s+$/', // trim leading & trailing spaces |
|
7163 | + '/_+/', // remove double "_" |
|
7164 | 7164 | ], |
7165 | 7165 | [ |
7166 | 7166 | '_', |
@@ -7244,7 +7244,7 @@ discard block |
||
7244 | 7244 | /** @noinspection PhpComposerExtensionStubsInspection */ |
7245 | 7245 | return \array_filter( |
7246 | 7246 | \mb_split($pattern, $str), |
7247 | - static function () use (&$limit): bool { |
|
7247 | + static function() use (&$limit): bool { |
|
7248 | 7248 | return --$limit >= 0; |
7249 | 7249 | } |
7250 | 7250 | ); |
@@ -7260,7 +7260,7 @@ discard block |
||
7260 | 7260 | $limit = -1; |
7261 | 7261 | } |
7262 | 7262 | |
7263 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7263 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7264 | 7264 | |
7265 | 7265 | if ($array === false) { |
7266 | 7266 | return []; |
@@ -7336,9 +7336,9 @@ discard block |
||
7336 | 7336 | return ''; |
7337 | 7337 | } |
7338 | 7338 | |
7339 | - return (string) \mb_substr( |
|
7339 | + return (string)\mb_substr( |
|
7340 | 7340 | $str, |
7341 | - $offset + (int) \mb_strlen($separator) |
|
7341 | + $offset + (int)\mb_strlen($separator) |
|
7342 | 7342 | ); |
7343 | 7343 | } |
7344 | 7344 | |
@@ -7347,9 +7347,9 @@ discard block |
||
7347 | 7347 | return ''; |
7348 | 7348 | } |
7349 | 7349 | |
7350 | - return (string) \mb_substr( |
|
7350 | + return (string)\mb_substr( |
|
7351 | 7351 | $str, |
7352 | - $offset + (int) self::strlen($separator, $encoding), |
|
7352 | + $offset + (int)self::strlen($separator, $encoding), |
|
7353 | 7353 | null, |
7354 | 7354 | $encoding |
7355 | 7355 | ); |
@@ -7376,9 +7376,9 @@ discard block |
||
7376 | 7376 | return ''; |
7377 | 7377 | } |
7378 | 7378 | |
7379 | - return (string) \mb_substr( |
|
7379 | + return (string)\mb_substr( |
|
7380 | 7380 | $str, |
7381 | - $offset + (int) \mb_strlen($separator) |
|
7381 | + $offset + (int)\mb_strlen($separator) |
|
7382 | 7382 | ); |
7383 | 7383 | } |
7384 | 7384 | |
@@ -7387,9 +7387,9 @@ discard block |
||
7387 | 7387 | return ''; |
7388 | 7388 | } |
7389 | 7389 | |
7390 | - return (string) self::substr( |
|
7390 | + return (string)self::substr( |
|
7391 | 7391 | $str, |
7392 | - $offset + (int) self::strlen($separator, $encoding), |
|
7392 | + $offset + (int)self::strlen($separator, $encoding), |
|
7393 | 7393 | null, |
7394 | 7394 | $encoding |
7395 | 7395 | ); |
@@ -7419,7 +7419,7 @@ discard block |
||
7419 | 7419 | return ''; |
7420 | 7420 | } |
7421 | 7421 | |
7422 | - return (string) \mb_substr( |
|
7422 | + return (string)\mb_substr( |
|
7423 | 7423 | $str, |
7424 | 7424 | 0, |
7425 | 7425 | $offset |
@@ -7431,7 +7431,7 @@ discard block |
||
7431 | 7431 | return ''; |
7432 | 7432 | } |
7433 | 7433 | |
7434 | - return (string) self::substr( |
|
7434 | + return (string)self::substr( |
|
7435 | 7435 | $str, |
7436 | 7436 | 0, |
7437 | 7437 | $offset, |
@@ -7460,7 +7460,7 @@ discard block |
||
7460 | 7460 | return ''; |
7461 | 7461 | } |
7462 | 7462 | |
7463 | - return (string) \mb_substr( |
|
7463 | + return (string)\mb_substr( |
|
7464 | 7464 | $str, |
7465 | 7465 | 0, |
7466 | 7466 | $offset |
@@ -7474,7 +7474,7 @@ discard block |
||
7474 | 7474 | |
7475 | 7475 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7476 | 7476 | |
7477 | - return (string) self::substr( |
|
7477 | + return (string)self::substr( |
|
7478 | 7478 | $str, |
7479 | 7479 | 0, |
7480 | 7480 | $offset, |
@@ -7582,7 +7582,7 @@ discard block |
||
7582 | 7582 | */ |
7583 | 7583 | public static function str_surround(string $str, string $substring): string |
7584 | 7584 | { |
7585 | - return $substring . $str . $substring; |
|
7585 | + return $substring.$str.$substring; |
|
7586 | 7586 | } |
7587 | 7587 | |
7588 | 7588 | /** |
@@ -7626,9 +7626,9 @@ discard block |
||
7626 | 7626 | |
7627 | 7627 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
7628 | 7628 | |
7629 | - return (string) \preg_replace_callback( |
|
7629 | + return (string)\preg_replace_callback( |
|
7630 | 7630 | '/([\S]+)/u', |
7631 | - static function (array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7631 | + static function(array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
7632 | 7632 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
7633 | 7633 | return $match[0]; |
7634 | 7634 | } |
@@ -7714,16 +7714,16 @@ discard block |
||
7714 | 7714 | } |
7715 | 7715 | |
7716 | 7716 | // the main substitutions |
7717 | - $str = (string) \preg_replace_callback( |
|
7717 | + $str = (string)\preg_replace_callback( |
|
7718 | 7718 | '~\b (_*) (?: # 1. Leading underscore and |
7719 | 7719 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
7720 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
7720 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
7721 | 7721 | | |
7722 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
7722 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
7723 | 7723 | | |
7724 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
7724 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
7725 | 7725 | | |
7726 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
7726 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
7727 | 7727 | ) (_*) \b # 6. With trailing underscore |
7728 | 7728 | ~ux', |
7729 | 7729 | /** |
@@ -7731,7 +7731,7 @@ discard block |
||
7731 | 7731 | * |
7732 | 7732 | * @return string |
7733 | 7733 | */ |
7734 | - static function (array $matches) use ($encoding): string { |
|
7734 | + static function(array $matches) use ($encoding): string { |
|
7735 | 7735 | // preserve leading underscore |
7736 | 7736 | $str = $matches[1]; |
7737 | 7737 | if ($matches[2]) { |
@@ -7756,26 +7756,26 @@ discard block |
||
7756 | 7756 | ); |
7757 | 7757 | |
7758 | 7758 | // Exceptions for small words: capitalize at start of title... |
7759 | - $str = (string) \preg_replace_callback( |
|
7759 | + $str = (string)\preg_replace_callback( |
|
7760 | 7760 | '~( \A [[:punct:]]* # start of title... |
7761 | 7761 | | [:.;?!][ ]+ # or of subsentence... |
7762 | 7762 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
7763 | - ( ' . $smallWordsRx . ' ) \b # ...followed by small word |
|
7763 | + ( ' . $smallWordsRx.' ) \b # ...followed by small word |
|
7764 | 7764 | ~uxi', |
7765 | 7765 | /** |
7766 | 7766 | * @param string[] $matches |
7767 | 7767 | * |
7768 | 7768 | * @return string |
7769 | 7769 | */ |
7770 | - static function (array $matches) use ($encoding): string { |
|
7771 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7770 | + static function(array $matches) use ($encoding): string { |
|
7771 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7772 | 7772 | }, |
7773 | 7773 | $str |
7774 | 7774 | ); |
7775 | 7775 | |
7776 | 7776 | // ...and end of title |
7777 | - $str = (string) \preg_replace_callback( |
|
7778 | - '~\b ( ' . $smallWordsRx . ' ) # small word... |
|
7777 | + $str = (string)\preg_replace_callback( |
|
7778 | + '~\b ( '.$smallWordsRx.' ) # small word... |
|
7779 | 7779 | (?= [[:punct:]]* \Z # ...at the end of the title... |
7780 | 7780 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
7781 | 7781 | ~uxi', |
@@ -7784,7 +7784,7 @@ discard block |
||
7784 | 7784 | * |
7785 | 7785 | * @return string |
7786 | 7786 | */ |
7787 | - static function (array $matches) use ($encoding): string { |
|
7787 | + static function(array $matches) use ($encoding): string { |
|
7788 | 7788 | return static::str_upper_first($matches[1], $encoding); |
7789 | 7789 | }, |
7790 | 7790 | $str |
@@ -7792,10 +7792,10 @@ discard block |
||
7792 | 7792 | |
7793 | 7793 | // Exceptions for small words in hyphenated compound words. |
7794 | 7794 | // e.g. "in-flight" -> In-Flight |
7795 | - $str = (string) \preg_replace_callback( |
|
7795 | + $str = (string)\preg_replace_callback( |
|
7796 | 7796 | '~\b |
7797 | 7797 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
7798 | - ( ' . $smallWordsRx . ' ) |
|
7798 | + ( ' . $smallWordsRx.' ) |
|
7799 | 7799 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
7800 | 7800 | ~uxi', |
7801 | 7801 | /** |
@@ -7803,18 +7803,18 @@ discard block |
||
7803 | 7803 | * |
7804 | 7804 | * @return string |
7805 | 7805 | */ |
7806 | - static function (array $matches) use ($encoding): string { |
|
7806 | + static function(array $matches) use ($encoding): string { |
|
7807 | 7807 | return static::str_upper_first($matches[1], $encoding); |
7808 | 7808 | }, |
7809 | 7809 | $str |
7810 | 7810 | ); |
7811 | 7811 | |
7812 | 7812 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
7813 | - $str = (string) \preg_replace_callback( |
|
7813 | + $str = (string)\preg_replace_callback( |
|
7814 | 7814 | '~\b |
7815 | 7815 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
7816 | 7816 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
7817 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
7817 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
7818 | 7818 | (?! - ) # Negative lookahead for another - |
7819 | 7819 | ~uxi', |
7820 | 7820 | /** |
@@ -7822,8 +7822,8 @@ discard block |
||
7822 | 7822 | * |
7823 | 7823 | * @return string |
7824 | 7824 | */ |
7825 | - static function (array $matches) use ($encoding): string { |
|
7826 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
7825 | + static function(array $matches) use ($encoding): string { |
|
7826 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
7827 | 7827 | }, |
7828 | 7828 | $str |
7829 | 7829 | ); |
@@ -7926,7 +7926,7 @@ discard block |
||
7926 | 7926 | ); |
7927 | 7927 | |
7928 | 7928 | foreach ($tmpReturn as &$item) { |
7929 | - $item = (string) $item; |
|
7929 | + $item = (string)$item; |
|
7930 | 7930 | } |
7931 | 7931 | |
7932 | 7932 | return $tmpReturn; |
@@ -7971,39 +7971,39 @@ discard block |
||
7971 | 7971 | } |
7972 | 7972 | |
7973 | 7973 | if ($encoding === 'UTF-8') { |
7974 | - if ($length >= (int) \mb_strlen($str)) { |
|
7974 | + if ($length >= (int)\mb_strlen($str)) { |
|
7975 | 7975 | return $str; |
7976 | 7976 | } |
7977 | 7977 | |
7978 | 7978 | if ($substring !== '') { |
7979 | - $length -= (int) \mb_strlen($substring); |
|
7979 | + $length -= (int)\mb_strlen($substring); |
|
7980 | 7980 | |
7981 | 7981 | /** @noinspection UnnecessaryCastingInspection */ |
7982 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
7982 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
7983 | 7983 | } |
7984 | 7984 | |
7985 | 7985 | /** @noinspection UnnecessaryCastingInspection */ |
7986 | - return (string) \mb_substr($str, 0, $length); |
|
7986 | + return (string)\mb_substr($str, 0, $length); |
|
7987 | 7987 | } |
7988 | 7988 | |
7989 | 7989 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7990 | 7990 | |
7991 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
7991 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
7992 | 7992 | return $str; |
7993 | 7993 | } |
7994 | 7994 | |
7995 | 7995 | if ($substring !== '') { |
7996 | - $length -= (int) self::strlen($substring, $encoding); |
|
7996 | + $length -= (int)self::strlen($substring, $encoding); |
|
7997 | 7997 | } |
7998 | 7998 | |
7999 | 7999 | return ( |
8000 | - (string) self::substr( |
|
8000 | + (string)self::substr( |
|
8001 | 8001 | $str, |
8002 | 8002 | 0, |
8003 | 8003 | $length, |
8004 | 8004 | $encoding |
8005 | 8005 | ) |
8006 | - ) . $substring; |
|
8006 | + ).$substring; |
|
8007 | 8007 | } |
8008 | 8008 | |
8009 | 8009 | /** |
@@ -8033,12 +8033,12 @@ discard block |
||
8033 | 8033 | } |
8034 | 8034 | |
8035 | 8035 | if ($encoding === 'UTF-8') { |
8036 | - if ($length >= (int) \mb_strlen($str)) { |
|
8036 | + if ($length >= (int)\mb_strlen($str)) { |
|
8037 | 8037 | return $str; |
8038 | 8038 | } |
8039 | 8039 | |
8040 | 8040 | // need to further trim the string so we can append the substring |
8041 | - $length -= (int) \mb_strlen($substring); |
|
8041 | + $length -= (int)\mb_strlen($substring); |
|
8042 | 8042 | if ($length <= 0) { |
8043 | 8043 | return $substring; |
8044 | 8044 | } |
@@ -8060,18 +8060,18 @@ discard block |
||
8060 | 8060 | || |
8061 | 8061 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8062 | 8062 | ) { |
8063 | - $truncated = (string) \mb_substr($truncated, 0, (int) $lastPos); |
|
8063 | + $truncated = (string)\mb_substr($truncated, 0, (int)$lastPos); |
|
8064 | 8064 | } |
8065 | 8065 | } |
8066 | 8066 | } else { |
8067 | 8067 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8068 | 8068 | |
8069 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8069 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8070 | 8070 | return $str; |
8071 | 8071 | } |
8072 | 8072 | |
8073 | 8073 | // need to further trim the string so we can append the substring |
8074 | - $length -= (int) self::strlen($substring, $encoding); |
|
8074 | + $length -= (int)self::strlen($substring, $encoding); |
|
8075 | 8075 | if ($length <= 0) { |
8076 | 8076 | return $substring; |
8077 | 8077 | } |
@@ -8093,12 +8093,12 @@ discard block |
||
8093 | 8093 | || |
8094 | 8094 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
8095 | 8095 | ) { |
8096 | - $truncated = (string) self::substr($truncated, 0, (int) $lastPos, $encoding); |
|
8096 | + $truncated = (string)self::substr($truncated, 0, (int)$lastPos, $encoding); |
|
8097 | 8097 | } |
8098 | 8098 | } |
8099 | 8099 | } |
8100 | 8100 | |
8101 | - return $truncated . $substring; |
|
8101 | + return $truncated.$substring; |
|
8102 | 8102 | } |
8103 | 8103 | |
8104 | 8104 | /** |
@@ -8188,13 +8188,13 @@ discard block |
||
8188 | 8188 | } |
8189 | 8189 | } elseif ($format === 2) { |
8190 | 8190 | $numberOfWords = []; |
8191 | - $offset = (int) self::strlen($strParts[0]); |
|
8191 | + $offset = (int)self::strlen($strParts[0]); |
|
8192 | 8192 | for ($i = 1; $i < $len; $i += 2) { |
8193 | 8193 | $numberOfWords[$offset] = $strParts[$i]; |
8194 | - $offset += (int) self::strlen($strParts[$i]) + (int) self::strlen($strParts[$i + 1]); |
|
8194 | + $offset += (int)self::strlen($strParts[$i]) + (int)self::strlen($strParts[$i + 1]); |
|
8195 | 8195 | } |
8196 | 8196 | } else { |
8197 | - $numberOfWords = (int) (($len - 1) / 2); |
|
8197 | + $numberOfWords = (int)(($len - 1) / 2); |
|
8198 | 8198 | } |
8199 | 8199 | |
8200 | 8200 | return $numberOfWords; |
@@ -8258,7 +8258,7 @@ discard block |
||
8258 | 8258 | */ |
8259 | 8259 | public static function strcmp(string $str1, string $str2): int |
8260 | 8260 | { |
8261 | - return $str1 . '' === $str2 . '' ? 0 : \strcmp( |
|
8261 | + return $str1.'' === $str2.'' ? 0 : \strcmp( |
|
8262 | 8262 | \Normalizer::normalize($str1, \Normalizer::NFD), |
8263 | 8263 | \Normalizer::normalize($str2, \Normalizer::NFD) |
8264 | 8264 | ); |
@@ -8287,21 +8287,21 @@ discard block |
||
8287 | 8287 | } |
8288 | 8288 | |
8289 | 8289 | if ($charList === '') { |
8290 | - return (int) self::strlen($str, $encoding); |
|
8290 | + return (int)self::strlen($str, $encoding); |
|
8291 | 8291 | } |
8292 | 8292 | |
8293 | 8293 | if ($offset !== null || $length !== null) { |
8294 | 8294 | if ($encoding === 'UTF-8') { |
8295 | 8295 | if ($length === null) { |
8296 | 8296 | /** @noinspection UnnecessaryCastingInspection */ |
8297 | - $strTmp = \mb_substr($str, (int) $offset); |
|
8297 | + $strTmp = \mb_substr($str, (int)$offset); |
|
8298 | 8298 | } else { |
8299 | 8299 | /** @noinspection UnnecessaryCastingInspection */ |
8300 | - $strTmp = \mb_substr($str, (int) $offset, $length); |
|
8300 | + $strTmp = \mb_substr($str, (int)$offset, $length); |
|
8301 | 8301 | } |
8302 | 8302 | } else { |
8303 | 8303 | /** @noinspection UnnecessaryCastingInspection */ |
8304 | - $strTmp = self::substr($str, (int) $offset, $length, $encoding); |
|
8304 | + $strTmp = self::substr($str, (int)$offset, $length, $encoding); |
|
8305 | 8305 | } |
8306 | 8306 | if ($strTmp === false) { |
8307 | 8307 | return 0; |
@@ -8314,7 +8314,7 @@ discard block |
||
8314 | 8314 | } |
8315 | 8315 | |
8316 | 8316 | $matches = []; |
8317 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $matches)) { |
|
8317 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $matches)) { |
|
8318 | 8318 | $return = self::strlen($matches[1], $encoding); |
8319 | 8319 | if ($return === false) { |
8320 | 8320 | return 0; |
@@ -8323,7 +8323,7 @@ discard block |
||
8323 | 8323 | return $return; |
8324 | 8324 | } |
8325 | 8325 | |
8326 | - return (int) self::strlen($str, $encoding); |
|
8326 | + return (int)self::strlen($str, $encoding); |
|
8327 | 8327 | } |
8328 | 8328 | |
8329 | 8329 | /** |
@@ -8445,7 +8445,7 @@ discard block |
||
8445 | 8445 | return ''; |
8446 | 8446 | } |
8447 | 8447 | |
8448 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
8448 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
8449 | 8449 | } |
8450 | 8450 | |
8451 | 8451 | /** |
@@ -8510,7 +8510,7 @@ discard block |
||
8510 | 8510 | // fallback for ascii only |
8511 | 8511 | // |
8512 | 8512 | |
8513 | - if (self::is_ascii($haystack . $needle)) { |
|
8513 | + if (self::is_ascii($haystack.$needle)) { |
|
8514 | 8514 | return \stripos($haystack, $needle, $offset); |
8515 | 8515 | } |
8516 | 8516 | |
@@ -8577,7 +8577,7 @@ discard block |
||
8577 | 8577 | && |
8578 | 8578 | self::$SUPPORT['mbstring'] === false |
8579 | 8579 | ) { |
8580 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8580 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8581 | 8581 | } |
8582 | 8582 | |
8583 | 8583 | if ( |
@@ -8591,11 +8591,11 @@ discard block |
||
8591 | 8591 | } |
8592 | 8592 | } |
8593 | 8593 | |
8594 | - if (self::is_ascii($needle . $haystack)) { |
|
8594 | + if (self::is_ascii($needle.$haystack)) { |
|
8595 | 8595 | return \stristr($haystack, $needle, $before_needle); |
8596 | 8596 | } |
8597 | 8597 | |
8598 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
8598 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
8599 | 8599 | |
8600 | 8600 | if (!isset($match[1])) { |
8601 | 8601 | return false; |
@@ -8605,7 +8605,7 @@ discard block |
||
8605 | 8605 | return $match[1]; |
8606 | 8606 | } |
8607 | 8607 | |
8608 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
8608 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
8609 | 8609 | } |
8610 | 8610 | |
8611 | 8611 | /** |
@@ -8672,7 +8672,7 @@ discard block |
||
8672 | 8672 | && |
8673 | 8673 | self::$SUPPORT['iconv'] === false |
8674 | 8674 | ) { |
8675 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8675 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8676 | 8676 | } |
8677 | 8677 | |
8678 | 8678 | // |
@@ -8783,7 +8783,7 @@ discard block |
||
8783 | 8783 | */ |
8784 | 8784 | public static function strnatcmp(string $str1, string $str2): int |
8785 | 8785 | { |
8786 | - return $str1 . '' === $str2 . '' ? 0 : \strnatcmp((string) self::strtonatfold($str1), (string) self::strtonatfold($str2)); |
|
8786 | + return $str1.'' === $str2.'' ? 0 : \strnatcmp((string)self::strtonatfold($str1), (string)self::strtonatfold($str2)); |
|
8787 | 8787 | } |
8788 | 8788 | |
8789 | 8789 | /** |
@@ -8840,11 +8840,11 @@ discard block |
||
8840 | 8840 | } |
8841 | 8841 | |
8842 | 8842 | if ($encoding === 'UTF-8') { |
8843 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
8844 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
8843 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
8844 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
8845 | 8845 | } else { |
8846 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
8847 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
8846 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
8847 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
8848 | 8848 | } |
8849 | 8849 | |
8850 | 8850 | return self::strcmp($str1, $str2); |
@@ -8866,8 +8866,8 @@ discard block |
||
8866 | 8866 | return false; |
8867 | 8867 | } |
8868 | 8868 | |
8869 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
8870 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
8869 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
8870 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
8871 | 8871 | } |
8872 | 8872 | |
8873 | 8873 | return false; |
@@ -8900,10 +8900,10 @@ discard block |
||
8900 | 8900 | } |
8901 | 8901 | |
8902 | 8902 | // iconv and mbstring do not support integer $needle |
8903 | - if ((int) $needle === $needle) { |
|
8904 | - $needle = (string) self::chr($needle); |
|
8903 | + if ((int)$needle === $needle) { |
|
8904 | + $needle = (string)self::chr($needle); |
|
8905 | 8905 | } |
8906 | - $needle = (string) $needle; |
|
8906 | + $needle = (string)$needle; |
|
8907 | 8907 | |
8908 | 8908 | if ($needle === '') { |
8909 | 8909 | return false; |
@@ -8950,7 +8950,7 @@ discard block |
||
8950 | 8950 | && |
8951 | 8951 | self::$SUPPORT['mbstring'] === false |
8952 | 8952 | ) { |
8953 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8953 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8954 | 8954 | } |
8955 | 8955 | |
8956 | 8956 | // |
@@ -8991,7 +8991,7 @@ discard block |
||
8991 | 8991 | // fallback for ascii only |
8992 | 8992 | // |
8993 | 8993 | |
8994 | - if (self::is_ascii($haystack . $needle)) { |
|
8994 | + if (self::is_ascii($haystack.$needle)) { |
|
8995 | 8995 | return \strpos($haystack, $needle, $offset); |
8996 | 8996 | } |
8997 | 8997 | |
@@ -9003,7 +9003,7 @@ discard block |
||
9003 | 9003 | if ($haystackTmp === false) { |
9004 | 9004 | $haystackTmp = ''; |
9005 | 9005 | } |
9006 | - $haystack = (string) $haystackTmp; |
|
9006 | + $haystack = (string)$haystackTmp; |
|
9007 | 9007 | |
9008 | 9008 | if ($offset < 0) { |
9009 | 9009 | $offset = 0; |
@@ -9015,7 +9015,7 @@ discard block |
||
9015 | 9015 | } |
9016 | 9016 | |
9017 | 9017 | if ($pos) { |
9018 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9018 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
9019 | 9019 | } |
9020 | 9020 | |
9021 | 9021 | return $offset + 0; |
@@ -9126,7 +9126,7 @@ discard block |
||
9126 | 9126 | && |
9127 | 9127 | self::$SUPPORT['mbstring'] === false |
9128 | 9128 | ) { |
9129 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9129 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9130 | 9130 | } |
9131 | 9131 | |
9132 | 9132 | // |
@@ -9138,7 +9138,7 @@ discard block |
||
9138 | 9138 | if ($needleTmp === false) { |
9139 | 9139 | return false; |
9140 | 9140 | } |
9141 | - $needle = (string) $needleTmp; |
|
9141 | + $needle = (string)$needleTmp; |
|
9142 | 9142 | |
9143 | 9143 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
9144 | 9144 | if ($pos === false) { |
@@ -9160,7 +9160,7 @@ discard block |
||
9160 | 9160 | if ($needleTmp === false) { |
9161 | 9161 | return false; |
9162 | 9162 | } |
9163 | - $needle = (string) $needleTmp; |
|
9163 | + $needle = (string)$needleTmp; |
|
9164 | 9164 | |
9165 | 9165 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
9166 | 9166 | if ($pos === false) { |
@@ -9196,7 +9196,7 @@ discard block |
||
9196 | 9196 | if ($encoding === 'UTF-8') { |
9197 | 9197 | if (self::$SUPPORT['intl'] === true) { |
9198 | 9198 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
9199 | - $i = (int) \grapheme_strlen($str); |
|
9199 | + $i = (int)\grapheme_strlen($str); |
|
9200 | 9200 | while ($i--) { |
9201 | 9201 | $reversedTmp = \grapheme_substr($str, $i, 1); |
9202 | 9202 | if ($reversedTmp !== false) { |
@@ -9204,7 +9204,7 @@ discard block |
||
9204 | 9204 | } |
9205 | 9205 | } |
9206 | 9206 | } else { |
9207 | - $i = (int) \mb_strlen($str); |
|
9207 | + $i = (int)\mb_strlen($str); |
|
9208 | 9208 | while ($i--) { |
9209 | 9209 | $reversedTmp = \mb_substr($str, $i, 1); |
9210 | 9210 | if ($reversedTmp !== false) { |
@@ -9215,7 +9215,7 @@ discard block |
||
9215 | 9215 | } else { |
9216 | 9216 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9217 | 9217 | |
9218 | - $i = (int) self::strlen($str, $encoding); |
|
9218 | + $i = (int)self::strlen($str, $encoding); |
|
9219 | 9219 | while ($i--) { |
9220 | 9220 | $reversedTmp = self::substr($str, $i, 1, $encoding); |
9221 | 9221 | if ($reversedTmp !== false) { |
@@ -9289,7 +9289,7 @@ discard block |
||
9289 | 9289 | if ($needleTmp === false) { |
9290 | 9290 | return false; |
9291 | 9291 | } |
9292 | - $needle = (string) $needleTmp; |
|
9292 | + $needle = (string)$needleTmp; |
|
9293 | 9293 | |
9294 | 9294 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
9295 | 9295 | if ($pos === false) { |
@@ -9328,10 +9328,10 @@ discard block |
||
9328 | 9328 | } |
9329 | 9329 | |
9330 | 9330 | // iconv and mbstring do not support integer $needle |
9331 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9332 | - $needle = (string) self::chr($needle); |
|
9331 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9332 | + $needle = (string)self::chr($needle); |
|
9333 | 9333 | } |
9334 | - $needle = (string) $needle; |
|
9334 | + $needle = (string)$needle; |
|
9335 | 9335 | |
9336 | 9336 | if ($needle === '') { |
9337 | 9337 | return false; |
@@ -9376,7 +9376,7 @@ discard block |
||
9376 | 9376 | && |
9377 | 9377 | self::$SUPPORT['mbstring'] === false |
9378 | 9378 | ) { |
9379 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9379 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9380 | 9380 | } |
9381 | 9381 | |
9382 | 9382 | // |
@@ -9400,7 +9400,7 @@ discard block |
||
9400 | 9400 | // fallback for ascii only |
9401 | 9401 | // |
9402 | 9402 | |
9403 | - if (self::is_ascii($haystack . $needle)) { |
|
9403 | + if (self::is_ascii($haystack.$needle)) { |
|
9404 | 9404 | return \strripos($haystack, $needle, $offset); |
9405 | 9405 | } |
9406 | 9406 | |
@@ -9476,10 +9476,10 @@ discard block |
||
9476 | 9476 | } |
9477 | 9477 | |
9478 | 9478 | // iconv and mbstring do not support integer $needle |
9479 | - if ((int) $needle === $needle && $needle >= 0) { |
|
9480 | - $needle = (string) self::chr($needle); |
|
9479 | + if ((int)$needle === $needle && $needle >= 0) { |
|
9480 | + $needle = (string)self::chr($needle); |
|
9481 | 9481 | } |
9482 | - $needle = (string) $needle; |
|
9482 | + $needle = (string)$needle; |
|
9483 | 9483 | |
9484 | 9484 | if ($needle === '' || $haystack === '') { |
9485 | 9485 | return false; |
@@ -9524,7 +9524,7 @@ discard block |
||
9524 | 9524 | && |
9525 | 9525 | self::$SUPPORT['mbstring'] === false |
9526 | 9526 | ) { |
9527 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9527 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9528 | 9528 | } |
9529 | 9529 | |
9530 | 9530 | // |
@@ -9548,7 +9548,7 @@ discard block |
||
9548 | 9548 | // fallback for ascii only |
9549 | 9549 | // |
9550 | 9550 | |
9551 | - if (self::is_ascii($haystack . $needle)) { |
|
9551 | + if (self::is_ascii($haystack.$needle)) { |
|
9552 | 9552 | return \strrpos($haystack, $needle, $offset); |
9553 | 9553 | } |
9554 | 9554 | |
@@ -9568,7 +9568,7 @@ discard block |
||
9568 | 9568 | if ($haystackTmp === false) { |
9569 | 9569 | $haystackTmp = ''; |
9570 | 9570 | } |
9571 | - $haystack = (string) $haystackTmp; |
|
9571 | + $haystack = (string)$haystackTmp; |
|
9572 | 9572 | } |
9573 | 9573 | |
9574 | 9574 | $pos = \strrpos($haystack, $needle); |
@@ -9581,7 +9581,7 @@ discard block |
||
9581 | 9581 | return false; |
9582 | 9582 | } |
9583 | 9583 | |
9584 | - return $offset + (int) self::strlen($strTmp); |
|
9584 | + return $offset + (int)self::strlen($strTmp); |
|
9585 | 9585 | } |
9586 | 9586 | |
9587 | 9587 | /** |
@@ -9641,12 +9641,12 @@ discard block |
||
9641 | 9641 | if ($offset || $length !== null) { |
9642 | 9642 | if ($encoding === 'UTF-8') { |
9643 | 9643 | if ($length === null) { |
9644 | - $str = (string) \mb_substr($str, $offset); |
|
9644 | + $str = (string)\mb_substr($str, $offset); |
|
9645 | 9645 | } else { |
9646 | - $str = (string) \mb_substr($str, $offset, $length); |
|
9646 | + $str = (string)\mb_substr($str, $offset, $length); |
|
9647 | 9647 | } |
9648 | 9648 | } else { |
9649 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
9649 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
9650 | 9650 | } |
9651 | 9651 | } |
9652 | 9652 | |
@@ -9656,7 +9656,7 @@ discard block |
||
9656 | 9656 | |
9657 | 9657 | $matches = []; |
9658 | 9658 | |
9659 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
9659 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
9660 | 9660 | } |
9661 | 9661 | |
9662 | 9662 | /** |
@@ -9725,7 +9725,7 @@ discard block |
||
9725 | 9725 | && |
9726 | 9726 | self::$SUPPORT['mbstring'] === false |
9727 | 9727 | ) { |
9728 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9728 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9729 | 9729 | } |
9730 | 9730 | |
9731 | 9731 | // |
@@ -9747,7 +9747,7 @@ discard block |
||
9747 | 9747 | // fallback for ascii only |
9748 | 9748 | // |
9749 | 9749 | |
9750 | - if (self::is_ascii($haystack . $needle)) { |
|
9750 | + if (self::is_ascii($haystack.$needle)) { |
|
9751 | 9751 | return \strstr($haystack, $needle, $before_needle); |
9752 | 9752 | } |
9753 | 9753 | |
@@ -9755,7 +9755,7 @@ discard block |
||
9755 | 9755 | // fallback via vanilla php |
9756 | 9756 | // |
9757 | 9757 | |
9758 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
9758 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
9759 | 9759 | |
9760 | 9760 | if (!isset($match[1])) { |
9761 | 9761 | return false; |
@@ -9765,7 +9765,7 @@ discard block |
||
9765 | 9765 | return $match[1]; |
9766 | 9766 | } |
9767 | 9767 | |
9768 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
9768 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
9769 | 9769 | } |
9770 | 9770 | |
9771 | 9771 | /** |
@@ -9879,7 +9879,7 @@ discard block |
||
9879 | 9879 | bool $tryToKeepStringLength = false |
9880 | 9880 | ): string { |
9881 | 9881 | // init |
9882 | - $str = (string) $str; |
|
9882 | + $str = (string)$str; |
|
9883 | 9883 | |
9884 | 9884 | if ($str === '') { |
9885 | 9885 | return ''; |
@@ -9904,19 +9904,19 @@ discard block |
||
9904 | 9904 | |
9905 | 9905 | if ($lang !== null) { |
9906 | 9906 | if (self::$SUPPORT['intl'] === true) { |
9907 | - $langCode = $lang . '-Lower'; |
|
9907 | + $langCode = $lang.'-Lower'; |
|
9908 | 9908 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
9909 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, \E_USER_WARNING); |
|
9909 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, \E_USER_WARNING); |
|
9910 | 9910 | |
9911 | 9911 | $langCode = 'Any-Lower'; |
9912 | 9912 | } |
9913 | 9913 | |
9914 | 9914 | /** @noinspection PhpComposerExtensionStubsInspection */ |
9915 | 9915 | /** @noinspection UnnecessaryCastingInspection */ |
9916 | - return (string) \transliterator_transliterate($langCode, $str); |
|
9916 | + return (string)\transliterator_transliterate($langCode, $str); |
|
9917 | 9917 | } |
9918 | 9918 | |
9919 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
9919 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
9920 | 9920 | } |
9921 | 9921 | |
9922 | 9922 | // always fallback via symfony polyfill |
@@ -9945,7 +9945,7 @@ discard block |
||
9945 | 9945 | bool $tryToKeepStringLength = false |
9946 | 9946 | ): string { |
9947 | 9947 | // init |
9948 | - $str = (string) $str; |
|
9948 | + $str = (string)$str; |
|
9949 | 9949 | |
9950 | 9950 | if ($str === '') { |
9951 | 9951 | return ''; |
@@ -9970,19 +9970,19 @@ discard block |
||
9970 | 9970 | |
9971 | 9971 | if ($lang !== null) { |
9972 | 9972 | if (self::$SUPPORT['intl'] === true) { |
9973 | - $langCode = $lang . '-Upper'; |
|
9973 | + $langCode = $lang.'-Upper'; |
|
9974 | 9974 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
9975 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
9975 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
9976 | 9976 | |
9977 | 9977 | $langCode = 'Any-Upper'; |
9978 | 9978 | } |
9979 | 9979 | |
9980 | 9980 | /** @noinspection PhpComposerExtensionStubsInspection */ |
9981 | 9981 | /** @noinspection UnnecessaryCastingInspection */ |
9982 | - return (string) \transliterator_transliterate($langCode, $str); |
|
9982 | + return (string)\transliterator_transliterate($langCode, $str); |
|
9983 | 9983 | } |
9984 | 9984 | |
9985 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
9985 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
9986 | 9986 | } |
9987 | 9987 | |
9988 | 9988 | // always fallback via symfony polyfill |
@@ -10026,7 +10026,7 @@ discard block |
||
10026 | 10026 | |
10027 | 10027 | $from = \array_combine($from, $to); |
10028 | 10028 | if ($from === false) { |
10029 | - 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) . ')'); |
|
10029 | + 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).')'); |
|
10030 | 10030 | } |
10031 | 10031 | } |
10032 | 10032 | |
@@ -10083,9 +10083,9 @@ discard block |
||
10083 | 10083 | } |
10084 | 10084 | |
10085 | 10085 | $wide = 0; |
10086 | - $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); |
|
10086 | + $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); |
|
10087 | 10087 | |
10088 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
10088 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
10089 | 10089 | } |
10090 | 10090 | |
10091 | 10091 | /** |
@@ -10185,9 +10185,9 @@ discard block |
||
10185 | 10185 | } |
10186 | 10186 | |
10187 | 10187 | if ($length === null) { |
10188 | - $length = (int) $str_length; |
|
10188 | + $length = (int)$str_length; |
|
10189 | 10189 | } else { |
10190 | - $length = (int) $length; |
|
10190 | + $length = (int)$length; |
|
10191 | 10191 | } |
10192 | 10192 | |
10193 | 10193 | if ( |
@@ -10195,7 +10195,7 @@ discard block |
||
10195 | 10195 | && |
10196 | 10196 | self::$SUPPORT['mbstring'] === false |
10197 | 10197 | ) { |
10198 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10198 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10199 | 10199 | } |
10200 | 10200 | |
10201 | 10201 | // |
@@ -10283,16 +10283,16 @@ discard block |
||
10283 | 10283 | ) { |
10284 | 10284 | if ($encoding === 'UTF-8') { |
10285 | 10285 | if ($length === null) { |
10286 | - $str1 = (string) \mb_substr($str1, $offset); |
|
10286 | + $str1 = (string)\mb_substr($str1, $offset); |
|
10287 | 10287 | } else { |
10288 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
10288 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
10289 | 10289 | } |
10290 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
10290 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
10291 | 10291 | } else { |
10292 | 10292 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10293 | 10293 | |
10294 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
10295 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
10294 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
10295 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
10296 | 10296 | } |
10297 | 10297 | } |
10298 | 10298 | |
@@ -10354,13 +10354,13 @@ discard block |
||
10354 | 10354 | if ($lengthTmp === false) { |
10355 | 10355 | return false; |
10356 | 10356 | } |
10357 | - $length = (int) $lengthTmp; |
|
10357 | + $length = (int)$lengthTmp; |
|
10358 | 10358 | } |
10359 | 10359 | |
10360 | 10360 | if ($encoding === 'UTF-8') { |
10361 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
10361 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
10362 | 10362 | } else { |
10363 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
10363 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
10364 | 10364 | } |
10365 | 10365 | } |
10366 | 10366 | |
@@ -10369,7 +10369,7 @@ discard block |
||
10369 | 10369 | && |
10370 | 10370 | self::$SUPPORT['mbstring'] === false |
10371 | 10371 | ) { |
10372 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10372 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10373 | 10373 | } |
10374 | 10374 | |
10375 | 10375 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10380,7 +10380,7 @@ discard block |
||
10380 | 10380 | return \mb_substr_count($haystack, $needle, $encoding); |
10381 | 10381 | } |
10382 | 10382 | |
10383 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10383 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
10384 | 10384 | |
10385 | 10385 | return \count($matches); |
10386 | 10386 | } |
@@ -10427,7 +10427,7 @@ discard block |
||
10427 | 10427 | if ($lengthTmp === false) { |
10428 | 10428 | return false; |
10429 | 10429 | } |
10430 | - $length = (int) $lengthTmp; |
|
10430 | + $length = (int)$lengthTmp; |
|
10431 | 10431 | } |
10432 | 10432 | |
10433 | 10433 | if ( |
@@ -10448,7 +10448,7 @@ discard block |
||
10448 | 10448 | if ($haystackTmp === false) { |
10449 | 10449 | $haystackTmp = ''; |
10450 | 10450 | } |
10451 | - $haystack = (string) $haystackTmp; |
|
10451 | + $haystack = (string)$haystackTmp; |
|
10452 | 10452 | } |
10453 | 10453 | |
10454 | 10454 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10487,10 +10487,10 @@ discard block |
||
10487 | 10487 | |
10488 | 10488 | if ($encoding === 'UTF-8') { |
10489 | 10489 | if ($caseSensitive) { |
10490 | - return (int) \mb_substr_count($str, $substring); |
|
10490 | + return (int)\mb_substr_count($str, $substring); |
|
10491 | 10491 | } |
10492 | 10492 | |
10493 | - return (int) \mb_substr_count( |
|
10493 | + return (int)\mb_substr_count( |
|
10494 | 10494 | \mb_strtoupper($str), |
10495 | 10495 | \mb_strtoupper($substring) |
10496 | 10496 | |
@@ -10500,10 +10500,10 @@ discard block |
||
10500 | 10500 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10501 | 10501 | |
10502 | 10502 | if ($caseSensitive) { |
10503 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
10503 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
10504 | 10504 | } |
10505 | 10505 | |
10506 | - return (int) \mb_substr_count( |
|
10506 | + return (int)\mb_substr_count( |
|
10507 | 10507 | self::strtocasefold($str, true, false, $encoding, null, false), |
10508 | 10508 | self::strtocasefold($substring, true, false, $encoding, null, false), |
10509 | 10509 | $encoding |
@@ -10529,7 +10529,7 @@ discard block |
||
10529 | 10529 | } |
10530 | 10530 | |
10531 | 10531 | if (self::str_istarts_with($haystack, $needle) === true) { |
10532 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10532 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10533 | 10533 | } |
10534 | 10534 | |
10535 | 10535 | return $haystack; |
@@ -10586,7 +10586,7 @@ discard block |
||
10586 | 10586 | } |
10587 | 10587 | |
10588 | 10588 | if (self::str_iends_with($haystack, $needle) === true) { |
10589 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
10589 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
10590 | 10590 | } |
10591 | 10591 | |
10592 | 10592 | return $haystack; |
@@ -10611,7 +10611,7 @@ discard block |
||
10611 | 10611 | } |
10612 | 10612 | |
10613 | 10613 | if (self::str_starts_with($haystack, $needle) === true) { |
10614 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
10614 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
10615 | 10615 | } |
10616 | 10616 | |
10617 | 10617 | return $haystack; |
@@ -10663,7 +10663,7 @@ discard block |
||
10663 | 10663 | if (\is_array($offset) === true) { |
10664 | 10664 | $offset = \array_slice($offset, 0, $num); |
10665 | 10665 | foreach ($offset as &$valueTmp) { |
10666 | - $valueTmp = (int) $valueTmp === $valueTmp ? $valueTmp : 0; |
|
10666 | + $valueTmp = (int)$valueTmp === $valueTmp ? $valueTmp : 0; |
|
10667 | 10667 | } |
10668 | 10668 | unset($valueTmp); |
10669 | 10669 | } else { |
@@ -10676,7 +10676,7 @@ discard block |
||
10676 | 10676 | } elseif (\is_array($length) === true) { |
10677 | 10677 | $length = \array_slice($length, 0, $num); |
10678 | 10678 | foreach ($length as &$valueTmpV2) { |
10679 | - $valueTmpV2 = (int) $valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10679 | + $valueTmpV2 = (int)$valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
10680 | 10680 | } |
10681 | 10681 | unset($valueTmpV2); |
10682 | 10682 | } else { |
@@ -10696,8 +10696,8 @@ discard block |
||
10696 | 10696 | } |
10697 | 10697 | |
10698 | 10698 | // init |
10699 | - $str = (string) $str; |
|
10700 | - $replacement = (string) $replacement; |
|
10699 | + $str = (string)$str; |
|
10700 | + $replacement = (string)$replacement; |
|
10701 | 10701 | |
10702 | 10702 | if (\is_array($length) === true) { |
10703 | 10703 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -10712,16 +10712,16 @@ discard block |
||
10712 | 10712 | } |
10713 | 10713 | |
10714 | 10714 | if (self::$SUPPORT['mbstring'] === true) { |
10715 | - $string_length = (int) self::strlen($str, $encoding); |
|
10715 | + $string_length = (int)self::strlen($str, $encoding); |
|
10716 | 10716 | |
10717 | 10717 | if ($offset < 0) { |
10718 | - $offset = (int) \max(0, $string_length + $offset); |
|
10718 | + $offset = (int)\max(0, $string_length + $offset); |
|
10719 | 10719 | } elseif ($offset > $string_length) { |
10720 | 10720 | $offset = $string_length; |
10721 | 10721 | } |
10722 | 10722 | |
10723 | 10723 | if ($length !== null && $length < 0) { |
10724 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
10724 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
10725 | 10725 | } elseif ($length === null || $length > $string_length) { |
10726 | 10726 | $length = $string_length; |
10727 | 10727 | } |
@@ -10732,9 +10732,9 @@ discard block |
||
10732 | 10732 | } |
10733 | 10733 | |
10734 | 10734 | /** @noinspection AdditionOperationOnArraysInspection */ |
10735 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
10736 | - $replacement . |
|
10737 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10735 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
10736 | + $replacement. |
|
10737 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
10738 | 10738 | } |
10739 | 10739 | |
10740 | 10740 | // |
@@ -10743,8 +10743,7 @@ discard block |
||
10743 | 10743 | |
10744 | 10744 | if (self::is_ascii($str)) { |
10745 | 10745 | return ($length === null) ? |
10746 | - \substr_replace($str, $replacement, $offset) : |
|
10747 | - \substr_replace($str, $replacement, $offset, $length); |
|
10746 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
10748 | 10747 | } |
10749 | 10748 | |
10750 | 10749 | // |
@@ -10760,7 +10759,7 @@ discard block |
||
10760 | 10759 | // e.g.: non mbstring support + invalid chars |
10761 | 10760 | return ''; |
10762 | 10761 | } |
10763 | - $length = (int) $lengthTmp; |
|
10762 | + $length = (int)$lengthTmp; |
|
10764 | 10763 | } |
10765 | 10764 | |
10766 | 10765 | \array_splice($smatches[0], $offset, $length, $rmatches[0]); |
@@ -10795,14 +10794,14 @@ discard block |
||
10795 | 10794 | && |
10796 | 10795 | \substr($haystack, -\strlen($needle)) === $needle |
10797 | 10796 | ) { |
10798 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
10797 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
10799 | 10798 | } |
10800 | 10799 | |
10801 | 10800 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
10802 | - return (string) self::substr( |
|
10801 | + return (string)self::substr( |
|
10803 | 10802 | $haystack, |
10804 | 10803 | 0, |
10805 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
10804 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
10806 | 10805 | $encoding |
10807 | 10806 | ); |
10808 | 10807 | } |
@@ -10832,10 +10831,10 @@ discard block |
||
10832 | 10831 | } |
10833 | 10832 | |
10834 | 10833 | if ($encoding === 'UTF-8') { |
10835 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10834 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
10836 | 10835 | } |
10837 | 10836 | |
10838 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10837 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
10839 | 10838 | } |
10840 | 10839 | |
10841 | 10840 | /** |
@@ -11031,7 +11030,7 @@ discard block |
||
11031 | 11030 | // INFO: https://unicode.org/cldr/utility/character.jsp?a=%E2%84%8C |
11032 | 11031 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11033 | 11032 | /** @noinspection UnnecessaryCastingInspection */ |
11034 | - $str = (string) \transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11033 | + $str = (string)\transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
11035 | 11034 | |
11036 | 11035 | // check again, if we only have ASCII, now ... |
11037 | 11036 | if (self::is_ascii($str) === true) { |
@@ -11154,7 +11153,7 @@ discard block |
||
11154 | 11153 | public static function to_boolean($str): bool |
11155 | 11154 | { |
11156 | 11155 | // init |
11157 | - $str = (string) $str; |
|
11156 | + $str = (string)$str; |
|
11158 | 11157 | |
11159 | 11158 | if ($str === '') { |
11160 | 11159 | return false; |
@@ -11182,10 +11181,10 @@ discard block |
||
11182 | 11181 | } |
11183 | 11182 | |
11184 | 11183 | if (\is_numeric($str)) { |
11185 | - return ((float) $str + 0) > 0; |
|
11184 | + return ((float)$str + 0) > 0; |
|
11186 | 11185 | } |
11187 | 11186 | |
11188 | - return (bool) \trim($str); |
|
11187 | + return (bool)\trim($str); |
|
11189 | 11188 | } |
11190 | 11189 | |
11191 | 11190 | /** |
@@ -11206,11 +11205,11 @@ discard block |
||
11206 | 11205 | |
11207 | 11206 | $fallback_char_escaped = \preg_quote($fallback_char, '/'); |
11208 | 11207 | |
11209 | - $string = (string) \preg_replace( |
|
11208 | + $string = (string)\preg_replace( |
|
11210 | 11209 | [ |
11211 | - '/[^' . $fallback_char_escaped . '\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
11212 | - '/[\s]+/', // 2) convert spaces to $fallback_char |
|
11213 | - '/[' . $fallback_char_escaped . ']+/', // 3) remove double $fallback_char's |
|
11210 | + '/[^'.$fallback_char_escaped.'\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
11211 | + '/[\s]+/', // 2) convert spaces to $fallback_char |
|
11212 | + '/['.$fallback_char_escaped.']+/', // 3) remove double $fallback_char's |
|
11214 | 11213 | ], |
11215 | 11214 | [ |
11216 | 11215 | '', |
@@ -11241,7 +11240,7 @@ discard block |
||
11241 | 11240 | return $str; |
11242 | 11241 | } |
11243 | 11242 | |
11244 | - $str = (string) $str; |
|
11243 | + $str = (string)$str; |
|
11245 | 11244 | if ($str === '') { |
11246 | 11245 | return ''; |
11247 | 11246 | } |
@@ -11288,7 +11287,7 @@ discard block |
||
11288 | 11287 | return $str; |
11289 | 11288 | } |
11290 | 11289 | |
11291 | - $str = (string) $str; |
|
11290 | + $str = (string)$str; |
|
11292 | 11291 | if ($str === '') { |
11293 | 11292 | return $str; |
11294 | 11293 | } |
@@ -11306,7 +11305,7 @@ discard block |
||
11306 | 11305 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
11307 | 11306 | |
11308 | 11307 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11309 | - $buf .= $c1 . $c2; |
|
11308 | + $buf .= $c1.$c2; |
|
11310 | 11309 | ++$i; |
11311 | 11310 | } else { // not valid UTF8 - convert it |
11312 | 11311 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11317,7 +11316,7 @@ discard block |
||
11317 | 11316 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
11318 | 11317 | |
11319 | 11318 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11320 | - $buf .= $c1 . $c2 . $c3; |
|
11319 | + $buf .= $c1.$c2.$c3; |
|
11321 | 11320 | $i += 2; |
11322 | 11321 | } else { // not valid UTF8 - convert it |
11323 | 11322 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11329,7 +11328,7 @@ discard block |
||
11329 | 11328 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
11330 | 11329 | |
11331 | 11330 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
11332 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
11331 | + $buf .= $c1.$c2.$c3.$c4; |
|
11333 | 11332 | $i += 3; |
11334 | 11333 | } else { // not valid UTF8 - convert it |
11335 | 11334 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11355,13 +11354,13 @@ discard block |
||
11355 | 11354 | * |
11356 | 11355 | * @return string |
11357 | 11356 | */ |
11358 | - static function (array $matches): string { |
|
11357 | + static function(array $matches): string { |
|
11359 | 11358 | if (isset($matches[3])) { |
11360 | - $cp = (int) \hexdec($matches[3]); |
|
11359 | + $cp = (int)\hexdec($matches[3]); |
|
11361 | 11360 | } else { |
11362 | 11361 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
11363 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
11364 | - + (int) \hexdec($matches[2]) |
|
11362 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
11363 | + + (int)\hexdec($matches[2]) |
|
11365 | 11364 | + 0x10000 |
11366 | 11365 | - (0xD800 << 10) |
11367 | 11366 | - 0xDC00; |
@@ -11372,12 +11371,12 @@ discard block |
||
11372 | 11371 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
11373 | 11372 | |
11374 | 11373 | if ($cp < 0x80) { |
11375 | - return (string) self::chr($cp); |
|
11374 | + return (string)self::chr($cp); |
|
11376 | 11375 | } |
11377 | 11376 | |
11378 | 11377 | if ($cp < 0xA0) { |
11379 | 11378 | /** @noinspection UnnecessaryCastingInspection */ |
11380 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
11379 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
11381 | 11380 | } |
11382 | 11381 | |
11383 | 11382 | return self::decimal_to_chr($cp); |
@@ -11425,7 +11424,7 @@ discard block |
||
11425 | 11424 | |
11426 | 11425 | if (self::$SUPPORT['mbstring'] === true) { |
11427 | 11426 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11428 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
11427 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
11429 | 11428 | } |
11430 | 11429 | |
11431 | 11430 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -11462,15 +11461,15 @@ discard block |
||
11462 | 11461 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
11463 | 11462 | |
11464 | 11463 | if ($encoding === 'UTF-8') { |
11465 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
11464 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
11466 | 11465 | |
11467 | 11466 | if ($useMbFunction === true) { |
11468 | 11467 | $strPartOne = \mb_strtoupper( |
11469 | - (string) \mb_substr($str, 0, 1) |
|
11468 | + (string)\mb_substr($str, 0, 1) |
|
11470 | 11469 | ); |
11471 | 11470 | } else { |
11472 | 11471 | $strPartOne = self::strtoupper( |
11473 | - (string) \mb_substr($str, 0, 1), |
|
11472 | + (string)\mb_substr($str, 0, 1), |
|
11474 | 11473 | $encoding, |
11475 | 11474 | false, |
11476 | 11475 | $lang, |
@@ -11480,16 +11479,16 @@ discard block |
||
11480 | 11479 | } else { |
11481 | 11480 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11482 | 11481 | |
11483 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
11482 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
11484 | 11483 | |
11485 | 11484 | if ($useMbFunction === true) { |
11486 | 11485 | $strPartOne = \mb_strtoupper( |
11487 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
11486 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
11488 | 11487 | $encoding |
11489 | 11488 | ); |
11490 | 11489 | } else { |
11491 | 11490 | $strPartOne = self::strtoupper( |
11492 | - (string) self::substr($str, 0, 1, $encoding), |
|
11491 | + (string)self::substr($str, 0, 1, $encoding), |
|
11493 | 11492 | $encoding, |
11494 | 11493 | false, |
11495 | 11494 | $lang, |
@@ -11498,7 +11497,7 @@ discard block |
||
11498 | 11497 | } |
11499 | 11498 | } |
11500 | 11499 | |
11501 | - return $strPartOne . $strPartTwo; |
|
11500 | + return $strPartOne.$strPartTwo; |
|
11502 | 11501 | } |
11503 | 11502 | |
11504 | 11503 | /** |
@@ -11549,7 +11548,7 @@ discard block |
||
11549 | 11548 | $str = self::clean($str); |
11550 | 11549 | } |
11551 | 11550 | |
11552 | - $usePhpDefaultFunctions = !(bool) ($charlist . \implode('', $exceptions)); |
|
11551 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
11553 | 11552 | |
11554 | 11553 | if ( |
11555 | 11554 | $usePhpDefaultFunctions === true |
@@ -11606,7 +11605,7 @@ discard block |
||
11606 | 11605 | |
11607 | 11606 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
11608 | 11607 | if (\preg_match($pattern, $str)) { |
11609 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
11608 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
11610 | 11609 | } |
11611 | 11610 | |
11612 | 11611 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -11945,7 +11944,7 @@ discard block |
||
11945 | 11944 | if ( |
11946 | 11945 | $keepUtf8Chars === true |
11947 | 11946 | && |
11948 | - self::strlen($return) >= (int) self::strlen($str_backup) |
|
11947 | + self::strlen($return) >= (int)self::strlen($str_backup) |
|
11949 | 11948 | ) { |
11950 | 11949 | return $str_backup; |
11951 | 11950 | } |
@@ -12039,17 +12038,17 @@ discard block |
||
12039 | 12038 | return ''; |
12040 | 12039 | } |
12041 | 12040 | |
12042 | - \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches); |
|
12041 | + \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches); |
|
12043 | 12042 | |
12044 | 12043 | if ( |
12045 | 12044 | !isset($matches[0]) |
12046 | 12045 | || |
12047 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
12046 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
12048 | 12047 | ) { |
12049 | 12048 | return $str; |
12050 | 12049 | } |
12051 | 12050 | |
12052 | - return \rtrim($matches[0]) . $strAddOn; |
|
12051 | + return \rtrim($matches[0]).$strAddOn; |
|
12053 | 12052 | } |
12054 | 12053 | |
12055 | 12054 | /** |
@@ -12119,7 +12118,7 @@ discard block |
||
12119 | 12118 | $strReturn .= $break; |
12120 | 12119 | } |
12121 | 12120 | |
12122 | - return $strReturn . \implode('', $chars); |
|
12121 | + return $strReturn.\implode('', $chars); |
|
12123 | 12122 | } |
12124 | 12123 | |
12125 | 12124 | /** |
@@ -12132,7 +12131,7 @@ discard block |
||
12132 | 12131 | */ |
12133 | 12132 | public static function wordwrap_per_line(string $str, int $limit): string |
12134 | 12133 | { |
12135 | - $strings = (array) \preg_split('/\\r\\n|\\r|\\n/', $str); |
|
12134 | + $strings = (array)\preg_split('/\\r\\n|\\r|\\n/', $str); |
|
12136 | 12135 | |
12137 | 12136 | $string = ''; |
12138 | 12137 | foreach ($strings as &$value) { |
@@ -12169,7 +12168,7 @@ discard block |
||
12169 | 12168 | |
12170 | 12169 | \uksort( |
12171 | 12170 | self::$EMOJI, |
12172 | - static function ($a, $b) { |
|
12171 | + static function($a, $b) { |
|
12173 | 12172 | return \strlen($b) <=> \strlen($a); |
12174 | 12173 | } |
12175 | 12174 | ); |
@@ -12178,7 +12177,7 @@ discard block |
||
12178 | 12177 | self::$EMOJI_VALUES_CACHE = \array_values(self::$EMOJI); |
12179 | 12178 | |
12180 | 12179 | foreach (self::$EMOJI_VALUES_CACHE as $counter => $value) { |
12181 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $counter . '_-_' . \strrev((string) $counter) . '_-_8FTU_ELBATROP_-_'; |
|
12180 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$counter.'_-_'.\strrev((string)$counter).'_-_8FTU_ELBATROP_-_'; |
|
12182 | 12181 | } |
12183 | 12182 | } |
12184 | 12183 | } |
@@ -12237,7 +12236,7 @@ discard block |
||
12237 | 12236 | /** @noinspection PhpIncludeInspection */ |
12238 | 12237 | /** @noinspection UsingInclusionReturnValueInspection */ |
12239 | 12238 | /** @psalm-suppress UnresolvableInclude */ |
12240 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
12239 | + return include __DIR__.'/data/'.$file.'.php'; |
|
12241 | 12240 | } |
12242 | 12241 | |
12243 | 12242 | /** |
@@ -12249,7 +12248,7 @@ discard block |
||
12249 | 12248 | */ |
12250 | 12249 | private static function getDataIfExists(string $file) |
12251 | 12250 | { |
12252 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
12251 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
12253 | 12252 | if (\file_exists($file)) { |
12254 | 12253 | /** @noinspection PhpIncludeInspection */ |
12255 | 12254 | /** @noinspection UsingInclusionReturnValueInspection */ |
@@ -12274,7 +12273,7 @@ discard block |
||
12274 | 12273 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
12275 | 12274 | return \defined('MB_OVERLOAD_STRING') |
12276 | 12275 | && |
12277 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12276 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
12278 | 12277 | } |
12279 | 12278 | |
12280 | 12279 | /** |
@@ -12324,7 +12323,7 @@ discard block |
||
12324 | 12323 | { |
12325 | 12324 | static $RX_CLASSS_CACHE = []; |
12326 | 12325 | |
12327 | - $cacheKey = $s . $class; |
|
12326 | + $cacheKey = $s.$class; |
|
12328 | 12327 | |
12329 | 12328 | if (isset($RX_CLASSS_CACHE[$cacheKey])) { |
12330 | 12329 | return $RX_CLASSS_CACHE[$cacheKey]; |
@@ -12336,7 +12335,7 @@ discard block |
||
12336 | 12335 | /** @noinspection AlterInForeachInspection */ |
12337 | 12336 | foreach (self::str_split($s) as &$s) { |
12338 | 12337 | if ($s === '-') { |
12339 | - $class[0] = '-' . $class[0]; |
|
12338 | + $class[0] = '-'.$class[0]; |
|
12340 | 12339 | } elseif (!isset($s[2])) { |
12341 | 12340 | $class[0] .= \preg_quote($s, '/'); |
12342 | 12341 | } elseif (self::strlen($s) === 1) { |
@@ -12347,13 +12346,13 @@ discard block |
||
12347 | 12346 | } |
12348 | 12347 | |
12349 | 12348 | if ($class[0]) { |
12350 | - $class[0] = '[' . $class[0] . ']'; |
|
12349 | + $class[0] = '['.$class[0].']'; |
|
12351 | 12350 | } |
12352 | 12351 | |
12353 | 12352 | if (\count($class) === 1) { |
12354 | 12353 | $return = $class[0]; |
12355 | 12354 | } else { |
12356 | - $return = '(?:' . \implode('|', $class) . ')'; |
|
12355 | + $return = '(?:'.\implode('|', $class).')'; |
|
12357 | 12356 | } |
12358 | 12357 | |
12359 | 12358 | $RX_CLASSS_CACHE[$cacheKey] = $return; |
@@ -12427,7 +12426,7 @@ discard block |
||
12427 | 12426 | $continue = false; |
12428 | 12427 | |
12429 | 12428 | if ($delimiter === '-') { |
12430 | - foreach ((array) $specialCases['names'] as &$beginning) { |
|
12429 | + foreach ((array)$specialCases['names'] as &$beginning) { |
|
12431 | 12430 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12432 | 12431 | $continue = true; |
12433 | 12432 | } |
@@ -12435,7 +12434,7 @@ discard block |
||
12435 | 12434 | unset($beginning); |
12436 | 12435 | } |
12437 | 12436 | |
12438 | - foreach ((array) $specialCases['prefixes'] as &$beginning) { |
|
12437 | + foreach ((array)$specialCases['prefixes'] as &$beginning) { |
|
12439 | 12438 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
12440 | 12439 | $continue = true; |
12441 | 12440 | } |
@@ -12491,8 +12490,8 @@ discard block |
||
12491 | 12490 | $buf .= self::$WIN1252_TO_UTF8[$ordC1]; |
12492 | 12491 | } else { |
12493 | 12492 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
12494 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
12495 | - $buf .= $cc1 . $cc2; |
|
12493 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
12494 | + $buf .= $cc1.$cc2; |
|
12496 | 12495 | } |
12497 | 12496 | |
12498 | 12497 | return $buf; |