@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | return ''; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - return (string) self::substr($str, $pos, 1); |
|
| 246 | + return (string)self::substr($str, $pos, 1); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /** |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | public static function add_bom_to_string(string $str): string |
| 259 | 259 | { |
| 260 | 260 | if (self::string_has_bom($str) === false) { |
| 261 | - $str = self::bom() . $str; |
|
| 261 | + $str = self::bom().$str; |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | return $str; |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | return ''; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - $substrIndex = $posStart + (int) self::strlen($start, $encoding); |
|
| 318 | + $substrIndex = $posStart + (int)self::strlen($start, $encoding); |
|
| 319 | 319 | $posEnd = self::strpos($str, $end, $substrIndex, $encoding); |
| 320 | 320 | if ( |
| 321 | 321 | $posEnd === false |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | return ''; |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | - return (string) self::substr($str, $substrIndex, $posEnd - $substrIndex, $encoding); |
|
| 328 | + return (string)self::substr($str, $substrIndex, $posEnd - $substrIndex, $encoding); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | /** |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | */ |
| 388 | 388 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
| 389 | 389 | { |
| 390 | - return (string) self::substr($str, $index, 1, $encoding); |
|
| 390 | + return (string)self::substr($str, $index, 1, $encoding); |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | /** |
@@ -483,10 +483,10 @@ discard block |
||
| 483 | 483 | && |
| 484 | 484 | self::$SUPPORT['mbstring'] === false |
| 485 | 485 | ) { |
| 486 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 486 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 487 | 487 | } |
| 488 | 488 | |
| 489 | - $cacheKey = $code_point . $encoding; |
|
| 489 | + $cacheKey = $code_point.$encoding; |
|
| 490 | 490 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
| 491 | 491 | return $CHAR_CACHE[$cacheKey]; |
| 492 | 492 | } |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | if (self::$CHR === null) { |
| 497 | 497 | $chrTmp = self::getData('chr'); |
| 498 | 498 | if ($chrTmp) { |
| 499 | - self::$CHR = (array) $chrTmp; |
|
| 499 | + self::$CHR = (array)$chrTmp; |
|
| 500 | 500 | } |
| 501 | 501 | } |
| 502 | 502 | |
@@ -526,11 +526,11 @@ discard block |
||
| 526 | 526 | if (self::$CHR === null) { |
| 527 | 527 | $chrTmp = self::getData('chr'); |
| 528 | 528 | if ($chrTmp) { |
| 529 | - self::$CHR = (array) $chrTmp; |
|
| 529 | + self::$CHR = (array)$chrTmp; |
|
| 530 | 530 | } |
| 531 | 531 | } |
| 532 | 532 | |
| 533 | - $code_point = (int) $code_point; |
|
| 533 | + $code_point = (int)$code_point; |
|
| 534 | 534 | if ($code_point <= 0x7F) { |
| 535 | 535 | /** |
| 536 | 536 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -540,22 +540,22 @@ discard block |
||
| 540 | 540 | /** |
| 541 | 541 | * @psalm-suppress PossiblyNullArrayAccess |
| 542 | 542 | */ |
| 543 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
| 543 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
| 544 | 544 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 545 | 545 | } elseif ($code_point <= 0xFFFF) { |
| 546 | 546 | /** |
| 547 | 547 | * @psalm-suppress PossiblyNullArrayAccess |
| 548 | 548 | */ |
| 549 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
| 550 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 549 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
| 550 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 551 | 551 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 552 | 552 | } else { |
| 553 | 553 | /** |
| 554 | 554 | * @psalm-suppress PossiblyNullArrayAccess |
| 555 | 555 | */ |
| 556 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
| 557 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 558 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 556 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
| 557 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
| 558 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 559 | 559 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 560 | 560 | } |
| 561 | 561 | |
@@ -607,7 +607,7 @@ discard block |
||
| 607 | 607 | |
| 608 | 608 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
| 609 | 609 | return \array_map( |
| 610 | - static function (string $data): int { |
|
| 610 | + static function(string $data): int { |
|
| 611 | 611 | return self::strlen_in_byte($data); |
| 612 | 612 | }, |
| 613 | 613 | $strSplit |
@@ -674,7 +674,7 @@ discard block |
||
| 674 | 674 | $char = ''; |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | - return self::int_to_hex(self::ord((string) $char), $pfix); |
|
| 677 | + return self::int_to_hex(self::ord((string)$char), $pfix); |
|
| 678 | 678 | } |
| 679 | 679 | |
| 680 | 680 | /** |
@@ -748,7 +748,7 @@ discard block |
||
| 748 | 748 | | ( [\x80-\xBF] ) # invalid byte in range 10000000 - 10111111 |
| 749 | 749 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
| 750 | 750 | /x'; |
| 751 | - $str = (string) \preg_replace($regx, '$1', $str); |
|
| 751 | + $str = (string)\preg_replace($regx, '$1', $str); |
|
| 752 | 752 | |
| 753 | 753 | if ($replace_diamond_question_mark === true) { |
| 754 | 754 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | public static function cleanup($str): string |
| 784 | 784 | { |
| 785 | 785 | // init |
| 786 | - $str = (string) $str; |
|
| 786 | + $str = (string)$str; |
|
| 787 | 787 | |
| 788 | 788 | if ($str === '') { |
| 789 | 789 | return ''; |
@@ -892,7 +892,7 @@ discard block |
||
| 892 | 892 | */ |
| 893 | 893 | public static function css_stripe_media_queries(string $str): string |
| 894 | 894 | { |
| 895 | - return (string) \preg_replace( |
|
| 895 | + return (string)\preg_replace( |
|
| 896 | 896 | '#@media\\s+(?:only\\s)?(?:[\\s{\\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#misU', |
| 897 | 897 | '', |
| 898 | 898 | $str |
@@ -919,7 +919,7 @@ discard block |
||
| 919 | 919 | */ |
| 920 | 920 | public static function decimal_to_chr($int): string |
| 921 | 921 | { |
| 922 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
| 922 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
| 923 | 923 | } |
| 924 | 924 | |
| 925 | 925 | /** |
@@ -996,7 +996,7 @@ discard block |
||
| 996 | 996 | if ($toEncoding === 'JSON') { |
| 997 | 997 | $return = self::json_encode($str); |
| 998 | 998 | if ($return === false) { |
| 999 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
| 999 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
| 1000 | 1000 | } |
| 1001 | 1001 | |
| 1002 | 1002 | return $return; |
@@ -1082,7 +1082,7 @@ discard block |
||
| 1082 | 1082 | && |
| 1083 | 1083 | self::$SUPPORT['mbstring'] === false |
| 1084 | 1084 | ) { |
| 1085 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $toEncoding . '" encoding', \E_USER_WARNING); |
|
| 1085 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$toEncoding.'" encoding', \E_USER_WARNING); |
|
| 1086 | 1086 | } |
| 1087 | 1087 | |
| 1088 | 1088 | if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) { |
@@ -1171,18 +1171,18 @@ discard block |
||
| 1171 | 1171 | $trimChars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
| 1172 | 1172 | |
| 1173 | 1173 | if ($length === null) { |
| 1174 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
| 1174 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
| 1175 | 1175 | } |
| 1176 | 1176 | |
| 1177 | 1177 | if (empty($search)) { |
| 1178 | 1178 | if ($length > 0) { |
| 1179 | - $stringLength = (int) self::strlen($str, $encoding); |
|
| 1179 | + $stringLength = (int)self::strlen($str, $encoding); |
|
| 1180 | 1180 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
| 1181 | 1181 | } else { |
| 1182 | 1182 | $end = 0; |
| 1183 | 1183 | } |
| 1184 | 1184 | |
| 1185 | - $pos = (int) \min( |
|
| 1185 | + $pos = (int)\min( |
|
| 1186 | 1186 | self::strpos($str, ' ', $end, $encoding), |
| 1187 | 1187 | self::strpos($str, '.', $end, $encoding) |
| 1188 | 1188 | ); |
@@ -1193,20 +1193,20 @@ discard block |
||
| 1193 | 1193 | return ''; |
| 1194 | 1194 | } |
| 1195 | 1195 | |
| 1196 | - return \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
| 1196 | + return \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
| 1197 | 1197 | } |
| 1198 | 1198 | |
| 1199 | 1199 | return $str; |
| 1200 | 1200 | } |
| 1201 | 1201 | |
| 1202 | - $wordPos = (int) self::stripos($str, $search, 0, $encoding); |
|
| 1203 | - $halfSide = (int) ($wordPos - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
| 1202 | + $wordPos = (int)self::stripos($str, $search, 0, $encoding); |
|
| 1203 | + $halfSide = (int)($wordPos - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
| 1204 | 1204 | |
| 1205 | 1205 | $pos_start = 0; |
| 1206 | 1206 | if ($halfSide > 0) { |
| 1207 | 1207 | $halfText = self::substr($str, 0, $halfSide, $encoding); |
| 1208 | 1208 | if ($halfText !== false) { |
| 1209 | - $pos_start = (int) \max( |
|
| 1209 | + $pos_start = (int)\max( |
|
| 1210 | 1210 | self::strrpos($halfText, ' ', 0, $encoding), |
| 1211 | 1211 | self::strrpos($halfText, '.', 0, $encoding) |
| 1212 | 1212 | ); |
@@ -1215,35 +1215,35 @@ discard block |
||
| 1215 | 1215 | |
| 1216 | 1216 | if ($wordPos && $halfSide > 0) { |
| 1217 | 1217 | $offset = $pos_start + $length - 1; |
| 1218 | - $realLength = (int) self::strlen($str, $encoding); |
|
| 1218 | + $realLength = (int)self::strlen($str, $encoding); |
|
| 1219 | 1219 | |
| 1220 | 1220 | if ($offset > $realLength) { |
| 1221 | 1221 | $offset = $realLength; |
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | - $pos_end = (int) \min( |
|
| 1224 | + $pos_end = (int)\min( |
|
| 1225 | 1225 | self::strpos($str, ' ', $offset, $encoding), |
| 1226 | 1226 | self::strpos($str, '.', $offset, $encoding) |
| 1227 | 1227 | ) - $pos_start; |
| 1228 | 1228 | |
| 1229 | 1229 | if (!$pos_end || $pos_end <= 0) { |
| 1230 | - $strSub = self::substr($str, $pos_start, (int) self::strlen($str), $encoding); |
|
| 1230 | + $strSub = self::substr($str, $pos_start, (int)self::strlen($str), $encoding); |
|
| 1231 | 1231 | if ($strSub !== false) { |
| 1232 | - $extract = $replacerForSkippedText . \ltrim($strSub, $trimChars); |
|
| 1232 | + $extract = $replacerForSkippedText.\ltrim($strSub, $trimChars); |
|
| 1233 | 1233 | } else { |
| 1234 | 1234 | $extract = ''; |
| 1235 | 1235 | } |
| 1236 | 1236 | } else { |
| 1237 | 1237 | $strSub = self::substr($str, $pos_start, $pos_end, $encoding); |
| 1238 | 1238 | if ($strSub !== false) { |
| 1239 | - $extract = $replacerForSkippedText . \trim($strSub, $trimChars) . $replacerForSkippedText; |
|
| 1239 | + $extract = $replacerForSkippedText.\trim($strSub, $trimChars).$replacerForSkippedText; |
|
| 1240 | 1240 | } else { |
| 1241 | 1241 | $extract = ''; |
| 1242 | 1242 | } |
| 1243 | 1243 | } |
| 1244 | 1244 | } else { |
| 1245 | 1245 | $offset = $length - 1; |
| 1246 | - $trueLength = (int) self::strlen($str, $encoding); |
|
| 1246 | + $trueLength = (int)self::strlen($str, $encoding); |
|
| 1247 | 1247 | |
| 1248 | 1248 | if ($offset > $trueLength) { |
| 1249 | 1249 | $offset = $trueLength; |
@@ -1257,7 +1257,7 @@ discard block |
||
| 1257 | 1257 | if ($pos_end) { |
| 1258 | 1258 | $strSub = self::substr($str, 0, $pos_end, $encoding); |
| 1259 | 1259 | if ($strSub !== false) { |
| 1260 | - $extract = \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
| 1260 | + $extract = \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
| 1261 | 1261 | } else { |
| 1262 | 1262 | $extract = ''; |
| 1263 | 1263 | } |
@@ -1377,7 +1377,7 @@ discard block |
||
| 1377 | 1377 | { |
| 1378 | 1378 | $file_content = \file_get_contents($file_path); |
| 1379 | 1379 | if ($file_content === false) { |
| 1380 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
| 1380 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
| 1381 | 1381 | } |
| 1382 | 1382 | |
| 1383 | 1383 | return self::string_has_bom($file_content); |
@@ -1440,7 +1440,7 @@ discard block |
||
| 1440 | 1440 | ) { |
| 1441 | 1441 | // Prevent leading combining chars |
| 1442 | 1442 | // for NFC-safe concatenations. |
| 1443 | - $var = $leading_combining . $var; |
|
| 1443 | + $var = $leading_combining.$var; |
|
| 1444 | 1444 | } |
| 1445 | 1445 | } |
| 1446 | 1446 | |
@@ -1674,7 +1674,7 @@ discard block |
||
| 1674 | 1674 | return ''; |
| 1675 | 1675 | } |
| 1676 | 1676 | |
| 1677 | - return (string) self::substr($str, 0, $n, $encoding); |
|
| 1677 | + return (string)self::substr($str, 0, $n, $encoding); |
|
| 1678 | 1678 | } |
| 1679 | 1679 | |
| 1680 | 1680 | /** |
@@ -1749,7 +1749,7 @@ discard block |
||
| 1749 | 1749 | return $str; |
| 1750 | 1750 | } |
| 1751 | 1751 | |
| 1752 | - $str = (string) $str; |
|
| 1752 | + $str = (string)$str; |
|
| 1753 | 1753 | $last = ''; |
| 1754 | 1754 | while ($last !== $str) { |
| 1755 | 1755 | $last = $str; |
@@ -1940,7 +1940,7 @@ discard block |
||
| 1940 | 1940 | } |
| 1941 | 1941 | |
| 1942 | 1942 | $str_info = \unpack('C2chars', $str_info); |
| 1943 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
| 1943 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
| 1944 | 1944 | |
| 1945 | 1945 | // DEBUG |
| 1946 | 1946 | //var_dump($type_code); |
@@ -2023,7 +2023,7 @@ discard block |
||
| 2023 | 2023 | // init |
| 2024 | 2024 | $i = 0; |
| 2025 | 2025 | $str = ''; |
| 2026 | - $maxlength = (int) self::strlen($possibleChars, $encoding); |
|
| 2026 | + $maxlength = (int)self::strlen($possibleChars, $encoding); |
|
| 2027 | 2027 | |
| 2028 | 2028 | if ($maxlength === 0) { |
| 2029 | 2029 | return ''; |
@@ -2055,16 +2055,16 @@ discard block |
||
| 2055 | 2055 | */ |
| 2056 | 2056 | public static function get_unique_string($entropyExtra = '', bool $md5 = true): string |
| 2057 | 2057 | { |
| 2058 | - $uniqueHelper = \random_int(0, \mt_getrandmax()) . |
|
| 2059 | - \session_id() . |
|
| 2060 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2061 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2058 | + $uniqueHelper = \random_int(0, \mt_getrandmax()). |
|
| 2059 | + \session_id(). |
|
| 2060 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
| 2061 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
| 2062 | 2062 | $entropyExtra; |
| 2063 | 2063 | |
| 2064 | 2064 | $uniqueString = \uniqid($uniqueHelper, true); |
| 2065 | 2065 | |
| 2066 | 2066 | if ($md5) { |
| 2067 | - $uniqueString = \md5($uniqueString . $uniqueHelper); |
|
| 2067 | + $uniqueString = \md5($uniqueString.$uniqueHelper); |
|
| 2068 | 2068 | } |
| 2069 | 2069 | |
| 2070 | 2070 | return $uniqueString; |
@@ -2134,7 +2134,7 @@ discard block |
||
| 2134 | 2134 | public static function hex_to_int($hexDec) |
| 2135 | 2135 | { |
| 2136 | 2136 | // init |
| 2137 | - $hexDec = (string) $hexDec; |
|
| 2137 | + $hexDec = (string)$hexDec; |
|
| 2138 | 2138 | |
| 2139 | 2139 | if ($hexDec === '') { |
| 2140 | 2140 | return false; |
@@ -2209,7 +2209,7 @@ discard block |
||
| 2209 | 2209 | return \implode( |
| 2210 | 2210 | '', |
| 2211 | 2211 | \array_map( |
| 2212 | - static function (string $chr) use ($keepAsciiChars, $encoding): string { |
|
| 2212 | + static function(string $chr) use ($keepAsciiChars, $encoding): string { |
|
| 2213 | 2213 | return self::single_chr_html_encode($chr, $keepAsciiChars, $encoding); |
| 2214 | 2214 | }, |
| 2215 | 2215 | self::split($str) |
@@ -2325,7 +2325,7 @@ discard block |
||
| 2325 | 2325 | && |
| 2326 | 2326 | self::$SUPPORT['mbstring'] === false |
| 2327 | 2327 | ) { |
| 2328 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 2328 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 2329 | 2329 | } |
| 2330 | 2330 | |
| 2331 | 2331 | if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) { |
@@ -2343,14 +2343,14 @@ discard block |
||
| 2343 | 2343 | $encoding |
| 2344 | 2344 | ); |
| 2345 | 2345 | } else { |
| 2346 | - $str = (string) \preg_replace_callback( |
|
| 2346 | + $str = (string)\preg_replace_callback( |
|
| 2347 | 2347 | "/&#\d{2,6};/", |
| 2348 | 2348 | /** |
| 2349 | 2349 | * @param string[] $matches |
| 2350 | 2350 | * |
| 2351 | 2351 | * @return string |
| 2352 | 2352 | */ |
| 2353 | - static function (array $matches) use ($encoding): string { |
|
| 2353 | + static function(array $matches) use ($encoding): string { |
|
| 2354 | 2354 | // always fallback via symfony polyfill |
| 2355 | 2355 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
| 2356 | 2356 | |
@@ -2366,7 +2366,7 @@ discard block |
||
| 2366 | 2366 | |
| 2367 | 2367 | // decode numeric & UTF16 two byte entities |
| 2368 | 2368 | $str = \html_entity_decode( |
| 2369 | - (string) \preg_replace('/(&#(?:x0*[0-9a-f]{2,6}(?![0-9a-f;])|(?:0*\d{2,6}(?![0-9;]))))/iS', '$1;', $str), |
|
| 2369 | + (string)\preg_replace('/(&#(?:x0*[0-9a-f]{2,6}(?![0-9a-f;])|(?:0*\d{2,6}(?![0-9;]))))/iS', '$1;', $str), |
|
| 2370 | 2370 | $flags, |
| 2371 | 2371 | $encoding |
| 2372 | 2372 | ); |
@@ -2403,7 +2403,7 @@ discard block |
||
| 2403 | 2403 | */ |
| 2404 | 2404 | public static function html_stripe_empty_tags(string $str): string |
| 2405 | 2405 | { |
| 2406 | - return (string) \preg_replace( |
|
| 2406 | + return (string)\preg_replace( |
|
| 2407 | 2407 | "/<[^\/>]*>(([\s]?)*|)<\/[^>]*>/iu", |
| 2408 | 2408 | '', |
| 2409 | 2409 | $str |
@@ -2692,9 +2692,9 @@ discard block |
||
| 2692 | 2692 | { |
| 2693 | 2693 | $hex = \dechex($int); |
| 2694 | 2694 | |
| 2695 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
| 2695 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
| 2696 | 2696 | |
| 2697 | - return $pfix . $hex . ''; |
|
| 2697 | + return $pfix.$hex.''; |
|
| 2698 | 2698 | } |
| 2699 | 2699 | |
| 2700 | 2700 | /** |
@@ -2935,7 +2935,7 @@ discard block |
||
| 2935 | 2935 | return false; |
| 2936 | 2936 | } |
| 2937 | 2937 | |
| 2938 | - $base64String = (string) \base64_decode($str, true); |
|
| 2938 | + $base64String = (string)\base64_decode($str, true); |
|
| 2939 | 2939 | |
| 2940 | 2940 | return $base64String && \base64_encode($base64String) === $str; |
| 2941 | 2941 | } |
@@ -2950,7 +2950,7 @@ discard block |
||
| 2950 | 2950 | */ |
| 2951 | 2951 | public static function is_binary($input, bool $strict = false): bool |
| 2952 | 2952 | { |
| 2953 | - $input = (string) $input; |
|
| 2953 | + $input = (string)$input; |
|
| 2954 | 2954 | if ($input === '') { |
| 2955 | 2955 | return false; |
| 2956 | 2956 | } |
@@ -3199,7 +3199,7 @@ discard block |
||
| 3199 | 3199 | public static function is_utf16($str, $checkIfStringIsBinary = true) |
| 3200 | 3200 | { |
| 3201 | 3201 | // init |
| 3202 | - $str = (string) $str; |
|
| 3202 | + $str = (string)$str; |
|
| 3203 | 3203 | $strChars = []; |
| 3204 | 3204 | |
| 3205 | 3205 | if ( |
@@ -3277,7 +3277,7 @@ discard block |
||
| 3277 | 3277 | public static function is_utf32($str, $checkIfStringIsBinary = true) |
| 3278 | 3278 | { |
| 3279 | 3279 | // init |
| 3280 | - $str = (string) $str; |
|
| 3280 | + $str = (string)$str; |
|
| 3281 | 3281 | $strChars = []; |
| 3282 | 3282 | |
| 3283 | 3283 | if ( |
@@ -3401,7 +3401,7 @@ discard block |
||
| 3401 | 3401 | self::$ORD = self::getData('ord'); |
| 3402 | 3402 | } |
| 3403 | 3403 | |
| 3404 | - $len = self::strlen_in_byte((string) $str); |
|
| 3404 | + $len = self::strlen_in_byte((string)$str); |
|
| 3405 | 3405 | /** @noinspection ForeachInvariantsInspection */ |
| 3406 | 3406 | for ($i = 0; $i < $len; ++$i) { |
| 3407 | 3407 | $in = self::$ORD[$str[$i]]; |
@@ -3630,17 +3630,17 @@ discard block |
||
| 3630 | 3630 | */ |
| 3631 | 3631 | public static function lcfirst(string $str, string $encoding = 'UTF-8', bool $cleanUtf8 = false, string $lang = null, bool $tryToKeepStringLength = false): string |
| 3632 | 3632 | { |
| 3633 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding, $cleanUtf8); |
|
| 3633 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding, $cleanUtf8); |
|
| 3634 | 3634 | |
| 3635 | 3635 | $strPartOne = self::strtolower( |
| 3636 | - (string) self::substr($str, 0, 1, $encoding, $cleanUtf8), |
|
| 3636 | + (string)self::substr($str, 0, 1, $encoding, $cleanUtf8), |
|
| 3637 | 3637 | $encoding, |
| 3638 | 3638 | $cleanUtf8, |
| 3639 | 3639 | $lang, |
| 3640 | 3640 | $tryToKeepStringLength |
| 3641 | 3641 | ); |
| 3642 | 3642 | |
| 3643 | - return $strPartOne . $strPartTwo; |
|
| 3643 | + return $strPartOne.$strPartTwo; |
|
| 3644 | 3644 | } |
| 3645 | 3645 | |
| 3646 | 3646 | /** |
@@ -3796,7 +3796,7 @@ discard block |
||
| 3796 | 3796 | { |
| 3797 | 3797 | $bytes = self::chr_size_list($str); |
| 3798 | 3798 | if (\count($bytes) > 0) { |
| 3799 | - return (int) \max($bytes); |
|
| 3799 | + return (int)\max($bytes); |
|
| 3800 | 3800 | } |
| 3801 | 3801 | |
| 3802 | 3802 | return 0; |
@@ -3871,7 +3871,7 @@ discard block |
||
| 3871 | 3871 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
| 3872 | 3872 | |
| 3873 | 3873 | // init |
| 3874 | - $encoding = (string) $encoding; |
|
| 3874 | + $encoding = (string)$encoding; |
|
| 3875 | 3875 | |
| 3876 | 3876 | if ( |
| 3877 | 3877 | !$encoding |
@@ -3923,7 +3923,7 @@ discard block |
||
| 3923 | 3923 | |
| 3924 | 3924 | $encodingOrig = $encoding; |
| 3925 | 3925 | $encoding = \strtoupper($encoding); |
| 3926 | - $encodingUpperHelper = (string) \preg_replace('/[^a-zA-Z0-9\s]/', '', $encoding); |
|
| 3926 | + $encodingUpperHelper = (string)\preg_replace('/[^a-zA-Z0-9\s]/', '', $encoding); |
|
| 3927 | 3927 | |
| 3928 | 3928 | $equivalences = [ |
| 3929 | 3929 | 'ISO8859' => 'ISO-8859-1', |
@@ -4009,7 +4009,7 @@ discard block |
||
| 4009 | 4009 | */ |
| 4010 | 4010 | public static function normalize_line_ending(string $str): string |
| 4011 | 4011 | { |
| 4012 | - return (string) \str_replace(["\r\n", "\r"], "\n", $str); |
|
| 4012 | + return (string)\str_replace(["\r\n", "\r"], "\n", $str); |
|
| 4013 | 4013 | } |
| 4014 | 4014 | |
| 4015 | 4015 | /** |
@@ -4057,7 +4057,7 @@ discard block |
||
| 4057 | 4057 | } |
| 4058 | 4058 | |
| 4059 | 4059 | static $WHITESPACE_CACHE = []; |
| 4060 | - $cacheKey = (int) $keepNonBreakingSpace; |
|
| 4060 | + $cacheKey = (int)$keepNonBreakingSpace; |
|
| 4061 | 4061 | |
| 4062 | 4062 | if (!isset($WHITESPACE_CACHE[$cacheKey])) { |
| 4063 | 4063 | $WHITESPACE_CACHE[$cacheKey] = self::$WHITESPACE_TABLE; |
@@ -4097,7 +4097,7 @@ discard block |
||
| 4097 | 4097 | public static function ord($chr, string $encoding = 'UTF-8'): int |
| 4098 | 4098 | { |
| 4099 | 4099 | // init |
| 4100 | - $chr = (string) $chr; |
|
| 4100 | + $chr = (string)$chr; |
|
| 4101 | 4101 | |
| 4102 | 4102 | static $CHAR_CACHE = []; |
| 4103 | 4103 | |
@@ -4108,7 +4108,7 @@ discard block |
||
| 4108 | 4108 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4109 | 4109 | } |
| 4110 | 4110 | |
| 4111 | - $cacheKey = $chr_orig . $encoding; |
|
| 4111 | + $cacheKey = $chr_orig.$encoding; |
|
| 4112 | 4112 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
| 4113 | 4113 | return $CHAR_CACHE[$cacheKey]; |
| 4114 | 4114 | } |
@@ -4139,22 +4139,22 @@ discard block |
||
| 4139 | 4139 | } |
| 4140 | 4140 | |
| 4141 | 4141 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
| 4142 | - $chr = \unpack('C*', (string) self::substr($chr, 0, 4, 'CP850')); |
|
| 4142 | + $chr = \unpack('C*', (string)self::substr($chr, 0, 4, 'CP850')); |
|
| 4143 | 4143 | $code = $chr ? $chr[1] : 0; |
| 4144 | 4144 | |
| 4145 | 4145 | if ($code >= 0xF0 && isset($chr[4])) { |
| 4146 | 4146 | /** @noinspection UnnecessaryCastingInspection */ |
| 4147 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 4147 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 4148 | 4148 | } |
| 4149 | 4149 | |
| 4150 | 4150 | if ($code >= 0xE0 && isset($chr[3])) { |
| 4151 | 4151 | /** @noinspection UnnecessaryCastingInspection */ |
| 4152 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 4152 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 4153 | 4153 | } |
| 4154 | 4154 | |
| 4155 | 4155 | if ($code >= 0xC0 && isset($chr[2])) { |
| 4156 | 4156 | /** @noinspection UnnecessaryCastingInspection */ |
| 4157 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 4157 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 4158 | 4158 | } |
| 4159 | 4159 | |
| 4160 | 4160 | return $CHAR_CACHE[$cacheKey] = $code; |
@@ -4207,7 +4207,7 @@ discard block |
||
| 4207 | 4207 | public static function pcre_utf8_support(): bool |
| 4208 | 4208 | { |
| 4209 | 4209 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 4210 | - return (bool) @\preg_match('//u', ''); |
|
| 4210 | + return (bool)@\preg_match('//u', ''); |
|
| 4211 | 4211 | } |
| 4212 | 4212 | |
| 4213 | 4213 | /** |
@@ -4233,10 +4233,10 @@ discard block |
||
| 4233 | 4233 | } |
| 4234 | 4234 | |
| 4235 | 4235 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4236 | - if (\ctype_digit((string) $var1)) { |
|
| 4237 | - $start = (int) $var1; |
|
| 4236 | + if (\ctype_digit((string)$var1)) { |
|
| 4237 | + $start = (int)$var1; |
|
| 4238 | 4238 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var1)) { |
| 4239 | - $start = (int) self::hex_to_int($var1); |
|
| 4239 | + $start = (int)self::hex_to_int($var1); |
|
| 4240 | 4240 | } else { |
| 4241 | 4241 | $start = self::ord($var1); |
| 4242 | 4242 | } |
@@ -4246,10 +4246,10 @@ discard block |
||
| 4246 | 4246 | } |
| 4247 | 4247 | |
| 4248 | 4248 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4249 | - if (\ctype_digit((string) $var2)) { |
|
| 4250 | - $end = (int) $var2; |
|
| 4249 | + if (\ctype_digit((string)$var2)) { |
|
| 4250 | + $end = (int)$var2; |
|
| 4251 | 4251 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var2)) { |
| 4252 | - $end = (int) self::hex_to_int($var2); |
|
| 4252 | + $end = (int)self::hex_to_int($var2); |
|
| 4253 | 4253 | } else { |
| 4254 | 4254 | $end = self::ord($var2); |
| 4255 | 4255 | } |
@@ -4259,8 +4259,8 @@ discard block |
||
| 4259 | 4259 | } |
| 4260 | 4260 | |
| 4261 | 4261 | return \array_map( |
| 4262 | - static function (int $i): string { |
|
| 4263 | - return (string) self::chr($i); |
|
| 4262 | + static function(int $i): string { |
|
| 4263 | + return (string)self::chr($i); |
|
| 4264 | 4264 | }, |
| 4265 | 4265 | \range($start, $end) |
| 4266 | 4266 | ); |
@@ -4293,7 +4293,7 @@ discard block |
||
| 4293 | 4293 | |
| 4294 | 4294 | $pattern = '/%u([0-9a-f]{3,4})/i'; |
| 4295 | 4295 | if (\preg_match($pattern, $str)) { |
| 4296 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
| 4296 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
| 4297 | 4297 | } |
| 4298 | 4298 | |
| 4299 | 4299 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -4341,8 +4341,8 @@ discard block |
||
| 4341 | 4341 | $delimiter = '/'; |
| 4342 | 4342 | } |
| 4343 | 4343 | |
| 4344 | - return (string) \preg_replace( |
|
| 4345 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
| 4344 | + return (string)\preg_replace( |
|
| 4345 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
| 4346 | 4346 | $replacement, |
| 4347 | 4347 | $str |
| 4348 | 4348 | ); |
@@ -4385,9 +4385,9 @@ discard block |
||
| 4385 | 4385 | return ''; |
| 4386 | 4386 | } |
| 4387 | 4387 | |
| 4388 | - $strLength -= (int) $bomByteLength; |
|
| 4388 | + $strLength -= (int)$bomByteLength; |
|
| 4389 | 4389 | |
| 4390 | - $str = (string) $strTmp; |
|
| 4390 | + $str = (string)$strTmp; |
|
| 4391 | 4391 | } |
| 4392 | 4392 | } |
| 4393 | 4393 | |
@@ -4411,7 +4411,7 @@ discard block |
||
| 4411 | 4411 | if (\is_array($what) === true) { |
| 4412 | 4412 | /** @noinspection ForeachSourceInspection */ |
| 4413 | 4413 | foreach ($what as $item) { |
| 4414 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/', $item, $str); |
|
| 4414 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/', $item, $str); |
|
| 4415 | 4415 | } |
| 4416 | 4416 | } |
| 4417 | 4417 | |
@@ -4443,7 +4443,7 @@ discard block |
||
| 4443 | 4443 | */ |
| 4444 | 4444 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
| 4445 | 4445 | { |
| 4446 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 4446 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 4447 | 4447 | } |
| 4448 | 4448 | |
| 4449 | 4449 | /** |
@@ -4474,7 +4474,7 @@ discard block |
||
| 4474 | 4474 | $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
| 4475 | 4475 | |
| 4476 | 4476 | do { |
| 4477 | - $str = (string) \preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
| 4477 | + $str = (string)\preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
| 4478 | 4478 | } while ($count !== 0); |
| 4479 | 4479 | |
| 4480 | 4480 | return $str; |
@@ -4492,9 +4492,9 @@ discard block |
||
| 4492 | 4492 | public static function remove_left(string $str, string $substring, string $encoding = 'UTF-8'): string |
| 4493 | 4493 | { |
| 4494 | 4494 | if (self::str_starts_with($str, $substring)) { |
| 4495 | - return (string) self::substr( |
|
| 4495 | + return (string)self::substr( |
|
| 4496 | 4496 | $str, |
| 4497 | - (int) self::strlen($substring, $encoding), |
|
| 4497 | + (int)self::strlen($substring, $encoding), |
|
| 4498 | 4498 | null, |
| 4499 | 4499 | $encoding |
| 4500 | 4500 | ); |
@@ -4515,10 +4515,10 @@ discard block |
||
| 4515 | 4515 | public static function remove_right(string $str, string $substring, string $encoding = 'UTF-8'): string |
| 4516 | 4516 | { |
| 4517 | 4517 | if (self::str_ends_with($str, $substring)) { |
| 4518 | - return (string) self::substr( |
|
| 4518 | + return (string)self::substr( |
|
| 4519 | 4519 | $str, |
| 4520 | 4520 | 0, |
| 4521 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding) |
|
| 4521 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding) |
|
| 4522 | 4522 | ); |
| 4523 | 4523 | } |
| 4524 | 4524 | |
@@ -4654,7 +4654,7 @@ discard block |
||
| 4654 | 4654 | |
| 4655 | 4655 | echo '<pre>'; |
| 4656 | 4656 | foreach (self::$SUPPORT as $key => &$value) { |
| 4657 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
| 4657 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
| 4658 | 4658 | } |
| 4659 | 4659 | unset($value); |
| 4660 | 4660 | echo '</pre>'; |
@@ -4687,7 +4687,7 @@ discard block |
||
| 4687 | 4687 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4688 | 4688 | } |
| 4689 | 4689 | |
| 4690 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
| 4690 | + return '&#'.self::ord($char, $encoding).';'; |
|
| 4691 | 4691 | } |
| 4692 | 4692 | |
| 4693 | 4693 | /** |
@@ -4726,7 +4726,7 @@ discard block |
||
| 4726 | 4726 | } |
| 4727 | 4727 | |
| 4728 | 4728 | // init |
| 4729 | - $str = (string) $str; |
|
| 4729 | + $str = (string)$str; |
|
| 4730 | 4730 | |
| 4731 | 4731 | if ($str === '') { |
| 4732 | 4732 | return []; |
@@ -4769,7 +4769,7 @@ discard block |
||
| 4769 | 4769 | ($str[$i] & "\xE0") === "\xC0" |
| 4770 | 4770 | ) { |
| 4771 | 4771 | if (($str[$i + 1] & "\xC0") === "\x80") { |
| 4772 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
| 4772 | + $ret[] = $str[$i].$str[$i + 1]; |
|
| 4773 | 4773 | |
| 4774 | 4774 | ++$i; |
| 4775 | 4775 | } |
@@ -4783,7 +4783,7 @@ discard block |
||
| 4783 | 4783 | && |
| 4784 | 4784 | ($str[$i + 2] & "\xC0") === "\x80" |
| 4785 | 4785 | ) { |
| 4786 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
| 4786 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
| 4787 | 4787 | |
| 4788 | 4788 | $i += 2; |
| 4789 | 4789 | } |
@@ -4799,7 +4799,7 @@ discard block |
||
| 4799 | 4799 | && |
| 4800 | 4800 | ($str[$i + 3] & "\xC0") === "\x80" |
| 4801 | 4801 | ) { |
| 4802 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
| 4802 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
| 4803 | 4803 | |
| 4804 | 4804 | $i += 3; |
| 4805 | 4805 | } |
@@ -4811,7 +4811,7 @@ discard block |
||
| 4811 | 4811 | $ret = \array_chunk($ret, $length); |
| 4812 | 4812 | |
| 4813 | 4813 | return \array_map( |
| 4814 | - static function (array $item): string { |
|
| 4814 | + static function(array $item): string { |
|
| 4815 | 4815 | return \implode('', $item); |
| 4816 | 4816 | }, |
| 4817 | 4817 | $ret |
@@ -4841,16 +4841,16 @@ discard block |
||
| 4841 | 4841 | public static function str_camelize(string $str, string $encoding = 'UTF-8', bool $cleanUtf8 = false, string $lang = null, bool $tryToKeepStringLength = false): string |
| 4842 | 4842 | { |
| 4843 | 4843 | $str = self::lcfirst(self::trim($str), $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
| 4844 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
| 4844 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
| 4845 | 4845 | |
| 4846 | - $str = (string) \preg_replace_callback( |
|
| 4846 | + $str = (string)\preg_replace_callback( |
|
| 4847 | 4847 | '/[-_\s]+(.)?/u', |
| 4848 | 4848 | /** |
| 4849 | 4849 | * @param array $match |
| 4850 | 4850 | * |
| 4851 | 4851 | * @return string |
| 4852 | 4852 | */ |
| 4853 | - static function (array $match) use ($encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
| 4853 | + static function(array $match) use ($encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
| 4854 | 4854 | if (isset($match[1])) { |
| 4855 | 4855 | return self::strtoupper($match[1], $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
| 4856 | 4856 | } |
@@ -4860,14 +4860,14 @@ discard block |
||
| 4860 | 4860 | $str |
| 4861 | 4861 | ); |
| 4862 | 4862 | |
| 4863 | - return (string) \preg_replace_callback( |
|
| 4863 | + return (string)\preg_replace_callback( |
|
| 4864 | 4864 | '/[\d]+(.)?/u', |
| 4865 | 4865 | /** |
| 4866 | 4866 | * @param array $match |
| 4867 | 4867 | * |
| 4868 | 4868 | * @return string |
| 4869 | 4869 | */ |
| 4870 | - static function (array $match) use ($encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
| 4870 | + static function(array $match) use ($encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
| 4871 | 4871 | return self::strtoupper($match[0], $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
| 4872 | 4872 | }, |
| 4873 | 4873 | $str |
@@ -4912,7 +4912,7 @@ discard block |
||
| 4912 | 4912 | // only a fallback to prevent BC in the api ... |
| 4913 | 4913 | /** @psalm-suppress RedundantConditionGivenDocblockType */ |
| 4914 | 4914 | if ($caseSensitive !== false && $caseSensitive !== true) { |
| 4915 | - $encoding = (string) $caseSensitive; |
|
| 4915 | + $encoding = (string)$caseSensitive; |
|
| 4916 | 4916 | } |
| 4917 | 4917 | |
| 4918 | 4918 | if ($caseSensitive) { |
@@ -4947,7 +4947,7 @@ discard block |
||
| 4947 | 4947 | // only a fallback to prevent BC in the api ... |
| 4948 | 4948 | /** @psalm-suppress RedundantConditionGivenDocblockType */ |
| 4949 | 4949 | if ($caseSensitive !== false && $caseSensitive !== true) { |
| 4950 | - $encoding = (string) $caseSensitive; |
|
| 4950 | + $encoding = (string)$caseSensitive; |
|
| 4951 | 4951 | } |
| 4952 | 4952 | |
| 4953 | 4953 | foreach ($needles as &$needle) { |
@@ -5029,11 +5029,11 @@ discard block |
||
| 5029 | 5029 | ): string { |
| 5030 | 5030 | $str = self::trim($str); |
| 5031 | 5031 | |
| 5032 | - $str = (string) \preg_replace('/\B([A-Z])/u', '-\1', $str); |
|
| 5032 | + $str = (string)\preg_replace('/\B([A-Z])/u', '-\1', $str); |
|
| 5033 | 5033 | |
| 5034 | 5034 | $str = self::strtolower($str, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
| 5035 | 5035 | |
| 5036 | - return (string) \preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
| 5036 | + return (string)\preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
| 5037 | 5037 | } |
| 5038 | 5038 | |
| 5039 | 5039 | /** |
@@ -5048,7 +5048,7 @@ discard block |
||
| 5048 | 5048 | public static function str_detect_encoding($str) |
| 5049 | 5049 | { |
| 5050 | 5050 | // init |
| 5051 | - $str = (string) $str; |
|
| 5051 | + $str = (string)$str; |
|
| 5052 | 5052 | |
| 5053 | 5053 | // |
| 5054 | 5054 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5154,7 +5154,7 @@ discard block |
||
| 5154 | 5154 | foreach (self::$ENCODINGS as $encodingTmp) { |
| 5155 | 5155 | // INFO: //IGNORE but still throw notice |
| 5156 | 5156 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 5157 | - if ((string) @\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str) === $str) { |
|
| 5157 | + if ((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str) === $str) { |
|
| 5158 | 5158 | return $encodingTmp; |
| 5159 | 5159 | } |
| 5160 | 5160 | } |
@@ -5216,7 +5216,7 @@ discard block |
||
| 5216 | 5216 | public static function str_ensure_left(string $str, string $substring): string |
| 5217 | 5217 | { |
| 5218 | 5218 | if (!self::str_starts_with($str, $substring)) { |
| 5219 | - $str = $substring . $str; |
|
| 5219 | + $str = $substring.$str; |
|
| 5220 | 5220 | } |
| 5221 | 5221 | |
| 5222 | 5222 | return $str; |
@@ -5412,15 +5412,15 @@ discard block |
||
| 5412 | 5412 | */ |
| 5413 | 5413 | public static function str_insert(string $str, string $substring, int $index, string $encoding = 'UTF-8'): string |
| 5414 | 5414 | { |
| 5415 | - $len = (int) self::strlen($str, $encoding); |
|
| 5415 | + $len = (int)self::strlen($str, $encoding); |
|
| 5416 | 5416 | |
| 5417 | 5417 | if ($index > $len) { |
| 5418 | 5418 | return $str; |
| 5419 | 5419 | } |
| 5420 | 5420 | |
| 5421 | - return (string) self::substr($str, 0, $index, $encoding) . |
|
| 5422 | - $substring . |
|
| 5423 | - (string) self::substr($str, $index, $len, $encoding); |
|
| 5421 | + return (string)self::substr($str, 0, $index, $encoding). |
|
| 5422 | + $substring. |
|
| 5423 | + (string)self::substr($str, $index, $len, $encoding); |
|
| 5424 | 5424 | } |
| 5425 | 5425 | |
| 5426 | 5426 | /** |
@@ -5450,15 +5450,15 @@ discard block |
||
| 5450 | 5450 | */ |
| 5451 | 5451 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
| 5452 | 5452 | { |
| 5453 | - $search = (array) $search; |
|
| 5453 | + $search = (array)$search; |
|
| 5454 | 5454 | |
| 5455 | 5455 | /** @noinspection AlterInForeachInspection */ |
| 5456 | 5456 | foreach ($search as &$s) { |
| 5457 | - $s = (string) $s; |
|
| 5457 | + $s = (string)$s; |
|
| 5458 | 5458 | if ($s === '') { |
| 5459 | 5459 | $s = '/^(?<=.)$/'; |
| 5460 | 5460 | } else { |
| 5461 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
| 5461 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
| 5462 | 5462 | } |
| 5463 | 5463 | } |
| 5464 | 5464 | |
@@ -5490,11 +5490,11 @@ discard block |
||
| 5490 | 5490 | } |
| 5491 | 5491 | |
| 5492 | 5492 | if ($search === '') { |
| 5493 | - return $str . $replacement; |
|
| 5493 | + return $str.$replacement; |
|
| 5494 | 5494 | } |
| 5495 | 5495 | |
| 5496 | 5496 | if (\stripos($str, $search) === 0) { |
| 5497 | - return $replacement . \substr($str, \strlen($search)); |
|
| 5497 | + return $replacement.\substr($str, \strlen($search)); |
|
| 5498 | 5498 | } |
| 5499 | 5499 | |
| 5500 | 5500 | return $str; |
@@ -5522,11 +5522,11 @@ discard block |
||
| 5522 | 5522 | } |
| 5523 | 5523 | |
| 5524 | 5524 | if ($search === '') { |
| 5525 | - return $str . $replacement; |
|
| 5525 | + return $str.$replacement; |
|
| 5526 | 5526 | } |
| 5527 | 5527 | |
| 5528 | 5528 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 5529 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 5529 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 5530 | 5530 | } |
| 5531 | 5531 | |
| 5532 | 5532 | return $str; |
@@ -5602,9 +5602,9 @@ discard block |
||
| 5602 | 5602 | return ''; |
| 5603 | 5603 | } |
| 5604 | 5604 | |
| 5605 | - return (string) self::substr( |
|
| 5605 | + return (string)self::substr( |
|
| 5606 | 5606 | $str, |
| 5607 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 5607 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 5608 | 5608 | null, |
| 5609 | 5609 | $encoding |
| 5610 | 5610 | ); |
@@ -5634,9 +5634,9 @@ discard block |
||
| 5634 | 5634 | return ''; |
| 5635 | 5635 | } |
| 5636 | 5636 | |
| 5637 | - return (string) self::substr( |
|
| 5637 | + return (string)self::substr( |
|
| 5638 | 5638 | $str, |
| 5639 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 5639 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 5640 | 5640 | null, |
| 5641 | 5641 | $encoding |
| 5642 | 5642 | ); |
@@ -5666,7 +5666,7 @@ discard block |
||
| 5666 | 5666 | return ''; |
| 5667 | 5667 | } |
| 5668 | 5668 | |
| 5669 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 5669 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 5670 | 5670 | } |
| 5671 | 5671 | |
| 5672 | 5672 | /** |
@@ -5693,7 +5693,7 @@ discard block |
||
| 5693 | 5693 | return ''; |
| 5694 | 5694 | } |
| 5695 | 5695 | |
| 5696 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 5696 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 5697 | 5697 | } |
| 5698 | 5698 | |
| 5699 | 5699 | /** |
@@ -5772,7 +5772,7 @@ discard block |
||
| 5772 | 5772 | return ''; |
| 5773 | 5773 | } |
| 5774 | 5774 | |
| 5775 | - return (string) self::substr($str, -$n, null, $encoding); |
|
| 5775 | + return (string)self::substr($str, -$n, null, $encoding); |
|
| 5776 | 5776 | } |
| 5777 | 5777 | |
| 5778 | 5778 | /** |
@@ -5795,11 +5795,11 @@ discard block |
||
| 5795 | 5795 | return ''; |
| 5796 | 5796 | } |
| 5797 | 5797 | |
| 5798 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 5798 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 5799 | 5799 | return $str; |
| 5800 | 5800 | } |
| 5801 | 5801 | |
| 5802 | - return (string) self::substr($str, 0, $length - (int) self::strlen($strAddOn), $encoding) . $strAddOn; |
|
| 5802 | + return (string)self::substr($str, 0, $length - (int)self::strlen($strAddOn), $encoding).$strAddOn; |
|
| 5803 | 5803 | } |
| 5804 | 5804 | |
| 5805 | 5805 | /** |
@@ -5822,17 +5822,17 @@ discard block |
||
| 5822 | 5822 | return ''; |
| 5823 | 5823 | } |
| 5824 | 5824 | |
| 5825 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 5825 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 5826 | 5826 | return $str; |
| 5827 | 5827 | } |
| 5828 | 5828 | |
| 5829 | 5829 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
| 5830 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
| 5830 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
| 5831 | 5831 | } |
| 5832 | 5832 | |
| 5833 | 5833 | $str = self::substr($str, 0, $length, $encoding); |
| 5834 | 5834 | if ($str === false) { |
| 5835 | - return '' . $strAddOn; |
|
| 5835 | + return ''.$strAddOn; |
|
| 5836 | 5836 | } |
| 5837 | 5837 | |
| 5838 | 5838 | $array = \explode(' ', $str); |
@@ -5840,10 +5840,10 @@ discard block |
||
| 5840 | 5840 | $new_str = \implode(' ', $array); |
| 5841 | 5841 | |
| 5842 | 5842 | if ($new_str === '') { |
| 5843 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
| 5843 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
| 5844 | 5844 | } |
| 5845 | 5845 | |
| 5846 | - return $new_str . $strAddOn; |
|
| 5846 | + return $new_str.$strAddOn; |
|
| 5847 | 5847 | } |
| 5848 | 5848 | |
| 5849 | 5849 | /** |
@@ -5857,7 +5857,7 @@ discard block |
||
| 5857 | 5857 | */ |
| 5858 | 5858 | public static function str_longest_common_prefix(string $str, string $otherStr, string $encoding = 'UTF-8'): string |
| 5859 | 5859 | { |
| 5860 | - $maxLength = \min(self::strlen($str, $encoding), (int) self::strlen($otherStr, $encoding)); |
|
| 5860 | + $maxLength = \min(self::strlen($str, $encoding), (int)self::strlen($otherStr, $encoding)); |
|
| 5861 | 5861 | |
| 5862 | 5862 | $longestCommonPrefix = ''; |
| 5863 | 5863 | for ($i = 0; $i < $maxLength; ++$i) { |
@@ -5891,8 +5891,8 @@ discard block |
||
| 5891 | 5891 | { |
| 5892 | 5892 | // Uses dynamic programming to solve |
| 5893 | 5893 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
| 5894 | - $strLength = (int) self::strlen($str, $encoding); |
|
| 5895 | - $otherLength = (int) self::strlen($otherStr, $encoding); |
|
| 5894 | + $strLength = (int)self::strlen($str, $encoding); |
|
| 5895 | + $otherLength = (int)self::strlen($otherStr, $encoding); |
|
| 5896 | 5896 | |
| 5897 | 5897 | // Return if either string is empty |
| 5898 | 5898 | if ($strLength === 0 || $otherLength === 0) { |
@@ -5924,7 +5924,7 @@ discard block |
||
| 5924 | 5924 | } |
| 5925 | 5925 | } |
| 5926 | 5926 | |
| 5927 | - return (string) self::substr($str, $end - $len, $len, $encoding); |
|
| 5927 | + return (string)self::substr($str, $end - $len, $len, $encoding); |
|
| 5928 | 5928 | } |
| 5929 | 5929 | |
| 5930 | 5930 | /** |
@@ -5938,7 +5938,7 @@ discard block |
||
| 5938 | 5938 | */ |
| 5939 | 5939 | public static function str_longest_common_suffix(string $str, string $otherStr, string $encoding = 'UTF-8'): string |
| 5940 | 5940 | { |
| 5941 | - $maxLength = \min(self::strlen($str, $encoding), (int) self::strlen($otherStr, $encoding)); |
|
| 5941 | + $maxLength = \min(self::strlen($str, $encoding), (int)self::strlen($otherStr, $encoding)); |
|
| 5942 | 5942 | |
| 5943 | 5943 | $longestCommonSuffix = ''; |
| 5944 | 5944 | for ($i = 1; $i <= $maxLength; ++$i) { |
@@ -5949,7 +5949,7 @@ discard block |
||
| 5949 | 5949 | && |
| 5950 | 5950 | $char === self::substr($otherStr, -$i, 1, $encoding) |
| 5951 | 5951 | ) { |
| 5952 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
| 5952 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
| 5953 | 5953 | } else { |
| 5954 | 5954 | break; |
| 5955 | 5955 | } |
@@ -5968,7 +5968,7 @@ discard block |
||
| 5968 | 5968 | */ |
| 5969 | 5969 | public static function str_matches_pattern(string $str, string $pattern): bool |
| 5970 | 5970 | { |
| 5971 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
| 5971 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
| 5972 | 5972 | } |
| 5973 | 5973 | |
| 5974 | 5974 | /** |
@@ -5985,7 +5985,7 @@ discard block |
||
| 5985 | 5985 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
| 5986 | 5986 | { |
| 5987 | 5987 | // init |
| 5988 | - $length = (int) self::strlen($str, $encoding); |
|
| 5988 | + $length = (int)self::strlen($str, $encoding); |
|
| 5989 | 5989 | |
| 5990 | 5990 | if ($offset >= 0) { |
| 5991 | 5991 | return $length > $offset; |
@@ -6011,7 +6011,7 @@ discard block |
||
| 6011 | 6011 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
| 6012 | 6012 | { |
| 6013 | 6013 | // init |
| 6014 | - $length = (int) self::strlen($str); |
|
| 6014 | + $length = (int)self::strlen($str); |
|
| 6015 | 6015 | |
| 6016 | 6016 | if ( |
| 6017 | 6017 | ($index >= 0 && $length <= $index) |
@@ -6045,7 +6045,7 @@ discard block |
||
| 6045 | 6045 | return ''; |
| 6046 | 6046 | } |
| 6047 | 6047 | |
| 6048 | - if ($pad_type !== (int) $pad_type) { |
|
| 6048 | + if ($pad_type !== (int)$pad_type) { |
|
| 6049 | 6049 | if ($pad_type === 'left') { |
| 6050 | 6050 | $pad_type = \STR_PAD_LEFT; |
| 6051 | 6051 | } elseif ($pad_type === 'right') { |
@@ -6054,46 +6054,46 @@ discard block |
||
| 6054 | 6054 | $pad_type = \STR_PAD_BOTH; |
| 6055 | 6055 | } else { |
| 6056 | 6056 | throw new \InvalidArgumentException( |
| 6057 | - 'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
| 6057 | + 'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
| 6058 | 6058 | ); |
| 6059 | 6059 | } |
| 6060 | 6060 | } |
| 6061 | 6061 | |
| 6062 | - $str_length = (int) self::strlen($str, $encoding); |
|
| 6062 | + $str_length = (int)self::strlen($str, $encoding); |
|
| 6063 | 6063 | |
| 6064 | 6064 | if ( |
| 6065 | 6065 | $pad_length > 0 |
| 6066 | 6066 | && |
| 6067 | 6067 | $pad_length >= $str_length |
| 6068 | 6068 | ) { |
| 6069 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 6069 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 6070 | 6070 | |
| 6071 | 6071 | $diff = ($pad_length - $str_length); |
| 6072 | 6072 | |
| 6073 | 6073 | switch ($pad_type) { |
| 6074 | 6074 | case \STR_PAD_LEFT: |
| 6075 | - $pre = \str_repeat($pad_string, (int) \ceil($diff / $ps_length)); |
|
| 6076 | - $pre = (string) self::substr($pre, 0, $diff, $encoding); |
|
| 6075 | + $pre = \str_repeat($pad_string, (int)\ceil($diff / $ps_length)); |
|
| 6076 | + $pre = (string)self::substr($pre, 0, $diff, $encoding); |
|
| 6077 | 6077 | $post = ''; |
| 6078 | 6078 | |
| 6079 | 6079 | break; |
| 6080 | 6080 | |
| 6081 | 6081 | case \STR_PAD_BOTH: |
| 6082 | - $pre = \str_repeat($pad_string, (int) \ceil($diff / $ps_length / 2)); |
|
| 6083 | - $pre = (string) self::substr($pre, 0, (int) \floor($diff / 2), $encoding); |
|
| 6084 | - $post = \str_repeat($pad_string, (int) \ceil($diff / $ps_length / 2)); |
|
| 6085 | - $post = (string) self::substr($post, 0, (int) \ceil($diff / 2), $encoding); |
|
| 6082 | + $pre = \str_repeat($pad_string, (int)\ceil($diff / $ps_length / 2)); |
|
| 6083 | + $pre = (string)self::substr($pre, 0, (int)\floor($diff / 2), $encoding); |
|
| 6084 | + $post = \str_repeat($pad_string, (int)\ceil($diff / $ps_length / 2)); |
|
| 6085 | + $post = (string)self::substr($post, 0, (int)\ceil($diff / 2), $encoding); |
|
| 6086 | 6086 | |
| 6087 | 6087 | break; |
| 6088 | 6088 | |
| 6089 | 6089 | case \STR_PAD_RIGHT: |
| 6090 | 6090 | default: |
| 6091 | - $post = \str_repeat($pad_string, (int) \ceil($diff / $ps_length)); |
|
| 6092 | - $post = (string) self::substr($post, 0, $diff, $encoding); |
|
| 6091 | + $post = \str_repeat($pad_string, (int)\ceil($diff / $ps_length)); |
|
| 6092 | + $post = (string)self::substr($post, 0, $diff, $encoding); |
|
| 6093 | 6093 | $pre = ''; |
| 6094 | 6094 | } |
| 6095 | 6095 | |
| 6096 | - return $pre . $str . $post; |
|
| 6096 | + return $pre.$str.$post; |
|
| 6097 | 6097 | } |
| 6098 | 6098 | |
| 6099 | 6099 | return $str; |
@@ -6112,9 +6112,9 @@ discard block |
||
| 6112 | 6112 | */ |
| 6113 | 6113 | public static function str_pad_both(string $str, int $length, string $padStr = ' ', string $encoding = 'UTF-8'): string |
| 6114 | 6114 | { |
| 6115 | - $padding = $length - (int) self::strlen($str, $encoding); |
|
| 6115 | + $padding = $length - (int)self::strlen($str, $encoding); |
|
| 6116 | 6116 | |
| 6117 | - return self::apply_padding($str, (int) \floor($padding / 2), (int) \ceil($padding / 2), $padStr, $encoding); |
|
| 6117 | + return self::apply_padding($str, (int)\floor($padding / 2), (int)\ceil($padding / 2), $padStr, $encoding); |
|
| 6118 | 6118 | } |
| 6119 | 6119 | |
| 6120 | 6120 | /** |
@@ -6130,7 +6130,7 @@ discard block |
||
| 6130 | 6130 | */ |
| 6131 | 6131 | public static function str_pad_left(string $str, int $length, string $padStr = ' ', string $encoding = 'UTF-8'): string |
| 6132 | 6132 | { |
| 6133 | - return self::apply_padding($str, $length - (int) self::strlen($str), 0, $padStr, $encoding); |
|
| 6133 | + return self::apply_padding($str, $length - (int)self::strlen($str), 0, $padStr, $encoding); |
|
| 6134 | 6134 | } |
| 6135 | 6135 | |
| 6136 | 6136 | /** |
@@ -6146,7 +6146,7 @@ discard block |
||
| 6146 | 6146 | */ |
| 6147 | 6147 | public static function str_pad_right(string $str, int $length, string $padStr = ' ', string $encoding = 'UTF-8'): string |
| 6148 | 6148 | { |
| 6149 | - return self::apply_padding($str, 0, $length - (int) self::strlen($str), $padStr, $encoding); |
|
| 6149 | + return self::apply_padding($str, 0, $length - (int)self::strlen($str), $padStr, $encoding); |
|
| 6150 | 6150 | } |
| 6151 | 6151 | |
| 6152 | 6152 | /** |
@@ -6231,11 +6231,11 @@ discard block |
||
| 6231 | 6231 | } |
| 6232 | 6232 | |
| 6233 | 6233 | if ($search === '') { |
| 6234 | - return $str . $replacement; |
|
| 6234 | + return $str.$replacement; |
|
| 6235 | 6235 | } |
| 6236 | 6236 | |
| 6237 | 6237 | if (\strpos($str, $search) === 0) { |
| 6238 | - return $replacement . \substr($str, \strlen($search)); |
|
| 6238 | + return $replacement.\substr($str, \strlen($search)); |
|
| 6239 | 6239 | } |
| 6240 | 6240 | |
| 6241 | 6241 | return $str; |
@@ -6263,11 +6263,11 @@ discard block |
||
| 6263 | 6263 | } |
| 6264 | 6264 | |
| 6265 | 6265 | if ($search === '') { |
| 6266 | - return $str . $replacement; |
|
| 6266 | + return $str.$replacement; |
|
| 6267 | 6267 | } |
| 6268 | 6268 | |
| 6269 | 6269 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 6270 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 6270 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 6271 | 6271 | } |
| 6272 | 6272 | |
| 6273 | 6273 | return $str; |
@@ -6289,7 +6289,7 @@ discard block |
||
| 6289 | 6289 | $pos = self::strpos($subject, $search); |
| 6290 | 6290 | if ($pos !== false) { |
| 6291 | 6291 | /** @psalm-suppress InvalidReturnStatement */ |
| 6292 | - return self::substr_replace($subject, $replace, $pos, (int) self::strlen($search)); |
|
| 6292 | + return self::substr_replace($subject, $replace, $pos, (int)self::strlen($search)); |
|
| 6293 | 6293 | } |
| 6294 | 6294 | |
| 6295 | 6295 | return $subject; |
@@ -6311,7 +6311,7 @@ discard block |
||
| 6311 | 6311 | $pos = self::strrpos($subject, $search); |
| 6312 | 6312 | if ($pos !== false) { |
| 6313 | 6313 | /** @psalm-suppress InvalidReturnStatement */ |
| 6314 | - return self::substr_replace($subject, $replace, $pos, (int) self::strlen($search)); |
|
| 6314 | + return self::substr_replace($subject, $replace, $pos, (int)self::strlen($search)); |
|
| 6315 | 6315 | } |
| 6316 | 6316 | |
| 6317 | 6317 | return $subject; |
@@ -6328,7 +6328,7 @@ discard block |
||
| 6328 | 6328 | */ |
| 6329 | 6329 | public static function str_shuffle(string $str): string |
| 6330 | 6330 | { |
| 6331 | - $indexes = \range(0, (int) self::strlen($str) - 1); |
|
| 6331 | + $indexes = \range(0, (int)self::strlen($str) - 1); |
|
| 6332 | 6332 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 6333 | 6333 | \shuffle($indexes); |
| 6334 | 6334 | |
@@ -6361,11 +6361,11 @@ discard block |
||
| 6361 | 6361 | public static function str_slice(string $str, int $start, int $end = null, string $encoding = 'UTF-8') |
| 6362 | 6362 | { |
| 6363 | 6363 | if ($end === null) { |
| 6364 | - $length = (int) self::strlen($str); |
|
| 6364 | + $length = (int)self::strlen($str); |
|
| 6365 | 6365 | } elseif ($end >= 0 && $end <= $start) { |
| 6366 | 6366 | return ''; |
| 6367 | 6367 | } elseif ($end < 0) { |
| 6368 | - $length = (int) self::strlen($str) + $end - $start; |
|
| 6368 | + $length = (int)self::strlen($str) + $end - $start; |
|
| 6369 | 6369 | } else { |
| 6370 | 6370 | $length = $end - $start; |
| 6371 | 6371 | } |
@@ -6386,31 +6386,31 @@ discard block |
||
| 6386 | 6386 | $str = self::normalize_whitespace($str); |
| 6387 | 6387 | $str = \str_replace('-', '_', $str); |
| 6388 | 6388 | |
| 6389 | - $str = (string) \preg_replace_callback( |
|
| 6389 | + $str = (string)\preg_replace_callback( |
|
| 6390 | 6390 | '/([\d|A-Z])/u', |
| 6391 | 6391 | /** |
| 6392 | 6392 | * @param string[] $matches |
| 6393 | 6393 | * |
| 6394 | 6394 | * @return string |
| 6395 | 6395 | */ |
| 6396 | - static function (array $matches) use ($encoding): string { |
|
| 6396 | + static function(array $matches) use ($encoding): string { |
|
| 6397 | 6397 | $match = $matches[1]; |
| 6398 | - $matchInt = (int) $match; |
|
| 6398 | + $matchInt = (int)$match; |
|
| 6399 | 6399 | |
| 6400 | - if ((string) $matchInt === $match) { |
|
| 6401 | - return '_' . $match . '_'; |
|
| 6400 | + if ((string)$matchInt === $match) { |
|
| 6401 | + return '_'.$match.'_'; |
|
| 6402 | 6402 | } |
| 6403 | 6403 | |
| 6404 | - return '_' . self::strtolower($match, $encoding); |
|
| 6404 | + return '_'.self::strtolower($match, $encoding); |
|
| 6405 | 6405 | }, |
| 6406 | 6406 | $str |
| 6407 | 6407 | ); |
| 6408 | 6408 | |
| 6409 | - $str = (string) \preg_replace( |
|
| 6409 | + $str = (string)\preg_replace( |
|
| 6410 | 6410 | [ |
| 6411 | - '/\s+/', // convert spaces to "_" |
|
| 6412 | - '/^\s+|\s+$/', // trim leading & trailing spaces |
|
| 6413 | - '/_+/', // remove double "_" |
|
| 6411 | + '/\s+/', // convert spaces to "_" |
|
| 6412 | + '/^\s+|\s+$/', // trim leading & trailing spaces |
|
| 6413 | + '/_+/', // remove double "_" |
|
| 6414 | 6414 | ], |
| 6415 | 6415 | [ |
| 6416 | 6416 | '_', |
@@ -6497,7 +6497,7 @@ discard block |
||
| 6497 | 6497 | $limit = -1; |
| 6498 | 6498 | } |
| 6499 | 6499 | |
| 6500 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
| 6500 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
| 6501 | 6501 | |
| 6502 | 6502 | if ($array === false) { |
| 6503 | 6503 | return []; |
@@ -6580,9 +6580,9 @@ discard block |
||
| 6580 | 6580 | return ''; |
| 6581 | 6581 | } |
| 6582 | 6582 | |
| 6583 | - return (string) self::substr( |
|
| 6583 | + return (string)self::substr( |
|
| 6584 | 6584 | $str, |
| 6585 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6585 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6586 | 6586 | null, |
| 6587 | 6587 | $encoding |
| 6588 | 6588 | ); |
@@ -6612,9 +6612,9 @@ discard block |
||
| 6612 | 6612 | return ''; |
| 6613 | 6613 | } |
| 6614 | 6614 | |
| 6615 | - return (string) self::substr( |
|
| 6615 | + return (string)self::substr( |
|
| 6616 | 6616 | $str, |
| 6617 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6617 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6618 | 6618 | null, |
| 6619 | 6619 | $encoding |
| 6620 | 6620 | ); |
@@ -6644,7 +6644,7 @@ discard block |
||
| 6644 | 6644 | return ''; |
| 6645 | 6645 | } |
| 6646 | 6646 | |
| 6647 | - return (string) self::substr( |
|
| 6647 | + return (string)self::substr( |
|
| 6648 | 6648 | $str, |
| 6649 | 6649 | 0, |
| 6650 | 6650 | $offset, |
@@ -6676,7 +6676,7 @@ discard block |
||
| 6676 | 6676 | return ''; |
| 6677 | 6677 | } |
| 6678 | 6678 | |
| 6679 | - return (string) self::substr( |
|
| 6679 | + return (string)self::substr( |
|
| 6680 | 6680 | $str, |
| 6681 | 6681 | 0, |
| 6682 | 6682 | $offset, |
@@ -6867,16 +6867,16 @@ discard block |
||
| 6867 | 6867 | } |
| 6868 | 6868 | |
| 6869 | 6869 | // the main substitutions |
| 6870 | - $str = (string) \preg_replace_callback( |
|
| 6870 | + $str = (string)\preg_replace_callback( |
|
| 6871 | 6871 | '~\b (_*) (?: # 1. Leading underscore and |
| 6872 | 6872 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
| 6873 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
| 6873 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
| 6874 | 6874 | | |
| 6875 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
| 6875 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
| 6876 | 6876 | | |
| 6877 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
| 6877 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
| 6878 | 6878 | | |
| 6879 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
| 6879 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
| 6880 | 6880 | ) (_*) \b # 6. With trailing underscore |
| 6881 | 6881 | ~ux', |
| 6882 | 6882 | /** |
@@ -6884,7 +6884,7 @@ discard block |
||
| 6884 | 6884 | * |
| 6885 | 6885 | * @return string |
| 6886 | 6886 | */ |
| 6887 | - static function (array $matches) use ($encoding): string { |
|
| 6887 | + static function(array $matches) use ($encoding): string { |
|
| 6888 | 6888 | // preserve leading underscore |
| 6889 | 6889 | $str = $matches[1]; |
| 6890 | 6890 | if ($matches[2]) { |
@@ -6909,26 +6909,26 @@ discard block |
||
| 6909 | 6909 | ); |
| 6910 | 6910 | |
| 6911 | 6911 | // Exceptions for small words: capitalize at start of title... |
| 6912 | - $str = (string) \preg_replace_callback( |
|
| 6912 | + $str = (string)\preg_replace_callback( |
|
| 6913 | 6913 | '~( \A [[:punct:]]* # start of title... |
| 6914 | 6914 | | [:.;?!][ ]+ # or of subsentence... |
| 6915 | 6915 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
| 6916 | - ( ' . $smallWordsRx . ' ) \b # ...followed by small word |
|
| 6916 | + ( ' . $smallWordsRx.' ) \b # ...followed by small word |
|
| 6917 | 6917 | ~uxi', |
| 6918 | 6918 | /** |
| 6919 | 6919 | * @param string[] $matches |
| 6920 | 6920 | * |
| 6921 | 6921 | * @return string |
| 6922 | 6922 | */ |
| 6923 | - static function (array $matches) use ($encoding): string { |
|
| 6924 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
| 6923 | + static function(array $matches) use ($encoding): string { |
|
| 6924 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
| 6925 | 6925 | }, |
| 6926 | 6926 | $str |
| 6927 | 6927 | ); |
| 6928 | 6928 | |
| 6929 | 6929 | // ...and end of title |
| 6930 | - $str = (string) \preg_replace_callback( |
|
| 6931 | - '~\b ( ' . $smallWordsRx . ' ) # small word... |
|
| 6930 | + $str = (string)\preg_replace_callback( |
|
| 6931 | + '~\b ( '.$smallWordsRx.' ) # small word... |
|
| 6932 | 6932 | (?= [[:punct:]]* \Z # ...at the end of the title... |
| 6933 | 6933 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
| 6934 | 6934 | ~uxi', |
@@ -6937,7 +6937,7 @@ discard block |
||
| 6937 | 6937 | * |
| 6938 | 6938 | * @return string |
| 6939 | 6939 | */ |
| 6940 | - static function (array $matches) use ($encoding): string { |
|
| 6940 | + static function(array $matches) use ($encoding): string { |
|
| 6941 | 6941 | return static::str_upper_first($matches[1], $encoding); |
| 6942 | 6942 | }, |
| 6943 | 6943 | $str |
@@ -6945,10 +6945,10 @@ discard block |
||
| 6945 | 6945 | |
| 6946 | 6946 | // Exceptions for small words in hyphenated compound words. |
| 6947 | 6947 | // e.g. "in-flight" -> In-Flight |
| 6948 | - $str = (string) \preg_replace_callback( |
|
| 6948 | + $str = (string)\preg_replace_callback( |
|
| 6949 | 6949 | '~\b |
| 6950 | 6950 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
| 6951 | - ( ' . $smallWordsRx . ' ) |
|
| 6951 | + ( ' . $smallWordsRx.' ) |
|
| 6952 | 6952 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
| 6953 | 6953 | ~uxi', |
| 6954 | 6954 | /** |
@@ -6956,18 +6956,18 @@ discard block |
||
| 6956 | 6956 | * |
| 6957 | 6957 | * @return string |
| 6958 | 6958 | */ |
| 6959 | - static function (array $matches) use ($encoding): string { |
|
| 6959 | + static function(array $matches) use ($encoding): string { |
|
| 6960 | 6960 | return static::str_upper_first($matches[1], $encoding); |
| 6961 | 6961 | }, |
| 6962 | 6962 | $str |
| 6963 | 6963 | ); |
| 6964 | 6964 | |
| 6965 | 6965 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
| 6966 | - $str = (string) \preg_replace_callback( |
|
| 6966 | + $str = (string)\preg_replace_callback( |
|
| 6967 | 6967 | '~\b |
| 6968 | 6968 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
| 6969 | 6969 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
| 6970 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
| 6970 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
| 6971 | 6971 | (?! - ) # Negative lookahead for another - |
| 6972 | 6972 | ~uxi', |
| 6973 | 6973 | /** |
@@ -6975,8 +6975,8 @@ discard block |
||
| 6975 | 6975 | * |
| 6976 | 6976 | * @return string |
| 6977 | 6977 | */ |
| 6978 | - static function (array $matches) use ($encoding): string { |
|
| 6979 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
| 6978 | + static function(array $matches) use ($encoding): string { |
|
| 6979 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
| 6980 | 6980 | }, |
| 6981 | 6981 | $str |
| 6982 | 6982 | ); |
@@ -7069,7 +7069,7 @@ discard block |
||
| 7069 | 7069 | ); |
| 7070 | 7070 | |
| 7071 | 7071 | foreach ($tmpReturn as &$item) { |
| 7072 | - $item = (string) $item; |
|
| 7072 | + $item = (string)$item; |
|
| 7073 | 7073 | } |
| 7074 | 7074 | |
| 7075 | 7075 | return $tmpReturn; |
@@ -7106,21 +7106,21 @@ discard block |
||
| 7106 | 7106 | public static function str_truncate($str, int $length, string $substring = '', string $encoding = 'UTF-8'): string |
| 7107 | 7107 | { |
| 7108 | 7108 | // init |
| 7109 | - $str = (string) $str; |
|
| 7109 | + $str = (string)$str; |
|
| 7110 | 7110 | |
| 7111 | 7111 | if ($str === '') { |
| 7112 | 7112 | return ''; |
| 7113 | 7113 | } |
| 7114 | 7114 | |
| 7115 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 7115 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 7116 | 7116 | return $str; |
| 7117 | 7117 | } |
| 7118 | 7118 | |
| 7119 | 7119 | // Need to further trim the string so we can append the substring |
| 7120 | - $substringLength = (int) self::strlen($substring, $encoding); |
|
| 7120 | + $substringLength = (int)self::strlen($substring, $encoding); |
|
| 7121 | 7121 | $length -= $substringLength; |
| 7122 | 7122 | |
| 7123 | - return ((string) self::substr($str, 0, $length, $encoding)) . $substring; |
|
| 7123 | + return ((string)self::substr($str, 0, $length, $encoding)).$substring; |
|
| 7124 | 7124 | } |
| 7125 | 7125 | |
| 7126 | 7126 | /** |
@@ -7145,12 +7145,12 @@ discard block |
||
| 7145 | 7145 | bool $ignoreDoNotSplitWordsForOneWord = false |
| 7146 | 7146 | ): string |
| 7147 | 7147 | { |
| 7148 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 7148 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 7149 | 7149 | return $str; |
| 7150 | 7150 | } |
| 7151 | 7151 | |
| 7152 | 7152 | // need to further trim the string so we can append the substring |
| 7153 | - $substringLength = (int) self::strlen($substring, $encoding); |
|
| 7153 | + $substringLength = (int)self::strlen($substring, $encoding); |
|
| 7154 | 7154 | $length -= $substringLength; |
| 7155 | 7155 | |
| 7156 | 7156 | $truncated = self::substr($str, 0, $length, $encoding); |
@@ -7169,11 +7169,11 @@ discard block |
||
| 7169 | 7169 | || |
| 7170 | 7170 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
| 7171 | 7171 | ) { |
| 7172 | - $truncated = (string) self::substr($truncated, 0, (int) $lastPos, $encoding); |
|
| 7172 | + $truncated = (string)self::substr($truncated, 0, (int)$lastPos, $encoding); |
|
| 7173 | 7173 | } |
| 7174 | 7174 | } |
| 7175 | 7175 | |
| 7176 | - return $truncated . $substring; |
|
| 7176 | + return $truncated.$substring; |
|
| 7177 | 7177 | } |
| 7178 | 7178 | |
| 7179 | 7179 | /** |
@@ -7253,13 +7253,13 @@ discard block |
||
| 7253 | 7253 | } |
| 7254 | 7254 | } elseif ($format === 2) { |
| 7255 | 7255 | $numberOfWords = []; |
| 7256 | - $offset = (int) self::strlen($strParts[0]); |
|
| 7256 | + $offset = (int)self::strlen($strParts[0]); |
|
| 7257 | 7257 | for ($i = 1; $i < $len; $i += 2) { |
| 7258 | 7258 | $numberOfWords[$offset] = $strParts[$i]; |
| 7259 | - $offset += (int) self::strlen($strParts[$i]) + (int) self::strlen($strParts[$i + 1]); |
|
| 7259 | + $offset += (int)self::strlen($strParts[$i]) + (int)self::strlen($strParts[$i + 1]); |
|
| 7260 | 7260 | } |
| 7261 | 7261 | } else { |
| 7262 | - $numberOfWords = (int) (($len - 1) / 2); |
|
| 7262 | + $numberOfWords = (int)(($len - 1) / 2); |
|
| 7263 | 7263 | } |
| 7264 | 7264 | |
| 7265 | 7265 | return $numberOfWords; |
@@ -7319,7 +7319,7 @@ discard block |
||
| 7319 | 7319 | public static function strcmp(string $str1, string $str2): int |
| 7320 | 7320 | { |
| 7321 | 7321 | /** @noinspection PhpUndefinedClassInspection */ |
| 7322 | - return $str1 . '' === $str2 . '' ? 0 : \strcmp( |
|
| 7322 | + return $str1.'' === $str2.'' ? 0 : \strcmp( |
|
| 7323 | 7323 | \Normalizer::normalize($str1, \Normalizer::NFD), |
| 7324 | 7324 | \Normalizer::normalize($str2, \Normalizer::NFD) |
| 7325 | 7325 | ); |
@@ -7338,12 +7338,12 @@ discard block |
||
| 7338 | 7338 | public static function strcspn(string $str, string $charList, int $offset = null, int $length = null): int |
| 7339 | 7339 | { |
| 7340 | 7340 | if ($charList === '') { |
| 7341 | - return (int) self::strlen($str); |
|
| 7341 | + return (int)self::strlen($str); |
|
| 7342 | 7342 | } |
| 7343 | 7343 | |
| 7344 | 7344 | if ($offset !== null || $length !== null) { |
| 7345 | 7345 | /** @noinspection UnnecessaryCastingInspection */ |
| 7346 | - $strTmp = self::substr($str, (int) $offset, $length); |
|
| 7346 | + $strTmp = self::substr($str, (int)$offset, $length); |
|
| 7347 | 7347 | if ($strTmp === false) { |
| 7348 | 7348 | return 0; |
| 7349 | 7349 | } |
@@ -7355,7 +7355,7 @@ discard block |
||
| 7355 | 7355 | } |
| 7356 | 7356 | |
| 7357 | 7357 | $matches = []; |
| 7358 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $matches)) { |
|
| 7358 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $matches)) { |
|
| 7359 | 7359 | $return = self::strlen($matches[1]); |
| 7360 | 7360 | if ($return === false) { |
| 7361 | 7361 | return 0; |
@@ -7364,7 +7364,7 @@ discard block |
||
| 7364 | 7364 | return $return; |
| 7365 | 7365 | } |
| 7366 | 7366 | |
| 7367 | - return (int) self::strlen($str); |
|
| 7367 | + return (int)self::strlen($str); |
|
| 7368 | 7368 | } |
| 7369 | 7369 | |
| 7370 | 7370 | /** |
@@ -7460,7 +7460,7 @@ discard block |
||
| 7460 | 7460 | } |
| 7461 | 7461 | |
| 7462 | 7462 | /** @noinspection UnnecessaryCastingInspection */ |
| 7463 | - return \strip_tags($str, (string) $allowable_tags); |
|
| 7463 | + return \strip_tags($str, (string)$allowable_tags); |
|
| 7464 | 7464 | } |
| 7465 | 7465 | |
| 7466 | 7466 | /** |
@@ -7478,7 +7478,7 @@ discard block |
||
| 7478 | 7478 | return ''; |
| 7479 | 7479 | } |
| 7480 | 7480 | |
| 7481 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
| 7481 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
| 7482 | 7482 | } |
| 7483 | 7483 | |
| 7484 | 7484 | /** |
@@ -7599,7 +7599,7 @@ discard block |
||
| 7599 | 7599 | && |
| 7600 | 7600 | self::$SUPPORT['mbstring'] === false |
| 7601 | 7601 | ) { |
| 7602 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 7602 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 7603 | 7603 | } |
| 7604 | 7604 | |
| 7605 | 7605 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -7621,7 +7621,7 @@ discard block |
||
| 7621 | 7621 | return \stristr($haystack, $needle, $before_needle); |
| 7622 | 7622 | } |
| 7623 | 7623 | |
| 7624 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
| 7624 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
| 7625 | 7625 | |
| 7626 | 7626 | if (!isset($match[1])) { |
| 7627 | 7627 | return false; |
@@ -7631,7 +7631,7 @@ discard block |
||
| 7631 | 7631 | return $match[1]; |
| 7632 | 7632 | } |
| 7633 | 7633 | |
| 7634 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
| 7634 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
| 7635 | 7635 | } |
| 7636 | 7636 | |
| 7637 | 7637 | /** |
@@ -7690,7 +7690,7 @@ discard block |
||
| 7690 | 7690 | && |
| 7691 | 7691 | self::$SUPPORT['iconv'] === false |
| 7692 | 7692 | ) { |
| 7693 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 7693 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 7694 | 7694 | } |
| 7695 | 7695 | |
| 7696 | 7696 | // |
@@ -7816,7 +7816,7 @@ discard block |
||
| 7816 | 7816 | */ |
| 7817 | 7817 | public static function strnatcmp(string $str1, string $str2): int |
| 7818 | 7818 | { |
| 7819 | - return $str1 . '' === $str2 . '' ? 0 : \strnatcmp((string) self::strtonatfold($str1), (string) self::strtonatfold($str2)); |
|
| 7819 | + return $str1.'' === $str2.'' ? 0 : \strnatcmp((string)self::strtonatfold($str1), (string)self::strtonatfold($str2)); |
|
| 7820 | 7820 | } |
| 7821 | 7821 | |
| 7822 | 7822 | /** |
@@ -7859,8 +7859,8 @@ discard block |
||
| 7859 | 7859 | */ |
| 7860 | 7860 | public static function strncmp(string $str1, string $str2, int $len): int |
| 7861 | 7861 | { |
| 7862 | - $str1 = (string) self::substr($str1, 0, $len); |
|
| 7863 | - $str2 = (string) self::substr($str2, 0, $len); |
|
| 7862 | + $str1 = (string)self::substr($str1, 0, $len); |
|
| 7863 | + $str2 = (string)self::substr($str2, 0, $len); |
|
| 7864 | 7864 | |
| 7865 | 7865 | return self::strcmp($str1, $str2); |
| 7866 | 7866 | } |
@@ -7881,8 +7881,8 @@ discard block |
||
| 7881 | 7881 | return false; |
| 7882 | 7882 | } |
| 7883 | 7883 | |
| 7884 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
| 7885 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
| 7884 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
| 7885 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
| 7886 | 7886 | } |
| 7887 | 7887 | |
| 7888 | 7888 | return false; |
@@ -7910,10 +7910,10 @@ discard block |
||
| 7910 | 7910 | } |
| 7911 | 7911 | |
| 7912 | 7912 | // iconv and mbstring do not support integer $needle |
| 7913 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 7914 | - $needle = (string) self::chr($needle); |
|
| 7913 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 7914 | + $needle = (string)self::chr($needle); |
|
| 7915 | 7915 | } |
| 7916 | - $needle = (string) $needle; |
|
| 7916 | + $needle = (string)$needle; |
|
| 7917 | 7917 | |
| 7918 | 7918 | if ($needle === '') { |
| 7919 | 7919 | return false; |
@@ -7953,7 +7953,7 @@ discard block |
||
| 7953 | 7953 | && |
| 7954 | 7954 | self::$SUPPORT['mbstring'] === false |
| 7955 | 7955 | ) { |
| 7956 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 7956 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 7957 | 7957 | } |
| 7958 | 7958 | |
| 7959 | 7959 | // |
@@ -8021,7 +8021,7 @@ discard block |
||
| 8021 | 8021 | if ($haystackTmp === false) { |
| 8022 | 8022 | $haystackTmp = ''; |
| 8023 | 8023 | } |
| 8024 | - $haystack = (string) $haystackTmp; |
|
| 8024 | + $haystack = (string)$haystackTmp; |
|
| 8025 | 8025 | |
| 8026 | 8026 | if ($offset < 0) { |
| 8027 | 8027 | $offset = 0; |
@@ -8033,7 +8033,7 @@ discard block |
||
| 8033 | 8033 | } |
| 8034 | 8034 | |
| 8035 | 8035 | if ($pos) { |
| 8036 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 8036 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 8037 | 8037 | } |
| 8038 | 8038 | |
| 8039 | 8039 | return $offset + 0; |
@@ -8119,7 +8119,7 @@ discard block |
||
| 8119 | 8119 | && |
| 8120 | 8120 | self::$SUPPORT['mbstring'] === false |
| 8121 | 8121 | ) { |
| 8122 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 8122 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 8123 | 8123 | } |
| 8124 | 8124 | |
| 8125 | 8125 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -8151,7 +8151,7 @@ discard block |
||
| 8151 | 8151 | if ($needleTmp === false) { |
| 8152 | 8152 | return false; |
| 8153 | 8153 | } |
| 8154 | - $needle = (string) $needleTmp; |
|
| 8154 | + $needle = (string)$needleTmp; |
|
| 8155 | 8155 | |
| 8156 | 8156 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
| 8157 | 8157 | if ($pos === false) { |
@@ -8173,7 +8173,7 @@ discard block |
||
| 8173 | 8173 | if ($needleTmp === false) { |
| 8174 | 8174 | return false; |
| 8175 | 8175 | } |
| 8176 | - $needle = (string) $needleTmp; |
|
| 8176 | + $needle = (string)$needleTmp; |
|
| 8177 | 8177 | |
| 8178 | 8178 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
| 8179 | 8179 | if ($pos === false) { |
@@ -8201,7 +8201,7 @@ discard block |
||
| 8201 | 8201 | } |
| 8202 | 8202 | |
| 8203 | 8203 | $reversed = ''; |
| 8204 | - $i = (int) self::strlen($str); |
|
| 8204 | + $i = (int)self::strlen($str); |
|
| 8205 | 8205 | while ($i--) { |
| 8206 | 8206 | $reversedTmp = self::substr($str, $i, 1); |
| 8207 | 8207 | if ($reversedTmp !== false) { |
@@ -8269,7 +8269,7 @@ discard block |
||
| 8269 | 8269 | if ($needleTmp === false) { |
| 8270 | 8270 | return false; |
| 8271 | 8271 | } |
| 8272 | - $needle = (string) $needleTmp; |
|
| 8272 | + $needle = (string)$needleTmp; |
|
| 8273 | 8273 | |
| 8274 | 8274 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
| 8275 | 8275 | if ($pos === false) { |
@@ -8303,10 +8303,10 @@ discard block |
||
| 8303 | 8303 | } |
| 8304 | 8304 | |
| 8305 | 8305 | // iconv and mbstring do not support integer $needle |
| 8306 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 8307 | - $needle = (string) self::chr($needle); |
|
| 8306 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 8307 | + $needle = (string)self::chr($needle); |
|
| 8308 | 8308 | } |
| 8309 | - $needle = (string) $needle; |
|
| 8309 | + $needle = (string)$needle; |
|
| 8310 | 8310 | |
| 8311 | 8311 | if ($needle === '') { |
| 8312 | 8312 | return false; |
@@ -8343,7 +8343,7 @@ discard block |
||
| 8343 | 8343 | && |
| 8344 | 8344 | self::$SUPPORT['mbstring'] === false |
| 8345 | 8345 | ) { |
| 8346 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 8346 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 8347 | 8347 | } |
| 8348 | 8348 | |
| 8349 | 8349 | // |
@@ -8450,10 +8450,10 @@ discard block |
||
| 8450 | 8450 | } |
| 8451 | 8451 | |
| 8452 | 8452 | // iconv and mbstring do not support integer $needle |
| 8453 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 8454 | - $needle = (string) self::chr($needle); |
|
| 8453 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 8454 | + $needle = (string)self::chr($needle); |
|
| 8455 | 8455 | } |
| 8456 | - $needle = (string) $needle; |
|
| 8456 | + $needle = (string)$needle; |
|
| 8457 | 8457 | |
| 8458 | 8458 | if ($needle === '') { |
| 8459 | 8459 | return false; |
@@ -8490,7 +8490,7 @@ discard block |
||
| 8490 | 8490 | && |
| 8491 | 8491 | self::$SUPPORT['mbstring'] === false |
| 8492 | 8492 | ) { |
| 8493 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 8493 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 8494 | 8494 | } |
| 8495 | 8495 | |
| 8496 | 8496 | // |
@@ -8550,7 +8550,7 @@ discard block |
||
| 8550 | 8550 | if ($haystackTmp === false) { |
| 8551 | 8551 | $haystackTmp = ''; |
| 8552 | 8552 | } |
| 8553 | - $haystack = (string) $haystackTmp; |
|
| 8553 | + $haystack = (string)$haystackTmp; |
|
| 8554 | 8554 | } |
| 8555 | 8555 | |
| 8556 | 8556 | $pos = self::strrpos_in_byte($haystack, $needle); |
@@ -8563,7 +8563,7 @@ discard block |
||
| 8563 | 8563 | return false; |
| 8564 | 8564 | } |
| 8565 | 8565 | |
| 8566 | - return $offset + (int) self::strlen($strTmp); |
|
| 8566 | + return $offset + (int)self::strlen($strTmp); |
|
| 8567 | 8567 | } |
| 8568 | 8568 | |
| 8569 | 8569 | /** |
@@ -8615,7 +8615,7 @@ discard block |
||
| 8615 | 8615 | public static function strspn(string $str, string $mask, int $offset = 0, int $length = null) |
| 8616 | 8616 | { |
| 8617 | 8617 | if ($offset || $length !== null) { |
| 8618 | - $str = (string) self::substr($str, $offset, $length); |
|
| 8618 | + $str = (string)self::substr($str, $offset, $length); |
|
| 8619 | 8619 | } |
| 8620 | 8620 | |
| 8621 | 8621 | if ($str === '' || $mask === '') { |
@@ -8624,7 +8624,7 @@ discard block |
||
| 8624 | 8624 | |
| 8625 | 8625 | $matches = []; |
| 8626 | 8626 | |
| 8627 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0]) : 0; |
|
| 8627 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0]) : 0; |
|
| 8628 | 8628 | } |
| 8629 | 8629 | |
| 8630 | 8630 | /** |
@@ -8680,7 +8680,7 @@ discard block |
||
| 8680 | 8680 | && |
| 8681 | 8681 | self::$SUPPORT['mbstring'] === false |
| 8682 | 8682 | ) { |
| 8683 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 8683 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 8684 | 8684 | } |
| 8685 | 8685 | |
| 8686 | 8686 | // |
@@ -8718,7 +8718,7 @@ discard block |
||
| 8718 | 8718 | // fallback via vanilla php |
| 8719 | 8719 | // |
| 8720 | 8720 | |
| 8721 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
| 8721 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
| 8722 | 8722 | |
| 8723 | 8723 | if (!isset($match[1])) { |
| 8724 | 8724 | return false; |
@@ -8728,7 +8728,7 @@ discard block |
||
| 8728 | 8728 | return $match[1]; |
| 8729 | 8729 | } |
| 8730 | 8730 | |
| 8731 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
| 8731 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
| 8732 | 8732 | } |
| 8733 | 8733 | |
| 8734 | 8734 | /** |
@@ -8827,7 +8827,7 @@ discard block |
||
| 8827 | 8827 | public static function strtolower($str, string $encoding = 'UTF-8', bool $cleanUtf8 = false, string $lang = null, bool $tryToKeepStringLength = false): string |
| 8828 | 8828 | { |
| 8829 | 8829 | // init |
| 8830 | - $str = (string) $str; |
|
| 8830 | + $str = (string)$str; |
|
| 8831 | 8831 | |
| 8832 | 8832 | if ($str === '') { |
| 8833 | 8833 | return ''; |
@@ -8854,9 +8854,9 @@ discard block |
||
| 8854 | 8854 | } |
| 8855 | 8855 | |
| 8856 | 8856 | if (self::$SUPPORT['intl'] === true) { |
| 8857 | - $langCode = $lang . '-Lower'; |
|
| 8857 | + $langCode = $lang.'-Lower'; |
|
| 8858 | 8858 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
| 8859 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, \E_USER_WARNING); |
|
| 8859 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, \E_USER_WARNING); |
|
| 8860 | 8860 | |
| 8861 | 8861 | $langCode = 'Any-Lower'; |
| 8862 | 8862 | } |
@@ -8865,7 +8865,7 @@ discard block |
||
| 8865 | 8865 | return \transliterator_transliterate($langCode, $str); |
| 8866 | 8866 | } |
| 8867 | 8867 | |
| 8868 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
| 8868 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
| 8869 | 8869 | } |
| 8870 | 8870 | |
| 8871 | 8871 | // always fallback via symfony polyfill |
@@ -8889,7 +8889,7 @@ discard block |
||
| 8889 | 8889 | public static function strtoupper($str, string $encoding = 'UTF-8', bool $cleanUtf8 = false, string $lang = null, bool $tryToKeepStringLength = false): string |
| 8890 | 8890 | { |
| 8891 | 8891 | // init |
| 8892 | - $str = (string) $str; |
|
| 8892 | + $str = (string)$str; |
|
| 8893 | 8893 | |
| 8894 | 8894 | if ($str === '') { |
| 8895 | 8895 | return ''; |
@@ -8916,9 +8916,9 @@ discard block |
||
| 8916 | 8916 | } |
| 8917 | 8917 | |
| 8918 | 8918 | if (self::$SUPPORT['intl'] === true) { |
| 8919 | - $langCode = $lang . '-Upper'; |
|
| 8919 | + $langCode = $lang.'-Upper'; |
|
| 8920 | 8920 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
| 8921 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
| 8921 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
| 8922 | 8922 | |
| 8923 | 8923 | $langCode = 'Any-Upper'; |
| 8924 | 8924 | } |
@@ -8927,7 +8927,7 @@ discard block |
||
| 8927 | 8927 | return \transliterator_transliterate($langCode, $str); |
| 8928 | 8928 | } |
| 8929 | 8929 | |
| 8930 | - \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
| 8930 | + \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
| 8931 | 8931 | } |
| 8932 | 8932 | |
| 8933 | 8933 | // always fallback via symfony polyfill |
@@ -8971,7 +8971,7 @@ discard block |
||
| 8971 | 8971 | |
| 8972 | 8972 | $from = \array_combine($from, $to); |
| 8973 | 8973 | if ($from === false) { |
| 8974 | - 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) . ')'); |
|
| 8974 | + 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).')'); |
|
| 8975 | 8975 | } |
| 8976 | 8976 | } |
| 8977 | 8977 | |
@@ -9028,9 +9028,9 @@ discard block |
||
| 9028 | 9028 | } |
| 9029 | 9029 | |
| 9030 | 9030 | $wide = 0; |
| 9031 | - $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); |
|
| 9031 | + $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); |
|
| 9032 | 9032 | |
| 9033 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
| 9033 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
| 9034 | 9034 | } |
| 9035 | 9035 | |
| 9036 | 9036 | /** |
@@ -9126,9 +9126,9 @@ discard block |
||
| 9126 | 9126 | } |
| 9127 | 9127 | |
| 9128 | 9128 | if ($length === null) { |
| 9129 | - $length = (int) $str_length; |
|
| 9129 | + $length = (int)$str_length; |
|
| 9130 | 9130 | } else { |
| 9131 | - $length = (int) $length; |
|
| 9131 | + $length = (int)$length; |
|
| 9132 | 9132 | } |
| 9133 | 9133 | |
| 9134 | 9134 | if ( |
@@ -9136,7 +9136,7 @@ discard block |
||
| 9136 | 9136 | && |
| 9137 | 9137 | self::$SUPPORT['mbstring'] === false |
| 9138 | 9138 | ) { |
| 9139 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9139 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9140 | 9140 | } |
| 9141 | 9141 | |
| 9142 | 9142 | // |
@@ -9215,8 +9215,8 @@ discard block |
||
| 9215 | 9215 | || |
| 9216 | 9216 | $length !== null |
| 9217 | 9217 | ) { |
| 9218 | - $str1 = (string) self::substr($str1, $offset, $length); |
|
| 9219 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1)); |
|
| 9218 | + $str1 = (string)self::substr($str1, $offset, $length); |
|
| 9219 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1)); |
|
| 9220 | 9220 | } |
| 9221 | 9221 | |
| 9222 | 9222 | if ($case_insensitivity === true) { |
@@ -9262,7 +9262,7 @@ discard block |
||
| 9262 | 9262 | if ($lengthTmp === false) { |
| 9263 | 9263 | return false; |
| 9264 | 9264 | } |
| 9265 | - $length = (int) $lengthTmp; |
|
| 9265 | + $length = (int)$lengthTmp; |
|
| 9266 | 9266 | } |
| 9267 | 9267 | |
| 9268 | 9268 | if ( |
@@ -9279,7 +9279,7 @@ discard block |
||
| 9279 | 9279 | return false; |
| 9280 | 9280 | } |
| 9281 | 9281 | |
| 9282 | - $haystack = (string) self::substr($haystack, $offset, $length, $encoding); |
|
| 9282 | + $haystack = (string)self::substr($haystack, $offset, $length, $encoding); |
|
| 9283 | 9283 | } |
| 9284 | 9284 | |
| 9285 | 9285 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
@@ -9302,14 +9302,14 @@ discard block |
||
| 9302 | 9302 | && |
| 9303 | 9303 | self::$SUPPORT['mbstring'] === false |
| 9304 | 9304 | ) { |
| 9305 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9305 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9306 | 9306 | } |
| 9307 | 9307 | |
| 9308 | 9308 | if (self::$SUPPORT['mbstring'] === true) { |
| 9309 | 9309 | return \mb_substr_count($haystack, $needle, $encoding); |
| 9310 | 9310 | } |
| 9311 | 9311 | |
| 9312 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 9312 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 9313 | 9313 | |
| 9314 | 9314 | return \count($matches); |
| 9315 | 9315 | } |
@@ -9356,7 +9356,7 @@ discard block |
||
| 9356 | 9356 | if ($lengthTmp === false) { |
| 9357 | 9357 | return false; |
| 9358 | 9358 | } |
| 9359 | - $length = (int) $lengthTmp; |
|
| 9359 | + $length = (int)$lengthTmp; |
|
| 9360 | 9360 | } |
| 9361 | 9361 | |
| 9362 | 9362 | if ( |
@@ -9377,7 +9377,7 @@ discard block |
||
| 9377 | 9377 | if ($haystackTmp === false) { |
| 9378 | 9378 | $haystackTmp = ''; |
| 9379 | 9379 | } |
| 9380 | - $haystack = (string) $haystackTmp; |
|
| 9380 | + $haystack = (string)$haystackTmp; |
|
| 9381 | 9381 | } |
| 9382 | 9382 | |
| 9383 | 9383 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -9413,7 +9413,7 @@ discard block |
||
| 9413 | 9413 | // only a fallback to prevent BC in the api ... |
| 9414 | 9414 | /** @psalm-suppress RedundantConditionGivenDocblockType */ |
| 9415 | 9415 | if ($caseSensitive !== false && $caseSensitive !== true) { |
| 9416 | - $encoding = (string) $caseSensitive; |
|
| 9416 | + $encoding = (string)$caseSensitive; |
|
| 9417 | 9417 | } |
| 9418 | 9418 | |
| 9419 | 9419 | if (!$caseSensitive) { |
@@ -9421,7 +9421,7 @@ discard block |
||
| 9421 | 9421 | $substring = self::strtocasefold($substring, true, false, $encoding, null, false); |
| 9422 | 9422 | } |
| 9423 | 9423 | |
| 9424 | - return (int) self::substr_count($str, $substring, 0, null, $encoding); |
|
| 9424 | + return (int)self::substr_count($str, $substring, 0, null, $encoding); |
|
| 9425 | 9425 | } |
| 9426 | 9426 | |
| 9427 | 9427 | /** |
@@ -9443,7 +9443,7 @@ discard block |
||
| 9443 | 9443 | } |
| 9444 | 9444 | |
| 9445 | 9445 | if (self::str_istarts_with($haystack, $needle) === true) { |
| 9446 | - $haystack = (string) self::substr($haystack, (int) self::strlen($needle)); |
|
| 9446 | + $haystack = (string)self::substr($haystack, (int)self::strlen($needle)); |
|
| 9447 | 9447 | } |
| 9448 | 9448 | |
| 9449 | 9449 | return $haystack; |
@@ -9508,7 +9508,7 @@ discard block |
||
| 9508 | 9508 | } |
| 9509 | 9509 | |
| 9510 | 9510 | if (self::str_iends_with($haystack, $needle) === true) { |
| 9511 | - $haystack = (string) self::substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
| 9511 | + $haystack = (string)self::substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
| 9512 | 9512 | } |
| 9513 | 9513 | |
| 9514 | 9514 | return $haystack; |
@@ -9533,7 +9533,7 @@ discard block |
||
| 9533 | 9533 | } |
| 9534 | 9534 | |
| 9535 | 9535 | if (self::str_starts_with($haystack, $needle) === true) { |
| 9536 | - $haystack = (string) self::substr($haystack, (int) self::strlen($needle)); |
|
| 9536 | + $haystack = (string)self::substr($haystack, (int)self::strlen($needle)); |
|
| 9537 | 9537 | } |
| 9538 | 9538 | |
| 9539 | 9539 | return $haystack; |
@@ -9580,7 +9580,7 @@ discard block |
||
| 9580 | 9580 | if (\is_array($offset) === true) { |
| 9581 | 9581 | $offset = \array_slice($offset, 0, $num); |
| 9582 | 9582 | foreach ($offset as &$valueTmp) { |
| 9583 | - $valueTmp = (int) $valueTmp === $valueTmp ? $valueTmp : 0; |
|
| 9583 | + $valueTmp = (int)$valueTmp === $valueTmp ? $valueTmp : 0; |
|
| 9584 | 9584 | } |
| 9585 | 9585 | unset($valueTmp); |
| 9586 | 9586 | } else { |
@@ -9594,7 +9594,7 @@ discard block |
||
| 9594 | 9594 | $length = \array_slice($length, 0, $num); |
| 9595 | 9595 | foreach ($length as &$valueTmpV2) { |
| 9596 | 9596 | if ($valueTmpV2 !== null) { |
| 9597 | - $valueTmpV2 = (int) $valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
| 9597 | + $valueTmpV2 = (int)$valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
| 9598 | 9598 | } else { |
| 9599 | 9599 | $valueTmpV2 = 0; |
| 9600 | 9600 | } |
@@ -9617,8 +9617,8 @@ discard block |
||
| 9617 | 9617 | } |
| 9618 | 9618 | |
| 9619 | 9619 | // init |
| 9620 | - $str = (string) $str; |
|
| 9621 | - $replacement = (string) $replacement; |
|
| 9620 | + $str = (string)$str; |
|
| 9621 | + $replacement = (string)$replacement; |
|
| 9622 | 9622 | |
| 9623 | 9623 | if (\is_array($length) === true) { |
| 9624 | 9624 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -9634,8 +9634,7 @@ discard block |
||
| 9634 | 9634 | |
| 9635 | 9635 | if (self::is_ascii($str)) { |
| 9636 | 9636 | return ($length === null) ? |
| 9637 | - \substr_replace($str, $replacement, $offset) : |
|
| 9638 | - \substr_replace($str, $replacement, $offset, $length); |
|
| 9637 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
| 9639 | 9638 | } |
| 9640 | 9639 | |
| 9641 | 9640 | if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) { |
@@ -9643,16 +9642,16 @@ discard block |
||
| 9643 | 9642 | } |
| 9644 | 9643 | |
| 9645 | 9644 | if (self::$SUPPORT['mbstring'] === true) { |
| 9646 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 9645 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 9647 | 9646 | |
| 9648 | 9647 | if ($offset < 0) { |
| 9649 | - $offset = (int) \max(0, $string_length + $offset); |
|
| 9648 | + $offset = (int)\max(0, $string_length + $offset); |
|
| 9650 | 9649 | } elseif ($offset > $string_length) { |
| 9651 | 9650 | $offset = $string_length; |
| 9652 | 9651 | } |
| 9653 | 9652 | |
| 9654 | 9653 | if ($length !== null && $length < 0) { |
| 9655 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
| 9654 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
| 9656 | 9655 | } elseif ($length === null || $length > $string_length) { |
| 9657 | 9656 | $length = $string_length; |
| 9658 | 9657 | } |
@@ -9663,9 +9662,9 @@ discard block |
||
| 9663 | 9662 | } |
| 9664 | 9663 | |
| 9665 | 9664 | /** @noinspection AdditionOperationOnArraysInspection */ |
| 9666 | - return (string) self::substr($str, 0, $offset, $encoding) . |
|
| 9667 | - $replacement . |
|
| 9668 | - (string) self::substr($str, $offset + $length, $string_length - $offset - $length, $encoding); |
|
| 9665 | + return (string)self::substr($str, 0, $offset, $encoding). |
|
| 9666 | + $replacement. |
|
| 9667 | + (string)self::substr($str, $offset + $length, $string_length - $offset - $length, $encoding); |
|
| 9669 | 9668 | } |
| 9670 | 9669 | |
| 9671 | 9670 | \preg_match_all('/./us', $str, $smatches); |
@@ -9677,7 +9676,7 @@ discard block |
||
| 9677 | 9676 | // e.g.: non mbstring support + invalid chars |
| 9678 | 9677 | return ''; |
| 9679 | 9678 | } |
| 9680 | - $length = (int) $lengthTmp; |
|
| 9679 | + $length = (int)$lengthTmp; |
|
| 9681 | 9680 | } |
| 9682 | 9681 | |
| 9683 | 9682 | \array_splice($smatches[0], $offset, $length, $rmatches[0]); |
@@ -9704,7 +9703,7 @@ discard block |
||
| 9704 | 9703 | } |
| 9705 | 9704 | |
| 9706 | 9705 | if (self::str_ends_with($haystack, $needle) === true) { |
| 9707 | - $haystack = (string) self::substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
| 9706 | + $haystack = (string)self::substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
| 9708 | 9707 | } |
| 9709 | 9708 | |
| 9710 | 9709 | return $haystack; |
@@ -9735,7 +9734,7 @@ discard block |
||
| 9735 | 9734 | $str = self::clean($str); |
| 9736 | 9735 | } |
| 9737 | 9736 | |
| 9738 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 9737 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 9739 | 9738 | } |
| 9740 | 9739 | |
| 9741 | 9740 | /** |
@@ -10030,7 +10029,7 @@ discard block |
||
| 10030 | 10029 | public static function to_boolean($str): bool |
| 10031 | 10030 | { |
| 10032 | 10031 | // init |
| 10033 | - $str = (string) $str; |
|
| 10032 | + $str = (string)$str; |
|
| 10034 | 10033 | |
| 10035 | 10034 | if ($str === '') { |
| 10036 | 10035 | return false; |
@@ -10056,10 +10055,10 @@ discard block |
||
| 10056 | 10055 | |
| 10057 | 10056 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
| 10058 | 10057 | if (\is_numeric($str)) { |
| 10059 | - return ((float) $str + 0) > 0; |
|
| 10058 | + return ((float)$str + 0) > 0; |
|
| 10060 | 10059 | } |
| 10061 | 10060 | |
| 10062 | - return (bool) self::trim($str); |
|
| 10061 | + return (bool)self::trim($str); |
|
| 10063 | 10062 | } |
| 10064 | 10063 | |
| 10065 | 10064 | /** |
@@ -10080,11 +10079,11 @@ discard block |
||
| 10080 | 10079 | |
| 10081 | 10080 | $fallback_char_escaped = \preg_quote($fallback_char, '/'); |
| 10082 | 10081 | |
| 10083 | - $string = (string) \preg_replace( |
|
| 10082 | + $string = (string)\preg_replace( |
|
| 10084 | 10083 | [ |
| 10085 | - '/[^' . $fallback_char_escaped . '\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
| 10086 | - '/[\s]+/', // 2) convert spaces to $fallback_char |
|
| 10087 | - '/[' . $fallback_char_escaped . ']+/', // 3) remove double $fallback_char's |
|
| 10084 | + '/[^'.$fallback_char_escaped.'\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
| 10085 | + '/[\s]+/', // 2) convert spaces to $fallback_char |
|
| 10086 | + '/['.$fallback_char_escaped.']+/', // 3) remove double $fallback_char's |
|
| 10088 | 10087 | ], |
| 10089 | 10088 | [ |
| 10090 | 10089 | '', |
@@ -10115,7 +10114,7 @@ discard block |
||
| 10115 | 10114 | return $str; |
| 10116 | 10115 | } |
| 10117 | 10116 | |
| 10118 | - $str = (string) $str; |
|
| 10117 | + $str = (string)$str; |
|
| 10119 | 10118 | if ($str === '') { |
| 10120 | 10119 | return ''; |
| 10121 | 10120 | } |
@@ -10162,7 +10161,7 @@ discard block |
||
| 10162 | 10161 | return $str; |
| 10163 | 10162 | } |
| 10164 | 10163 | |
| 10165 | - $str = (string) $str; |
|
| 10164 | + $str = (string)$str; |
|
| 10166 | 10165 | if ($str === '') { |
| 10167 | 10166 | return $str; |
| 10168 | 10167 | } |
@@ -10184,7 +10183,7 @@ discard block |
||
| 10184 | 10183 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
| 10185 | 10184 | |
| 10186 | 10185 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 10187 | - $buf .= $c1 . $c2; |
|
| 10186 | + $buf .= $c1.$c2; |
|
| 10188 | 10187 | ++$i; |
| 10189 | 10188 | } else { // not valid UTF8 - convert it |
| 10190 | 10189 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -10195,7 +10194,7 @@ discard block |
||
| 10195 | 10194 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
| 10196 | 10195 | |
| 10197 | 10196 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 10198 | - $buf .= $c1 . $c2 . $c3; |
|
| 10197 | + $buf .= $c1.$c2.$c3; |
|
| 10199 | 10198 | $i += 2; |
| 10200 | 10199 | } else { // not valid UTF8 - convert it |
| 10201 | 10200 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -10207,7 +10206,7 @@ discard block |
||
| 10207 | 10206 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
| 10208 | 10207 | |
| 10209 | 10208 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 10210 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
| 10209 | + $buf .= $c1.$c2.$c3.$c4; |
|
| 10211 | 10210 | $i += 3; |
| 10212 | 10211 | } else { // not valid UTF8 - convert it |
| 10213 | 10212 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -10231,7 +10230,7 @@ discard block |
||
| 10231 | 10230 | * |
| 10232 | 10231 | * @return string |
| 10233 | 10232 | */ |
| 10234 | - static function (array $match): string { |
|
| 10233 | + static function(array $match): string { |
|
| 10235 | 10234 | // always fallback via symfony polyfill |
| 10236 | 10235 | return \mb_convert_encoding(\pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); |
| 10237 | 10236 | }, |
@@ -10299,17 +10298,17 @@ discard block |
||
| 10299 | 10298 | $str = self::clean($str); |
| 10300 | 10299 | } |
| 10301 | 10300 | |
| 10302 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
| 10301 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
| 10303 | 10302 | |
| 10304 | 10303 | $strPartOne = self::strtoupper( |
| 10305 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 10304 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 10306 | 10305 | $encoding, |
| 10307 | 10306 | $cleanUtf8, |
| 10308 | 10307 | $lang, |
| 10309 | 10308 | $tryToKeepStringLength |
| 10310 | 10309 | ); |
| 10311 | 10310 | |
| 10312 | - return $strPartOne . $strPartTwo; |
|
| 10311 | + return $strPartOne.$strPartTwo; |
|
| 10313 | 10312 | } |
| 10314 | 10313 | |
| 10315 | 10314 | /** |
@@ -10355,7 +10354,7 @@ discard block |
||
| 10355 | 10354 | $str = self::clean($str); |
| 10356 | 10355 | } |
| 10357 | 10356 | |
| 10358 | - $usePhpDefaultFunctions = !(bool) ($charlist . \implode('', $exceptions)); |
|
| 10357 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
| 10359 | 10358 | |
| 10360 | 10359 | if ( |
| 10361 | 10360 | $usePhpDefaultFunctions === true |
@@ -10412,7 +10411,7 @@ discard block |
||
| 10412 | 10411 | |
| 10413 | 10412 | $pattern = '/%u([0-9a-f]{3,4})/i'; |
| 10414 | 10413 | if (\preg_match($pattern, $str)) { |
| 10415 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
| 10414 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
| 10416 | 10415 | } |
| 10417 | 10416 | |
| 10418 | 10417 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -10756,7 +10755,7 @@ discard block |
||
| 10756 | 10755 | if ( |
| 10757 | 10756 | $keepUtf8Chars === true |
| 10758 | 10757 | && |
| 10759 | - self::strlen($return) >= (int) self::strlen($str_backup) |
|
| 10758 | + self::strlen($return) >= (int)self::strlen($str_backup) |
|
| 10760 | 10759 | ) { |
| 10761 | 10760 | return $str_backup; |
| 10762 | 10761 | } |
@@ -10854,17 +10853,17 @@ discard block |
||
| 10854 | 10853 | return ''; |
| 10855 | 10854 | } |
| 10856 | 10855 | |
| 10857 | - \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches); |
|
| 10856 | + \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches); |
|
| 10858 | 10857 | |
| 10859 | 10858 | if ( |
| 10860 | 10859 | !isset($matches[0]) |
| 10861 | 10860 | || |
| 10862 | - self::strlen($str) === (int) self::strlen($matches[0]) |
|
| 10861 | + self::strlen($str) === (int)self::strlen($matches[0]) |
|
| 10863 | 10862 | ) { |
| 10864 | 10863 | return $str; |
| 10865 | 10864 | } |
| 10866 | 10865 | |
| 10867 | - return self::rtrim($matches[0]) . $strAddOn; |
|
| 10866 | + return self::rtrim($matches[0]).$strAddOn; |
|
| 10868 | 10867 | } |
| 10869 | 10868 | |
| 10870 | 10869 | /** |
@@ -10930,7 +10929,7 @@ discard block |
||
| 10930 | 10929 | $strReturn .= $break; |
| 10931 | 10930 | } |
| 10932 | 10931 | |
| 10933 | - return $strReturn . \implode('', $chars); |
|
| 10932 | + return $strReturn.\implode('', $chars); |
|
| 10934 | 10933 | } |
| 10935 | 10934 | |
| 10936 | 10935 | /** |
@@ -10943,7 +10942,7 @@ discard block |
||
| 10943 | 10942 | */ |
| 10944 | 10943 | public static function wordwrap_per_line(string $str, int $limit): string |
| 10945 | 10944 | { |
| 10946 | - $strings = (array) \preg_split('/\\r\\n|\\r|\\n/', $str); |
|
| 10945 | + $strings = (array)\preg_split('/\\r\\n|\\r|\\n/', $str); |
|
| 10947 | 10946 | |
| 10948 | 10947 | $string = ''; |
| 10949 | 10948 | foreach ($strings as &$value) { |
@@ -10982,7 +10981,7 @@ discard block |
||
| 10982 | 10981 | */ |
| 10983 | 10982 | private static function apply_padding(string $str, int $left = 0, int $right = 0, string $padStr = ' ', string $encoding = 'UTF-8'): string |
| 10984 | 10983 | { |
| 10985 | - $strlen = (int) self::strlen($str, $encoding); |
|
| 10984 | + $strlen = (int)self::strlen($str, $encoding); |
|
| 10986 | 10985 | |
| 10987 | 10986 | if ($left && $right) { |
| 10988 | 10987 | $length = ($left + $right) + $strlen; |
@@ -11014,13 +11013,13 @@ discard block |
||
| 11014 | 11013 | $lower = self::$COMMON_CASE_FOLD['lower']; |
| 11015 | 11014 | |
| 11016 | 11015 | if ($useLower === true) { |
| 11017 | - $str = (string) \str_replace( |
|
| 11016 | + $str = (string)\str_replace( |
|
| 11018 | 11017 | $upper, |
| 11019 | 11018 | $lower, |
| 11020 | 11019 | $str |
| 11021 | 11020 | ); |
| 11022 | 11021 | } else { |
| 11023 | - $str = (string) \str_replace( |
|
| 11022 | + $str = (string)\str_replace( |
|
| 11024 | 11023 | $lower, |
| 11025 | 11024 | $upper, |
| 11026 | 11025 | $str |
@@ -11034,9 +11033,9 @@ discard block |
||
| 11034 | 11033 | } |
| 11035 | 11034 | |
| 11036 | 11035 | if ($useLower === true) { |
| 11037 | - $str = (string) \str_replace($FULL_CASE_FOLD[0], $FULL_CASE_FOLD[1], $str); |
|
| 11036 | + $str = (string)\str_replace($FULL_CASE_FOLD[0], $FULL_CASE_FOLD[1], $str); |
|
| 11038 | 11037 | } else { |
| 11039 | - $str = (string) \str_replace($FULL_CASE_FOLD[1], $FULL_CASE_FOLD[0], $str); |
|
| 11038 | + $str = (string)\str_replace($FULL_CASE_FOLD[1], $FULL_CASE_FOLD[0], $str); |
|
| 11040 | 11039 | } |
| 11041 | 11040 | } |
| 11042 | 11041 | |
@@ -11054,7 +11053,7 @@ discard block |
||
| 11054 | 11053 | { |
| 11055 | 11054 | /** @noinspection PhpIncludeInspection */ |
| 11056 | 11055 | /** @psalm-suppress UnresolvableInclude */ |
| 11057 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
| 11056 | + return include __DIR__.'/data/'.$file.'.php'; |
|
| 11058 | 11057 | } |
| 11059 | 11058 | |
| 11060 | 11059 | /** |
@@ -11066,7 +11065,7 @@ discard block |
||
| 11066 | 11065 | */ |
| 11067 | 11066 | private static function getDataIfExists(string $file) |
| 11068 | 11067 | { |
| 11069 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
| 11068 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
| 11070 | 11069 | if (\file_exists($file)) { |
| 11071 | 11070 | /** @noinspection PhpIncludeInspection */ |
| 11072 | 11071 | return include $file; |
@@ -11090,7 +11089,7 @@ discard block |
||
| 11090 | 11089 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 11091 | 11090 | return \defined('MB_OVERLOAD_STRING') |
| 11092 | 11091 | && |
| 11093 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 11092 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 11094 | 11093 | } |
| 11095 | 11094 | |
| 11096 | 11095 | /** |
@@ -11140,7 +11139,7 @@ discard block |
||
| 11140 | 11139 | { |
| 11141 | 11140 | static $RX_CLASSS_CACHE = []; |
| 11142 | 11141 | |
| 11143 | - $cacheKey = $s . $class; |
|
| 11142 | + $cacheKey = $s.$class; |
|
| 11144 | 11143 | |
| 11145 | 11144 | if (isset($RX_CLASSS_CACHE[$cacheKey])) { |
| 11146 | 11145 | return $RX_CLASSS_CACHE[$cacheKey]; |
@@ -11151,7 +11150,7 @@ discard block |
||
| 11151 | 11150 | /** @noinspection SuspiciousLoopInspection */ |
| 11152 | 11151 | foreach (self::str_split($s) as &$s) { |
| 11153 | 11152 | if ($s === '-') { |
| 11154 | - $class[0] = '-' . $class[0]; |
|
| 11153 | + $class[0] = '-'.$class[0]; |
|
| 11155 | 11154 | } elseif (!isset($s[2])) { |
| 11156 | 11155 | $class[0] .= \preg_quote($s, '/'); |
| 11157 | 11156 | } elseif (self::strlen($s) === 1) { |
@@ -11163,13 +11162,13 @@ discard block |
||
| 11163 | 11162 | unset($s); |
| 11164 | 11163 | |
| 11165 | 11164 | if ($class[0]) { |
| 11166 | - $class[0] = '[' . $class[0] . ']'; |
|
| 11165 | + $class[0] = '['.$class[0].']'; |
|
| 11167 | 11166 | } |
| 11168 | 11167 | |
| 11169 | 11168 | if (\count($class) === 1) { |
| 11170 | 11169 | $return = $class[0]; |
| 11171 | 11170 | } else { |
| 11172 | - $return = '(?:' . \implode('|', $class) . ')'; |
|
| 11171 | + $return = '(?:'.\implode('|', $class).')'; |
|
| 11173 | 11172 | } |
| 11174 | 11173 | |
| 11175 | 11174 | $RX_CLASSS_CACHE[$cacheKey] = $return; |
@@ -11308,8 +11307,8 @@ discard block |
||
| 11308 | 11307 | $buf .= self::$WIN1252_TO_UTF8[$ordC1]; |
| 11309 | 11308 | } else { |
| 11310 | 11309 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
| 11311 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
| 11312 | - $buf .= $cc1 . $cc2; |
|
| 11310 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
| 11311 | + $buf .= $cc1.$cc2; |
|
| 11313 | 11312 | } |
| 11314 | 11313 | |
| 11315 | 11314 | return $buf; |