@@ -581,22 +581,22 @@ discard block |
||
| 581 | 581 | * @psalm-suppress PossiblyNullArrayAccess |
| 582 | 582 | */ |
| 583 | 583 | $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
| 584 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 584 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 585 | 585 | } elseif ($code_point <= 0xFFFF) { |
| 586 | 586 | /** |
| 587 | 587 | * @psalm-suppress PossiblyNullArrayAccess |
| 588 | 588 | */ |
| 589 | 589 | $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
| 590 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 591 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 590 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 591 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 592 | 592 | } else { |
| 593 | 593 | /** |
| 594 | 594 | * @psalm-suppress PossiblyNullArrayAccess |
| 595 | 595 | */ |
| 596 | 596 | $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
| 597 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 598 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 599 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 597 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 598 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 599 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | if ($encoding !== 'UTF-8') { |
@@ -5770,8 +5770,8 @@ discard block |
||
| 5770 | 5770 | |
| 5771 | 5771 | /** @noinspection UnnecessaryCastingInspection */ |
| 5772 | 5772 | return (string) \mb_substr($str, 0, $index) . |
| 5773 | - $substring . |
|
| 5774 | - (string) \mb_substr($str, $index, $len); |
|
| 5773 | + $substring . |
|
| 5774 | + (string) \mb_substr($str, $index, $len); |
|
| 5775 | 5775 | } |
| 5776 | 5776 | |
| 5777 | 5777 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -5782,8 +5782,8 @@ discard block |
||
| 5782 | 5782 | } |
| 5783 | 5783 | |
| 5784 | 5784 | return ((string) self::substr($str, 0, $index, $encoding)) . |
| 5785 | - $substring . |
|
| 5786 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
| 5785 | + $substring . |
|
| 5786 | + ((string) self::substr($str, $index, $len, $encoding)); |
|
| 5787 | 5787 | } |
| 5788 | 5788 | |
| 5789 | 5789 | /** |
@@ -7562,11 +7562,11 @@ discard block |
||
| 7562 | 7562 | if ($useMbFunction === true) { |
| 7563 | 7563 | if ($encoding === 'UTF-8') { |
| 7564 | 7564 | return \mb_strtoupper(\mb_substr($match[0], 0, 1)) |
| 7565 | - . \mb_strtolower(\mb_substr($match[0], 1)); |
|
| 7565 | + . \mb_strtolower(\mb_substr($match[0], 1)); |
|
| 7566 | 7566 | } |
| 7567 | 7567 | |
| 7568 | 7568 | return \mb_strtoupper(\mb_substr($match[0], 0, 1, $encoding), $encoding) |
| 7569 | - . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
| 7569 | + . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
| 7570 | 7570 | } |
| 7571 | 7571 | |
| 7572 | 7572 | return self::ucfirst( |
@@ -7929,7 +7929,7 @@ discard block |
||
| 7929 | 7929 | $length, |
| 7930 | 7930 | $encoding |
| 7931 | 7931 | ) |
| 7932 | - ) . $substring; |
|
| 7932 | + ) . $substring; |
|
| 7933 | 7933 | } |
| 7934 | 7934 | |
| 7935 | 7935 | /** |
@@ -10646,8 +10646,8 @@ discard block |
||
| 10646 | 10646 | |
| 10647 | 10647 | /** @noinspection AdditionOperationOnArraysInspection */ |
| 10648 | 10648 | return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
| 10649 | - $replacement . |
|
| 10650 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 10649 | + $replacement . |
|
| 10650 | + ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 10651 | 10651 | } |
| 10652 | 10652 | |
| 10653 | 10653 | // |
@@ -235,10 +235,10 @@ discard block |
||
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | if ($encoding === 'UTF-8') { |
| 238 | - return (string) \mb_substr($str, $pos, 1); |
|
| 238 | + return (string)\mb_substr($str, $pos, 1); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
| 241 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /** |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | public static function add_bom_to_string(string $str): string |
| 254 | 254 | { |
| 255 | 255 | if (self::string_has_bom($str) === false) { |
| 256 | - $str = self::bom() . $str; |
|
| 256 | + $str = self::bom().$str; |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | return $str; |
@@ -282,8 +282,8 @@ discard block |
||
| 282 | 282 | $return = []; |
| 283 | 283 | foreach ($array as $key => &$value) { |
| 284 | 284 | $key = $case === \CASE_LOWER |
| 285 | - ? self::strtolower((string) $key, $encoding) |
|
| 286 | - : self::strtoupper((string) $key, $encoding); |
|
| 285 | + ? self::strtolower((string)$key, $encoding) |
|
| 286 | + : self::strtoupper((string)$key, $encoding); |
|
| 287 | 287 | |
| 288 | 288 | $return[$key] = $value; |
| 289 | 289 | } |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | return ''; |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - $substrIndex = $posStart + (int) \mb_strlen($start); |
|
| 320 | + $substrIndex = $posStart + (int)\mb_strlen($start); |
|
| 321 | 321 | $posEnd = \mb_strpos($str, $end, $substrIndex); |
| 322 | 322 | if ( |
| 323 | 323 | $posEnd === false |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | return ''; |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - return (string) \mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
| 330 | + return (string)\mb_substr($str, $substrIndex, $posEnd - $substrIndex); |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | return ''; |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - $substrIndex = $posStart + (int) self::strlen($start, $encoding); |
|
| 340 | + $substrIndex = $posStart + (int)self::strlen($start, $encoding); |
|
| 341 | 341 | $posEnd = self::strpos($str, $end, $substrIndex, $encoding); |
| 342 | 342 | if ( |
| 343 | 343 | $posEnd === false |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | return ''; |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | - return (string) self::substr( |
|
| 350 | + return (string)self::substr( |
|
| 351 | 351 | $str, |
| 352 | 352 | $substrIndex, |
| 353 | 353 | $posEnd - $substrIndex, |
@@ -415,10 +415,10 @@ discard block |
||
| 415 | 415 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
| 416 | 416 | { |
| 417 | 417 | if ($encoding === 'UTF-8') { |
| 418 | - return (string) \mb_substr($str, $index, 1); |
|
| 418 | + return (string)\mb_substr($str, $index, 1); |
|
| 419 | 419 | } |
| 420 | 420 | |
| 421 | - return (string) self::substr($str, $index, 1, $encoding); |
|
| 421 | + return (string)self::substr($str, $index, 1, $encoding); |
|
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | /** |
@@ -521,10 +521,10 @@ discard block |
||
| 521 | 521 | && |
| 522 | 522 | self::$SUPPORT['mbstring'] === false |
| 523 | 523 | ) { |
| 524 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 524 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 525 | 525 | } |
| 526 | 526 | |
| 527 | - $cacheKey = $code_point . $encoding; |
|
| 527 | + $cacheKey = $code_point.$encoding; |
|
| 528 | 528 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
| 529 | 529 | return $CHAR_CACHE[$cacheKey]; |
| 530 | 530 | } |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | if ($code_point <= 127) { // use "simple"-char only until "\x80" |
| 533 | 533 | |
| 534 | 534 | if (self::$CHR === null) { |
| 535 | - self::$CHR = (array) self::getData('chr'); |
|
| 535 | + self::$CHR = (array)self::getData('chr'); |
|
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | /** |
@@ -567,10 +567,10 @@ discard block |
||
| 567 | 567 | // |
| 568 | 568 | |
| 569 | 569 | if (self::$CHR === null) { |
| 570 | - self::$CHR = (array) self::getData('chr'); |
|
| 570 | + self::$CHR = (array)self::getData('chr'); |
|
| 571 | 571 | } |
| 572 | 572 | |
| 573 | - $code_point = (int) $code_point; |
|
| 573 | + $code_point = (int)$code_point; |
|
| 574 | 574 | if ($code_point <= 0x7F) { |
| 575 | 575 | /** |
| 576 | 576 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -580,22 +580,22 @@ discard block |
||
| 580 | 580 | /** |
| 581 | 581 | * @psalm-suppress PossiblyNullArrayAccess |
| 582 | 582 | */ |
| 583 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
| 583 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
| 584 | 584 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 585 | 585 | } elseif ($code_point <= 0xFFFF) { |
| 586 | 586 | /** |
| 587 | 587 | * @psalm-suppress PossiblyNullArrayAccess |
| 588 | 588 | */ |
| 589 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
| 590 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 589 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
| 590 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 591 | 591 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 592 | 592 | } else { |
| 593 | 593 | /** |
| 594 | 594 | * @psalm-suppress PossiblyNullArrayAccess |
| 595 | 595 | */ |
| 596 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
| 597 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 598 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 596 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
| 597 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
| 598 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 599 | 599 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 600 | 600 | } |
| 601 | 601 | |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | |
| 643 | 643 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
| 644 | 644 | return \array_map( |
| 645 | - static function (string $data): int { |
|
| 645 | + static function(string $data): int { |
|
| 646 | 646 | // "mb_" is available if overload is used, so use it ... |
| 647 | 647 | return \mb_strlen($data, 'CP850'); // 8-BIT |
| 648 | 648 | }, |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | $char = ''; |
| 711 | 711 | } |
| 712 | 712 | |
| 713 | - return self::int_to_hex(self::ord((string) $char), $pfix); |
|
| 713 | + return self::int_to_hex(self::ord((string)$char), $pfix); |
|
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | /** |
@@ -784,7 +784,7 @@ discard block |
||
| 784 | 784 | | ( [\x80-\xBF] ) # invalid byte in range 10000000 - 10111111 |
| 785 | 785 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
| 786 | 786 | /x'; |
| 787 | - $str = (string) \preg_replace($regx, '$1', $str); |
|
| 787 | + $str = (string)\preg_replace($regx, '$1', $str); |
|
| 788 | 788 | |
| 789 | 789 | if ($replace_diamond_question_mark === true) { |
| 790 | 790 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -819,7 +819,7 @@ discard block |
||
| 819 | 819 | public static function cleanup($str): string |
| 820 | 820 | { |
| 821 | 821 | // init |
| 822 | - $str = (string) $str; |
|
| 822 | + $str = (string)$str; |
|
| 823 | 823 | |
| 824 | 824 | if ($str === '') { |
| 825 | 825 | return ''; |
@@ -902,7 +902,7 @@ discard block |
||
| 902 | 902 | { |
| 903 | 903 | if (self::$SUPPORT['mbstring'] === true) { |
| 904 | 904 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 905 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 905 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
| 906 | 906 | } |
| 907 | 907 | |
| 908 | 908 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -942,7 +942,7 @@ discard block |
||
| 942 | 942 | */ |
| 943 | 943 | public static function css_stripe_media_queries(string $str): string |
| 944 | 944 | { |
| 945 | - return (string) \preg_replace( |
|
| 945 | + return (string)\preg_replace( |
|
| 946 | 946 | '#@media\\s+(?:only\\s)?(?:[\\s{\\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#misU', |
| 947 | 947 | '', |
| 948 | 948 | $str |
@@ -969,7 +969,7 @@ discard block |
||
| 969 | 969 | */ |
| 970 | 970 | public static function decimal_to_chr($int): string |
| 971 | 971 | { |
| 972 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
| 972 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
| 973 | 973 | } |
| 974 | 974 | |
| 975 | 975 | /** |
@@ -1048,7 +1048,7 @@ discard block |
||
| 1048 | 1048 | if ($toEncoding === 'JSON') { |
| 1049 | 1049 | $return = self::json_encode($str); |
| 1050 | 1050 | if ($return === false) { |
| 1051 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
| 1051 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
| 1052 | 1052 | } |
| 1053 | 1053 | |
| 1054 | 1054 | return $return; |
@@ -1134,7 +1134,7 @@ discard block |
||
| 1134 | 1134 | && |
| 1135 | 1135 | self::$SUPPORT['mbstring'] === false |
| 1136 | 1136 | ) { |
| 1137 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $toEncoding . '" encoding', \E_USER_WARNING); |
|
| 1137 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$toEncoding.'" encoding', \E_USER_WARNING); |
|
| 1138 | 1138 | } |
| 1139 | 1139 | |
| 1140 | 1140 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1228,31 +1228,31 @@ discard block |
||
| 1228 | 1228 | $trimChars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
| 1229 | 1229 | |
| 1230 | 1230 | if ($length === null) { |
| 1231 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
| 1231 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
| 1232 | 1232 | } |
| 1233 | 1233 | |
| 1234 | 1234 | if ($search === '') { |
| 1235 | 1235 | if ($encoding === 'UTF-8') { |
| 1236 | 1236 | if ($length > 0) { |
| 1237 | - $stringLength = (int) \mb_strlen($str); |
|
| 1237 | + $stringLength = (int)\mb_strlen($str); |
|
| 1238 | 1238 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
| 1239 | 1239 | } else { |
| 1240 | 1240 | $end = 0; |
| 1241 | 1241 | } |
| 1242 | 1242 | |
| 1243 | - $pos = (int) \min( |
|
| 1243 | + $pos = (int)\min( |
|
| 1244 | 1244 | \mb_strpos($str, ' ', $end), |
| 1245 | 1245 | \mb_strpos($str, '.', $end) |
| 1246 | 1246 | ); |
| 1247 | 1247 | } else { |
| 1248 | 1248 | if ($length > 0) { |
| 1249 | - $stringLength = (int) self::strlen($str, $encoding); |
|
| 1249 | + $stringLength = (int)self::strlen($str, $encoding); |
|
| 1250 | 1250 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
| 1251 | 1251 | } else { |
| 1252 | 1252 | $end = 0; |
| 1253 | 1253 | } |
| 1254 | 1254 | |
| 1255 | - $pos = (int) \min( |
|
| 1255 | + $pos = (int)\min( |
|
| 1256 | 1256 | self::strpos($str, ' ', $end, $encoding), |
| 1257 | 1257 | self::strpos($str, '.', $end, $encoding) |
| 1258 | 1258 | ); |
@@ -1269,18 +1269,18 @@ discard block |
||
| 1269 | 1269 | return ''; |
| 1270 | 1270 | } |
| 1271 | 1271 | |
| 1272 | - return \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
| 1272 | + return \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
| 1273 | 1273 | } |
| 1274 | 1274 | |
| 1275 | 1275 | return $str; |
| 1276 | 1276 | } |
| 1277 | 1277 | |
| 1278 | 1278 | if ($encoding === 'UTF-8') { |
| 1279 | - $wordPos = (int) \mb_stripos($str, $search); |
|
| 1280 | - $halfSide = (int) ($wordPos - $length / 2 + (int) \mb_strlen($search) / 2); |
|
| 1279 | + $wordPos = (int)\mb_stripos($str, $search); |
|
| 1280 | + $halfSide = (int)($wordPos - $length / 2 + (int)\mb_strlen($search) / 2); |
|
| 1281 | 1281 | } else { |
| 1282 | - $wordPos = (int) self::stripos($str, $search, 0, $encoding); |
|
| 1283 | - $halfSide = (int) ($wordPos - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
| 1282 | + $wordPos = (int)self::stripos($str, $search, 0, $encoding); |
|
| 1283 | + $halfSide = (int)($wordPos - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
| 1284 | 1284 | } |
| 1285 | 1285 | |
| 1286 | 1286 | $pos_start = 0; |
@@ -1292,12 +1292,12 @@ discard block |
||
| 1292 | 1292 | } |
| 1293 | 1293 | if ($halfText !== false) { |
| 1294 | 1294 | if ($encoding === 'UTF-8') { |
| 1295 | - $pos_start = (int) \max( |
|
| 1295 | + $pos_start = (int)\max( |
|
| 1296 | 1296 | \mb_strrpos($halfText, ' '), |
| 1297 | 1297 | \mb_strrpos($halfText, '.') |
| 1298 | 1298 | ); |
| 1299 | 1299 | } else { |
| 1300 | - $pos_start = (int) \max( |
|
| 1300 | + $pos_start = (int)\max( |
|
| 1301 | 1301 | self::strrpos($halfText, ' ', 0, $encoding), |
| 1302 | 1302 | self::strrpos($halfText, '.', 0, $encoding) |
| 1303 | 1303 | ); |
@@ -1307,19 +1307,19 @@ discard block |
||
| 1307 | 1307 | |
| 1308 | 1308 | if ($wordPos && $halfSide > 0) { |
| 1309 | 1309 | $offset = $pos_start + $length - 1; |
| 1310 | - $realLength = (int) self::strlen($str, $encoding); |
|
| 1310 | + $realLength = (int)self::strlen($str, $encoding); |
|
| 1311 | 1311 | |
| 1312 | 1312 | if ($offset > $realLength) { |
| 1313 | 1313 | $offset = $realLength; |
| 1314 | 1314 | } |
| 1315 | 1315 | |
| 1316 | 1316 | if ($encoding === 'UTF-8') { |
| 1317 | - $pos_end = (int) \min( |
|
| 1317 | + $pos_end = (int)\min( |
|
| 1318 | 1318 | \mb_strpos($str, ' ', $offset), |
| 1319 | 1319 | \mb_strpos($str, '.', $offset) |
| 1320 | 1320 | ) - $pos_start; |
| 1321 | 1321 | } else { |
| 1322 | - $pos_end = (int) \min( |
|
| 1322 | + $pos_end = (int)\min( |
|
| 1323 | 1323 | self::strpos($str, ' ', $offset, $encoding), |
| 1324 | 1324 | self::strpos($str, '.', $offset, $encoding) |
| 1325 | 1325 | ) - $pos_start; |
@@ -1327,12 +1327,12 @@ discard block |
||
| 1327 | 1327 | |
| 1328 | 1328 | if (!$pos_end || $pos_end <= 0) { |
| 1329 | 1329 | if ($encoding === 'UTF-8') { |
| 1330 | - $strSub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
| 1330 | + $strSub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
| 1331 | 1331 | } else { |
| 1332 | - $strSub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
| 1332 | + $strSub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
| 1333 | 1333 | } |
| 1334 | 1334 | if ($strSub !== false) { |
| 1335 | - $extract = $replacerForSkippedText . \ltrim($strSub, $trimChars); |
|
| 1335 | + $extract = $replacerForSkippedText.\ltrim($strSub, $trimChars); |
|
| 1336 | 1336 | } else { |
| 1337 | 1337 | $extract = ''; |
| 1338 | 1338 | } |
@@ -1343,26 +1343,26 @@ discard block |
||
| 1343 | 1343 | $strSub = self::substr($str, $pos_start, $pos_end, $encoding); |
| 1344 | 1344 | } |
| 1345 | 1345 | if ($strSub !== false) { |
| 1346 | - $extract = $replacerForSkippedText . \trim($strSub, $trimChars) . $replacerForSkippedText; |
|
| 1346 | + $extract = $replacerForSkippedText.\trim($strSub, $trimChars).$replacerForSkippedText; |
|
| 1347 | 1347 | } else { |
| 1348 | 1348 | $extract = ''; |
| 1349 | 1349 | } |
| 1350 | 1350 | } |
| 1351 | 1351 | } else { |
| 1352 | 1352 | $offset = $length - 1; |
| 1353 | - $trueLength = (int) self::strlen($str, $encoding); |
|
| 1353 | + $trueLength = (int)self::strlen($str, $encoding); |
|
| 1354 | 1354 | |
| 1355 | 1355 | if ($offset > $trueLength) { |
| 1356 | 1356 | $offset = $trueLength; |
| 1357 | 1357 | } |
| 1358 | 1358 | |
| 1359 | 1359 | if ($encoding === 'UTF-8') { |
| 1360 | - $pos_end = (int) \min( |
|
| 1360 | + $pos_end = (int)\min( |
|
| 1361 | 1361 | \mb_strpos($str, ' ', $offset), |
| 1362 | 1362 | \mb_strpos($str, '.', $offset) |
| 1363 | 1363 | ); |
| 1364 | 1364 | } else { |
| 1365 | - $pos_end = (int) \min( |
|
| 1365 | + $pos_end = (int)\min( |
|
| 1366 | 1366 | self::strpos($str, ' ', $offset, $encoding), |
| 1367 | 1367 | self::strpos($str, '.', $offset, $encoding) |
| 1368 | 1368 | ); |
@@ -1375,7 +1375,7 @@ discard block |
||
| 1375 | 1375 | $strSub = self::substr($str, 0, $pos_end, $encoding); |
| 1376 | 1376 | } |
| 1377 | 1377 | if ($strSub !== false) { |
| 1378 | - $extract = \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
| 1378 | + $extract = \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
| 1379 | 1379 | } else { |
| 1380 | 1380 | $extract = ''; |
| 1381 | 1381 | } |
@@ -1495,7 +1495,7 @@ discard block |
||
| 1495 | 1495 | { |
| 1496 | 1496 | $file_content = \file_get_contents($file_path); |
| 1497 | 1497 | if ($file_content === false) { |
| 1498 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
| 1498 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
| 1499 | 1499 | } |
| 1500 | 1500 | |
| 1501 | 1501 | return self::string_has_bom($file_content); |
@@ -1556,7 +1556,7 @@ discard block |
||
| 1556 | 1556 | ) { |
| 1557 | 1557 | // Prevent leading combining chars |
| 1558 | 1558 | // for NFC-safe concatenations. |
| 1559 | - $var = $leading_combining . $var; |
|
| 1559 | + $var = $leading_combining.$var; |
|
| 1560 | 1560 | } |
| 1561 | 1561 | } |
| 1562 | 1562 | |
@@ -1795,10 +1795,10 @@ discard block |
||
| 1795 | 1795 | } |
| 1796 | 1796 | |
| 1797 | 1797 | if ($encoding === 'UTF-8') { |
| 1798 | - return (string) \mb_substr($str, 0, $n); |
|
| 1798 | + return (string)\mb_substr($str, 0, $n); |
|
| 1799 | 1799 | } |
| 1800 | 1800 | |
| 1801 | - return (string) self::substr($str, 0, $n, $encoding); |
|
| 1801 | + return (string)self::substr($str, 0, $n, $encoding); |
|
| 1802 | 1802 | } |
| 1803 | 1803 | |
| 1804 | 1804 | /** |
@@ -1873,7 +1873,7 @@ discard block |
||
| 1873 | 1873 | return $str; |
| 1874 | 1874 | } |
| 1875 | 1875 | |
| 1876 | - $str = (string) $str; |
|
| 1876 | + $str = (string)$str; |
|
| 1877 | 1877 | $last = ''; |
| 1878 | 1878 | while ($last !== $str) { |
| 1879 | 1879 | $last = $str; |
@@ -2056,7 +2056,7 @@ discard block |
||
| 2056 | 2056 | } |
| 2057 | 2057 | |
| 2058 | 2058 | $str_info = \unpack('C2chars', $str_info); |
| 2059 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
| 2059 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
| 2060 | 2060 | |
| 2061 | 2061 | // DEBUG |
| 2062 | 2062 | //var_dump($type_code); |
@@ -2145,7 +2145,7 @@ discard block |
||
| 2145 | 2145 | // |
| 2146 | 2146 | |
| 2147 | 2147 | if ($encoding === 'UTF-8') { |
| 2148 | - $maxlength = (int) \mb_strlen($possibleChars); |
|
| 2148 | + $maxlength = (int)\mb_strlen($possibleChars); |
|
| 2149 | 2149 | if ($maxlength === 0) { |
| 2150 | 2150 | return ''; |
| 2151 | 2151 | } |
@@ -2166,7 +2166,7 @@ discard block |
||
| 2166 | 2166 | } else { |
| 2167 | 2167 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 2168 | 2168 | |
| 2169 | - $maxlength = (int) self::strlen($possibleChars, $encoding); |
|
| 2169 | + $maxlength = (int)self::strlen($possibleChars, $encoding); |
|
| 2170 | 2170 | if ($maxlength === 0) { |
| 2171 | 2171 | return ''; |
| 2172 | 2172 | } |
@@ -2197,16 +2197,16 @@ discard block |
||
| 2197 | 2197 | */ |
| 2198 | 2198 | public static function get_unique_string($entropyExtra = '', bool $md5 = true): string |
| 2199 | 2199 | { |
| 2200 | - $uniqueHelper = \random_int(0, \mt_getrandmax()) . |
|
| 2201 | - \session_id() . |
|
| 2202 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2203 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2200 | + $uniqueHelper = \random_int(0, \mt_getrandmax()). |
|
| 2201 | + \session_id(). |
|
| 2202 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
| 2203 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
| 2204 | 2204 | $entropyExtra; |
| 2205 | 2205 | |
| 2206 | 2206 | $uniqueString = \uniqid($uniqueHelper, true); |
| 2207 | 2207 | |
| 2208 | 2208 | if ($md5) { |
| 2209 | - $uniqueString = \md5($uniqueString . $uniqueHelper); |
|
| 2209 | + $uniqueString = \md5($uniqueString.$uniqueHelper); |
|
| 2210 | 2210 | } |
| 2211 | 2211 | |
| 2212 | 2212 | return $uniqueString; |
@@ -2286,7 +2286,7 @@ discard block |
||
| 2286 | 2286 | public static function hex_to_int($hexDec) |
| 2287 | 2287 | { |
| 2288 | 2288 | // init |
| 2289 | - $hexDec = (string) $hexDec; |
|
| 2289 | + $hexDec = (string)$hexDec; |
|
| 2290 | 2290 | |
| 2291 | 2291 | if ($hexDec === '') { |
| 2292 | 2292 | return false; |
@@ -2364,7 +2364,7 @@ discard block |
||
| 2364 | 2364 | return \implode( |
| 2365 | 2365 | '', |
| 2366 | 2366 | \array_map( |
| 2367 | - static function (string $chr) use ($keepAsciiChars, $encoding): string { |
|
| 2367 | + static function(string $chr) use ($keepAsciiChars, $encoding): string { |
|
| 2368 | 2368 | return self::single_chr_html_encode($chr, $keepAsciiChars, $encoding); |
| 2369 | 2369 | }, |
| 2370 | 2370 | self::str_split($str) |
@@ -2468,7 +2468,7 @@ discard block |
||
| 2468 | 2468 | && |
| 2469 | 2469 | self::$SUPPORT['mbstring'] === false |
| 2470 | 2470 | ) { |
| 2471 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 2471 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 2472 | 2472 | } |
| 2473 | 2473 | |
| 2474 | 2474 | do { |
@@ -2489,14 +2489,14 @@ discard block |
||
| 2489 | 2489 | ); |
| 2490 | 2490 | } |
| 2491 | 2491 | } else { |
| 2492 | - $str = (string) \preg_replace_callback( |
|
| 2492 | + $str = (string)\preg_replace_callback( |
|
| 2493 | 2493 | "/&#\d{2,6};/", |
| 2494 | 2494 | /** |
| 2495 | 2495 | * @param string[] $matches |
| 2496 | 2496 | * |
| 2497 | 2497 | * @return string |
| 2498 | 2498 | */ |
| 2499 | - static function (array $matches) use ($encoding): string { |
|
| 2499 | + static function(array $matches) use ($encoding): string { |
|
| 2500 | 2500 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
| 2501 | 2501 | if ($returnTmp !== '"' && $returnTmp !== "'") { |
| 2502 | 2502 | return $returnTmp; |
@@ -2511,7 +2511,7 @@ discard block |
||
| 2511 | 2511 | if (\strpos($str, '&') !== false) { |
| 2512 | 2512 | if (\strpos($str, '&#') !== false) { |
| 2513 | 2513 | // decode also numeric & UTF16 two byte entities |
| 2514 | - $str = (string) \preg_replace( |
|
| 2514 | + $str = (string)\preg_replace( |
|
| 2515 | 2515 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
| 2516 | 2516 | '$1;', |
| 2517 | 2517 | $str |
@@ -2557,7 +2557,7 @@ discard block |
||
| 2557 | 2557 | */ |
| 2558 | 2558 | public static function html_stripe_empty_tags(string $str): string |
| 2559 | 2559 | { |
| 2560 | - return (string) \preg_replace( |
|
| 2560 | + return (string)\preg_replace( |
|
| 2561 | 2561 | "/<[^\/>]*>(([\s]?)*|)<\/[^>]*>/iu", |
| 2562 | 2562 | '', |
| 2563 | 2563 | $str |
@@ -2856,9 +2856,9 @@ discard block |
||
| 2856 | 2856 | { |
| 2857 | 2857 | $hex = \dechex($int); |
| 2858 | 2858 | |
| 2859 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
| 2859 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
| 2860 | 2860 | |
| 2861 | - return $pfix . $hex . ''; |
|
| 2861 | + return $pfix.$hex.''; |
|
| 2862 | 2862 | } |
| 2863 | 2863 | |
| 2864 | 2864 | /** |
@@ -3125,7 +3125,7 @@ discard block |
||
| 3125 | 3125 | */ |
| 3126 | 3126 | public static function is_binary($input, bool $strict = false): bool |
| 3127 | 3127 | { |
| 3128 | - $input = (string) $input; |
|
| 3128 | + $input = (string)$input; |
|
| 3129 | 3129 | if ($input === '') { |
| 3130 | 3130 | return false; |
| 3131 | 3131 | } |
@@ -3384,7 +3384,7 @@ discard block |
||
| 3384 | 3384 | public static function is_utf16($str, $checkIfStringIsBinary = true) |
| 3385 | 3385 | { |
| 3386 | 3386 | // init |
| 3387 | - $str = (string) $str; |
|
| 3387 | + $str = (string)$str; |
|
| 3388 | 3388 | $strChars = []; |
| 3389 | 3389 | |
| 3390 | 3390 | if ( |
@@ -3462,7 +3462,7 @@ discard block |
||
| 3462 | 3462 | public static function is_utf32($str, $checkIfStringIsBinary = true) |
| 3463 | 3463 | { |
| 3464 | 3464 | // init |
| 3465 | - $str = (string) $str; |
|
| 3465 | + $str = (string)$str; |
|
| 3466 | 3466 | $strChars = []; |
| 3467 | 3467 | |
| 3468 | 3468 | if ( |
@@ -3582,7 +3582,7 @@ discard block |
||
| 3582 | 3582 | self::$ORD = self::getData('ord'); |
| 3583 | 3583 | } |
| 3584 | 3584 | |
| 3585 | - $len = \strlen((string) $str); |
|
| 3585 | + $len = \strlen((string)$str); |
|
| 3586 | 3586 | /** @noinspection ForeachInvariantsInspection */ |
| 3587 | 3587 | for ($i = 0; $i < $len; ++$i) { |
| 3588 | 3588 | $in = self::$ORD[$str[$i]]; |
@@ -3819,15 +3819,15 @@ discard block |
||
| 3819 | 3819 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
| 3820 | 3820 | |
| 3821 | 3821 | if ($encoding === 'UTF-8') { |
| 3822 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
| 3822 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
| 3823 | 3823 | |
| 3824 | 3824 | if ($useMbFunction === true) { |
| 3825 | 3825 | $strPartOne = \mb_strtolower( |
| 3826 | - (string) \mb_substr($str, 0, 1) |
|
| 3826 | + (string)\mb_substr($str, 0, 1) |
|
| 3827 | 3827 | ); |
| 3828 | 3828 | } else { |
| 3829 | 3829 | $strPartOne = self::strtolower( |
| 3830 | - (string) \mb_substr($str, 0, 1), |
|
| 3830 | + (string)\mb_substr($str, 0, 1), |
|
| 3831 | 3831 | $encoding, |
| 3832 | 3832 | false, |
| 3833 | 3833 | $lang, |
@@ -3837,10 +3837,10 @@ discard block |
||
| 3837 | 3837 | } else { |
| 3838 | 3838 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 3839 | 3839 | |
| 3840 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
| 3840 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
| 3841 | 3841 | |
| 3842 | 3842 | $strPartOne = self::strtolower( |
| 3843 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 3843 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 3844 | 3844 | $encoding, |
| 3845 | 3845 | false, |
| 3846 | 3846 | $lang, |
@@ -3848,7 +3848,7 @@ discard block |
||
| 3848 | 3848 | ); |
| 3849 | 3849 | } |
| 3850 | 3850 | |
| 3851 | - return $strPartOne . $strPartTwo; |
|
| 3851 | + return $strPartOne.$strPartTwo; |
|
| 3852 | 3852 | } |
| 3853 | 3853 | |
| 3854 | 3854 | /** |
@@ -3967,7 +3967,7 @@ discard block |
||
| 3967 | 3967 | |
| 3968 | 3968 | if (self::$SUPPORT['mbstring'] === true) { |
| 3969 | 3969 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 3970 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 3970 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 3971 | 3971 | } |
| 3972 | 3972 | |
| 3973 | 3973 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -4008,7 +4008,7 @@ discard block |
||
| 4008 | 4008 | { |
| 4009 | 4009 | $bytes = self::chr_size_list($str); |
| 4010 | 4010 | if (\count($bytes) > 0) { |
| 4011 | - return (int) \max($bytes); |
|
| 4011 | + return (int)\max($bytes); |
|
| 4012 | 4012 | } |
| 4013 | 4013 | |
| 4014 | 4014 | return 0; |
@@ -4078,7 +4078,7 @@ discard block |
||
| 4078 | 4078 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
| 4079 | 4079 | |
| 4080 | 4080 | // init |
| 4081 | - $encoding = (string) $encoding; |
|
| 4081 | + $encoding = (string)$encoding; |
|
| 4082 | 4082 | |
| 4083 | 4083 | if (!$encoding) { |
| 4084 | 4084 | return $fallback; |
@@ -4132,7 +4132,7 @@ discard block |
||
| 4132 | 4132 | |
| 4133 | 4133 | $encodingOrig = $encoding; |
| 4134 | 4134 | $encoding = \strtoupper($encoding); |
| 4135 | - $encodingUpperHelper = (string) \preg_replace('/[^a-zA-Z0-9\s]/', '', $encoding); |
|
| 4135 | + $encodingUpperHelper = (string)\preg_replace('/[^a-zA-Z0-9\s]/', '', $encoding); |
|
| 4136 | 4136 | |
| 4137 | 4137 | $equivalences = [ |
| 4138 | 4138 | 'ISO8859' => 'ISO-8859-1', |
@@ -4290,7 +4290,7 @@ discard block |
||
| 4290 | 4290 | } |
| 4291 | 4291 | |
| 4292 | 4292 | static $WHITESPACE_CACHE = []; |
| 4293 | - $cacheKey = (int) $keepNonBreakingSpace; |
|
| 4293 | + $cacheKey = (int)$keepNonBreakingSpace; |
|
| 4294 | 4294 | |
| 4295 | 4295 | if (!isset($WHITESPACE_CACHE[$cacheKey])) { |
| 4296 | 4296 | $WHITESPACE_CACHE[$cacheKey] = self::$WHITESPACE_TABLE; |
@@ -4332,13 +4332,13 @@ discard block |
||
| 4332 | 4332 | static $CHAR_CACHE = []; |
| 4333 | 4333 | |
| 4334 | 4334 | // init |
| 4335 | - $chr = (string) $chr; |
|
| 4335 | + $chr = (string)$chr; |
|
| 4336 | 4336 | |
| 4337 | 4337 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
| 4338 | 4338 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4339 | 4339 | } |
| 4340 | 4340 | |
| 4341 | - $cacheKey = $chr . $encoding; |
|
| 4341 | + $cacheKey = $chr.$encoding; |
|
| 4342 | 4342 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
| 4343 | 4343 | return $CHAR_CACHE[$cacheKey]; |
| 4344 | 4344 | } |
@@ -4373,22 +4373,22 @@ discard block |
||
| 4373 | 4373 | // |
| 4374 | 4374 | |
| 4375 | 4375 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
| 4376 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
| 4376 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
| 4377 | 4377 | $code = $chr ? $chr[1] : 0; |
| 4378 | 4378 | |
| 4379 | 4379 | if ($code >= 0xF0 && isset($chr[4])) { |
| 4380 | 4380 | /** @noinspection UnnecessaryCastingInspection */ |
| 4381 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 4381 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 4382 | 4382 | } |
| 4383 | 4383 | |
| 4384 | 4384 | if ($code >= 0xE0 && isset($chr[3])) { |
| 4385 | 4385 | /** @noinspection UnnecessaryCastingInspection */ |
| 4386 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 4386 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 4387 | 4387 | } |
| 4388 | 4388 | |
| 4389 | 4389 | if ($code >= 0xC0 && isset($chr[2])) { |
| 4390 | 4390 | /** @noinspection UnnecessaryCastingInspection */ |
| 4391 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 4391 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 4392 | 4392 | } |
| 4393 | 4393 | |
| 4394 | 4394 | return $CHAR_CACHE[$cacheKey] = $code; |
@@ -4437,7 +4437,7 @@ discard block |
||
| 4437 | 4437 | public static function pcre_utf8_support(): bool |
| 4438 | 4438 | { |
| 4439 | 4439 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 4440 | - return (bool) @\preg_match('//u', ''); |
|
| 4440 | + return (bool)@\preg_match('//u', ''); |
|
| 4441 | 4441 | } |
| 4442 | 4442 | |
| 4443 | 4443 | /** |
@@ -4459,10 +4459,10 @@ discard block |
||
| 4459 | 4459 | } |
| 4460 | 4460 | |
| 4461 | 4461 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4462 | - if (\ctype_digit((string) $var1)) { |
|
| 4463 | - $start = (int) $var1; |
|
| 4462 | + if (\ctype_digit((string)$var1)) { |
|
| 4463 | + $start = (int)$var1; |
|
| 4464 | 4464 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var1)) { |
| 4465 | - $start = (int) self::hex_to_int($var1); |
|
| 4465 | + $start = (int)self::hex_to_int($var1); |
|
| 4466 | 4466 | } else { |
| 4467 | 4467 | $start = self::ord($var1); |
| 4468 | 4468 | } |
@@ -4472,10 +4472,10 @@ discard block |
||
| 4472 | 4472 | } |
| 4473 | 4473 | |
| 4474 | 4474 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4475 | - if (\ctype_digit((string) $var2)) { |
|
| 4476 | - $end = (int) $var2; |
|
| 4475 | + if (\ctype_digit((string)$var2)) { |
|
| 4476 | + $end = (int)$var2; |
|
| 4477 | 4477 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var2)) { |
| 4478 | - $end = (int) self::hex_to_int($var2); |
|
| 4478 | + $end = (int)self::hex_to_int($var2); |
|
| 4479 | 4479 | } else { |
| 4480 | 4480 | $end = self::ord($var2); |
| 4481 | 4481 | } |
@@ -4485,8 +4485,8 @@ discard block |
||
| 4485 | 4485 | } |
| 4486 | 4486 | |
| 4487 | 4487 | return \array_map( |
| 4488 | - static function (int $i): string { |
|
| 4489 | - return (string) self::chr($i); |
|
| 4488 | + static function(int $i): string { |
|
| 4489 | + return (string)self::chr($i); |
|
| 4490 | 4490 | }, |
| 4491 | 4491 | \range($start, $end) |
| 4492 | 4492 | ); |
@@ -4519,7 +4519,7 @@ discard block |
||
| 4519 | 4519 | |
| 4520 | 4520 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
| 4521 | 4521 | if (\preg_match($pattern, $str)) { |
| 4522 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
| 4522 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
| 4523 | 4523 | } |
| 4524 | 4524 | |
| 4525 | 4525 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -4572,8 +4572,8 @@ discard block |
||
| 4572 | 4572 | $delimiter = '/'; |
| 4573 | 4573 | } |
| 4574 | 4574 | |
| 4575 | - return (string) \preg_replace( |
|
| 4576 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
| 4575 | + return (string)\preg_replace( |
|
| 4576 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
| 4577 | 4577 | $replacement, |
| 4578 | 4578 | $str |
| 4579 | 4579 | ); |
@@ -4616,9 +4616,9 @@ discard block |
||
| 4616 | 4616 | return ''; |
| 4617 | 4617 | } |
| 4618 | 4618 | |
| 4619 | - $strLength -= (int) $bomByteLength; |
|
| 4619 | + $strLength -= (int)$bomByteLength; |
|
| 4620 | 4620 | |
| 4621 | - $str = (string) $strTmp; |
|
| 4621 | + $str = (string)$strTmp; |
|
| 4622 | 4622 | } |
| 4623 | 4623 | } |
| 4624 | 4624 | |
@@ -4642,7 +4642,7 @@ discard block |
||
| 4642 | 4642 | if (\is_array($what) === true) { |
| 4643 | 4643 | /** @noinspection ForeachSourceInspection */ |
| 4644 | 4644 | foreach ($what as $item) { |
| 4645 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/', $item, $str); |
|
| 4645 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/', $item, $str); |
|
| 4646 | 4646 | } |
| 4647 | 4647 | } |
| 4648 | 4648 | |
@@ -4674,7 +4674,7 @@ discard block |
||
| 4674 | 4674 | */ |
| 4675 | 4675 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
| 4676 | 4676 | { |
| 4677 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 4677 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 4678 | 4678 | } |
| 4679 | 4679 | |
| 4680 | 4680 | /** |
@@ -4705,7 +4705,7 @@ discard block |
||
| 4705 | 4705 | $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
| 4706 | 4706 | |
| 4707 | 4707 | do { |
| 4708 | - $str = (string) \preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
| 4708 | + $str = (string)\preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
| 4709 | 4709 | } while ($count !== 0); |
| 4710 | 4710 | |
| 4711 | 4711 | return $str; |
@@ -4724,17 +4724,17 @@ discard block |
||
| 4724 | 4724 | { |
| 4725 | 4725 | if ($substring && \strpos($str, $substring) === 0) { |
| 4726 | 4726 | if ($encoding === 'UTF-8') { |
| 4727 | - return (string) \mb_substr( |
|
| 4727 | + return (string)\mb_substr( |
|
| 4728 | 4728 | $str, |
| 4729 | - (int) \mb_strlen($substring) |
|
| 4729 | + (int)\mb_strlen($substring) |
|
| 4730 | 4730 | ); |
| 4731 | 4731 | } |
| 4732 | 4732 | |
| 4733 | 4733 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4734 | 4734 | |
| 4735 | - return (string) self::substr( |
|
| 4735 | + return (string)self::substr( |
|
| 4736 | 4736 | $str, |
| 4737 | - (int) self::strlen($substring, $encoding), |
|
| 4737 | + (int)self::strlen($substring, $encoding), |
|
| 4738 | 4738 | null, |
| 4739 | 4739 | $encoding |
| 4740 | 4740 | ); |
@@ -4756,19 +4756,19 @@ discard block |
||
| 4756 | 4756 | { |
| 4757 | 4757 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
| 4758 | 4758 | if ($encoding === 'UTF-8') { |
| 4759 | - return (string) \mb_substr( |
|
| 4759 | + return (string)\mb_substr( |
|
| 4760 | 4760 | $str, |
| 4761 | 4761 | 0, |
| 4762 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
| 4762 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
| 4763 | 4763 | ); |
| 4764 | 4764 | } |
| 4765 | 4765 | |
| 4766 | 4766 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4767 | 4767 | |
| 4768 | - return (string) self::substr( |
|
| 4768 | + return (string)self::substr( |
|
| 4769 | 4769 | $str, |
| 4770 | 4770 | 0, |
| 4771 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
| 4771 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
| 4772 | 4772 | $encoding |
| 4773 | 4773 | ); |
| 4774 | 4774 | } |
@@ -4852,7 +4852,7 @@ discard block |
||
| 4852 | 4852 | $save = \mb_substitute_character(); |
| 4853 | 4853 | \mb_substitute_character($replacementCharHelper); |
| 4854 | 4854 | // the polyfill maybe return false, so cast to string |
| 4855 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 4855 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
| 4856 | 4856 | \mb_substitute_character($save); |
| 4857 | 4857 | } |
| 4858 | 4858 | |
@@ -4892,7 +4892,7 @@ discard block |
||
| 4892 | 4892 | |
| 4893 | 4893 | if (self::$SUPPORT['mbstring'] === true) { |
| 4894 | 4894 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4895 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 4895 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 4896 | 4896 | } |
| 4897 | 4897 | |
| 4898 | 4898 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -4905,7 +4905,7 @@ discard block |
||
| 4905 | 4905 | { |
| 4906 | 4906 | echo '<pre>'; |
| 4907 | 4907 | foreach (self::$SUPPORT as $key => &$value) { |
| 4908 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
| 4908 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
| 4909 | 4909 | } |
| 4910 | 4910 | unset($value); |
| 4911 | 4911 | echo '</pre>'; |
@@ -4934,7 +4934,7 @@ discard block |
||
| 4934 | 4934 | return $char; |
| 4935 | 4935 | } |
| 4936 | 4936 | |
| 4937 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
| 4937 | + return '&#'.self::ord($char, $encoding).';'; |
|
| 4938 | 4938 | } |
| 4939 | 4939 | |
| 4940 | 4940 | /** |
@@ -4993,7 +4993,7 @@ discard block |
||
| 4993 | 4993 | } |
| 4994 | 4994 | |
| 4995 | 4995 | // init |
| 4996 | - $str = (string) $str; |
|
| 4996 | + $str = (string)$str; |
|
| 4997 | 4997 | |
| 4998 | 4998 | if ($str === '') { |
| 4999 | 4999 | return []; |
@@ -5040,7 +5040,7 @@ discard block |
||
| 5040 | 5040 | ($str[$i] & "\xE0") === "\xC0" |
| 5041 | 5041 | ) { |
| 5042 | 5042 | if (($str[$i + 1] & "\xC0") === "\x80") { |
| 5043 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
| 5043 | + $ret[] = $str[$i].$str[$i + 1]; |
|
| 5044 | 5044 | |
| 5045 | 5045 | ++$i; |
| 5046 | 5046 | } |
@@ -5054,7 +5054,7 @@ discard block |
||
| 5054 | 5054 | && |
| 5055 | 5055 | ($str[$i + 2] & "\xC0") === "\x80" |
| 5056 | 5056 | ) { |
| 5057 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
| 5057 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
| 5058 | 5058 | |
| 5059 | 5059 | $i += 2; |
| 5060 | 5060 | } |
@@ -5070,7 +5070,7 @@ discard block |
||
| 5070 | 5070 | && |
| 5071 | 5071 | ($str[$i + 3] & "\xC0") === "\x80" |
| 5072 | 5072 | ) { |
| 5073 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
| 5073 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
| 5074 | 5074 | |
| 5075 | 5075 | $i += 3; |
| 5076 | 5076 | } |
@@ -5082,7 +5082,7 @@ discard block |
||
| 5082 | 5082 | $ret = \array_chunk($ret, $length); |
| 5083 | 5083 | |
| 5084 | 5084 | return \array_map( |
| 5085 | - static function (array &$item): string { |
|
| 5085 | + static function(array &$item): string { |
|
| 5086 | 5086 | return \implode('', $item); |
| 5087 | 5087 | }, |
| 5088 | 5088 | $ret |
@@ -5131,18 +5131,18 @@ discard block |
||
| 5131 | 5131 | $lang, |
| 5132 | 5132 | $tryToKeepStringLength |
| 5133 | 5133 | ); |
| 5134 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
| 5134 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
| 5135 | 5135 | |
| 5136 | 5136 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
| 5137 | 5137 | |
| 5138 | - $str = (string) \preg_replace_callback( |
|
| 5138 | + $str = (string)\preg_replace_callback( |
|
| 5139 | 5139 | '/[-_\s]+(.)?/u', |
| 5140 | 5140 | /** |
| 5141 | 5141 | * @param array $match |
| 5142 | 5142 | * |
| 5143 | 5143 | * @return string |
| 5144 | 5144 | */ |
| 5145 | - static function (array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
| 5145 | + static function(array $match) use ($useMbFunction, $encoding, $lang, $tryToKeepStringLength): string { |
|
| 5146 | 5146 | if (isset($match[1])) { |
| 5147 | 5147 | if ($useMbFunction === true) { |
| 5148 | 5148 | if ($encoding === 'UTF-8') { |
@@ -5160,14 +5160,14 @@ discard block |
||
| 5160 | 5160 | $str |
| 5161 | 5161 | ); |
| 5162 | 5162 | |
| 5163 | - return (string) \preg_replace_callback( |
|
| 5163 | + return (string)\preg_replace_callback( |
|
| 5164 | 5164 | '/[\d]+(.)?/u', |
| 5165 | 5165 | /** |
| 5166 | 5166 | * @param array $match |
| 5167 | 5167 | * |
| 5168 | 5168 | * @return string |
| 5169 | 5169 | */ |
| 5170 | - static function (array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
| 5170 | + static function(array $match) use ($useMbFunction, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
| 5171 | 5171 | if ($useMbFunction === true) { |
| 5172 | 5172 | if ($encoding === 'UTF-8') { |
| 5173 | 5173 | return \mb_strtoupper($match[0]); |
@@ -5339,7 +5339,7 @@ discard block |
||
| 5339 | 5339 | ): string { |
| 5340 | 5340 | if (self::$SUPPORT['mbstring'] === true) { |
| 5341 | 5341 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5342 | - $str = (string) \mb_ereg_replace('\B([A-Z])', '-\1', \trim($str)); |
|
| 5342 | + $str = (string)\mb_ereg_replace('\B([A-Z])', '-\1', \trim($str)); |
|
| 5343 | 5343 | |
| 5344 | 5344 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
| 5345 | 5345 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5349,10 +5349,10 @@ discard block |
||
| 5349 | 5349 | } |
| 5350 | 5350 | |
| 5351 | 5351 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 5352 | - return (string) \mb_ereg_replace('[-_\s]+', $delimiter, $str); |
|
| 5352 | + return (string)\mb_ereg_replace('[-_\s]+', $delimiter, $str); |
|
| 5353 | 5353 | } |
| 5354 | 5354 | |
| 5355 | - $str = (string) \preg_replace('/\B([A-Z])/u', '-\1', \trim($str)); |
|
| 5355 | + $str = (string)\preg_replace('/\B([A-Z])/u', '-\1', \trim($str)); |
|
| 5356 | 5356 | |
| 5357 | 5357 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
| 5358 | 5358 | if ($useMbFunction === true && $encoding === 'UTF-8') { |
@@ -5361,7 +5361,7 @@ discard block |
||
| 5361 | 5361 | $str = self::strtolower($str, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
| 5362 | 5362 | } |
| 5363 | 5363 | |
| 5364 | - return (string) \preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
| 5364 | + return (string)\preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
| 5365 | 5365 | } |
| 5366 | 5366 | |
| 5367 | 5367 | /** |
@@ -5376,7 +5376,7 @@ discard block |
||
| 5376 | 5376 | public static function str_detect_encoding($str) |
| 5377 | 5377 | { |
| 5378 | 5378 | // init |
| 5379 | - $str = (string) $str; |
|
| 5379 | + $str = (string)$str; |
|
| 5380 | 5380 | |
| 5381 | 5381 | // |
| 5382 | 5382 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5478,7 +5478,7 @@ discard block |
||
| 5478 | 5478 | foreach (self::$ENCODINGS as $encodingTmp) { |
| 5479 | 5479 | // INFO: //IGNORE but still throw notice |
| 5480 | 5480 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 5481 | - if ((string) @\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str) === $str) { |
|
| 5481 | + if ((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str) === $str) { |
|
| 5482 | 5482 | return $encodingTmp; |
| 5483 | 5483 | } |
| 5484 | 5484 | } |
@@ -5543,7 +5543,7 @@ discard block |
||
| 5543 | 5543 | return $str; |
| 5544 | 5544 | } |
| 5545 | 5545 | |
| 5546 | - return $substring . $str; |
|
| 5546 | + return $substring.$str; |
|
| 5547 | 5547 | } |
| 5548 | 5548 | |
| 5549 | 5549 | /** |
@@ -5763,27 +5763,27 @@ discard block |
||
| 5763 | 5763 | string $encoding = 'UTF-8' |
| 5764 | 5764 | ): string { |
| 5765 | 5765 | if ($encoding === 'UTF-8') { |
| 5766 | - $len = (int) \mb_strlen($str); |
|
| 5766 | + $len = (int)\mb_strlen($str); |
|
| 5767 | 5767 | if ($index > $len) { |
| 5768 | 5768 | return $str; |
| 5769 | 5769 | } |
| 5770 | 5770 | |
| 5771 | 5771 | /** @noinspection UnnecessaryCastingInspection */ |
| 5772 | - return (string) \mb_substr($str, 0, $index) . |
|
| 5773 | - $substring . |
|
| 5774 | - (string) \mb_substr($str, $index, $len); |
|
| 5772 | + return (string)\mb_substr($str, 0, $index). |
|
| 5773 | + $substring. |
|
| 5774 | + (string)\mb_substr($str, $index, $len); |
|
| 5775 | 5775 | } |
| 5776 | 5776 | |
| 5777 | 5777 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5778 | 5778 | |
| 5779 | - $len = (int) self::strlen($str, $encoding); |
|
| 5779 | + $len = (int)self::strlen($str, $encoding); |
|
| 5780 | 5780 | if ($index > $len) { |
| 5781 | 5781 | return $str; |
| 5782 | 5782 | } |
| 5783 | 5783 | |
| 5784 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
| 5785 | - $substring . |
|
| 5786 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
| 5784 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
| 5785 | + $substring. |
|
| 5786 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
| 5787 | 5787 | } |
| 5788 | 5788 | |
| 5789 | 5789 | /** |
@@ -5813,15 +5813,15 @@ discard block |
||
| 5813 | 5813 | */ |
| 5814 | 5814 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
| 5815 | 5815 | { |
| 5816 | - $search = (array) $search; |
|
| 5816 | + $search = (array)$search; |
|
| 5817 | 5817 | |
| 5818 | 5818 | /** @noinspection AlterInForeachInspection */ |
| 5819 | 5819 | foreach ($search as &$s) { |
| 5820 | - $s = (string) $s; |
|
| 5820 | + $s = (string)$s; |
|
| 5821 | 5821 | if ($s === '') { |
| 5822 | 5822 | $s = '/^(?<=.)$/'; |
| 5823 | 5823 | } else { |
| 5824 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
| 5824 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
| 5825 | 5825 | } |
| 5826 | 5826 | } |
| 5827 | 5827 | |
@@ -5853,11 +5853,11 @@ discard block |
||
| 5853 | 5853 | } |
| 5854 | 5854 | |
| 5855 | 5855 | if ($search === '') { |
| 5856 | - return $str . $replacement; |
|
| 5856 | + return $str.$replacement; |
|
| 5857 | 5857 | } |
| 5858 | 5858 | |
| 5859 | 5859 | if (\stripos($str, $search) === 0) { |
| 5860 | - return $replacement . \substr($str, \strlen($search)); |
|
| 5860 | + return $replacement.\substr($str, \strlen($search)); |
|
| 5861 | 5861 | } |
| 5862 | 5862 | |
| 5863 | 5863 | return $str; |
@@ -5885,11 +5885,11 @@ discard block |
||
| 5885 | 5885 | } |
| 5886 | 5886 | |
| 5887 | 5887 | if ($search === '') { |
| 5888 | - return $str . $replacement; |
|
| 5888 | + return $str.$replacement; |
|
| 5889 | 5889 | } |
| 5890 | 5890 | |
| 5891 | 5891 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 5892 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 5892 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 5893 | 5893 | } |
| 5894 | 5894 | |
| 5895 | 5895 | return $str; |
@@ -5962,15 +5962,15 @@ discard block |
||
| 5962 | 5962 | } |
| 5963 | 5963 | |
| 5964 | 5964 | if ($encoding === 'UTF-8') { |
| 5965 | - return (string) \mb_substr( |
|
| 5965 | + return (string)\mb_substr( |
|
| 5966 | 5966 | $str, |
| 5967 | - $offset + (int) \mb_strlen($separator) |
|
| 5967 | + $offset + (int)\mb_strlen($separator) |
|
| 5968 | 5968 | ); |
| 5969 | 5969 | } |
| 5970 | 5970 | |
| 5971 | - return (string) self::substr( |
|
| 5971 | + return (string)self::substr( |
|
| 5972 | 5972 | $str, |
| 5973 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 5973 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 5974 | 5974 | null, |
| 5975 | 5975 | $encoding |
| 5976 | 5976 | ); |
@@ -5997,15 +5997,15 @@ discard block |
||
| 5997 | 5997 | } |
| 5998 | 5998 | |
| 5999 | 5999 | if ($encoding === 'UTF-8') { |
| 6000 | - return (string) \mb_substr( |
|
| 6000 | + return (string)\mb_substr( |
|
| 6001 | 6001 | $str, |
| 6002 | - $offset + (int) self::strlen($separator) |
|
| 6002 | + $offset + (int)self::strlen($separator) |
|
| 6003 | 6003 | ); |
| 6004 | 6004 | } |
| 6005 | 6005 | |
| 6006 | - return (string) self::substr( |
|
| 6006 | + return (string)self::substr( |
|
| 6007 | 6007 | $str, |
| 6008 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6008 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6009 | 6009 | null, |
| 6010 | 6010 | $encoding |
| 6011 | 6011 | ); |
@@ -6032,10 +6032,10 @@ discard block |
||
| 6032 | 6032 | } |
| 6033 | 6033 | |
| 6034 | 6034 | if ($encoding === 'UTF-8') { |
| 6035 | - return (string) \mb_substr($str, 0, $offset); |
|
| 6035 | + return (string)\mb_substr($str, 0, $offset); |
|
| 6036 | 6036 | } |
| 6037 | 6037 | |
| 6038 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 6038 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 6039 | 6039 | } |
| 6040 | 6040 | |
| 6041 | 6041 | /** |
@@ -6059,7 +6059,7 @@ discard block |
||
| 6059 | 6059 | return ''; |
| 6060 | 6060 | } |
| 6061 | 6061 | |
| 6062 | - return (string) \mb_substr($str, 0, $offset); |
|
| 6062 | + return (string)\mb_substr($str, 0, $offset); |
|
| 6063 | 6063 | } |
| 6064 | 6064 | |
| 6065 | 6065 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6067,7 +6067,7 @@ discard block |
||
| 6067 | 6067 | return ''; |
| 6068 | 6068 | } |
| 6069 | 6069 | |
| 6070 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 6070 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 6071 | 6071 | } |
| 6072 | 6072 | |
| 6073 | 6073 | /** |
@@ -6155,12 +6155,12 @@ discard block |
||
| 6155 | 6155 | } |
| 6156 | 6156 | |
| 6157 | 6157 | if ($encoding === 'UTF-8') { |
| 6158 | - return (string) \mb_substr($str, -$n); |
|
| 6158 | + return (string)\mb_substr($str, -$n); |
|
| 6159 | 6159 | } |
| 6160 | 6160 | |
| 6161 | 6161 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6162 | 6162 | |
| 6163 | - return (string) self::substr($str, -$n, null, $encoding); |
|
| 6163 | + return (string)self::substr($str, -$n, null, $encoding); |
|
| 6164 | 6164 | } |
| 6165 | 6165 | |
| 6166 | 6166 | /** |
@@ -6184,21 +6184,21 @@ discard block |
||
| 6184 | 6184 | } |
| 6185 | 6185 | |
| 6186 | 6186 | if ($encoding === 'UTF-8') { |
| 6187 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 6187 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 6188 | 6188 | return $str; |
| 6189 | 6189 | } |
| 6190 | 6190 | |
| 6191 | 6191 | /** @noinspection UnnecessaryCastingInspection */ |
| 6192 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($strAddOn)) . $strAddOn; |
|
| 6192 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($strAddOn)).$strAddOn; |
|
| 6193 | 6193 | } |
| 6194 | 6194 | |
| 6195 | 6195 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6196 | 6196 | |
| 6197 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 6197 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 6198 | 6198 | return $str; |
| 6199 | 6199 | } |
| 6200 | 6200 | |
| 6201 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($strAddOn), $encoding)) . $strAddOn; |
|
| 6201 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($strAddOn), $encoding)).$strAddOn; |
|
| 6202 | 6202 | } |
| 6203 | 6203 | |
| 6204 | 6204 | /** |
@@ -6223,12 +6223,12 @@ discard block |
||
| 6223 | 6223 | |
| 6224 | 6224 | if ($encoding === 'UTF-8') { |
| 6225 | 6225 | /** @noinspection UnnecessaryCastingInspection */ |
| 6226 | - if ((int) \mb_strlen($str) <= $length) { |
|
| 6226 | + if ((int)\mb_strlen($str) <= $length) { |
|
| 6227 | 6227 | return $str; |
| 6228 | 6228 | } |
| 6229 | 6229 | |
| 6230 | 6230 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
| 6231 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
| 6231 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
| 6232 | 6232 | } |
| 6233 | 6233 | |
| 6234 | 6234 | $str = \mb_substr($str, 0, $length); |
@@ -6238,20 +6238,20 @@ discard block |
||
| 6238 | 6238 | $new_str = \implode(' ', $array); |
| 6239 | 6239 | |
| 6240 | 6240 | if ($new_str === '') { |
| 6241 | - return ((string) \mb_substr($str, 0, $length - 1)) . $strAddOn; |
|
| 6241 | + return ((string)\mb_substr($str, 0, $length - 1)).$strAddOn; |
|
| 6242 | 6242 | } |
| 6243 | 6243 | } else { |
| 6244 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 6244 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 6245 | 6245 | return $str; |
| 6246 | 6246 | } |
| 6247 | 6247 | |
| 6248 | 6248 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
| 6249 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
| 6249 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
| 6250 | 6250 | } |
| 6251 | 6251 | |
| 6252 | 6252 | $str = self::substr($str, 0, $length, $encoding); |
| 6253 | 6253 | if ($str === false) { |
| 6254 | - return '' . $strAddOn; |
|
| 6254 | + return ''.$strAddOn; |
|
| 6255 | 6255 | } |
| 6256 | 6256 | |
| 6257 | 6257 | $array = \explode(' ', $str); |
@@ -6259,11 +6259,11 @@ discard block |
||
| 6259 | 6259 | $new_str = \implode(' ', $array); |
| 6260 | 6260 | |
| 6261 | 6261 | if ($new_str === '') { |
| 6262 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
| 6262 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
| 6263 | 6263 | } |
| 6264 | 6264 | } |
| 6265 | 6265 | |
| 6266 | - return $new_str . $strAddOn; |
|
| 6266 | + return $new_str.$strAddOn; |
|
| 6267 | 6267 | } |
| 6268 | 6268 | |
| 6269 | 6269 | /** |
@@ -6281,7 +6281,7 @@ discard block |
||
| 6281 | 6281 | $longestCommonPrefix = ''; |
| 6282 | 6282 | |
| 6283 | 6283 | if ($encoding === 'UTF-8') { |
| 6284 | - $maxLength = (int) \min( |
|
| 6284 | + $maxLength = (int)\min( |
|
| 6285 | 6285 | \mb_strlen($str), |
| 6286 | 6286 | \mb_strlen($otherStr) |
| 6287 | 6287 | ); |
@@ -6302,7 +6302,7 @@ discard block |
||
| 6302 | 6302 | } else { |
| 6303 | 6303 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6304 | 6304 | |
| 6305 | - $maxLength = (int) \min( |
|
| 6305 | + $maxLength = (int)\min( |
|
| 6306 | 6306 | self::strlen($str, $encoding), |
| 6307 | 6307 | self::strlen($otherStr, $encoding) |
| 6308 | 6308 | ); |
@@ -6345,13 +6345,13 @@ discard block |
||
| 6345 | 6345 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
| 6346 | 6346 | |
| 6347 | 6347 | if ($encoding === 'UTF-8') { |
| 6348 | - $strLength = (int) \mb_strlen($str); |
|
| 6349 | - $otherLength = (int) \mb_strlen($otherStr); |
|
| 6348 | + $strLength = (int)\mb_strlen($str); |
|
| 6349 | + $otherLength = (int)\mb_strlen($otherStr); |
|
| 6350 | 6350 | } else { |
| 6351 | 6351 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6352 | 6352 | |
| 6353 | - $strLength = (int) self::strlen($str, $encoding); |
|
| 6354 | - $otherLength = (int) self::strlen($otherStr, $encoding); |
|
| 6353 | + $strLength = (int)self::strlen($str, $encoding); |
|
| 6354 | + $otherLength = (int)self::strlen($otherStr, $encoding); |
|
| 6355 | 6355 | } |
| 6356 | 6356 | |
| 6357 | 6357 | // Return if either string is empty |
@@ -6404,10 +6404,10 @@ discard block |
||
| 6404 | 6404 | } |
| 6405 | 6405 | |
| 6406 | 6406 | if ($encoding === 'UTF-8') { |
| 6407 | - return (string) \mb_substr($str, $end - $len, $len); |
|
| 6407 | + return (string)\mb_substr($str, $end - $len, $len); |
|
| 6408 | 6408 | } |
| 6409 | 6409 | |
| 6410 | - return (string) self::substr($str, $end - $len, $len, $encoding); |
|
| 6410 | + return (string)self::substr($str, $end - $len, $len, $encoding); |
|
| 6411 | 6411 | } |
| 6412 | 6412 | |
| 6413 | 6413 | /** |
@@ -6426,7 +6426,7 @@ discard block |
||
| 6426 | 6426 | } |
| 6427 | 6427 | |
| 6428 | 6428 | if ($encoding === 'UTF-8') { |
| 6429 | - $maxLength = (int) \min( |
|
| 6429 | + $maxLength = (int)\min( |
|
| 6430 | 6430 | \mb_strlen($str, $encoding), |
| 6431 | 6431 | \mb_strlen($otherStr, $encoding) |
| 6432 | 6432 | ); |
@@ -6440,7 +6440,7 @@ discard block |
||
| 6440 | 6440 | && |
| 6441 | 6441 | $char === \mb_substr($otherStr, -$i, 1) |
| 6442 | 6442 | ) { |
| 6443 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
| 6443 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
| 6444 | 6444 | } else { |
| 6445 | 6445 | break; |
| 6446 | 6446 | } |
@@ -6448,7 +6448,7 @@ discard block |
||
| 6448 | 6448 | } else { |
| 6449 | 6449 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6450 | 6450 | |
| 6451 | - $maxLength = (int) \min( |
|
| 6451 | + $maxLength = (int)\min( |
|
| 6452 | 6452 | self::strlen($str, $encoding), |
| 6453 | 6453 | self::strlen($otherStr, $encoding) |
| 6454 | 6454 | ); |
@@ -6462,7 +6462,7 @@ discard block |
||
| 6462 | 6462 | && |
| 6463 | 6463 | $char === self::substr($otherStr, -$i, 1, $encoding) |
| 6464 | 6464 | ) { |
| 6465 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
| 6465 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
| 6466 | 6466 | } else { |
| 6467 | 6467 | break; |
| 6468 | 6468 | } |
@@ -6482,7 +6482,7 @@ discard block |
||
| 6482 | 6482 | */ |
| 6483 | 6483 | public static function str_matches_pattern(string $str, string $pattern): bool |
| 6484 | 6484 | { |
| 6485 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
| 6485 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
| 6486 | 6486 | } |
| 6487 | 6487 | |
| 6488 | 6488 | /** |
@@ -6499,7 +6499,7 @@ discard block |
||
| 6499 | 6499 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
| 6500 | 6500 | { |
| 6501 | 6501 | // init |
| 6502 | - $length = (int) self::strlen($str, $encoding); |
|
| 6502 | + $length = (int)self::strlen($str, $encoding); |
|
| 6503 | 6503 | |
| 6504 | 6504 | if ($offset >= 0) { |
| 6505 | 6505 | return $length > $offset; |
@@ -6525,7 +6525,7 @@ discard block |
||
| 6525 | 6525 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
| 6526 | 6526 | { |
| 6527 | 6527 | // init |
| 6528 | - $length = (int) self::strlen($str); |
|
| 6528 | + $length = (int)self::strlen($str); |
|
| 6529 | 6529 | |
| 6530 | 6530 | if ( |
| 6531 | 6531 | ($index >= 0 && $length <= $index) |
@@ -6564,7 +6564,7 @@ discard block |
||
| 6564 | 6564 | return $str; |
| 6565 | 6565 | } |
| 6566 | 6566 | |
| 6567 | - if ($pad_type !== (int) $pad_type) { |
|
| 6567 | + if ($pad_type !== (int)$pad_type) { |
|
| 6568 | 6568 | if ($pad_type === 'left') { |
| 6569 | 6569 | $pad_type = \STR_PAD_LEFT; |
| 6570 | 6570 | } elseif ($pad_type === 'right') { |
@@ -6573,23 +6573,23 @@ discard block |
||
| 6573 | 6573 | $pad_type = \STR_PAD_BOTH; |
| 6574 | 6574 | } else { |
| 6575 | 6575 | throw new \InvalidArgumentException( |
| 6576 | - 'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
| 6576 | + 'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
| 6577 | 6577 | ); |
| 6578 | 6578 | } |
| 6579 | 6579 | } |
| 6580 | 6580 | |
| 6581 | 6581 | if ($encoding === 'UTF-8') { |
| 6582 | - $str_length = (int) \mb_strlen($str); |
|
| 6582 | + $str_length = (int)\mb_strlen($str); |
|
| 6583 | 6583 | |
| 6584 | 6584 | if ($pad_length >= $str_length) { |
| 6585 | 6585 | switch ($pad_type) { |
| 6586 | 6586 | case \STR_PAD_LEFT: |
| 6587 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 6587 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 6588 | 6588 | |
| 6589 | 6589 | $diff = ($pad_length - $str_length); |
| 6590 | 6590 | |
| 6591 | - $pre = (string) \mb_substr( |
|
| 6592 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 6591 | + $pre = (string)\mb_substr( |
|
| 6592 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 6593 | 6593 | 0, |
| 6594 | 6594 | $diff |
| 6595 | 6595 | ); |
@@ -6600,16 +6600,16 @@ discard block |
||
| 6600 | 6600 | case \STR_PAD_BOTH: |
| 6601 | 6601 | $diff = ($pad_length - $str_length); |
| 6602 | 6602 | |
| 6603 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 6603 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 6604 | 6604 | |
| 6605 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 6605 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 6606 | 6606 | |
| 6607 | - $pre = (string) \mb_substr( |
|
| 6607 | + $pre = (string)\mb_substr( |
|
| 6608 | 6608 | \str_repeat($pad_string, $ps_length_left), |
| 6609 | 6609 | 0, |
| 6610 | 6610 | $ps_length_left |
| 6611 | 6611 | ); |
| 6612 | - $post = (string) \mb_substr( |
|
| 6612 | + $post = (string)\mb_substr( |
|
| 6613 | 6613 | \str_repeat($pad_string, $ps_length_right), |
| 6614 | 6614 | 0, |
| 6615 | 6615 | $ps_length_right |
@@ -6619,19 +6619,19 @@ discard block |
||
| 6619 | 6619 | |
| 6620 | 6620 | case \STR_PAD_RIGHT: |
| 6621 | 6621 | default: |
| 6622 | - $ps_length = (int) \mb_strlen($pad_string); |
|
| 6622 | + $ps_length = (int)\mb_strlen($pad_string); |
|
| 6623 | 6623 | |
| 6624 | 6624 | $diff = ($pad_length - $str_length); |
| 6625 | 6625 | |
| 6626 | - $post = (string) \mb_substr( |
|
| 6627 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 6626 | + $post = (string)\mb_substr( |
|
| 6627 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 6628 | 6628 | 0, |
| 6629 | 6629 | $diff |
| 6630 | 6630 | ); |
| 6631 | 6631 | $pre = ''; |
| 6632 | 6632 | } |
| 6633 | 6633 | |
| 6634 | - return $pre . $str . $post; |
|
| 6634 | + return $pre.$str.$post; |
|
| 6635 | 6635 | } |
| 6636 | 6636 | |
| 6637 | 6637 | return $str; |
@@ -6639,17 +6639,17 @@ discard block |
||
| 6639 | 6639 | |
| 6640 | 6640 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6641 | 6641 | |
| 6642 | - $str_length = (int) self::strlen($str, $encoding); |
|
| 6642 | + $str_length = (int)self::strlen($str, $encoding); |
|
| 6643 | 6643 | |
| 6644 | 6644 | if ($pad_length >= $str_length) { |
| 6645 | 6645 | switch ($pad_type) { |
| 6646 | 6646 | case \STR_PAD_LEFT: |
| 6647 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 6647 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 6648 | 6648 | |
| 6649 | 6649 | $diff = ($pad_length - $str_length); |
| 6650 | 6650 | |
| 6651 | - $pre = (string) self::substr( |
|
| 6652 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 6651 | + $pre = (string)self::substr( |
|
| 6652 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 6653 | 6653 | 0, |
| 6654 | 6654 | $diff, |
| 6655 | 6655 | $encoding |
@@ -6661,17 +6661,17 @@ discard block |
||
| 6661 | 6661 | case \STR_PAD_BOTH: |
| 6662 | 6662 | $diff = ($pad_length - $str_length); |
| 6663 | 6663 | |
| 6664 | - $ps_length_left = (int) \floor($diff / 2); |
|
| 6664 | + $ps_length_left = (int)\floor($diff / 2); |
|
| 6665 | 6665 | |
| 6666 | - $ps_length_right = (int) \ceil($diff / 2); |
|
| 6666 | + $ps_length_right = (int)\ceil($diff / 2); |
|
| 6667 | 6667 | |
| 6668 | - $pre = (string) self::substr( |
|
| 6668 | + $pre = (string)self::substr( |
|
| 6669 | 6669 | \str_repeat($pad_string, $ps_length_left), |
| 6670 | 6670 | 0, |
| 6671 | 6671 | $ps_length_left, |
| 6672 | 6672 | $encoding |
| 6673 | 6673 | ); |
| 6674 | - $post = (string) self::substr( |
|
| 6674 | + $post = (string)self::substr( |
|
| 6675 | 6675 | \str_repeat($pad_string, $ps_length_right), |
| 6676 | 6676 | 0, |
| 6677 | 6677 | $ps_length_right, |
@@ -6682,12 +6682,12 @@ discard block |
||
| 6682 | 6682 | |
| 6683 | 6683 | case \STR_PAD_RIGHT: |
| 6684 | 6684 | default: |
| 6685 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 6685 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 6686 | 6686 | |
| 6687 | 6687 | $diff = ($pad_length - $str_length); |
| 6688 | 6688 | |
| 6689 | - $post = (string) self::substr( |
|
| 6690 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
| 6689 | + $post = (string)self::substr( |
|
| 6690 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
| 6691 | 6691 | 0, |
| 6692 | 6692 | $diff, |
| 6693 | 6693 | $encoding |
@@ -6695,7 +6695,7 @@ discard block |
||
| 6695 | 6695 | $pre = ''; |
| 6696 | 6696 | } |
| 6697 | 6697 | |
| 6698 | - return $pre . $str . $post; |
|
| 6698 | + return $pre.$str.$post; |
|
| 6699 | 6699 | } |
| 6700 | 6700 | |
| 6701 | 6701 | return $str; |
@@ -6847,11 +6847,11 @@ discard block |
||
| 6847 | 6847 | } |
| 6848 | 6848 | |
| 6849 | 6849 | if ($search === '') { |
| 6850 | - return $str . $replacement; |
|
| 6850 | + return $str.$replacement; |
|
| 6851 | 6851 | } |
| 6852 | 6852 | |
| 6853 | 6853 | if (\strpos($str, $search) === 0) { |
| 6854 | - return $replacement . \substr($str, \strlen($search)); |
|
| 6854 | + return $replacement.\substr($str, \strlen($search)); |
|
| 6855 | 6855 | } |
| 6856 | 6856 | |
| 6857 | 6857 | return $str; |
@@ -6879,11 +6879,11 @@ discard block |
||
| 6879 | 6879 | } |
| 6880 | 6880 | |
| 6881 | 6881 | if ($search === '') { |
| 6882 | - return $str . $replacement; |
|
| 6882 | + return $str.$replacement; |
|
| 6883 | 6883 | } |
| 6884 | 6884 | |
| 6885 | 6885 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 6886 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 6886 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 6887 | 6887 | } |
| 6888 | 6888 | |
| 6889 | 6889 | return $str; |
@@ -6906,7 +6906,7 @@ discard block |
||
| 6906 | 6906 | |
| 6907 | 6907 | if ($pos !== false) { |
| 6908 | 6908 | /** @psalm-suppress InvalidReturnStatement */ |
| 6909 | - return self::substr_replace($subject, $replace, $pos, (int) self::strlen($search)); |
|
| 6909 | + return self::substr_replace($subject, $replace, $pos, (int)self::strlen($search)); |
|
| 6910 | 6910 | } |
| 6911 | 6911 | |
| 6912 | 6912 | return $subject; |
@@ -6931,7 +6931,7 @@ discard block |
||
| 6931 | 6931 | $pos = self::strrpos($subject, $search); |
| 6932 | 6932 | if ($pos !== false) { |
| 6933 | 6933 | /** @psalm-suppress InvalidReturnStatement */ |
| 6934 | - return self::substr_replace($subject, $replace, $pos, (int) self::strlen($search)); |
|
| 6934 | + return self::substr_replace($subject, $replace, $pos, (int)self::strlen($search)); |
|
| 6935 | 6935 | } |
| 6936 | 6936 | |
| 6937 | 6937 | return $subject; |
@@ -6950,7 +6950,7 @@ discard block |
||
| 6950 | 6950 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
| 6951 | 6951 | { |
| 6952 | 6952 | if ($encoding === 'UTF-8') { |
| 6953 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
| 6953 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
| 6954 | 6954 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 6955 | 6955 | \shuffle($indexes); |
| 6956 | 6956 | |
@@ -6966,7 +6966,7 @@ discard block |
||
| 6966 | 6966 | } else { |
| 6967 | 6967 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 6968 | 6968 | |
| 6969 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
| 6969 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
| 6970 | 6970 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 6971 | 6971 | \shuffle($indexes); |
| 6972 | 6972 | |
@@ -7007,11 +7007,11 @@ discard block |
||
| 7007 | 7007 | ) { |
| 7008 | 7008 | if ($encoding === 'UTF-8') { |
| 7009 | 7009 | if ($end === null) { |
| 7010 | - $length = (int) \mb_strlen($str); |
|
| 7010 | + $length = (int)\mb_strlen($str); |
|
| 7011 | 7011 | } elseif ($end >= 0 && $end <= $start) { |
| 7012 | 7012 | return ''; |
| 7013 | 7013 | } elseif ($end < 0) { |
| 7014 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
| 7014 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
| 7015 | 7015 | } else { |
| 7016 | 7016 | $length = $end - $start; |
| 7017 | 7017 | } |
@@ -7022,11 +7022,11 @@ discard block |
||
| 7022 | 7022 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7023 | 7023 | |
| 7024 | 7024 | if ($end === null) { |
| 7025 | - $length = (int) self::strlen($str, $encoding); |
|
| 7025 | + $length = (int)self::strlen($str, $encoding); |
|
| 7026 | 7026 | } elseif ($end >= 0 && $end <= $start) { |
| 7027 | 7027 | return ''; |
| 7028 | 7028 | } elseif ($end < 0) { |
| 7029 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
| 7029 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
| 7030 | 7030 | } else { |
| 7031 | 7031 | $length = $end - $start; |
| 7032 | 7032 | } |
@@ -7058,35 +7058,35 @@ discard block |
||
| 7058 | 7058 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7059 | 7059 | } |
| 7060 | 7060 | |
| 7061 | - $str = (string) \preg_replace_callback( |
|
| 7061 | + $str = (string)\preg_replace_callback( |
|
| 7062 | 7062 | '/([\d|A-Z])/u', |
| 7063 | 7063 | /** |
| 7064 | 7064 | * @param string[] $matches |
| 7065 | 7065 | * |
| 7066 | 7066 | * @return string |
| 7067 | 7067 | */ |
| 7068 | - static function (array $matches) use ($encoding): string { |
|
| 7068 | + static function(array $matches) use ($encoding): string { |
|
| 7069 | 7069 | $match = $matches[1]; |
| 7070 | - $matchInt = (int) $match; |
|
| 7070 | + $matchInt = (int)$match; |
|
| 7071 | 7071 | |
| 7072 | - if ((string) $matchInt === $match) { |
|
| 7073 | - return '_' . $match . '_'; |
|
| 7072 | + if ((string)$matchInt === $match) { |
|
| 7073 | + return '_'.$match.'_'; |
|
| 7074 | 7074 | } |
| 7075 | 7075 | |
| 7076 | 7076 | if ($encoding === 'UTF-8') { |
| 7077 | - return '_' . \mb_strtolower($match); |
|
| 7077 | + return '_'.\mb_strtolower($match); |
|
| 7078 | 7078 | } |
| 7079 | 7079 | |
| 7080 | - return '_' . self::strtolower($match, $encoding); |
|
| 7080 | + return '_'.self::strtolower($match, $encoding); |
|
| 7081 | 7081 | }, |
| 7082 | 7082 | $str |
| 7083 | 7083 | ); |
| 7084 | 7084 | |
| 7085 | - $str = (string) \preg_replace( |
|
| 7085 | + $str = (string)\preg_replace( |
|
| 7086 | 7086 | [ |
| 7087 | - '/\s+/', // convert spaces to "_" |
|
| 7088 | - '/^\s+|\s+$/', // trim leading & trailing spaces |
|
| 7089 | - '/_+/', // remove double "_" |
|
| 7087 | + '/\s+/', // convert spaces to "_" |
|
| 7088 | + '/^\s+|\s+$/', // trim leading & trailing spaces |
|
| 7089 | + '/_+/', // remove double "_" |
|
| 7090 | 7090 | ], |
| 7091 | 7091 | [ |
| 7092 | 7092 | '_', |
@@ -7170,7 +7170,7 @@ discard block |
||
| 7170 | 7170 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 7171 | 7171 | return \array_filter( |
| 7172 | 7172 | \mb_split($pattern, $str), |
| 7173 | - static function () use (&$limit): bool { |
|
| 7173 | + static function() use (&$limit): bool { |
|
| 7174 | 7174 | return --$limit >= 0; |
| 7175 | 7175 | } |
| 7176 | 7176 | ); |
@@ -7186,7 +7186,7 @@ discard block |
||
| 7186 | 7186 | $limit = -1; |
| 7187 | 7187 | } |
| 7188 | 7188 | |
| 7189 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
| 7189 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
| 7190 | 7190 | |
| 7191 | 7191 | if ($array === false) { |
| 7192 | 7192 | return []; |
@@ -7262,9 +7262,9 @@ discard block |
||
| 7262 | 7262 | return ''; |
| 7263 | 7263 | } |
| 7264 | 7264 | |
| 7265 | - return (string) \mb_substr( |
|
| 7265 | + return (string)\mb_substr( |
|
| 7266 | 7266 | $str, |
| 7267 | - $offset + (int) \mb_strlen($separator) |
|
| 7267 | + $offset + (int)\mb_strlen($separator) |
|
| 7268 | 7268 | ); |
| 7269 | 7269 | } |
| 7270 | 7270 | |
@@ -7273,9 +7273,9 @@ discard block |
||
| 7273 | 7273 | return ''; |
| 7274 | 7274 | } |
| 7275 | 7275 | |
| 7276 | - return (string) \mb_substr( |
|
| 7276 | + return (string)\mb_substr( |
|
| 7277 | 7277 | $str, |
| 7278 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 7278 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 7279 | 7279 | null, |
| 7280 | 7280 | $encoding |
| 7281 | 7281 | ); |
@@ -7302,9 +7302,9 @@ discard block |
||
| 7302 | 7302 | return ''; |
| 7303 | 7303 | } |
| 7304 | 7304 | |
| 7305 | - return (string) \mb_substr( |
|
| 7305 | + return (string)\mb_substr( |
|
| 7306 | 7306 | $str, |
| 7307 | - $offset + (int) \mb_strlen($separator) |
|
| 7307 | + $offset + (int)\mb_strlen($separator) |
|
| 7308 | 7308 | ); |
| 7309 | 7309 | } |
| 7310 | 7310 | |
@@ -7313,9 +7313,9 @@ discard block |
||
| 7313 | 7313 | return ''; |
| 7314 | 7314 | } |
| 7315 | 7315 | |
| 7316 | - return (string) self::substr( |
|
| 7316 | + return (string)self::substr( |
|
| 7317 | 7317 | $str, |
| 7318 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 7318 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 7319 | 7319 | null, |
| 7320 | 7320 | $encoding |
| 7321 | 7321 | ); |
@@ -7345,7 +7345,7 @@ discard block |
||
| 7345 | 7345 | return ''; |
| 7346 | 7346 | } |
| 7347 | 7347 | |
| 7348 | - return (string) \mb_substr( |
|
| 7348 | + return (string)\mb_substr( |
|
| 7349 | 7349 | $str, |
| 7350 | 7350 | 0, |
| 7351 | 7351 | $offset |
@@ -7357,7 +7357,7 @@ discard block |
||
| 7357 | 7357 | return ''; |
| 7358 | 7358 | } |
| 7359 | 7359 | |
| 7360 | - return (string) self::substr( |
|
| 7360 | + return (string)self::substr( |
|
| 7361 | 7361 | $str, |
| 7362 | 7362 | 0, |
| 7363 | 7363 | $offset, |
@@ -7386,7 +7386,7 @@ discard block |
||
| 7386 | 7386 | return ''; |
| 7387 | 7387 | } |
| 7388 | 7388 | |
| 7389 | - return (string) \mb_substr( |
|
| 7389 | + return (string)\mb_substr( |
|
| 7390 | 7390 | $str, |
| 7391 | 7391 | 0, |
| 7392 | 7392 | $offset |
@@ -7400,7 +7400,7 @@ discard block |
||
| 7400 | 7400 | |
| 7401 | 7401 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7402 | 7402 | |
| 7403 | - return (string) self::substr( |
|
| 7403 | + return (string)self::substr( |
|
| 7404 | 7404 | $str, |
| 7405 | 7405 | 0, |
| 7406 | 7406 | $offset, |
@@ -7508,7 +7508,7 @@ discard block |
||
| 7508 | 7508 | */ |
| 7509 | 7509 | public static function str_surround(string $str, string $substring): string |
| 7510 | 7510 | { |
| 7511 | - return $substring . $str . $substring; |
|
| 7511 | + return $substring.$str.$substring; |
|
| 7512 | 7512 | } |
| 7513 | 7513 | |
| 7514 | 7514 | /** |
@@ -7552,9 +7552,9 @@ discard block |
||
| 7552 | 7552 | |
| 7553 | 7553 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
| 7554 | 7554 | |
| 7555 | - return (string) \preg_replace_callback( |
|
| 7555 | + return (string)\preg_replace_callback( |
|
| 7556 | 7556 | '/([\S]+)/u', |
| 7557 | - static function (array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
| 7557 | + static function(array $match) use ($tryToKeepStringLength, $lang, $ignore, $useMbFunction, $encoding): string { |
|
| 7558 | 7558 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
| 7559 | 7559 | return $match[0]; |
| 7560 | 7560 | } |
@@ -7640,16 +7640,16 @@ discard block |
||
| 7640 | 7640 | } |
| 7641 | 7641 | |
| 7642 | 7642 | // the main substitutions |
| 7643 | - $str = (string) \preg_replace_callback( |
|
| 7643 | + $str = (string)\preg_replace_callback( |
|
| 7644 | 7644 | '~\b (_*) (?: # 1. Leading underscore and |
| 7645 | 7645 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
| 7646 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
| 7646 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
| 7647 | 7647 | | |
| 7648 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
| 7648 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
| 7649 | 7649 | | |
| 7650 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
| 7650 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
| 7651 | 7651 | | |
| 7652 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
| 7652 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
| 7653 | 7653 | ) (_*) \b # 6. With trailing underscore |
| 7654 | 7654 | ~ux', |
| 7655 | 7655 | /** |
@@ -7657,7 +7657,7 @@ discard block |
||
| 7657 | 7657 | * |
| 7658 | 7658 | * @return string |
| 7659 | 7659 | */ |
| 7660 | - static function (array $matches) use ($encoding): string { |
|
| 7660 | + static function(array $matches) use ($encoding): string { |
|
| 7661 | 7661 | // preserve leading underscore |
| 7662 | 7662 | $str = $matches[1]; |
| 7663 | 7663 | if ($matches[2]) { |
@@ -7682,26 +7682,26 @@ discard block |
||
| 7682 | 7682 | ); |
| 7683 | 7683 | |
| 7684 | 7684 | // Exceptions for small words: capitalize at start of title... |
| 7685 | - $str = (string) \preg_replace_callback( |
|
| 7685 | + $str = (string)\preg_replace_callback( |
|
| 7686 | 7686 | '~( \A [[:punct:]]* # start of title... |
| 7687 | 7687 | | [:.;?!][ ]+ # or of subsentence... |
| 7688 | 7688 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
| 7689 | - ( ' . $smallWordsRx . ' ) \b # ...followed by small word |
|
| 7689 | + ( ' . $smallWordsRx.' ) \b # ...followed by small word |
|
| 7690 | 7690 | ~uxi', |
| 7691 | 7691 | /** |
| 7692 | 7692 | * @param string[] $matches |
| 7693 | 7693 | * |
| 7694 | 7694 | * @return string |
| 7695 | 7695 | */ |
| 7696 | - static function (array $matches) use ($encoding): string { |
|
| 7697 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
| 7696 | + static function(array $matches) use ($encoding): string { |
|
| 7697 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
| 7698 | 7698 | }, |
| 7699 | 7699 | $str |
| 7700 | 7700 | ); |
| 7701 | 7701 | |
| 7702 | 7702 | // ...and end of title |
| 7703 | - $str = (string) \preg_replace_callback( |
|
| 7704 | - '~\b ( ' . $smallWordsRx . ' ) # small word... |
|
| 7703 | + $str = (string)\preg_replace_callback( |
|
| 7704 | + '~\b ( '.$smallWordsRx.' ) # small word... |
|
| 7705 | 7705 | (?= [[:punct:]]* \Z # ...at the end of the title... |
| 7706 | 7706 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
| 7707 | 7707 | ~uxi', |
@@ -7710,7 +7710,7 @@ discard block |
||
| 7710 | 7710 | * |
| 7711 | 7711 | * @return string |
| 7712 | 7712 | */ |
| 7713 | - static function (array $matches) use ($encoding): string { |
|
| 7713 | + static function(array $matches) use ($encoding): string { |
|
| 7714 | 7714 | return static::str_upper_first($matches[1], $encoding); |
| 7715 | 7715 | }, |
| 7716 | 7716 | $str |
@@ -7718,10 +7718,10 @@ discard block |
||
| 7718 | 7718 | |
| 7719 | 7719 | // Exceptions for small words in hyphenated compound words. |
| 7720 | 7720 | // e.g. "in-flight" -> In-Flight |
| 7721 | - $str = (string) \preg_replace_callback( |
|
| 7721 | + $str = (string)\preg_replace_callback( |
|
| 7722 | 7722 | '~\b |
| 7723 | 7723 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
| 7724 | - ( ' . $smallWordsRx . ' ) |
|
| 7724 | + ( ' . $smallWordsRx.' ) |
|
| 7725 | 7725 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
| 7726 | 7726 | ~uxi', |
| 7727 | 7727 | /** |
@@ -7729,18 +7729,18 @@ discard block |
||
| 7729 | 7729 | * |
| 7730 | 7730 | * @return string |
| 7731 | 7731 | */ |
| 7732 | - static function (array $matches) use ($encoding): string { |
|
| 7732 | + static function(array $matches) use ($encoding): string { |
|
| 7733 | 7733 | return static::str_upper_first($matches[1], $encoding); |
| 7734 | 7734 | }, |
| 7735 | 7735 | $str |
| 7736 | 7736 | ); |
| 7737 | 7737 | |
| 7738 | 7738 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
| 7739 | - $str = (string) \preg_replace_callback( |
|
| 7739 | + $str = (string)\preg_replace_callback( |
|
| 7740 | 7740 | '~\b |
| 7741 | 7741 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
| 7742 | 7742 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
| 7743 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
| 7743 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
| 7744 | 7744 | (?! - ) # Negative lookahead for another - |
| 7745 | 7745 | ~uxi', |
| 7746 | 7746 | /** |
@@ -7748,8 +7748,8 @@ discard block |
||
| 7748 | 7748 | * |
| 7749 | 7749 | * @return string |
| 7750 | 7750 | */ |
| 7751 | - static function (array $matches) use ($encoding): string { |
|
| 7752 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
| 7751 | + static function(array $matches) use ($encoding): string { |
|
| 7752 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
| 7753 | 7753 | }, |
| 7754 | 7754 | $str |
| 7755 | 7755 | ); |
@@ -7852,7 +7852,7 @@ discard block |
||
| 7852 | 7852 | ); |
| 7853 | 7853 | |
| 7854 | 7854 | foreach ($tmpReturn as &$item) { |
| 7855 | - $item = (string) $item; |
|
| 7855 | + $item = (string)$item; |
|
| 7856 | 7856 | } |
| 7857 | 7857 | |
| 7858 | 7858 | return $tmpReturn; |
@@ -7897,39 +7897,39 @@ discard block |
||
| 7897 | 7897 | } |
| 7898 | 7898 | |
| 7899 | 7899 | if ($encoding === 'UTF-8') { |
| 7900 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 7900 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 7901 | 7901 | return $str; |
| 7902 | 7902 | } |
| 7903 | 7903 | |
| 7904 | 7904 | if ($substring !== '') { |
| 7905 | - $length -= (int) \mb_strlen($substring); |
|
| 7905 | + $length -= (int)\mb_strlen($substring); |
|
| 7906 | 7906 | |
| 7907 | 7907 | /** @noinspection UnnecessaryCastingInspection */ |
| 7908 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
| 7908 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
| 7909 | 7909 | } |
| 7910 | 7910 | |
| 7911 | 7911 | /** @noinspection UnnecessaryCastingInspection */ |
| 7912 | - return (string) \mb_substr($str, 0, $length); |
|
| 7912 | + return (string)\mb_substr($str, 0, $length); |
|
| 7913 | 7913 | } |
| 7914 | 7914 | |
| 7915 | 7915 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7916 | 7916 | |
| 7917 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 7917 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 7918 | 7918 | return $str; |
| 7919 | 7919 | } |
| 7920 | 7920 | |
| 7921 | 7921 | if ($substring !== '') { |
| 7922 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 7922 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 7923 | 7923 | } |
| 7924 | 7924 | |
| 7925 | 7925 | return ( |
| 7926 | - (string) self::substr( |
|
| 7926 | + (string)self::substr( |
|
| 7927 | 7927 | $str, |
| 7928 | 7928 | 0, |
| 7929 | 7929 | $length, |
| 7930 | 7930 | $encoding |
| 7931 | 7931 | ) |
| 7932 | - ) . $substring; |
|
| 7932 | + ).$substring; |
|
| 7933 | 7933 | } |
| 7934 | 7934 | |
| 7935 | 7935 | /** |
@@ -7959,12 +7959,12 @@ discard block |
||
| 7959 | 7959 | } |
| 7960 | 7960 | |
| 7961 | 7961 | if ($encoding === 'UTF-8') { |
| 7962 | - if ($length >= (int) \mb_strlen($str)) { |
|
| 7962 | + if ($length >= (int)\mb_strlen($str)) { |
|
| 7963 | 7963 | return $str; |
| 7964 | 7964 | } |
| 7965 | 7965 | |
| 7966 | 7966 | // need to further trim the string so we can append the substring |
| 7967 | - $length -= (int) \mb_strlen($substring); |
|
| 7967 | + $length -= (int)\mb_strlen($substring); |
|
| 7968 | 7968 | if ($length <= 0) { |
| 7969 | 7969 | return $substring; |
| 7970 | 7970 | } |
@@ -7986,18 +7986,18 @@ discard block |
||
| 7986 | 7986 | || |
| 7987 | 7987 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
| 7988 | 7988 | ) { |
| 7989 | - $truncated = (string) \mb_substr($truncated, 0, (int) $lastPos); |
|
| 7989 | + $truncated = (string)\mb_substr($truncated, 0, (int)$lastPos); |
|
| 7990 | 7990 | } |
| 7991 | 7991 | } |
| 7992 | 7992 | } else { |
| 7993 | 7993 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 7994 | 7994 | |
| 7995 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 7995 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 7996 | 7996 | return $str; |
| 7997 | 7997 | } |
| 7998 | 7998 | |
| 7999 | 7999 | // need to further trim the string so we can append the substring |
| 8000 | - $length -= (int) self::strlen($substring, $encoding); |
|
| 8000 | + $length -= (int)self::strlen($substring, $encoding); |
|
| 8001 | 8001 | if ($length <= 0) { |
| 8002 | 8002 | return $substring; |
| 8003 | 8003 | } |
@@ -8019,12 +8019,12 @@ discard block |
||
| 8019 | 8019 | || |
| 8020 | 8020 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
| 8021 | 8021 | ) { |
| 8022 | - $truncated = (string) self::substr($truncated, 0, (int) $lastPos, $encoding); |
|
| 8022 | + $truncated = (string)self::substr($truncated, 0, (int)$lastPos, $encoding); |
|
| 8023 | 8023 | } |
| 8024 | 8024 | } |
| 8025 | 8025 | } |
| 8026 | 8026 | |
| 8027 | - return $truncated . $substring; |
|
| 8027 | + return $truncated.$substring; |
|
| 8028 | 8028 | } |
| 8029 | 8029 | |
| 8030 | 8030 | /** |
@@ -8114,13 +8114,13 @@ discard block |
||
| 8114 | 8114 | } |
| 8115 | 8115 | } elseif ($format === 2) { |
| 8116 | 8116 | $numberOfWords = []; |
| 8117 | - $offset = (int) self::strlen($strParts[0]); |
|
| 8117 | + $offset = (int)self::strlen($strParts[0]); |
|
| 8118 | 8118 | for ($i = 1; $i < $len; $i += 2) { |
| 8119 | 8119 | $numberOfWords[$offset] = $strParts[$i]; |
| 8120 | - $offset += (int) self::strlen($strParts[$i]) + (int) self::strlen($strParts[$i + 1]); |
|
| 8120 | + $offset += (int)self::strlen($strParts[$i]) + (int)self::strlen($strParts[$i + 1]); |
|
| 8121 | 8121 | } |
| 8122 | 8122 | } else { |
| 8123 | - $numberOfWords = (int) (($len - 1) / 2); |
|
| 8123 | + $numberOfWords = (int)(($len - 1) / 2); |
|
| 8124 | 8124 | } |
| 8125 | 8125 | |
| 8126 | 8126 | return $numberOfWords; |
@@ -8184,7 +8184,7 @@ discard block |
||
| 8184 | 8184 | */ |
| 8185 | 8185 | public static function strcmp(string $str1, string $str2): int |
| 8186 | 8186 | { |
| 8187 | - return $str1 . '' === $str2 . '' ? 0 : \strcmp( |
|
| 8187 | + return $str1.'' === $str2.'' ? 0 : \strcmp( |
|
| 8188 | 8188 | \Normalizer::normalize($str1, \Normalizer::NFD), |
| 8189 | 8189 | \Normalizer::normalize($str2, \Normalizer::NFD) |
| 8190 | 8190 | ); |
@@ -8213,21 +8213,21 @@ discard block |
||
| 8213 | 8213 | } |
| 8214 | 8214 | |
| 8215 | 8215 | if ($charList === '') { |
| 8216 | - return (int) self::strlen($str, $encoding); |
|
| 8216 | + return (int)self::strlen($str, $encoding); |
|
| 8217 | 8217 | } |
| 8218 | 8218 | |
| 8219 | 8219 | if ($offset !== null || $length !== null) { |
| 8220 | 8220 | if ($encoding === 'UTF-8') { |
| 8221 | 8221 | if ($length === null) { |
| 8222 | 8222 | /** @noinspection UnnecessaryCastingInspection */ |
| 8223 | - $strTmp = \mb_substr($str, (int) $offset); |
|
| 8223 | + $strTmp = \mb_substr($str, (int)$offset); |
|
| 8224 | 8224 | } else { |
| 8225 | 8225 | /** @noinspection UnnecessaryCastingInspection */ |
| 8226 | - $strTmp = \mb_substr($str, (int) $offset, $length); |
|
| 8226 | + $strTmp = \mb_substr($str, (int)$offset, $length); |
|
| 8227 | 8227 | } |
| 8228 | 8228 | } else { |
| 8229 | 8229 | /** @noinspection UnnecessaryCastingInspection */ |
| 8230 | - $strTmp = self::substr($str, (int) $offset, $length, $encoding); |
|
| 8230 | + $strTmp = self::substr($str, (int)$offset, $length, $encoding); |
|
| 8231 | 8231 | } |
| 8232 | 8232 | if ($strTmp === false) { |
| 8233 | 8233 | return 0; |
@@ -8240,7 +8240,7 @@ discard block |
||
| 8240 | 8240 | } |
| 8241 | 8241 | |
| 8242 | 8242 | $matches = []; |
| 8243 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $matches)) { |
|
| 8243 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $matches)) { |
|
| 8244 | 8244 | $return = self::strlen($matches[1], $encoding); |
| 8245 | 8245 | if ($return === false) { |
| 8246 | 8246 | return 0; |
@@ -8249,7 +8249,7 @@ discard block |
||
| 8249 | 8249 | return $return; |
| 8250 | 8250 | } |
| 8251 | 8251 | |
| 8252 | - return (int) self::strlen($str, $encoding); |
|
| 8252 | + return (int)self::strlen($str, $encoding); |
|
| 8253 | 8253 | } |
| 8254 | 8254 | |
| 8255 | 8255 | /** |
@@ -8371,7 +8371,7 @@ discard block |
||
| 8371 | 8371 | return ''; |
| 8372 | 8372 | } |
| 8373 | 8373 | |
| 8374 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
| 8374 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
| 8375 | 8375 | } |
| 8376 | 8376 | |
| 8377 | 8377 | /** |
@@ -8436,7 +8436,7 @@ discard block |
||
| 8436 | 8436 | // fallback for ascii only |
| 8437 | 8437 | // |
| 8438 | 8438 | |
| 8439 | - if (self::is_ascii($haystack . $needle)) { |
|
| 8439 | + if (self::is_ascii($haystack.$needle)) { |
|
| 8440 | 8440 | return \stripos($haystack, $needle, $offset); |
| 8441 | 8441 | } |
| 8442 | 8442 | |
@@ -8503,7 +8503,7 @@ discard block |
||
| 8503 | 8503 | && |
| 8504 | 8504 | self::$SUPPORT['mbstring'] === false |
| 8505 | 8505 | ) { |
| 8506 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 8506 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 8507 | 8507 | } |
| 8508 | 8508 | |
| 8509 | 8509 | if ( |
@@ -8517,11 +8517,11 @@ discard block |
||
| 8517 | 8517 | } |
| 8518 | 8518 | } |
| 8519 | 8519 | |
| 8520 | - if (self::is_ascii($needle . $haystack)) { |
|
| 8520 | + if (self::is_ascii($needle.$haystack)) { |
|
| 8521 | 8521 | return \stristr($haystack, $needle, $before_needle); |
| 8522 | 8522 | } |
| 8523 | 8523 | |
| 8524 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
| 8524 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
| 8525 | 8525 | |
| 8526 | 8526 | if (!isset($match[1])) { |
| 8527 | 8527 | return false; |
@@ -8531,7 +8531,7 @@ discard block |
||
| 8531 | 8531 | return $match[1]; |
| 8532 | 8532 | } |
| 8533 | 8533 | |
| 8534 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
| 8534 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
| 8535 | 8535 | } |
| 8536 | 8536 | |
| 8537 | 8537 | /** |
@@ -8598,7 +8598,7 @@ discard block |
||
| 8598 | 8598 | && |
| 8599 | 8599 | self::$SUPPORT['iconv'] === false |
| 8600 | 8600 | ) { |
| 8601 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 8601 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 8602 | 8602 | } |
| 8603 | 8603 | |
| 8604 | 8604 | // |
@@ -8709,7 +8709,7 @@ discard block |
||
| 8709 | 8709 | */ |
| 8710 | 8710 | public static function strnatcmp(string $str1, string $str2): int |
| 8711 | 8711 | { |
| 8712 | - return $str1 . '' === $str2 . '' ? 0 : \strnatcmp((string) self::strtonatfold($str1), (string) self::strtonatfold($str2)); |
|
| 8712 | + return $str1.'' === $str2.'' ? 0 : \strnatcmp((string)self::strtonatfold($str1), (string)self::strtonatfold($str2)); |
|
| 8713 | 8713 | } |
| 8714 | 8714 | |
| 8715 | 8715 | /** |
@@ -8766,11 +8766,11 @@ discard block |
||
| 8766 | 8766 | } |
| 8767 | 8767 | |
| 8768 | 8768 | if ($encoding === 'UTF-8') { |
| 8769 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
| 8770 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
| 8769 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
| 8770 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
| 8771 | 8771 | } else { |
| 8772 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
| 8773 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
| 8772 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
| 8773 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
| 8774 | 8774 | } |
| 8775 | 8775 | |
| 8776 | 8776 | return self::strcmp($str1, $str2); |
@@ -8792,8 +8792,8 @@ discard block |
||
| 8792 | 8792 | return false; |
| 8793 | 8793 | } |
| 8794 | 8794 | |
| 8795 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
| 8796 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
| 8795 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
| 8796 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
| 8797 | 8797 | } |
| 8798 | 8798 | |
| 8799 | 8799 | return false; |
@@ -8826,10 +8826,10 @@ discard block |
||
| 8826 | 8826 | } |
| 8827 | 8827 | |
| 8828 | 8828 | // iconv and mbstring do not support integer $needle |
| 8829 | - if ((int) $needle === $needle) { |
|
| 8830 | - $needle = (string) self::chr($needle); |
|
| 8829 | + if ((int)$needle === $needle) { |
|
| 8830 | + $needle = (string)self::chr($needle); |
|
| 8831 | 8831 | } |
| 8832 | - $needle = (string) $needle; |
|
| 8832 | + $needle = (string)$needle; |
|
| 8833 | 8833 | |
| 8834 | 8834 | if ($needle === '') { |
| 8835 | 8835 | return false; |
@@ -8876,7 +8876,7 @@ discard block |
||
| 8876 | 8876 | && |
| 8877 | 8877 | self::$SUPPORT['mbstring'] === false |
| 8878 | 8878 | ) { |
| 8879 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 8879 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 8880 | 8880 | } |
| 8881 | 8881 | |
| 8882 | 8882 | // |
@@ -8917,7 +8917,7 @@ discard block |
||
| 8917 | 8917 | // fallback for ascii only |
| 8918 | 8918 | // |
| 8919 | 8919 | |
| 8920 | - if (self::is_ascii($haystack . $needle)) { |
|
| 8920 | + if (self::is_ascii($haystack.$needle)) { |
|
| 8921 | 8921 | return \strpos($haystack, $needle, $offset); |
| 8922 | 8922 | } |
| 8923 | 8923 | |
@@ -8929,7 +8929,7 @@ discard block |
||
| 8929 | 8929 | if ($haystackTmp === false) { |
| 8930 | 8930 | $haystackTmp = ''; |
| 8931 | 8931 | } |
| 8932 | - $haystack = (string) $haystackTmp; |
|
| 8932 | + $haystack = (string)$haystackTmp; |
|
| 8933 | 8933 | |
| 8934 | 8934 | if ($offset < 0) { |
| 8935 | 8935 | $offset = 0; |
@@ -8941,7 +8941,7 @@ discard block |
||
| 8941 | 8941 | } |
| 8942 | 8942 | |
| 8943 | 8943 | if ($pos) { |
| 8944 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 8944 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 8945 | 8945 | } |
| 8946 | 8946 | |
| 8947 | 8947 | return $offset + 0; |
@@ -9052,7 +9052,7 @@ discard block |
||
| 9052 | 9052 | && |
| 9053 | 9053 | self::$SUPPORT['mbstring'] === false |
| 9054 | 9054 | ) { |
| 9055 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9055 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9056 | 9056 | } |
| 9057 | 9057 | |
| 9058 | 9058 | // |
@@ -9064,7 +9064,7 @@ discard block |
||
| 9064 | 9064 | if ($needleTmp === false) { |
| 9065 | 9065 | return false; |
| 9066 | 9066 | } |
| 9067 | - $needle = (string) $needleTmp; |
|
| 9067 | + $needle = (string)$needleTmp; |
|
| 9068 | 9068 | |
| 9069 | 9069 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
| 9070 | 9070 | if ($pos === false) { |
@@ -9086,7 +9086,7 @@ discard block |
||
| 9086 | 9086 | if ($needleTmp === false) { |
| 9087 | 9087 | return false; |
| 9088 | 9088 | } |
| 9089 | - $needle = (string) $needleTmp; |
|
| 9089 | + $needle = (string)$needleTmp; |
|
| 9090 | 9090 | |
| 9091 | 9091 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
| 9092 | 9092 | if ($pos === false) { |
@@ -9118,7 +9118,7 @@ discard block |
||
| 9118 | 9118 | $reversed = ''; |
| 9119 | 9119 | |
| 9120 | 9120 | if ($encoding === 'UTF-8') { |
| 9121 | - $i = (int) \mb_strlen($str); |
|
| 9121 | + $i = (int)\mb_strlen($str); |
|
| 9122 | 9122 | while ($i--) { |
| 9123 | 9123 | $reversedTmp = \mb_substr($str, $i, 1); |
| 9124 | 9124 | if ($reversedTmp !== false) { |
@@ -9128,7 +9128,7 @@ discard block |
||
| 9128 | 9128 | } else { |
| 9129 | 9129 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 9130 | 9130 | |
| 9131 | - $i = (int) self::strlen($str, $encoding); |
|
| 9131 | + $i = (int)self::strlen($str, $encoding); |
|
| 9132 | 9132 | while ($i--) { |
| 9133 | 9133 | $reversedTmp = self::substr($str, $i, 1, $encoding); |
| 9134 | 9134 | if ($reversedTmp !== false) { |
@@ -9202,7 +9202,7 @@ discard block |
||
| 9202 | 9202 | if ($needleTmp === false) { |
| 9203 | 9203 | return false; |
| 9204 | 9204 | } |
| 9205 | - $needle = (string) $needleTmp; |
|
| 9205 | + $needle = (string)$needleTmp; |
|
| 9206 | 9206 | |
| 9207 | 9207 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
| 9208 | 9208 | if ($pos === false) { |
@@ -9241,10 +9241,10 @@ discard block |
||
| 9241 | 9241 | } |
| 9242 | 9242 | |
| 9243 | 9243 | // iconv and mbstring do not support integer $needle |
| 9244 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 9245 | - $needle = (string) self::chr($needle); |
|
| 9244 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 9245 | + $needle = (string)self::chr($needle); |
|
| 9246 | 9246 | } |
| 9247 | - $needle = (string) $needle; |
|
| 9247 | + $needle = (string)$needle; |
|
| 9248 | 9248 | |
| 9249 | 9249 | if ($needle === '') { |
| 9250 | 9250 | return false; |
@@ -9289,7 +9289,7 @@ discard block |
||
| 9289 | 9289 | && |
| 9290 | 9290 | self::$SUPPORT['mbstring'] === false |
| 9291 | 9291 | ) { |
| 9292 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9292 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9293 | 9293 | } |
| 9294 | 9294 | |
| 9295 | 9295 | // |
@@ -9313,7 +9313,7 @@ discard block |
||
| 9313 | 9313 | // fallback for ascii only |
| 9314 | 9314 | // |
| 9315 | 9315 | |
| 9316 | - if (self::is_ascii($haystack . $needle)) { |
|
| 9316 | + if (self::is_ascii($haystack.$needle)) { |
|
| 9317 | 9317 | return \strripos($haystack, $needle, $offset); |
| 9318 | 9318 | } |
| 9319 | 9319 | |
@@ -9389,10 +9389,10 @@ discard block |
||
| 9389 | 9389 | } |
| 9390 | 9390 | |
| 9391 | 9391 | // iconv and mbstring do not support integer $needle |
| 9392 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 9393 | - $needle = (string) self::chr($needle); |
|
| 9392 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 9393 | + $needle = (string)self::chr($needle); |
|
| 9394 | 9394 | } |
| 9395 | - $needle = (string) $needle; |
|
| 9395 | + $needle = (string)$needle; |
|
| 9396 | 9396 | |
| 9397 | 9397 | if ($needle === '' || $haystack === '') { |
| 9398 | 9398 | return false; |
@@ -9437,7 +9437,7 @@ discard block |
||
| 9437 | 9437 | && |
| 9438 | 9438 | self::$SUPPORT['mbstring'] === false |
| 9439 | 9439 | ) { |
| 9440 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9440 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9441 | 9441 | } |
| 9442 | 9442 | |
| 9443 | 9443 | // |
@@ -9461,7 +9461,7 @@ discard block |
||
| 9461 | 9461 | // fallback for ascii only |
| 9462 | 9462 | // |
| 9463 | 9463 | |
| 9464 | - if (self::is_ascii($haystack . $needle)) { |
|
| 9464 | + if (self::is_ascii($haystack.$needle)) { |
|
| 9465 | 9465 | return \strrpos($haystack, $needle, $offset); |
| 9466 | 9466 | } |
| 9467 | 9467 | |
@@ -9481,7 +9481,7 @@ discard block |
||
| 9481 | 9481 | if ($haystackTmp === false) { |
| 9482 | 9482 | $haystackTmp = ''; |
| 9483 | 9483 | } |
| 9484 | - $haystack = (string) $haystackTmp; |
|
| 9484 | + $haystack = (string)$haystackTmp; |
|
| 9485 | 9485 | } |
| 9486 | 9486 | |
| 9487 | 9487 | $pos = \strrpos($haystack, $needle); |
@@ -9494,7 +9494,7 @@ discard block |
||
| 9494 | 9494 | return false; |
| 9495 | 9495 | } |
| 9496 | 9496 | |
| 9497 | - return $offset + (int) self::strlen($strTmp); |
|
| 9497 | + return $offset + (int)self::strlen($strTmp); |
|
| 9498 | 9498 | } |
| 9499 | 9499 | |
| 9500 | 9500 | /** |
@@ -9554,12 +9554,12 @@ discard block |
||
| 9554 | 9554 | if ($offset || $length !== null) { |
| 9555 | 9555 | if ($encoding === 'UTF-8') { |
| 9556 | 9556 | if ($length === null) { |
| 9557 | - $str = (string) \mb_substr($str, $offset); |
|
| 9557 | + $str = (string)\mb_substr($str, $offset); |
|
| 9558 | 9558 | } else { |
| 9559 | - $str = (string) \mb_substr($str, $offset, $length); |
|
| 9559 | + $str = (string)\mb_substr($str, $offset, $length); |
|
| 9560 | 9560 | } |
| 9561 | 9561 | } else { |
| 9562 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
| 9562 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
| 9563 | 9563 | } |
| 9564 | 9564 | } |
| 9565 | 9565 | |
@@ -9569,7 +9569,7 @@ discard block |
||
| 9569 | 9569 | |
| 9570 | 9570 | $matches = []; |
| 9571 | 9571 | |
| 9572 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
| 9572 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
| 9573 | 9573 | } |
| 9574 | 9574 | |
| 9575 | 9575 | /** |
@@ -9638,7 +9638,7 @@ discard block |
||
| 9638 | 9638 | && |
| 9639 | 9639 | self::$SUPPORT['mbstring'] === false |
| 9640 | 9640 | ) { |
| 9641 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9641 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9642 | 9642 | } |
| 9643 | 9643 | |
| 9644 | 9644 | // |
@@ -9660,7 +9660,7 @@ discard block |
||
| 9660 | 9660 | // fallback for ascii only |
| 9661 | 9661 | // |
| 9662 | 9662 | |
| 9663 | - if (self::is_ascii($haystack . $needle)) { |
|
| 9663 | + if (self::is_ascii($haystack.$needle)) { |
|
| 9664 | 9664 | return \strstr($haystack, $needle, $before_needle); |
| 9665 | 9665 | } |
| 9666 | 9666 | |
@@ -9668,7 +9668,7 @@ discard block |
||
| 9668 | 9668 | // fallback via vanilla php |
| 9669 | 9669 | // |
| 9670 | 9670 | |
| 9671 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
| 9671 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
| 9672 | 9672 | |
| 9673 | 9673 | if (!isset($match[1])) { |
| 9674 | 9674 | return false; |
@@ -9678,7 +9678,7 @@ discard block |
||
| 9678 | 9678 | return $match[1]; |
| 9679 | 9679 | } |
| 9680 | 9680 | |
| 9681 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
| 9681 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
| 9682 | 9682 | } |
| 9683 | 9683 | |
| 9684 | 9684 | /** |
@@ -9792,7 +9792,7 @@ discard block |
||
| 9792 | 9792 | bool $tryToKeepStringLength = false |
| 9793 | 9793 | ): string { |
| 9794 | 9794 | // init |
| 9795 | - $str = (string) $str; |
|
| 9795 | + $str = (string)$str; |
|
| 9796 | 9796 | |
| 9797 | 9797 | if ($str === '') { |
| 9798 | 9798 | return ''; |
@@ -9817,19 +9817,19 @@ discard block |
||
| 9817 | 9817 | |
| 9818 | 9818 | if ($lang !== null) { |
| 9819 | 9819 | if (self::$SUPPORT['intl'] === true) { |
| 9820 | - $langCode = $lang . '-Lower'; |
|
| 9820 | + $langCode = $lang.'-Lower'; |
|
| 9821 | 9821 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
| 9822 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, \E_USER_WARNING); |
|
| 9822 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, \E_USER_WARNING); |
|
| 9823 | 9823 | |
| 9824 | 9824 | $langCode = 'Any-Lower'; |
| 9825 | 9825 | } |
| 9826 | 9826 | |
| 9827 | 9827 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 9828 | 9828 | /** @noinspection UnnecessaryCastingInspection */ |
| 9829 | - return (string) \transliterator_transliterate($langCode, $str); |
|
| 9829 | + return (string)\transliterator_transliterate($langCode, $str); |
|
| 9830 | 9830 | } |
| 9831 | 9831 | |
| 9832 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
| 9832 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
| 9833 | 9833 | } |
| 9834 | 9834 | |
| 9835 | 9835 | // always fallback via symfony polyfill |
@@ -9858,7 +9858,7 @@ discard block |
||
| 9858 | 9858 | bool $tryToKeepStringLength = false |
| 9859 | 9859 | ): string { |
| 9860 | 9860 | // init |
| 9861 | - $str = (string) $str; |
|
| 9861 | + $str = (string)$str; |
|
| 9862 | 9862 | |
| 9863 | 9863 | if ($str === '') { |
| 9864 | 9864 | return ''; |
@@ -9883,19 +9883,19 @@ discard block |
||
| 9883 | 9883 | |
| 9884 | 9884 | if ($lang !== null) { |
| 9885 | 9885 | if (self::$SUPPORT['intl'] === true) { |
| 9886 | - $langCode = $lang . '-Upper'; |
|
| 9886 | + $langCode = $lang.'-Upper'; |
|
| 9887 | 9887 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
| 9888 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
| 9888 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
| 9889 | 9889 | |
| 9890 | 9890 | $langCode = 'Any-Upper'; |
| 9891 | 9891 | } |
| 9892 | 9892 | |
| 9893 | 9893 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 9894 | 9894 | /** @noinspection UnnecessaryCastingInspection */ |
| 9895 | - return (string) \transliterator_transliterate($langCode, $str); |
|
| 9895 | + return (string)\transliterator_transliterate($langCode, $str); |
|
| 9896 | 9896 | } |
| 9897 | 9897 | |
| 9898 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
| 9898 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
| 9899 | 9899 | } |
| 9900 | 9900 | |
| 9901 | 9901 | // always fallback via symfony polyfill |
@@ -9939,7 +9939,7 @@ discard block |
||
| 9939 | 9939 | |
| 9940 | 9940 | $from = \array_combine($from, $to); |
| 9941 | 9941 | if ($from === false) { |
| 9942 | - 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) . ')'); |
|
| 9942 | + 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).')'); |
|
| 9943 | 9943 | } |
| 9944 | 9944 | } |
| 9945 | 9945 | |
@@ -9996,9 +9996,9 @@ discard block |
||
| 9996 | 9996 | } |
| 9997 | 9997 | |
| 9998 | 9998 | $wide = 0; |
| 9999 | - $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); |
|
| 9999 | + $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); |
|
| 10000 | 10000 | |
| 10001 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
| 10001 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
| 10002 | 10002 | } |
| 10003 | 10003 | |
| 10004 | 10004 | /** |
@@ -10098,9 +10098,9 @@ discard block |
||
| 10098 | 10098 | } |
| 10099 | 10099 | |
| 10100 | 10100 | if ($length === null) { |
| 10101 | - $length = (int) $str_length; |
|
| 10101 | + $length = (int)$str_length; |
|
| 10102 | 10102 | } else { |
| 10103 | - $length = (int) $length; |
|
| 10103 | + $length = (int)$length; |
|
| 10104 | 10104 | } |
| 10105 | 10105 | |
| 10106 | 10106 | if ( |
@@ -10108,7 +10108,7 @@ discard block |
||
| 10108 | 10108 | && |
| 10109 | 10109 | self::$SUPPORT['mbstring'] === false |
| 10110 | 10110 | ) { |
| 10111 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10111 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10112 | 10112 | } |
| 10113 | 10113 | |
| 10114 | 10114 | // |
@@ -10196,16 +10196,16 @@ discard block |
||
| 10196 | 10196 | ) { |
| 10197 | 10197 | if ($encoding === 'UTF-8') { |
| 10198 | 10198 | if ($length === null) { |
| 10199 | - $str1 = (string) \mb_substr($str1, $offset); |
|
| 10199 | + $str1 = (string)\mb_substr($str1, $offset); |
|
| 10200 | 10200 | } else { |
| 10201 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
| 10201 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
| 10202 | 10202 | } |
| 10203 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
| 10203 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
| 10204 | 10204 | } else { |
| 10205 | 10205 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 10206 | 10206 | |
| 10207 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
| 10208 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
| 10207 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
| 10208 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
| 10209 | 10209 | } |
| 10210 | 10210 | } |
| 10211 | 10211 | |
@@ -10267,13 +10267,13 @@ discard block |
||
| 10267 | 10267 | if ($lengthTmp === false) { |
| 10268 | 10268 | return false; |
| 10269 | 10269 | } |
| 10270 | - $length = (int) $lengthTmp; |
|
| 10270 | + $length = (int)$lengthTmp; |
|
| 10271 | 10271 | } |
| 10272 | 10272 | |
| 10273 | 10273 | if ($encoding === 'UTF-8') { |
| 10274 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
| 10274 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
| 10275 | 10275 | } else { |
| 10276 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
| 10276 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
| 10277 | 10277 | } |
| 10278 | 10278 | } |
| 10279 | 10279 | |
@@ -10282,7 +10282,7 @@ discard block |
||
| 10282 | 10282 | && |
| 10283 | 10283 | self::$SUPPORT['mbstring'] === false |
| 10284 | 10284 | ) { |
| 10285 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 10285 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 10286 | 10286 | } |
| 10287 | 10287 | |
| 10288 | 10288 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -10293,7 +10293,7 @@ discard block |
||
| 10293 | 10293 | return \mb_substr_count($haystack, $needle, $encoding); |
| 10294 | 10294 | } |
| 10295 | 10295 | |
| 10296 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 10296 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 10297 | 10297 | |
| 10298 | 10298 | return \count($matches); |
| 10299 | 10299 | } |
@@ -10340,7 +10340,7 @@ discard block |
||
| 10340 | 10340 | if ($lengthTmp === false) { |
| 10341 | 10341 | return false; |
| 10342 | 10342 | } |
| 10343 | - $length = (int) $lengthTmp; |
|
| 10343 | + $length = (int)$lengthTmp; |
|
| 10344 | 10344 | } |
| 10345 | 10345 | |
| 10346 | 10346 | if ( |
@@ -10361,7 +10361,7 @@ discard block |
||
| 10361 | 10361 | if ($haystackTmp === false) { |
| 10362 | 10362 | $haystackTmp = ''; |
| 10363 | 10363 | } |
| 10364 | - $haystack = (string) $haystackTmp; |
|
| 10364 | + $haystack = (string)$haystackTmp; |
|
| 10365 | 10365 | } |
| 10366 | 10366 | |
| 10367 | 10367 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -10400,10 +10400,10 @@ discard block |
||
| 10400 | 10400 | |
| 10401 | 10401 | if ($encoding === 'UTF-8') { |
| 10402 | 10402 | if ($caseSensitive) { |
| 10403 | - return (int) \mb_substr_count($str, $substring); |
|
| 10403 | + return (int)\mb_substr_count($str, $substring); |
|
| 10404 | 10404 | } |
| 10405 | 10405 | |
| 10406 | - return (int) \mb_substr_count( |
|
| 10406 | + return (int)\mb_substr_count( |
|
| 10407 | 10407 | \mb_strtoupper($str), |
| 10408 | 10408 | \mb_strtoupper($substring) |
| 10409 | 10409 | |
@@ -10413,10 +10413,10 @@ discard block |
||
| 10413 | 10413 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 10414 | 10414 | |
| 10415 | 10415 | if ($caseSensitive) { |
| 10416 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
| 10416 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
| 10417 | 10417 | } |
| 10418 | 10418 | |
| 10419 | - return (int) \mb_substr_count( |
|
| 10419 | + return (int)\mb_substr_count( |
|
| 10420 | 10420 | self::strtocasefold($str, true, false, $encoding, null, false), |
| 10421 | 10421 | self::strtocasefold($substring, true, false, $encoding, null, false), |
| 10422 | 10422 | $encoding |
@@ -10442,7 +10442,7 @@ discard block |
||
| 10442 | 10442 | } |
| 10443 | 10443 | |
| 10444 | 10444 | if (self::str_istarts_with($haystack, $needle) === true) { |
| 10445 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 10445 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 10446 | 10446 | } |
| 10447 | 10447 | |
| 10448 | 10448 | return $haystack; |
@@ -10499,7 +10499,7 @@ discard block |
||
| 10499 | 10499 | } |
| 10500 | 10500 | |
| 10501 | 10501 | if (self::str_iends_with($haystack, $needle) === true) { |
| 10502 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
| 10502 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
| 10503 | 10503 | } |
| 10504 | 10504 | |
| 10505 | 10505 | return $haystack; |
@@ -10524,7 +10524,7 @@ discard block |
||
| 10524 | 10524 | } |
| 10525 | 10525 | |
| 10526 | 10526 | if (self::str_starts_with($haystack, $needle) === true) { |
| 10527 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
| 10527 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
| 10528 | 10528 | } |
| 10529 | 10529 | |
| 10530 | 10530 | return $haystack; |
@@ -10576,7 +10576,7 @@ discard block |
||
| 10576 | 10576 | if (\is_array($offset) === true) { |
| 10577 | 10577 | $offset = \array_slice($offset, 0, $num); |
| 10578 | 10578 | foreach ($offset as &$valueTmp) { |
| 10579 | - $valueTmp = (int) $valueTmp === $valueTmp ? $valueTmp : 0; |
|
| 10579 | + $valueTmp = (int)$valueTmp === $valueTmp ? $valueTmp : 0; |
|
| 10580 | 10580 | } |
| 10581 | 10581 | unset($valueTmp); |
| 10582 | 10582 | } else { |
@@ -10589,7 +10589,7 @@ discard block |
||
| 10589 | 10589 | } elseif (\is_array($length) === true) { |
| 10590 | 10590 | $length = \array_slice($length, 0, $num); |
| 10591 | 10591 | foreach ($length as &$valueTmpV2) { |
| 10592 | - $valueTmpV2 = (int) $valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
| 10592 | + $valueTmpV2 = (int)$valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
| 10593 | 10593 | } |
| 10594 | 10594 | unset($valueTmpV2); |
| 10595 | 10595 | } else { |
@@ -10609,8 +10609,8 @@ discard block |
||
| 10609 | 10609 | } |
| 10610 | 10610 | |
| 10611 | 10611 | // init |
| 10612 | - $str = (string) $str; |
|
| 10613 | - $replacement = (string) $replacement; |
|
| 10612 | + $str = (string)$str; |
|
| 10613 | + $replacement = (string)$replacement; |
|
| 10614 | 10614 | |
| 10615 | 10615 | if (\is_array($length) === true) { |
| 10616 | 10616 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -10625,16 +10625,16 @@ discard block |
||
| 10625 | 10625 | } |
| 10626 | 10626 | |
| 10627 | 10627 | if (self::$SUPPORT['mbstring'] === true) { |
| 10628 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 10628 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 10629 | 10629 | |
| 10630 | 10630 | if ($offset < 0) { |
| 10631 | - $offset = (int) \max(0, $string_length + $offset); |
|
| 10631 | + $offset = (int)\max(0, $string_length + $offset); |
|
| 10632 | 10632 | } elseif ($offset > $string_length) { |
| 10633 | 10633 | $offset = $string_length; |
| 10634 | 10634 | } |
| 10635 | 10635 | |
| 10636 | 10636 | if ($length !== null && $length < 0) { |
| 10637 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
| 10637 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
| 10638 | 10638 | } elseif ($length === null || $length > $string_length) { |
| 10639 | 10639 | $length = $string_length; |
| 10640 | 10640 | } |
@@ -10645,9 +10645,9 @@ discard block |
||
| 10645 | 10645 | } |
| 10646 | 10646 | |
| 10647 | 10647 | /** @noinspection AdditionOperationOnArraysInspection */ |
| 10648 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
| 10649 | - $replacement . |
|
| 10650 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 10648 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
| 10649 | + $replacement. |
|
| 10650 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
| 10651 | 10651 | } |
| 10652 | 10652 | |
| 10653 | 10653 | // |
@@ -10656,8 +10656,7 @@ discard block |
||
| 10656 | 10656 | |
| 10657 | 10657 | if (self::is_ascii($str)) { |
| 10658 | 10658 | return ($length === null) ? |
| 10659 | - \substr_replace($str, $replacement, $offset) : |
|
| 10660 | - \substr_replace($str, $replacement, $offset, $length); |
|
| 10659 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
| 10661 | 10660 | } |
| 10662 | 10661 | |
| 10663 | 10662 | // |
@@ -10673,7 +10672,7 @@ discard block |
||
| 10673 | 10672 | // e.g.: non mbstring support + invalid chars |
| 10674 | 10673 | return ''; |
| 10675 | 10674 | } |
| 10676 | - $length = (int) $lengthTmp; |
|
| 10675 | + $length = (int)$lengthTmp; |
|
| 10677 | 10676 | } |
| 10678 | 10677 | |
| 10679 | 10678 | \array_splice($smatches[0], $offset, $length, $rmatches[0]); |
@@ -10708,14 +10707,14 @@ discard block |
||
| 10708 | 10707 | && |
| 10709 | 10708 | \substr($haystack, -\strlen($needle)) === $needle |
| 10710 | 10709 | ) { |
| 10711 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
| 10710 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
| 10712 | 10711 | } |
| 10713 | 10712 | |
| 10714 | 10713 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
| 10715 | - return (string) self::substr( |
|
| 10714 | + return (string)self::substr( |
|
| 10716 | 10715 | $haystack, |
| 10717 | 10716 | 0, |
| 10718 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
| 10717 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
| 10719 | 10718 | $encoding |
| 10720 | 10719 | ); |
| 10721 | 10720 | } |
@@ -10745,10 +10744,10 @@ discard block |
||
| 10745 | 10744 | } |
| 10746 | 10745 | |
| 10747 | 10746 | if ($encoding === 'UTF-8') { |
| 10748 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 10747 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
| 10749 | 10748 | } |
| 10750 | 10749 | |
| 10751 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 10750 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 10752 | 10751 | } |
| 10753 | 10752 | |
| 10754 | 10753 | /** |
@@ -10944,7 +10943,7 @@ discard block |
||
| 10944 | 10943 | // INFO: https://unicode.org/cldr/utility/character.jsp?a=%E2%84%8C |
| 10945 | 10944 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 10946 | 10945 | /** @noinspection UnnecessaryCastingInspection */ |
| 10947 | - $str = (string) \transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
| 10946 | + $str = (string)\transliterator_transliterate('NFKC; [:Nonspacing Mark:] Remove; NFKC; Any-Latin; Latin-ASCII;', $str); |
|
| 10948 | 10947 | |
| 10949 | 10948 | // check again, if we only have ASCII, now ... |
| 10950 | 10949 | if (self::is_ascii($str) === true) { |
@@ -11067,7 +11066,7 @@ discard block |
||
| 11067 | 11066 | public static function to_boolean($str): bool |
| 11068 | 11067 | { |
| 11069 | 11068 | // init |
| 11070 | - $str = (string) $str; |
|
| 11069 | + $str = (string)$str; |
|
| 11071 | 11070 | |
| 11072 | 11071 | if ($str === '') { |
| 11073 | 11072 | return false; |
@@ -11095,10 +11094,10 @@ discard block |
||
| 11095 | 11094 | } |
| 11096 | 11095 | |
| 11097 | 11096 | if (\is_numeric($str)) { |
| 11098 | - return ((float) $str + 0) > 0; |
|
| 11097 | + return ((float)$str + 0) > 0; |
|
| 11099 | 11098 | } |
| 11100 | 11099 | |
| 11101 | - return (bool) \trim($str); |
|
| 11100 | + return (bool)\trim($str); |
|
| 11102 | 11101 | } |
| 11103 | 11102 | |
| 11104 | 11103 | /** |
@@ -11119,11 +11118,11 @@ discard block |
||
| 11119 | 11118 | |
| 11120 | 11119 | $fallback_char_escaped = \preg_quote($fallback_char, '/'); |
| 11121 | 11120 | |
| 11122 | - $string = (string) \preg_replace( |
|
| 11121 | + $string = (string)\preg_replace( |
|
| 11123 | 11122 | [ |
| 11124 | - '/[^' . $fallback_char_escaped . '\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
| 11125 | - '/[\s]+/', // 2) convert spaces to $fallback_char |
|
| 11126 | - '/[' . $fallback_char_escaped . ']+/', // 3) remove double $fallback_char's |
|
| 11123 | + '/[^'.$fallback_char_escaped.'\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
| 11124 | + '/[\s]+/', // 2) convert spaces to $fallback_char |
|
| 11125 | + '/['.$fallback_char_escaped.']+/', // 3) remove double $fallback_char's |
|
| 11127 | 11126 | ], |
| 11128 | 11127 | [ |
| 11129 | 11128 | '', |
@@ -11154,7 +11153,7 @@ discard block |
||
| 11154 | 11153 | return $str; |
| 11155 | 11154 | } |
| 11156 | 11155 | |
| 11157 | - $str = (string) $str; |
|
| 11156 | + $str = (string)$str; |
|
| 11158 | 11157 | if ($str === '') { |
| 11159 | 11158 | return ''; |
| 11160 | 11159 | } |
@@ -11201,7 +11200,7 @@ discard block |
||
| 11201 | 11200 | return $str; |
| 11202 | 11201 | } |
| 11203 | 11202 | |
| 11204 | - $str = (string) $str; |
|
| 11203 | + $str = (string)$str; |
|
| 11205 | 11204 | if ($str === '') { |
| 11206 | 11205 | return $str; |
| 11207 | 11206 | } |
@@ -11219,7 +11218,7 @@ discard block |
||
| 11219 | 11218 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
| 11220 | 11219 | |
| 11221 | 11220 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 11222 | - $buf .= $c1 . $c2; |
|
| 11221 | + $buf .= $c1.$c2; |
|
| 11223 | 11222 | ++$i; |
| 11224 | 11223 | } else { // not valid UTF8 - convert it |
| 11225 | 11224 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11230,7 +11229,7 @@ discard block |
||
| 11230 | 11229 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
| 11231 | 11230 | |
| 11232 | 11231 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 11233 | - $buf .= $c1 . $c2 . $c3; |
|
| 11232 | + $buf .= $c1.$c2.$c3; |
|
| 11234 | 11233 | $i += 2; |
| 11235 | 11234 | } else { // not valid UTF8 - convert it |
| 11236 | 11235 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11242,7 +11241,7 @@ discard block |
||
| 11242 | 11241 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
| 11243 | 11242 | |
| 11244 | 11243 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 11245 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
| 11244 | + $buf .= $c1.$c2.$c3.$c4; |
|
| 11246 | 11245 | $i += 3; |
| 11247 | 11246 | } else { // not valid UTF8 - convert it |
| 11248 | 11247 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -11268,13 +11267,13 @@ discard block |
||
| 11268 | 11267 | * |
| 11269 | 11268 | * @return string |
| 11270 | 11269 | */ |
| 11271 | - static function (array $matches): string { |
|
| 11270 | + static function(array $matches): string { |
|
| 11272 | 11271 | if (isset($matches[3])) { |
| 11273 | - $cp = (int) \hexdec($matches[3]); |
|
| 11272 | + $cp = (int)\hexdec($matches[3]); |
|
| 11274 | 11273 | } else { |
| 11275 | 11274 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
| 11276 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
| 11277 | - + (int) \hexdec($matches[2]) |
|
| 11275 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
| 11276 | + + (int)\hexdec($matches[2]) |
|
| 11278 | 11277 | + 0x10000 |
| 11279 | 11278 | - (0xD800 << 10) |
| 11280 | 11279 | - 0xDC00; |
@@ -11285,12 +11284,12 @@ discard block |
||
| 11285 | 11284 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
| 11286 | 11285 | |
| 11287 | 11286 | if ($cp < 0x80) { |
| 11288 | - return (string) self::chr($cp); |
|
| 11287 | + return (string)self::chr($cp); |
|
| 11289 | 11288 | } |
| 11290 | 11289 | |
| 11291 | 11290 | if ($cp < 0xA0) { |
| 11292 | 11291 | /** @noinspection UnnecessaryCastingInspection */ |
| 11293 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
| 11292 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
| 11294 | 11293 | } |
| 11295 | 11294 | |
| 11296 | 11295 | return self::decimal_to_chr($cp); |
@@ -11338,7 +11337,7 @@ discard block |
||
| 11338 | 11337 | |
| 11339 | 11338 | if (self::$SUPPORT['mbstring'] === true) { |
| 11340 | 11339 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 11341 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
| 11340 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
| 11342 | 11341 | } |
| 11343 | 11342 | |
| 11344 | 11343 | return self::regex_replace($str, $pattern, '', '', '/'); |
@@ -11375,15 +11374,15 @@ discard block |
||
| 11375 | 11374 | $useMbFunction = $lang === null && $tryToKeepStringLength === false; |
| 11376 | 11375 | |
| 11377 | 11376 | if ($encoding === 'UTF-8') { |
| 11378 | - $strPartTwo = (string) \mb_substr($str, 1); |
|
| 11377 | + $strPartTwo = (string)\mb_substr($str, 1); |
|
| 11379 | 11378 | |
| 11380 | 11379 | if ($useMbFunction === true) { |
| 11381 | 11380 | $strPartOne = \mb_strtoupper( |
| 11382 | - (string) \mb_substr($str, 0, 1) |
|
| 11381 | + (string)\mb_substr($str, 0, 1) |
|
| 11383 | 11382 | ); |
| 11384 | 11383 | } else { |
| 11385 | 11384 | $strPartOne = self::strtoupper( |
| 11386 | - (string) \mb_substr($str, 0, 1), |
|
| 11385 | + (string)\mb_substr($str, 0, 1), |
|
| 11387 | 11386 | $encoding, |
| 11388 | 11387 | false, |
| 11389 | 11388 | $lang, |
@@ -11393,16 +11392,16 @@ discard block |
||
| 11393 | 11392 | } else { |
| 11394 | 11393 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 11395 | 11394 | |
| 11396 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
| 11395 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
| 11397 | 11396 | |
| 11398 | 11397 | if ($useMbFunction === true) { |
| 11399 | 11398 | $strPartOne = \mb_strtoupper( |
| 11400 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
| 11399 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
| 11401 | 11400 | $encoding |
| 11402 | 11401 | ); |
| 11403 | 11402 | } else { |
| 11404 | 11403 | $strPartOne = self::strtoupper( |
| 11405 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 11404 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 11406 | 11405 | $encoding, |
| 11407 | 11406 | false, |
| 11408 | 11407 | $lang, |
@@ -11411,7 +11410,7 @@ discard block |
||
| 11411 | 11410 | } |
| 11412 | 11411 | } |
| 11413 | 11412 | |
| 11414 | - return $strPartOne . $strPartTwo; |
|
| 11413 | + return $strPartOne.$strPartTwo; |
|
| 11415 | 11414 | } |
| 11416 | 11415 | |
| 11417 | 11416 | /** |
@@ -11462,7 +11461,7 @@ discard block |
||
| 11462 | 11461 | $str = self::clean($str); |
| 11463 | 11462 | } |
| 11464 | 11463 | |
| 11465 | - $usePhpDefaultFunctions = !(bool) ($charlist . \implode('', $exceptions)); |
|
| 11464 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
| 11466 | 11465 | |
| 11467 | 11466 | if ( |
| 11468 | 11467 | $usePhpDefaultFunctions === true |
@@ -11519,7 +11518,7 @@ discard block |
||
| 11519 | 11518 | |
| 11520 | 11519 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
| 11521 | 11520 | if (\preg_match($pattern, $str)) { |
| 11522 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
| 11521 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
| 11523 | 11522 | } |
| 11524 | 11523 | |
| 11525 | 11524 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -11858,7 +11857,7 @@ discard block |
||
| 11858 | 11857 | if ( |
| 11859 | 11858 | $keepUtf8Chars === true |
| 11860 | 11859 | && |
| 11861 | - self::strlen($return) >= (int) self::strlen($str_backup) |
|
| 11860 | + self::strlen($return) >= (int)self::strlen($str_backup) |
|
| 11862 | 11861 | ) { |
| 11863 | 11862 | return $str_backup; |
| 11864 | 11863 | } |
@@ -11952,17 +11951,17 @@ discard block |
||
| 11952 | 11951 | return ''; |
| 11953 | 11952 | } |
| 11954 | 11953 | |
| 11955 | - \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches); |
|
| 11954 | + \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches); |
|
| 11956 | 11955 | |
| 11957 | 11956 | if ( |
| 11958 | 11957 | !isset($matches[0]) |
| 11959 | 11958 | || |
| 11960 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
| 11959 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
| 11961 | 11960 | ) { |
| 11962 | 11961 | return $str; |
| 11963 | 11962 | } |
| 11964 | 11963 | |
| 11965 | - return \rtrim($matches[0]) . $strAddOn; |
|
| 11964 | + return \rtrim($matches[0]).$strAddOn; |
|
| 11966 | 11965 | } |
| 11967 | 11966 | |
| 11968 | 11967 | /** |
@@ -12032,7 +12031,7 @@ discard block |
||
| 12032 | 12031 | $strReturn .= $break; |
| 12033 | 12032 | } |
| 12034 | 12033 | |
| 12035 | - return $strReturn . \implode('', $chars); |
|
| 12034 | + return $strReturn.\implode('', $chars); |
|
| 12036 | 12035 | } |
| 12037 | 12036 | |
| 12038 | 12037 | /** |
@@ -12045,7 +12044,7 @@ discard block |
||
| 12045 | 12044 | */ |
| 12046 | 12045 | public static function wordwrap_per_line(string $str, int $limit): string |
| 12047 | 12046 | { |
| 12048 | - $strings = (array) \preg_split('/\\r\\n|\\r|\\n/', $str); |
|
| 12047 | + $strings = (array)\preg_split('/\\r\\n|\\r|\\n/', $str); |
|
| 12049 | 12048 | |
| 12050 | 12049 | $string = ''; |
| 12051 | 12050 | foreach ($strings as &$value) { |
@@ -12124,7 +12123,7 @@ discard block |
||
| 12124 | 12123 | /** @noinspection PhpIncludeInspection */ |
| 12125 | 12124 | /** @noinspection UsingInclusionReturnValueInspection */ |
| 12126 | 12125 | /** @psalm-suppress UnresolvableInclude */ |
| 12127 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
| 12126 | + return include __DIR__.'/data/'.$file.'.php'; |
|
| 12128 | 12127 | } |
| 12129 | 12128 | |
| 12130 | 12129 | /** |
@@ -12136,7 +12135,7 @@ discard block |
||
| 12136 | 12135 | */ |
| 12137 | 12136 | private static function getDataIfExists(string $file) |
| 12138 | 12137 | { |
| 12139 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
| 12138 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
| 12140 | 12139 | if (\file_exists($file)) { |
| 12141 | 12140 | /** @noinspection PhpIncludeInspection */ |
| 12142 | 12141 | /** @noinspection UsingInclusionReturnValueInspection */ |
@@ -12161,7 +12160,7 @@ discard block |
||
| 12161 | 12160 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 12162 | 12161 | return \defined('MB_OVERLOAD_STRING') |
| 12163 | 12162 | && |
| 12164 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 12163 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 12165 | 12164 | } |
| 12166 | 12165 | |
| 12167 | 12166 | /** |
@@ -12211,7 +12210,7 @@ discard block |
||
| 12211 | 12210 | { |
| 12212 | 12211 | static $RX_CLASSS_CACHE = []; |
| 12213 | 12212 | |
| 12214 | - $cacheKey = $s . $class; |
|
| 12213 | + $cacheKey = $s.$class; |
|
| 12215 | 12214 | |
| 12216 | 12215 | if (isset($RX_CLASSS_CACHE[$cacheKey])) { |
| 12217 | 12216 | return $RX_CLASSS_CACHE[$cacheKey]; |
@@ -12223,7 +12222,7 @@ discard block |
||
| 12223 | 12222 | /** @noinspection AlterInForeachInspection */ |
| 12224 | 12223 | foreach (self::str_split($s) as &$s) { |
| 12225 | 12224 | if ($s === '-') { |
| 12226 | - $class[0] = '-' . $class[0]; |
|
| 12225 | + $class[0] = '-'.$class[0]; |
|
| 12227 | 12226 | } elseif (!isset($s[2])) { |
| 12228 | 12227 | $class[0] .= \preg_quote($s, '/'); |
| 12229 | 12228 | } elseif (self::strlen($s) === 1) { |
@@ -12234,13 +12233,13 @@ discard block |
||
| 12234 | 12233 | } |
| 12235 | 12234 | |
| 12236 | 12235 | if ($class[0]) { |
| 12237 | - $class[0] = '[' . $class[0] . ']'; |
|
| 12236 | + $class[0] = '['.$class[0].']'; |
|
| 12238 | 12237 | } |
| 12239 | 12238 | |
| 12240 | 12239 | if (\count($class) === 1) { |
| 12241 | 12240 | $return = $class[0]; |
| 12242 | 12241 | } else { |
| 12243 | - $return = '(?:' . \implode('|', $class) . ')'; |
|
| 12242 | + $return = '(?:'.\implode('|', $class).')'; |
|
| 12244 | 12243 | } |
| 12245 | 12244 | |
| 12246 | 12245 | $RX_CLASSS_CACHE[$cacheKey] = $return; |
@@ -12314,7 +12313,7 @@ discard block |
||
| 12314 | 12313 | $continue = false; |
| 12315 | 12314 | |
| 12316 | 12315 | if ($delimiter === '-') { |
| 12317 | - foreach ((array) $specialCases['names'] as &$beginning) { |
|
| 12316 | + foreach ((array)$specialCases['names'] as &$beginning) { |
|
| 12318 | 12317 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
| 12319 | 12318 | $continue = true; |
| 12320 | 12319 | } |
@@ -12322,7 +12321,7 @@ discard block |
||
| 12322 | 12321 | unset($beginning); |
| 12323 | 12322 | } |
| 12324 | 12323 | |
| 12325 | - foreach ((array) $specialCases['prefixes'] as &$beginning) { |
|
| 12324 | + foreach ((array)$specialCases['prefixes'] as &$beginning) { |
|
| 12326 | 12325 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
| 12327 | 12326 | $continue = true; |
| 12328 | 12327 | } |
@@ -12378,8 +12377,8 @@ discard block |
||
| 12378 | 12377 | $buf .= self::$WIN1252_TO_UTF8[$ordC1]; |
| 12379 | 12378 | } else { |
| 12380 | 12379 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
| 12381 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
| 12382 | - $buf .= $cc1 . $cc2; |
|
| 12380 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
| 12381 | + $buf .= $cc1.$cc2; |
|
| 12383 | 12382 | } |
| 12384 | 12383 | |
| 12385 | 12384 | return $buf; |