@@ -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 self::single_chr_html_encode($data, $keepAsciiChars); |
2851 | 2851 | }, |
2852 | 2852 | self::split($str) |
@@ -3071,7 +3071,7 @@ discard block |
||
3071 | 3071 | { |
3072 | 3072 | $encoding = self::normalizeEncoding($encoding); |
3073 | 3073 | |
3074 | - $str = htmlentities($str, $flags, $encoding, $double_encode); |
|
3074 | + $str = htmlentities($str, $flags, $encoding, $double_encode); |
|
3075 | 3075 | |
3076 | 3076 | if ($encoding !== 'UTF-8') { |
3077 | 3077 | return $str; |
@@ -3233,9 +3233,9 @@ discard block |
||
3233 | 3233 | if (ctype_digit((string)$int)) { |
3234 | 3234 | $hex = dechex((int)$int); |
3235 | 3235 | |
3236 | - $hex = (strlen($hex) < 4 ? substr('0000' . $hex, -4) : $hex); |
|
3236 | + $hex = (strlen($hex) < 4 ? substr('0000'.$hex, -4) : $hex); |
|
3237 | 3237 | |
3238 | - return $pfix . $hex; |
|
3238 | + return $pfix.$hex; |
|
3239 | 3239 | } |
3240 | 3240 | |
3241 | 3241 | return ''; |
@@ -3813,7 +3813,7 @@ discard block |
||
3813 | 3813 | */ |
3814 | 3814 | public static function lcfirst($str) |
3815 | 3815 | { |
3816 | - return self::strtolower(self::substr($str, 0, 1)) . self::substr($str, 1); |
|
3816 | + return self::strtolower(self::substr($str, 0, 1)).self::substr($str, 1); |
|
3817 | 3817 | } |
3818 | 3818 | |
3819 | 3819 | /** |
@@ -4219,7 +4219,7 @@ discard block |
||
4219 | 4219 | |
4220 | 4220 | if (is_array($what)) { |
4221 | 4221 | foreach ($what as $item) { |
4222 | - $str = preg_replace('/(' . preg_quote($item, '/') . ')+/', $item, $str); |
|
4222 | + $str = preg_replace('/('.preg_quote($item, '/').')+/', $item, $str); |
|
4223 | 4223 | } |
4224 | 4224 | } |
4225 | 4225 | |
@@ -4319,7 +4319,7 @@ discard block |
||
4319 | 4319 | { |
4320 | 4320 | static $rxClassCache = array(); |
4321 | 4321 | |
4322 | - $cacheKey = $s . $class; |
|
4322 | + $cacheKey = $s.$class; |
|
4323 | 4323 | |
4324 | 4324 | if (isset($rxClassCache[$cacheKey])) { |
4325 | 4325 | return $rxClassCache[$cacheKey]; |
@@ -4330,7 +4330,7 @@ discard block |
||
4330 | 4330 | /** @noinspection SuspiciousLoopInspection */ |
4331 | 4331 | foreach (self::str_split($s) as $s) { |
4332 | 4332 | if ('-' === $s) { |
4333 | - $class[0] = '-' . $class[0]; |
|
4333 | + $class[0] = '-'.$class[0]; |
|
4334 | 4334 | } elseif (!isset($s[2])) { |
4335 | 4335 | $class[0] .= preg_quote($s, '/'); |
4336 | 4336 | } elseif (1 === self::strlen($s)) { |
@@ -4340,12 +4340,12 @@ discard block |
||
4340 | 4340 | } |
4341 | 4341 | } |
4342 | 4342 | |
4343 | - $class[0] = '[' . $class[0] . ']'; |
|
4343 | + $class[0] = '['.$class[0].']'; |
|
4344 | 4344 | |
4345 | 4345 | if (1 === count($class)) { |
4346 | 4346 | $return = $class[0]; |
4347 | 4347 | } else { |
4348 | - $return = '(?:' . implode('|', $class) . ')'; |
|
4348 | + $return = '(?:'.implode('|', $class).')'; |
|
4349 | 4349 | } |
4350 | 4350 | |
4351 | 4351 | $rxClassCache[$cacheKey] = $return; |
@@ -4359,7 +4359,7 @@ discard block |
||
4359 | 4359 | public static function showSupport() |
4360 | 4360 | { |
4361 | 4361 | foreach (self::$support as $utf8Support) { |
4362 | - echo $utf8Support . "\n<br>"; |
|
4362 | + echo $utf8Support."\n<br>"; |
|
4363 | 4363 | } |
4364 | 4364 | } |
4365 | 4365 | |
@@ -4385,7 +4385,7 @@ discard block |
||
4385 | 4385 | return $char; |
4386 | 4386 | } |
4387 | 4387 | |
4388 | - return '&#' . self::ord($char) . ';'; |
|
4388 | + return '&#'.self::ord($char).';'; |
|
4389 | 4389 | } |
4390 | 4390 | |
4391 | 4391 | /** |
@@ -4434,19 +4434,19 @@ discard block |
||
4434 | 4434 | $ret[] = $str[$i]; |
4435 | 4435 | } elseif ((($str[$i] & "\xE0") === "\xC0") && isset($str[$i + 1])) { |
4436 | 4436 | if (($str[$i + 1] & "\xC0") === "\x80") { |
4437 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
4437 | + $ret[] = $str[$i].$str[$i + 1]; |
|
4438 | 4438 | |
4439 | 4439 | $i++; |
4440 | 4440 | } |
4441 | 4441 | } elseif ((($str[$i] & "\xF0") === "\xE0") && isset($str[$i + 2])) { |
4442 | 4442 | if ((($str[$i + 1] & "\xC0") === "\x80") && (($str[$i + 2] & "\xC0") === "\x80")) { |
4443 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
4443 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
4444 | 4444 | |
4445 | 4445 | $i += 2; |
4446 | 4446 | } |
4447 | 4447 | } elseif ((($str[$i] & "\xF8") === "\xF0") && isset($str[$i + 3])) { |
4448 | 4448 | if ((($str[$i + 1] & "\xC0") === "\x80") && (($str[$i + 2] & "\xC0") === "\x80") && (($str[$i + 3] & "\xC0") === "\x80")) { |
4449 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
4449 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
4450 | 4450 | |
4451 | 4451 | $i += 3; |
4452 | 4452 | } |
@@ -4580,7 +4580,7 @@ discard block |
||
4580 | 4580 | if ('' === $s .= '') { |
4581 | 4581 | $s = '/^(?<=.)$/'; |
4582 | 4582 | } else { |
4583 | - $s = '/' . preg_quote($s, '/') . '/ui'; |
|
4583 | + $s = '/'.preg_quote($s, '/').'/ui'; |
|
4584 | 4584 | } |
4585 | 4585 | } |
4586 | 4586 | |
@@ -4614,7 +4614,7 @@ discard block |
||
4614 | 4614 | } |
4615 | 4615 | |
4616 | 4616 | if (self::substr($str, $length - 1, 1) === ' ') { |
4617 | - return self::substr($str, 0, $length - 1) . $strAddOn; |
|
4617 | + return self::substr($str, 0, $length - 1).$strAddOn; |
|
4618 | 4618 | } |
4619 | 4619 | |
4620 | 4620 | $str = self::substr($str, 0, $length); |
@@ -4623,9 +4623,9 @@ discard block |
||
4623 | 4623 | $new_str = implode(' ', $array); |
4624 | 4624 | |
4625 | 4625 | if ($new_str === '') { |
4626 | - $str = self::substr($str, 0, $length - 1) . $strAddOn; |
|
4626 | + $str = self::substr($str, 0, $length - 1).$strAddOn; |
|
4627 | 4627 | } else { |
4628 | - $str = $new_str . $strAddOn; |
|
4628 | + $str = $new_str.$strAddOn; |
|
4629 | 4629 | } |
4630 | 4630 | |
4631 | 4631 | return $str; |
@@ -4671,7 +4671,7 @@ discard block |
||
4671 | 4671 | $pre = ''; |
4672 | 4672 | } |
4673 | 4673 | |
4674 | - return $pre . $input . $post; |
|
4674 | + return $pre.$input.$post; |
|
4675 | 4675 | } |
4676 | 4676 | |
4677 | 4677 | return $input; |
@@ -4805,7 +4805,7 @@ discard block |
||
4805 | 4805 | $a[] = \grapheme_extract($str, 1, GRAPHEME_EXTR_COUNT, $p, $p); |
4806 | 4806 | } |
4807 | 4807 | } else { |
4808 | - preg_match_all('/' . Grapheme::GRAPHEME_CLUSTER_RX . '/u', $str, $a); |
|
4808 | + preg_match_all('/'.Grapheme::GRAPHEME_CLUSTER_RX.'/u', $str, $a); |
|
4809 | 4809 | $a = $a[0]; |
4810 | 4810 | } |
4811 | 4811 | |
@@ -4946,7 +4946,7 @@ discard block |
||
4946 | 4946 | |
4947 | 4947 | $bank = $ord >> 8; |
4948 | 4948 | if (!array_key_exists($bank, (array)$UTF8_TO_ASCII)) { |
4949 | - $bankfile = __DIR__ . '/data/' . sprintf('x%02x', $bank) . '.php'; |
|
4949 | + $bankfile = __DIR__.'/data/'.sprintf('x%02x', $bank).'.php'; |
|
4950 | 4950 | if (file_exists($bankfile)) { |
4951 | 4951 | /** @noinspection PhpIncludeInspection */ |
4952 | 4952 | require $bankfile; |
@@ -5036,7 +5036,7 @@ discard block |
||
5036 | 5036 | */ |
5037 | 5037 | public static function strcmp($str1, $str2) |
5038 | 5038 | { |
5039 | - return $str1 . '' === $str2 . '' ? 0 : strcmp( |
|
5039 | + return $str1.'' === $str2.'' ? 0 : strcmp( |
|
5040 | 5040 | \Normalizer::normalize($str1, \Normalizer::NFD), |
5041 | 5041 | \Normalizer::normalize($str2, \Normalizer::NFD) |
5042 | 5042 | ); |
@@ -5064,7 +5064,7 @@ discard block |
||
5064 | 5064 | $str = (string)$str; |
5065 | 5065 | } |
5066 | 5066 | |
5067 | - if (preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $length)) { |
|
5067 | + if (preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $length)) { |
|
5068 | 5068 | /** @noinspection OffsetOperationsInspection */ |
5069 | 5069 | return self::strlen($length[1]); |
5070 | 5070 | } else { |
@@ -5288,7 +5288,7 @@ discard block |
||
5288 | 5288 | */ |
5289 | 5289 | public static function strnatcmp($str1, $str2) |
5290 | 5290 | { |
5291 | - return $str1 . '' === $str2 . '' ? 0 : strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
5291 | + return $str1.'' === $str2.'' ? 0 : strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
5292 | 5292 | } |
5293 | 5293 | |
5294 | 5294 | /** |
@@ -5369,7 +5369,7 @@ discard block |
||
5369 | 5369 | return false; |
5370 | 5370 | } |
5371 | 5371 | |
5372 | - if (preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
5372 | + if (preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
5373 | 5373 | return substr($haystack, strpos($haystack, $m[0])); |
5374 | 5374 | } else { |
5375 | 5375 | return false; |
@@ -5646,7 +5646,7 @@ discard block |
||
5646 | 5646 | $str = self::substr($str, $offset, $length); |
5647 | 5647 | } |
5648 | 5648 | |
5649 | - return preg_match('/^' . self::rxClass($mask) . '+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
5649 | + return preg_match('/^'.self::rxClass($mask).'+/u', $str, $str) ? self::strlen($str[0]) : 0; |
|
5650 | 5650 | } |
5651 | 5651 | |
5652 | 5652 | /** |
@@ -6089,7 +6089,7 @@ discard block |
||
6089 | 6089 | |
6090 | 6090 | $strSwappedCase = preg_replace_callback( |
6091 | 6091 | '/[\S]/u', |
6092 | - function ($match) use ($encoding) { |
|
6092 | + function($match) use ($encoding) { |
|
6093 | 6093 | $marchToUpper = UTF8::strtoupper($match[0], $encoding); |
6094 | 6094 | |
6095 | 6095 | if ($match[0] === $marchToUpper) { |
@@ -6298,40 +6298,40 @@ discard block |
||
6298 | 6298 | if ($c1 >= "\xc0" & $c1 <= "\xdf") { // looks like 2 bytes UTF8 |
6299 | 6299 | |
6300 | 6300 | if ($c2 >= "\x80" && $c2 <= "\xbf") { // yeah, almost sure it's UTF8 already |
6301 | - $buf .= $c1 . $c2; |
|
6301 | + $buf .= $c1.$c2; |
|
6302 | 6302 | $i++; |
6303 | 6303 | } else { // not valid UTF8 - convert it |
6304 | 6304 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
6305 | 6305 | $cc2 = ($c1 & "\x3f") | "\x80"; |
6306 | - $buf .= $cc1 . $cc2; |
|
6306 | + $buf .= $cc1.$cc2; |
|
6307 | 6307 | } |
6308 | 6308 | |
6309 | 6309 | } elseif ($c1 >= "\xe0" & $c1 <= "\xef") { // looks like 3 bytes UTF8 |
6310 | 6310 | |
6311 | 6311 | if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf") { // yeah, almost sure it's UTF8 already |
6312 | - $buf .= $c1 . $c2 . $c3; |
|
6312 | + $buf .= $c1.$c2.$c3; |
|
6313 | 6313 | $i += 2; |
6314 | 6314 | } else { // not valid UTF8 - convert it |
6315 | 6315 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
6316 | 6316 | $cc2 = ($c1 & "\x3f") | "\x80"; |
6317 | - $buf .= $cc1 . $cc2; |
|
6317 | + $buf .= $cc1.$cc2; |
|
6318 | 6318 | } |
6319 | 6319 | |
6320 | 6320 | } elseif ($c1 >= "\xf0" & $c1 <= "\xf7") { // looks like 4 bytes UTF8 |
6321 | 6321 | |
6322 | 6322 | if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf" && $c4 >= "\x80" && $c4 <= "\xbf") { // yeah, almost sure it's UTF8 already |
6323 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
6323 | + $buf .= $c1.$c2.$c3.$c4; |
|
6324 | 6324 | $i += 3; |
6325 | 6325 | } else { // not valid UTF8 - convert it |
6326 | 6326 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
6327 | 6327 | $cc2 = ($c1 & "\x3f") | "\x80"; |
6328 | - $buf .= $cc1 . $cc2; |
|
6328 | + $buf .= $cc1.$cc2; |
|
6329 | 6329 | } |
6330 | 6330 | |
6331 | 6331 | } else { // doesn't look like UTF8, but should be converted |
6332 | 6332 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
6333 | 6333 | $cc2 = (($c1 & "\x3f") | "\x80"); |
6334 | - $buf .= $cc1 . $cc2; |
|
6334 | + $buf .= $cc1.$cc2; |
|
6335 | 6335 | } |
6336 | 6336 | |
6337 | 6337 | } elseif (($c1 & "\xc0") === "\x80") { // needs conversion |
@@ -6342,7 +6342,7 @@ discard block |
||
6342 | 6342 | } else { |
6343 | 6343 | $cc1 = (chr($ordC1 / 64) | "\xc0"); |
6344 | 6344 | $cc2 = (($c1 & "\x3f") | "\x80"); |
6345 | - $buf .= $cc1 . $cc2; |
|
6345 | + $buf .= $cc1.$cc2; |
|
6346 | 6346 | } |
6347 | 6347 | |
6348 | 6348 | } else { // it doesn't need conversion |
@@ -6355,7 +6355,7 @@ discard block |
||
6355 | 6355 | // decode unicode escape sequences |
6356 | 6356 | $buf = preg_replace_callback( |
6357 | 6357 | '/\\\\u([0-9a-f]{4})/i', |
6358 | - function ($match) { |
|
6358 | + function($match) { |
|
6359 | 6359 | return \mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); |
6360 | 6360 | }, |
6361 | 6361 | $buf |
@@ -6364,7 +6364,7 @@ discard block |
||
6364 | 6364 | // decode UTF-8 codepoints |
6365 | 6365 | $buf = preg_replace_callback( |
6366 | 6366 | '/&#\d{2,4};/', |
6367 | - function ($match) { |
|
6367 | + function($match) { |
|
6368 | 6368 | return \mb_convert_encoding($match[0], 'UTF-8', 'HTML-ENTITIES'); |
6369 | 6369 | }, |
6370 | 6370 | $buf |
@@ -6439,7 +6439,7 @@ discard block |
||
6439 | 6439 | */ |
6440 | 6440 | public static function ucfirst($str) |
6441 | 6441 | { |
6442 | - return self::strtoupper(self::substr($str, 0, 1)) . self::substr($str, 1); |
|
6442 | + return self::strtoupper(self::substr($str, 0, 1)).self::substr($str, 1); |
|
6443 | 6443 | } |
6444 | 6444 | |
6445 | 6445 | /** |
@@ -6888,7 +6888,7 @@ discard block |
||
6888 | 6888 | return ''; |
6889 | 6889 | } |
6890 | 6890 | |
6891 | - preg_match('/^\s*+(?:\S++\s*+){1,' . $words . '}/u', $str, $matches); |
|
6891 | + preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $str, $matches); |
|
6892 | 6892 | |
6893 | 6893 | if ( |
6894 | 6894 | !isset($matches[0]) |
@@ -6898,7 +6898,7 @@ discard block |
||
6898 | 6898 | return $str; |
6899 | 6899 | } |
6900 | 6900 | |
6901 | - return self::rtrim($matches[0]) . $strAddOn; |
|
6901 | + return self::rtrim($matches[0]).$strAddOn; |
|
6902 | 6902 | } |
6903 | 6903 | |
6904 | 6904 | /** |
@@ -6980,7 +6980,7 @@ discard block |
||
6980 | 6980 | $strReturn .= $break; |
6981 | 6981 | } |
6982 | 6982 | |
6983 | - return $strReturn . implode('', $chars); |
|
6983 | + return $strReturn.implode('', $chars); |
|
6984 | 6984 | } |
6985 | 6985 | |
6986 | 6986 | /** |