| @@ -79,9 +79,9 @@ | ||
| 79 | 79 | private static $internalEncoding = 'UTF-8'; |
| 80 | 80 | |
| 81 | 81 | public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null) |
| 82 | 82 | { |
| 83 | - if (\is_array($fromEncoding) || ($fromEncoding !== null && false !== strpos($fromEncoding, ','))) { | |
| 83 | + if (\is_array($fromEncoding) || (null !== $fromEncoding && false !== strpos($fromEncoding, ','))) { | |
| 84 | 84 | $fromEncoding = self::mb_detect_encoding($s, $fromEncoding); |
| 85 | 85 | } else { |
| 86 | 86 | $fromEncoding = self::getEncoding($fromEncoding); |
| 87 | 87 | } |
| @@ -101,9 +101,9 @@ | ||
| 101 | 101 | if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) { |
| 102 | 102 | $fromEncoding = 'Windows-1252'; |
| 103 | 103 | } |
| 104 | 104 | if ('UTF-8' !== $fromEncoding) { |
| 105 | - $s = \iconv($fromEncoding, 'UTF-8//IGNORE', $s); | |
| 105 | + $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s); | |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | return preg_replace_callback('/[\x80-\xFF]+/', [__CLASS__, 'html_encoding_callback'], $s); |
| 109 | 109 | } |
| @@ -112,9 +112,9 @@ | ||
| 112 | 112 | $s = html_entity_decode($s, \ENT_COMPAT, 'UTF-8'); |
| 113 | 113 | $fromEncoding = 'UTF-8'; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - return \iconv($fromEncoding, $toEncoding.'//IGNORE', $s); | |
| 116 | + return iconv($fromEncoding, $toEncoding.'//IGNORE', $s); | |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | public static function mb_convert_variables($toEncoding, $fromEncoding, &...$vars) |
| 120 | 120 | { |
| @@ -129,9 +129,9 @@ | ||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | public static function mb_decode_mimeheader($s) |
| 132 | 132 | { |
| 133 | - return \iconv_mime_decode($s, 2, self::$internalEncoding); | |
| 133 | + return iconv_mime_decode($s, 2, self::$internalEncoding); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null) |
| 137 | 137 | { |
| @@ -139,9 +139,9 @@ | ||
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | public static function mb_decode_numericentity($s, $convmap, $encoding = null) |
| 142 | 142 | { |
| 143 | - if (null !== $s && !is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) { | |
| 143 | + if (null !== $s && !\is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) { | |
| 144 | 144 | trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING); |
| 145 | 145 | |
| 146 | 146 | return null; |
| 147 | 147 | } |
| @@ -149,9 +149,9 @@ | ||
| 149 | 149 | if (!\is_array($convmap) || (80000 > \PHP_VERSION_ID && !$convmap)) { |
| 150 | 150 | return false; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - if (null !== $encoding && !is_scalar($encoding)) { | |
| 153 | + if (null !== $encoding && !\is_scalar($encoding)) { | |
| 154 | 154 | trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING); |
| 155 | 155 | |
| 156 | 156 | return ''; // Instead of null (cf. mb_encode_numericentity). |
| 157 | 157 | } |
| @@ -165,12 +165,12 @@ | ||
| 165 | 165 | |
| 166 | 166 | if ('UTF-8' === $encoding) { |
| 167 | 167 | $encoding = null; |
| 168 | 168 | if (!preg_match('//u', $s)) { |
| 169 | - $s = @\iconv('UTF-8', 'UTF-8//IGNORE', $s); | |
| 169 | + $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s); | |
| 170 | 170 | } |
| 171 | 171 | } else { |
| 172 | - $s = \iconv($encoding, 'UTF-8//IGNORE', $s); | |
| 172 | + $s = iconv($encoding, 'UTF-8//IGNORE', $s); | |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | $cnt = floor(\count($convmap) / 4) * 4; |
| 176 | 176 | |
| @@ -194,14 +194,14 @@ | ||
| 194 | 194 | if (null === $encoding) { |
| 195 | 195 | return $s; |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - return \iconv('UTF-8', $encoding.'//IGNORE', $s); | |
| 198 | + return iconv('UTF-8', $encoding.'//IGNORE', $s); | |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false) |
| 202 | 202 | { |
| 203 | - if (null !== $s && !is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) { | |
| 203 | + if (null !== $s && !\is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) { | |
| 204 | 204 | trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING); |
| 205 | 205 | |
| 206 | 206 | return null; |
| 207 | 207 | } |
| @@ -209,15 +209,15 @@ | ||
| 209 | 209 | if (!\is_array($convmap) || (80000 > \PHP_VERSION_ID && !$convmap)) { |
| 210 | 210 | return false; |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - if (null !== $encoding && !is_scalar($encoding)) { | |
| 213 | + if (null !== $encoding && !\is_scalar($encoding)) { | |
| 214 | 214 | trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING); |
| 215 | 215 | |
| 216 | 216 | return null; // Instead of '' (cf. mb_decode_numericentity). |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - if (null !== $is_hex && !is_scalar($is_hex)) { | |
| 219 | + if (null !== $is_hex && !\is_scalar($is_hex)) { | |
| 220 | 220 | trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', \E_USER_WARNING); |
| 221 | 221 | |
| 222 | 222 | return null; |
| 223 | 223 | } |
| @@ -231,12 +231,12 @@ | ||
| 231 | 231 | |
| 232 | 232 | if ('UTF-8' === $encoding) { |
| 233 | 233 | $encoding = null; |
| 234 | 234 | if (!preg_match('//u', $s)) { |
| 235 | - $s = @\iconv('UTF-8', 'UTF-8//IGNORE', $s); | |
| 235 | + $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s); | |
| 236 | 236 | } |
| 237 | 237 | } else { |
| 238 | - $s = \iconv($encoding, 'UTF-8//IGNORE', $s); | |
| 238 | + $s = iconv($encoding, 'UTF-8//IGNORE', $s); | |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4]; |
| 242 | 242 | |
| @@ -264,9 +264,9 @@ | ||
| 264 | 264 | if (null === $encoding) { |
| 265 | 265 | return $result; |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - return \iconv('UTF-8', $encoding.'//IGNORE', $result); | |
| 268 | + return iconv('UTF-8', $encoding.'//IGNORE', $result); | |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | public static function mb_convert_case($s, $mode, $encoding = null) |
| 272 | 272 | { |
| @@ -279,12 +279,12 @@ | ||
| 279 | 279 | |
| 280 | 280 | if ('UTF-8' === $encoding) { |
| 281 | 281 | $encoding = null; |
| 282 | 282 | if (!preg_match('//u', $s)) { |
| 283 | - $s = @\iconv('UTF-8', 'UTF-8//IGNORE', $s); | |
| 283 | + $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s); | |
| 284 | 284 | } |
| 285 | 285 | } else { |
| 286 | - $s = \iconv($encoding, 'UTF-8//IGNORE', $s); | |
| 286 | + $s = iconv($encoding, 'UTF-8//IGNORE', $s); | |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | if (\MB_CASE_TITLE == $mode) { |
| 290 | 290 | static $titleRegexp = null; |
| @@ -342,9 +342,9 @@ | ||
| 342 | 342 | if (null === $encoding) { |
| 343 | 343 | return $s; |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | - return \iconv('UTF-8', $encoding.'//IGNORE', $s); | |
| 346 | + return iconv('UTF-8', $encoding.'//IGNORE', $s); | |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | public static function mb_internal_encoding($encoding = null) |
| 350 | 350 | { |
| @@ -353,9 +353,9 @@ | ||
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | $normalizedEncoding = self::getEncoding($encoding); |
| 356 | 356 | |
| 357 | - if ('UTF-8' === $normalizedEncoding || false !== @\iconv($normalizedEncoding, $normalizedEncoding, ' ')) { | |
| 357 | + if ('UTF-8' === $normalizedEncoding || false !== @iconv($normalizedEncoding, $normalizedEncoding, ' ')) { | |
| 358 | 358 | self::$internalEncoding = $normalizedEncoding; |
| 359 | 359 | |
| 360 | 360 | return true; |
| 361 | 361 | } |
| @@ -412,9 +412,9 @@ | ||
| 412 | 412 | } |
| 413 | 413 | $encoding = self::$internalEncoding; |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | - return self::mb_detect_encoding($var, [$encoding]) || false !== @\iconv($encoding, $encoding, $var); | |
| 416 | + return self::mb_detect_encoding($var, [$encoding]) || false !== @iconv($encoding, $encoding, $var); | |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | public static function mb_detect_encoding($str, $encodingList = null, $strict = false) |
| 420 | 420 | { |
| @@ -487,9 +487,9 @@ | ||
| 487 | 487 | if ('CP850' === $encoding || 'ASCII' === $encoding) { |
| 488 | 488 | return \strlen($s); |
| 489 | 489 | } |
| 490 | 490 | |
| 491 | - return @\iconv_strlen($s, $encoding); | |
| 491 | + return @iconv_strlen($s, $encoding); | |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) |
| 495 | 495 | { |
| @@ -508,9 +508,9 @@ | ||
| 508 | 508 | |
| 509 | 509 | return 0; |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | - return \iconv_strpos($haystack, $needle, $offset, $encoding); | |
| 512 | + return iconv_strpos($haystack, $needle, $offset, $encoding); | |
| 513 | 513 | } |
| 514 | 514 | |
| 515 | 515 | public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) |
| 516 | 516 | { |
| @@ -532,9 +532,9 @@ | ||
| 532 | 532 | } |
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | $pos = '' !== $needle || 80000 > \PHP_VERSION_ID |
| 536 | - ? \iconv_strrpos($haystack, $needle, $encoding) | |
| 536 | + ? iconv_strrpos($haystack, $needle, $encoding) | |
| 537 | 537 | : self::mb_strlen($haystack, $encoding); |
| 538 | 538 | |
| 539 | 539 | return false !== $pos ? $offset + $pos : false; |
| 540 | 540 | } |
| @@ -540,9 +540,9 @@ | ||
| 540 | 540 | } |
| 541 | 541 | |
| 542 | 542 | public static function mb_str_split($string, $split_length = 1, $encoding = null) |
| 543 | 543 | { |
| 544 | - if (null !== $string && !is_scalar($string) && !(\is_object($string) && method_exists($string, '__toString'))) { | |
| 544 | + if (null !== $string && !\is_scalar($string) && !(\is_object($string) && method_exists($string, '__toString'))) { | |
| 545 | 545 | trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', \E_USER_WARNING); |
| 546 | 546 | |
| 547 | 547 | return null; |
| 548 | 548 | } |
| @@ -549,8 +549,9 @@ | ||
| 549 | 549 | |
| 550 | 550 | if (1 > $split_length = (int) $split_length) { |
| 551 | 551 | if (80000 > \PHP_VERSION_ID) { |
| 552 | 552 | trigger_error('The length of each segment must be greater than zero', \E_USER_WARNING); |
| 553 | + | |
| 553 | 554 | return false; |
| 554 | 555 | } |
| 555 | 556 | |
| 556 | 557 | throw new \ValueError('Argument #2 ($length) must be greater than 0'); |
| @@ -616,9 +617,9 @@ | ||
| 616 | 617 | return (string) substr($s, $start, null === $length ? 2147483647 : $length); |
| 617 | 618 | } |
| 618 | 619 | |
| 619 | 620 | if ($start < 0) { |
| 620 | - $start = \iconv_strlen($s, $encoding) + $start; | |
| 621 | + $start = iconv_strlen($s, $encoding) + $start; | |
| 621 | 622 | if ($start < 0) { |
| 622 | 623 | $start = 0; |
| 623 | 624 | } |
| 624 | 625 | } |
| @@ -625,15 +626,15 @@ | ||
| 625 | 626 | |
| 626 | 627 | if (null === $length) { |
| 627 | 628 | $length = 2147483647; |
| 628 | 629 | } elseif ($length < 0) { |
| 629 | - $length = \iconv_strlen($s, $encoding) + $length - $start; | |
| 630 | + $length = iconv_strlen($s, $encoding) + $length - $start; | |
| 630 | 631 | if ($length < 0) { |
| 631 | 632 | return ''; |
| 632 | 633 | } |
| 633 | 634 | } |
| 634 | 635 | |
| 635 | - return (string) \iconv_substr($s, $start, $length, $encoding); | |
| 636 | + return (string) iconv_substr($s, $start, $length, $encoding); | |
| 636 | 637 | } |
| 637 | 638 | |
| 638 | 639 | public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) |
| 639 | 640 | { |
| @@ -656,9 +657,9 @@ | ||
| 656 | 657 | if ('CP850' === $encoding || 'ASCII' === $encoding) { |
| 657 | 658 | $pos = strrpos($haystack, $needle); |
| 658 | 659 | } else { |
| 659 | 660 | $needle = self::mb_substr($needle, 0, 1, $encoding); |
| 660 | - $pos = \iconv_strrpos($haystack, $needle, $encoding); | |
| 661 | + $pos = iconv_strrpos($haystack, $needle, $encoding); | |
| 661 | 662 | } |
| 662 | 663 | |
| 663 | 664 | return self::getSubpart($pos, $part, $haystack, $encoding); |
| 664 | 665 | } |
| @@ -735,14 +736,14 @@ | ||
| 735 | 736 | { |
| 736 | 737 | $encoding = self::getEncoding($encoding); |
| 737 | 738 | |
| 738 | 739 | if ('UTF-8' !== $encoding) { |
| 739 | - $s = \iconv($encoding, 'UTF-8//IGNORE', $s); | |
| 740 | + $s = iconv($encoding, 'UTF-8//IGNORE', $s); | |
| 740 | 741 | } |
| 741 | 742 | |
| 742 | 743 | $s = 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', '', $s, -1, $wide); |
| 743 | 744 | |
| 744 | - return ($wide << 1) + \iconv_strlen($s, 'UTF-8'); | |
| 745 | + return ($wide << 1) + iconv_strlen($s, 'UTF-8'); | |
| 745 | 746 | } |
| 746 | 747 | |
| 747 | 748 | public static function mb_substr_count($haystack, $needle, $encoding = null) |
| 748 | 749 | { |