@@ -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; |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | */ |
| 429 | 429 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
| 430 | 430 | { |
| 431 | - return (string) self::substr($str, $index, 1, $encoding); |
|
| 431 | + return (string)self::substr($str, $index, 1, $encoding); |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | /** |
@@ -524,10 +524,10 @@ discard block |
||
| 524 | 524 | && |
| 525 | 525 | self::$SUPPORT['mbstring'] === false |
| 526 | 526 | ) { |
| 527 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 527 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 528 | 528 | } |
| 529 | 529 | |
| 530 | - $cacheKey = $code_point . $encoding; |
|
| 530 | + $cacheKey = $code_point.$encoding; |
|
| 531 | 531 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
| 532 | 532 | return $CHAR_CACHE[$cacheKey]; |
| 533 | 533 | } |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | if (self::$CHR === null) { |
| 538 | 538 | $chrTmp = self::getData('chr'); |
| 539 | 539 | if ($chrTmp) { |
| 540 | - self::$CHR = (array) $chrTmp; |
|
| 540 | + self::$CHR = (array)$chrTmp; |
|
| 541 | 541 | } |
| 542 | 542 | } |
| 543 | 543 | |
@@ -564,24 +564,24 @@ discard block |
||
| 564 | 564 | if (self::$CHR === null) { |
| 565 | 565 | $chrTmp = self::getData('chr'); |
| 566 | 566 | if ($chrTmp) { |
| 567 | - self::$CHR = (array) $chrTmp; |
|
| 567 | + self::$CHR = (array)$chrTmp; |
|
| 568 | 568 | } |
| 569 | 569 | } |
| 570 | 570 | |
| 571 | - $code_point = (int) $code_point; |
|
| 571 | + $code_point = (int)$code_point; |
|
| 572 | 572 | if ($code_point <= 0x7F) { |
| 573 | 573 | $chr = self::$CHR[$code_point]; |
| 574 | 574 | } elseif ($code_point <= 0x7FF) { |
| 575 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
| 575 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
| 576 | 576 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 577 | 577 | } elseif ($code_point <= 0xFFFF) { |
| 578 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
| 579 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 578 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
| 579 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 580 | 580 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 581 | 581 | } else { |
| 582 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
| 583 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 584 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 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 | 585 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 586 | 586 | } |
| 587 | 587 | |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | |
| 634 | 634 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
| 635 | 635 | return \array_map( |
| 636 | - function ($data) { |
|
| 636 | + function($data) { |
|
| 637 | 637 | return self::strlen_in_byte($data); |
| 638 | 638 | }, |
| 639 | 639 | $strSplit |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | | ( [\x80-\xBF] ) # invalid byte in range 10000000 - 10111111 |
| 775 | 775 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
| 776 | 776 | /x'; |
| 777 | - $str = (string) \preg_replace($regx, '$1', $str); |
|
| 777 | + $str = (string)\preg_replace($regx, '$1', $str); |
|
| 778 | 778 | |
| 779 | 779 | if ($replace_diamond_question_mark === true) { |
| 780 | 780 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | public static function cleanup($str): string |
| 810 | 810 | { |
| 811 | 811 | // init |
| 812 | - $str = (string) $str; |
|
| 812 | + $str = (string)$str; |
|
| 813 | 813 | |
| 814 | 814 | if ($str === '') { |
| 815 | 815 | return ''; |
@@ -918,7 +918,7 @@ discard block |
||
| 918 | 918 | */ |
| 919 | 919 | public static function css_stripe_media_queries(string $str): string |
| 920 | 920 | { |
| 921 | - return (string) \preg_replace( |
|
| 921 | + return (string)\preg_replace( |
|
| 922 | 922 | '#@media\\s+(?:only\\s)?(?:[\\s{\\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#misU', |
| 923 | 923 | '', |
| 924 | 924 | $str |
@@ -945,7 +945,7 @@ discard block |
||
| 945 | 945 | */ |
| 946 | 946 | public static function decimal_to_chr($int): string |
| 947 | 947 | { |
| 948 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
| 948 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
| 949 | 949 | } |
| 950 | 950 | |
| 951 | 951 | /** |
@@ -1101,7 +1101,7 @@ discard block |
||
| 1101 | 1101 | && |
| 1102 | 1102 | self::$SUPPORT['mbstring'] === false |
| 1103 | 1103 | ) { |
| 1104 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $toEncoding . '" encoding', \E_USER_WARNING); |
|
| 1104 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$toEncoding.'" encoding', \E_USER_WARNING); |
|
| 1105 | 1105 | } |
| 1106 | 1106 | |
| 1107 | 1107 | if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) { |
@@ -1190,7 +1190,7 @@ discard block |
||
| 1190 | 1190 | $trimChars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
| 1191 | 1191 | |
| 1192 | 1192 | if ($length === null) { |
| 1193 | - $length = (int) \round(self::strlen($str, $encoding) / 2, 0); |
|
| 1193 | + $length = (int)\round(self::strlen($str, $encoding) / 2, 0); |
|
| 1194 | 1194 | } |
| 1195 | 1195 | |
| 1196 | 1196 | if (empty($search)) { |
@@ -1202,7 +1202,7 @@ discard block |
||
| 1202 | 1202 | $end = 0; |
| 1203 | 1203 | } |
| 1204 | 1204 | |
| 1205 | - $pos = (int) \min( |
|
| 1205 | + $pos = (int)\min( |
|
| 1206 | 1206 | self::strpos($str, ' ', $end, $encoding), |
| 1207 | 1207 | self::strpos($str, '.', $end, $encoding) |
| 1208 | 1208 | ); |
@@ -1213,20 +1213,20 @@ discard block |
||
| 1213 | 1213 | return ''; |
| 1214 | 1214 | } |
| 1215 | 1215 | |
| 1216 | - return \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
| 1216 | + return \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
| 1217 | 1217 | } |
| 1218 | 1218 | |
| 1219 | 1219 | return $str; |
| 1220 | 1220 | } |
| 1221 | 1221 | |
| 1222 | 1222 | $wordPos = self::stripos($str, $search, 0, $encoding); |
| 1223 | - $halfSide = (int) ($wordPos - $length / 2 + self::strlen($search, $encoding) / 2); |
|
| 1223 | + $halfSide = (int)($wordPos - $length / 2 + self::strlen($search, $encoding) / 2); |
|
| 1224 | 1224 | |
| 1225 | 1225 | $pos_start = 0; |
| 1226 | 1226 | if ($halfSide > 0) { |
| 1227 | 1227 | $halfText = self::substr($str, 0, $halfSide, $encoding); |
| 1228 | 1228 | if ($halfText !== false) { |
| 1229 | - $pos_start = (int) \max( |
|
| 1229 | + $pos_start = (int)\max( |
|
| 1230 | 1230 | self::strrpos($halfText, ' ', 0, $encoding), |
| 1231 | 1231 | self::strrpos($halfText, '.', 0, $encoding) |
| 1232 | 1232 | ); |
@@ -1241,7 +1241,7 @@ discard block |
||
| 1241 | 1241 | $l = $realLength; |
| 1242 | 1242 | } |
| 1243 | 1243 | |
| 1244 | - $pos_end = (int) \min( |
|
| 1244 | + $pos_end = (int)\min( |
|
| 1245 | 1245 | self::strpos($str, ' ', $l, $encoding), |
| 1246 | 1246 | self::strpos($str, '.', $l, $encoding) |
| 1247 | 1247 | ) - $pos_start; |
@@ -1249,14 +1249,14 @@ discard block |
||
| 1249 | 1249 | if (!$pos_end || $pos_end <= 0) { |
| 1250 | 1250 | $strSub = self::substr($str, $pos_start, self::strlen($str), $encoding); |
| 1251 | 1251 | if ($strSub !== false) { |
| 1252 | - $extract = $replacerForSkippedText . \ltrim($strSub, $trimChars); |
|
| 1252 | + $extract = $replacerForSkippedText.\ltrim($strSub, $trimChars); |
|
| 1253 | 1253 | } else { |
| 1254 | 1254 | $extract = ''; |
| 1255 | 1255 | } |
| 1256 | 1256 | } else { |
| 1257 | 1257 | $strSub = self::substr($str, $pos_start, $pos_end, $encoding); |
| 1258 | 1258 | if ($strSub !== false) { |
| 1259 | - $extract = $replacerForSkippedText . \trim($strSub, $trimChars) . $replacerForSkippedText; |
|
| 1259 | + $extract = $replacerForSkippedText.\trim($strSub, $trimChars).$replacerForSkippedText; |
|
| 1260 | 1260 | } else { |
| 1261 | 1261 | $extract = ''; |
| 1262 | 1262 | } |
@@ -1277,7 +1277,7 @@ discard block |
||
| 1277 | 1277 | if ($pos_end) { |
| 1278 | 1278 | $strSub = self::substr($str, 0, $pos_end, $encoding); |
| 1279 | 1279 | if ($strSub !== false) { |
| 1280 | - $extract = \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
| 1280 | + $extract = \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
| 1281 | 1281 | } else { |
| 1282 | 1282 | $extract = ''; |
| 1283 | 1283 | } |
@@ -1397,7 +1397,7 @@ discard block |
||
| 1397 | 1397 | { |
| 1398 | 1398 | $file_content = \file_get_contents($file_path); |
| 1399 | 1399 | if ($file_content === false) { |
| 1400 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
| 1400 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
| 1401 | 1401 | } |
| 1402 | 1402 | |
| 1403 | 1403 | return self::string_has_bom($file_content); |
@@ -1459,7 +1459,7 @@ discard block |
||
| 1459 | 1459 | ) { |
| 1460 | 1460 | // Prevent leading combining chars |
| 1461 | 1461 | // for NFC-safe concatenations. |
| 1462 | - $var = $leading_combining . $var; |
|
| 1462 | + $var = $leading_combining.$var; |
|
| 1463 | 1463 | } |
| 1464 | 1464 | } |
| 1465 | 1465 | |
@@ -1727,13 +1727,13 @@ discard block |
||
| 1727 | 1727 | $lower = self::$COMMON_CASE_FOLD['lower']; |
| 1728 | 1728 | |
| 1729 | 1729 | if ($useLower === true) { |
| 1730 | - $str = (string) \str_replace( |
|
| 1730 | + $str = (string)\str_replace( |
|
| 1731 | 1731 | $upper, |
| 1732 | 1732 | $lower, |
| 1733 | 1733 | $str |
| 1734 | 1734 | ); |
| 1735 | 1735 | } else { |
| 1736 | - $str = (string) \str_replace( |
|
| 1736 | + $str = (string)\str_replace( |
|
| 1737 | 1737 | $lower, |
| 1738 | 1738 | $upper, |
| 1739 | 1739 | $str |
@@ -1747,9 +1747,9 @@ discard block |
||
| 1747 | 1747 | } |
| 1748 | 1748 | |
| 1749 | 1749 | if ($useLower === true) { |
| 1750 | - $str = (string) \str_replace($FULL_CASE_FOLD[0], $FULL_CASE_FOLD[1], $str); |
|
| 1750 | + $str = (string)\str_replace($FULL_CASE_FOLD[0], $FULL_CASE_FOLD[1], $str); |
|
| 1751 | 1751 | } else { |
| 1752 | - $str = (string) \str_replace($FULL_CASE_FOLD[1], $FULL_CASE_FOLD[0], $str); |
|
| 1752 | + $str = (string)\str_replace($FULL_CASE_FOLD[1], $FULL_CASE_FOLD[0], $str); |
|
| 1753 | 1753 | } |
| 1754 | 1754 | } |
| 1755 | 1755 | |
@@ -1809,7 +1809,7 @@ discard block |
||
| 1809 | 1809 | return $str; |
| 1810 | 1810 | } |
| 1811 | 1811 | |
| 1812 | - $str = (string) $str; |
|
| 1812 | + $str = (string)$str; |
|
| 1813 | 1813 | $last = ''; |
| 1814 | 1814 | while ($last !== $str) { |
| 1815 | 1815 | $last = $str; |
@@ -1949,7 +1949,7 @@ discard block |
||
| 1949 | 1949 | private static function getData(string $file) |
| 1950 | 1950 | { |
| 1951 | 1951 | /** @noinspection PhpIncludeInspection */ |
| 1952 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
| 1952 | + return include __DIR__.'/data/'.$file.'.php'; |
|
| 1953 | 1953 | } |
| 1954 | 1954 | |
| 1955 | 1955 | /** |
@@ -1961,7 +1961,7 @@ discard block |
||
| 1961 | 1961 | */ |
| 1962 | 1962 | private static function getDataIfExists(string $file) |
| 1963 | 1963 | { |
| 1964 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
| 1964 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
| 1965 | 1965 | if (\file_exists($file)) { |
| 1966 | 1966 | /** @noinspection PhpIncludeInspection */ |
| 1967 | 1967 | return include $file; |
@@ -2025,7 +2025,7 @@ discard block |
||
| 2025 | 2025 | } |
| 2026 | 2026 | |
| 2027 | 2027 | $str_info = \unpack('C2chars', $str_info); |
| 2028 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
| 2028 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
| 2029 | 2029 | |
| 2030 | 2030 | // DEBUG |
| 2031 | 2031 | //var_dump($type_code); |
@@ -2138,16 +2138,16 @@ discard block |
||
| 2138 | 2138 | */ |
| 2139 | 2139 | public static function get_unique_string($entropyExtra = '', bool $md5 = true): string |
| 2140 | 2140 | { |
| 2141 | - $uniqueHelper = \mt_rand() . |
|
| 2142 | - \session_id() . |
|
| 2143 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2144 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2141 | + $uniqueHelper = \mt_rand(). |
|
| 2142 | + \session_id(). |
|
| 2143 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
| 2144 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
| 2145 | 2145 | $entropyExtra; |
| 2146 | 2146 | |
| 2147 | 2147 | $uniqueString = \uniqid($uniqueHelper, true); |
| 2148 | 2148 | |
| 2149 | 2149 | if ($md5) { |
| 2150 | - $uniqueString = \md5($uniqueString . $uniqueHelper); |
|
| 2150 | + $uniqueString = \md5($uniqueString.$uniqueHelper); |
|
| 2151 | 2151 | } |
| 2152 | 2152 | |
| 2153 | 2153 | return $uniqueString; |
@@ -2217,7 +2217,7 @@ discard block |
||
| 2217 | 2217 | public static function hex_to_int($hexDec) |
| 2218 | 2218 | { |
| 2219 | 2219 | // init |
| 2220 | - $hexDec = (string) $hexDec; |
|
| 2220 | + $hexDec = (string)$hexDec; |
|
| 2221 | 2221 | |
| 2222 | 2222 | if ($hexDec === '') { |
| 2223 | 2223 | return false; |
@@ -2292,7 +2292,7 @@ discard block |
||
| 2292 | 2292 | return \implode( |
| 2293 | 2293 | '', |
| 2294 | 2294 | \array_map( |
| 2295 | - function ($chr) use ($keepAsciiChars, $encoding) { |
|
| 2295 | + function($chr) use ($keepAsciiChars, $encoding) { |
|
| 2296 | 2296 | return self::single_chr_html_encode($chr, $keepAsciiChars, $encoding); |
| 2297 | 2297 | }, |
| 2298 | 2298 | self::split($str) |
@@ -2408,7 +2408,7 @@ discard block |
||
| 2408 | 2408 | && |
| 2409 | 2409 | self::$SUPPORT['mbstring'] === false |
| 2410 | 2410 | ) { |
| 2411 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 2411 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 2412 | 2412 | } |
| 2413 | 2413 | |
| 2414 | 2414 | if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) { |
@@ -2426,9 +2426,9 @@ discard block |
||
| 2426 | 2426 | $encoding |
| 2427 | 2427 | ); |
| 2428 | 2428 | } else { |
| 2429 | - $str = (string) \preg_replace_callback( |
|
| 2429 | + $str = (string)\preg_replace_callback( |
|
| 2430 | 2430 | "/&#\d{2,6};/", |
| 2431 | - function ($matches) use ($encoding) { |
|
| 2431 | + function($matches) use ($encoding) { |
|
| 2432 | 2432 | // always fallback via symfony polyfill |
| 2433 | 2433 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
| 2434 | 2434 | |
@@ -2481,7 +2481,7 @@ discard block |
||
| 2481 | 2481 | */ |
| 2482 | 2482 | public static function html_stripe_empty_tags(string $str): string |
| 2483 | 2483 | { |
| 2484 | - return (string) \preg_replace( |
|
| 2484 | + return (string)\preg_replace( |
|
| 2485 | 2485 | "/<[^\/>]*>(([\s]?)*|)<\/[^>]*>/iu", |
| 2486 | 2486 | '', |
| 2487 | 2487 | $str |
@@ -2768,9 +2768,9 @@ discard block |
||
| 2768 | 2768 | { |
| 2769 | 2769 | $hex = \dechex($int); |
| 2770 | 2770 | |
| 2771 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
| 2771 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
| 2772 | 2772 | |
| 2773 | - return $pfix . $hex . ''; |
|
| 2773 | + return $pfix.$hex.''; |
|
| 2774 | 2774 | } |
| 2775 | 2775 | |
| 2776 | 2776 | /** |
@@ -3008,7 +3008,7 @@ discard block |
||
| 3008 | 3008 | return false; |
| 3009 | 3009 | } |
| 3010 | 3010 | |
| 3011 | - $base64String = (string) \base64_decode($str, true); |
|
| 3011 | + $base64String = (string)\base64_decode($str, true); |
|
| 3012 | 3012 | |
| 3013 | 3013 | return $base64String && \base64_encode($base64String) === $str; |
| 3014 | 3014 | } |
@@ -3023,7 +3023,7 @@ discard block |
||
| 3023 | 3023 | */ |
| 3024 | 3024 | public static function is_binary($input, bool $strict = false): bool |
| 3025 | 3025 | { |
| 3026 | - $input = (string) $input; |
|
| 3026 | + $input = (string)$input; |
|
| 3027 | 3027 | if ($input === '') { |
| 3028 | 3028 | return false; |
| 3029 | 3029 | } |
@@ -3272,7 +3272,7 @@ discard block |
||
| 3272 | 3272 | public static function is_utf16($str, $checkIfStringIsBinary = true) |
| 3273 | 3273 | { |
| 3274 | 3274 | // init |
| 3275 | - $str = (string) $str; |
|
| 3275 | + $str = (string)$str; |
|
| 3276 | 3276 | $strChars = []; |
| 3277 | 3277 | |
| 3278 | 3278 | if ( |
@@ -3348,7 +3348,7 @@ discard block |
||
| 3348 | 3348 | public static function is_utf32($str, $checkIfStringIsBinary = true) |
| 3349 | 3349 | { |
| 3350 | 3350 | // init |
| 3351 | - $str = (string) $str; |
|
| 3351 | + $str = (string)$str; |
|
| 3352 | 3352 | $strChars = []; |
| 3353 | 3353 | |
| 3354 | 3354 | if ( |
@@ -3470,7 +3470,7 @@ discard block |
||
| 3470 | 3470 | self::$ORD = self::getData('ord'); |
| 3471 | 3471 | } |
| 3472 | 3472 | |
| 3473 | - $len = self::strlen_in_byte((string) $str); |
|
| 3473 | + $len = self::strlen_in_byte((string)$str); |
|
| 3474 | 3474 | /** @noinspection ForeachInvariantsInspection */ |
| 3475 | 3475 | for ($i = 0; $i < $len; $i++) { |
| 3476 | 3476 | $in = self::$ORD[$str[$i]]; |
@@ -3705,14 +3705,14 @@ discard block |
||
| 3705 | 3705 | } |
| 3706 | 3706 | |
| 3707 | 3707 | $strPartOne = self::strtolower( |
| 3708 | - (string) self::substr($str, 0, 1, $encoding, $cleanUtf8), |
|
| 3708 | + (string)self::substr($str, 0, 1, $encoding, $cleanUtf8), |
|
| 3709 | 3709 | $encoding, |
| 3710 | 3710 | $cleanUtf8, |
| 3711 | 3711 | $lang, |
| 3712 | 3712 | $tryToKeepStringLength |
| 3713 | 3713 | ); |
| 3714 | 3714 | |
| 3715 | - return $strPartOne . $strPartTwo; |
|
| 3715 | + return $strPartOne.$strPartTwo; |
|
| 3716 | 3716 | } |
| 3717 | 3717 | |
| 3718 | 3718 | /** |
@@ -3880,7 +3880,7 @@ discard block |
||
| 3880 | 3880 | { |
| 3881 | 3881 | $bytes = self::chr_size_list($str); |
| 3882 | 3882 | if (\count($bytes) > 0) { |
| 3883 | - return (int) \max($bytes); |
|
| 3883 | + return (int)\max($bytes); |
|
| 3884 | 3884 | } |
| 3885 | 3885 | |
| 3886 | 3886 | return 0; |
@@ -3974,7 +3974,7 @@ discard block |
||
| 3974 | 3974 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
| 3975 | 3975 | |
| 3976 | 3976 | // init |
| 3977 | - $encoding = (string) $encoding; |
|
| 3977 | + $encoding = (string)$encoding; |
|
| 3978 | 3978 | |
| 3979 | 3979 | if ( |
| 3980 | 3980 | !$encoding |
@@ -4112,7 +4112,7 @@ discard block |
||
| 4112 | 4112 | */ |
| 4113 | 4113 | public static function normalize_line_ending(string $str): string |
| 4114 | 4114 | { |
| 4115 | - return (string) \str_replace(["\r\n", "\r"], "\n", $str); |
|
| 4115 | + return (string)\str_replace(["\r\n", "\r"], "\n", $str); |
|
| 4116 | 4116 | } |
| 4117 | 4117 | |
| 4118 | 4118 | /** |
@@ -4160,7 +4160,7 @@ discard block |
||
| 4160 | 4160 | } |
| 4161 | 4161 | |
| 4162 | 4162 | static $WHITESPACE_CACHE = []; |
| 4163 | - $cacheKey = (int) $keepNonBreakingSpace; |
|
| 4163 | + $cacheKey = (int)$keepNonBreakingSpace; |
|
| 4164 | 4164 | |
| 4165 | 4165 | if (!isset($WHITESPACE_CACHE[$cacheKey])) { |
| 4166 | 4166 | $WHITESPACE_CACHE[$cacheKey] = self::$WHITESPACE_TABLE; |
@@ -4200,7 +4200,7 @@ discard block |
||
| 4200 | 4200 | public static function ord($chr, string $encoding = 'UTF-8'): int |
| 4201 | 4201 | { |
| 4202 | 4202 | // init |
| 4203 | - $chr = (string) $chr; |
|
| 4203 | + $chr = (string)$chr; |
|
| 4204 | 4204 | |
| 4205 | 4205 | static $CHAR_CACHE = []; |
| 4206 | 4206 | |
@@ -4211,7 +4211,7 @@ discard block |
||
| 4211 | 4211 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4212 | 4212 | } |
| 4213 | 4213 | |
| 4214 | - $cacheKey = $chr_orig . $encoding; |
|
| 4214 | + $cacheKey = $chr_orig.$encoding; |
|
| 4215 | 4215 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
| 4216 | 4216 | return $CHAR_CACHE[$cacheKey]; |
| 4217 | 4217 | } |
@@ -4242,22 +4242,22 @@ discard block |
||
| 4242 | 4242 | } |
| 4243 | 4243 | |
| 4244 | 4244 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
| 4245 | - $chr = \unpack('C*', (string) self::substr($chr, 0, 4, 'CP850')); |
|
| 4245 | + $chr = \unpack('C*', (string)self::substr($chr, 0, 4, 'CP850')); |
|
| 4246 | 4246 | $code = $chr ? $chr[1] : 0; |
| 4247 | 4247 | |
| 4248 | 4248 | if ($code >= 0xF0 && isset($chr[4])) { |
| 4249 | 4249 | /** @noinspection UnnecessaryCastingInspection */ |
| 4250 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 4250 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 4251 | 4251 | } |
| 4252 | 4252 | |
| 4253 | 4253 | if ($code >= 0xE0 && isset($chr[3])) { |
| 4254 | 4254 | /** @noinspection UnnecessaryCastingInspection */ |
| 4255 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 4255 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 4256 | 4256 | } |
| 4257 | 4257 | |
| 4258 | 4258 | if ($code >= 0xC0 && isset($chr[2])) { |
| 4259 | 4259 | /** @noinspection UnnecessaryCastingInspection */ |
| 4260 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 4260 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 4261 | 4261 | } |
| 4262 | 4262 | |
| 4263 | 4263 | return $CHAR_CACHE[$cacheKey] = $code; |
@@ -4310,7 +4310,7 @@ discard block |
||
| 4310 | 4310 | public static function pcre_utf8_support(): bool |
| 4311 | 4311 | { |
| 4312 | 4312 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 4313 | - return (bool) @\preg_match('//u', ''); |
|
| 4313 | + return (bool)@\preg_match('//u', ''); |
|
| 4314 | 4314 | } |
| 4315 | 4315 | |
| 4316 | 4316 | /** |
@@ -4336,10 +4336,10 @@ discard block |
||
| 4336 | 4336 | } |
| 4337 | 4337 | |
| 4338 | 4338 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4339 | - if (\ctype_digit((string) $var1)) { |
|
| 4340 | - $start = (int) $var1; |
|
| 4339 | + if (\ctype_digit((string)$var1)) { |
|
| 4340 | + $start = (int)$var1; |
|
| 4341 | 4341 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var1)) { |
| 4342 | - $start = (int) self::hex_to_int($var1); |
|
| 4342 | + $start = (int)self::hex_to_int($var1); |
|
| 4343 | 4343 | } else { |
| 4344 | 4344 | $start = self::ord($var1); |
| 4345 | 4345 | } |
@@ -4349,10 +4349,10 @@ discard block |
||
| 4349 | 4349 | } |
| 4350 | 4350 | |
| 4351 | 4351 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4352 | - if (\ctype_digit((string) $var2)) { |
|
| 4353 | - $end = (int) $var2; |
|
| 4352 | + if (\ctype_digit((string)$var2)) { |
|
| 4353 | + $end = (int)$var2; |
|
| 4354 | 4354 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var2)) { |
| 4355 | - $end = (int) self::hex_to_int($var2); |
|
| 4355 | + $end = (int)self::hex_to_int($var2); |
|
| 4356 | 4356 | } else { |
| 4357 | 4357 | $end = self::ord($var2); |
| 4358 | 4358 | } |
@@ -4397,7 +4397,7 @@ discard block |
||
| 4397 | 4397 | |
| 4398 | 4398 | $pattern = '/%u([0-9a-f]{3,4})/i'; |
| 4399 | 4399 | if (\preg_match($pattern, $str)) { |
| 4400 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
| 4400 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
| 4401 | 4401 | } |
| 4402 | 4402 | |
| 4403 | 4403 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -4475,8 +4475,8 @@ discard block |
||
| 4475 | 4475 | $delimiter = '/'; |
| 4476 | 4476 | } |
| 4477 | 4477 | |
| 4478 | - return (string) \preg_replace( |
|
| 4479 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
| 4478 | + return (string)\preg_replace( |
|
| 4479 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
| 4480 | 4480 | $replacement, |
| 4481 | 4481 | $str |
| 4482 | 4482 | ); |
@@ -4521,7 +4521,7 @@ discard block |
||
| 4521 | 4521 | |
| 4522 | 4522 | $strLength -= $bomByteLength; |
| 4523 | 4523 | |
| 4524 | - $str = (string) $strTmp; |
|
| 4524 | + $str = (string)$strTmp; |
|
| 4525 | 4525 | } |
| 4526 | 4526 | } |
| 4527 | 4527 | |
@@ -4545,7 +4545,7 @@ discard block |
||
| 4545 | 4545 | if (\is_array($what) === true) { |
| 4546 | 4546 | /** @noinspection ForeachSourceInspection */ |
| 4547 | 4547 | foreach ($what as $item) { |
| 4548 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/', $item, $str); |
|
| 4548 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/', $item, $str); |
|
| 4549 | 4549 | } |
| 4550 | 4550 | } |
| 4551 | 4551 | |
@@ -4577,7 +4577,7 @@ discard block |
||
| 4577 | 4577 | */ |
| 4578 | 4578 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
| 4579 | 4579 | { |
| 4580 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 4580 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 4581 | 4581 | } |
| 4582 | 4582 | |
| 4583 | 4583 | /** |
@@ -4608,7 +4608,7 @@ discard block |
||
| 4608 | 4608 | $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
| 4609 | 4609 | |
| 4610 | 4610 | do { |
| 4611 | - $str = (string) \preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
| 4611 | + $str = (string)\preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
| 4612 | 4612 | } while ($count !== 0); |
| 4613 | 4613 | |
| 4614 | 4614 | return $str; |
@@ -4626,7 +4626,7 @@ discard block |
||
| 4626 | 4626 | public static function remove_left(string $str, string $substring, string $encoding = 'UTF-8'): string |
| 4627 | 4627 | { |
| 4628 | 4628 | if (self::str_starts_with($str, $substring)) { |
| 4629 | - return (string) self::substr( |
|
| 4629 | + return (string)self::substr( |
|
| 4630 | 4630 | $str, |
| 4631 | 4631 | self::strlen($substring, $encoding), |
| 4632 | 4632 | null, |
@@ -4649,7 +4649,7 @@ discard block |
||
| 4649 | 4649 | public static function remove_right(string $str, string $substring, string $encoding = 'UTF-8'): string |
| 4650 | 4650 | { |
| 4651 | 4651 | if (self::str_ends_with($str, $substring)) { |
| 4652 | - return (string) self::substr( |
|
| 4652 | + return (string)self::substr( |
|
| 4653 | 4653 | $str, |
| 4654 | 4654 | 0, |
| 4655 | 4655 | self::strlen($str, $encoding) - self::strlen($substring, $encoding) |
@@ -4791,7 +4791,7 @@ discard block |
||
| 4791 | 4791 | { |
| 4792 | 4792 | static $RX_CLASSS_CACHE = []; |
| 4793 | 4793 | |
| 4794 | - $cacheKey = $s . $class; |
|
| 4794 | + $cacheKey = $s.$class; |
|
| 4795 | 4795 | |
| 4796 | 4796 | if (isset($RX_CLASSS_CACHE[$cacheKey])) { |
| 4797 | 4797 | return $RX_CLASSS_CACHE[$cacheKey]; |
@@ -4803,7 +4803,7 @@ discard block |
||
| 4803 | 4803 | /** @noinspection SuspiciousLoopInspection */ |
| 4804 | 4804 | foreach (self::str_split($s) as $s) { |
| 4805 | 4805 | if ($s === '-') { |
| 4806 | - $class[0] = '-' . $class[0]; |
|
| 4806 | + $class[0] = '-'.$class[0]; |
|
| 4807 | 4807 | } elseif (!isset($s[2])) { |
| 4808 | 4808 | $class[0] .= \preg_quote($s, '/'); |
| 4809 | 4809 | } elseif (self::strlen($s) === 1) { |
@@ -4814,13 +4814,13 @@ discard block |
||
| 4814 | 4814 | } |
| 4815 | 4815 | |
| 4816 | 4816 | if ($class[0]) { |
| 4817 | - $class[0] = '[' . $class[0] . ']'; |
|
| 4817 | + $class[0] = '['.$class[0].']'; |
|
| 4818 | 4818 | } |
| 4819 | 4819 | |
| 4820 | 4820 | if (\count($class) === 1) { |
| 4821 | 4821 | $return = $class[0]; |
| 4822 | 4822 | } else { |
| 4823 | - $return = '(?:' . \implode('|', $class) . ')'; |
|
| 4823 | + $return = '(?:'.\implode('|', $class).')'; |
|
| 4824 | 4824 | } |
| 4825 | 4825 | |
| 4826 | 4826 | $RX_CLASSS_CACHE[$cacheKey] = $return; |
@@ -4839,7 +4839,7 @@ discard block |
||
| 4839 | 4839 | |
| 4840 | 4840 | echo '<pre>'; |
| 4841 | 4841 | foreach (self::$SUPPORT as $key => $value) { |
| 4842 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
| 4842 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
| 4843 | 4843 | } |
| 4844 | 4844 | echo '</pre>'; |
| 4845 | 4845 | } |
@@ -4871,7 +4871,7 @@ discard block |
||
| 4871 | 4871 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4872 | 4872 | } |
| 4873 | 4873 | |
| 4874 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
| 4874 | + return '&#'.self::ord($char, $encoding).';'; |
|
| 4875 | 4875 | } |
| 4876 | 4876 | |
| 4877 | 4877 | /** |
@@ -4909,7 +4909,7 @@ discard block |
||
| 4909 | 4909 | } |
| 4910 | 4910 | |
| 4911 | 4911 | // init |
| 4912 | - $str = (string) $str; |
|
| 4912 | + $str = (string)$str; |
|
| 4913 | 4913 | |
| 4914 | 4914 | if ($str === '') { |
| 4915 | 4915 | return []; |
@@ -4952,7 +4952,7 @@ discard block |
||
| 4952 | 4952 | ($str[$i] & "\xE0") === "\xC0" |
| 4953 | 4953 | ) { |
| 4954 | 4954 | if (($str[$i + 1] & "\xC0") === "\x80") { |
| 4955 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
| 4955 | + $ret[] = $str[$i].$str[$i + 1]; |
|
| 4956 | 4956 | |
| 4957 | 4957 | $i++; |
| 4958 | 4958 | } |
@@ -4966,7 +4966,7 @@ discard block |
||
| 4966 | 4966 | && |
| 4967 | 4967 | ($str[$i + 2] & "\xC0") === "\x80" |
| 4968 | 4968 | ) { |
| 4969 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
| 4969 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
| 4970 | 4970 | |
| 4971 | 4971 | $i += 2; |
| 4972 | 4972 | } |
@@ -4982,7 +4982,7 @@ discard block |
||
| 4982 | 4982 | && |
| 4983 | 4983 | ($str[$i + 3] & "\xC0") === "\x80" |
| 4984 | 4984 | ) { |
| 4985 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
| 4985 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
| 4986 | 4986 | |
| 4987 | 4987 | $i += 3; |
| 4988 | 4988 | } |
@@ -4994,7 +4994,7 @@ discard block |
||
| 4994 | 4994 | $ret = \array_chunk($ret, $length); |
| 4995 | 4995 | |
| 4996 | 4996 | return \array_map( |
| 4997 | - function ($item) { |
|
| 4997 | + function($item) { |
|
| 4998 | 4998 | return \implode('', $item); |
| 4999 | 4999 | }, |
| 5000 | 5000 | $ret |
@@ -5024,11 +5024,11 @@ discard block |
||
| 5024 | 5024 | public static function str_camelize(string $str, string $encoding = 'UTF-8', bool $cleanUtf8 = false, string $lang = null, bool $tryToKeepStringLength = false): string |
| 5025 | 5025 | { |
| 5026 | 5026 | $str = self::lcfirst(self::trim($str), $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
| 5027 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
| 5027 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
| 5028 | 5028 | |
| 5029 | - $str = (string) \preg_replace_callback( |
|
| 5029 | + $str = (string)\preg_replace_callback( |
|
| 5030 | 5030 | '/[-_\s]+(.)?/u', |
| 5031 | - function ($match) use ($encoding, $cleanUtf8, $lang, $tryToKeepStringLength) { |
|
| 5031 | + function($match) use ($encoding, $cleanUtf8, $lang, $tryToKeepStringLength) { |
|
| 5032 | 5032 | if (isset($match[1])) { |
| 5033 | 5033 | return self::strtoupper($match[1], $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
| 5034 | 5034 | } |
@@ -5038,9 +5038,9 @@ discard block |
||
| 5038 | 5038 | $str |
| 5039 | 5039 | ); |
| 5040 | 5040 | |
| 5041 | - $str = (string) \preg_replace_callback( |
|
| 5041 | + $str = (string)\preg_replace_callback( |
|
| 5042 | 5042 | '/[\d]+(.)?/u', |
| 5043 | - function ($match) use ($encoding, $cleanUtf8, $lang, $tryToKeepStringLength) { |
|
| 5043 | + function($match) use ($encoding, $cleanUtf8, $lang, $tryToKeepStringLength) { |
|
| 5044 | 5044 | return self::strtoupper($match[0], $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
| 5045 | 5045 | }, |
| 5046 | 5046 | $str |
@@ -5175,7 +5175,7 @@ discard block |
||
| 5175 | 5175 | |
| 5176 | 5176 | // only a fallback to prevent BC in the api ... |
| 5177 | 5177 | if ($caseSensitive !== false && $caseSensitive !== true) { |
| 5178 | - $encoding = (string) $caseSensitive; |
|
| 5178 | + $encoding = (string)$caseSensitive; |
|
| 5179 | 5179 | } |
| 5180 | 5180 | |
| 5181 | 5181 | if ($caseSensitive) { |
@@ -5209,7 +5209,7 @@ discard block |
||
| 5209 | 5209 | |
| 5210 | 5210 | // only a fallback to prevent BC in the api ... |
| 5211 | 5211 | if ($caseSensitive !== false && $caseSensitive !== true) { |
| 5212 | - $encoding = (string) $caseSensitive; |
|
| 5212 | + $encoding = (string)$caseSensitive; |
|
| 5213 | 5213 | } |
| 5214 | 5214 | |
| 5215 | 5215 | foreach ($needles as $needle) { |
@@ -5291,11 +5291,11 @@ discard block |
||
| 5291 | 5291 | ): string { |
| 5292 | 5292 | $str = self::trim($str); |
| 5293 | 5293 | |
| 5294 | - $str = (string) \preg_replace('/\B([A-Z])/u', '-\1', $str); |
|
| 5294 | + $str = (string)\preg_replace('/\B([A-Z])/u', '-\1', $str); |
|
| 5295 | 5295 | |
| 5296 | 5296 | $str = self::strtolower($str, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
| 5297 | 5297 | |
| 5298 | - return (string) \preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
| 5298 | + return (string)\preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
| 5299 | 5299 | } |
| 5300 | 5300 | |
| 5301 | 5301 | /** |
@@ -5310,7 +5310,7 @@ discard block |
||
| 5310 | 5310 | public static function str_detect_encoding($str) |
| 5311 | 5311 | { |
| 5312 | 5312 | // init |
| 5313 | - $str = (string) $str; |
|
| 5313 | + $str = (string)$str; |
|
| 5314 | 5314 | |
| 5315 | 5315 | // |
| 5316 | 5316 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5416,7 +5416,7 @@ discard block |
||
| 5416 | 5416 | foreach (self::$ENCODINGS as $encodingTmp) { |
| 5417 | 5417 | // INFO: //IGNORE but still throw notice |
| 5418 | 5418 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 5419 | - if ((string) @\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str) === $str) { |
|
| 5419 | + if ((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str) === $str) { |
|
| 5420 | 5420 | return $encodingTmp; |
| 5421 | 5421 | } |
| 5422 | 5422 | } |
@@ -5478,7 +5478,7 @@ discard block |
||
| 5478 | 5478 | public static function str_ensure_left(string $str, string $substring): string |
| 5479 | 5479 | { |
| 5480 | 5480 | if (!self::str_starts_with($str, $substring)) { |
| 5481 | - $str = $substring . $str; |
|
| 5481 | + $str = $substring.$str; |
|
| 5482 | 5482 | } |
| 5483 | 5483 | |
| 5484 | 5484 | return $str; |
@@ -5687,7 +5687,7 @@ discard block |
||
| 5687 | 5687 | $start = self::substr($str, 0, $index, $encoding); |
| 5688 | 5688 | $end = self::substr($str, $index, $len, $encoding); |
| 5689 | 5689 | |
| 5690 | - return $start . $substring . $end; |
|
| 5690 | + return $start.$substring.$end; |
|
| 5691 | 5691 | } |
| 5692 | 5692 | |
| 5693 | 5693 | /** |
@@ -5717,15 +5717,15 @@ discard block |
||
| 5717 | 5717 | */ |
| 5718 | 5718 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
| 5719 | 5719 | { |
| 5720 | - $search = (array) $search; |
|
| 5720 | + $search = (array)$search; |
|
| 5721 | 5721 | |
| 5722 | 5722 | /** @noinspection AlterInForeachInspection */ |
| 5723 | 5723 | foreach ($search as &$s) { |
| 5724 | - $s = (string) $s; |
|
| 5724 | + $s = (string)$s; |
|
| 5725 | 5725 | if ($s === '') { |
| 5726 | 5726 | $s = '/^(?<=.)$/'; |
| 5727 | 5727 | } else { |
| 5728 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
| 5728 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
| 5729 | 5729 | } |
| 5730 | 5730 | } |
| 5731 | 5731 | |
@@ -5757,11 +5757,11 @@ discard block |
||
| 5757 | 5757 | } |
| 5758 | 5758 | |
| 5759 | 5759 | if ($search === '') { |
| 5760 | - return $str . $replacement; |
|
| 5760 | + return $str.$replacement; |
|
| 5761 | 5761 | } |
| 5762 | 5762 | |
| 5763 | 5763 | if (\stripos($str, $search) === 0) { |
| 5764 | - return $replacement . \substr($str, \strlen($search)); |
|
| 5764 | + return $replacement.\substr($str, \strlen($search)); |
|
| 5765 | 5765 | } |
| 5766 | 5766 | |
| 5767 | 5767 | return $str; |
@@ -5789,11 +5789,11 @@ discard block |
||
| 5789 | 5789 | } |
| 5790 | 5790 | |
| 5791 | 5791 | if ($search === '') { |
| 5792 | - return $str . $replacement; |
|
| 5792 | + return $str.$replacement; |
|
| 5793 | 5793 | } |
| 5794 | 5794 | |
| 5795 | 5795 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 5796 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 5796 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 5797 | 5797 | } |
| 5798 | 5798 | |
| 5799 | 5799 | return $str; |
@@ -5873,7 +5873,7 @@ discard block |
||
| 5873 | 5873 | return ''; |
| 5874 | 5874 | } |
| 5875 | 5875 | |
| 5876 | - return (string) self::substr( |
|
| 5876 | + return (string)self::substr( |
|
| 5877 | 5877 | $str, |
| 5878 | 5878 | $offset + self::strlen($separator, $encoding), |
| 5879 | 5879 | null, |
@@ -5905,7 +5905,7 @@ discard block |
||
| 5905 | 5905 | return ''; |
| 5906 | 5906 | } |
| 5907 | 5907 | |
| 5908 | - return (string) self::substr( |
|
| 5908 | + return (string)self::substr( |
|
| 5909 | 5909 | $str, |
| 5910 | 5910 | $offset + self::strlen($separator, $encoding), |
| 5911 | 5911 | null, |
@@ -5937,7 +5937,7 @@ discard block |
||
| 5937 | 5937 | return ''; |
| 5938 | 5938 | } |
| 5939 | 5939 | |
| 5940 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 5940 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 5941 | 5941 | } |
| 5942 | 5942 | |
| 5943 | 5943 | /** |
@@ -5964,7 +5964,7 @@ discard block |
||
| 5964 | 5964 | return ''; |
| 5965 | 5965 | } |
| 5966 | 5966 | |
| 5967 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 5967 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 5968 | 5968 | } |
| 5969 | 5969 | |
| 5970 | 5970 | /** |
@@ -6072,7 +6072,7 @@ discard block |
||
| 6072 | 6072 | return $str; |
| 6073 | 6073 | } |
| 6074 | 6074 | |
| 6075 | - return self::substr($str, 0, $length - self::strlen($strAddOn), $encoding) . $strAddOn; |
|
| 6075 | + return self::substr($str, 0, $length - self::strlen($strAddOn), $encoding).$strAddOn; |
|
| 6076 | 6076 | } |
| 6077 | 6077 | |
| 6078 | 6078 | /** |
@@ -6100,18 +6100,18 @@ discard block |
||
| 6100 | 6100 | } |
| 6101 | 6101 | |
| 6102 | 6102 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
| 6103 | - return self::substr($str, 0, $length - 1, $encoding) . $strAddOn; |
|
| 6103 | + return self::substr($str, 0, $length - 1, $encoding).$strAddOn; |
|
| 6104 | 6104 | } |
| 6105 | 6105 | |
| 6106 | - $str = (string) self::substr($str, 0, $length, $encoding); |
|
| 6106 | + $str = (string)self::substr($str, 0, $length, $encoding); |
|
| 6107 | 6107 | $array = \explode(' ', $str); |
| 6108 | 6108 | \array_pop($array); |
| 6109 | 6109 | $new_str = \implode(' ', $array); |
| 6110 | 6110 | |
| 6111 | 6111 | if ($new_str === '') { |
| 6112 | - $str = self::substr($str, 0, $length - 1, $encoding) . $strAddOn; |
|
| 6112 | + $str = self::substr($str, 0, $length - 1, $encoding).$strAddOn; |
|
| 6113 | 6113 | } else { |
| 6114 | - $str = $new_str . $strAddOn; |
|
| 6114 | + $str = $new_str.$strAddOn; |
|
| 6115 | 6115 | } |
| 6116 | 6116 | |
| 6117 | 6117 | return $str; |
@@ -6214,7 +6214,7 @@ discard block |
||
| 6214 | 6214 | $char = self::substr($str, -$i, 1, $encoding); |
| 6215 | 6215 | |
| 6216 | 6216 | if ($char === self::substr($otherStr, -$i, 1, $encoding)) { |
| 6217 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
| 6217 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
| 6218 | 6218 | } else { |
| 6219 | 6219 | break; |
| 6220 | 6220 | } |
@@ -6233,7 +6233,7 @@ discard block |
||
| 6233 | 6233 | */ |
| 6234 | 6234 | public static function str_matches_pattern(string $str, string $pattern): bool |
| 6235 | 6235 | { |
| 6236 | - if (\preg_match('/' . $pattern . '/u', $str)) { |
|
| 6236 | + if (\preg_match('/'.$pattern.'/u', $str)) { |
|
| 6237 | 6237 | return true; |
| 6238 | 6238 | } |
| 6239 | 6239 | |
@@ -6313,7 +6313,7 @@ discard block |
||
| 6313 | 6313 | return ''; |
| 6314 | 6314 | } |
| 6315 | 6315 | |
| 6316 | - if ($pad_type !== (int) $pad_type) { |
|
| 6316 | + if ($pad_type !== (int)$pad_type) { |
|
| 6317 | 6317 | if ($pad_type === 'left') { |
| 6318 | 6318 | $pad_type = \STR_PAD_LEFT; |
| 6319 | 6319 | } elseif ($pad_type === 'right') { |
@@ -6322,7 +6322,7 @@ discard block |
||
| 6322 | 6322 | $pad_type = \STR_PAD_BOTH; |
| 6323 | 6323 | } else { |
| 6324 | 6324 | throw new \InvalidArgumentException( |
| 6325 | - 'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
| 6325 | + 'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
| 6326 | 6326 | ); |
| 6327 | 6327 | } |
| 6328 | 6328 | } |
@@ -6340,28 +6340,28 @@ discard block |
||
| 6340 | 6340 | |
| 6341 | 6341 | switch ($pad_type) { |
| 6342 | 6342 | case \STR_PAD_LEFT: |
| 6343 | - $pre = \str_repeat($pad_string, (int) \ceil($diff / $ps_length)); |
|
| 6344 | - $pre = (string) self::substr($pre, 0, $diff, $encoding); |
|
| 6343 | + $pre = \str_repeat($pad_string, (int)\ceil($diff / $ps_length)); |
|
| 6344 | + $pre = (string)self::substr($pre, 0, $diff, $encoding); |
|
| 6345 | 6345 | $post = ''; |
| 6346 | 6346 | |
| 6347 | 6347 | break; |
| 6348 | 6348 | |
| 6349 | 6349 | case \STR_PAD_BOTH: |
| 6350 | - $pre = \str_repeat($pad_string, (int) \ceil($diff / $ps_length / 2)); |
|
| 6351 | - $pre = (string) self::substr($pre, 0, (int) \floor($diff / 2), $encoding); |
|
| 6352 | - $post = \str_repeat($pad_string, (int) \ceil($diff / $ps_length / 2)); |
|
| 6353 | - $post = (string) self::substr($post, 0, (int) \ceil($diff / 2), $encoding); |
|
| 6350 | + $pre = \str_repeat($pad_string, (int)\ceil($diff / $ps_length / 2)); |
|
| 6351 | + $pre = (string)self::substr($pre, 0, (int)\floor($diff / 2), $encoding); |
|
| 6352 | + $post = \str_repeat($pad_string, (int)\ceil($diff / $ps_length / 2)); |
|
| 6353 | + $post = (string)self::substr($post, 0, (int)\ceil($diff / 2), $encoding); |
|
| 6354 | 6354 | |
| 6355 | 6355 | break; |
| 6356 | 6356 | |
| 6357 | 6357 | case \STR_PAD_RIGHT: |
| 6358 | 6358 | default: |
| 6359 | - $post = \str_repeat($pad_string, (int) \ceil($diff / $ps_length)); |
|
| 6360 | - $post = (string) self::substr($post, 0, $diff, $encoding); |
|
| 6359 | + $post = \str_repeat($pad_string, (int)\ceil($diff / $ps_length)); |
|
| 6360 | + $post = (string)self::substr($post, 0, $diff, $encoding); |
|
| 6361 | 6361 | $pre = ''; |
| 6362 | 6362 | } |
| 6363 | 6363 | |
| 6364 | - return $pre . $str . $post; |
|
| 6364 | + return $pre.$str.$post; |
|
| 6365 | 6365 | } |
| 6366 | 6366 | |
| 6367 | 6367 | return $str; |
@@ -6382,7 +6382,7 @@ discard block |
||
| 6382 | 6382 | { |
| 6383 | 6383 | $padding = $length - self::strlen($str, $encoding); |
| 6384 | 6384 | |
| 6385 | - return self::apply_padding($str, (int) \floor($padding / 2), (int) \ceil($padding / 2), $padStr, $encoding); |
|
| 6385 | + return self::apply_padding($str, (int)\floor($padding / 2), (int)\ceil($padding / 2), $padStr, $encoding); |
|
| 6386 | 6386 | } |
| 6387 | 6387 | |
| 6388 | 6388 | /** |
@@ -6498,11 +6498,11 @@ discard block |
||
| 6498 | 6498 | } |
| 6499 | 6499 | |
| 6500 | 6500 | if ($search === '') { |
| 6501 | - return $str . $replacement; |
|
| 6501 | + return $str.$replacement; |
|
| 6502 | 6502 | } |
| 6503 | 6503 | |
| 6504 | 6504 | if (\strpos($str, $search) === 0) { |
| 6505 | - return $replacement . \substr($str, \strlen($search)); |
|
| 6505 | + return $replacement.\substr($str, \strlen($search)); |
|
| 6506 | 6506 | } |
| 6507 | 6507 | |
| 6508 | 6508 | return $str; |
@@ -6530,11 +6530,11 @@ discard block |
||
| 6530 | 6530 | } |
| 6531 | 6531 | |
| 6532 | 6532 | if ($search === '') { |
| 6533 | - return $str . $replacement; |
|
| 6533 | + return $str.$replacement; |
|
| 6534 | 6534 | } |
| 6535 | 6535 | |
| 6536 | 6536 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 6537 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 6537 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 6538 | 6538 | } |
| 6539 | 6539 | |
| 6540 | 6540 | return $str; |
@@ -6644,26 +6644,26 @@ discard block |
||
| 6644 | 6644 | $str = self::normalize_whitespace($str); |
| 6645 | 6645 | $str = \str_replace('-', '_', $str); |
| 6646 | 6646 | |
| 6647 | - $str = (string) \preg_replace_callback( |
|
| 6647 | + $str = (string)\preg_replace_callback( |
|
| 6648 | 6648 | '/([\d|A-Z])/u', |
| 6649 | - function ($matches) use ($encoding) { |
|
| 6649 | + function($matches) use ($encoding) { |
|
| 6650 | 6650 | $match = $matches[1]; |
| 6651 | - $matchInt = (int) $match; |
|
| 6651 | + $matchInt = (int)$match; |
|
| 6652 | 6652 | |
| 6653 | - if ((string) $matchInt === $match) { |
|
| 6654 | - return '_' . $match . '_'; |
|
| 6653 | + if ((string)$matchInt === $match) { |
|
| 6654 | + return '_'.$match.'_'; |
|
| 6655 | 6655 | } |
| 6656 | 6656 | |
| 6657 | - return '_' . self::strtolower($match, $encoding); |
|
| 6657 | + return '_'.self::strtolower($match, $encoding); |
|
| 6658 | 6658 | }, |
| 6659 | 6659 | $str |
| 6660 | 6660 | ); |
| 6661 | 6661 | |
| 6662 | - $str = (string) \preg_replace( |
|
| 6662 | + $str = (string)\preg_replace( |
|
| 6663 | 6663 | [ |
| 6664 | - '/\s+/', // convert spaces to "_" |
|
| 6665 | - '/^\s+|\s+$/', // trim leading & trailing spaces |
|
| 6666 | - '/_+/', // remove double "_" |
|
| 6664 | + '/\s+/', // convert spaces to "_" |
|
| 6665 | + '/^\s+|\s+$/', // trim leading & trailing spaces |
|
| 6666 | + '/_+/', // remove double "_" |
|
| 6667 | 6667 | ], |
| 6668 | 6668 | [ |
| 6669 | 6669 | '_', |
@@ -6750,7 +6750,7 @@ discard block |
||
| 6750 | 6750 | $limit = -1; |
| 6751 | 6751 | } |
| 6752 | 6752 | |
| 6753 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
| 6753 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
| 6754 | 6754 | |
| 6755 | 6755 | if ($array === false) { |
| 6756 | 6756 | return []; |
@@ -6837,7 +6837,7 @@ discard block |
||
| 6837 | 6837 | return ''; |
| 6838 | 6838 | } |
| 6839 | 6839 | |
| 6840 | - return (string) self::substr( |
|
| 6840 | + return (string)self::substr( |
|
| 6841 | 6841 | $str, |
| 6842 | 6842 | $offset + self::strlen($separator, $encoding), |
| 6843 | 6843 | null, |
@@ -6869,7 +6869,7 @@ discard block |
||
| 6869 | 6869 | return ''; |
| 6870 | 6870 | } |
| 6871 | 6871 | |
| 6872 | - return (string) self::substr( |
|
| 6872 | + return (string)self::substr( |
|
| 6873 | 6873 | $str, |
| 6874 | 6874 | $offset + self::strlen($separator, $encoding), |
| 6875 | 6875 | null, |
@@ -6901,7 +6901,7 @@ discard block |
||
| 6901 | 6901 | return ''; |
| 6902 | 6902 | } |
| 6903 | 6903 | |
| 6904 | - return (string) self::substr( |
|
| 6904 | + return (string)self::substr( |
|
| 6905 | 6905 | $str, |
| 6906 | 6906 | 0, |
| 6907 | 6907 | $offset, |
@@ -6933,7 +6933,7 @@ discard block |
||
| 6933 | 6933 | return ''; |
| 6934 | 6934 | } |
| 6935 | 6935 | |
| 6936 | - return (string) self::substr( |
|
| 6936 | + return (string)self::substr( |
|
| 6937 | 6937 | $str, |
| 6938 | 6938 | 0, |
| 6939 | 6939 | $offset, |
@@ -7124,19 +7124,19 @@ discard block |
||
| 7124 | 7124 | } |
| 7125 | 7125 | |
| 7126 | 7126 | // The main substitutions |
| 7127 | - $str = (string) \preg_replace_callback( |
|
| 7127 | + $str = (string)\preg_replace_callback( |
|
| 7128 | 7128 | '~\b (_*) (?: # 1. Leading underscore and |
| 7129 | 7129 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
| 7130 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
| 7130 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
| 7131 | 7131 | | |
| 7132 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
| 7132 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
| 7133 | 7133 | | |
| 7134 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
| 7134 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
| 7135 | 7135 | | |
| 7136 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
| 7136 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
| 7137 | 7137 | ) (_*) \b # 6. With trailing underscore |
| 7138 | 7138 | ~ux', |
| 7139 | - function ($matches) use ($encoding) { |
|
| 7139 | + function($matches) use ($encoding) { |
|
| 7140 | 7140 | // Preserve leading underscore |
| 7141 | 7141 | $str = $matches[1]; |
| 7142 | 7142 | if ($matches[2]) { |
@@ -7161,25 +7161,25 @@ discard block |
||
| 7161 | 7161 | ); |
| 7162 | 7162 | |
| 7163 | 7163 | // Exceptions for small words: capitalize at start of title... |
| 7164 | - $str = (string) \preg_replace_callback( |
|
| 7164 | + $str = (string)\preg_replace_callback( |
|
| 7165 | 7165 | '~( \A [[:punct:]]* # start of title... |
| 7166 | 7166 | | [:.;?!][ ]+ # or of subsentence... |
| 7167 | 7167 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
| 7168 | - ( ' . $smallWordsRx . ' ) \b # ...followed by small word |
|
| 7168 | + ( ' . $smallWordsRx.' ) \b # ...followed by small word |
|
| 7169 | 7169 | ~uxi', |
| 7170 | - function ($matches) use ($encoding) { |
|
| 7171 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
| 7170 | + function($matches) use ($encoding) { |
|
| 7171 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
| 7172 | 7172 | }, |
| 7173 | 7173 | $str |
| 7174 | 7174 | ); |
| 7175 | 7175 | |
| 7176 | 7176 | // ...and end of title |
| 7177 | - $str = (string) \preg_replace_callback( |
|
| 7178 | - '~\b ( ' . $smallWordsRx . ' ) # small word... |
|
| 7177 | + $str = (string)\preg_replace_callback( |
|
| 7178 | + '~\b ( '.$smallWordsRx.' ) # small word... |
|
| 7179 | 7179 | (?= [[:punct:]]* \Z # ...at the end of the title... |
| 7180 | 7180 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
| 7181 | 7181 | ~uxi', |
| 7182 | - function ($matches) use ($encoding) { |
|
| 7182 | + function($matches) use ($encoding) { |
|
| 7183 | 7183 | return static::str_upper_first($matches[1], $encoding); |
| 7184 | 7184 | }, |
| 7185 | 7185 | $str |
@@ -7187,28 +7187,28 @@ discard block |
||
| 7187 | 7187 | |
| 7188 | 7188 | // Exceptions for small words in hyphenated compound words |
| 7189 | 7189 | // e.g. "in-flight" -> In-Flight |
| 7190 | - $str = (string) \preg_replace_callback( |
|
| 7190 | + $str = (string)\preg_replace_callback( |
|
| 7191 | 7191 | '~\b |
| 7192 | 7192 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
| 7193 | - ( ' . $smallWordsRx . ' ) |
|
| 7193 | + ( ' . $smallWordsRx.' ) |
|
| 7194 | 7194 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
| 7195 | 7195 | ~uxi', |
| 7196 | - function ($matches) use ($encoding) { |
|
| 7196 | + function($matches) use ($encoding) { |
|
| 7197 | 7197 | return static::str_upper_first($matches[1], $encoding); |
| 7198 | 7198 | }, |
| 7199 | 7199 | $str |
| 7200 | 7200 | ); |
| 7201 | 7201 | |
| 7202 | 7202 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
| 7203 | - $str = (string) \preg_replace_callback( |
|
| 7203 | + $str = (string)\preg_replace_callback( |
|
| 7204 | 7204 | '~\b |
| 7205 | 7205 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
| 7206 | 7206 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
| 7207 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
| 7207 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
| 7208 | 7208 | (?! - ) # Negative lookahead for another - |
| 7209 | 7209 | ~uxi', |
| 7210 | - function ($matches) use ($encoding) { |
|
| 7211 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
| 7210 | + function($matches) use ($encoding) { |
|
| 7211 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
| 7212 | 7212 | }, |
| 7213 | 7213 | $str |
| 7214 | 7214 | ); |
@@ -7303,7 +7303,7 @@ discard block |
||
| 7303 | 7303 | ); |
| 7304 | 7304 | |
| 7305 | 7305 | foreach ($tmpReturn as &$item) { |
| 7306 | - $item = (string) $item; |
|
| 7306 | + $item = (string)$item; |
|
| 7307 | 7307 | } |
| 7308 | 7308 | |
| 7309 | 7309 | return $tmpReturn; |
@@ -7340,7 +7340,7 @@ discard block |
||
| 7340 | 7340 | public static function str_truncate($str, int $length, string $substring = '', string $encoding = 'UTF-8'): string |
| 7341 | 7341 | { |
| 7342 | 7342 | // init |
| 7343 | - $str = (string) $str; |
|
| 7343 | + $str = (string)$str; |
|
| 7344 | 7344 | |
| 7345 | 7345 | if ($str === '') { |
| 7346 | 7346 | return ''; |
@@ -7356,7 +7356,7 @@ discard block |
||
| 7356 | 7356 | |
| 7357 | 7357 | $truncated = self::substr($str, 0, $length, $encoding); |
| 7358 | 7358 | |
| 7359 | - return $truncated . $substring; |
|
| 7359 | + return $truncated.$substring; |
|
| 7360 | 7360 | } |
| 7361 | 7361 | |
| 7362 | 7362 | /** |
@@ -7394,11 +7394,11 @@ discard block |
||
| 7394 | 7394 | $lastPos = self::strrpos($truncated, ' ', 0, $encoding); |
| 7395 | 7395 | |
| 7396 | 7396 | if ($lastPos !== false || $strPosSpace !== false) { |
| 7397 | - $truncated = self::substr($truncated, 0, (int) $lastPos, $encoding); |
|
| 7397 | + $truncated = self::substr($truncated, 0, (int)$lastPos, $encoding); |
|
| 7398 | 7398 | } |
| 7399 | 7399 | } |
| 7400 | 7400 | |
| 7401 | - return $truncated . $substring; |
|
| 7401 | + return $truncated.$substring; |
|
| 7402 | 7402 | } |
| 7403 | 7403 | |
| 7404 | 7404 | /** |
@@ -7484,7 +7484,7 @@ discard block |
||
| 7484 | 7484 | $offset += self::strlen($strParts[$i]) + self::strlen($strParts[$i + 1]); |
| 7485 | 7485 | } |
| 7486 | 7486 | } else { |
| 7487 | - $numberOfWords = (int) (($len - 1) / 2); |
|
| 7487 | + $numberOfWords = (int)(($len - 1) / 2); |
|
| 7488 | 7488 | } |
| 7489 | 7489 | |
| 7490 | 7490 | return $numberOfWords; |
@@ -7544,7 +7544,7 @@ discard block |
||
| 7544 | 7544 | public static function strcmp(string $str1, string $str2): int |
| 7545 | 7545 | { |
| 7546 | 7546 | /** @noinspection PhpUndefinedClassInspection */ |
| 7547 | - return $str1 . '' === $str2 . '' ? 0 : \strcmp( |
|
| 7547 | + return $str1.'' === $str2.'' ? 0 : \strcmp( |
|
| 7548 | 7548 | \Normalizer::normalize($str1, \Normalizer::NFD), |
| 7549 | 7549 | \Normalizer::normalize($str2, \Normalizer::NFD) |
| 7550 | 7550 | ); |
@@ -7578,7 +7578,7 @@ discard block |
||
| 7578 | 7578 | return null; |
| 7579 | 7579 | } |
| 7580 | 7580 | |
| 7581 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $length)) { |
|
| 7581 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $length)) { |
|
| 7582 | 7582 | return self::strlen($length[1]); |
| 7583 | 7583 | } |
| 7584 | 7584 | |
@@ -7694,7 +7694,7 @@ discard block |
||
| 7694 | 7694 | return ''; |
| 7695 | 7695 | } |
| 7696 | 7696 | |
| 7697 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
| 7697 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
| 7698 | 7698 | } |
| 7699 | 7699 | |
| 7700 | 7700 | /** |
@@ -7815,7 +7815,7 @@ discard block |
||
| 7815 | 7815 | && |
| 7816 | 7816 | self::$SUPPORT['mbstring'] === false |
| 7817 | 7817 | ) { |
| 7818 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 7818 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 7819 | 7819 | } |
| 7820 | 7820 | |
| 7821 | 7821 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -7837,7 +7837,7 @@ discard block |
||
| 7837 | 7837 | return \stristr($haystack, $needle, $before_needle); |
| 7838 | 7838 | } |
| 7839 | 7839 | |
| 7840 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
| 7840 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
| 7841 | 7841 | |
| 7842 | 7842 | if (!isset($match[1])) { |
| 7843 | 7843 | return false; |
@@ -7905,7 +7905,7 @@ discard block |
||
| 7905 | 7905 | && |
| 7906 | 7906 | self::$SUPPORT['iconv'] === false |
| 7907 | 7907 | ) { |
| 7908 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 7908 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 7909 | 7909 | } |
| 7910 | 7910 | |
| 7911 | 7911 | // |
@@ -8031,7 +8031,7 @@ discard block |
||
| 8031 | 8031 | */ |
| 8032 | 8032 | public static function strnatcmp(string $str1, string $str2): int |
| 8033 | 8033 | { |
| 8034 | - return $str1 . '' === $str2 . '' ? 0 : \strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
| 8034 | + return $str1.'' === $str2.'' ? 0 : \strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
| 8035 | 8035 | } |
| 8036 | 8036 | |
| 8037 | 8037 | /** |
@@ -8074,8 +8074,8 @@ discard block |
||
| 8074 | 8074 | */ |
| 8075 | 8075 | public static function strncmp(string $str1, string $str2, int $len): int |
| 8076 | 8076 | { |
| 8077 | - $str1 = (string) self::substr($str1, 0, $len); |
|
| 8078 | - $str2 = (string) self::substr($str2, 0, $len); |
|
| 8077 | + $str1 = (string)self::substr($str1, 0, $len); |
|
| 8078 | + $str2 = (string)self::substr($str2, 0, $len); |
|
| 8079 | 8079 | |
| 8080 | 8080 | return self::strcmp($str1, $str2); |
| 8081 | 8081 | } |
@@ -8096,8 +8096,8 @@ discard block |
||
| 8096 | 8096 | return false; |
| 8097 | 8097 | } |
| 8098 | 8098 | |
| 8099 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
| 8100 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
| 8099 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
| 8100 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
| 8101 | 8101 | } |
| 8102 | 8102 | |
| 8103 | 8103 | return false; |
@@ -8125,10 +8125,10 @@ discard block |
||
| 8125 | 8125 | } |
| 8126 | 8126 | |
| 8127 | 8127 | // iconv and mbstring do not support integer $needle |
| 8128 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 8129 | - $needle = (string) self::chr($needle); |
|
| 8128 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 8129 | + $needle = (string)self::chr($needle); |
|
| 8130 | 8130 | } |
| 8131 | - $needle = (string) $needle; |
|
| 8131 | + $needle = (string)$needle; |
|
| 8132 | 8132 | |
| 8133 | 8133 | if ($needle === '') { |
| 8134 | 8134 | return false; |
@@ -8168,7 +8168,7 @@ discard block |
||
| 8168 | 8168 | && |
| 8169 | 8169 | self::$SUPPORT['mbstring'] === false |
| 8170 | 8170 | ) { |
| 8171 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 8171 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 8172 | 8172 | } |
| 8173 | 8173 | |
| 8174 | 8174 | // |
@@ -8236,7 +8236,7 @@ discard block |
||
| 8236 | 8236 | if ($haystackTmp === false) { |
| 8237 | 8237 | $haystackTmp = ''; |
| 8238 | 8238 | } |
| 8239 | - $haystack = (string) $haystackTmp; |
|
| 8239 | + $haystack = (string)$haystackTmp; |
|
| 8240 | 8240 | |
| 8241 | 8241 | if ($offset < 0) { |
| 8242 | 8242 | $offset = 0; |
@@ -8334,7 +8334,7 @@ discard block |
||
| 8334 | 8334 | && |
| 8335 | 8335 | self::$SUPPORT['mbstring'] === false |
| 8336 | 8336 | ) { |
| 8337 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 8337 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 8338 | 8338 | } |
| 8339 | 8339 | |
| 8340 | 8340 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -8366,7 +8366,7 @@ discard block |
||
| 8366 | 8366 | if ($needleTmp === false) { |
| 8367 | 8367 | return false; |
| 8368 | 8368 | } |
| 8369 | - $needle = (string) $needleTmp; |
|
| 8369 | + $needle = (string)$needleTmp; |
|
| 8370 | 8370 | |
| 8371 | 8371 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
| 8372 | 8372 | if ($pos === false) { |
@@ -8388,7 +8388,7 @@ discard block |
||
| 8388 | 8388 | if ($needleTmp === false) { |
| 8389 | 8389 | return false; |
| 8390 | 8390 | } |
| 8391 | - $needle = (string) $needleTmp; |
|
| 8391 | + $needle = (string)$needleTmp; |
|
| 8392 | 8392 | |
| 8393 | 8393 | $pos = self::strrpos($haystack, $needle, null, $encoding); |
| 8394 | 8394 | if ($pos === false) { |
@@ -8481,7 +8481,7 @@ discard block |
||
| 8481 | 8481 | if ($needleTmp === false) { |
| 8482 | 8482 | return false; |
| 8483 | 8483 | } |
| 8484 | - $needle = (string) $needleTmp; |
|
| 8484 | + $needle = (string)$needleTmp; |
|
| 8485 | 8485 | |
| 8486 | 8486 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
| 8487 | 8487 | if ($pos === false) { |
@@ -8515,10 +8515,10 @@ discard block |
||
| 8515 | 8515 | } |
| 8516 | 8516 | |
| 8517 | 8517 | // iconv and mbstring do not support integer $needle |
| 8518 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 8519 | - $needle = (string) self::chr($needle); |
|
| 8518 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 8519 | + $needle = (string)self::chr($needle); |
|
| 8520 | 8520 | } |
| 8521 | - $needle = (string) $needle; |
|
| 8521 | + $needle = (string)$needle; |
|
| 8522 | 8522 | |
| 8523 | 8523 | if ($needle === '') { |
| 8524 | 8524 | return false; |
@@ -8555,7 +8555,7 @@ discard block |
||
| 8555 | 8555 | && |
| 8556 | 8556 | self::$SUPPORT['mbstring'] === false |
| 8557 | 8557 | ) { |
| 8558 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 8558 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 8559 | 8559 | } |
| 8560 | 8560 | |
| 8561 | 8561 | // |
@@ -8662,10 +8662,10 @@ discard block |
||
| 8662 | 8662 | } |
| 8663 | 8663 | |
| 8664 | 8664 | // iconv and mbstring do not support integer $needle |
| 8665 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 8666 | - $needle = (string) self::chr($needle); |
|
| 8665 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 8666 | + $needle = (string)self::chr($needle); |
|
| 8667 | 8667 | } |
| 8668 | - $needle = (string) $needle; |
|
| 8668 | + $needle = (string)$needle; |
|
| 8669 | 8669 | |
| 8670 | 8670 | if ($needle === '') { |
| 8671 | 8671 | return false; |
@@ -8702,7 +8702,7 @@ discard block |
||
| 8702 | 8702 | && |
| 8703 | 8703 | self::$SUPPORT['mbstring'] === false |
| 8704 | 8704 | ) { |
| 8705 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 8705 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 8706 | 8706 | } |
| 8707 | 8707 | |
| 8708 | 8708 | // |
@@ -8762,7 +8762,7 @@ discard block |
||
| 8762 | 8762 | if ($haystackTmp === false) { |
| 8763 | 8763 | $haystackTmp = ''; |
| 8764 | 8764 | } |
| 8765 | - $haystack = (string) $haystackTmp; |
|
| 8765 | + $haystack = (string)$haystackTmp; |
|
| 8766 | 8766 | } |
| 8767 | 8767 | |
| 8768 | 8768 | $pos = self::strrpos_in_byte($haystack, $needle); |
@@ -8826,14 +8826,14 @@ discard block |
||
| 8826 | 8826 | if ($strTmp === false) { |
| 8827 | 8827 | $strTmp = ''; |
| 8828 | 8828 | } |
| 8829 | - $str = (string) $strTmp; |
|
| 8829 | + $str = (string)$strTmp; |
|
| 8830 | 8830 | } |
| 8831 | 8831 | |
| 8832 | 8832 | if ($str === '' || $mask === '') { |
| 8833 | 8833 | return 0; |
| 8834 | 8834 | } |
| 8835 | 8835 | |
| 8836 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
| 8836 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
| 8837 | 8837 | } |
| 8838 | 8838 | |
| 8839 | 8839 | /** |
@@ -8889,7 +8889,7 @@ discard block |
||
| 8889 | 8889 | && |
| 8890 | 8890 | self::$SUPPORT['mbstring'] === false |
| 8891 | 8891 | ) { |
| 8892 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 8892 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 8893 | 8893 | } |
| 8894 | 8894 | |
| 8895 | 8895 | // |
@@ -8927,7 +8927,7 @@ discard block |
||
| 8927 | 8927 | // fallback via vanilla php |
| 8928 | 8928 | // |
| 8929 | 8929 | |
| 8930 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
| 8930 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
| 8931 | 8931 | |
| 8932 | 8932 | if (!isset($match[1])) { |
| 8933 | 8933 | return false; |
@@ -9035,7 +9035,7 @@ discard block |
||
| 9035 | 9035 | public static function strtolower($str, string $encoding = 'UTF-8', bool $cleanUtf8 = false, string $lang = null, bool $tryToKeepStringLength = false): string |
| 9036 | 9036 | { |
| 9037 | 9037 | // init |
| 9038 | - $str = (string) $str; |
|
| 9038 | + $str = (string)$str; |
|
| 9039 | 9039 | |
| 9040 | 9040 | if ($str === '') { |
| 9041 | 9041 | return ''; |
@@ -9062,9 +9062,9 @@ discard block |
||
| 9062 | 9062 | } |
| 9063 | 9063 | |
| 9064 | 9064 | if (self::$SUPPORT['intl'] === true) { |
| 9065 | - $langCode = $lang . '-Lower'; |
|
| 9065 | + $langCode = $lang.'-Lower'; |
|
| 9066 | 9066 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
| 9067 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, \E_USER_WARNING); |
|
| 9067 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, \E_USER_WARNING); |
|
| 9068 | 9068 | |
| 9069 | 9069 | $langCode = 'Any-Lower'; |
| 9070 | 9070 | } |
@@ -9073,7 +9073,7 @@ discard block |
||
| 9073 | 9073 | return \transliterator_transliterate($langCode, $str); |
| 9074 | 9074 | } |
| 9075 | 9075 | |
| 9076 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
| 9076 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
| 9077 | 9077 | } |
| 9078 | 9078 | |
| 9079 | 9079 | // always fallback via symfony polyfill |
@@ -9109,7 +9109,7 @@ discard block |
||
| 9109 | 9109 | public static function strtoupper($str, string $encoding = 'UTF-8', bool $cleanUtf8 = false, string $lang = null, bool $tryToKeepStringLength = false): string |
| 9110 | 9110 | { |
| 9111 | 9111 | // init |
| 9112 | - $str = (string) $str; |
|
| 9112 | + $str = (string)$str; |
|
| 9113 | 9113 | |
| 9114 | 9114 | if ($str === '') { |
| 9115 | 9115 | return ''; |
@@ -9136,9 +9136,9 @@ discard block |
||
| 9136 | 9136 | } |
| 9137 | 9137 | |
| 9138 | 9138 | if (self::$SUPPORT['intl'] === true) { |
| 9139 | - $langCode = $lang . '-Upper'; |
|
| 9139 | + $langCode = $lang.'-Upper'; |
|
| 9140 | 9140 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
| 9141 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
| 9141 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
| 9142 | 9142 | |
| 9143 | 9143 | $langCode = 'Any-Upper'; |
| 9144 | 9144 | } |
@@ -9147,7 +9147,7 @@ discard block |
||
| 9147 | 9147 | return \transliterator_transliterate($langCode, $str); |
| 9148 | 9148 | } |
| 9149 | 9149 | |
| 9150 | - \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
| 9150 | + \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
| 9151 | 9151 | } |
| 9152 | 9152 | |
| 9153 | 9153 | // always fallback via symfony polyfill |
@@ -9245,7 +9245,7 @@ discard block |
||
| 9245 | 9245 | } |
| 9246 | 9246 | |
| 9247 | 9247 | $wide = 0; |
| 9248 | - $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); |
|
| 9248 | + $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); |
|
| 9249 | 9249 | |
| 9250 | 9250 | return ($wide << 1) + self::strlen($str, 'UTF-8'); |
| 9251 | 9251 | } |
@@ -9343,9 +9343,9 @@ discard block |
||
| 9343 | 9343 | } |
| 9344 | 9344 | |
| 9345 | 9345 | if ($length === null) { |
| 9346 | - $length = (int) $str_length; |
|
| 9346 | + $length = (int)$str_length; |
|
| 9347 | 9347 | } else { |
| 9348 | - $length = (int) $length; |
|
| 9348 | + $length = (int)$length; |
|
| 9349 | 9349 | } |
| 9350 | 9350 | |
| 9351 | 9351 | if ( |
@@ -9353,7 +9353,7 @@ discard block |
||
| 9353 | 9353 | && |
| 9354 | 9354 | self::$SUPPORT['mbstring'] === false |
| 9355 | 9355 | ) { |
| 9356 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9356 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9357 | 9357 | } |
| 9358 | 9358 | |
| 9359 | 9359 | // |
@@ -9436,13 +9436,13 @@ discard block |
||
| 9436 | 9436 | if ($str1Tmp === false) { |
| 9437 | 9437 | $str1Tmp = ''; |
| 9438 | 9438 | } |
| 9439 | - $str1 = (string) $str1Tmp; |
|
| 9439 | + $str1 = (string)$str1Tmp; |
|
| 9440 | 9440 | |
| 9441 | 9441 | $str2Tmp = self::substr($str2, 0, self::strlen($str1)); |
| 9442 | 9442 | if ($str2Tmp === false) { |
| 9443 | 9443 | $str2Tmp = ''; |
| 9444 | 9444 | } |
| 9445 | - $str2 = (string) $str2Tmp; |
|
| 9445 | + $str2 = (string)$str2Tmp; |
|
| 9446 | 9446 | } |
| 9447 | 9447 | |
| 9448 | 9448 | if ($case_insensitivity === true) { |
@@ -9488,7 +9488,7 @@ discard block |
||
| 9488 | 9488 | if ($lengthTmp === false) { |
| 9489 | 9489 | return false; |
| 9490 | 9490 | } |
| 9491 | - $length = (int) $lengthTmp; |
|
| 9491 | + $length = (int)$lengthTmp; |
|
| 9492 | 9492 | } |
| 9493 | 9493 | |
| 9494 | 9494 | if ( |
@@ -9509,7 +9509,7 @@ discard block |
||
| 9509 | 9509 | if ($haystackTmp === false) { |
| 9510 | 9510 | $haystackTmp = ''; |
| 9511 | 9511 | } |
| 9512 | - $haystack = (string) $haystackTmp; |
|
| 9512 | + $haystack = (string)$haystackTmp; |
|
| 9513 | 9513 | } |
| 9514 | 9514 | |
| 9515 | 9515 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
@@ -9532,14 +9532,14 @@ discard block |
||
| 9532 | 9532 | && |
| 9533 | 9533 | self::$SUPPORT['mbstring'] === false |
| 9534 | 9534 | ) { |
| 9535 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9535 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9536 | 9536 | } |
| 9537 | 9537 | |
| 9538 | 9538 | if (self::$SUPPORT['mbstring'] === true) { |
| 9539 | 9539 | return \mb_substr_count($haystack, $needle, $encoding); |
| 9540 | 9540 | } |
| 9541 | 9541 | |
| 9542 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 9542 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 9543 | 9543 | |
| 9544 | 9544 | return \count($matches); |
| 9545 | 9545 | } |
@@ -9586,7 +9586,7 @@ discard block |
||
| 9586 | 9586 | if ($lengthTmp === false) { |
| 9587 | 9587 | return false; |
| 9588 | 9588 | } |
| 9589 | - $length = (int) $lengthTmp; |
|
| 9589 | + $length = (int)$lengthTmp; |
|
| 9590 | 9590 | } |
| 9591 | 9591 | |
| 9592 | 9592 | if ( |
@@ -9607,7 +9607,7 @@ discard block |
||
| 9607 | 9607 | if ($haystackTmp === false) { |
| 9608 | 9608 | $haystackTmp = ''; |
| 9609 | 9609 | } |
| 9610 | - $haystack = (string) $haystackTmp; |
|
| 9610 | + $haystack = (string)$haystackTmp; |
|
| 9611 | 9611 | } |
| 9612 | 9612 | |
| 9613 | 9613 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -9638,7 +9638,7 @@ discard block |
||
| 9638 | 9638 | |
| 9639 | 9639 | // only a fallback to prevent BC in the api ... |
| 9640 | 9640 | if ($caseSensitive !== false && $caseSensitive !== true) { |
| 9641 | - $encoding = (string) $caseSensitive; |
|
| 9641 | + $encoding = (string)$caseSensitive; |
|
| 9642 | 9642 | } |
| 9643 | 9643 | |
| 9644 | 9644 | if (!$caseSensitive) { |
@@ -9646,7 +9646,7 @@ discard block |
||
| 9646 | 9646 | $substring = self::strtocasefold($substring, true, false, $encoding, null, false); |
| 9647 | 9647 | } |
| 9648 | 9648 | |
| 9649 | - return (int) self::substr_count($str, $substring, 0, null, $encoding); |
|
| 9649 | + return (int)self::substr_count($str, $substring, 0, null, $encoding); |
|
| 9650 | 9650 | } |
| 9651 | 9651 | |
| 9652 | 9652 | /** |
@@ -9672,7 +9672,7 @@ discard block |
||
| 9672 | 9672 | if ($haystackTmp === false) { |
| 9673 | 9673 | $haystackTmp = ''; |
| 9674 | 9674 | } |
| 9675 | - $haystack = (string) $haystackTmp; |
|
| 9675 | + $haystack = (string)$haystackTmp; |
|
| 9676 | 9676 | } |
| 9677 | 9677 | |
| 9678 | 9678 | return $haystack; |
@@ -9741,7 +9741,7 @@ discard block |
||
| 9741 | 9741 | if ($haystackTmp === false) { |
| 9742 | 9742 | $haystackTmp = ''; |
| 9743 | 9743 | } |
| 9744 | - $haystack = (string) $haystackTmp; |
|
| 9744 | + $haystack = (string)$haystackTmp; |
|
| 9745 | 9745 | } |
| 9746 | 9746 | |
| 9747 | 9747 | return $haystack; |
@@ -9770,7 +9770,7 @@ discard block |
||
| 9770 | 9770 | if ($haystackTmp === false) { |
| 9771 | 9771 | $haystackTmp = ''; |
| 9772 | 9772 | } |
| 9773 | - $haystack = (string) $haystackTmp; |
|
| 9773 | + $haystack = (string)$haystackTmp; |
|
| 9774 | 9774 | } |
| 9775 | 9775 | |
| 9776 | 9776 | return $haystack; |
@@ -9817,7 +9817,7 @@ discard block |
||
| 9817 | 9817 | if (\is_array($offset) === true) { |
| 9818 | 9818 | $offset = \array_slice($offset, 0, $num); |
| 9819 | 9819 | foreach ($offset as &$valueTmp) { |
| 9820 | - $valueTmp = (int) $valueTmp === $valueTmp ? $valueTmp : 0; |
|
| 9820 | + $valueTmp = (int)$valueTmp === $valueTmp ? $valueTmp : 0; |
|
| 9821 | 9821 | } |
| 9822 | 9822 | unset($valueTmp); |
| 9823 | 9823 | } else { |
@@ -9831,7 +9831,7 @@ discard block |
||
| 9831 | 9831 | $length = \array_slice($length, 0, $num); |
| 9832 | 9832 | foreach ($length as &$valueTmpV2) { |
| 9833 | 9833 | if ($valueTmpV2 !== null) { |
| 9834 | - $valueTmpV2 = (int) $valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
| 9834 | + $valueTmpV2 = (int)$valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
| 9835 | 9835 | } else { |
| 9836 | 9836 | $valueTmpV2 = 0; |
| 9837 | 9837 | } |
@@ -9854,8 +9854,8 @@ discard block |
||
| 9854 | 9854 | } |
| 9855 | 9855 | |
| 9856 | 9856 | // init |
| 9857 | - $str = (string) $str; |
|
| 9858 | - $replacement = (string) $replacement; |
|
| 9857 | + $str = (string)$str; |
|
| 9858 | + $replacement = (string)$replacement; |
|
| 9859 | 9859 | |
| 9860 | 9860 | if ($str === '') { |
| 9861 | 9861 | return $replacement; |
@@ -9863,8 +9863,7 @@ discard block |
||
| 9863 | 9863 | |
| 9864 | 9864 | if (self::is_ascii($str)) { |
| 9865 | 9865 | return ($length === null) ? |
| 9866 | - \substr_replace($str, $replacement, $offset) : |
|
| 9867 | - \substr_replace($str, $replacement, $offset, $length); |
|
| 9866 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
| 9868 | 9867 | } |
| 9869 | 9868 | |
| 9870 | 9869 | if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) { |
@@ -9890,7 +9889,7 @@ discard block |
||
| 9890 | 9889 | $length = $string_length - $offset; |
| 9891 | 9890 | } |
| 9892 | 9891 | |
| 9893 | - return self::substr($str, 0, $offset, $encoding) . $replacement . self::substr($str, $offset + $length, $string_length - $offset - $length, $encoding); |
|
| 9892 | + return self::substr($str, 0, $offset, $encoding).$replacement.self::substr($str, $offset + $length, $string_length - $offset - $length, $encoding); |
|
| 9894 | 9893 | } |
| 9895 | 9894 | |
| 9896 | 9895 | \preg_match_all('/./us', $str, $smatches); |
@@ -9902,7 +9901,7 @@ discard block |
||
| 9902 | 9901 | // e.g.: non mbstring support + invalid chars |
| 9903 | 9902 | return ''; |
| 9904 | 9903 | } |
| 9905 | - $length = (int) $lengthTmp; |
|
| 9904 | + $length = (int)$lengthTmp; |
|
| 9906 | 9905 | } |
| 9907 | 9906 | |
| 9908 | 9907 | \array_splice($smatches[0], $offset, $length, $rmatches[0]); |
@@ -9933,7 +9932,7 @@ discard block |
||
| 9933 | 9932 | if ($haystackTmp === false) { |
| 9934 | 9933 | $haystackTmp = ''; |
| 9935 | 9934 | } |
| 9936 | - $haystack = (string) $haystackTmp; |
|
| 9935 | + $haystack = (string)$haystackTmp; |
|
| 9937 | 9936 | } |
| 9938 | 9937 | |
| 9939 | 9938 | return $haystack; |
@@ -9964,7 +9963,7 @@ discard block |
||
| 9964 | 9963 | $str = self::clean($str); |
| 9965 | 9964 | } |
| 9966 | 9965 | |
| 9967 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 9966 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 9968 | 9967 | } |
| 9969 | 9968 | |
| 9970 | 9969 | /** |
@@ -10258,7 +10257,7 @@ discard block |
||
| 10258 | 10257 | public static function to_boolean($str): bool |
| 10259 | 10258 | { |
| 10260 | 10259 | // init |
| 10261 | - $str = (string) $str; |
|
| 10260 | + $str = (string)$str; |
|
| 10262 | 10261 | |
| 10263 | 10262 | if ($str === '') { |
| 10264 | 10263 | return false; |
@@ -10284,10 +10283,10 @@ discard block |
||
| 10284 | 10283 | |
| 10285 | 10284 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
| 10286 | 10285 | if (\is_numeric($str)) { |
| 10287 | - return ((float) $str + 0) > 0; |
|
| 10286 | + return ((float)$str + 0) > 0; |
|
| 10288 | 10287 | } |
| 10289 | 10288 | |
| 10290 | - return (bool) self::trim($str); |
|
| 10289 | + return (bool)self::trim($str); |
|
| 10291 | 10290 | } |
| 10292 | 10291 | |
| 10293 | 10292 | /** |
@@ -10308,11 +10307,11 @@ discard block |
||
| 10308 | 10307 | |
| 10309 | 10308 | $fallback_char_escaped = \preg_quote($fallback_char, '/'); |
| 10310 | 10309 | |
| 10311 | - $string = (string) \preg_replace( |
|
| 10310 | + $string = (string)\preg_replace( |
|
| 10312 | 10311 | [ |
| 10313 | - '/[^' . $fallback_char_escaped . '\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
| 10314 | - '/[\s]+/', // 2) convert spaces to $fallback_char |
|
| 10315 | - '/[' . $fallback_char_escaped . ']+/', // 3) remove double $fallback_char's |
|
| 10312 | + '/[^'.$fallback_char_escaped.'\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
| 10313 | + '/[\s]+/', // 2) convert spaces to $fallback_char |
|
| 10314 | + '/['.$fallback_char_escaped.']+/', // 3) remove double $fallback_char's |
|
| 10316 | 10315 | ], |
| 10317 | 10316 | [ |
| 10318 | 10317 | '', |
@@ -10343,7 +10342,7 @@ discard block |
||
| 10343 | 10342 | return $str; |
| 10344 | 10343 | } |
| 10345 | 10344 | |
| 10346 | - $str = (string) $str; |
|
| 10345 | + $str = (string)$str; |
|
| 10347 | 10346 | if ($str === '') { |
| 10348 | 10347 | return ''; |
| 10349 | 10348 | } |
@@ -10390,7 +10389,7 @@ discard block |
||
| 10390 | 10389 | return $str; |
| 10391 | 10390 | } |
| 10392 | 10391 | |
| 10393 | - $str = (string) $str; |
|
| 10392 | + $str = (string)$str; |
|
| 10394 | 10393 | if ($str === '') { |
| 10395 | 10394 | return $str; |
| 10396 | 10395 | } |
@@ -10413,7 +10412,7 @@ discard block |
||
| 10413 | 10412 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
| 10414 | 10413 | |
| 10415 | 10414 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 10416 | - $buf .= $c1 . $c2; |
|
| 10415 | + $buf .= $c1.$c2; |
|
| 10417 | 10416 | $i++; |
| 10418 | 10417 | } else { // not valid UTF8 - convert it |
| 10419 | 10418 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -10424,7 +10423,7 @@ discard block |
||
| 10424 | 10423 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
| 10425 | 10424 | |
| 10426 | 10425 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 10427 | - $buf .= $c1 . $c2 . $c3; |
|
| 10426 | + $buf .= $c1.$c2.$c3; |
|
| 10428 | 10427 | $i += 2; |
| 10429 | 10428 | } else { // not valid UTF8 - convert it |
| 10430 | 10429 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -10436,7 +10435,7 @@ discard block |
||
| 10436 | 10435 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
| 10437 | 10436 | |
| 10438 | 10437 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 10439 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
| 10438 | + $buf .= $c1.$c2.$c3.$c4; |
|
| 10440 | 10439 | $i += 3; |
| 10441 | 10440 | } else { // not valid UTF8 - convert it |
| 10442 | 10441 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -10455,7 +10454,7 @@ discard block |
||
| 10455 | 10454 | // decode unicode escape sequences |
| 10456 | 10455 | $buf = \preg_replace_callback( |
| 10457 | 10456 | '/\\\\u([0-9a-f]{4})/i', |
| 10458 | - function ($match) { |
|
| 10457 | + function($match) { |
|
| 10459 | 10458 | // always fallback via symfony polyfill |
| 10460 | 10459 | return \mb_convert_encoding(\pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); |
| 10461 | 10460 | }, |
@@ -10497,8 +10496,8 @@ discard block |
||
| 10497 | 10496 | $buf .= self::$WIN1252_TO_UTF8[$ordC1]; |
| 10498 | 10497 | } else { |
| 10499 | 10498 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
| 10500 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
| 10501 | - $buf .= $cc1 . $cc2; |
|
| 10499 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
| 10500 | + $buf .= $cc1.$cc2; |
|
| 10502 | 10501 | } |
| 10503 | 10502 | |
| 10504 | 10503 | return $buf; |
@@ -10559,14 +10558,14 @@ discard block |
||
| 10559 | 10558 | } |
| 10560 | 10559 | |
| 10561 | 10560 | $strPartOne = self::strtoupper( |
| 10562 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 10561 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 10563 | 10562 | $encoding, |
| 10564 | 10563 | $cleanUtf8, |
| 10565 | 10564 | $lang, |
| 10566 | 10565 | $tryToKeepStringLength |
| 10567 | 10566 | ); |
| 10568 | 10567 | |
| 10569 | - return $strPartOne . $strPartTwo; |
|
| 10568 | + return $strPartOne.$strPartTwo; |
|
| 10570 | 10569 | } |
| 10571 | 10570 | |
| 10572 | 10571 | /** |
@@ -10612,7 +10611,7 @@ discard block |
||
| 10612 | 10611 | $str = self::clean($str); |
| 10613 | 10612 | } |
| 10614 | 10613 | |
| 10615 | - $usePhpDefaultFunctions = !(bool) ($charlist . \implode('', $exceptions)); |
|
| 10614 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
| 10616 | 10615 | |
| 10617 | 10616 | if ( |
| 10618 | 10617 | $usePhpDefaultFunctions === true |
@@ -10681,7 +10680,7 @@ discard block |
||
| 10681 | 10680 | |
| 10682 | 10681 | $pattern = '/%u([0-9a-f]{3,4})/i'; |
| 10683 | 10682 | if (\preg_match($pattern, $str)) { |
| 10684 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
| 10683 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
| 10685 | 10684 | } |
| 10686 | 10685 | |
| 10687 | 10686 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -11115,7 +11114,7 @@ discard block |
||
| 11115 | 11114 | return ''; |
| 11116 | 11115 | } |
| 11117 | 11116 | |
| 11118 | - \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches); |
|
| 11117 | + \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches); |
|
| 11119 | 11118 | |
| 11120 | 11119 | if ( |
| 11121 | 11120 | !isset($matches[0]) |
@@ -11125,7 +11124,7 @@ discard block |
||
| 11125 | 11124 | return $str; |
| 11126 | 11125 | } |
| 11127 | 11126 | |
| 11128 | - return self::rtrim($matches[0]) . $strAddOn; |
|
| 11127 | + return self::rtrim($matches[0]).$strAddOn; |
|
| 11129 | 11128 | } |
| 11130 | 11129 | |
| 11131 | 11130 | /** |
@@ -11195,7 +11194,7 @@ discard block |
||
| 11195 | 11194 | $strReturn .= $break; |
| 11196 | 11195 | } |
| 11197 | 11196 | |
| 11198 | - return $strReturn . \implode('', $chars); |
|
| 11197 | + return $strReturn.\implode('', $chars); |
|
| 11199 | 11198 | } |
| 11200 | 11199 | |
| 11201 | 11200 | /** |
@@ -11208,7 +11207,7 @@ discard block |
||
| 11208 | 11207 | */ |
| 11209 | 11208 | public static function wordwrap_per_line(string $str, int $limit): string |
| 11210 | 11209 | { |
| 11211 | - $strings = (array) \preg_split('/\\r\\n|\\r|\\n/', $str); |
|
| 11210 | + $strings = (array)\preg_split('/\\r\\n|\\r|\\n/', $str); |
|
| 11212 | 11211 | |
| 11213 | 11212 | $string = ''; |
| 11214 | 11213 | foreach ($strings as $value) { |