@@ -3409,7 +3409,7 @@ discard block |
||
3409 | 3409 | /** |
3410 | 3410 | * Check if the input is binary... (is look like a hack). |
3411 | 3411 | * |
3412 | - * @param mixed $input |
|
3412 | + * @param string $input |
|
3413 | 3413 | * |
3414 | 3414 | * @return bool |
3415 | 3415 | */ |
@@ -5624,7 +5624,7 @@ discard block |
||
5624 | 5624 | * The string being checked, for the last occurrence |
5625 | 5625 | * of needle |
5626 | 5626 | * </p> |
5627 | - * @param string|int $needle <p> |
|
5627 | + * @param string $needle <p> |
|
5628 | 5628 | * The string to find in haystack. |
5629 | 5629 | * Or a code point as int. |
5630 | 5630 | * </p> |
@@ -5700,7 +5700,7 @@ discard block |
||
5700 | 5700 | * @param int $offset |
5701 | 5701 | * @param int $length |
5702 | 5702 | * |
5703 | - * @return int|null |
|
5703 | + * @return integer |
|
5704 | 5704 | */ |
5705 | 5705 | public static function strspn($str, $mask, $offset = 0, $length = 2147483647) |
5706 | 5706 | { |
@@ -6324,7 +6324,7 @@ discard block |
||
6324 | 6324 | * 2) when any of these: àáâãäåæçèéêëìíîï are followed by TWO chars from group B, |
6325 | 6325 | * 3) when any of these: ðñòó are followed by THREE chars from group B. |
6326 | 6326 | * |
6327 | - * @param string|array $str Any string or array. |
|
6327 | + * @param string $str Any string or array. |
|
6328 | 6328 | * |
6329 | 6329 | * @return string The same string, but UTF8 encoded. |
6330 | 6330 | */ |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | public static function add_bom_to_string($str) |
835 | 835 | { |
836 | 836 | if (self::string_has_bom($str) === false) { |
837 | - $str = self::bom() . $str; |
|
837 | + $str = self::bom().$str; |
|
838 | 838 | } |
839 | 839 | |
840 | 840 | return $str; |
@@ -2154,7 +2154,7 @@ discard block |
||
2154 | 2154 | self::checkForSupport(); |
2155 | 2155 | |
2156 | 2156 | return \mb_convert_encoding( |
2157 | - '&#x' . dechex($code) . ';', |
|
2157 | + '&#x'.dechex($code).';', |
|
2158 | 2158 | 'UTF-8', |
2159 | 2159 | 'HTML-ENTITIES' |
2160 | 2160 | ); |
@@ -2434,7 +2434,7 @@ discard block |
||
2434 | 2434 | if ($var[0] >= "\x80" && isset($n[0], $leading_combining[0]) && preg_match('/^\p{Mn}/u', $var)) { |
2435 | 2435 | // Prevent leading combining chars |
2436 | 2436 | // for NFC-safe concatenations. |
2437 | - $var = $leading_combining . $var; |
|
2437 | + $var = $leading_combining.$var; |
|
2438 | 2438 | } |
2439 | 2439 | } |
2440 | 2440 | break; |
@@ -2721,7 +2721,7 @@ discard block |
||
2721 | 2721 | */ |
2722 | 2722 | protected static function getData($file) |
2723 | 2723 | { |
2724 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
2724 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
2725 | 2725 | if (file_exists($file)) { |
2726 | 2726 | /** @noinspection PhpIncludeInspection */ |
2727 | 2727 | return require $file; |
@@ -2846,7 +2846,7 @@ discard block |
||
2846 | 2846 | |
2847 | 2847 | return implode( |
2848 | 2848 | array_map( |
2849 | - function ($data) use ($keepAsciiChars) { |
|
2849 | + function($data) use ($keepAsciiChars) { |
|
2850 | 2850 | return UTF8::single_chr_html_encode($data, $keepAsciiChars); |
2851 | 2851 | }, |
2852 | 2852 | self::split($str) |
@@ -3235,9 +3235,9 @@ discard block |
||
3235 | 3235 | if (ctype_digit((string)$int)) { |
3236 | 3236 | $hex = dechex((int)$int); |
3237 | 3237 | |
3238 | - $hex = (strlen($hex) < 4 ? substr('0000' . $hex, -4) : $hex); |
|
3238 | + $hex = (strlen($hex) < 4 ? substr('0000'.$hex, -4) : $hex); |
|
3239 | 3239 | |
3240 | - return $pfix . $hex; |
|
3240 | + return $pfix.$hex; |
|
3241 | 3241 | } |
3242 | 3242 | |
3243 | 3243 | return ''; |
@@ -3875,7 +3875,7 @@ discard block |
||
3875 | 3875 | */ |
3876 | 3876 | public static function lcfirst($str) |
3877 | 3877 | { |
3878 | - return self::strtolower(self::substr($str, 0, 1)) . self::substr($str, 1); |
|
3878 | + return self::strtolower(self::substr($str, 0, 1)).self::substr($str, 1); |
|
3879 | 3879 | } |
3880 | 3880 | |
3881 | 3881 | /** |
@@ -4281,7 +4281,7 @@ discard block |
||
4281 | 4281 | |
4282 | 4282 | if (is_array($what)) { |
4283 | 4283 | foreach ($what as $item) { |
4284 | - $str = preg_replace('/(' . preg_quote($item, '/') . ')+/', $item, $str); |
|
4284 | + $str = preg_replace('/('.preg_quote($item, '/').')+/', $item, $str); |
|
4285 | 4285 | } |
4286 | 4286 | } |
4287 | 4287 | |
@@ -4381,7 +4381,7 @@ discard block |
||
4381 | 4381 | { |
4382 | 4382 | static $rxClassCache = array(); |
4383 | 4383 | |
4384 | - $cacheKey = $s . $class; |
|
4384 | + $cacheKey = $s.$class; |
|
4385 | 4385 | |
4386 | 4386 | if (isset($rxClassCache[$cacheKey])) { |
4387 | 4387 | return $rxClassCache[$cacheKey]; |
@@ -4392,7 +4392,7 @@ discard block |
||
4392 | 4392 | /** @noinspection SuspiciousLoopInspection */ |
4393 | 4393 | foreach (self::str_split($s) as $s) { |
4394 | 4394 | if ('-' === $s) { |
4395 | - $class[0] = '-' . $class[0]; |
|
4395 | + $class[0] = '-'.$class[0]; |
|
4396 | 4396 | } elseif (!isset($s[2])) { |
4397 | 4397 | $class[0] .= preg_quote($s, '/'); |
4398 | 4398 | } elseif (1 === self::strlen($s)) { |
@@ -4402,12 +4402,12 @@ discard block |
||
4402 | 4402 | } |
4403 | 4403 | } |
4404 | 4404 | |
4405 | - $class[0] = '[' . $class[0] . ']'; |
|
4405 | + $class[0] = '['.$class[0].']'; |
|
4406 | 4406 | |
4407 | 4407 | if (1 === count($class)) { |
4408 | 4408 | $return = $class[0]; |
4409 | 4409 | } else { |
4410 | - $return = '(?:' . implode('|', $class) . ')'; |
|
4410 | + $return = '(?:'.implode('|', $class).')'; |
|
4411 | 4411 | } |
4412 | 4412 | |
4413 | 4413 | $rxClassCache[$cacheKey] = $return; |
@@ -4421,7 +4421,7 @@ discard block |
||
4421 | 4421 | public static function showSupport() |
4422 | 4422 | { |
4423 | 4423 | foreach (self::$support as $utf8Support) { |
4424 | - echo $utf8Support . "\n<br>"; |
|
4424 | + echo $utf8Support."\n<br>"; |
|
4425 | 4425 | } |
4426 | 4426 | } |
4427 | 4427 | |
@@ -4447,7 +4447,7 @@ discard block |
||
4447 | 4447 | return $char; |
4448 | 4448 | } |
4449 | 4449 | |
4450 | - return '&#' . self::ord($char) . ';'; |
|
4450 | + return '&#'.self::ord($char).';'; |
|
4451 | 4451 | } |
4452 | 4452 | |
4453 | 4453 | /** |
@@ -4496,19 +4496,19 @@ discard block |
||
4496 | 4496 | $ret[] = $str[$i]; |
4497 | 4497 | } elseif ((($str[$i] & "\xE0") === "\xC0") && isset($str[$i + 1])) { |
4498 | 4498 | if (($str[$i + 1] & "\xC0") === "\x80") { |
4499 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
4499 | + $ret[] = $str[$i].$str[$i + 1]; |
|
4500 | 4500 | |
4501 | 4501 | $i++; |
4502 | 4502 | } |
4503 | 4503 | } elseif ((($str[$i] & "\xF0") === "\xE0") && isset($str[$i + 2])) { |
4504 | 4504 | if ((($str[$i + 1] & "\xC0") === "\x80") && (($str[$i + 2] & "\xC0") === "\x80")) { |
4505 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
4505 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
4506 | 4506 | |
4507 | 4507 | $i += 2; |
4508 | 4508 | } |
4509 | 4509 | } elseif ((($str[$i] & "\xF8") === "\xF0") && isset($str[$i + 3])) { |
4510 | 4510 | if ((($str[$i + 1] & "\xC0") === "\x80") && (($str[$i + 2] & "\xC0") === "\x80") && (($str[$i + 3] & "\xC0") === "\x80")) { |
4511 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
4511 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
4512 | 4512 | |
4513 | 4513 | $i += 3; |
4514 | 4514 | } |
@@ -4642,7 +4642,7 @@ discard block |
||
4642 | 4642 | if ('' === $s .= '') { |
4643 | 4643 | $s = '/^(?<=.)$/'; |
4644 | 4644 | } else { |
4645 | - $s = '/' . preg_quote($s, '/') . '/ui'; |
|
4645 | + $s = '/'.preg_quote($s, '/').'/ui'; |
|
4646 | 4646 | } |
4647 | 4647 | } |
4648 | 4648 | |
@@ -4676,7 +4676,7 @@ discard block |
||
4676 | 4676 | } |
4677 | 4677 | |
4678 | 4678 | if (self::substr($str, $length - 1, 1) === ' ') { |
4679 | - return self::substr($str, 0, $length - 1) . $strAddOn; |
|
4679 | + return self::substr($str, 0, $length - 1).$strAddOn; |
|
4680 | 4680 | } |
4681 | 4681 | |
4682 | 4682 | $str = self::substr($str, 0, $length); |
@@ -4685,9 +4685,9 @@ discard block |
||
4685 | 4685 | $new_str = implode(' ', $array); |
4686 | 4686 | |
4687 | 4687 | if ($new_str === '') { |
4688 | - $str = self::substr($str, 0, $length - 1) . $strAddOn; |
|
4688 | + $str = self::substr($str, 0, $length - 1).$strAddOn; |
|
4689 | 4689 | } else { |
4690 | - $str = $new_str . $strAddOn; |
|
4690 | + $str = $new_str.$strAddOn; |
|
4691 | 4691 | } |
4692 | 4692 | |
4693 | 4693 | return $str; |
@@ -4733,7 +4733,7 @@ discard block |
||
4733 | 4733 | $pre = ''; |
4734 | 4734 | } |
4735 | 4735 | |
4736 | - return $pre . $str . $post; |
|
4736 | + return $pre.$str.$post; |
|
4737 | 4737 | } |
4738 | 4738 | |
4739 | 4739 | return $str; |
@@ -4867,7 +4867,7 @@ discard block |
||
4867 | 4867 | $a[] = \grapheme_extract($str, 1, GRAPHEME_EXTR_COUNT, $p, $p); |
4868 | 4868 | } |
4869 | 4869 | } else { |
4870 | - preg_match_all('/' . Grapheme::GRAPHEME_CLUSTER_RX . '/u', $str, $a); |
|
4870 | + preg_match_all('/'.Grapheme::GRAPHEME_CLUSTER_RX.'/u', $str, $a); |
|
4871 | 4871 | $a = $a[0]; |
4872 | 4872 | } |
4873 | 4873 | |
@@ -5008,7 +5008,7 @@ discard block |
||
5008 | 5008 | |
5009 | 5009 | $bank = $ord >> 8; |
5010 | 5010 | if (!array_key_exists($bank, (array)$UTF8_TO_ASCII)) { |
5011 | - $bankfile = __DIR__ . '/data/' . sprintf('x%02x', $bank) . '.php'; |
|
5011 | + $bankfile = __DIR__.'/data/'.sprintf('x%02x', $bank).'.php'; |
|
5012 | 5012 | if (file_exists($bankfile)) { |
5013 | 5013 | /** @noinspection PhpIncludeInspection */ |
5014 | 5014 | require $bankfile; |
@@ -5098,7 +5098,7 @@ discard block |
||
5098 | 5098 | */ |
5099 | 5099 | public static function strcmp($str1, $str2) |
5100 | 5100 | { |
5101 | - return $str1 . '' === $str2 . '' ? 0 : strcmp( |
|
5101 | + return $str1.'' === $str2.'' ? 0 : strcmp( |
|
5102 | 5102 | \Normalizer::normalize($str1, \Normalizer::NFD), |
5103 | 5103 | \Normalizer::normalize($str2, \Normalizer::NFD) |
5104 | 5104 | ); |
@@ -5126,7 +5126,7 @@ discard block |
||
5126 | 5126 | $str = (string)$str; |
5127 | 5127 | } |
5128 | 5128 | |
5129 | - if (preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $length)) { |
|
5129 | + if (preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $length)) { |
|
5130 | 5130 | /** @noinspection OffsetOperationsInspection */ |
5131 | 5131 | return self::strlen($length[1]); |
5132 | 5132 | } else { |
@@ -5350,7 +5350,7 @@ discard block |
||
5350 | 5350 | */ |
5351 | 5351 | public static function strnatcmp($str1, $str2) |
5352 | 5352 | { |
5353 | - return $str1 . '' === $str2 . '' ? 0 : strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
5353 | + return $str1.'' === $str2.'' ? 0 : strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
5354 | 5354 | } |
5355 | 5355 | |
5356 | 5356 | /** |
@@ -5431,7 +5431,7 @@ discard block |
||
5431 | 5431 | return false; |
5432 | 5432 | } |
5433 | 5433 | |
5434 | - if (preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
5434 | + if (preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
5435 | 5435 | return substr($haystack, strpos($haystack, $m[0])); |
5436 | 5436 | } else { |
5437 | 5437 | return false; |
@@ -5708,7 +5708,7 @@ discard block |
||
5708 | 5708 | $str = self::substr($str, $offset, $length); |
5709 | 5709 | } |
5710 | 5710 | |
5711 | - return preg_match('/^' . self::rxClass($mask) . '+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
5711 | + return preg_match('/^'.self::rxClass($mask).'+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
5712 | 5712 | } |
5713 | 5713 | |
5714 | 5714 | /** |
@@ -6151,7 +6151,7 @@ discard block |
||
6151 | 6151 | |
6152 | 6152 | $strSwappedCase = preg_replace_callback( |
6153 | 6153 | '/[\S]/u', |
6154 | - function ($match) use ($encoding) { |
|
6154 | + function($match) use ($encoding) { |
|
6155 | 6155 | $marchToUpper = UTF8::strtoupper($match[0], $encoding); |
6156 | 6156 | |
6157 | 6157 | if ($match[0] === $marchToUpper) { |
@@ -6360,40 +6360,40 @@ discard block |
||
6360 | 6360 | if ($c1 >= "\xc0" & $c1 <= "\xdf") { // looks like 2 bytes UTF8 |
6361 | 6361 | |
6362 | 6362 | if ($c2 >= "\x80" && $c2 <= "\xbf") { // yeah, almost sure it's UTF8 already |
6363 | - $buf .= $c1 . $c2; |
|
6363 | + $buf .= $c1.$c2; |
|
6364 | 6364 | $i++; |
6365 | 6365 | } else { // not valid UTF8 - convert it |
6366 | 6366 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
6367 | 6367 | $cc2 = ($c1 & "\x3f") | "\x80"; |
6368 | - $buf .= $cc1 . $cc2; |
|
6368 | + $buf .= $cc1.$cc2; |
|
6369 | 6369 | } |
6370 | 6370 | |
6371 | 6371 | } elseif ($c1 >= "\xe0" & $c1 <= "\xef") { // looks like 3 bytes UTF8 |
6372 | 6372 | |
6373 | 6373 | if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf") { // yeah, almost sure it's UTF8 already |
6374 | - $buf .= $c1 . $c2 . $c3; |
|
6374 | + $buf .= $c1.$c2.$c3; |
|
6375 | 6375 | $i += 2; |
6376 | 6376 | } else { // not valid UTF8 - convert it |
6377 | 6377 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
6378 | 6378 | $cc2 = ($c1 & "\x3f") | "\x80"; |
6379 | - $buf .= $cc1 . $cc2; |
|
6379 | + $buf .= $cc1.$cc2; |
|
6380 | 6380 | } |
6381 | 6381 | |
6382 | 6382 | } elseif ($c1 >= "\xf0" & $c1 <= "\xf7") { // looks like 4 bytes UTF8 |
6383 | 6383 | |
6384 | 6384 | if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf" && $c4 >= "\x80" && $c4 <= "\xbf") { // yeah, almost sure it's UTF8 already |
6385 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
6385 | + $buf .= $c1.$c2.$c3.$c4; |
|
6386 | 6386 | $i += 3; |
6387 | 6387 | } else { // not valid UTF8 - convert it |
6388 | 6388 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
6389 | 6389 | $cc2 = ($c1 & "\x3f") | "\x80"; |
6390 | - $buf .= $cc1 . $cc2; |
|
6390 | + $buf .= $cc1.$cc2; |
|
6391 | 6391 | } |
6392 | 6392 | |
6393 | 6393 | } else { // doesn't look like UTF8, but should be converted |
6394 | 6394 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
6395 | 6395 | $cc2 = (($c1 & "\x3f") | "\x80"); |
6396 | - $buf .= $cc1 . $cc2; |
|
6396 | + $buf .= $cc1.$cc2; |
|
6397 | 6397 | } |
6398 | 6398 | |
6399 | 6399 | } elseif (($c1 & "\xc0") === "\x80") { // needs conversion |
@@ -6404,7 +6404,7 @@ discard block |
||
6404 | 6404 | } else { |
6405 | 6405 | $cc1 = (chr($ordC1 / 64) | "\xc0"); |
6406 | 6406 | $cc2 = (($c1 & "\x3f") | "\x80"); |
6407 | - $buf .= $cc1 . $cc2; |
|
6407 | + $buf .= $cc1.$cc2; |
|
6408 | 6408 | } |
6409 | 6409 | |
6410 | 6410 | } else { // it doesn't need conversion |
@@ -6417,7 +6417,7 @@ discard block |
||
6417 | 6417 | // decode unicode escape sequences |
6418 | 6418 | $buf = preg_replace_callback( |
6419 | 6419 | '/\\\\u([0-9a-f]{4})/i', |
6420 | - function ($match) { |
|
6420 | + function($match) { |
|
6421 | 6421 | return \mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); |
6422 | 6422 | }, |
6423 | 6423 | $buf |
@@ -6426,7 +6426,7 @@ discard block |
||
6426 | 6426 | // decode UTF-8 codepoints |
6427 | 6427 | $buf = preg_replace_callback( |
6428 | 6428 | '/&#\d{2,4};/', |
6429 | - function ($match) { |
|
6429 | + function($match) { |
|
6430 | 6430 | return \mb_convert_encoding($match[0], 'UTF-8', 'HTML-ENTITIES'); |
6431 | 6431 | }, |
6432 | 6432 | $buf |
@@ -6501,7 +6501,7 @@ discard block |
||
6501 | 6501 | */ |
6502 | 6502 | public static function ucfirst($str) |
6503 | 6503 | { |
6504 | - return self::strtoupper(self::substr($str, 0, 1)) . self::substr($str, 1); |
|
6504 | + return self::strtoupper(self::substr($str, 0, 1)).self::substr($str, 1); |
|
6505 | 6505 | } |
6506 | 6506 | |
6507 | 6507 | /** |
@@ -6950,7 +6950,7 @@ discard block |
||
6950 | 6950 | return ''; |
6951 | 6951 | } |
6952 | 6952 | |
6953 | - preg_match('/^\s*+(?:\S++\s*+){1,' . $words . '}/u', $str, $matches); |
|
6953 | + preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $str, $matches); |
|
6954 | 6954 | |
6955 | 6955 | if ( |
6956 | 6956 | !isset($matches[0]) |
@@ -6960,7 +6960,7 @@ discard block |
||
6960 | 6960 | return $str; |
6961 | 6961 | } |
6962 | 6962 | |
6963 | - return self::rtrim($matches[0]) . $strAddOn; |
|
6963 | + return self::rtrim($matches[0]).$strAddOn; |
|
6964 | 6964 | } |
6965 | 6965 | |
6966 | 6966 | /** |
@@ -7042,7 +7042,7 @@ discard block |
||
7042 | 7042 | $strReturn .= $break; |
7043 | 7043 | } |
7044 | 7044 | |
7045 | - return $strReturn . implode('', $chars); |
|
7045 | + return $strReturn.implode('', $chars); |
|
7046 | 7046 | } |
7047 | 7047 | |
7048 | 7048 | /** |