@@ -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 | /** |
@@ -985,7 +985,7 @@ discard block |
||
985 | 985 | if ($toEncoding === 'JSON') { |
986 | 986 | $return = self::json_encode($str); |
987 | 987 | if ($return === false) { |
988 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
988 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
989 | 989 | } |
990 | 990 | |
991 | 991 | return $return; |
@@ -1071,7 +1071,7 @@ discard block |
||
1071 | 1071 | && |
1072 | 1072 | self::$SUPPORT['mbstring'] === false |
1073 | 1073 | ) { |
1074 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $toEncoding . '" encoding', \E_USER_WARNING); |
|
1074 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$toEncoding.'" encoding', \E_USER_WARNING); |
|
1075 | 1075 | } |
1076 | 1076 | |
1077 | 1077 | if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) { |
@@ -1160,18 +1160,18 @@ discard block |
||
1160 | 1160 | $trimChars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1161 | 1161 | |
1162 | 1162 | if ($length === null) { |
1163 | - $length = (int) \round(self::strlen($str, $encoding) / 2, 0); |
|
1163 | + $length = (int)\round(self::strlen($str, $encoding) / 2, 0); |
|
1164 | 1164 | } |
1165 | 1165 | |
1166 | 1166 | if (empty($search)) { |
1167 | 1167 | if ($length > 0) { |
1168 | - $stringLength = (int) self::strlen($str, $encoding); |
|
1168 | + $stringLength = (int)self::strlen($str, $encoding); |
|
1169 | 1169 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
1170 | 1170 | } else { |
1171 | 1171 | $end = 0; |
1172 | 1172 | } |
1173 | 1173 | |
1174 | - $pos = (int) \min( |
|
1174 | + $pos = (int)\min( |
|
1175 | 1175 | self::strpos($str, ' ', $end, $encoding), |
1176 | 1176 | self::strpos($str, '.', $end, $encoding) |
1177 | 1177 | ); |
@@ -1182,20 +1182,20 @@ discard block |
||
1182 | 1182 | return ''; |
1183 | 1183 | } |
1184 | 1184 | |
1185 | - return \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1185 | + return \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1186 | 1186 | } |
1187 | 1187 | |
1188 | 1188 | return $str; |
1189 | 1189 | } |
1190 | 1190 | |
1191 | 1191 | $wordPos = self::stripos($str, $search, 0, $encoding); |
1192 | - $halfSide = (int) ($wordPos - $length / 2 + self::strlen($search, $encoding) / 2); |
|
1192 | + $halfSide = (int)($wordPos - $length / 2 + self::strlen($search, $encoding) / 2); |
|
1193 | 1193 | |
1194 | 1194 | $pos_start = 0; |
1195 | 1195 | if ($halfSide > 0) { |
1196 | 1196 | $halfText = self::substr($str, 0, $halfSide, $encoding); |
1197 | 1197 | if ($halfText !== false) { |
1198 | - $pos_start = (int) \max( |
|
1198 | + $pos_start = (int)\max( |
|
1199 | 1199 | self::strrpos($halfText, ' ', 0, $encoding), |
1200 | 1200 | self::strrpos($halfText, '.', 0, $encoding) |
1201 | 1201 | ); |
@@ -1204,35 +1204,35 @@ discard block |
||
1204 | 1204 | |
1205 | 1205 | if ($wordPos && $halfSide > 0) { |
1206 | 1206 | $offset = $pos_start + $length - 1; |
1207 | - $realLength = (int) self::strlen($str, $encoding); |
|
1207 | + $realLength = (int)self::strlen($str, $encoding); |
|
1208 | 1208 | |
1209 | 1209 | if ($offset > $realLength) { |
1210 | 1210 | $offset = $realLength; |
1211 | 1211 | } |
1212 | 1212 | |
1213 | - $pos_end = (int) \min( |
|
1213 | + $pos_end = (int)\min( |
|
1214 | 1214 | self::strpos($str, ' ', $offset, $encoding), |
1215 | 1215 | self::strpos($str, '.', $offset, $encoding) |
1216 | 1216 | ) - $pos_start; |
1217 | 1217 | |
1218 | 1218 | if (!$pos_end || $pos_end <= 0) { |
1219 | - $strSub = self::substr($str, $pos_start, (int) self::strlen($str), $encoding); |
|
1219 | + $strSub = self::substr($str, $pos_start, (int)self::strlen($str), $encoding); |
|
1220 | 1220 | if ($strSub !== false) { |
1221 | - $extract = $replacerForSkippedText . \ltrim($strSub, $trimChars); |
|
1221 | + $extract = $replacerForSkippedText.\ltrim($strSub, $trimChars); |
|
1222 | 1222 | } else { |
1223 | 1223 | $extract = ''; |
1224 | 1224 | } |
1225 | 1225 | } else { |
1226 | 1226 | $strSub = self::substr($str, $pos_start, $pos_end, $encoding); |
1227 | 1227 | if ($strSub !== false) { |
1228 | - $extract = $replacerForSkippedText . \trim($strSub, $trimChars) . $replacerForSkippedText; |
|
1228 | + $extract = $replacerForSkippedText.\trim($strSub, $trimChars).$replacerForSkippedText; |
|
1229 | 1229 | } else { |
1230 | 1230 | $extract = ''; |
1231 | 1231 | } |
1232 | 1232 | } |
1233 | 1233 | } else { |
1234 | 1234 | $offset = $length - 1; |
1235 | - $trueLength = (int) self::strlen($str, $encoding); |
|
1235 | + $trueLength = (int)self::strlen($str, $encoding); |
|
1236 | 1236 | |
1237 | 1237 | if ($offset > $trueLength) { |
1238 | 1238 | $offset = $trueLength; |
@@ -1246,7 +1246,7 @@ discard block |
||
1246 | 1246 | if ($pos_end) { |
1247 | 1247 | $strSub = self::substr($str, 0, $pos_end, $encoding); |
1248 | 1248 | if ($strSub !== false) { |
1249 | - $extract = \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
1249 | + $extract = \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
1250 | 1250 | } else { |
1251 | 1251 | $extract = ''; |
1252 | 1252 | } |
@@ -1366,7 +1366,7 @@ discard block |
||
1366 | 1366 | { |
1367 | 1367 | $file_content = \file_get_contents($file_path); |
1368 | 1368 | if ($file_content === false) { |
1369 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1369 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1370 | 1370 | } |
1371 | 1371 | |
1372 | 1372 | return self::string_has_bom($file_content); |
@@ -1428,7 +1428,7 @@ discard block |
||
1428 | 1428 | ) { |
1429 | 1429 | // Prevent leading combining chars |
1430 | 1430 | // for NFC-safe concatenations. |
1431 | - $var = $leading_combining . $var; |
|
1431 | + $var = $leading_combining.$var; |
|
1432 | 1432 | } |
1433 | 1433 | } |
1434 | 1434 | |
@@ -1736,7 +1736,7 @@ discard block |
||
1736 | 1736 | return $str; |
1737 | 1737 | } |
1738 | 1738 | |
1739 | - $str = (string) $str; |
|
1739 | + $str = (string)$str; |
|
1740 | 1740 | $last = ''; |
1741 | 1741 | while ($last !== $str) { |
1742 | 1742 | $last = $str; |
@@ -1921,7 +1921,7 @@ discard block |
||
1921 | 1921 | } |
1922 | 1922 | |
1923 | 1923 | $str_info = \unpack('C2chars', $str_info); |
1924 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
1924 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
1925 | 1925 | |
1926 | 1926 | // DEBUG |
1927 | 1927 | //var_dump($type_code); |
@@ -2034,16 +2034,16 @@ discard block |
||
2034 | 2034 | */ |
2035 | 2035 | public static function get_unique_string($entropyExtra = '', bool $md5 = true): string |
2036 | 2036 | { |
2037 | - $uniqueHelper = \random_int(0, \mt_getrandmax()) . |
|
2038 | - \session_id() . |
|
2039 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2040 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2037 | + $uniqueHelper = \random_int(0, \mt_getrandmax()). |
|
2038 | + \session_id(). |
|
2039 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2040 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2041 | 2041 | $entropyExtra; |
2042 | 2042 | |
2043 | 2043 | $uniqueString = \uniqid($uniqueHelper, true); |
2044 | 2044 | |
2045 | 2045 | if ($md5) { |
2046 | - $uniqueString = \md5($uniqueString . $uniqueHelper); |
|
2046 | + $uniqueString = \md5($uniqueString.$uniqueHelper); |
|
2047 | 2047 | } |
2048 | 2048 | |
2049 | 2049 | return $uniqueString; |
@@ -2113,7 +2113,7 @@ discard block |
||
2113 | 2113 | public static function hex_to_int($hexDec) |
2114 | 2114 | { |
2115 | 2115 | // init |
2116 | - $hexDec = (string) $hexDec; |
|
2116 | + $hexDec = (string)$hexDec; |
|
2117 | 2117 | |
2118 | 2118 | if ($hexDec === '') { |
2119 | 2119 | return false; |
@@ -2188,7 +2188,7 @@ discard block |
||
2188 | 2188 | return \implode( |
2189 | 2189 | '', |
2190 | 2190 | \array_map( |
2191 | - static function ($chr) use ($keepAsciiChars, $encoding) { |
|
2191 | + static function($chr) use ($keepAsciiChars, $encoding) { |
|
2192 | 2192 | return self::single_chr_html_encode($chr, $keepAsciiChars, $encoding); |
2193 | 2193 | }, |
2194 | 2194 | self::split($str) |
@@ -2304,7 +2304,7 @@ discard block |
||
2304 | 2304 | && |
2305 | 2305 | self::$SUPPORT['mbstring'] === false |
2306 | 2306 | ) { |
2307 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2307 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2308 | 2308 | } |
2309 | 2309 | |
2310 | 2310 | if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) { |
@@ -2322,9 +2322,9 @@ discard block |
||
2322 | 2322 | $encoding |
2323 | 2323 | ); |
2324 | 2324 | } else { |
2325 | - $str = (string) \preg_replace_callback( |
|
2325 | + $str = (string)\preg_replace_callback( |
|
2326 | 2326 | "/&#\d{2,6};/", |
2327 | - static function ($matches) use ($encoding) { |
|
2327 | + static function($matches) use ($encoding) { |
|
2328 | 2328 | // always fallback via symfony polyfill |
2329 | 2329 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
2330 | 2330 | |
@@ -2340,7 +2340,7 @@ discard block |
||
2340 | 2340 | |
2341 | 2341 | // decode numeric & UTF16 two byte entities |
2342 | 2342 | $str = \html_entity_decode( |
2343 | - (string) \preg_replace('/(&#(?:x0*[0-9a-f]{2,6}(?![0-9a-f;])|(?:0*\d{2,6}(?![0-9;]))))/iS', '$1;', $str), |
|
2343 | + (string)\preg_replace('/(&#(?:x0*[0-9a-f]{2,6}(?![0-9a-f;])|(?:0*\d{2,6}(?![0-9;]))))/iS', '$1;', $str), |
|
2344 | 2344 | $flags, |
2345 | 2345 | $encoding |
2346 | 2346 | ); |
@@ -2377,7 +2377,7 @@ discard block |
||
2377 | 2377 | */ |
2378 | 2378 | public static function html_stripe_empty_tags(string $str): string |
2379 | 2379 | { |
2380 | - return (string) \preg_replace( |
|
2380 | + return (string)\preg_replace( |
|
2381 | 2381 | "/<[^\/>]*>(([\s]?)*|)<\/[^>]*>/iu", |
2382 | 2382 | '', |
2383 | 2383 | $str |
@@ -2666,9 +2666,9 @@ discard block |
||
2666 | 2666 | { |
2667 | 2667 | $hex = \dechex($int); |
2668 | 2668 | |
2669 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
2669 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
2670 | 2670 | |
2671 | - return $pfix . $hex . ''; |
|
2671 | + return $pfix.$hex.''; |
|
2672 | 2672 | } |
2673 | 2673 | |
2674 | 2674 | /** |
@@ -2906,7 +2906,7 @@ discard block |
||
2906 | 2906 | return false; |
2907 | 2907 | } |
2908 | 2908 | |
2909 | - $base64String = (string) \base64_decode($str, true); |
|
2909 | + $base64String = (string)\base64_decode($str, true); |
|
2910 | 2910 | |
2911 | 2911 | return $base64String && \base64_encode($base64String) === $str; |
2912 | 2912 | } |
@@ -2921,7 +2921,7 @@ discard block |
||
2921 | 2921 | */ |
2922 | 2922 | public static function is_binary($input, bool $strict = false): bool |
2923 | 2923 | { |
2924 | - $input = (string) $input; |
|
2924 | + $input = (string)$input; |
|
2925 | 2925 | if ($input === '') { |
2926 | 2926 | return false; |
2927 | 2927 | } |
@@ -3164,7 +3164,7 @@ discard block |
||
3164 | 3164 | public static function is_utf16($str, $checkIfStringIsBinary = true) |
3165 | 3165 | { |
3166 | 3166 | // init |
3167 | - $str = (string) $str; |
|
3167 | + $str = (string)$str; |
|
3168 | 3168 | $strChars = []; |
3169 | 3169 | |
3170 | 3170 | if ( |
@@ -3240,7 +3240,7 @@ discard block |
||
3240 | 3240 | public static function is_utf32($str, $checkIfStringIsBinary = true) |
3241 | 3241 | { |
3242 | 3242 | // init |
3243 | - $str = (string) $str; |
|
3243 | + $str = (string)$str; |
|
3244 | 3244 | $strChars = []; |
3245 | 3245 | |
3246 | 3246 | if ( |
@@ -3362,7 +3362,7 @@ discard block |
||
3362 | 3362 | self::$ORD = self::getData('ord'); |
3363 | 3363 | } |
3364 | 3364 | |
3365 | - $len = self::strlen_in_byte((string) $str); |
|
3365 | + $len = self::strlen_in_byte((string)$str); |
|
3366 | 3366 | /** @noinspection ForeachInvariantsInspection */ |
3367 | 3367 | for ($i = 0; $i < $len; ++$i) { |
3368 | 3368 | $in = self::$ORD[$str[$i]]; |
@@ -3597,14 +3597,14 @@ discard block |
||
3597 | 3597 | } |
3598 | 3598 | |
3599 | 3599 | $strPartOne = self::strtolower( |
3600 | - (string) self::substr($str, 0, 1, $encoding, $cleanUtf8), |
|
3600 | + (string)self::substr($str, 0, 1, $encoding, $cleanUtf8), |
|
3601 | 3601 | $encoding, |
3602 | 3602 | $cleanUtf8, |
3603 | 3603 | $lang, |
3604 | 3604 | $tryToKeepStringLength |
3605 | 3605 | ); |
3606 | 3606 | |
3607 | - return $strPartOne . $strPartTwo; |
|
3607 | + return $strPartOne.$strPartTwo; |
|
3608 | 3608 | } |
3609 | 3609 | |
3610 | 3610 | /** |
@@ -3768,7 +3768,7 @@ discard block |
||
3768 | 3768 | { |
3769 | 3769 | $bytes = self::chr_size_list($str); |
3770 | 3770 | if (\count($bytes) > 0) { |
3771 | - return (int) \max($bytes); |
|
3771 | + return (int)\max($bytes); |
|
3772 | 3772 | } |
3773 | 3773 | |
3774 | 3774 | return 0; |
@@ -3843,7 +3843,7 @@ discard block |
||
3843 | 3843 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
3844 | 3844 | |
3845 | 3845 | // init |
3846 | - $encoding = (string) $encoding; |
|
3846 | + $encoding = (string)$encoding; |
|
3847 | 3847 | |
3848 | 3848 | if ( |
3849 | 3849 | !$encoding |
@@ -3981,7 +3981,7 @@ discard block |
||
3981 | 3981 | */ |
3982 | 3982 | public static function normalize_line_ending(string $str): string |
3983 | 3983 | { |
3984 | - return (string) \str_replace(["\r\n", "\r"], "\n", $str); |
|
3984 | + return (string)\str_replace(["\r\n", "\r"], "\n", $str); |
|
3985 | 3985 | } |
3986 | 3986 | |
3987 | 3987 | /** |
@@ -4029,7 +4029,7 @@ discard block |
||
4029 | 4029 | } |
4030 | 4030 | |
4031 | 4031 | static $WHITESPACE_CACHE = []; |
4032 | - $cacheKey = (int) $keepNonBreakingSpace; |
|
4032 | + $cacheKey = (int)$keepNonBreakingSpace; |
|
4033 | 4033 | |
4034 | 4034 | if (!isset($WHITESPACE_CACHE[$cacheKey])) { |
4035 | 4035 | $WHITESPACE_CACHE[$cacheKey] = self::$WHITESPACE_TABLE; |
@@ -4069,7 +4069,7 @@ discard block |
||
4069 | 4069 | public static function ord($chr, string $encoding = 'UTF-8'): int |
4070 | 4070 | { |
4071 | 4071 | // init |
4072 | - $chr = (string) $chr; |
|
4072 | + $chr = (string)$chr; |
|
4073 | 4073 | |
4074 | 4074 | static $CHAR_CACHE = []; |
4075 | 4075 | |
@@ -4080,7 +4080,7 @@ discard block |
||
4080 | 4080 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4081 | 4081 | } |
4082 | 4082 | |
4083 | - $cacheKey = $chr_orig . $encoding; |
|
4083 | + $cacheKey = $chr_orig.$encoding; |
|
4084 | 4084 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
4085 | 4085 | return $CHAR_CACHE[$cacheKey]; |
4086 | 4086 | } |
@@ -4111,22 +4111,22 @@ discard block |
||
4111 | 4111 | } |
4112 | 4112 | |
4113 | 4113 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
4114 | - $chr = \unpack('C*', (string) self::substr($chr, 0, 4, 'CP850')); |
|
4114 | + $chr = \unpack('C*', (string)self::substr($chr, 0, 4, 'CP850')); |
|
4115 | 4115 | $code = $chr ? $chr[1] : 0; |
4116 | 4116 | |
4117 | 4117 | if ($code >= 0xF0 && isset($chr[4])) { |
4118 | 4118 | /** @noinspection UnnecessaryCastingInspection */ |
4119 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4119 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4120 | 4120 | } |
4121 | 4121 | |
4122 | 4122 | if ($code >= 0xE0 && isset($chr[3])) { |
4123 | 4123 | /** @noinspection UnnecessaryCastingInspection */ |
4124 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4124 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4125 | 4125 | } |
4126 | 4126 | |
4127 | 4127 | if ($code >= 0xC0 && isset($chr[2])) { |
4128 | 4128 | /** @noinspection UnnecessaryCastingInspection */ |
4129 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4129 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4130 | 4130 | } |
4131 | 4131 | |
4132 | 4132 | return $CHAR_CACHE[$cacheKey] = $code; |
@@ -4179,7 +4179,7 @@ discard block |
||
4179 | 4179 | public static function pcre_utf8_support(): bool |
4180 | 4180 | { |
4181 | 4181 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4182 | - return (bool) @\preg_match('//u', ''); |
|
4182 | + return (bool)@\preg_match('//u', ''); |
|
4183 | 4183 | } |
4184 | 4184 | |
4185 | 4185 | /** |
@@ -4205,10 +4205,10 @@ discard block |
||
4205 | 4205 | } |
4206 | 4206 | |
4207 | 4207 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4208 | - if (\ctype_digit((string) $var1)) { |
|
4209 | - $start = (int) $var1; |
|
4208 | + if (\ctype_digit((string)$var1)) { |
|
4209 | + $start = (int)$var1; |
|
4210 | 4210 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var1)) { |
4211 | - $start = (int) self::hex_to_int($var1); |
|
4211 | + $start = (int)self::hex_to_int($var1); |
|
4212 | 4212 | } else { |
4213 | 4213 | $start = self::ord($var1); |
4214 | 4214 | } |
@@ -4218,10 +4218,10 @@ discard block |
||
4218 | 4218 | } |
4219 | 4219 | |
4220 | 4220 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4221 | - if (\ctype_digit((string) $var2)) { |
|
4222 | - $end = (int) $var2; |
|
4221 | + if (\ctype_digit((string)$var2)) { |
|
4222 | + $end = (int)$var2; |
|
4223 | 4223 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var2)) { |
4224 | - $end = (int) self::hex_to_int($var2); |
|
4224 | + $end = (int)self::hex_to_int($var2); |
|
4225 | 4225 | } else { |
4226 | 4226 | $end = self::ord($var2); |
4227 | 4227 | } |
@@ -4231,8 +4231,8 @@ discard block |
||
4231 | 4231 | } |
4232 | 4232 | |
4233 | 4233 | return \array_map( |
4234 | - static function ($i) { |
|
4235 | - return (string) self::chr($i); |
|
4234 | + static function($i) { |
|
4235 | + return (string)self::chr($i); |
|
4236 | 4236 | }, |
4237 | 4237 | \range($start, $end) |
4238 | 4238 | ); |
@@ -4265,7 +4265,7 @@ discard block |
||
4265 | 4265 | |
4266 | 4266 | $pattern = '/%u([0-9a-f]{3,4})/i'; |
4267 | 4267 | if (\preg_match($pattern, $str)) { |
4268 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
4268 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
4269 | 4269 | } |
4270 | 4270 | |
4271 | 4271 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -4308,8 +4308,8 @@ discard block |
||
4308 | 4308 | $delimiter = '/'; |
4309 | 4309 | } |
4310 | 4310 | |
4311 | - return (string) \preg_replace( |
|
4312 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
4311 | + return (string)\preg_replace( |
|
4312 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
4313 | 4313 | $replacement, |
4314 | 4314 | $str |
4315 | 4315 | ); |
@@ -4352,9 +4352,9 @@ discard block |
||
4352 | 4352 | return ''; |
4353 | 4353 | } |
4354 | 4354 | |
4355 | - $strLength -= (int) $bomByteLength; |
|
4355 | + $strLength -= (int)$bomByteLength; |
|
4356 | 4356 | |
4357 | - $str = (string) $strTmp; |
|
4357 | + $str = (string)$strTmp; |
|
4358 | 4358 | } |
4359 | 4359 | } |
4360 | 4360 | |
@@ -4378,7 +4378,7 @@ discard block |
||
4378 | 4378 | if (\is_array($what) === true) { |
4379 | 4379 | /** @noinspection ForeachSourceInspection */ |
4380 | 4380 | foreach ($what as $item) { |
4381 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/', $item, $str); |
|
4381 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/', $item, $str); |
|
4382 | 4382 | } |
4383 | 4383 | } |
4384 | 4384 | |
@@ -4410,7 +4410,7 @@ discard block |
||
4410 | 4410 | */ |
4411 | 4411 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
4412 | 4412 | { |
4413 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4413 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
4414 | 4414 | } |
4415 | 4415 | |
4416 | 4416 | /** |
@@ -4441,7 +4441,7 @@ discard block |
||
4441 | 4441 | $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
4442 | 4442 | |
4443 | 4443 | do { |
4444 | - $str = (string) \preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4444 | + $str = (string)\preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
4445 | 4445 | } while ($count !== 0); |
4446 | 4446 | |
4447 | 4447 | return $str; |
@@ -4459,9 +4459,9 @@ discard block |
||
4459 | 4459 | public static function remove_left(string $str, string $substring, string $encoding = 'UTF-8'): string |
4460 | 4460 | { |
4461 | 4461 | if (self::str_starts_with($str, $substring)) { |
4462 | - return (string) self::substr( |
|
4462 | + return (string)self::substr( |
|
4463 | 4463 | $str, |
4464 | - (int) self::strlen($substring, $encoding), |
|
4464 | + (int)self::strlen($substring, $encoding), |
|
4465 | 4465 | null, |
4466 | 4466 | $encoding |
4467 | 4467 | ); |
@@ -4482,7 +4482,7 @@ discard block |
||
4482 | 4482 | public static function remove_right(string $str, string $substring, string $encoding = 'UTF-8'): string |
4483 | 4483 | { |
4484 | 4484 | if (self::str_ends_with($str, $substring)) { |
4485 | - return (string) self::substr( |
|
4485 | + return (string)self::substr( |
|
4486 | 4486 | $str, |
4487 | 4487 | 0, |
4488 | 4488 | self::strlen($str, $encoding) - self::strlen($substring, $encoding) |
@@ -4619,7 +4619,7 @@ discard block |
||
4619 | 4619 | |
4620 | 4620 | echo '<pre>'; |
4621 | 4621 | foreach (self::$SUPPORT as $key => $value) { |
4622 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
4622 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
4623 | 4623 | } |
4624 | 4624 | echo '</pre>'; |
4625 | 4625 | } |
@@ -4651,7 +4651,7 @@ discard block |
||
4651 | 4651 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4652 | 4652 | } |
4653 | 4653 | |
4654 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
4654 | + return '&#'.self::ord($char, $encoding).';'; |
|
4655 | 4655 | } |
4656 | 4656 | |
4657 | 4657 | /** |
@@ -4689,7 +4689,7 @@ discard block |
||
4689 | 4689 | } |
4690 | 4690 | |
4691 | 4691 | // init |
4692 | - $str = (string) $str; |
|
4692 | + $str = (string)$str; |
|
4693 | 4693 | |
4694 | 4694 | if ($str === '') { |
4695 | 4695 | return []; |
@@ -4732,7 +4732,7 @@ discard block |
||
4732 | 4732 | ($str[$i] & "\xE0") === "\xC0" |
4733 | 4733 | ) { |
4734 | 4734 | if (($str[$i + 1] & "\xC0") === "\x80") { |
4735 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
4735 | + $ret[] = $str[$i].$str[$i + 1]; |
|
4736 | 4736 | |
4737 | 4737 | ++$i; |
4738 | 4738 | } |
@@ -4746,7 +4746,7 @@ discard block |
||
4746 | 4746 | && |
4747 | 4747 | ($str[$i + 2] & "\xC0") === "\x80" |
4748 | 4748 | ) { |
4749 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
4749 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
4750 | 4750 | |
4751 | 4751 | $i += 2; |
4752 | 4752 | } |
@@ -4762,7 +4762,7 @@ discard block |
||
4762 | 4762 | && |
4763 | 4763 | ($str[$i + 3] & "\xC0") === "\x80" |
4764 | 4764 | ) { |
4765 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
4765 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
4766 | 4766 | |
4767 | 4767 | $i += 3; |
4768 | 4768 | } |
@@ -4774,7 +4774,7 @@ discard block |
||
4774 | 4774 | $ret = \array_chunk($ret, $length); |
4775 | 4775 | |
4776 | 4776 | return \array_map( |
4777 | - static function ($item) { |
|
4777 | + static function($item) { |
|
4778 | 4778 | return \implode('', $item); |
4779 | 4779 | }, |
4780 | 4780 | $ret |
@@ -4804,11 +4804,11 @@ discard block |
||
4804 | 4804 | public static function str_camelize(string $str, string $encoding = 'UTF-8', bool $cleanUtf8 = false, string $lang = null, bool $tryToKeepStringLength = false): string |
4805 | 4805 | { |
4806 | 4806 | $str = self::lcfirst(self::trim($str), $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
4807 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
4807 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
4808 | 4808 | |
4809 | - $str = (string) \preg_replace_callback( |
|
4809 | + $str = (string)\preg_replace_callback( |
|
4810 | 4810 | '/[-_\s]+(.)?/u', |
4811 | - static function ($match) use ($encoding, $cleanUtf8, $lang, $tryToKeepStringLength) { |
|
4811 | + static function($match) use ($encoding, $cleanUtf8, $lang, $tryToKeepStringLength) { |
|
4812 | 4812 | if (isset($match[1])) { |
4813 | 4813 | return self::strtoupper($match[1], $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
4814 | 4814 | } |
@@ -4818,9 +4818,9 @@ discard block |
||
4818 | 4818 | $str |
4819 | 4819 | ); |
4820 | 4820 | |
4821 | - return (string) \preg_replace_callback( |
|
4821 | + return (string)\preg_replace_callback( |
|
4822 | 4822 | '/[\d]+(.)?/u', |
4823 | - static function ($match) use ($encoding, $cleanUtf8, $lang, $tryToKeepStringLength) { |
|
4823 | + static function($match) use ($encoding, $cleanUtf8, $lang, $tryToKeepStringLength) { |
|
4824 | 4824 | return self::strtoupper($match[0], $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
4825 | 4825 | }, |
4826 | 4826 | $str |
@@ -4864,7 +4864,7 @@ discard block |
||
4864 | 4864 | |
4865 | 4865 | // only a fallback to prevent BC in the api ... |
4866 | 4866 | if ($caseSensitive !== false && $caseSensitive !== true) { |
4867 | - $encoding = (string) $caseSensitive; |
|
4867 | + $encoding = (string)$caseSensitive; |
|
4868 | 4868 | } |
4869 | 4869 | |
4870 | 4870 | if ($caseSensitive) { |
@@ -4898,7 +4898,7 @@ discard block |
||
4898 | 4898 | |
4899 | 4899 | // only a fallback to prevent BC in the api ... |
4900 | 4900 | if ($caseSensitive !== false && $caseSensitive !== true) { |
4901 | - $encoding = (string) $caseSensitive; |
|
4901 | + $encoding = (string)$caseSensitive; |
|
4902 | 4902 | } |
4903 | 4903 | |
4904 | 4904 | foreach ($needles as $needle) { |
@@ -4980,11 +4980,11 @@ discard block |
||
4980 | 4980 | ): string { |
4981 | 4981 | $str = self::trim($str); |
4982 | 4982 | |
4983 | - $str = (string) \preg_replace('/\B([A-Z])/u', '-\1', $str); |
|
4983 | + $str = (string)\preg_replace('/\B([A-Z])/u', '-\1', $str); |
|
4984 | 4984 | |
4985 | 4985 | $str = self::strtolower($str, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
4986 | 4986 | |
4987 | - return (string) \preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
4987 | + return (string)\preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
4988 | 4988 | } |
4989 | 4989 | |
4990 | 4990 | /** |
@@ -4999,7 +4999,7 @@ discard block |
||
4999 | 4999 | public static function str_detect_encoding($str) |
5000 | 5000 | { |
5001 | 5001 | // init |
5002 | - $str = (string) $str; |
|
5002 | + $str = (string)$str; |
|
5003 | 5003 | |
5004 | 5004 | // |
5005 | 5005 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5105,7 +5105,7 @@ discard block |
||
5105 | 5105 | foreach (self::$ENCODINGS as $encodingTmp) { |
5106 | 5106 | // INFO: //IGNORE but still throw notice |
5107 | 5107 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5108 | - if ((string) @\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str) === $str) { |
|
5108 | + if ((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str) === $str) { |
|
5109 | 5109 | return $encodingTmp; |
5110 | 5110 | } |
5111 | 5111 | } |
@@ -5167,7 +5167,7 @@ discard block |
||
5167 | 5167 | public static function str_ensure_left(string $str, string $substring): string |
5168 | 5168 | { |
5169 | 5169 | if (!self::str_starts_with($str, $substring)) { |
5170 | - $str = $substring . $str; |
|
5170 | + $str = $substring.$str; |
|
5171 | 5171 | } |
5172 | 5172 | |
5173 | 5173 | return $str; |
@@ -5363,7 +5363,7 @@ discard block |
||
5363 | 5363 | */ |
5364 | 5364 | public static function str_insert(string $str, string $substring, int $index, string $encoding = 'UTF-8'): string |
5365 | 5365 | { |
5366 | - $len = (int) self::strlen($str, $encoding); |
|
5366 | + $len = (int)self::strlen($str, $encoding); |
|
5367 | 5367 | |
5368 | 5368 | if ($index > $len) { |
5369 | 5369 | return $str; |
@@ -5372,7 +5372,7 @@ discard block |
||
5372 | 5372 | $start = self::substr($str, 0, $index, $encoding); |
5373 | 5373 | $end = self::substr($str, $index, $len, $encoding); |
5374 | 5374 | |
5375 | - return $start . $substring . $end; |
|
5375 | + return $start.$substring.$end; |
|
5376 | 5376 | } |
5377 | 5377 | |
5378 | 5378 | /** |
@@ -5402,15 +5402,15 @@ discard block |
||
5402 | 5402 | */ |
5403 | 5403 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
5404 | 5404 | { |
5405 | - $search = (array) $search; |
|
5405 | + $search = (array)$search; |
|
5406 | 5406 | |
5407 | 5407 | /** @noinspection AlterInForeachInspection */ |
5408 | 5408 | foreach ($search as &$s) { |
5409 | - $s = (string) $s; |
|
5409 | + $s = (string)$s; |
|
5410 | 5410 | if ($s === '') { |
5411 | 5411 | $s = '/^(?<=.)$/'; |
5412 | 5412 | } else { |
5413 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
5413 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
5414 | 5414 | } |
5415 | 5415 | } |
5416 | 5416 | |
@@ -5442,11 +5442,11 @@ discard block |
||
5442 | 5442 | } |
5443 | 5443 | |
5444 | 5444 | if ($search === '') { |
5445 | - return $str . $replacement; |
|
5445 | + return $str.$replacement; |
|
5446 | 5446 | } |
5447 | 5447 | |
5448 | 5448 | if (\stripos($str, $search) === 0) { |
5449 | - return $replacement . \substr($str, \strlen($search)); |
|
5449 | + return $replacement.\substr($str, \strlen($search)); |
|
5450 | 5450 | } |
5451 | 5451 | |
5452 | 5452 | return $str; |
@@ -5474,11 +5474,11 @@ discard block |
||
5474 | 5474 | } |
5475 | 5475 | |
5476 | 5476 | if ($search === '') { |
5477 | - return $str . $replacement; |
|
5477 | + return $str.$replacement; |
|
5478 | 5478 | } |
5479 | 5479 | |
5480 | 5480 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
5481 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
5481 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
5482 | 5482 | } |
5483 | 5483 | |
5484 | 5484 | return $str; |
@@ -5554,7 +5554,7 @@ discard block |
||
5554 | 5554 | return ''; |
5555 | 5555 | } |
5556 | 5556 | |
5557 | - return (string) self::substr( |
|
5557 | + return (string)self::substr( |
|
5558 | 5558 | $str, |
5559 | 5559 | $offset + self::strlen($separator, $encoding), |
5560 | 5560 | null, |
@@ -5586,7 +5586,7 @@ discard block |
||
5586 | 5586 | return ''; |
5587 | 5587 | } |
5588 | 5588 | |
5589 | - return (string) self::substr( |
|
5589 | + return (string)self::substr( |
|
5590 | 5590 | $str, |
5591 | 5591 | $offset + self::strlen($separator, $encoding), |
5592 | 5592 | null, |
@@ -5618,7 +5618,7 @@ discard block |
||
5618 | 5618 | return ''; |
5619 | 5619 | } |
5620 | 5620 | |
5621 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
5621 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
5622 | 5622 | } |
5623 | 5623 | |
5624 | 5624 | /** |
@@ -5645,7 +5645,7 @@ discard block |
||
5645 | 5645 | return ''; |
5646 | 5646 | } |
5647 | 5647 | |
5648 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
5648 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
5649 | 5649 | } |
5650 | 5650 | |
5651 | 5651 | /** |
@@ -5753,7 +5753,7 @@ discard block |
||
5753 | 5753 | return $str; |
5754 | 5754 | } |
5755 | 5755 | |
5756 | - return self::substr($str, 0, $length - self::strlen($strAddOn), $encoding) . $strAddOn; |
|
5756 | + return self::substr($str, 0, $length - self::strlen($strAddOn), $encoding).$strAddOn; |
|
5757 | 5757 | } |
5758 | 5758 | |
5759 | 5759 | /** |
@@ -5781,18 +5781,18 @@ discard block |
||
5781 | 5781 | } |
5782 | 5782 | |
5783 | 5783 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
5784 | - return self::substr($str, 0, $length - 1, $encoding) . $strAddOn; |
|
5784 | + return self::substr($str, 0, $length - 1, $encoding).$strAddOn; |
|
5785 | 5785 | } |
5786 | 5786 | |
5787 | - $str = (string) self::substr($str, 0, $length, $encoding); |
|
5787 | + $str = (string)self::substr($str, 0, $length, $encoding); |
|
5788 | 5788 | $array = \explode(' ', $str); |
5789 | 5789 | \array_pop($array); |
5790 | 5790 | $new_str = \implode(' ', $array); |
5791 | 5791 | |
5792 | 5792 | if ($new_str === '') { |
5793 | - $str = self::substr($str, 0, $length - 1, $encoding) . $strAddOn; |
|
5793 | + $str = self::substr($str, 0, $length - 1, $encoding).$strAddOn; |
|
5794 | 5794 | } else { |
5795 | - $str = $new_str . $strAddOn; |
|
5795 | + $str = $new_str.$strAddOn; |
|
5796 | 5796 | } |
5797 | 5797 | |
5798 | 5798 | return $str; |
@@ -5895,7 +5895,7 @@ discard block |
||
5895 | 5895 | $char = self::substr($str, -$i, 1, $encoding); |
5896 | 5896 | |
5897 | 5897 | if ($char === self::substr($otherStr, -$i, 1, $encoding)) { |
5898 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
5898 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
5899 | 5899 | } else { |
5900 | 5900 | break; |
5901 | 5901 | } |
@@ -5914,7 +5914,7 @@ discard block |
||
5914 | 5914 | */ |
5915 | 5915 | public static function str_matches_pattern(string $str, string $pattern): bool |
5916 | 5916 | { |
5917 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
5917 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
5918 | 5918 | } |
5919 | 5919 | |
5920 | 5920 | /** |
@@ -5991,7 +5991,7 @@ discard block |
||
5991 | 5991 | return ''; |
5992 | 5992 | } |
5993 | 5993 | |
5994 | - if ($pad_type !== (int) $pad_type) { |
|
5994 | + if ($pad_type !== (int)$pad_type) { |
|
5995 | 5995 | if ($pad_type === 'left') { |
5996 | 5996 | $pad_type = \STR_PAD_LEFT; |
5997 | 5997 | } elseif ($pad_type === 'right') { |
@@ -6000,7 +6000,7 @@ discard block |
||
6000 | 6000 | $pad_type = \STR_PAD_BOTH; |
6001 | 6001 | } else { |
6002 | 6002 | throw new \InvalidArgumentException( |
6003 | - 'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
6003 | + 'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
6004 | 6004 | ); |
6005 | 6005 | } |
6006 | 6006 | } |
@@ -6018,28 +6018,28 @@ discard block |
||
6018 | 6018 | |
6019 | 6019 | switch ($pad_type) { |
6020 | 6020 | case \STR_PAD_LEFT: |
6021 | - $pre = \str_repeat($pad_string, (int) \ceil($diff / $ps_length)); |
|
6022 | - $pre = (string) self::substr($pre, 0, $diff, $encoding); |
|
6021 | + $pre = \str_repeat($pad_string, (int)\ceil($diff / $ps_length)); |
|
6022 | + $pre = (string)self::substr($pre, 0, $diff, $encoding); |
|
6023 | 6023 | $post = ''; |
6024 | 6024 | |
6025 | 6025 | break; |
6026 | 6026 | |
6027 | 6027 | case \STR_PAD_BOTH: |
6028 | - $pre = \str_repeat($pad_string, (int) \ceil($diff / $ps_length / 2)); |
|
6029 | - $pre = (string) self::substr($pre, 0, (int) \floor($diff / 2), $encoding); |
|
6030 | - $post = \str_repeat($pad_string, (int) \ceil($diff / $ps_length / 2)); |
|
6031 | - $post = (string) self::substr($post, 0, (int) \ceil($diff / 2), $encoding); |
|
6028 | + $pre = \str_repeat($pad_string, (int)\ceil($diff / $ps_length / 2)); |
|
6029 | + $pre = (string)self::substr($pre, 0, (int)\floor($diff / 2), $encoding); |
|
6030 | + $post = \str_repeat($pad_string, (int)\ceil($diff / $ps_length / 2)); |
|
6031 | + $post = (string)self::substr($post, 0, (int)\ceil($diff / 2), $encoding); |
|
6032 | 6032 | |
6033 | 6033 | break; |
6034 | 6034 | |
6035 | 6035 | case \STR_PAD_RIGHT: |
6036 | 6036 | default: |
6037 | - $post = \str_repeat($pad_string, (int) \ceil($diff / $ps_length)); |
|
6038 | - $post = (string) self::substr($post, 0, $diff, $encoding); |
|
6037 | + $post = \str_repeat($pad_string, (int)\ceil($diff / $ps_length)); |
|
6038 | + $post = (string)self::substr($post, 0, $diff, $encoding); |
|
6039 | 6039 | $pre = ''; |
6040 | 6040 | } |
6041 | 6041 | |
6042 | - return $pre . $str . $post; |
|
6042 | + return $pre.$str.$post; |
|
6043 | 6043 | } |
6044 | 6044 | |
6045 | 6045 | return $str; |
@@ -6060,7 +6060,7 @@ discard block |
||
6060 | 6060 | { |
6061 | 6061 | $padding = $length - self::strlen($str, $encoding); |
6062 | 6062 | |
6063 | - return self::apply_padding($str, (int) \floor($padding / 2), (int) \ceil($padding / 2), $padStr, $encoding); |
|
6063 | + return self::apply_padding($str, (int)\floor($padding / 2), (int)\ceil($padding / 2), $padStr, $encoding); |
|
6064 | 6064 | } |
6065 | 6065 | |
6066 | 6066 | /** |
@@ -6176,11 +6176,11 @@ discard block |
||
6176 | 6176 | } |
6177 | 6177 | |
6178 | 6178 | if ($search === '') { |
6179 | - return $str . $replacement; |
|
6179 | + return $str.$replacement; |
|
6180 | 6180 | } |
6181 | 6181 | |
6182 | 6182 | if (\strpos($str, $search) === 0) { |
6183 | - return $replacement . \substr($str, \strlen($search)); |
|
6183 | + return $replacement.\substr($str, \strlen($search)); |
|
6184 | 6184 | } |
6185 | 6185 | |
6186 | 6186 | return $str; |
@@ -6208,11 +6208,11 @@ discard block |
||
6208 | 6208 | } |
6209 | 6209 | |
6210 | 6210 | if ($search === '') { |
6211 | - return $str . $replacement; |
|
6211 | + return $str.$replacement; |
|
6212 | 6212 | } |
6213 | 6213 | |
6214 | 6214 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6215 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6215 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6216 | 6216 | } |
6217 | 6217 | |
6218 | 6218 | return $str; |
@@ -6231,7 +6231,7 @@ discard block |
||
6231 | 6231 | { |
6232 | 6232 | $pos = self::strpos($subject, $search); |
6233 | 6233 | if ($pos !== false) { |
6234 | - return self::substr_replace($subject, $replace, $pos, (int) self::strlen($search)); |
|
6234 | + return self::substr_replace($subject, $replace, $pos, (int)self::strlen($search)); |
|
6235 | 6235 | } |
6236 | 6236 | |
6237 | 6237 | return $subject; |
@@ -6250,7 +6250,7 @@ discard block |
||
6250 | 6250 | { |
6251 | 6251 | $pos = self::strrpos($subject, $search); |
6252 | 6252 | if ($pos !== false) { |
6253 | - return self::substr_replace($subject, $replace, $pos, (int) self::strlen($search)); |
|
6253 | + return self::substr_replace($subject, $replace, $pos, (int)self::strlen($search)); |
|
6254 | 6254 | } |
6255 | 6255 | |
6256 | 6256 | return $subject; |
@@ -6297,11 +6297,11 @@ discard block |
||
6297 | 6297 | public static function str_slice(string $str, int $start, int $end = null, string $encoding = 'UTF-8') |
6298 | 6298 | { |
6299 | 6299 | if ($end === null) { |
6300 | - $length = (int) self::strlen($str); |
|
6300 | + $length = (int)self::strlen($str); |
|
6301 | 6301 | } elseif ($end >= 0 && $end <= $start) { |
6302 | 6302 | return ''; |
6303 | 6303 | } elseif ($end < 0) { |
6304 | - $length = (int) self::strlen($str) + $end - $start; |
|
6304 | + $length = (int)self::strlen($str) + $end - $start; |
|
6305 | 6305 | } else { |
6306 | 6306 | $length = $end - $start; |
6307 | 6307 | } |
@@ -6322,26 +6322,26 @@ discard block |
||
6322 | 6322 | $str = self::normalize_whitespace($str); |
6323 | 6323 | $str = \str_replace('-', '_', $str); |
6324 | 6324 | |
6325 | - $str = (string) \preg_replace_callback( |
|
6325 | + $str = (string)\preg_replace_callback( |
|
6326 | 6326 | '/([\d|A-Z])/u', |
6327 | - static function ($matches) use ($encoding) { |
|
6327 | + static function($matches) use ($encoding) { |
|
6328 | 6328 | $match = $matches[1]; |
6329 | - $matchInt = (int) $match; |
|
6329 | + $matchInt = (int)$match; |
|
6330 | 6330 | |
6331 | - if ((string) $matchInt === $match) { |
|
6332 | - return '_' . $match . '_'; |
|
6331 | + if ((string)$matchInt === $match) { |
|
6332 | + return '_'.$match.'_'; |
|
6333 | 6333 | } |
6334 | 6334 | |
6335 | - return '_' . self::strtolower($match, $encoding); |
|
6335 | + return '_'.self::strtolower($match, $encoding); |
|
6336 | 6336 | }, |
6337 | 6337 | $str |
6338 | 6338 | ); |
6339 | 6339 | |
6340 | - $str = (string) \preg_replace( |
|
6340 | + $str = (string)\preg_replace( |
|
6341 | 6341 | [ |
6342 | - '/\s+/', // convert spaces to "_" |
|
6343 | - '/^\s+|\s+$/', // trim leading & trailing spaces |
|
6344 | - '/_+/', // remove double "_" |
|
6342 | + '/\s+/', // convert spaces to "_" |
|
6343 | + '/^\s+|\s+$/', // trim leading & trailing spaces |
|
6344 | + '/_+/', // remove double "_" |
|
6345 | 6345 | ], |
6346 | 6346 | [ |
6347 | 6347 | '_', |
@@ -6428,7 +6428,7 @@ discard block |
||
6428 | 6428 | $limit = -1; |
6429 | 6429 | } |
6430 | 6430 | |
6431 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
6431 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
6432 | 6432 | |
6433 | 6433 | if ($array === false) { |
6434 | 6434 | return []; |
@@ -6511,7 +6511,7 @@ discard block |
||
6511 | 6511 | return ''; |
6512 | 6512 | } |
6513 | 6513 | |
6514 | - return (string) self::substr( |
|
6514 | + return (string)self::substr( |
|
6515 | 6515 | $str, |
6516 | 6516 | $offset + self::strlen($separator, $encoding), |
6517 | 6517 | null, |
@@ -6543,7 +6543,7 @@ discard block |
||
6543 | 6543 | return ''; |
6544 | 6544 | } |
6545 | 6545 | |
6546 | - return (string) self::substr( |
|
6546 | + return (string)self::substr( |
|
6547 | 6547 | $str, |
6548 | 6548 | $offset + self::strlen($separator, $encoding), |
6549 | 6549 | null, |
@@ -6575,7 +6575,7 @@ discard block |
||
6575 | 6575 | return ''; |
6576 | 6576 | } |
6577 | 6577 | |
6578 | - return (string) self::substr( |
|
6578 | + return (string)self::substr( |
|
6579 | 6579 | $str, |
6580 | 6580 | 0, |
6581 | 6581 | $offset, |
@@ -6607,7 +6607,7 @@ discard block |
||
6607 | 6607 | return ''; |
6608 | 6608 | } |
6609 | 6609 | |
6610 | - return (string) self::substr( |
|
6610 | + return (string)self::substr( |
|
6611 | 6611 | $str, |
6612 | 6612 | 0, |
6613 | 6613 | $offset, |
@@ -6798,19 +6798,19 @@ discard block |
||
6798 | 6798 | } |
6799 | 6799 | |
6800 | 6800 | // The main substitutions |
6801 | - $str = (string) \preg_replace_callback( |
|
6801 | + $str = (string)\preg_replace_callback( |
|
6802 | 6802 | '~\b (_*) (?: # 1. Leading underscore and |
6803 | 6803 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
6804 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
6804 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
6805 | 6805 | | |
6806 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
6806 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
6807 | 6807 | | |
6808 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
6808 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
6809 | 6809 | | |
6810 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
6810 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
6811 | 6811 | ) (_*) \b # 6. With trailing underscore |
6812 | 6812 | ~ux', |
6813 | - static function ($matches) use ($encoding) { |
|
6813 | + static function($matches) use ($encoding) { |
|
6814 | 6814 | // Preserve leading underscore |
6815 | 6815 | $str = $matches[1]; |
6816 | 6816 | if ($matches[2]) { |
@@ -6835,25 +6835,25 @@ discard block |
||
6835 | 6835 | ); |
6836 | 6836 | |
6837 | 6837 | // Exceptions for small words: capitalize at start of title... |
6838 | - $str = (string) \preg_replace_callback( |
|
6838 | + $str = (string)\preg_replace_callback( |
|
6839 | 6839 | '~( \A [[:punct:]]* # start of title... |
6840 | 6840 | | [:.;?!][ ]+ # or of subsentence... |
6841 | 6841 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
6842 | - ( ' . $smallWordsRx . ' ) \b # ...followed by small word |
|
6842 | + ( ' . $smallWordsRx.' ) \b # ...followed by small word |
|
6843 | 6843 | ~uxi', |
6844 | - static function ($matches) use ($encoding) { |
|
6845 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
6844 | + static function($matches) use ($encoding) { |
|
6845 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
6846 | 6846 | }, |
6847 | 6847 | $str |
6848 | 6848 | ); |
6849 | 6849 | |
6850 | 6850 | // ...and end of title |
6851 | - $str = (string) \preg_replace_callback( |
|
6852 | - '~\b ( ' . $smallWordsRx . ' ) # small word... |
|
6851 | + $str = (string)\preg_replace_callback( |
|
6852 | + '~\b ( '.$smallWordsRx.' ) # small word... |
|
6853 | 6853 | (?= [[:punct:]]* \Z # ...at the end of the title... |
6854 | 6854 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
6855 | 6855 | ~uxi', |
6856 | - static function ($matches) use ($encoding) { |
|
6856 | + static function($matches) use ($encoding) { |
|
6857 | 6857 | return static::str_upper_first($matches[1], $encoding); |
6858 | 6858 | }, |
6859 | 6859 | $str |
@@ -6861,28 +6861,28 @@ discard block |
||
6861 | 6861 | |
6862 | 6862 | // Exceptions for small words in hyphenated compound words |
6863 | 6863 | // e.g. "in-flight" -> In-Flight |
6864 | - $str = (string) \preg_replace_callback( |
|
6864 | + $str = (string)\preg_replace_callback( |
|
6865 | 6865 | '~\b |
6866 | 6866 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
6867 | - ( ' . $smallWordsRx . ' ) |
|
6867 | + ( ' . $smallWordsRx.' ) |
|
6868 | 6868 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
6869 | 6869 | ~uxi', |
6870 | - static function ($matches) use ($encoding) { |
|
6870 | + static function($matches) use ($encoding) { |
|
6871 | 6871 | return static::str_upper_first($matches[1], $encoding); |
6872 | 6872 | }, |
6873 | 6873 | $str |
6874 | 6874 | ); |
6875 | 6875 | |
6876 | 6876 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
6877 | - $str = (string) \preg_replace_callback( |
|
6877 | + $str = (string)\preg_replace_callback( |
|
6878 | 6878 | '~\b |
6879 | 6879 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
6880 | 6880 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
6881 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
6881 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
6882 | 6882 | (?! - ) # Negative lookahead for another - |
6883 | 6883 | ~uxi', |
6884 | - static function ($matches) use ($encoding) { |
|
6885 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
6884 | + static function($matches) use ($encoding) { |
|
6885 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
6886 | 6886 | }, |
6887 | 6887 | $str |
6888 | 6888 | ); |
@@ -6977,7 +6977,7 @@ discard block |
||
6977 | 6977 | ); |
6978 | 6978 | |
6979 | 6979 | foreach ($tmpReturn as &$item) { |
6980 | - $item = (string) $item; |
|
6980 | + $item = (string)$item; |
|
6981 | 6981 | } |
6982 | 6982 | |
6983 | 6983 | return $tmpReturn; |
@@ -7014,7 +7014,7 @@ discard block |
||
7014 | 7014 | public static function str_truncate($str, int $length, string $substring = '', string $encoding = 'UTF-8'): string |
7015 | 7015 | { |
7016 | 7016 | // init |
7017 | - $str = (string) $str; |
|
7017 | + $str = (string)$str; |
|
7018 | 7018 | |
7019 | 7019 | if ($str === '') { |
7020 | 7020 | return ''; |
@@ -7030,7 +7030,7 @@ discard block |
||
7030 | 7030 | |
7031 | 7031 | $truncated = self::substr($str, 0, $length, $encoding); |
7032 | 7032 | |
7033 | - return $truncated . $substring; |
|
7033 | + return $truncated.$substring; |
|
7034 | 7034 | } |
7035 | 7035 | |
7036 | 7036 | /** |
@@ -7068,11 +7068,11 @@ discard block |
||
7068 | 7068 | $lastPos = self::strrpos($truncated, ' ', 0, $encoding); |
7069 | 7069 | |
7070 | 7070 | if ($lastPos !== false || $strPosSpace !== false) { |
7071 | - $truncated = self::substr($truncated, 0, (int) $lastPos, $encoding); |
|
7071 | + $truncated = self::substr($truncated, 0, (int)$lastPos, $encoding); |
|
7072 | 7072 | } |
7073 | 7073 | } |
7074 | 7074 | |
7075 | - return $truncated . $substring; |
|
7075 | + return $truncated.$substring; |
|
7076 | 7076 | } |
7077 | 7077 | |
7078 | 7078 | /** |
@@ -7158,7 +7158,7 @@ discard block |
||
7158 | 7158 | $offset += self::strlen($strParts[$i]) + self::strlen($strParts[$i + 1]); |
7159 | 7159 | } |
7160 | 7160 | } else { |
7161 | - $numberOfWords = (int) (($len - 1) / 2); |
|
7161 | + $numberOfWords = (int)(($len - 1) / 2); |
|
7162 | 7162 | } |
7163 | 7163 | |
7164 | 7164 | return $numberOfWords; |
@@ -7218,7 +7218,7 @@ discard block |
||
7218 | 7218 | public static function strcmp(string $str1, string $str2): int |
7219 | 7219 | { |
7220 | 7220 | /** @noinspection PhpUndefinedClassInspection */ |
7221 | - return $str1 . '' === $str2 . '' ? 0 : \strcmp( |
|
7221 | + return $str1.'' === $str2.'' ? 0 : \strcmp( |
|
7222 | 7222 | \Normalizer::normalize($str1, \Normalizer::NFD), |
7223 | 7223 | \Normalizer::normalize($str2, \Normalizer::NFD) |
7224 | 7224 | ); |
@@ -7237,12 +7237,12 @@ discard block |
||
7237 | 7237 | public static function strcspn(string $str, string $charList, int $offset = null, int $length = null): int |
7238 | 7238 | { |
7239 | 7239 | if ($charList === '') { |
7240 | - return (int) self::strlen($str); |
|
7240 | + return (int)self::strlen($str); |
|
7241 | 7241 | } |
7242 | 7242 | |
7243 | 7243 | if ($offset !== null || $length !== null) { |
7244 | 7244 | /** @noinspection UnnecessaryCastingInspection */ |
7245 | - $strTmp = self::substr($str, (int) $offset, $length); |
|
7245 | + $strTmp = self::substr($str, (int)$offset, $length); |
|
7246 | 7246 | if ($strTmp === false) { |
7247 | 7247 | return 0; |
7248 | 7248 | } |
@@ -7253,7 +7253,7 @@ discard block |
||
7253 | 7253 | return 0; |
7254 | 7254 | } |
7255 | 7255 | |
7256 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $length)) { |
|
7256 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $length)) { |
|
7257 | 7257 | $return = self::strlen($length[1]); |
7258 | 7258 | if ($return === false) { |
7259 | 7259 | return 0; |
@@ -7262,7 +7262,7 @@ discard block |
||
7262 | 7262 | return $return; |
7263 | 7263 | } |
7264 | 7264 | |
7265 | - return (int) self::strlen($str); |
|
7265 | + return (int)self::strlen($str); |
|
7266 | 7266 | } |
7267 | 7267 | |
7268 | 7268 | /** |
@@ -7357,7 +7357,7 @@ discard block |
||
7357 | 7357 | } |
7358 | 7358 | |
7359 | 7359 | /** @noinspection UnnecessaryCastingInspection */ |
7360 | - return \strip_tags($str, (string) $allowable_tags); |
|
7360 | + return \strip_tags($str, (string)$allowable_tags); |
|
7361 | 7361 | } |
7362 | 7362 | |
7363 | 7363 | /** |
@@ -7375,7 +7375,7 @@ discard block |
||
7375 | 7375 | return ''; |
7376 | 7376 | } |
7377 | 7377 | |
7378 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
7378 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
7379 | 7379 | } |
7380 | 7380 | |
7381 | 7381 | /** |
@@ -7496,7 +7496,7 @@ discard block |
||
7496 | 7496 | && |
7497 | 7497 | self::$SUPPORT['mbstring'] === false |
7498 | 7498 | ) { |
7499 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
7499 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
7500 | 7500 | } |
7501 | 7501 | |
7502 | 7502 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -7518,7 +7518,7 @@ discard block |
||
7518 | 7518 | return \stristr($haystack, $needle, $before_needle); |
7519 | 7519 | } |
7520 | 7520 | |
7521 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
7521 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
7522 | 7522 | |
7523 | 7523 | if (!isset($match[1])) { |
7524 | 7524 | return false; |
@@ -7528,7 +7528,7 @@ discard block |
||
7528 | 7528 | return $match[1]; |
7529 | 7529 | } |
7530 | 7530 | |
7531 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
7531 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
7532 | 7532 | } |
7533 | 7533 | |
7534 | 7534 | /** |
@@ -7587,7 +7587,7 @@ discard block |
||
7587 | 7587 | && |
7588 | 7588 | self::$SUPPORT['iconv'] === false |
7589 | 7589 | ) { |
7590 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
7590 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
7591 | 7591 | } |
7592 | 7592 | |
7593 | 7593 | // |
@@ -7713,7 +7713,7 @@ discard block |
||
7713 | 7713 | */ |
7714 | 7714 | public static function strnatcmp(string $str1, string $str2): int |
7715 | 7715 | { |
7716 | - return $str1 . '' === $str2 . '' ? 0 : \strnatcmp((string) self::strtonatfold($str1), (string) self::strtonatfold($str2)); |
|
7716 | + return $str1.'' === $str2.'' ? 0 : \strnatcmp((string)self::strtonatfold($str1), (string)self::strtonatfold($str2)); |
|
7717 | 7717 | } |
7718 | 7718 | |
7719 | 7719 | /** |
@@ -7756,8 +7756,8 @@ discard block |
||
7756 | 7756 | */ |
7757 | 7757 | public static function strncmp(string $str1, string $str2, int $len): int |
7758 | 7758 | { |
7759 | - $str1 = (string) self::substr($str1, 0, $len); |
|
7760 | - $str2 = (string) self::substr($str2, 0, $len); |
|
7759 | + $str1 = (string)self::substr($str1, 0, $len); |
|
7760 | + $str2 = (string)self::substr($str2, 0, $len); |
|
7761 | 7761 | |
7762 | 7762 | return self::strcmp($str1, $str2); |
7763 | 7763 | } |
@@ -7778,8 +7778,8 @@ discard block |
||
7778 | 7778 | return false; |
7779 | 7779 | } |
7780 | 7780 | |
7781 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
7782 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
7781 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
7782 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
7783 | 7783 | } |
7784 | 7784 | |
7785 | 7785 | return false; |
@@ -7807,10 +7807,10 @@ discard block |
||
7807 | 7807 | } |
7808 | 7808 | |
7809 | 7809 | // iconv and mbstring do not support integer $needle |
7810 | - if ((int) $needle === $needle && $needle >= 0) { |
|
7811 | - $needle = (string) self::chr($needle); |
|
7810 | + if ((int)$needle === $needle && $needle >= 0) { |
|
7811 | + $needle = (string)self::chr($needle); |
|
7812 | 7812 | } |
7813 | - $needle = (string) $needle; |
|
7813 | + $needle = (string)$needle; |
|
7814 | 7814 | |
7815 | 7815 | if ($needle === '') { |
7816 | 7816 | return false; |
@@ -7850,7 +7850,7 @@ discard block |
||
7850 | 7850 | && |
7851 | 7851 | self::$SUPPORT['mbstring'] === false |
7852 | 7852 | ) { |
7853 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
7853 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
7854 | 7854 | } |
7855 | 7855 | |
7856 | 7856 | // |
@@ -7918,7 +7918,7 @@ discard block |
||
7918 | 7918 | if ($haystackTmp === false) { |
7919 | 7919 | $haystackTmp = ''; |
7920 | 7920 | } |
7921 | - $haystack = (string) $haystackTmp; |
|
7921 | + $haystack = (string)$haystackTmp; |
|
7922 | 7922 | |
7923 | 7923 | if ($offset < 0) { |
7924 | 7924 | $offset = 0; |
@@ -8016,7 +8016,7 @@ discard block |
||
8016 | 8016 | && |
8017 | 8017 | self::$SUPPORT['mbstring'] === false |
8018 | 8018 | ) { |
8019 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8019 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8020 | 8020 | } |
8021 | 8021 | |
8022 | 8022 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -8048,7 +8048,7 @@ discard block |
||
8048 | 8048 | if ($needleTmp === false) { |
8049 | 8049 | return false; |
8050 | 8050 | } |
8051 | - $needle = (string) $needleTmp; |
|
8051 | + $needle = (string)$needleTmp; |
|
8052 | 8052 | |
8053 | 8053 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
8054 | 8054 | if ($pos === false) { |
@@ -8070,7 +8070,7 @@ discard block |
||
8070 | 8070 | if ($needleTmp === false) { |
8071 | 8071 | return false; |
8072 | 8072 | } |
8073 | - $needle = (string) $needleTmp; |
|
8073 | + $needle = (string)$needleTmp; |
|
8074 | 8074 | |
8075 | 8075 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
8076 | 8076 | if ($pos === false) { |
@@ -8098,7 +8098,7 @@ discard block |
||
8098 | 8098 | } |
8099 | 8099 | |
8100 | 8100 | $reversed = ''; |
8101 | - $i = (int) self::strlen($str); |
|
8101 | + $i = (int)self::strlen($str); |
|
8102 | 8102 | while ($i--) { |
8103 | 8103 | $reversed .= self::substr($str, $i, 1); |
8104 | 8104 | } |
@@ -8163,7 +8163,7 @@ discard block |
||
8163 | 8163 | if ($needleTmp === false) { |
8164 | 8164 | return false; |
8165 | 8165 | } |
8166 | - $needle = (string) $needleTmp; |
|
8166 | + $needle = (string)$needleTmp; |
|
8167 | 8167 | |
8168 | 8168 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
8169 | 8169 | if ($pos === false) { |
@@ -8197,10 +8197,10 @@ discard block |
||
8197 | 8197 | } |
8198 | 8198 | |
8199 | 8199 | // iconv and mbstring do not support integer $needle |
8200 | - if ((int) $needle === $needle && $needle >= 0) { |
|
8201 | - $needle = (string) self::chr($needle); |
|
8200 | + if ((int)$needle === $needle && $needle >= 0) { |
|
8201 | + $needle = (string)self::chr($needle); |
|
8202 | 8202 | } |
8203 | - $needle = (string) $needle; |
|
8203 | + $needle = (string)$needle; |
|
8204 | 8204 | |
8205 | 8205 | if ($needle === '') { |
8206 | 8206 | return false; |
@@ -8237,7 +8237,7 @@ discard block |
||
8237 | 8237 | && |
8238 | 8238 | self::$SUPPORT['mbstring'] === false |
8239 | 8239 | ) { |
8240 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8240 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8241 | 8241 | } |
8242 | 8242 | |
8243 | 8243 | // |
@@ -8344,10 +8344,10 @@ discard block |
||
8344 | 8344 | } |
8345 | 8345 | |
8346 | 8346 | // iconv and mbstring do not support integer $needle |
8347 | - if ((int) $needle === $needle && $needle >= 0) { |
|
8348 | - $needle = (string) self::chr($needle); |
|
8347 | + if ((int)$needle === $needle && $needle >= 0) { |
|
8348 | + $needle = (string)self::chr($needle); |
|
8349 | 8349 | } |
8350 | - $needle = (string) $needle; |
|
8350 | + $needle = (string)$needle; |
|
8351 | 8351 | |
8352 | 8352 | if ($needle === '') { |
8353 | 8353 | return false; |
@@ -8384,7 +8384,7 @@ discard block |
||
8384 | 8384 | && |
8385 | 8385 | self::$SUPPORT['mbstring'] === false |
8386 | 8386 | ) { |
8387 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8387 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8388 | 8388 | } |
8389 | 8389 | |
8390 | 8390 | // |
@@ -8444,7 +8444,7 @@ discard block |
||
8444 | 8444 | if ($haystackTmp === false) { |
8445 | 8445 | $haystackTmp = ''; |
8446 | 8446 | } |
8447 | - $haystack = (string) $haystackTmp; |
|
8447 | + $haystack = (string)$haystackTmp; |
|
8448 | 8448 | } |
8449 | 8449 | |
8450 | 8450 | $pos = self::strrpos_in_byte($haystack, $needle); |
@@ -8457,7 +8457,7 @@ discard block |
||
8457 | 8457 | return false; |
8458 | 8458 | } |
8459 | 8459 | |
8460 | - return $offset + (int) self::strlen($strTmp); |
|
8460 | + return $offset + (int)self::strlen($strTmp); |
|
8461 | 8461 | } |
8462 | 8462 | |
8463 | 8463 | /** |
@@ -8513,14 +8513,14 @@ discard block |
||
8513 | 8513 | if ($strTmp === false) { |
8514 | 8514 | $strTmp = ''; |
8515 | 8515 | } |
8516 | - $str = (string) $strTmp; |
|
8516 | + $str = (string)$strTmp; |
|
8517 | 8517 | } |
8518 | 8518 | |
8519 | 8519 | if ($str === '' || $mask === '') { |
8520 | 8520 | return 0; |
8521 | 8521 | } |
8522 | 8522 | |
8523 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $str) ? (int) self::strlen($str[0]) : 0; |
|
8523 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $str) ? (int)self::strlen($str[0]) : 0; |
|
8524 | 8524 | } |
8525 | 8525 | |
8526 | 8526 | /** |
@@ -8576,7 +8576,7 @@ discard block |
||
8576 | 8576 | && |
8577 | 8577 | self::$SUPPORT['mbstring'] === false |
8578 | 8578 | ) { |
8579 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
8579 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
8580 | 8580 | } |
8581 | 8581 | |
8582 | 8582 | // |
@@ -8614,7 +8614,7 @@ discard block |
||
8614 | 8614 | // fallback via vanilla php |
8615 | 8615 | // |
8616 | 8616 | |
8617 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
8617 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
8618 | 8618 | |
8619 | 8619 | if (!isset($match[1])) { |
8620 | 8620 | return false; |
@@ -8624,7 +8624,7 @@ discard block |
||
8624 | 8624 | return $match[1]; |
8625 | 8625 | } |
8626 | 8626 | |
8627 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
8627 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
8628 | 8628 | } |
8629 | 8629 | |
8630 | 8630 | /** |
@@ -8722,7 +8722,7 @@ discard block |
||
8722 | 8722 | public static function strtolower($str, string $encoding = 'UTF-8', bool $cleanUtf8 = false, string $lang = null, bool $tryToKeepStringLength = false): string |
8723 | 8723 | { |
8724 | 8724 | // init |
8725 | - $str = (string) $str; |
|
8725 | + $str = (string)$str; |
|
8726 | 8726 | |
8727 | 8727 | if ($str === '') { |
8728 | 8728 | return ''; |
@@ -8749,9 +8749,9 @@ discard block |
||
8749 | 8749 | } |
8750 | 8750 | |
8751 | 8751 | if (self::$SUPPORT['intl'] === true) { |
8752 | - $langCode = $lang . '-Lower'; |
|
8752 | + $langCode = $lang.'-Lower'; |
|
8753 | 8753 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
8754 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, \E_USER_WARNING); |
|
8754 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, \E_USER_WARNING); |
|
8755 | 8755 | |
8756 | 8756 | $langCode = 'Any-Lower'; |
8757 | 8757 | } |
@@ -8760,7 +8760,7 @@ discard block |
||
8760 | 8760 | return \transliterator_transliterate($langCode, $str); |
8761 | 8761 | } |
8762 | 8762 | |
8763 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
8763 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
8764 | 8764 | } |
8765 | 8765 | |
8766 | 8766 | // always fallback via symfony polyfill |
@@ -8783,7 +8783,7 @@ discard block |
||
8783 | 8783 | public static function strtoupper($str, string $encoding = 'UTF-8', bool $cleanUtf8 = false, string $lang = null, bool $tryToKeepStringLength = false): string |
8784 | 8784 | { |
8785 | 8785 | // init |
8786 | - $str = (string) $str; |
|
8786 | + $str = (string)$str; |
|
8787 | 8787 | |
8788 | 8788 | if ($str === '') { |
8789 | 8789 | return ''; |
@@ -8810,9 +8810,9 @@ discard block |
||
8810 | 8810 | } |
8811 | 8811 | |
8812 | 8812 | if (self::$SUPPORT['intl'] === true) { |
8813 | - $langCode = $lang . '-Upper'; |
|
8813 | + $langCode = $lang.'-Upper'; |
|
8814 | 8814 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
8815 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
8815 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
8816 | 8816 | |
8817 | 8817 | $langCode = 'Any-Upper'; |
8818 | 8818 | } |
@@ -8821,7 +8821,7 @@ discard block |
||
8821 | 8821 | return \transliterator_transliterate($langCode, $str); |
8822 | 8822 | } |
8823 | 8823 | |
8824 | - \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
8824 | + \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
8825 | 8825 | } |
8826 | 8826 | |
8827 | 8827 | // always fallback via symfony polyfill |
@@ -8865,7 +8865,7 @@ discard block |
||
8865 | 8865 | |
8866 | 8866 | $from = \array_combine($from, $to); |
8867 | 8867 | if ($from === false) { |
8868 | - throw new \InvalidArgumentException('The number of elements for each array isn\'t equal or the arrays are empty: (from: ' . \print_r($from, true) . ' | to: ' . \print_r($to, true) . ')'); |
|
8868 | + throw new \InvalidArgumentException('The number of elements for each array isn\'t equal or the arrays are empty: (from: '.\print_r($from, true).' | to: '.\print_r($to, true).')'); |
|
8869 | 8869 | } |
8870 | 8870 | } |
8871 | 8871 | |
@@ -8922,9 +8922,9 @@ discard block |
||
8922 | 8922 | } |
8923 | 8923 | |
8924 | 8924 | $wide = 0; |
8925 | - $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); |
|
8925 | + $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); |
|
8926 | 8926 | |
8927 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
8927 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
8928 | 8928 | } |
8929 | 8929 | |
8930 | 8930 | /** |
@@ -9020,9 +9020,9 @@ discard block |
||
9020 | 9020 | } |
9021 | 9021 | |
9022 | 9022 | if ($length === null) { |
9023 | - $length = (int) $str_length; |
|
9023 | + $length = (int)$str_length; |
|
9024 | 9024 | } else { |
9025 | - $length = (int) $length; |
|
9025 | + $length = (int)$length; |
|
9026 | 9026 | } |
9027 | 9027 | |
9028 | 9028 | if ( |
@@ -9030,7 +9030,7 @@ discard block |
||
9030 | 9030 | && |
9031 | 9031 | self::$SUPPORT['mbstring'] === false |
9032 | 9032 | ) { |
9033 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9033 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9034 | 9034 | } |
9035 | 9035 | |
9036 | 9036 | // |
@@ -9113,13 +9113,13 @@ discard block |
||
9113 | 9113 | if ($str1Tmp === false) { |
9114 | 9114 | $str1Tmp = ''; |
9115 | 9115 | } |
9116 | - $str1 = (string) $str1Tmp; |
|
9116 | + $str1 = (string)$str1Tmp; |
|
9117 | 9117 | |
9118 | - $str2Tmp = self::substr($str2, 0, (int) self::strlen($str1)); |
|
9118 | + $str2Tmp = self::substr($str2, 0, (int)self::strlen($str1)); |
|
9119 | 9119 | if ($str2Tmp === false) { |
9120 | 9120 | $str2Tmp = ''; |
9121 | 9121 | } |
9122 | - $str2 = (string) $str2Tmp; |
|
9122 | + $str2 = (string)$str2Tmp; |
|
9123 | 9123 | } |
9124 | 9124 | |
9125 | 9125 | if ($case_insensitivity === true) { |
@@ -9165,7 +9165,7 @@ discard block |
||
9165 | 9165 | if ($lengthTmp === false) { |
9166 | 9166 | return false; |
9167 | 9167 | } |
9168 | - $length = (int) $lengthTmp; |
|
9168 | + $length = (int)$lengthTmp; |
|
9169 | 9169 | } |
9170 | 9170 | |
9171 | 9171 | if ( |
@@ -9186,7 +9186,7 @@ discard block |
||
9186 | 9186 | if ($haystackTmp === false) { |
9187 | 9187 | $haystackTmp = ''; |
9188 | 9188 | } |
9189 | - $haystack = (string) $haystackTmp; |
|
9189 | + $haystack = (string)$haystackTmp; |
|
9190 | 9190 | } |
9191 | 9191 | |
9192 | 9192 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
@@ -9209,14 +9209,14 @@ discard block |
||
9209 | 9209 | && |
9210 | 9210 | self::$SUPPORT['mbstring'] === false |
9211 | 9211 | ) { |
9212 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9212 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9213 | 9213 | } |
9214 | 9214 | |
9215 | 9215 | if (self::$SUPPORT['mbstring'] === true) { |
9216 | 9216 | return \mb_substr_count($haystack, $needle, $encoding); |
9217 | 9217 | } |
9218 | 9218 | |
9219 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
9219 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
9220 | 9220 | |
9221 | 9221 | return \count($matches); |
9222 | 9222 | } |
@@ -9263,7 +9263,7 @@ discard block |
||
9263 | 9263 | if ($lengthTmp === false) { |
9264 | 9264 | return false; |
9265 | 9265 | } |
9266 | - $length = (int) $lengthTmp; |
|
9266 | + $length = (int)$lengthTmp; |
|
9267 | 9267 | } |
9268 | 9268 | |
9269 | 9269 | if ( |
@@ -9284,7 +9284,7 @@ discard block |
||
9284 | 9284 | if ($haystackTmp === false) { |
9285 | 9285 | $haystackTmp = ''; |
9286 | 9286 | } |
9287 | - $haystack = (string) $haystackTmp; |
|
9287 | + $haystack = (string)$haystackTmp; |
|
9288 | 9288 | } |
9289 | 9289 | |
9290 | 9290 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -9319,7 +9319,7 @@ discard block |
||
9319 | 9319 | |
9320 | 9320 | // only a fallback to prevent BC in the api ... |
9321 | 9321 | if ($caseSensitive !== false && $caseSensitive !== true) { |
9322 | - $encoding = (string) $caseSensitive; |
|
9322 | + $encoding = (string)$caseSensitive; |
|
9323 | 9323 | } |
9324 | 9324 | |
9325 | 9325 | if (!$caseSensitive) { |
@@ -9327,7 +9327,7 @@ discard block |
||
9327 | 9327 | $substring = self::strtocasefold($substring, true, false, $encoding, null, false); |
9328 | 9328 | } |
9329 | 9329 | |
9330 | - return (int) self::substr_count($str, $substring, 0, null, $encoding); |
|
9330 | + return (int)self::substr_count($str, $substring, 0, null, $encoding); |
|
9331 | 9331 | } |
9332 | 9332 | |
9333 | 9333 | /** |
@@ -9349,11 +9349,11 @@ discard block |
||
9349 | 9349 | } |
9350 | 9350 | |
9351 | 9351 | if (self::str_istarts_with($haystack, $needle) === true) { |
9352 | - $haystackTmp = self::substr($haystack, (int) self::strlen($needle)); |
|
9352 | + $haystackTmp = self::substr($haystack, (int)self::strlen($needle)); |
|
9353 | 9353 | if ($haystackTmp === false) { |
9354 | 9354 | $haystackTmp = ''; |
9355 | 9355 | } |
9356 | - $haystack = (string) $haystackTmp; |
|
9356 | + $haystack = (string)$haystackTmp; |
|
9357 | 9357 | } |
9358 | 9358 | |
9359 | 9359 | return $haystack; |
@@ -9422,7 +9422,7 @@ discard block |
||
9422 | 9422 | if ($haystackTmp === false) { |
9423 | 9423 | $haystackTmp = ''; |
9424 | 9424 | } |
9425 | - $haystack = (string) $haystackTmp; |
|
9425 | + $haystack = (string)$haystackTmp; |
|
9426 | 9426 | } |
9427 | 9427 | |
9428 | 9428 | return $haystack; |
@@ -9447,11 +9447,11 @@ discard block |
||
9447 | 9447 | } |
9448 | 9448 | |
9449 | 9449 | if (self::str_starts_with($haystack, $needle) === true) { |
9450 | - $haystackTmp = self::substr($haystack, (int) self::strlen($needle)); |
|
9450 | + $haystackTmp = self::substr($haystack, (int)self::strlen($needle)); |
|
9451 | 9451 | if ($haystackTmp === false) { |
9452 | 9452 | $haystackTmp = ''; |
9453 | 9453 | } |
9454 | - $haystack = (string) $haystackTmp; |
|
9454 | + $haystack = (string)$haystackTmp; |
|
9455 | 9455 | } |
9456 | 9456 | |
9457 | 9457 | return $haystack; |
@@ -9498,7 +9498,7 @@ discard block |
||
9498 | 9498 | if (\is_array($offset) === true) { |
9499 | 9499 | $offset = \array_slice($offset, 0, $num); |
9500 | 9500 | foreach ($offset as &$valueTmp) { |
9501 | - $valueTmp = (int) $valueTmp === $valueTmp ? $valueTmp : 0; |
|
9501 | + $valueTmp = (int)$valueTmp === $valueTmp ? $valueTmp : 0; |
|
9502 | 9502 | } |
9503 | 9503 | unset($valueTmp); |
9504 | 9504 | } else { |
@@ -9512,7 +9512,7 @@ discard block |
||
9512 | 9512 | $length = \array_slice($length, 0, $num); |
9513 | 9513 | foreach ($length as &$valueTmpV2) { |
9514 | 9514 | if ($valueTmpV2 !== null) { |
9515 | - $valueTmpV2 = (int) $valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
9515 | + $valueTmpV2 = (int)$valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
9516 | 9516 | } else { |
9517 | 9517 | $valueTmpV2 = 0; |
9518 | 9518 | } |
@@ -9535,8 +9535,8 @@ discard block |
||
9535 | 9535 | } |
9536 | 9536 | |
9537 | 9537 | // init |
9538 | - $str = (string) $str; |
|
9539 | - $replacement = (string) $replacement; |
|
9538 | + $str = (string)$str; |
|
9539 | + $replacement = (string)$replacement; |
|
9540 | 9540 | |
9541 | 9541 | if (\is_array($length) === true) { |
9542 | 9542 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -9552,8 +9552,7 @@ discard block |
||
9552 | 9552 | |
9553 | 9553 | if (self::is_ascii($str)) { |
9554 | 9554 | return ($length === null) ? |
9555 | - \substr_replace($str, $replacement, $offset) : |
|
9556 | - \substr_replace($str, $replacement, $offset, $length); |
|
9555 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
9557 | 9556 | } |
9558 | 9557 | |
9559 | 9558 | if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) { |
@@ -9564,22 +9563,22 @@ discard block |
||
9564 | 9563 | $string_length = self::strlen($str, $encoding); |
9565 | 9564 | |
9566 | 9565 | if ($offset < 0) { |
9567 | - $offset = (int) \max(0, $string_length + $offset); |
|
9566 | + $offset = (int)\max(0, $string_length + $offset); |
|
9568 | 9567 | } elseif ($offset > $string_length) { |
9569 | - $offset = (int) $string_length; |
|
9568 | + $offset = (int)$string_length; |
|
9570 | 9569 | } |
9571 | 9570 | |
9572 | 9571 | if ($length < 0) { |
9573 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
9572 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
9574 | 9573 | } elseif ($length === null || $length > $string_length) { |
9575 | - $length = (int) $string_length; |
|
9574 | + $length = (int)$string_length; |
|
9576 | 9575 | } |
9577 | 9576 | |
9578 | 9577 | if (($offset + $length) > $string_length) { |
9579 | 9578 | $length = $string_length - $offset; |
9580 | 9579 | } |
9581 | 9580 | |
9582 | - return self::substr($str, 0, $offset, $encoding) . $replacement . self::substr($str, $offset + $length, $string_length - $offset - $length, $encoding); |
|
9581 | + return self::substr($str, 0, $offset, $encoding).$replacement.self::substr($str, $offset + $length, $string_length - $offset - $length, $encoding); |
|
9583 | 9582 | } |
9584 | 9583 | |
9585 | 9584 | \preg_match_all('/./us', $str, $smatches); |
@@ -9591,7 +9590,7 @@ discard block |
||
9591 | 9590 | // e.g.: non mbstring support + invalid chars |
9592 | 9591 | return ''; |
9593 | 9592 | } |
9594 | - $length = (int) $lengthTmp; |
|
9593 | + $length = (int)$lengthTmp; |
|
9595 | 9594 | } |
9596 | 9595 | |
9597 | 9596 | \array_splice($smatches[0], $offset, $length, $rmatches[0]); |
@@ -9622,7 +9621,7 @@ discard block |
||
9622 | 9621 | if ($haystackTmp === false) { |
9623 | 9622 | $haystackTmp = ''; |
9624 | 9623 | } |
9625 | - $haystack = (string) $haystackTmp; |
|
9624 | + $haystack = (string)$haystackTmp; |
|
9626 | 9625 | } |
9627 | 9626 | |
9628 | 9627 | return $haystack; |
@@ -9653,7 +9652,7 @@ discard block |
||
9653 | 9652 | $str = self::clean($str); |
9654 | 9653 | } |
9655 | 9654 | |
9656 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
9655 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
9657 | 9656 | } |
9658 | 9657 | |
9659 | 9658 | /** |
@@ -9947,7 +9946,7 @@ discard block |
||
9947 | 9946 | public static function to_boolean($str): bool |
9948 | 9947 | { |
9949 | 9948 | // init |
9950 | - $str = (string) $str; |
|
9949 | + $str = (string)$str; |
|
9951 | 9950 | |
9952 | 9951 | if ($str === '') { |
9953 | 9952 | return false; |
@@ -9973,10 +9972,10 @@ discard block |
||
9973 | 9972 | |
9974 | 9973 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
9975 | 9974 | if (\is_numeric($str)) { |
9976 | - return ((float) $str + 0) > 0; |
|
9975 | + return ((float)$str + 0) > 0; |
|
9977 | 9976 | } |
9978 | 9977 | |
9979 | - return (bool) self::trim($str); |
|
9978 | + return (bool)self::trim($str); |
|
9980 | 9979 | } |
9981 | 9980 | |
9982 | 9981 | /** |
@@ -9997,11 +9996,11 @@ discard block |
||
9997 | 9996 | |
9998 | 9997 | $fallback_char_escaped = \preg_quote($fallback_char, '/'); |
9999 | 9998 | |
10000 | - $string = (string) \preg_replace( |
|
9999 | + $string = (string)\preg_replace( |
|
10001 | 10000 | [ |
10002 | - '/[^' . $fallback_char_escaped . '\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
10003 | - '/[\s]+/', // 2) convert spaces to $fallback_char |
|
10004 | - '/[' . $fallback_char_escaped . ']+/', // 3) remove double $fallback_char's |
|
10001 | + '/[^'.$fallback_char_escaped.'\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
10002 | + '/[\s]+/', // 2) convert spaces to $fallback_char |
|
10003 | + '/['.$fallback_char_escaped.']+/', // 3) remove double $fallback_char's |
|
10005 | 10004 | ], |
10006 | 10005 | [ |
10007 | 10006 | '', |
@@ -10032,7 +10031,7 @@ discard block |
||
10032 | 10031 | return $str; |
10033 | 10032 | } |
10034 | 10033 | |
10035 | - $str = (string) $str; |
|
10034 | + $str = (string)$str; |
|
10036 | 10035 | if ($str === '') { |
10037 | 10036 | return ''; |
10038 | 10037 | } |
@@ -10079,7 +10078,7 @@ discard block |
||
10079 | 10078 | return $str; |
10080 | 10079 | } |
10081 | 10080 | |
10082 | - $str = (string) $str; |
|
10081 | + $str = (string)$str; |
|
10083 | 10082 | if ($str === '') { |
10084 | 10083 | return $str; |
10085 | 10084 | } |
@@ -10102,7 +10101,7 @@ discard block |
||
10102 | 10101 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
10103 | 10102 | |
10104 | 10103 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
10105 | - $buf .= $c1 . $c2; |
|
10104 | + $buf .= $c1.$c2; |
|
10106 | 10105 | ++$i; |
10107 | 10106 | } else { // not valid UTF8 - convert it |
10108 | 10107 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -10113,7 +10112,7 @@ discard block |
||
10113 | 10112 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
10114 | 10113 | |
10115 | 10114 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
10116 | - $buf .= $c1 . $c2 . $c3; |
|
10115 | + $buf .= $c1.$c2.$c3; |
|
10117 | 10116 | $i += 2; |
10118 | 10117 | } else { // not valid UTF8 - convert it |
10119 | 10118 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -10125,7 +10124,7 @@ discard block |
||
10125 | 10124 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
10126 | 10125 | |
10127 | 10126 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
10128 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
10127 | + $buf .= $c1.$c2.$c3.$c4; |
|
10129 | 10128 | $i += 3; |
10130 | 10129 | } else { // not valid UTF8 - convert it |
10131 | 10130 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -10144,7 +10143,7 @@ discard block |
||
10144 | 10143 | // decode unicode escape sequences |
10145 | 10144 | $buf = \preg_replace_callback( |
10146 | 10145 | '/\\\\u([0-9a-f]{4})/i', |
10147 | - static function ($match) { |
|
10146 | + static function($match) { |
|
10148 | 10147 | // always fallback via symfony polyfill |
10149 | 10148 | return \mb_convert_encoding(\pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); |
10150 | 10149 | }, |
@@ -10218,14 +10217,14 @@ discard block |
||
10218 | 10217 | } |
10219 | 10218 | |
10220 | 10219 | $strPartOne = self::strtoupper( |
10221 | - (string) self::substr($str, 0, 1, $encoding), |
|
10220 | + (string)self::substr($str, 0, 1, $encoding), |
|
10222 | 10221 | $encoding, |
10223 | 10222 | $cleanUtf8, |
10224 | 10223 | $lang, |
10225 | 10224 | $tryToKeepStringLength |
10226 | 10225 | ); |
10227 | 10226 | |
10228 | - return $strPartOne . $strPartTwo; |
|
10227 | + return $strPartOne.$strPartTwo; |
|
10229 | 10228 | } |
10230 | 10229 | |
10231 | 10230 | /** |
@@ -10271,7 +10270,7 @@ discard block |
||
10271 | 10270 | $str = self::clean($str); |
10272 | 10271 | } |
10273 | 10272 | |
10274 | - $usePhpDefaultFunctions = !(bool) ($charlist . \implode('', $exceptions)); |
|
10273 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
10275 | 10274 | |
10276 | 10275 | if ( |
10277 | 10276 | $usePhpDefaultFunctions === true |
@@ -10336,7 +10335,7 @@ discard block |
||
10336 | 10335 | |
10337 | 10336 | $pattern = '/%u([0-9a-f]{3,4})/i'; |
10338 | 10337 | if (\preg_match($pattern, $str)) { |
10339 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
10338 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
10340 | 10339 | } |
10341 | 10340 | |
10342 | 10341 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -10770,7 +10769,7 @@ discard block |
||
10770 | 10769 | return ''; |
10771 | 10770 | } |
10772 | 10771 | |
10773 | - \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches); |
|
10772 | + \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches); |
|
10774 | 10773 | |
10775 | 10774 | if ( |
10776 | 10775 | !isset($matches[0]) |
@@ -10780,7 +10779,7 @@ discard block |
||
10780 | 10779 | return $str; |
10781 | 10780 | } |
10782 | 10781 | |
10783 | - return self::rtrim($matches[0]) . $strAddOn; |
|
10782 | + return self::rtrim($matches[0]).$strAddOn; |
|
10784 | 10783 | } |
10785 | 10784 | |
10786 | 10785 | /** |
@@ -10848,7 +10847,7 @@ discard block |
||
10848 | 10847 | $strReturn .= $break; |
10849 | 10848 | } |
10850 | 10849 | |
10851 | - return $strReturn . \implode('', $chars); |
|
10850 | + return $strReturn.\implode('', $chars); |
|
10852 | 10851 | } |
10853 | 10852 | |
10854 | 10853 | /** |
@@ -10861,7 +10860,7 @@ discard block |
||
10861 | 10860 | */ |
10862 | 10861 | public static function wordwrap_per_line(string $str, int $limit): string |
10863 | 10862 | { |
10864 | - $strings = (array) \preg_split('/\\r\\n|\\r|\\n/', $str); |
|
10863 | + $strings = (array)\preg_split('/\\r\\n|\\r|\\n/', $str); |
|
10865 | 10864 | |
10866 | 10865 | $string = ''; |
10867 | 10866 | foreach ($strings as $value) { |
@@ -10932,13 +10931,13 @@ discard block |
||
10932 | 10931 | $lower = self::$COMMON_CASE_FOLD['lower']; |
10933 | 10932 | |
10934 | 10933 | if ($useLower === true) { |
10935 | - $str = (string) \str_replace( |
|
10934 | + $str = (string)\str_replace( |
|
10936 | 10935 | $upper, |
10937 | 10936 | $lower, |
10938 | 10937 | $str |
10939 | 10938 | ); |
10940 | 10939 | } else { |
10941 | - $str = (string) \str_replace( |
|
10940 | + $str = (string)\str_replace( |
|
10942 | 10941 | $lower, |
10943 | 10942 | $upper, |
10944 | 10943 | $str |
@@ -10952,9 +10951,9 @@ discard block |
||
10952 | 10951 | } |
10953 | 10952 | |
10954 | 10953 | if ($useLower === true) { |
10955 | - $str = (string) \str_replace($FULL_CASE_FOLD[0], $FULL_CASE_FOLD[1], $str); |
|
10954 | + $str = (string)\str_replace($FULL_CASE_FOLD[0], $FULL_CASE_FOLD[1], $str); |
|
10956 | 10955 | } else { |
10957 | - $str = (string) \str_replace($FULL_CASE_FOLD[1], $FULL_CASE_FOLD[0], $str); |
|
10956 | + $str = (string)\str_replace($FULL_CASE_FOLD[1], $FULL_CASE_FOLD[0], $str); |
|
10958 | 10957 | } |
10959 | 10958 | } |
10960 | 10959 | |
@@ -10971,7 +10970,7 @@ discard block |
||
10971 | 10970 | private static function getData(string $file) |
10972 | 10971 | { |
10973 | 10972 | /** @noinspection PhpIncludeInspection */ |
10974 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
10973 | + return include __DIR__.'/data/'.$file.'.php'; |
|
10975 | 10974 | } |
10976 | 10975 | |
10977 | 10976 | /** |
@@ -10983,7 +10982,7 @@ discard block |
||
10983 | 10982 | */ |
10984 | 10983 | private static function getDataIfExists(string $file) |
10985 | 10984 | { |
10986 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
10985 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
10987 | 10986 | if (\file_exists($file)) { |
10988 | 10987 | /** @noinspection PhpIncludeInspection */ |
10989 | 10988 | return include $file; |
@@ -11057,7 +11056,7 @@ discard block |
||
11057 | 11056 | { |
11058 | 11057 | static $RX_CLASSS_CACHE = []; |
11059 | 11058 | |
11060 | - $cacheKey = $s . $class; |
|
11059 | + $cacheKey = $s.$class; |
|
11061 | 11060 | |
11062 | 11061 | if (isset($RX_CLASSS_CACHE[$cacheKey])) { |
11063 | 11062 | return $RX_CLASSS_CACHE[$cacheKey]; |
@@ -11069,7 +11068,7 @@ discard block |
||
11069 | 11068 | /** @noinspection SuspiciousLoopInspection */ |
11070 | 11069 | foreach (self::str_split($s) as $s) { |
11071 | 11070 | if ($s === '-') { |
11072 | - $class[0] = '-' . $class[0]; |
|
11071 | + $class[0] = '-'.$class[0]; |
|
11073 | 11072 | } elseif (!isset($s[2])) { |
11074 | 11073 | $class[0] .= \preg_quote($s, '/'); |
11075 | 11074 | } elseif (self::strlen($s) === 1) { |
@@ -11080,13 +11079,13 @@ discard block |
||
11080 | 11079 | } |
11081 | 11080 | |
11082 | 11081 | if ($class[0]) { |
11083 | - $class[0] = '[' . $class[0] . ']'; |
|
11082 | + $class[0] = '['.$class[0].']'; |
|
11084 | 11083 | } |
11085 | 11084 | |
11086 | 11085 | if (\count($class) === 1) { |
11087 | 11086 | $return = $class[0]; |
11088 | 11087 | } else { |
11089 | - $return = '(?:' . \implode('|', $class) . ')'; |
|
11088 | + $return = '(?:'.\implode('|', $class).')'; |
|
11090 | 11089 | } |
11091 | 11090 | |
11092 | 11091 | $RX_CLASSS_CACHE[$cacheKey] = $return; |
@@ -11223,8 +11222,8 @@ discard block |
||
11223 | 11222 | $buf .= self::$WIN1252_TO_UTF8[$ordC1]; |
11224 | 11223 | } else { |
11225 | 11224 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
11226 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
11227 | - $buf .= $cc1 . $cc2; |
|
11225 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
11226 | + $buf .= $cc1.$cc2; |
|
11228 | 11227 | } |
11229 | 11228 | |
11230 | 11229 | return $buf; |