@@ -819,7 +819,7 @@ discard block |
||
| 819 | 819 | public static function add_bom_to_string($str) |
| 820 | 820 | { |
| 821 | 821 | if (!self::is_bom(substr($str, 0, 3))) { |
| 822 | - $str = self::bom() . $str; |
|
| 822 | + $str = self::bom().$str; |
|
| 823 | 823 | } |
| 824 | 824 | |
| 825 | 825 | return $str; |
@@ -2135,7 +2135,7 @@ discard block |
||
| 2135 | 2135 | self::checkForSupport(); |
| 2136 | 2136 | |
| 2137 | 2137 | return mb_convert_encoding( |
| 2138 | - '&#x' . dechex($code) . ';', |
|
| 2138 | + '&#x'.dechex($code).';', |
|
| 2139 | 2139 | 'UTF-8', |
| 2140 | 2140 | 'HTML-ENTITIES' |
| 2141 | 2141 | ); |
@@ -2373,7 +2373,7 @@ discard block |
||
| 2373 | 2373 | if ($var[0] >= "\x80" && isset($n[0], $leading_combining[0]) && preg_match('/^\p{Mn}/u', $var)) { |
| 2374 | 2374 | // Prevent leading combining chars |
| 2375 | 2375 | // for NFC-safe concatenations. |
| 2376 | - $var = $leading_combining . $var; |
|
| 2376 | + $var = $leading_combining.$var; |
|
| 2377 | 2377 | } |
| 2378 | 2378 | } |
| 2379 | 2379 | break; |
@@ -2640,7 +2640,7 @@ discard block |
||
| 2640 | 2640 | */ |
| 2641 | 2641 | protected static function getData($file) |
| 2642 | 2642 | { |
| 2643 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
| 2643 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
| 2644 | 2644 | if (file_exists($file)) { |
| 2645 | 2645 | /** @noinspection PhpIncludeInspection */ |
| 2646 | 2646 | return require $file; |
@@ -3086,9 +3086,9 @@ discard block |
||
| 3086 | 3086 | if (ctype_digit((string)$int)) { |
| 3087 | 3087 | $hex = dechex((int)$int); |
| 3088 | 3088 | |
| 3089 | - $hex = (strlen($hex) < 4 ? substr('0000' . $hex, -4) : $hex); |
|
| 3089 | + $hex = (strlen($hex) < 4 ? substr('0000'.$hex, -4) : $hex); |
|
| 3090 | 3090 | |
| 3091 | - return $pfix . $hex; |
|
| 3091 | + return $pfix.$hex; |
|
| 3092 | 3092 | } |
| 3093 | 3093 | |
| 3094 | 3094 | return ''; |
@@ -3625,7 +3625,7 @@ discard block |
||
| 3625 | 3625 | */ |
| 3626 | 3626 | public static function lcfirst($str) |
| 3627 | 3627 | { |
| 3628 | - return self::strtolower(self::substr($str, 0, 1)) . self::substr($str, 1); |
|
| 3628 | + return self::strtolower(self::substr($str, 0, 1)).self::substr($str, 1); |
|
| 3629 | 3629 | } |
| 3630 | 3630 | |
| 3631 | 3631 | /** |
@@ -4009,7 +4009,7 @@ discard block |
||
| 4009 | 4009 | |
| 4010 | 4010 | if (is_array($what)) { |
| 4011 | 4011 | foreach ($what as $item) { |
| 4012 | - $str = preg_replace('/(' . preg_quote($item, '/') . ')+/', $item, $str); |
|
| 4012 | + $str = preg_replace('/('.preg_quote($item, '/').')+/', $item, $str); |
|
| 4013 | 4013 | } |
| 4014 | 4014 | } |
| 4015 | 4015 | |
@@ -4108,7 +4108,7 @@ discard block |
||
| 4108 | 4108 | { |
| 4109 | 4109 | static $rxClassCache = array(); |
| 4110 | 4110 | |
| 4111 | - $cacheKey = $s . $class; |
|
| 4111 | + $cacheKey = $s.$class; |
|
| 4112 | 4112 | |
| 4113 | 4113 | if (isset($rxClassCache[$cacheKey])) { |
| 4114 | 4114 | return $rxClassCache[$cacheKey]; |
@@ -4119,7 +4119,7 @@ discard block |
||
| 4119 | 4119 | /** @noinspection SuspiciousLoopInspection */ |
| 4120 | 4120 | foreach (self::str_split($s) as $s) { |
| 4121 | 4121 | if ('-' === $s) { |
| 4122 | - $class[0] = '-' . $class[0]; |
|
| 4122 | + $class[0] = '-'.$class[0]; |
|
| 4123 | 4123 | } elseif (!isset($s[2])) { |
| 4124 | 4124 | $class[0] .= preg_quote($s, '/'); |
| 4125 | 4125 | } elseif (1 === self::strlen($s)) { |
@@ -4129,12 +4129,12 @@ discard block |
||
| 4129 | 4129 | } |
| 4130 | 4130 | } |
| 4131 | 4131 | |
| 4132 | - $class[0] = '[' . $class[0] . ']'; |
|
| 4132 | + $class[0] = '['.$class[0].']'; |
|
| 4133 | 4133 | |
| 4134 | 4134 | if (1 === count($class)) { |
| 4135 | 4135 | $return = $class[0]; |
| 4136 | 4136 | } else { |
| 4137 | - $return = '(?:' . implode('|', $class) . ')'; |
|
| 4137 | + $return = '(?:'.implode('|', $class).')'; |
|
| 4138 | 4138 | } |
| 4139 | 4139 | |
| 4140 | 4140 | $rxClassCache[$cacheKey] = $return; |
@@ -4148,7 +4148,7 @@ discard block |
||
| 4148 | 4148 | public static function showSupport() |
| 4149 | 4149 | { |
| 4150 | 4150 | foreach (self::$support as $utf8Support) { |
| 4151 | - echo $utf8Support . "\n<br>"; |
|
| 4151 | + echo $utf8Support."\n<br>"; |
|
| 4152 | 4152 | } |
| 4153 | 4153 | } |
| 4154 | 4154 | |
@@ -4165,7 +4165,7 @@ discard block |
||
| 4165 | 4165 | return ''; |
| 4166 | 4166 | } |
| 4167 | 4167 | |
| 4168 | - return '&#' . self::ord($chr) . ';'; |
|
| 4168 | + return '&#'.self::ord($chr).';'; |
|
| 4169 | 4169 | } |
| 4170 | 4170 | |
| 4171 | 4171 | /** |
@@ -4214,19 +4214,19 @@ discard block |
||
| 4214 | 4214 | $ret[] = $str[$i]; |
| 4215 | 4215 | } elseif ((($str[$i] & "\xE0") === "\xC0") && isset($str[$i + 1])) { |
| 4216 | 4216 | if (($str[$i + 1] & "\xC0") === "\x80") { |
| 4217 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
| 4217 | + $ret[] = $str[$i].$str[$i + 1]; |
|
| 4218 | 4218 | |
| 4219 | 4219 | $i++; |
| 4220 | 4220 | } |
| 4221 | 4221 | } elseif ((($str[$i] & "\xF0") === "\xE0") && isset($str[$i + 2])) { |
| 4222 | 4222 | if ((($str[$i + 1] & "\xC0") === "\x80") && (($str[$i + 2] & "\xC0") === "\x80")) { |
| 4223 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
| 4223 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
| 4224 | 4224 | |
| 4225 | 4225 | $i += 2; |
| 4226 | 4226 | } |
| 4227 | 4227 | } elseif ((($str[$i] & "\xF8") === "\xF0") && isset($str[$i + 3])) { |
| 4228 | 4228 | if ((($str[$i + 1] & "\xC0") === "\x80") && (($str[$i + 2] & "\xC0") === "\x80") && (($str[$i + 3] & "\xC0") === "\x80")) { |
| 4229 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
| 4229 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
| 4230 | 4230 | |
| 4231 | 4231 | $i += 3; |
| 4232 | 4232 | } |
@@ -4360,7 +4360,7 @@ discard block |
||
| 4360 | 4360 | if ('' === $s .= '') { |
| 4361 | 4361 | $s = '/^(?<=.)$/'; |
| 4362 | 4362 | } else { |
| 4363 | - $s = '/' . preg_quote($s, '/') . '/ui'; |
|
| 4363 | + $s = '/'.preg_quote($s, '/').'/ui'; |
|
| 4364 | 4364 | } |
| 4365 | 4365 | } |
| 4366 | 4366 | |
@@ -4392,7 +4392,7 @@ discard block |
||
| 4392 | 4392 | } |
| 4393 | 4393 | |
| 4394 | 4394 | if (self::substr($str, $length - 1, 1) === ' ') { |
| 4395 | - return self::substr($str, 0, $length - 1) . $strAddOn; |
|
| 4395 | + return self::substr($str, 0, $length - 1).$strAddOn; |
|
| 4396 | 4396 | } |
| 4397 | 4397 | |
| 4398 | 4398 | $str = self::substr($str, 0, $length); |
@@ -4401,9 +4401,9 @@ discard block |
||
| 4401 | 4401 | $new_str = implode(' ', $array); |
| 4402 | 4402 | |
| 4403 | 4403 | if ($new_str === '') { |
| 4404 | - $str = self::substr($str, 0, $length - 1) . $strAddOn; |
|
| 4404 | + $str = self::substr($str, 0, $length - 1).$strAddOn; |
|
| 4405 | 4405 | } else { |
| 4406 | - $str = $new_str . $strAddOn; |
|
| 4406 | + $str = $new_str.$strAddOn; |
|
| 4407 | 4407 | } |
| 4408 | 4408 | |
| 4409 | 4409 | return $str; |
@@ -4449,7 +4449,7 @@ discard block |
||
| 4449 | 4449 | $pre = ''; |
| 4450 | 4450 | } |
| 4451 | 4451 | |
| 4452 | - return $pre . $input . $post; |
|
| 4452 | + return $pre.$input.$post; |
|
| 4453 | 4453 | } |
| 4454 | 4454 | |
| 4455 | 4455 | return $input; |
@@ -4583,7 +4583,7 @@ discard block |
||
| 4583 | 4583 | $a[] = grapheme_extract($str, 1, GRAPHEME_EXTR_COUNT, $p, $p); |
| 4584 | 4584 | } |
| 4585 | 4585 | } else { |
| 4586 | - preg_match_all('/' . Grapheme::GRAPHEME_CLUSTER_RX . '/u', $str, $a); |
|
| 4586 | + preg_match_all('/'.Grapheme::GRAPHEME_CLUSTER_RX.'/u', $str, $a); |
|
| 4587 | 4587 | $a = $a[0]; |
| 4588 | 4588 | } |
| 4589 | 4589 | |
@@ -4724,7 +4724,7 @@ discard block |
||
| 4724 | 4724 | |
| 4725 | 4725 | $bank = $ord >> 8; |
| 4726 | 4726 | if (!array_key_exists($bank, (array)$UTF8_TO_ASCII)) { |
| 4727 | - $bankfile = __DIR__ . '/data/' . sprintf('x%02x', $bank) . '.php'; |
|
| 4727 | + $bankfile = __DIR__.'/data/'.sprintf('x%02x', $bank).'.php'; |
|
| 4728 | 4728 | if (file_exists($bankfile)) { |
| 4729 | 4729 | /** @noinspection PhpIncludeInspection */ |
| 4730 | 4730 | require $bankfile; |
@@ -4812,7 +4812,7 @@ discard block |
||
| 4812 | 4812 | */ |
| 4813 | 4813 | public static function strcmp($str1, $str2) |
| 4814 | 4814 | { |
| 4815 | - return $str1 . '' === $str2 . '' ? 0 : strcmp( |
|
| 4815 | + return $str1.'' === $str2.'' ? 0 : strcmp( |
|
| 4816 | 4816 | Normalizer::normalize($str1, Normalizer::NFD), |
| 4817 | 4817 | Normalizer::normalize($str2, Normalizer::NFD) |
| 4818 | 4818 | ); |
@@ -4841,7 +4841,7 @@ discard block |
||
| 4841 | 4841 | } |
| 4842 | 4842 | |
| 4843 | 4843 | /* @var $len array */ |
| 4844 | - if (preg_match('/^(.*?)' . self::rxClass($charlist) . '/us', $str, $len)) { |
|
| 4844 | + if (preg_match('/^(.*?)'.self::rxClass($charlist).'/us', $str, $len)) { |
|
| 4845 | 4845 | return self::strlen($len[1]); |
| 4846 | 4846 | } else { |
| 4847 | 4847 | return self::strlen($str); |
@@ -5038,7 +5038,7 @@ discard block |
||
| 5038 | 5038 | */ |
| 5039 | 5039 | public static function strnatcmp($str1, $str2) |
| 5040 | 5040 | { |
| 5041 | - return $str1 . '' === $str2 . '' ? 0 : strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
| 5041 | + return $str1.'' === $str2.'' ? 0 : strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2)); |
|
| 5042 | 5042 | } |
| 5043 | 5043 | |
| 5044 | 5044 | /** |
@@ -5081,7 +5081,7 @@ discard block |
||
| 5081 | 5081 | */ |
| 5082 | 5082 | public static function strpbrk($s, $charList) |
| 5083 | 5083 | { |
| 5084 | - if (preg_match('/' . self::rxClass($charList) . '/us', $s, $m)) { |
|
| 5084 | + if (preg_match('/'.self::rxClass($charList).'/us', $s, $m)) { |
|
| 5085 | 5085 | return substr($s, strpos($s, $m[0])); |
| 5086 | 5086 | } else { |
| 5087 | 5087 | return false; |
@@ -5352,7 +5352,7 @@ discard block |
||
| 5352 | 5352 | $s = self::substr($s, $start, $len); |
| 5353 | 5353 | } |
| 5354 | 5354 | |
| 5355 | - return preg_match('/^' . self::rxClass($mask) . '+/u', $s, $s) ? self::strlen($s[0]) : 0; |
|
| 5355 | + return preg_match('/^'.self::rxClass($mask).'+/u', $s, $s) ? self::strlen($s[0]) : 0; |
|
| 5356 | 5356 | } |
| 5357 | 5357 | |
| 5358 | 5358 | /** |
@@ -5789,7 +5789,7 @@ discard block |
||
| 5789 | 5789 | |
| 5790 | 5790 | $strSwappedCase = preg_replace_callback( |
| 5791 | 5791 | '/[\S]/u', |
| 5792 | - function ($match) use ($encoding) { |
|
| 5792 | + function($match) use ($encoding) { |
|
| 5793 | 5793 | $marchToUpper = UTF8::strtoupper($match[0], $encoding); |
| 5794 | 5794 | |
| 5795 | 5795 | if ($match[0] == $marchToUpper) { |
@@ -5998,40 +5998,40 @@ discard block |
||
| 5998 | 5998 | if ($c1 >= "\xc0" & $c1 <= "\xdf") { // looks like 2 bytes UTF8 |
| 5999 | 5999 | |
| 6000 | 6000 | if ($c2 >= "\x80" && $c2 <= "\xbf") { // yeah, almost sure it's UTF8 already |
| 6001 | - $buf .= $c1 . $c2; |
|
| 6001 | + $buf .= $c1.$c2; |
|
| 6002 | 6002 | $i++; |
| 6003 | 6003 | } else { // not valid UTF8 - convert it |
| 6004 | 6004 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
| 6005 | 6005 | $cc2 = ($c1 & "\x3f") | "\x80"; |
| 6006 | - $buf .= $cc1 . $cc2; |
|
| 6006 | + $buf .= $cc1.$cc2; |
|
| 6007 | 6007 | } |
| 6008 | 6008 | |
| 6009 | 6009 | } elseif ($c1 >= "\xe0" & $c1 <= "\xef") { // looks like 3 bytes UTF8 |
| 6010 | 6010 | |
| 6011 | 6011 | if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf") { // yeah, almost sure it's UTF8 already |
| 6012 | - $buf .= $c1 . $c2 . $c3; |
|
| 6012 | + $buf .= $c1.$c2.$c3; |
|
| 6013 | 6013 | $i += 2; |
| 6014 | 6014 | } else { // not valid UTF8 - convert it |
| 6015 | 6015 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
| 6016 | 6016 | $cc2 = ($c1 & "\x3f") | "\x80"; |
| 6017 | - $buf .= $cc1 . $cc2; |
|
| 6017 | + $buf .= $cc1.$cc2; |
|
| 6018 | 6018 | } |
| 6019 | 6019 | |
| 6020 | 6020 | } elseif ($c1 >= "\xf0" & $c1 <= "\xf7") { // looks like 4 bytes UTF8 |
| 6021 | 6021 | |
| 6022 | 6022 | if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf" && $c4 >= "\x80" && $c4 <= "\xbf") { // yeah, almost sure it's UTF8 already |
| 6023 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
| 6023 | + $buf .= $c1.$c2.$c3.$c4; |
|
| 6024 | 6024 | $i += 3; |
| 6025 | 6025 | } else { // not valid UTF8 - convert it |
| 6026 | 6026 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
| 6027 | 6027 | $cc2 = ($c1 & "\x3f") | "\x80"; |
| 6028 | - $buf .= $cc1 . $cc2; |
|
| 6028 | + $buf .= $cc1.$cc2; |
|
| 6029 | 6029 | } |
| 6030 | 6030 | |
| 6031 | 6031 | } else { // doesn't look like UTF8, but should be converted |
| 6032 | 6032 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
| 6033 | 6033 | $cc2 = (($c1 & "\x3f") | "\x80"); |
| 6034 | - $buf .= $cc1 . $cc2; |
|
| 6034 | + $buf .= $cc1.$cc2; |
|
| 6035 | 6035 | } |
| 6036 | 6036 | |
| 6037 | 6037 | } elseif (($c1 & "\xc0") === "\x80") { // needs conversion |
@@ -6042,7 +6042,7 @@ discard block |
||
| 6042 | 6042 | } else { |
| 6043 | 6043 | $cc1 = (chr($ordC1 / 64) | "\xc0"); |
| 6044 | 6044 | $cc2 = (($c1 & "\x3f") | "\x80"); |
| 6045 | - $buf .= $cc1 . $cc2; |
|
| 6045 | + $buf .= $cc1.$cc2; |
|
| 6046 | 6046 | } |
| 6047 | 6047 | |
| 6048 | 6048 | } else { // it doesn't need conversion |
@@ -6055,7 +6055,7 @@ discard block |
||
| 6055 | 6055 | // decode unicode escape sequences |
| 6056 | 6056 | $buf = preg_replace_callback( |
| 6057 | 6057 | '/\\\\u([0-9a-f]{4})/i', |
| 6058 | - function ($match) { |
|
| 6058 | + function($match) { |
|
| 6059 | 6059 | return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); |
| 6060 | 6060 | }, |
| 6061 | 6061 | $buf |
@@ -6064,7 +6064,7 @@ discard block |
||
| 6064 | 6064 | // decode UTF-8 codepoints |
| 6065 | 6065 | $buf = preg_replace_callback( |
| 6066 | 6066 | '/&#\d{2,4};/', |
| 6067 | - function ($match) { |
|
| 6067 | + function($match) { |
|
| 6068 | 6068 | return mb_convert_encoding($match[0], 'UTF-8', 'HTML-ENTITIES'); |
| 6069 | 6069 | }, |
| 6070 | 6070 | $buf |
@@ -6135,7 +6135,7 @@ discard block |
||
| 6135 | 6135 | */ |
| 6136 | 6136 | public static function ucfirst($str) |
| 6137 | 6137 | { |
| 6138 | - return self::strtoupper(self::substr($str, 0, 1)) . self::substr($str, 1); |
|
| 6138 | + return self::strtoupper(self::substr($str, 0, 1)).self::substr($str, 1); |
|
| 6139 | 6139 | } |
| 6140 | 6140 | |
| 6141 | 6141 | /** |
@@ -6582,7 +6582,7 @@ discard block |
||
| 6582 | 6582 | return ''; |
| 6583 | 6583 | } |
| 6584 | 6584 | |
| 6585 | - preg_match('/^\s*+(?:\S++\s*+){1,' . $words . '}/u', $str, $matches); |
|
| 6585 | + preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $str, $matches); |
|
| 6586 | 6586 | |
| 6587 | 6587 | if ( |
| 6588 | 6588 | !isset($matches[0]) |
@@ -6592,7 +6592,7 @@ discard block |
||
| 6592 | 6592 | return $str; |
| 6593 | 6593 | } |
| 6594 | 6594 | |
| 6595 | - return self::rtrim($matches[0]) . $strAddOn; |
|
| 6595 | + return self::rtrim($matches[0]).$strAddOn; |
|
| 6596 | 6596 | } |
| 6597 | 6597 | |
| 6598 | 6598 | /** |
@@ -6659,7 +6659,7 @@ discard block |
||
| 6659 | 6659 | $strReturn .= $break; |
| 6660 | 6660 | } |
| 6661 | 6661 | |
| 6662 | - return $strReturn . implode('', $chars); |
|
| 6662 | + return $strReturn.implode('', $chars); |
|
| 6663 | 6663 | } |
| 6664 | 6664 | |
| 6665 | 6665 | /** |