@@ -573,16 +573,16 @@ discard block |
||
573 | 573 | $chr = self::$CHR[$code_point]; |
574 | 574 | } elseif ($code_point <= 0x7FF) { |
575 | 575 | $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
576 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
576 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
577 | 577 | } elseif ($code_point <= 0xFFFF) { |
578 | 578 | $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
579 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
580 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
579 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
580 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
581 | 581 | } else { |
582 | 582 | $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
583 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
584 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
585 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
583 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
584 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
585 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
586 | 586 | } |
587 | 587 | |
588 | 588 | if ($encoding !== 'UTF-8') { |
@@ -3189,10 +3189,10 @@ discard block |
||
3189 | 3189 | |
3190 | 3190 | /** @noinspection PhpComposerExtensionStubsInspection */ |
3191 | 3191 | return ( |
3192 | - \is_object($json) === true |
|
3192 | + \is_object($json) === true |
|
3193 | 3193 | || |
3194 | 3194 | \is_array($json) === true |
3195 | - ) |
|
3195 | + ) |
|
3196 | 3196 | && |
3197 | 3197 | \json_last_error() === \JSON_ERROR_NONE; |
3198 | 3198 | } |
@@ -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; |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | */ |
394 | 394 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
395 | 395 | { |
396 | - return (string) self::substr($str, $index, 1, $encoding); |
|
396 | + return (string)self::substr($str, $index, 1, $encoding); |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | /** |
@@ -489,10 +489,10 @@ discard block |
||
489 | 489 | && |
490 | 490 | self::$SUPPORT['mbstring'] === false |
491 | 491 | ) { |
492 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
492 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
493 | 493 | } |
494 | 494 | |
495 | - $cacheKey = $code_point . $encoding; |
|
495 | + $cacheKey = $code_point.$encoding; |
|
496 | 496 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
497 | 497 | return $CHAR_CACHE[$cacheKey]; |
498 | 498 | } |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | if (self::$CHR === null) { |
503 | 503 | $chrTmp = self::getData('chr'); |
504 | 504 | if ($chrTmp) { |
505 | - self::$CHR = (array) $chrTmp; |
|
505 | + self::$CHR = (array)$chrTmp; |
|
506 | 506 | } |
507 | 507 | } |
508 | 508 | |
@@ -529,24 +529,24 @@ discard block |
||
529 | 529 | if (self::$CHR === null) { |
530 | 530 | $chrTmp = self::getData('chr'); |
531 | 531 | if ($chrTmp) { |
532 | - self::$CHR = (array) $chrTmp; |
|
532 | + self::$CHR = (array)$chrTmp; |
|
533 | 533 | } |
534 | 534 | } |
535 | 535 | |
536 | - $code_point = (int) $code_point; |
|
536 | + $code_point = (int)$code_point; |
|
537 | 537 | if ($code_point <= 0x7F) { |
538 | 538 | $chr = self::$CHR[$code_point]; |
539 | 539 | } elseif ($code_point <= 0x7FF) { |
540 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
540 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
541 | 541 | self::$CHR[($code_point & 0x3F) + 0x80]; |
542 | 542 | } elseif ($code_point <= 0xFFFF) { |
543 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
544 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
543 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
544 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
545 | 545 | self::$CHR[($code_point & 0x3F) + 0x80]; |
546 | 546 | } else { |
547 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
548 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
549 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
547 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
548 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
549 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
550 | 550 | self::$CHR[($code_point & 0x3F) + 0x80]; |
551 | 551 | } |
552 | 552 | |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | |
599 | 599 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
600 | 600 | return \array_map( |
601 | - static function ($data) { |
|
601 | + static function($data) { |
|
602 | 602 | return self::strlen_in_byte($data); |
603 | 603 | }, |
604 | 604 | $strSplit |
@@ -739,7 +739,7 @@ discard block |
||
739 | 739 | | ( [\x80-\xBF] ) # invalid byte in range 10000000 - 10111111 |
740 | 740 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
741 | 741 | /x'; |
742 | - $str = (string) \preg_replace($regx, '$1', $str); |
|
742 | + $str = (string)\preg_replace($regx, '$1', $str); |
|
743 | 743 | |
744 | 744 | if ($replace_diamond_question_mark === true) { |
745 | 745 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | public static function cleanup($str): string |
775 | 775 | { |
776 | 776 | // init |
777 | - $str = (string) $str; |
|
777 | + $str = (string)$str; |
|
778 | 778 | |
779 | 779 | if ($str === '') { |
780 | 780 | return ''; |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | */ |
884 | 884 | public static function css_stripe_media_queries(string $str): string |
885 | 885 | { |
886 | - return (string) \preg_replace( |
|
886 | + return (string)\preg_replace( |
|
887 | 887 | '#@media\\s+(?:only\\s)?(?:[\\s{\\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#misU', |
888 | 888 | '', |
889 | 889 | $str |
@@ -910,7 +910,7 @@ discard block |
||
910 | 910 | */ |
911 | 911 | public static function decimal_to_chr($int): string |
912 | 912 | { |
913 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
913 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
914 | 914 | } |
915 | 915 | |
916 | 916 | /** |
@@ -1066,7 +1066,7 @@ discard block |
||
1066 | 1066 | && |
1067 | 1067 | self::$SUPPORT['mbstring'] === false |
1068 | 1068 | ) { |
1069 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $toEncoding . '" encoding', \E_USER_WARNING); |
|
1069 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$toEncoding.'" encoding', \E_USER_WARNING); |
|
1070 | 1070 | } |
1071 | 1071 | |
1072 | 1072 | if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) { |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | $trimChars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1156 | 1156 | |
1157 | 1157 | if ($length === null) { |
1158 | - $length = (int) \round(self::strlen($str, $encoding) / 2, 0); |
|
1158 | + $length = (int)\round(self::strlen($str, $encoding) / 2, 0); |
|
1159 | 1159 | } |
1160 | 1160 | |
1161 | 1161 | if (empty($search)) { |
@@ -1167,7 +1167,7 @@ discard block |
||
1167 | 1167 | $end = 0; |
1168 | 1168 | } |
1169 | 1169 | |
1170 | - $pos = (int) \min( |
|
1170 | + $pos = (int)\min( |
|
1171 | 1171 | self::strpos($str, ' ', $end, $encoding), |
1172 | 1172 | self::strpos($str, '.', $end, $encoding) |
1173 | 1173 | ); |
@@ -1178,20 +1178,20 @@ discard block |
||
1178 | 1178 | return ''; |
1179 | 1179 | } |
1180 | 1180 | |
1181 | - return \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1181 | + return \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1182 | 1182 | } |
1183 | 1183 | |
1184 | 1184 | return $str; |
1185 | 1185 | } |
1186 | 1186 | |
1187 | 1187 | $wordPos = self::stripos($str, $search, 0, $encoding); |
1188 | - $halfSide = (int) ($wordPos - $length / 2 + self::strlen($search, $encoding) / 2); |
|
1188 | + $halfSide = (int)($wordPos - $length / 2 + self::strlen($search, $encoding) / 2); |
|
1189 | 1189 | |
1190 | 1190 | $pos_start = 0; |
1191 | 1191 | if ($halfSide > 0) { |
1192 | 1192 | $halfText = self::substr($str, 0, $halfSide, $encoding); |
1193 | 1193 | if ($halfText !== false) { |
1194 | - $pos_start = (int) \max( |
|
1194 | + $pos_start = (int)\max( |
|
1195 | 1195 | self::strrpos($halfText, ' ', 0, $encoding), |
1196 | 1196 | self::strrpos($halfText, '.', 0, $encoding) |
1197 | 1197 | ); |
@@ -1206,7 +1206,7 @@ discard block |
||
1206 | 1206 | $l = $realLength; |
1207 | 1207 | } |
1208 | 1208 | |
1209 | - $pos_end = (int) \min( |
|
1209 | + $pos_end = (int)\min( |
|
1210 | 1210 | self::strpos($str, ' ', $l, $encoding), |
1211 | 1211 | self::strpos($str, '.', $l, $encoding) |
1212 | 1212 | ) - $pos_start; |
@@ -1214,14 +1214,14 @@ discard block |
||
1214 | 1214 | if (!$pos_end || $pos_end <= 0) { |
1215 | 1215 | $strSub = self::substr($str, $pos_start, self::strlen($str), $encoding); |
1216 | 1216 | if ($strSub !== false) { |
1217 | - $extract = $replacerForSkippedText . \ltrim($strSub, $trimChars); |
|
1217 | + $extract = $replacerForSkippedText.\ltrim($strSub, $trimChars); |
|
1218 | 1218 | } else { |
1219 | 1219 | $extract = ''; |
1220 | 1220 | } |
1221 | 1221 | } else { |
1222 | 1222 | $strSub = self::substr($str, $pos_start, $pos_end, $encoding); |
1223 | 1223 | if ($strSub !== false) { |
1224 | - $extract = $replacerForSkippedText . \trim($strSub, $trimChars) . $replacerForSkippedText; |
|
1224 | + $extract = $replacerForSkippedText.\trim($strSub, $trimChars).$replacerForSkippedText; |
|
1225 | 1225 | } else { |
1226 | 1226 | $extract = ''; |
1227 | 1227 | } |
@@ -1242,7 +1242,7 @@ discard block |
||
1242 | 1242 | if ($pos_end) { |
1243 | 1243 | $strSub = self::substr($str, 0, $pos_end, $encoding); |
1244 | 1244 | if ($strSub !== false) { |
1245 | - $extract = \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1245 | + $extract = \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1246 | 1246 | } else { |
1247 | 1247 | $extract = ''; |
1248 | 1248 | } |
@@ -1362,7 +1362,7 @@ discard block |
||
1362 | 1362 | { |
1363 | 1363 | $file_content = \file_get_contents($file_path); |
1364 | 1364 | if ($file_content === false) { |
1365 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1365 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1366 | 1366 | } |
1367 | 1367 | |
1368 | 1368 | return self::string_has_bom($file_content); |
@@ -1424,7 +1424,7 @@ discard block |
||
1424 | 1424 | ) { |
1425 | 1425 | // Prevent leading combining chars |
1426 | 1426 | // for NFC-safe concatenations. |
1427 | - $var = $leading_combining . $var; |
|
1427 | + $var = $leading_combining.$var; |
|
1428 | 1428 | } |
1429 | 1429 | } |
1430 | 1430 | |
@@ -1732,7 +1732,7 @@ discard block |
||
1732 | 1732 | return $str; |
1733 | 1733 | } |
1734 | 1734 | |
1735 | - $str = (string) $str; |
|
1735 | + $str = (string)$str; |
|
1736 | 1736 | $last = ''; |
1737 | 1737 | while ($last !== $str) { |
1738 | 1738 | $last = $str; |
@@ -1917,7 +1917,7 @@ discard block |
||
1917 | 1917 | } |
1918 | 1918 | |
1919 | 1919 | $str_info = \unpack('C2chars', $str_info); |
1920 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
1920 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
1921 | 1921 | |
1922 | 1922 | // DEBUG |
1923 | 1923 | //var_dump($type_code); |
@@ -2030,16 +2030,16 @@ discard block |
||
2030 | 2030 | */ |
2031 | 2031 | public static function get_unique_string($entropyExtra = '', bool $md5 = true): string |
2032 | 2032 | { |
2033 | - $uniqueHelper = \random_int(0, \mt_getrandmax()) . |
|
2034 | - \session_id() . |
|
2035 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2036 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2033 | + $uniqueHelper = \random_int(0, \mt_getrandmax()). |
|
2034 | + \session_id(). |
|
2035 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2036 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2037 | 2037 | $entropyExtra; |
2038 | 2038 | |
2039 | 2039 | $uniqueString = \uniqid($uniqueHelper, true); |
2040 | 2040 | |
2041 | 2041 | if ($md5) { |
2042 | - $uniqueString = \md5($uniqueString . $uniqueHelper); |
|
2042 | + $uniqueString = \md5($uniqueString.$uniqueHelper); |
|
2043 | 2043 | } |
2044 | 2044 | |
2045 | 2045 | return $uniqueString; |
@@ -2109,7 +2109,7 @@ discard block |
||
2109 | 2109 | public static function hex_to_int($hexDec) |
2110 | 2110 | { |
2111 | 2111 | // init |
2112 | - $hexDec = (string) $hexDec; |
|
2112 | + $hexDec = (string)$hexDec; |
|
2113 | 2113 | |
2114 | 2114 | if ($hexDec === '') { |
2115 | 2115 | return false; |
@@ -2184,7 +2184,7 @@ discard block |
||
2184 | 2184 | return \implode( |
2185 | 2185 | '', |
2186 | 2186 | \array_map( |
2187 | - static function ($chr) use ($keepAsciiChars, $encoding) { |
|
2187 | + static function($chr) use ($keepAsciiChars, $encoding) { |
|
2188 | 2188 | return self::single_chr_html_encode($chr, $keepAsciiChars, $encoding); |
2189 | 2189 | }, |
2190 | 2190 | self::split($str) |
@@ -2300,7 +2300,7 @@ discard block |
||
2300 | 2300 | && |
2301 | 2301 | self::$SUPPORT['mbstring'] === false |
2302 | 2302 | ) { |
2303 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2303 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2304 | 2304 | } |
2305 | 2305 | |
2306 | 2306 | if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) { |
@@ -2318,9 +2318,9 @@ discard block |
||
2318 | 2318 | $encoding |
2319 | 2319 | ); |
2320 | 2320 | } else { |
2321 | - $str = (string) \preg_replace_callback( |
|
2321 | + $str = (string)\preg_replace_callback( |
|
2322 | 2322 | "/&#\d{2,6};/", |
2323 | - static function ($matches) use ($encoding) { |
|
2323 | + static function($matches) use ($encoding) { |
|
2324 | 2324 | // always fallback via symfony polyfill |
2325 | 2325 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
2326 | 2326 | |
@@ -2373,7 +2373,7 @@ discard block |
||
2373 | 2373 | */ |
2374 | 2374 | public static function html_stripe_empty_tags(string $str): string |
2375 | 2375 | { |
2376 | - return (string) \preg_replace( |
|
2376 | + return (string)\preg_replace( |
|
2377 | 2377 | "/<[^\/>]*>(([\s]?)*|)<\/[^>]*>/iu", |
2378 | 2378 | '', |
2379 | 2379 | $str |
@@ -2662,9 +2662,9 @@ discard block |
||
2662 | 2662 | { |
2663 | 2663 | $hex = \dechex($int); |
2664 | 2664 | |
2665 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
2665 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
2666 | 2666 | |
2667 | - return $pfix . $hex . ''; |
|
2667 | + return $pfix.$hex.''; |
|
2668 | 2668 | } |
2669 | 2669 | |
2670 | 2670 | /** |
@@ -2902,7 +2902,7 @@ discard block |
||
2902 | 2902 | return false; |
2903 | 2903 | } |
2904 | 2904 | |
2905 | - $base64String = (string) \base64_decode($str, true); |
|
2905 | + $base64String = (string)\base64_decode($str, true); |
|
2906 | 2906 | |
2907 | 2907 | return $base64String && \base64_encode($base64String) === $str; |
2908 | 2908 | } |
@@ -2917,7 +2917,7 @@ discard block |
||
2917 | 2917 | */ |
2918 | 2918 | public static function is_binary($input, bool $strict = false): bool |
2919 | 2919 | { |
2920 | - $input = (string) $input; |
|
2920 | + $input = (string)$input; |
|
2921 | 2921 | if ($input === '') { |
2922 | 2922 | return false; |
2923 | 2923 | } |
@@ -3162,7 +3162,7 @@ discard block |
||
3162 | 3162 | public static function is_utf16($str, $checkIfStringIsBinary = true) |
3163 | 3163 | { |
3164 | 3164 | // init |
3165 | - $str = (string) $str; |
|
3165 | + $str = (string)$str; |
|
3166 | 3166 | $strChars = []; |
3167 | 3167 | |
3168 | 3168 | if ( |
@@ -3238,7 +3238,7 @@ discard block |
||
3238 | 3238 | public static function is_utf32($str, $checkIfStringIsBinary = true) |
3239 | 3239 | { |
3240 | 3240 | // init |
3241 | - $str = (string) $str; |
|
3241 | + $str = (string)$str; |
|
3242 | 3242 | $strChars = []; |
3243 | 3243 | |
3244 | 3244 | if ( |
@@ -3360,7 +3360,7 @@ discard block |
||
3360 | 3360 | self::$ORD = self::getData('ord'); |
3361 | 3361 | } |
3362 | 3362 | |
3363 | - $len = self::strlen_in_byte((string) $str); |
|
3363 | + $len = self::strlen_in_byte((string)$str); |
|
3364 | 3364 | /** @noinspection ForeachInvariantsInspection */ |
3365 | 3365 | for ($i = 0; $i < $len; ++$i) { |
3366 | 3366 | $in = self::$ORD[$str[$i]]; |
@@ -3595,14 +3595,14 @@ discard block |
||
3595 | 3595 | } |
3596 | 3596 | |
3597 | 3597 | $strPartOne = self::strtolower( |
3598 | - (string) self::substr($str, 0, 1, $encoding, $cleanUtf8), |
|
3598 | + (string)self::substr($str, 0, 1, $encoding, $cleanUtf8), |
|
3599 | 3599 | $encoding, |
3600 | 3600 | $cleanUtf8, |
3601 | 3601 | $lang, |
3602 | 3602 | $tryToKeepStringLength |
3603 | 3603 | ); |
3604 | 3604 | |
3605 | - return $strPartOne . $strPartTwo; |
|
3605 | + return $strPartOne.$strPartTwo; |
|
3606 | 3606 | } |
3607 | 3607 | |
3608 | 3608 | /** |
@@ -3766,7 +3766,7 @@ discard block |
||
3766 | 3766 | { |
3767 | 3767 | $bytes = self::chr_size_list($str); |
3768 | 3768 | if (\count($bytes) > 0) { |
3769 | - return (int) \max($bytes); |
|
3769 | + return (int)\max($bytes); |
|
3770 | 3770 | } |
3771 | 3771 | |
3772 | 3772 | return 0; |
@@ -3841,7 +3841,7 @@ discard block |
||
3841 | 3841 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
3842 | 3842 | |
3843 | 3843 | // init |
3844 | - $encoding = (string) $encoding; |
|
3844 | + $encoding = (string)$encoding; |
|
3845 | 3845 | |
3846 | 3846 | if ( |
3847 | 3847 | !$encoding |
@@ -3979,7 +3979,7 @@ discard block |
||
3979 | 3979 | */ |
3980 | 3980 | public static function normalize_line_ending(string $str): string |
3981 | 3981 | { |
3982 | - return (string) \str_replace(["\r\n", "\r"], "\n", $str); |
|
3982 | + return (string)\str_replace(["\r\n", "\r"], "\n", $str); |
|
3983 | 3983 | } |
3984 | 3984 | |
3985 | 3985 | /** |
@@ -4027,7 +4027,7 @@ discard block |
||
4027 | 4027 | } |
4028 | 4028 | |
4029 | 4029 | static $WHITESPACE_CACHE = []; |
4030 | - $cacheKey = (int) $keepNonBreakingSpace; |
|
4030 | + $cacheKey = (int)$keepNonBreakingSpace; |
|
4031 | 4031 | |
4032 | 4032 | if (!isset($WHITESPACE_CACHE[$cacheKey])) { |
4033 | 4033 | $WHITESPACE_CACHE[$cacheKey] = self::$WHITESPACE_TABLE; |
@@ -4067,7 +4067,7 @@ discard block |
||
4067 | 4067 | public static function ord($chr, string $encoding = 'UTF-8'): int |
4068 | 4068 | { |
4069 | 4069 | // init |
4070 | - $chr = (string) $chr; |
|
4070 | + $chr = (string)$chr; |
|
4071 | 4071 | |
4072 | 4072 | static $CHAR_CACHE = []; |
4073 | 4073 | |
@@ -4078,7 +4078,7 @@ discard block |
||
4078 | 4078 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4079 | 4079 | } |
4080 | 4080 | |
4081 | - $cacheKey = $chr_orig . $encoding; |
|
4081 | + $cacheKey = $chr_orig.$encoding; |
|
4082 | 4082 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
4083 | 4083 | return $CHAR_CACHE[$cacheKey]; |
4084 | 4084 | } |
@@ -4109,22 +4109,22 @@ discard block |
||
4109 | 4109 | } |
4110 | 4110 | |
4111 | 4111 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
4112 | - $chr = \unpack('C*', (string) self::substr($chr, 0, 4, 'CP850')); |
|
4112 | + $chr = \unpack('C*', (string)self::substr($chr, 0, 4, 'CP850')); |
|
4113 | 4113 | $code = $chr ? $chr[1] : 0; |
4114 | 4114 | |
4115 | 4115 | if ($code >= 0xF0 && isset($chr[4])) { |
4116 | 4116 | /** @noinspection UnnecessaryCastingInspection */ |
4117 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4117 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4118 | 4118 | } |
4119 | 4119 | |
4120 | 4120 | if ($code >= 0xE0 && isset($chr[3])) { |
4121 | 4121 | /** @noinspection UnnecessaryCastingInspection */ |
4122 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4122 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4123 | 4123 | } |
4124 | 4124 | |
4125 | 4125 | if ($code >= 0xC0 && isset($chr[2])) { |
4126 | 4126 | /** @noinspection UnnecessaryCastingInspection */ |
4127 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4127 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4128 | 4128 | } |
4129 | 4129 | |
4130 | 4130 | return $CHAR_CACHE[$cacheKey] = $code; |
@@ -4177,7 +4177,7 @@ discard block |
||
4177 | 4177 | public static function pcre_utf8_support(): bool |
4178 | 4178 | { |
4179 | 4179 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4180 | - return (bool) @\preg_match('//u', ''); |
|
4180 | + return (bool)@\preg_match('//u', ''); |
|
4181 | 4181 | } |
4182 | 4182 | |
4183 | 4183 | /** |
@@ -4203,10 +4203,10 @@ discard block |
||
4203 | 4203 | } |
4204 | 4204 | |
4205 | 4205 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4206 | - if (\ctype_digit((string) $var1)) { |
|
4207 | - $start = (int) $var1; |
|
4206 | + if (\ctype_digit((string)$var1)) { |
|
4207 | + $start = (int)$var1; |
|
4208 | 4208 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var1)) { |
4209 | - $start = (int) self::hex_to_int($var1); |
|
4209 | + $start = (int)self::hex_to_int($var1); |
|
4210 | 4210 | } else { |
4211 | 4211 | $start = self::ord($var1); |
4212 | 4212 | } |
@@ -4216,10 +4216,10 @@ discard block |
||
4216 | 4216 | } |
4217 | 4217 | |
4218 | 4218 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4219 | - if (\ctype_digit((string) $var2)) { |
|
4220 | - $end = (int) $var2; |
|
4219 | + if (\ctype_digit((string)$var2)) { |
|
4220 | + $end = (int)$var2; |
|
4221 | 4221 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var2)) { |
4222 | - $end = (int) self::hex_to_int($var2); |
|
4222 | + $end = (int)self::hex_to_int($var2); |
|
4223 | 4223 | } else { |
4224 | 4224 | $end = self::ord($var2); |
4225 | 4225 | } |
@@ -4264,7 +4264,7 @@ discard block |
||
4264 | 4264 | |
4265 | 4265 | $pattern = '/%u([0-9a-f]{3,4})/i'; |
4266 | 4266 | if (\preg_match($pattern, $str)) { |
4267 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
4267 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
4268 | 4268 | } |
4269 | 4269 | |
4270 | 4270 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -4307,8 +4307,8 @@ discard block |
||
4307 | 4307 | $delimiter = '/'; |
4308 | 4308 | } |
4309 | 4309 | |
4310 | - return (string) \preg_replace( |
|
4311 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4310 | + return (string)\preg_replace( |
|
4311 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4312 | 4312 | $replacement, |
4313 | 4313 | $str |
4314 | 4314 | ); |
@@ -4353,7 +4353,7 @@ discard block |
||
4353 | 4353 | |
4354 | 4354 | $strLength -= $bomByteLength; |
4355 | 4355 | |
4356 | - $str = (string) $strTmp; |
|
4356 | + $str = (string)$strTmp; |
|
4357 | 4357 | } |
4358 | 4358 | } |
4359 | 4359 | |
@@ -4377,7 +4377,7 @@ discard block |
||
4377 | 4377 | if (\is_array($what) === true) { |
4378 | 4378 | /** @noinspection ForeachSourceInspection */ |
4379 | 4379 | foreach ($what as $item) { |
4380 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/', $item, $str); |
|
4380 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/', $item, $str); |
|
4381 | 4381 | } |
4382 | 4382 | } |
4383 | 4383 | |
@@ -4409,7 +4409,7 @@ discard block |
||
4409 | 4409 | */ |
4410 | 4410 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
4411 | 4411 | { |
4412 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4412 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4413 | 4413 | } |
4414 | 4414 | |
4415 | 4415 | /** |
@@ -4440,7 +4440,7 @@ discard block |
||
4440 | 4440 | $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
4441 | 4441 | |
4442 | 4442 | do { |
4443 | - $str = (string) \preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4443 | + $str = (string)\preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4444 | 4444 | } while ($count !== 0); |
4445 | 4445 | |
4446 | 4446 | return $str; |
@@ -4458,7 +4458,7 @@ discard block |
||
4458 | 4458 | public static function remove_left(string $str, string $substring, string $encoding = 'UTF-8'): string |
4459 | 4459 | { |
4460 | 4460 | if (self::str_starts_with($str, $substring)) { |
4461 | - return (string) self::substr( |
|
4461 | + return (string)self::substr( |
|
4462 | 4462 | $str, |
4463 | 4463 | self::strlen($substring, $encoding), |
4464 | 4464 | null, |
@@ -4481,7 +4481,7 @@ discard block |
||
4481 | 4481 | public static function remove_right(string $str, string $substring, string $encoding = 'UTF-8'): string |
4482 | 4482 | { |
4483 | 4483 | if (self::str_ends_with($str, $substring)) { |
4484 | - return (string) self::substr( |
|
4484 | + return (string)self::substr( |
|
4485 | 4485 | $str, |
4486 | 4486 | 0, |
4487 | 4487 | self::strlen($str, $encoding) - self::strlen($substring, $encoding) |
@@ -4618,7 +4618,7 @@ discard block |
||
4618 | 4618 | |
4619 | 4619 | echo '<pre>'; |
4620 | 4620 | foreach (self::$SUPPORT as $key => $value) { |
4621 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
4621 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
4622 | 4622 | } |
4623 | 4623 | echo '</pre>'; |
4624 | 4624 | } |
@@ -4650,7 +4650,7 @@ discard block |
||
4650 | 4650 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4651 | 4651 | } |
4652 | 4652 | |
4653 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
4653 | + return '&#'.self::ord($char, $encoding).';'; |
|
4654 | 4654 | } |
4655 | 4655 | |
4656 | 4656 | /** |
@@ -4688,7 +4688,7 @@ discard block |
||
4688 | 4688 | } |
4689 | 4689 | |
4690 | 4690 | // init |
4691 | - $str = (string) $str; |
|
4691 | + $str = (string)$str; |
|
4692 | 4692 | |
4693 | 4693 | if ($str === '') { |
4694 | 4694 | return []; |
@@ -4731,7 +4731,7 @@ discard block |
||
4731 | 4731 | ($str[$i] & "\xE0") === "\xC0" |
4732 | 4732 | ) { |
4733 | 4733 | if (($str[$i + 1] & "\xC0") === "\x80") { |
4734 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
4734 | + $ret[] = $str[$i].$str[$i + 1]; |
|
4735 | 4735 | |
4736 | 4736 | ++$i; |
4737 | 4737 | } |
@@ -4745,7 +4745,7 @@ discard block |
||
4745 | 4745 | && |
4746 | 4746 | ($str[$i + 2] & "\xC0") === "\x80" |
4747 | 4747 | ) { |
4748 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
4748 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
4749 | 4749 | |
4750 | 4750 | $i += 2; |
4751 | 4751 | } |
@@ -4761,7 +4761,7 @@ discard block |
||
4761 | 4761 | && |
4762 | 4762 | ($str[$i + 3] & "\xC0") === "\x80" |
4763 | 4763 | ) { |
4764 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
4764 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
4765 | 4765 | |
4766 | 4766 | $i += 3; |
4767 | 4767 | } |
@@ -4773,7 +4773,7 @@ discard block |
||
4773 | 4773 | $ret = \array_chunk($ret, $length); |
4774 | 4774 | |
4775 | 4775 | return \array_map( |
4776 | - static function ($item) { |
|
4776 | + static function($item) { |
|
4777 | 4777 | return \implode('', $item); |
4778 | 4778 | }, |
4779 | 4779 | $ret |
@@ -4803,11 +4803,11 @@ discard block |
||
4803 | 4803 | public static function str_camelize(string $str, string $encoding = 'UTF-8', bool $cleanUtf8 = false, string $lang = null, bool $tryToKeepStringLength = false): string |
4804 | 4804 | { |
4805 | 4805 | $str = self::lcfirst(self::trim($str), $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
4806 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
4806 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
4807 | 4807 | |
4808 | - $str = (string) \preg_replace_callback( |
|
4808 | + $str = (string)\preg_replace_callback( |
|
4809 | 4809 | '/[-_\s]+(.)?/u', |
4810 | - static function ($match) use ($encoding, $cleanUtf8, $lang, $tryToKeepStringLength) { |
|
4810 | + static function($match) use ($encoding, $cleanUtf8, $lang, $tryToKeepStringLength) { |
|
4811 | 4811 | if (isset($match[1])) { |
4812 | 4812 | return self::strtoupper($match[1], $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
4813 | 4813 | } |
@@ -4817,9 +4817,9 @@ discard block |
||
4817 | 4817 | $str |
4818 | 4818 | ); |
4819 | 4819 | |
4820 | - return (string) \preg_replace_callback( |
|
4820 | + return (string)\preg_replace_callback( |
|
4821 | 4821 | '/[\d]+(.)?/u', |
4822 | - static function ($match) use ($encoding, $cleanUtf8, $lang, $tryToKeepStringLength) { |
|
4822 | + static function($match) use ($encoding, $cleanUtf8, $lang, $tryToKeepStringLength) { |
|
4823 | 4823 | return self::strtoupper($match[0], $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
4824 | 4824 | }, |
4825 | 4825 | $str |
@@ -4863,7 +4863,7 @@ discard block |
||
4863 | 4863 | |
4864 | 4864 | // only a fallback to prevent BC in the api ... |
4865 | 4865 | if ($caseSensitive !== false && $caseSensitive !== true) { |
4866 | - $encoding = (string) $caseSensitive; |
|
4866 | + $encoding = (string)$caseSensitive; |
|
4867 | 4867 | } |
4868 | 4868 | |
4869 | 4869 | if ($caseSensitive) { |
@@ -4897,7 +4897,7 @@ discard block |
||
4897 | 4897 | |
4898 | 4898 | // only a fallback to prevent BC in the api ... |
4899 | 4899 | if ($caseSensitive !== false && $caseSensitive !== true) { |
4900 | - $encoding = (string) $caseSensitive; |
|
4900 | + $encoding = (string)$caseSensitive; |
|
4901 | 4901 | } |
4902 | 4902 | |
4903 | 4903 | foreach ($needles as $needle) { |
@@ -4979,11 +4979,11 @@ discard block |
||
4979 | 4979 | ): string { |
4980 | 4980 | $str = self::trim($str); |
4981 | 4981 | |
4982 | - $str = (string) \preg_replace('/\B([A-Z])/u', '-\1', $str); |
|
4982 | + $str = (string)\preg_replace('/\B([A-Z])/u', '-\1', $str); |
|
4983 | 4983 | |
4984 | 4984 | $str = self::strtolower($str, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
4985 | 4985 | |
4986 | - return (string) \preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
4986 | + return (string)\preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
4987 | 4987 | } |
4988 | 4988 | |
4989 | 4989 | /** |
@@ -4998,7 +4998,7 @@ discard block |
||
4998 | 4998 | public static function str_detect_encoding($str) |
4999 | 4999 | { |
5000 | 5000 | // init |
5001 | - $str = (string) $str; |
|
5001 | + $str = (string)$str; |
|
5002 | 5002 | |
5003 | 5003 | // |
5004 | 5004 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5104,7 +5104,7 @@ discard block |
||
5104 | 5104 | foreach (self::$ENCODINGS as $encodingTmp) { |
5105 | 5105 | // INFO: //IGNORE but still throw notice |
5106 | 5106 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5107 | - if ((string) @\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str) === $str) { |
|
5107 | + if ((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str) === $str) { |
|
5108 | 5108 | return $encodingTmp; |
5109 | 5109 | } |
5110 | 5110 | } |
@@ -5166,7 +5166,7 @@ discard block |
||
5166 | 5166 | public static function str_ensure_left(string $str, string $substring): string |
5167 | 5167 | { |
5168 | 5168 | if (!self::str_starts_with($str, $substring)) { |
5169 | - $str = $substring . $str; |
|
5169 | + $str = $substring.$str; |
|
5170 | 5170 | } |
5171 | 5171 | |
5172 | 5172 | return $str; |
@@ -5371,7 +5371,7 @@ discard block |
||
5371 | 5371 | $start = self::substr($str, 0, $index, $encoding); |
5372 | 5372 | $end = self::substr($str, $index, $len, $encoding); |
5373 | 5373 | |
5374 | - return $start . $substring . $end; |
|
5374 | + return $start.$substring.$end; |
|
5375 | 5375 | } |
5376 | 5376 | |
5377 | 5377 | /** |
@@ -5401,15 +5401,15 @@ discard block |
||
5401 | 5401 | */ |
5402 | 5402 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5403 | 5403 | { |
5404 | - $search = (array) $search; |
|
5404 | + $search = (array)$search; |
|
5405 | 5405 | |
5406 | 5406 | /** @noinspection AlterInForeachInspection */ |
5407 | 5407 | foreach ($search as &$s) { |
5408 | - $s = (string) $s; |
|
5408 | + $s = (string)$s; |
|
5409 | 5409 | if ($s === '') { |
5410 | 5410 | $s = '/^(?<=.)$/'; |
5411 | 5411 | } else { |
5412 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5412 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5413 | 5413 | } |
5414 | 5414 | } |
5415 | 5415 | |
@@ -5441,11 +5441,11 @@ discard block |
||
5441 | 5441 | } |
5442 | 5442 | |
5443 | 5443 | if ($search === '') { |
5444 | - return $str . $replacement; |
|
5444 | + return $str.$replacement; |
|
5445 | 5445 | } |
5446 | 5446 | |
5447 | 5447 | if (\stripos($str, $search) === 0) { |
5448 | - return $replacement . \substr($str, \strlen($search)); |
|
5448 | + return $replacement.\substr($str, \strlen($search)); |
|
5449 | 5449 | } |
5450 | 5450 | |
5451 | 5451 | return $str; |
@@ -5473,11 +5473,11 @@ discard block |
||
5473 | 5473 | } |
5474 | 5474 | |
5475 | 5475 | if ($search === '') { |
5476 | - return $str . $replacement; |
|
5476 | + return $str.$replacement; |
|
5477 | 5477 | } |
5478 | 5478 | |
5479 | 5479 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
5480 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
5480 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
5481 | 5481 | } |
5482 | 5482 | |
5483 | 5483 | return $str; |
@@ -5553,7 +5553,7 @@ discard block |
||
5553 | 5553 | return ''; |
5554 | 5554 | } |
5555 | 5555 | |
5556 | - return (string) self::substr( |
|
5556 | + return (string)self::substr( |
|
5557 | 5557 | $str, |
5558 | 5558 | $offset + self::strlen($separator, $encoding), |
5559 | 5559 | null, |
@@ -5585,7 +5585,7 @@ discard block |
||
5585 | 5585 | return ''; |
5586 | 5586 | } |
5587 | 5587 | |
5588 | - return (string) self::substr( |
|
5588 | + return (string)self::substr( |
|
5589 | 5589 | $str, |
5590 | 5590 | $offset + self::strlen($separator, $encoding), |
5591 | 5591 | null, |
@@ -5617,7 +5617,7 @@ discard block |
||
5617 | 5617 | return ''; |
5618 | 5618 | } |
5619 | 5619 | |
5620 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
5620 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
5621 | 5621 | } |
5622 | 5622 | |
5623 | 5623 | /** |
@@ -5644,7 +5644,7 @@ discard block |
||
5644 | 5644 | return ''; |
5645 | 5645 | } |
5646 | 5646 | |
5647 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
5647 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
5648 | 5648 | } |
5649 | 5649 | |
5650 | 5650 | /** |
@@ -5752,7 +5752,7 @@ discard block |
||
5752 | 5752 | return $str; |
5753 | 5753 | } |
5754 | 5754 | |
5755 | - return self::substr($str, 0, $length - self::strlen($strAddOn), $encoding) . $strAddOn; |
|
5755 | + return self::substr($str, 0, $length - self::strlen($strAddOn), $encoding).$strAddOn; |
|
5756 | 5756 | } |
5757 | 5757 | |
5758 | 5758 | /** |
@@ -5780,18 +5780,18 @@ discard block |
||
5780 | 5780 | } |
5781 | 5781 | |
5782 | 5782 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
5783 | - return self::substr($str, 0, $length - 1, $encoding) . $strAddOn; |
|
5783 | + return self::substr($str, 0, $length - 1, $encoding).$strAddOn; |
|
5784 | 5784 | } |
5785 | 5785 | |
5786 | - $str = (string) self::substr($str, 0, $length, $encoding); |
|
5786 | + $str = (string)self::substr($str, 0, $length, $encoding); |
|
5787 | 5787 | $array = \explode(' ', $str); |
5788 | 5788 | \array_pop($array); |
5789 | 5789 | $new_str = \implode(' ', $array); |
5790 | 5790 | |
5791 | 5791 | if ($new_str === '') { |
5792 | - $str = self::substr($str, 0, $length - 1, $encoding) . $strAddOn; |
|
5792 | + $str = self::substr($str, 0, $length - 1, $encoding).$strAddOn; |
|
5793 | 5793 | } else { |
5794 | - $str = $new_str . $strAddOn; |
|
5794 | + $str = $new_str.$strAddOn; |
|
5795 | 5795 | } |
5796 | 5796 | |
5797 | 5797 | return $str; |
@@ -5894,7 +5894,7 @@ discard block |
||
5894 | 5894 | $char = self::substr($str, -$i, 1, $encoding); |
5895 | 5895 | |
5896 | 5896 | if ($char === self::substr($otherStr, -$i, 1, $encoding)) { |
5897 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
5897 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
5898 | 5898 | } else { |
5899 | 5899 | break; |
5900 | 5900 | } |
@@ -5913,7 +5913,7 @@ discard block |
||
5913 | 5913 | */ |
5914 | 5914 | public static function str_matches_pattern(string $str, string $pattern): bool |
5915 | 5915 | { |
5916 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
5916 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
5917 | 5917 | } |
5918 | 5918 | |
5919 | 5919 | /** |
@@ -5989,7 +5989,7 @@ discard block |
||
5989 | 5989 | return ''; |
5990 | 5990 | } |
5991 | 5991 | |
5992 | - if ($pad_type !== (int) $pad_type) { |
|
5992 | + if ($pad_type !== (int)$pad_type) { |
|
5993 | 5993 | if ($pad_type === 'left') { |
5994 | 5994 | $pad_type = \STR_PAD_LEFT; |
5995 | 5995 | } elseif ($pad_type === 'right') { |
@@ -5998,7 +5998,7 @@ discard block |
||
5998 | 5998 | $pad_type = \STR_PAD_BOTH; |
5999 | 5999 | } else { |
6000 | 6000 | throw new \InvalidArgumentException( |
6001 | - 'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6001 | + 'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6002 | 6002 | ); |
6003 | 6003 | } |
6004 | 6004 | } |
@@ -6016,28 +6016,28 @@ discard block |
||
6016 | 6016 | |
6017 | 6017 | switch ($pad_type) { |
6018 | 6018 | case \STR_PAD_LEFT: |
6019 | - $pre = \str_repeat($pad_string, (int) \ceil($diff / $ps_length)); |
|
6020 | - $pre = (string) self::substr($pre, 0, $diff, $encoding); |
|
6019 | + $pre = \str_repeat($pad_string, (int)\ceil($diff / $ps_length)); |
|
6020 | + $pre = (string)self::substr($pre, 0, $diff, $encoding); |
|
6021 | 6021 | $post = ''; |
6022 | 6022 | |
6023 | 6023 | break; |
6024 | 6024 | |
6025 | 6025 | case \STR_PAD_BOTH: |
6026 | - $pre = \str_repeat($pad_string, (int) \ceil($diff / $ps_length / 2)); |
|
6027 | - $pre = (string) self::substr($pre, 0, (int) \floor($diff / 2), $encoding); |
|
6028 | - $post = \str_repeat($pad_string, (int) \ceil($diff / $ps_length / 2)); |
|
6029 | - $post = (string) self::substr($post, 0, (int) \ceil($diff / 2), $encoding); |
|
6026 | + $pre = \str_repeat($pad_string, (int)\ceil($diff / $ps_length / 2)); |
|
6027 | + $pre = (string)self::substr($pre, 0, (int)\floor($diff / 2), $encoding); |
|
6028 | + $post = \str_repeat($pad_string, (int)\ceil($diff / $ps_length / 2)); |
|
6029 | + $post = (string)self::substr($post, 0, (int)\ceil($diff / 2), $encoding); |
|
6030 | 6030 | |
6031 | 6031 | break; |
6032 | 6032 | |
6033 | 6033 | case \STR_PAD_RIGHT: |
6034 | 6034 | default: |
6035 | - $post = \str_repeat($pad_string, (int) \ceil($diff / $ps_length)); |
|
6036 | - $post = (string) self::substr($post, 0, $diff, $encoding); |
|
6035 | + $post = \str_repeat($pad_string, (int)\ceil($diff / $ps_length)); |
|
6036 | + $post = (string)self::substr($post, 0, $diff, $encoding); |
|
6037 | 6037 | $pre = ''; |
6038 | 6038 | } |
6039 | 6039 | |
6040 | - return $pre . $str . $post; |
|
6040 | + return $pre.$str.$post; |
|
6041 | 6041 | } |
6042 | 6042 | |
6043 | 6043 | return $str; |
@@ -6058,7 +6058,7 @@ discard block |
||
6058 | 6058 | { |
6059 | 6059 | $padding = $length - self::strlen($str, $encoding); |
6060 | 6060 | |
6061 | - return self::apply_padding($str, (int) \floor($padding / 2), (int) \ceil($padding / 2), $padStr, $encoding); |
|
6061 | + return self::apply_padding($str, (int)\floor($padding / 2), (int)\ceil($padding / 2), $padStr, $encoding); |
|
6062 | 6062 | } |
6063 | 6063 | |
6064 | 6064 | /** |
@@ -6174,11 +6174,11 @@ discard block |
||
6174 | 6174 | } |
6175 | 6175 | |
6176 | 6176 | if ($search === '') { |
6177 | - return $str . $replacement; |
|
6177 | + return $str.$replacement; |
|
6178 | 6178 | } |
6179 | 6179 | |
6180 | 6180 | if (\strpos($str, $search) === 0) { |
6181 | - return $replacement . \substr($str, \strlen($search)); |
|
6181 | + return $replacement.\substr($str, \strlen($search)); |
|
6182 | 6182 | } |
6183 | 6183 | |
6184 | 6184 | return $str; |
@@ -6206,11 +6206,11 @@ discard block |
||
6206 | 6206 | } |
6207 | 6207 | |
6208 | 6208 | if ($search === '') { |
6209 | - return $str . $replacement; |
|
6209 | + return $str.$replacement; |
|
6210 | 6210 | } |
6211 | 6211 | |
6212 | 6212 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6213 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6213 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6214 | 6214 | } |
6215 | 6215 | |
6216 | 6216 | return $str; |
@@ -6320,26 +6320,26 @@ discard block |
||
6320 | 6320 | $str = self::normalize_whitespace($str); |
6321 | 6321 | $str = \str_replace('-', '_', $str); |
6322 | 6322 | |
6323 | - $str = (string) \preg_replace_callback( |
|
6323 | + $str = (string)\preg_replace_callback( |
|
6324 | 6324 | '/([\d|A-Z])/u', |
6325 | - static function ($matches) use ($encoding) { |
|
6325 | + static function($matches) use ($encoding) { |
|
6326 | 6326 | $match = $matches[1]; |
6327 | - $matchInt = (int) $match; |
|
6327 | + $matchInt = (int)$match; |
|
6328 | 6328 | |
6329 | - if ((string) $matchInt === $match) { |
|
6330 | - return '_' . $match . '_'; |
|
6329 | + if ((string)$matchInt === $match) { |
|
6330 | + return '_'.$match.'_'; |
|
6331 | 6331 | } |
6332 | 6332 | |
6333 | - return '_' . self::strtolower($match, $encoding); |
|
6333 | + return '_'.self::strtolower($match, $encoding); |
|
6334 | 6334 | }, |
6335 | 6335 | $str |
6336 | 6336 | ); |
6337 | 6337 | |
6338 | - $str = (string) \preg_replace( |
|
6338 | + $str = (string)\preg_replace( |
|
6339 | 6339 | [ |
6340 | - '/\s+/', // convert spaces to "_" |
|
6341 | - '/^\s+|\s+$/', // trim leading & trailing spaces |
|
6342 | - '/_+/', // remove double "_" |
|
6340 | + '/\s+/', // convert spaces to "_" |
|
6341 | + '/^\s+|\s+$/', // trim leading & trailing spaces |
|
6342 | + '/_+/', // remove double "_" |
|
6343 | 6343 | ], |
6344 | 6344 | [ |
6345 | 6345 | '_', |
@@ -6426,7 +6426,7 @@ discard block |
||
6426 | 6426 | $limit = -1; |
6427 | 6427 | } |
6428 | 6428 | |
6429 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
6429 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
6430 | 6430 | |
6431 | 6431 | if ($array === false) { |
6432 | 6432 | return []; |
@@ -6509,7 +6509,7 @@ discard block |
||
6509 | 6509 | return ''; |
6510 | 6510 | } |
6511 | 6511 | |
6512 | - return (string) self::substr( |
|
6512 | + return (string)self::substr( |
|
6513 | 6513 | $str, |
6514 | 6514 | $offset + self::strlen($separator, $encoding), |
6515 | 6515 | null, |
@@ -6541,7 +6541,7 @@ discard block |
||
6541 | 6541 | return ''; |
6542 | 6542 | } |
6543 | 6543 | |
6544 | - return (string) self::substr( |
|
6544 | + return (string)self::substr( |
|
6545 | 6545 | $str, |
6546 | 6546 | $offset + self::strlen($separator, $encoding), |
6547 | 6547 | null, |
@@ -6573,7 +6573,7 @@ discard block |
||
6573 | 6573 | return ''; |
6574 | 6574 | } |
6575 | 6575 | |
6576 | - return (string) self::substr( |
|
6576 | + return (string)self::substr( |
|
6577 | 6577 | $str, |
6578 | 6578 | 0, |
6579 | 6579 | $offset, |
@@ -6605,7 +6605,7 @@ discard block |
||
6605 | 6605 | return ''; |
6606 | 6606 | } |
6607 | 6607 | |
6608 | - return (string) self::substr( |
|
6608 | + return (string)self::substr( |
|
6609 | 6609 | $str, |
6610 | 6610 | 0, |
6611 | 6611 | $offset, |
@@ -6796,19 +6796,19 @@ discard block |
||
6796 | 6796 | } |
6797 | 6797 | |
6798 | 6798 | // The main substitutions |
6799 | - $str = (string) \preg_replace_callback( |
|
6799 | + $str = (string)\preg_replace_callback( |
|
6800 | 6800 | '~\b (_*) (?: # 1. Leading underscore and |
6801 | 6801 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
6802 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
6802 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
6803 | 6803 | | |
6804 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
6804 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
6805 | 6805 | | |
6806 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
6806 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
6807 | 6807 | | |
6808 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
6808 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
6809 | 6809 | ) (_*) \b # 6. With trailing underscore |
6810 | 6810 | ~ux', |
6811 | - static function ($matches) use ($encoding) { |
|
6811 | + static function($matches) use ($encoding) { |
|
6812 | 6812 | // Preserve leading underscore |
6813 | 6813 | $str = $matches[1]; |
6814 | 6814 | if ($matches[2]) { |
@@ -6833,25 +6833,25 @@ discard block |
||
6833 | 6833 | ); |
6834 | 6834 | |
6835 | 6835 | // Exceptions for small words: capitalize at start of title... |
6836 | - $str = (string) \preg_replace_callback( |
|
6836 | + $str = (string)\preg_replace_callback( |
|
6837 | 6837 | '~( \A [[:punct:]]* # start of title... |
6838 | 6838 | | [:.;?!][ ]+ # or of subsentence... |
6839 | 6839 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
6840 | - ( ' . $smallWordsRx . ' ) \b # ...followed by small word |
|
6840 | + ( ' . $smallWordsRx.' ) \b # ...followed by small word |
|
6841 | 6841 | ~uxi', |
6842 | - static function ($matches) use ($encoding) { |
|
6843 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
6842 | + static function($matches) use ($encoding) { |
|
6843 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
6844 | 6844 | }, |
6845 | 6845 | $str |
6846 | 6846 | ); |
6847 | 6847 | |
6848 | 6848 | // ...and end of title |
6849 | - $str = (string) \preg_replace_callback( |
|
6850 | - '~\b ( ' . $smallWordsRx . ' ) # small word... |
|
6849 | + $str = (string)\preg_replace_callback( |
|
6850 | + '~\b ( '.$smallWordsRx.' ) # small word... |
|
6851 | 6851 | (?= [[:punct:]]* \Z # ...at the end of the title... |
6852 | 6852 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
6853 | 6853 | ~uxi', |
6854 | - static function ($matches) use ($encoding) { |
|
6854 | + static function($matches) use ($encoding) { |
|
6855 | 6855 | return static::str_upper_first($matches[1], $encoding); |
6856 | 6856 | }, |
6857 | 6857 | $str |
@@ -6859,28 +6859,28 @@ discard block |
||
6859 | 6859 | |
6860 | 6860 | // Exceptions for small words in hyphenated compound words |
6861 | 6861 | // e.g. "in-flight" -> In-Flight |
6862 | - $str = (string) \preg_replace_callback( |
|
6862 | + $str = (string)\preg_replace_callback( |
|
6863 | 6863 | '~\b |
6864 | 6864 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
6865 | - ( ' . $smallWordsRx . ' ) |
|
6865 | + ( ' . $smallWordsRx.' ) |
|
6866 | 6866 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
6867 | 6867 | ~uxi', |
6868 | - static function ($matches) use ($encoding) { |
|
6868 | + static function($matches) use ($encoding) { |
|
6869 | 6869 | return static::str_upper_first($matches[1], $encoding); |
6870 | 6870 | }, |
6871 | 6871 | $str |
6872 | 6872 | ); |
6873 | 6873 | |
6874 | 6874 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
6875 | - $str = (string) \preg_replace_callback( |
|
6875 | + $str = (string)\preg_replace_callback( |
|
6876 | 6876 | '~\b |
6877 | 6877 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
6878 | 6878 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
6879 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
6879 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
6880 | 6880 | (?! - ) # Negative lookahead for another - |
6881 | 6881 | ~uxi', |
6882 | - static function ($matches) use ($encoding) { |
|
6883 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
6882 | + static function($matches) use ($encoding) { |
|
6883 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
6884 | 6884 | }, |
6885 | 6885 | $str |
6886 | 6886 | ); |
@@ -6975,7 +6975,7 @@ discard block |
||
6975 | 6975 | ); |
6976 | 6976 | |
6977 | 6977 | foreach ($tmpReturn as &$item) { |
6978 | - $item = (string) $item; |
|
6978 | + $item = (string)$item; |
|
6979 | 6979 | } |
6980 | 6980 | |
6981 | 6981 | return $tmpReturn; |
@@ -7012,7 +7012,7 @@ discard block |
||
7012 | 7012 | public static function str_truncate($str, int $length, string $substring = '', string $encoding = 'UTF-8'): string |
7013 | 7013 | { |
7014 | 7014 | // init |
7015 | - $str = (string) $str; |
|
7015 | + $str = (string)$str; |
|
7016 | 7016 | |
7017 | 7017 | if ($str === '') { |
7018 | 7018 | return ''; |
@@ -7028,7 +7028,7 @@ discard block |
||
7028 | 7028 | |
7029 | 7029 | $truncated = self::substr($str, 0, $length, $encoding); |
7030 | 7030 | |
7031 | - return $truncated . $substring; |
|
7031 | + return $truncated.$substring; |
|
7032 | 7032 | } |
7033 | 7033 | |
7034 | 7034 | /** |
@@ -7066,11 +7066,11 @@ discard block |
||
7066 | 7066 | $lastPos = self::strrpos($truncated, ' ', 0, $encoding); |
7067 | 7067 | |
7068 | 7068 | if ($lastPos !== false || $strPosSpace !== false) { |
7069 | - $truncated = self::substr($truncated, 0, (int) $lastPos, $encoding); |
|
7069 | + $truncated = self::substr($truncated, 0, (int)$lastPos, $encoding); |
|
7070 | 7070 | } |
7071 | 7071 | } |
7072 | 7072 | |
7073 | - return $truncated . $substring; |
|
7073 | + return $truncated.$substring; |
|
7074 | 7074 | } |
7075 | 7075 | |
7076 | 7076 | /** |
@@ -7156,7 +7156,7 @@ discard block |
||
7156 | 7156 | $offset += self::strlen($strParts[$i]) + self::strlen($strParts[$i + 1]); |
7157 | 7157 | } |
7158 | 7158 | } else { |
7159 | - $numberOfWords = (int) (($len - 1) / 2); |
|
7159 | + $numberOfWords = (int)(($len - 1) / 2); |
|
7160 | 7160 | } |
7161 | 7161 | |
7162 | 7162 | return $numberOfWords; |
@@ -7216,7 +7216,7 @@ discard block |
||
7216 | 7216 | public static function strcmp(string $str1, string $str2): int |
7217 | 7217 | { |
7218 | 7218 | /** @noinspection PhpUndefinedClassInspection */ |
7219 | - return $str1 . '' === $str2 . '' ? 0 : \strcmp( |
|
7219 | + return $str1.'' === $str2.'' ? 0 : \strcmp( |
|
7220 | 7220 | \Normalizer::normalize($str1, \Normalizer::NFD), |
7221 | 7221 | \Normalizer::normalize($str2, \Normalizer::NFD) |
7222 | 7222 | ); |
@@ -7250,7 +7250,7 @@ discard block |
||
7250 | 7250 | return null; |
7251 | 7251 | } |
7252 | 7252 | |
7253 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $length)) { |
|
7253 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $length)) { |
|
7254 | 7254 | return self::strlen($length[1]); |
7255 | 7255 | } |
7256 | 7256 | |
@@ -7366,7 +7366,7 @@ discard block |
||
7366 | 7366 | return ''; |
7367 | 7367 | } |
7368 | 7368 | |
7369 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
7369 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
7370 | 7370 | } |
7371 | 7371 | |
7372 | 7372 | /** |
@@ -7487,7 +7487,7 @@ discard block |
||
7487 | 7487 | && |
7488 | 7488 | self::$SUPPORT['mbstring'] === false |
7489 | 7489 | ) { |
7490 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
7490 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
7491 | 7491 | } |
7492 | 7492 | |
7493 | 7493 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -7509,7 +7509,7 @@ discard block |
||
7509 | 7509 | return \stristr($haystack, $needle, $before_needle); |
7510 | 7510 | } |
7511 | 7511 | |
7512 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
7512 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
7513 | 7513 | |
7514 | 7514 | if (!isset($match[1])) { |
7515 | 7515 | return false; |
@@ -7578,7 +7578,7 @@ discard block |
||
7578 | 7578 | && |
7579 | 7579 | self::$SUPPORT['iconv'] === false |
7580 | 7580 | ) { |
7581 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
7581 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
7582 | 7582 | } |
7583 | 7583 | |
7584 | 7584 | // |
@@ -7704,7 +7704,7 @@ discard block |
||
7704 | 7704 | */ |
7705 | 7705 | public static function strnatcmp(string $str1, string $str2): int |
7706 | 7706 | { |
7707 | - return $str1 . '' === $str2 . '' ? 0 : \strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
7707 | + return $str1.'' === $str2.'' ? 0 : \strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
7708 | 7708 | } |
7709 | 7709 | |
7710 | 7710 | /** |
@@ -7747,8 +7747,8 @@ discard block |
||
7747 | 7747 | */ |
7748 | 7748 | public static function strncmp(string $str1, string $str2, int $len): int |
7749 | 7749 | { |
7750 | - $str1 = (string) self::substr($str1, 0, $len); |
|
7751 | - $str2 = (string) self::substr($str2, 0, $len); |
|
7750 | + $str1 = (string)self::substr($str1, 0, $len); |
|
7751 | + $str2 = (string)self::substr($str2, 0, $len); |
|
7752 | 7752 | |
7753 | 7753 | return self::strcmp($str1, $str2); |
7754 | 7754 | } |
@@ -7769,8 +7769,8 @@ discard block |
||
7769 | 7769 | return false; |
7770 | 7770 | } |
7771 | 7771 | |
7772 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
7773 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
7772 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
7773 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
7774 | 7774 | } |
7775 | 7775 | |
7776 | 7776 | return false; |
@@ -7798,10 +7798,10 @@ discard block |
||
7798 | 7798 | } |
7799 | 7799 | |
7800 | 7800 | // iconv and mbstring do not support integer $needle |
7801 | - if ((int) $needle === $needle && $needle >= 0) { |
|
7802 | - $needle = (string) self::chr($needle); |
|
7801 | + if ((int)$needle === $needle && $needle >= 0) { |
|
7802 | + $needle = (string)self::chr($needle); |
|
7803 | 7803 | } |
7804 | - $needle = (string) $needle; |
|
7804 | + $needle = (string)$needle; |
|
7805 | 7805 | |
7806 | 7806 | if ($needle === '') { |
7807 | 7807 | return false; |
@@ -7841,7 +7841,7 @@ discard block |
||
7841 | 7841 | && |
7842 | 7842 | self::$SUPPORT['mbstring'] === false |
7843 | 7843 | ) { |
7844 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
7844 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
7845 | 7845 | } |
7846 | 7846 | |
7847 | 7847 | // |
@@ -7909,7 +7909,7 @@ discard block |
||
7909 | 7909 | if ($haystackTmp === false) { |
7910 | 7910 | $haystackTmp = ''; |
7911 | 7911 | } |
7912 | - $haystack = (string) $haystackTmp; |
|
7912 | + $haystack = (string)$haystackTmp; |
|
7913 | 7913 | |
7914 | 7914 | if ($offset < 0) { |
7915 | 7915 | $offset = 0; |
@@ -8007,7 +8007,7 @@ discard block |
||
8007 | 8007 | && |
8008 | 8008 | self::$SUPPORT['mbstring'] === false |
8009 | 8009 | ) { |
8010 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8010 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8011 | 8011 | } |
8012 | 8012 | |
8013 | 8013 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -8039,7 +8039,7 @@ discard block |
||
8039 | 8039 | if ($needleTmp === false) { |
8040 | 8040 | return false; |
8041 | 8041 | } |
8042 | - $needle = (string) $needleTmp; |
|
8042 | + $needle = (string)$needleTmp; |
|
8043 | 8043 | |
8044 | 8044 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
8045 | 8045 | if ($pos === false) { |
@@ -8061,7 +8061,7 @@ discard block |
||
8061 | 8061 | if ($needleTmp === false) { |
8062 | 8062 | return false; |
8063 | 8063 | } |
8064 | - $needle = (string) $needleTmp; |
|
8064 | + $needle = (string)$needleTmp; |
|
8065 | 8065 | |
8066 | 8066 | $pos = self::strrpos($haystack, $needle, null, $encoding); |
8067 | 8067 | if ($pos === false) { |
@@ -8154,7 +8154,7 @@ discard block |
||
8154 | 8154 | if ($needleTmp === false) { |
8155 | 8155 | return false; |
8156 | 8156 | } |
8157 | - $needle = (string) $needleTmp; |
|
8157 | + $needle = (string)$needleTmp; |
|
8158 | 8158 | |
8159 | 8159 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
8160 | 8160 | if ($pos === false) { |
@@ -8188,10 +8188,10 @@ discard block |
||
8188 | 8188 | } |
8189 | 8189 | |
8190 | 8190 | // iconv and mbstring do not support integer $needle |
8191 | - if ((int) $needle === $needle && $needle >= 0) { |
|
8192 | - $needle = (string) self::chr($needle); |
|
8191 | + if ((int)$needle === $needle && $needle >= 0) { |
|
8192 | + $needle = (string)self::chr($needle); |
|
8193 | 8193 | } |
8194 | - $needle = (string) $needle; |
|
8194 | + $needle = (string)$needle; |
|
8195 | 8195 | |
8196 | 8196 | if ($needle === '') { |
8197 | 8197 | return false; |
@@ -8228,7 +8228,7 @@ discard block |
||
8228 | 8228 | && |
8229 | 8229 | self::$SUPPORT['mbstring'] === false |
8230 | 8230 | ) { |
8231 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8231 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8232 | 8232 | } |
8233 | 8233 | |
8234 | 8234 | // |
@@ -8335,10 +8335,10 @@ discard block |
||
8335 | 8335 | } |
8336 | 8336 | |
8337 | 8337 | // iconv and mbstring do not support integer $needle |
8338 | - if ((int) $needle === $needle && $needle >= 0) { |
|
8339 | - $needle = (string) self::chr($needle); |
|
8338 | + if ((int)$needle === $needle && $needle >= 0) { |
|
8339 | + $needle = (string)self::chr($needle); |
|
8340 | 8340 | } |
8341 | - $needle = (string) $needle; |
|
8341 | + $needle = (string)$needle; |
|
8342 | 8342 | |
8343 | 8343 | if ($needle === '') { |
8344 | 8344 | return false; |
@@ -8375,7 +8375,7 @@ discard block |
||
8375 | 8375 | && |
8376 | 8376 | self::$SUPPORT['mbstring'] === false |
8377 | 8377 | ) { |
8378 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8378 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8379 | 8379 | } |
8380 | 8380 | |
8381 | 8381 | // |
@@ -8435,7 +8435,7 @@ discard block |
||
8435 | 8435 | if ($haystackTmp === false) { |
8436 | 8436 | $haystackTmp = ''; |
8437 | 8437 | } |
8438 | - $haystack = (string) $haystackTmp; |
|
8438 | + $haystack = (string)$haystackTmp; |
|
8439 | 8439 | } |
8440 | 8440 | |
8441 | 8441 | $pos = self::strrpos_in_byte($haystack, $needle); |
@@ -8499,14 +8499,14 @@ discard block |
||
8499 | 8499 | if ($strTmp === false) { |
8500 | 8500 | $strTmp = ''; |
8501 | 8501 | } |
8502 | - $str = (string) $strTmp; |
|
8502 | + $str = (string)$strTmp; |
|
8503 | 8503 | } |
8504 | 8504 | |
8505 | 8505 | if ($str === '' || $mask === '') { |
8506 | 8506 | return 0; |
8507 | 8507 | } |
8508 | 8508 | |
8509 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
8509 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
8510 | 8510 | } |
8511 | 8511 | |
8512 | 8512 | /** |
@@ -8562,7 +8562,7 @@ discard block |
||
8562 | 8562 | && |
8563 | 8563 | self::$SUPPORT['mbstring'] === false |
8564 | 8564 | ) { |
8565 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8565 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8566 | 8566 | } |
8567 | 8567 | |
8568 | 8568 | // |
@@ -8600,7 +8600,7 @@ discard block |
||
8600 | 8600 | // fallback via vanilla php |
8601 | 8601 | // |
8602 | 8602 | |
8603 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
8603 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
8604 | 8604 | |
8605 | 8605 | if (!isset($match[1])) { |
8606 | 8606 | return false; |
@@ -8708,7 +8708,7 @@ discard block |
||
8708 | 8708 | public static function strtolower($str, string $encoding = 'UTF-8', bool $cleanUtf8 = false, string $lang = null, bool $tryToKeepStringLength = false): string |
8709 | 8709 | { |
8710 | 8710 | // init |
8711 | - $str = (string) $str; |
|
8711 | + $str = (string)$str; |
|
8712 | 8712 | |
8713 | 8713 | if ($str === '') { |
8714 | 8714 | return ''; |
@@ -8735,9 +8735,9 @@ discard block |
||
8735 | 8735 | } |
8736 | 8736 | |
8737 | 8737 | if (self::$SUPPORT['intl'] === true) { |
8738 | - $langCode = $lang . '-Lower'; |
|
8738 | + $langCode = $lang.'-Lower'; |
|
8739 | 8739 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
8740 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, \E_USER_WARNING); |
|
8740 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, \E_USER_WARNING); |
|
8741 | 8741 | |
8742 | 8742 | $langCode = 'Any-Lower'; |
8743 | 8743 | } |
@@ -8746,7 +8746,7 @@ discard block |
||
8746 | 8746 | return \transliterator_transliterate($langCode, $str); |
8747 | 8747 | } |
8748 | 8748 | |
8749 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
8749 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
8750 | 8750 | } |
8751 | 8751 | |
8752 | 8752 | // always fallback via symfony polyfill |
@@ -8769,7 +8769,7 @@ discard block |
||
8769 | 8769 | public static function strtoupper($str, string $encoding = 'UTF-8', bool $cleanUtf8 = false, string $lang = null, bool $tryToKeepStringLength = false): string |
8770 | 8770 | { |
8771 | 8771 | // init |
8772 | - $str = (string) $str; |
|
8772 | + $str = (string)$str; |
|
8773 | 8773 | |
8774 | 8774 | if ($str === '') { |
8775 | 8775 | return ''; |
@@ -8796,9 +8796,9 @@ discard block |
||
8796 | 8796 | } |
8797 | 8797 | |
8798 | 8798 | if (self::$SUPPORT['intl'] === true) { |
8799 | - $langCode = $lang . '-Upper'; |
|
8799 | + $langCode = $lang.'-Upper'; |
|
8800 | 8800 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
8801 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
8801 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
8802 | 8802 | |
8803 | 8803 | $langCode = 'Any-Upper'; |
8804 | 8804 | } |
@@ -8807,7 +8807,7 @@ discard block |
||
8807 | 8807 | return \transliterator_transliterate($langCode, $str); |
8808 | 8808 | } |
8809 | 8809 | |
8810 | - \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
8810 | + \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
8811 | 8811 | } |
8812 | 8812 | |
8813 | 8813 | // always fallback via symfony polyfill |
@@ -8905,7 +8905,7 @@ discard block |
||
8905 | 8905 | } |
8906 | 8906 | |
8907 | 8907 | $wide = 0; |
8908 | - $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); |
|
8908 | + $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); |
|
8909 | 8909 | |
8910 | 8910 | return ($wide << 1) + self::strlen($str, 'UTF-8'); |
8911 | 8911 | } |
@@ -9003,9 +9003,9 @@ discard block |
||
9003 | 9003 | } |
9004 | 9004 | |
9005 | 9005 | if ($length === null) { |
9006 | - $length = (int) $str_length; |
|
9006 | + $length = (int)$str_length; |
|
9007 | 9007 | } else { |
9008 | - $length = (int) $length; |
|
9008 | + $length = (int)$length; |
|
9009 | 9009 | } |
9010 | 9010 | |
9011 | 9011 | if ( |
@@ -9013,7 +9013,7 @@ discard block |
||
9013 | 9013 | && |
9014 | 9014 | self::$SUPPORT['mbstring'] === false |
9015 | 9015 | ) { |
9016 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9016 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9017 | 9017 | } |
9018 | 9018 | |
9019 | 9019 | // |
@@ -9096,13 +9096,13 @@ discard block |
||
9096 | 9096 | if ($str1Tmp === false) { |
9097 | 9097 | $str1Tmp = ''; |
9098 | 9098 | } |
9099 | - $str1 = (string) $str1Tmp; |
|
9099 | + $str1 = (string)$str1Tmp; |
|
9100 | 9100 | |
9101 | 9101 | $str2Tmp = self::substr($str2, 0, self::strlen($str1)); |
9102 | 9102 | if ($str2Tmp === false) { |
9103 | 9103 | $str2Tmp = ''; |
9104 | 9104 | } |
9105 | - $str2 = (string) $str2Tmp; |
|
9105 | + $str2 = (string)$str2Tmp; |
|
9106 | 9106 | } |
9107 | 9107 | |
9108 | 9108 | if ($case_insensitivity === true) { |
@@ -9148,7 +9148,7 @@ discard block |
||
9148 | 9148 | if ($lengthTmp === false) { |
9149 | 9149 | return false; |
9150 | 9150 | } |
9151 | - $length = (int) $lengthTmp; |
|
9151 | + $length = (int)$lengthTmp; |
|
9152 | 9152 | } |
9153 | 9153 | |
9154 | 9154 | if ( |
@@ -9169,7 +9169,7 @@ discard block |
||
9169 | 9169 | if ($haystackTmp === false) { |
9170 | 9170 | $haystackTmp = ''; |
9171 | 9171 | } |
9172 | - $haystack = (string) $haystackTmp; |
|
9172 | + $haystack = (string)$haystackTmp; |
|
9173 | 9173 | } |
9174 | 9174 | |
9175 | 9175 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
@@ -9192,14 +9192,14 @@ discard block |
||
9192 | 9192 | && |
9193 | 9193 | self::$SUPPORT['mbstring'] === false |
9194 | 9194 | ) { |
9195 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9195 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9196 | 9196 | } |
9197 | 9197 | |
9198 | 9198 | if (self::$SUPPORT['mbstring'] === true) { |
9199 | 9199 | return \mb_substr_count($haystack, $needle, $encoding); |
9200 | 9200 | } |
9201 | 9201 | |
9202 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
9202 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
9203 | 9203 | |
9204 | 9204 | return \count($matches); |
9205 | 9205 | } |
@@ -9246,7 +9246,7 @@ discard block |
||
9246 | 9246 | if ($lengthTmp === false) { |
9247 | 9247 | return false; |
9248 | 9248 | } |
9249 | - $length = (int) $lengthTmp; |
|
9249 | + $length = (int)$lengthTmp; |
|
9250 | 9250 | } |
9251 | 9251 | |
9252 | 9252 | if ( |
@@ -9267,7 +9267,7 @@ discard block |
||
9267 | 9267 | if ($haystackTmp === false) { |
9268 | 9268 | $haystackTmp = ''; |
9269 | 9269 | } |
9270 | - $haystack = (string) $haystackTmp; |
|
9270 | + $haystack = (string)$haystackTmp; |
|
9271 | 9271 | } |
9272 | 9272 | |
9273 | 9273 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -9298,7 +9298,7 @@ discard block |
||
9298 | 9298 | |
9299 | 9299 | // only a fallback to prevent BC in the api ... |
9300 | 9300 | if ($caseSensitive !== false && $caseSensitive !== true) { |
9301 | - $encoding = (string) $caseSensitive; |
|
9301 | + $encoding = (string)$caseSensitive; |
|
9302 | 9302 | } |
9303 | 9303 | |
9304 | 9304 | if (!$caseSensitive) { |
@@ -9306,7 +9306,7 @@ discard block |
||
9306 | 9306 | $substring = self::strtocasefold($substring, true, false, $encoding, null, false); |
9307 | 9307 | } |
9308 | 9308 | |
9309 | - return (int) self::substr_count($str, $substring, 0, null, $encoding); |
|
9309 | + return (int)self::substr_count($str, $substring, 0, null, $encoding); |
|
9310 | 9310 | } |
9311 | 9311 | |
9312 | 9312 | /** |
@@ -9332,7 +9332,7 @@ discard block |
||
9332 | 9332 | if ($haystackTmp === false) { |
9333 | 9333 | $haystackTmp = ''; |
9334 | 9334 | } |
9335 | - $haystack = (string) $haystackTmp; |
|
9335 | + $haystack = (string)$haystackTmp; |
|
9336 | 9336 | } |
9337 | 9337 | |
9338 | 9338 | return $haystack; |
@@ -9401,7 +9401,7 @@ discard block |
||
9401 | 9401 | if ($haystackTmp === false) { |
9402 | 9402 | $haystackTmp = ''; |
9403 | 9403 | } |
9404 | - $haystack = (string) $haystackTmp; |
|
9404 | + $haystack = (string)$haystackTmp; |
|
9405 | 9405 | } |
9406 | 9406 | |
9407 | 9407 | return $haystack; |
@@ -9430,7 +9430,7 @@ discard block |
||
9430 | 9430 | if ($haystackTmp === false) { |
9431 | 9431 | $haystackTmp = ''; |
9432 | 9432 | } |
9433 | - $haystack = (string) $haystackTmp; |
|
9433 | + $haystack = (string)$haystackTmp; |
|
9434 | 9434 | } |
9435 | 9435 | |
9436 | 9436 | return $haystack; |
@@ -9477,7 +9477,7 @@ discard block |
||
9477 | 9477 | if (\is_array($offset) === true) { |
9478 | 9478 | $offset = \array_slice($offset, 0, $num); |
9479 | 9479 | foreach ($offset as &$valueTmp) { |
9480 | - $valueTmp = (int) $valueTmp === $valueTmp ? $valueTmp : 0; |
|
9480 | + $valueTmp = (int)$valueTmp === $valueTmp ? $valueTmp : 0; |
|
9481 | 9481 | } |
9482 | 9482 | unset($valueTmp); |
9483 | 9483 | } else { |
@@ -9491,7 +9491,7 @@ discard block |
||
9491 | 9491 | $length = \array_slice($length, 0, $num); |
9492 | 9492 | foreach ($length as &$valueTmpV2) { |
9493 | 9493 | if ($valueTmpV2 !== null) { |
9494 | - $valueTmpV2 = (int) $valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
9494 | + $valueTmpV2 = (int)$valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
9495 | 9495 | } else { |
9496 | 9496 | $valueTmpV2 = 0; |
9497 | 9497 | } |
@@ -9514,8 +9514,8 @@ discard block |
||
9514 | 9514 | } |
9515 | 9515 | |
9516 | 9516 | // init |
9517 | - $str = (string) $str; |
|
9518 | - $replacement = (string) $replacement; |
|
9517 | + $str = (string)$str; |
|
9518 | + $replacement = (string)$replacement; |
|
9519 | 9519 | |
9520 | 9520 | if ($str === '') { |
9521 | 9521 | return $replacement; |
@@ -9523,8 +9523,7 @@ discard block |
||
9523 | 9523 | |
9524 | 9524 | if (self::is_ascii($str)) { |
9525 | 9525 | return ($length === null) ? |
9526 | - \substr_replace($str, $replacement, $offset) : |
|
9527 | - \substr_replace($str, $replacement, $offset, $length); |
|
9526 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
9528 | 9527 | } |
9529 | 9528 | |
9530 | 9529 | if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) { |
@@ -9550,7 +9549,7 @@ discard block |
||
9550 | 9549 | $length = $string_length - $offset; |
9551 | 9550 | } |
9552 | 9551 | |
9553 | - return self::substr($str, 0, $offset, $encoding) . $replacement . self::substr($str, $offset + $length, $string_length - $offset - $length, $encoding); |
|
9552 | + return self::substr($str, 0, $offset, $encoding).$replacement.self::substr($str, $offset + $length, $string_length - $offset - $length, $encoding); |
|
9554 | 9553 | } |
9555 | 9554 | |
9556 | 9555 | \preg_match_all('/./us', $str, $smatches); |
@@ -9562,7 +9561,7 @@ discard block |
||
9562 | 9561 | // e.g.: non mbstring support + invalid chars |
9563 | 9562 | return ''; |
9564 | 9563 | } |
9565 | - $length = (int) $lengthTmp; |
|
9564 | + $length = (int)$lengthTmp; |
|
9566 | 9565 | } |
9567 | 9566 | |
9568 | 9567 | \array_splice($smatches[0], $offset, $length, $rmatches[0]); |
@@ -9593,7 +9592,7 @@ discard block |
||
9593 | 9592 | if ($haystackTmp === false) { |
9594 | 9593 | $haystackTmp = ''; |
9595 | 9594 | } |
9596 | - $haystack = (string) $haystackTmp; |
|
9595 | + $haystack = (string)$haystackTmp; |
|
9597 | 9596 | } |
9598 | 9597 | |
9599 | 9598 | return $haystack; |
@@ -9624,7 +9623,7 @@ discard block |
||
9624 | 9623 | $str = self::clean($str); |
9625 | 9624 | } |
9626 | 9625 | |
9627 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
9626 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
9628 | 9627 | } |
9629 | 9628 | |
9630 | 9629 | /** |
@@ -9918,7 +9917,7 @@ discard block |
||
9918 | 9917 | public static function to_boolean($str): bool |
9919 | 9918 | { |
9920 | 9919 | // init |
9921 | - $str = (string) $str; |
|
9920 | + $str = (string)$str; |
|
9922 | 9921 | |
9923 | 9922 | if ($str === '') { |
9924 | 9923 | return false; |
@@ -9944,10 +9943,10 @@ discard block |
||
9944 | 9943 | |
9945 | 9944 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
9946 | 9945 | if (\is_numeric($str)) { |
9947 | - return ((float) $str + 0) > 0; |
|
9946 | + return ((float)$str + 0) > 0; |
|
9948 | 9947 | } |
9949 | 9948 | |
9950 | - return (bool) self::trim($str); |
|
9949 | + return (bool)self::trim($str); |
|
9951 | 9950 | } |
9952 | 9951 | |
9953 | 9952 | /** |
@@ -9968,11 +9967,11 @@ discard block |
||
9968 | 9967 | |
9969 | 9968 | $fallback_char_escaped = \preg_quote($fallback_char, '/'); |
9970 | 9969 | |
9971 | - $string = (string) \preg_replace( |
|
9970 | + $string = (string)\preg_replace( |
|
9972 | 9971 | [ |
9973 | - '/[^' . $fallback_char_escaped . '\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
9974 | - '/[\s]+/', // 2) convert spaces to $fallback_char |
|
9975 | - '/[' . $fallback_char_escaped . ']+/', // 3) remove double $fallback_char's |
|
9972 | + '/[^'.$fallback_char_escaped.'\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
9973 | + '/[\s]+/', // 2) convert spaces to $fallback_char |
|
9974 | + '/['.$fallback_char_escaped.']+/', // 3) remove double $fallback_char's |
|
9976 | 9975 | ], |
9977 | 9976 | [ |
9978 | 9977 | '', |
@@ -10003,7 +10002,7 @@ discard block |
||
10003 | 10002 | return $str; |
10004 | 10003 | } |
10005 | 10004 | |
10006 | - $str = (string) $str; |
|
10005 | + $str = (string)$str; |
|
10007 | 10006 | if ($str === '') { |
10008 | 10007 | return ''; |
10009 | 10008 | } |
@@ -10050,7 +10049,7 @@ discard block |
||
10050 | 10049 | return $str; |
10051 | 10050 | } |
10052 | 10051 | |
10053 | - $str = (string) $str; |
|
10052 | + $str = (string)$str; |
|
10054 | 10053 | if ($str === '') { |
10055 | 10054 | return $str; |
10056 | 10055 | } |
@@ -10073,7 +10072,7 @@ discard block |
||
10073 | 10072 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
10074 | 10073 | |
10075 | 10074 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
10076 | - $buf .= $c1 . $c2; |
|
10075 | + $buf .= $c1.$c2; |
|
10077 | 10076 | ++$i; |
10078 | 10077 | } else { // not valid UTF8 - convert it |
10079 | 10078 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -10084,7 +10083,7 @@ discard block |
||
10084 | 10083 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
10085 | 10084 | |
10086 | 10085 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
10087 | - $buf .= $c1 . $c2 . $c3; |
|
10086 | + $buf .= $c1.$c2.$c3; |
|
10088 | 10087 | $i += 2; |
10089 | 10088 | } else { // not valid UTF8 - convert it |
10090 | 10089 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -10096,7 +10095,7 @@ discard block |
||
10096 | 10095 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
10097 | 10096 | |
10098 | 10097 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
10099 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
10098 | + $buf .= $c1.$c2.$c3.$c4; |
|
10100 | 10099 | $i += 3; |
10101 | 10100 | } else { // not valid UTF8 - convert it |
10102 | 10101 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -10115,7 +10114,7 @@ discard block |
||
10115 | 10114 | // decode unicode escape sequences |
10116 | 10115 | $buf = \preg_replace_callback( |
10117 | 10116 | '/\\\\u([0-9a-f]{4})/i', |
10118 | - static function ($match) { |
|
10117 | + static function($match) { |
|
10119 | 10118 | // always fallback via symfony polyfill |
10120 | 10119 | return \mb_convert_encoding(\pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); |
10121 | 10120 | }, |
@@ -10185,14 +10184,14 @@ discard block |
||
10185 | 10184 | } |
10186 | 10185 | |
10187 | 10186 | $strPartOne = self::strtoupper( |
10188 | - (string) self::substr($str, 0, 1, $encoding), |
|
10187 | + (string)self::substr($str, 0, 1, $encoding), |
|
10189 | 10188 | $encoding, |
10190 | 10189 | $cleanUtf8, |
10191 | 10190 | $lang, |
10192 | 10191 | $tryToKeepStringLength |
10193 | 10192 | ); |
10194 | 10193 | |
10195 | - return $strPartOne . $strPartTwo; |
|
10194 | + return $strPartOne.$strPartTwo; |
|
10196 | 10195 | } |
10197 | 10196 | |
10198 | 10197 | /** |
@@ -10238,7 +10237,7 @@ discard block |
||
10238 | 10237 | $str = self::clean($str); |
10239 | 10238 | } |
10240 | 10239 | |
10241 | - $usePhpDefaultFunctions = !(bool) ($charlist . \implode('', $exceptions)); |
|
10240 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
10242 | 10241 | |
10243 | 10242 | if ( |
10244 | 10243 | $usePhpDefaultFunctions === true |
@@ -10303,7 +10302,7 @@ discard block |
||
10303 | 10302 | |
10304 | 10303 | $pattern = '/%u([0-9a-f]{3,4})/i'; |
10305 | 10304 | if (\preg_match($pattern, $str)) { |
10306 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
10305 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
10307 | 10306 | } |
10308 | 10307 | |
10309 | 10308 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -10737,7 +10736,7 @@ discard block |
||
10737 | 10736 | return ''; |
10738 | 10737 | } |
10739 | 10738 | |
10740 | - \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches); |
|
10739 | + \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches); |
|
10741 | 10740 | |
10742 | 10741 | if ( |
10743 | 10742 | !isset($matches[0]) |
@@ -10747,7 +10746,7 @@ discard block |
||
10747 | 10746 | return $str; |
10748 | 10747 | } |
10749 | 10748 | |
10750 | - return self::rtrim($matches[0]) . $strAddOn; |
|
10749 | + return self::rtrim($matches[0]).$strAddOn; |
|
10751 | 10750 | } |
10752 | 10751 | |
10753 | 10752 | /** |
@@ -10815,7 +10814,7 @@ discard block |
||
10815 | 10814 | $strReturn .= $break; |
10816 | 10815 | } |
10817 | 10816 | |
10818 | - return $strReturn . \implode('', $chars); |
|
10817 | + return $strReturn.\implode('', $chars); |
|
10819 | 10818 | } |
10820 | 10819 | |
10821 | 10820 | /** |
@@ -10828,7 +10827,7 @@ discard block |
||
10828 | 10827 | */ |
10829 | 10828 | public static function wordwrap_per_line(string $str, int $limit): string |
10830 | 10829 | { |
10831 | - $strings = (array) \preg_split('/\\r\\n|\\r|\\n/', $str); |
|
10830 | + $strings = (array)\preg_split('/\\r\\n|\\r|\\n/', $str); |
|
10832 | 10831 | |
10833 | 10832 | $string = ''; |
10834 | 10833 | foreach ($strings as $value) { |
@@ -10899,13 +10898,13 @@ discard block |
||
10899 | 10898 | $lower = self::$COMMON_CASE_FOLD['lower']; |
10900 | 10899 | |
10901 | 10900 | if ($useLower === true) { |
10902 | - $str = (string) \str_replace( |
|
10901 | + $str = (string)\str_replace( |
|
10903 | 10902 | $upper, |
10904 | 10903 | $lower, |
10905 | 10904 | $str |
10906 | 10905 | ); |
10907 | 10906 | } else { |
10908 | - $str = (string) \str_replace( |
|
10907 | + $str = (string)\str_replace( |
|
10909 | 10908 | $lower, |
10910 | 10909 | $upper, |
10911 | 10910 | $str |
@@ -10919,9 +10918,9 @@ discard block |
||
10919 | 10918 | } |
10920 | 10919 | |
10921 | 10920 | if ($useLower === true) { |
10922 | - $str = (string) \str_replace($FULL_CASE_FOLD[0], $FULL_CASE_FOLD[1], $str); |
|
10921 | + $str = (string)\str_replace($FULL_CASE_FOLD[0], $FULL_CASE_FOLD[1], $str); |
|
10923 | 10922 | } else { |
10924 | - $str = (string) \str_replace($FULL_CASE_FOLD[1], $FULL_CASE_FOLD[0], $str); |
|
10923 | + $str = (string)\str_replace($FULL_CASE_FOLD[1], $FULL_CASE_FOLD[0], $str); |
|
10925 | 10924 | } |
10926 | 10925 | } |
10927 | 10926 | |
@@ -10938,7 +10937,7 @@ discard block |
||
10938 | 10937 | private static function getData(string $file) |
10939 | 10938 | { |
10940 | 10939 | /** @noinspection PhpIncludeInspection */ |
10941 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
10940 | + return include __DIR__.'/data/'.$file.'.php'; |
|
10942 | 10941 | } |
10943 | 10942 | |
10944 | 10943 | /** |
@@ -10950,7 +10949,7 @@ discard block |
||
10950 | 10949 | */ |
10951 | 10950 | private static function getDataIfExists(string $file) |
10952 | 10951 | { |
10953 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
10952 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
10954 | 10953 | if (\file_exists($file)) { |
10955 | 10954 | /** @noinspection PhpIncludeInspection */ |
10956 | 10955 | return include $file; |
@@ -11024,7 +11023,7 @@ discard block |
||
11024 | 11023 | { |
11025 | 11024 | static $RX_CLASSS_CACHE = []; |
11026 | 11025 | |
11027 | - $cacheKey = $s . $class; |
|
11026 | + $cacheKey = $s.$class; |
|
11028 | 11027 | |
11029 | 11028 | if (isset($RX_CLASSS_CACHE[$cacheKey])) { |
11030 | 11029 | return $RX_CLASSS_CACHE[$cacheKey]; |
@@ -11036,7 +11035,7 @@ discard block |
||
11036 | 11035 | /** @noinspection SuspiciousLoopInspection */ |
11037 | 11036 | foreach (self::str_split($s) as $s) { |
11038 | 11037 | if ($s === '-') { |
11039 | - $class[0] = '-' . $class[0]; |
|
11038 | + $class[0] = '-'.$class[0]; |
|
11040 | 11039 | } elseif (!isset($s[2])) { |
11041 | 11040 | $class[0] .= \preg_quote($s, '/'); |
11042 | 11041 | } elseif (self::strlen($s) === 1) { |
@@ -11047,13 +11046,13 @@ discard block |
||
11047 | 11046 | } |
11048 | 11047 | |
11049 | 11048 | if ($class[0]) { |
11050 | - $class[0] = '[' . $class[0] . ']'; |
|
11049 | + $class[0] = '['.$class[0].']'; |
|
11051 | 11050 | } |
11052 | 11051 | |
11053 | 11052 | if (\count($class) === 1) { |
11054 | 11053 | $return = $class[0]; |
11055 | 11054 | } else { |
11056 | - $return = '(?:' . \implode('|', $class) . ')'; |
|
11055 | + $return = '(?:'.\implode('|', $class).')'; |
|
11057 | 11056 | } |
11058 | 11057 | |
11059 | 11058 | $RX_CLASSS_CACHE[$cacheKey] = $return; |
@@ -11190,8 +11189,8 @@ discard block |
||
11190 | 11189 | $buf .= self::$WIN1252_TO_UTF8[$ordC1]; |
11191 | 11190 | } else { |
11192 | 11191 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
11193 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
11194 | - $buf .= $cc1 . $cc2; |
|
11192 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
11193 | + $buf .= $cc1.$cc2; |
|
11195 | 11194 | } |
11196 | 11195 | |
11197 | 11196 | return $buf; |
@@ -3,17 +3,17 @@ discard block |
||
3 | 3 | return [ |
4 | 4 | 0x80 => "\xe2\x82\xac", // € |
5 | 5 | 0x82 => "\xe2\x80\x9a", // ‚ |
6 | - 0x83 => "\xc6\x92", // ƒ |
|
6 | + 0x83 => "\xc6\x92", // ƒ |
|
7 | 7 | 0x84 => "\xe2\x80\x9e", // „ |
8 | 8 | 0x85 => "\xe2\x80\xa6", // … |
9 | 9 | 0x86 => "\xe2\x80\xa0", // † |
10 | 10 | 0x87 => "\xe2\x80\xa1", // ‡ |
11 | - 0x88 => "\xcb\x86", // ˆ |
|
11 | + 0x88 => "\xcb\x86", // ˆ |
|
12 | 12 | 0x89 => "\xe2\x80\xb0", // ‰ |
13 | - 0x8a => "\xc5\xa0", // Š |
|
13 | + 0x8a => "\xc5\xa0", // Š |
|
14 | 14 | 0x8b => "\xe2\x80\xb9", // ‹ |
15 | - 0x8c => "\xc5\x92", // Œ |
|
16 | - 0x8e => "\xc5\xbd", // Ž |
|
15 | + 0x8c => "\xc5\x92", // Œ |
|
16 | + 0x8e => "\xc5\xbd", // Ž |
|
17 | 17 | 0x91 => "\xe2\x80\x98", // ‘ |
18 | 18 | 0x92 => "\xe2\x80\x99", // ’ |
19 | 19 | 0x93 => "\xe2\x80\x9c", // “ |
@@ -21,106 +21,106 @@ discard block |
||
21 | 21 | 0x95 => "\xe2\x80\xa2", // • |
22 | 22 | 0x96 => "\xe2\x80\x93", // – |
23 | 23 | 0x97 => "\xe2\x80\x94", // — |
24 | - 0x98 => "\xcb\x9c", // ˜ |
|
24 | + 0x98 => "\xcb\x9c", // ˜ |
|
25 | 25 | 0x99 => "\xe2\x84\xa2", // ™ |
26 | - 0x9a => "\xc5\xa1", // š |
|
26 | + 0x9a => "\xc5\xa1", // š |
|
27 | 27 | 0x9b => "\xe2\x80\xba", // › |
28 | - 0x9c => "\xc5\x93", // œ |
|
29 | - 0x9e => "\xc5\xbe", // ž |
|
30 | - 0x9f => "\xc5\xb8", // Ÿ |
|
28 | + 0x9c => "\xc5\x93", // œ |
|
29 | + 0x9e => "\xc5\xbe", // ž |
|
30 | + 0x9f => "\xc5\xb8", // Ÿ |
|
31 | 31 | 0xa0 => "\xc2\xa0", |
32 | - 0xa1 => "\xc2\xa1", // ¡ |
|
33 | - 0xa2 => "\xc2\xa2", // ¢ |
|
34 | - 0xa3 => "\xc2\xa3", // £ |
|
35 | - 0xa4 => "\xc2\xa4", // ¤ |
|
36 | - 0xa5 => "\xc2\xa5", // ¥ |
|
37 | - 0xa6 => "\xc2\xa6", // ¦ |
|
38 | - 0xa7 => "\xc2\xa7", // § |
|
39 | - 0xa8 => "\xc2\xa8", // ¨ |
|
40 | - 0xa9 => "\xc2\xa9", // © |
|
41 | - 0xaa => "\xc2\xaa", // ª |
|
42 | - 0xab => "\xc2\xab", // « |
|
43 | - 0xac => "\xc2\xac", // ¬ |
|
44 | - 0xad => "\xc2\xad", // |
|
45 | - 0xae => "\xc2\xae", // ® |
|
46 | - 0xaf => "\xc2\xaf", // ¯ |
|
47 | - 0xb0 => "\xc2\xb0", // ° |
|
48 | - 0xb1 => "\xc2\xb1", // ± |
|
49 | - 0xb2 => "\xc2\xb2", // ² |
|
50 | - 0xb3 => "\xc2\xb3", // ³ |
|
51 | - 0xb4 => "\xc2\xb4", // ´ |
|
52 | - 0xb5 => "\xc2\xb5", // µ |
|
53 | - 0xb6 => "\xc2\xb6", // ¶ |
|
54 | - 0xb7 => "\xc2\xb7", // · |
|
55 | - 0xb8 => "\xc2\xb8", // ¸ |
|
56 | - 0xb9 => "\xc2\xb9", // ¹ |
|
57 | - 0xba => "\xc2\xba", // º |
|
58 | - 0xbb => "\xc2\xbb", // » |
|
59 | - 0xbc => "\xc2\xbc", // ¼ |
|
60 | - 0xbd => "\xc2\xbd", // ½ |
|
61 | - 0xbe => "\xc2\xbe", // ¾ |
|
62 | - 0xbf => "\xc2\xbf", // ¿ |
|
63 | - 0xc0 => "\xc3\x80", // À |
|
64 | - 0xc1 => "\xc3\x81", // Á |
|
65 | - 0xc2 => "\xc3\x82", // Â |
|
66 | - 0xc3 => "\xc3\x83", // Ã |
|
67 | - 0xc4 => "\xc3\x84", // Ä |
|
68 | - 0xc5 => "\xc3\x85", // Å |
|
69 | - 0xc6 => "\xc3\x86", // Æ |
|
70 | - 0xc7 => "\xc3\x87", // Ç |
|
71 | - 0xc8 => "\xc3\x88", // È |
|
72 | - 0xc9 => "\xc3\x89", // É |
|
73 | - 0xca => "\xc3\x8a", // Ê |
|
74 | - 0xcb => "\xc3\x8b", // Ë |
|
75 | - 0xcc => "\xc3\x8c", // Ì |
|
76 | - 0xcd => "\xc3\x8d", // Í |
|
77 | - 0xce => "\xc3\x8e", // Î |
|
78 | - 0xcf => "\xc3\x8f", // Ï |
|
79 | - 0xd0 => "\xc3\x90", // Ð |
|
80 | - 0xd1 => "\xc3\x91", // Ñ |
|
81 | - 0xd2 => "\xc3\x92", // Ò |
|
82 | - 0xd3 => "\xc3\x93", // Ó |
|
83 | - 0xd4 => "\xc3\x94", // Ô |
|
84 | - 0xd5 => "\xc3\x95", // Õ |
|
85 | - 0xd6 => "\xc3\x96", // Ö |
|
86 | - 0xd7 => "\xc3\x97", // × |
|
87 | - 0xd8 => "\xc3\x98", // Ø |
|
88 | - 0xd9 => "\xc3\x99", // Ù |
|
89 | - 0xda => "\xc3\x9a", // Ú |
|
90 | - 0xdb => "\xc3\x9b", // Û |
|
91 | - 0xdc => "\xc3\x9c", // Ü |
|
92 | - 0xdd => "\xc3\x9d", // Ý |
|
93 | - 0xde => "\xc3\x9e", // Þ |
|
94 | - 0xdf => "\xc3\x9f", // ß |
|
95 | - 0xe0 => "\xc3\xa0", // à |
|
96 | - 0xe1 => "\xa1", // á |
|
97 | - 0xe2 => "\xc3\xa2", // â |
|
98 | - 0xe3 => "\xc3\xa3", // ã |
|
99 | - 0xe4 => "\xc3\xa4", // ä |
|
100 | - 0xe5 => "\xc3\xa5", // å |
|
101 | - 0xe6 => "\xc3\xa6", // æ |
|
102 | - 0xe7 => "\xc3\xa7", // ç |
|
103 | - 0xe8 => "\xc3\xa8", // è |
|
104 | - 0xe9 => "\xc3\xa9", // é |
|
105 | - 0xea => "\xc3\xaa", // ê |
|
106 | - 0xeb => "\xc3\xab", // ë |
|
107 | - 0xec => "\xc3\xac", // ì |
|
108 | - 0xed => "\xc3\xad", // í |
|
109 | - 0xee => "\xc3\xae", // î |
|
110 | - 0xef => "\xc3\xaf", // ï |
|
111 | - 0xf0 => "\xc3\xb0", // ð |
|
112 | - 0xf1 => "\xc3\xb1", // ñ |
|
113 | - 0xf2 => "\xc3\xb2", // ò |
|
114 | - 0xf3 => "\xc3\xb3", // ó |
|
115 | - 0xf4 => "\xc3\xb4", // ô |
|
116 | - 0xf5 => "\xc3\xb5", // õ |
|
117 | - 0xf6 => "\xc3\xb6", // ö |
|
118 | - 0xf7 => "\xc3\xb7", // ÷ |
|
119 | - 0xf8 => "\xc3\xb8", // ø |
|
120 | - 0xf9 => "\xc3\xb9", // ù |
|
121 | - 0xfa => "\xc3\xba", // ú |
|
122 | - 0xfb => "\xc3\xbb", // û |
|
123 | - 0xfc => "\xc3\xbc", // ü |
|
124 | - 0xfd => "\xc3\xbd", // ý |
|
125 | - 0xfe => "\xc3\xbe", // þ |
|
32 | + 0xa1 => "\xc2\xa1", // ¡ |
|
33 | + 0xa2 => "\xc2\xa2", // ¢ |
|
34 | + 0xa3 => "\xc2\xa3", // £ |
|
35 | + 0xa4 => "\xc2\xa4", // ¤ |
|
36 | + 0xa5 => "\xc2\xa5", // ¥ |
|
37 | + 0xa6 => "\xc2\xa6", // ¦ |
|
38 | + 0xa7 => "\xc2\xa7", // § |
|
39 | + 0xa8 => "\xc2\xa8", // ¨ |
|
40 | + 0xa9 => "\xc2\xa9", // © |
|
41 | + 0xaa => "\xc2\xaa", // ª |
|
42 | + 0xab => "\xc2\xab", // « |
|
43 | + 0xac => "\xc2\xac", // ¬ |
|
44 | + 0xad => "\xc2\xad", // |
|
45 | + 0xae => "\xc2\xae", // ® |
|
46 | + 0xaf => "\xc2\xaf", // ¯ |
|
47 | + 0xb0 => "\xc2\xb0", // ° |
|
48 | + 0xb1 => "\xc2\xb1", // ± |
|
49 | + 0xb2 => "\xc2\xb2", // ² |
|
50 | + 0xb3 => "\xc2\xb3", // ³ |
|
51 | + 0xb4 => "\xc2\xb4", // ´ |
|
52 | + 0xb5 => "\xc2\xb5", // µ |
|
53 | + 0xb6 => "\xc2\xb6", // ¶ |
|
54 | + 0xb7 => "\xc2\xb7", // · |
|
55 | + 0xb8 => "\xc2\xb8", // ¸ |
|
56 | + 0xb9 => "\xc2\xb9", // ¹ |
|
57 | + 0xba => "\xc2\xba", // º |
|
58 | + 0xbb => "\xc2\xbb", // » |
|
59 | + 0xbc => "\xc2\xbc", // ¼ |
|
60 | + 0xbd => "\xc2\xbd", // ½ |
|
61 | + 0xbe => "\xc2\xbe", // ¾ |
|
62 | + 0xbf => "\xc2\xbf", // ¿ |
|
63 | + 0xc0 => "\xc3\x80", // À |
|
64 | + 0xc1 => "\xc3\x81", // Á |
|
65 | + 0xc2 => "\xc3\x82", // Â |
|
66 | + 0xc3 => "\xc3\x83", // Ã |
|
67 | + 0xc4 => "\xc3\x84", // Ä |
|
68 | + 0xc5 => "\xc3\x85", // Å |
|
69 | + 0xc6 => "\xc3\x86", // Æ |
|
70 | + 0xc7 => "\xc3\x87", // Ç |
|
71 | + 0xc8 => "\xc3\x88", // È |
|
72 | + 0xc9 => "\xc3\x89", // É |
|
73 | + 0xca => "\xc3\x8a", // Ê |
|
74 | + 0xcb => "\xc3\x8b", // Ë |
|
75 | + 0xcc => "\xc3\x8c", // Ì |
|
76 | + 0xcd => "\xc3\x8d", // Í |
|
77 | + 0xce => "\xc3\x8e", // Î |
|
78 | + 0xcf => "\xc3\x8f", // Ï |
|
79 | + 0xd0 => "\xc3\x90", // Ð |
|
80 | + 0xd1 => "\xc3\x91", // Ñ |
|
81 | + 0xd2 => "\xc3\x92", // Ò |
|
82 | + 0xd3 => "\xc3\x93", // Ó |
|
83 | + 0xd4 => "\xc3\x94", // Ô |
|
84 | + 0xd5 => "\xc3\x95", // Õ |
|
85 | + 0xd6 => "\xc3\x96", // Ö |
|
86 | + 0xd7 => "\xc3\x97", // × |
|
87 | + 0xd8 => "\xc3\x98", // Ø |
|
88 | + 0xd9 => "\xc3\x99", // Ù |
|
89 | + 0xda => "\xc3\x9a", // Ú |
|
90 | + 0xdb => "\xc3\x9b", // Û |
|
91 | + 0xdc => "\xc3\x9c", // Ü |
|
92 | + 0xdd => "\xc3\x9d", // Ý |
|
93 | + 0xde => "\xc3\x9e", // Þ |
|
94 | + 0xdf => "\xc3\x9f", // ß |
|
95 | + 0xe0 => "\xc3\xa0", // à |
|
96 | + 0xe1 => "\xa1", // á |
|
97 | + 0xe2 => "\xc3\xa2", // â |
|
98 | + 0xe3 => "\xc3\xa3", // ã |
|
99 | + 0xe4 => "\xc3\xa4", // ä |
|
100 | + 0xe5 => "\xc3\xa5", // å |
|
101 | + 0xe6 => "\xc3\xa6", // æ |
|
102 | + 0xe7 => "\xc3\xa7", // ç |
|
103 | + 0xe8 => "\xc3\xa8", // è |
|
104 | + 0xe9 => "\xc3\xa9", // é |
|
105 | + 0xea => "\xc3\xaa", // ê |
|
106 | + 0xeb => "\xc3\xab", // ë |
|
107 | + 0xec => "\xc3\xac", // ì |
|
108 | + 0xed => "\xc3\xad", // í |
|
109 | + 0xee => "\xc3\xae", // î |
|
110 | + 0xef => "\xc3\xaf", // ï |
|
111 | + 0xf0 => "\xc3\xb0", // ð |
|
112 | + 0xf1 => "\xc3\xb1", // ñ |
|
113 | + 0xf2 => "\xc3\xb2", // ò |
|
114 | + 0xf3 => "\xc3\xb3", // ó |
|
115 | + 0xf4 => "\xc3\xb4", // ô |
|
116 | + 0xf5 => "\xc3\xb5", // õ |
|
117 | + 0xf6 => "\xc3\xb6", // ö |
|
118 | + 0xf7 => "\xc3\xb7", // ÷ |
|
119 | + 0xf8 => "\xc3\xb8", // ø |
|
120 | + 0xf9 => "\xc3\xb9", // ù |
|
121 | + 0xfa => "\xc3\xba", // ú |
|
122 | + 0xfb => "\xc3\xbb", // û |
|
123 | + 0xfc => "\xc3\xbc", // ü |
|
124 | + 0xfd => "\xc3\xbd", // ý |
|
125 | + 0xfe => "\xc3\xbe", // þ |
|
126 | 126 | ]; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | return false; |
71 | 71 | } |
72 | 72 | |
73 | - $uri = (string) $_SERVER['REQUEST_URI']; |
|
73 | + $uri = (string)$_SERVER['REQUEST_URI']; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | $uriOrig = $uri; |
@@ -87,17 +87,17 @@ discard block |
||
87 | 87 | // When not, assumes Windows-1252 and redirects to the corresponding UTF-8 encoded URL |
88 | 88 | // |
89 | 89 | |
90 | - $uri = (string) \preg_replace_callback( |
|
90 | + $uri = (string)\preg_replace_callback( |
|
91 | 91 | '/[\x80-\xFF]+/', |
92 | - static function ($m) { |
|
92 | + static function($m) { |
|
93 | 93 | return \rawurlencode($m[0]); |
94 | 94 | }, |
95 | 95 | $uri |
96 | 96 | ); |
97 | 97 | |
98 | - $uri = (string) \preg_replace_callback( |
|
98 | + $uri = (string)\preg_replace_callback( |
|
99 | 99 | '/(?:%[89A-F][0-9A-F])+/i', |
100 | - static function ($m) { |
|
100 | + static function($m) { |
|
101 | 101 | return \rawurlencode(UTF8::rawurldecode($m[0])); |
102 | 102 | }, |
103 | 103 | $uri |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | ) { |
113 | 113 | // Use ob_start() to buffer content and avoid problem of headers already sent... |
114 | 114 | $severProtocol = ($_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'); |
115 | - \header($severProtocol . ' 301 Moved Permanently'); |
|
116 | - \header('Location: ' . $uri); |
|
115 | + \header($severProtocol.' 301 Moved Permanently'); |
|
116 | + \header('Location: '.$uri); |
|
117 | 117 | exit(); |
118 | 118 | } |
119 | 119 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | return false; |
151 | 151 | } |
152 | 152 | |
153 | - $length = (int) $length; |
|
153 | + $length = (int)$length; |
|
154 | 154 | |
155 | 155 | if ($length <= 0) { |
156 | 156 | return false; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | { |
182 | 182 | static $_IS_PHP; |
183 | 183 | |
184 | - $version = (string) $version; |
|
184 | + $version = (string)$version; |
|
185 | 185 | |
186 | 186 | if (!isset($_IS_PHP[$version])) { |
187 | 187 | $_IS_PHP[$version] = \version_compare(\PHP_VERSION, $version, '>='); |