Completed
Push — master ( 098737...568744 )
by Lars
02:48
created
src/voku/helper/UTF8.php 1 patch
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
   public static function add_bom_to_string($str)
851 851
   {
852 852
     if (self::string_has_bom($str) === false) {
853
-      $str = self::bom() . $str;
853
+      $str = self::bom().$str;
854 854
     }
855 855
 
856 856
     return $str;
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
 
969 969
     // use static cache, only if there is no support for "\IntlChar"
970 970
     static $CHAR_CACHE = array();
971
-    $cacheKey = $code_point . $encoding;
971
+    $cacheKey = $code_point.$encoding;
972 972
     if (isset($CHAR_CACHE[$cacheKey]) === true) {
973 973
       return $CHAR_CACHE[$cacheKey];
974 974
     }
@@ -976,16 +976,16 @@  discard block
 block discarded – undo
976 976
     if (0x80 > $code_point %= 0x200000) {
977 977
       $str = self::chr_and_parse_int($code_point);
978 978
     } elseif (0x800 > $code_point) {
979
-      $str = self::chr_and_parse_int(0xC0 | $code_point >> 6) .
979
+      $str = self::chr_and_parse_int(0xC0 | $code_point >> 6).
980 980
              self::chr_and_parse_int(0x80 | $code_point & 0x3F);
981 981
     } elseif (0x10000 > $code_point) {
982
-      $str = self::chr_and_parse_int(0xE0 | $code_point >> 12) .
983
-             self::chr_and_parse_int(0x80 | $code_point >> 6 & 0x3F) .
982
+      $str = self::chr_and_parse_int(0xE0 | $code_point >> 12).
983
+             self::chr_and_parse_int(0x80 | $code_point >> 6 & 0x3F).
984 984
              self::chr_and_parse_int(0x80 | $code_point & 0x3F);
985 985
     } else {
986
-      $str = self::chr_and_parse_int(0xF0 | $code_point >> 18) .
987
-             self::chr_and_parse_int(0x80 | $code_point >> 12 & 0x3F) .
988
-             self::chr_and_parse_int(0x80 | $code_point >> 6 & 0x3F) .
986
+      $str = self::chr_and_parse_int(0xF0 | $code_point >> 18).
987
+             self::chr_and_parse_int(0x80 | $code_point >> 12 & 0x3F).
988
+             self::chr_and_parse_int(0x80 | $code_point >> 6 & 0x3F).
989 989
              self::chr_and_parse_int(0x80 | $code_point & 0x3F);
990 990
     }
991 991
 
@@ -1045,7 +1045,7 @@  discard block
 block discarded – undo
1045 1045
     }
1046 1046
 
1047 1047
     return array_map(
1048
-        function ($data) {
1048
+        function($data) {
1049 1049
           return UTF8::strlen($data, '8BIT');
1050 1050
         },
1051 1051
         self::split($str)
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
       $flags = ENT_QUOTES;
1288 1288
     }
1289 1289
 
1290
-    return self::html_entity_decode('&#' . $int . ';', $flags);
1290
+    return self::html_entity_decode('&#'.$int.';', $flags);
1291 1291
   }
1292 1292
 
1293 1293
   /**
@@ -1364,7 +1364,7 @@  discard block
 block discarded – undo
1364 1364
           &&
1365 1365
           self::$SUPPORT['mbstring'] === false
1366 1366
       ) {
1367
-        trigger_error('UTF8::encode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
1367
+        trigger_error('UTF8::encode() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
1368 1368
       }
1369 1369
 
1370 1370
       $strEncoded = \mb_convert_encoding(
@@ -1573,7 +1573,7 @@  discard block
 block discarded – undo
1573 1573
           ) {
1574 1574
             // Prevent leading combining chars
1575 1575
             // for NFC-safe concatenations.
1576
-            $var = $leading_combining . $var;
1576
+            $var = $leading_combining.$var;
1577 1577
           }
1578 1578
         }
1579 1579
 
@@ -1996,7 +1996,7 @@  discard block
 block discarded – undo
1996 1996
    */
1997 1997
   private static function getData($file)
1998 1998
   {
1999
-    $file = __DIR__ . '/data/' . $file . '.php';
1999
+    $file = __DIR__.'/data/'.$file.'.php';
2000 2000
     if (file_exists($file)) {
2001 2001
       /** @noinspection PhpIncludeInspection */
2002 2002
       return require $file;
@@ -2141,7 +2141,7 @@  discard block
 block discarded – undo
2141 2141
     return implode(
2142 2142
         '',
2143 2143
         array_map(
2144
-            function ($data) use ($keepAsciiChars, $encoding) {
2144
+            function($data) use ($keepAsciiChars, $encoding) {
2145 2145
               return UTF8::single_chr_html_encode($data, $keepAsciiChars, $encoding);
2146 2146
             },
2147 2147
             self::split($str)
@@ -2260,7 +2260,7 @@  discard block
 block discarded – undo
2260 2260
 
2261 2261
       $str = preg_replace_callback(
2262 2262
           "/&#\d{2,6};/",
2263
-          function ($matches) use ($encoding) {
2263
+          function($matches) use ($encoding) {
2264 2264
             $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES');
2265 2265
 
2266 2266
             if ($returnTmp !== '"' && $returnTmp !== "'") {
@@ -2584,9 +2584,9 @@  discard block
 block discarded – undo
2584 2584
     if ((int)$int === $int) {
2585 2585
       $hex = dechex($int);
2586 2586
 
2587
-      $hex = (strlen($hex) < 4 ? substr('0000' . $hex, -4) : $hex);
2587
+      $hex = (strlen($hex) < 4 ? substr('0000'.$hex, -4) : $hex);
2588 2588
 
2589
-      return $pfix . $hex;
2589
+      return $pfix.$hex;
2590 2590
     }
2591 2591
 
2592 2592
     return '';
@@ -3314,7 +3314,7 @@  discard block
 block discarded – undo
3314 3314
    */
3315 3315
   public static function lcfirst($str)
3316 3316
   {
3317
-    return self::strtolower(self::substr($str, 0, 1)) . self::substr($str, 1);
3317
+    return self::strtolower(self::substr($str, 0, 1)).self::substr($str, 1);
3318 3318
   }
3319 3319
 
3320 3320
   /**
@@ -3338,7 +3338,7 @@  discard block
 block discarded – undo
3338 3338
       return preg_replace('/^[\pZ\pC]+/u', '', $str);
3339 3339
     }
3340 3340
 
3341
-    return preg_replace('/^' . self::rxClass($chars) . '+/u', '', $str);
3341
+    return preg_replace('/^'.self::rxClass($chars).'+/u', '', $str);
3342 3342
   }
3343 3343
 
3344 3344
   /**
@@ -3874,7 +3874,7 @@  discard block
 block discarded – undo
3874 3874
     if (is_array($what) === true) {
3875 3875
       /** @noinspection ForeachSourceInspection */
3876 3876
       foreach ($what as $item) {
3877
-        $str = preg_replace('/(' . preg_quote($item, '/') . ')+/', $item, $str);
3877
+        $str = preg_replace('/('.preg_quote($item, '/').')+/', $item, $str);
3878 3878
       }
3879 3879
     }
3880 3880
 
@@ -3987,7 +3987,7 @@  discard block
 block discarded – undo
3987 3987
       return preg_replace('/[\pZ\pC]+$/u', '', $str);
3988 3988
     }
3989 3989
 
3990
-    return preg_replace('/' . self::rxClass($chars) . '+$/u', '', $str);
3990
+    return preg_replace('/'.self::rxClass($chars).'+$/u', '', $str);
3991 3991
   }
3992 3992
 
3993 3993
   /**
@@ -4002,7 +4002,7 @@  discard block
 block discarded – undo
4002 4002
   {
4003 4003
     static $RX_CLASSS_CACHE = array();
4004 4004
 
4005
-    $cacheKey = $s . $class;
4005
+    $cacheKey = $s.$class;
4006 4006
 
4007 4007
     if (isset($RX_CLASSS_CACHE[$cacheKey])) {
4008 4008
       return $RX_CLASSS_CACHE[$cacheKey];
@@ -4014,7 +4014,7 @@  discard block
 block discarded – undo
4014 4014
     /** @noinspection SuspiciousLoopInspection */
4015 4015
     foreach (self::str_split($s) as $s) {
4016 4016
       if ('-' === $s) {
4017
-        $class[0] = '-' . $class[0];
4017
+        $class[0] = '-'.$class[0];
4018 4018
       } elseif (!isset($s[2])) {
4019 4019
         $class[0] .= preg_quote($s, '/');
4020 4020
       } elseif (1 === self::strlen($s)) {
@@ -4025,13 +4025,13 @@  discard block
 block discarded – undo
4025 4025
     }
4026 4026
 
4027 4027
     if ($class[0]) {
4028
-      $class[0] = '[' . $class[0] . ']';
4028
+      $class[0] = '['.$class[0].']';
4029 4029
     }
4030 4030
 
4031 4031
     if (1 === count($class)) {
4032 4032
       $return = $class[0];
4033 4033
     } else {
4034
-      $return = '(?:' . implode('|', $class) . ')';
4034
+      $return = '(?:'.implode('|', $class).')';
4035 4035
     }
4036 4036
 
4037 4037
     $RX_CLASSS_CACHE[$cacheKey] = $return;
@@ -4049,7 +4049,7 @@  discard block
 block discarded – undo
4049 4049
     }
4050 4050
 
4051 4051
     foreach (self::$SUPPORT as $utf8Support) {
4052
-      echo $utf8Support . "\n<br>";
4052
+      echo $utf8Support."\n<br>";
4053 4053
     }
4054 4054
   }
4055 4055
 
@@ -4083,7 +4083,7 @@  discard block
 block discarded – undo
4083 4083
       $encoding = self::normalize_encoding($encoding, 'UTF-8');
4084 4084
     }
4085 4085
 
4086
-    return '&#' . self::ord($char, $encoding) . ';';
4086
+    return '&#'.self::ord($char, $encoding).';';
4087 4087
   }
4088 4088
 
4089 4089
   /**
@@ -4150,7 +4150,7 @@  discard block
 block discarded – undo
4150 4150
         ) {
4151 4151
 
4152 4152
           if (($str[$i + 1] & "\xC0") === "\x80") {
4153
-            $ret[] = $str[$i] . $str[$i + 1];
4153
+            $ret[] = $str[$i].$str[$i + 1];
4154 4154
 
4155 4155
             $i++;
4156 4156
           }
@@ -4166,7 +4166,7 @@  discard block
 block discarded – undo
4166 4166
               &&
4167 4167
               ($str[$i + 2] & "\xC0") === "\x80"
4168 4168
           ) {
4169
-            $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2];
4169
+            $ret[] = $str[$i].$str[$i + 1].$str[$i + 2];
4170 4170
 
4171 4171
             $i += 2;
4172 4172
           }
@@ -4184,7 +4184,7 @@  discard block
 block discarded – undo
4184 4184
               &&
4185 4185
               ($str[$i + 3] & "\xC0") === "\x80"
4186 4186
           ) {
4187
-            $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3];
4187
+            $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3];
4188 4188
 
4189 4189
             $i += 3;
4190 4190
           }
@@ -4197,7 +4197,7 @@  discard block
 block discarded – undo
4197 4197
       $ret = array_chunk($ret, $length);
4198 4198
 
4199 4199
       return array_map(
4200
-          function ($item) {
4200
+          function($item) {
4201 4201
             return implode('', $item);
4202 4202
           }, $ret
4203 4203
       );
@@ -4304,7 +4304,7 @@  discard block
 block discarded – undo
4304 4304
     foreach (self::$ICONV_ENCODING as $encodingTmp) {
4305 4305
       # INFO: //IGNORE and //TRANSLIT still throw notice
4306 4306
       /** @noinspection PhpUsageOfSilenceOperatorInspection */
4307
-      if (md5(@\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str)) === $md5) {
4307
+      if (md5(@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str)) === $md5) {
4308 4308
         return $encodingTmp;
4309 4309
       }
4310 4310
     }
@@ -4394,7 +4394,7 @@  discard block
 block discarded – undo
4394 4394
       if ('' === $s .= '') {
4395 4395
         $s = '/^(?<=.)$/';
4396 4396
       } else {
4397
-        $s = '/' . preg_quote($s, '/') . '/ui';
4397
+        $s = '/'.preg_quote($s, '/').'/ui';
4398 4398
       }
4399 4399
     }
4400 4400
 
@@ -4452,7 +4452,7 @@  discard block
 block discarded – undo
4452 4452
     }
4453 4453
 
4454 4454
     if (self::substr($str, $length - 1, 1) === ' ') {
4455
-      return self::substr($str, 0, $length - 1) . $strAddOn;
4455
+      return self::substr($str, 0, $length - 1).$strAddOn;
4456 4456
     }
4457 4457
 
4458 4458
     $str = self::substr($str, 0, $length);
@@ -4461,9 +4461,9 @@  discard block
 block discarded – undo
4461 4461
     $new_str = implode(' ', $array);
4462 4462
 
4463 4463
     if ($new_str === '') {
4464
-      $str = self::substr($str, 0, $length - 1) . $strAddOn;
4464
+      $str = self::substr($str, 0, $length - 1).$strAddOn;
4465 4465
     } else {
4466
-      $str = $new_str . $strAddOn;
4466
+      $str = $new_str.$strAddOn;
4467 4467
     }
4468 4468
 
4469 4469
     return $str;
@@ -4518,7 +4518,7 @@  discard block
 block discarded – undo
4518 4518
           $pre = '';
4519 4519
       }
4520 4520
 
4521
-      return $pre . $str . $post;
4521
+      return $pre.$str.$post;
4522 4522
     }
4523 4523
 
4524 4524
     return $str;
@@ -4668,7 +4668,7 @@  discard block
 block discarded – undo
4668 4668
     }
4669 4669
 
4670 4670
     /** @noinspection PhpInternalEntityUsedInspection */
4671
-    preg_match_all('/' . Grapheme::GRAPHEME_CLUSTER_RX . '/u', $str, $a);
4671
+    preg_match_all('/'.Grapheme::GRAPHEME_CLUSTER_RX.'/u', $str, $a);
4672 4672
     $a = $a[0];
4673 4673
 
4674 4674
     if ($len === 1) {
@@ -4863,7 +4863,7 @@  discard block
 block discarded – undo
4863 4863
   public static function strcmp($str1, $str2)
4864 4864
   {
4865 4865
     /** @noinspection PhpUndefinedClassInspection */
4866
-    return $str1 . '' === $str2 . '' ? 0 : strcmp(
4866
+    return $str1.'' === $str2.'' ? 0 : strcmp(
4867 4867
         \Normalizer::normalize($str1, \Normalizer::NFD),
4868 4868
         \Normalizer::normalize($str2, \Normalizer::NFD)
4869 4869
     );
@@ -4894,7 +4894,7 @@  discard block
 block discarded – undo
4894 4894
       return null;
4895 4895
     }
4896 4896
 
4897
-    if (preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $length)) {
4897
+    if (preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $length)) {
4898 4898
       /** @noinspection OffsetOperationsInspection */
4899 4899
       return self::strlen($length[1]);
4900 4900
     }
@@ -5109,7 +5109,7 @@  discard block
 block discarded – undo
5109 5109
         &&
5110 5110
         self::$SUPPORT['mbstring'] === false
5111 5111
     ) {
5112
-      trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5112
+      trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
5113 5113
     }
5114 5114
 
5115 5115
     if (self::$SUPPORT['mbstring'] === true) {
@@ -5126,7 +5126,7 @@  discard block
 block discarded – undo
5126 5126
       return \grapheme_stristr($haystack, $needle, $before_needle);
5127 5127
     }
5128 5128
 
5129
-    preg_match('/^(.*?)' . preg_quote($needle, '/') . '/usi', $haystack, $match);
5129
+    preg_match('/^(.*?)'.preg_quote($needle, '/').'/usi', $haystack, $match);
5130 5130
 
5131 5131
     if (!isset($match[1])) {
5132 5132
       return false;
@@ -5200,7 +5200,7 @@  discard block
 block discarded – undo
5200 5200
         &&
5201 5201
         self::$SUPPORT['iconv'] === false
5202 5202
     ) {
5203
-      trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5203
+      trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
5204 5204
     }
5205 5205
 
5206 5206
     if (
@@ -5275,7 +5275,7 @@  discard block
 block discarded – undo
5275 5275
    */
5276 5276
   public static function strnatcmp($str1, $str2)
5277 5277
   {
5278
-    return $str1 . '' === $str2 . '' ? 0 : strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2));
5278
+    return $str1.'' === $str2.'' ? 0 : strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2));
5279 5279
   }
5280 5280
 
5281 5281
   /**
@@ -5336,7 +5336,7 @@  discard block
 block discarded – undo
5336 5336
       return false;
5337 5337
     }
5338 5338
 
5339
-    if (preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) {
5339
+    if (preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) {
5340 5340
       return substr($haystack, strpos($haystack, $m[0]));
5341 5341
     }
5342 5342
 
@@ -5413,7 +5413,7 @@  discard block
 block discarded – undo
5413 5413
         &&
5414 5414
         self::$SUPPORT['mbstring'] === false
5415 5415
     ) {
5416
-      trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5416
+      trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
5417 5417
     }
5418 5418
 
5419 5419
     if (
@@ -5632,7 +5632,7 @@  discard block
 block discarded – undo
5632 5632
         &&
5633 5633
         self::$SUPPORT['mbstring'] === false
5634 5634
     ) {
5635
-      trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5635
+      trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
5636 5636
     }
5637 5637
 
5638 5638
     if (self::$SUPPORT['mbstring'] === true) {
@@ -5715,7 +5715,7 @@  discard block
 block discarded – undo
5715 5715
         &&
5716 5716
         self::$SUPPORT['mbstring'] === false
5717 5717
     ) {
5718
-      trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5718
+      trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
5719 5719
     }
5720 5720
 
5721 5721
     if (self::$SUPPORT['mbstring'] === true) {
@@ -5775,7 +5775,7 @@  discard block
 block discarded – undo
5775 5775
       return 0;
5776 5776
     }
5777 5777
 
5778
-    return preg_match('/^' . self::rxClass($mask) . '+/u', $str, $str) ? self::strlen($str[0]) : 0;
5778
+    return preg_match('/^'.self::rxClass($mask).'+/u', $str, $str) ? self::strlen($str[0]) : 0;
5779 5779
   }
5780 5780
 
5781 5781
   /**
@@ -5821,7 +5821,7 @@  discard block
 block discarded – undo
5821 5821
         &&
5822 5822
         self::$SUPPORT['mbstring'] === false
5823 5823
     ) {
5824
-      trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5824
+      trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
5825 5825
     }
5826 5826
 
5827 5827
     if (self::$SUPPORT['mbstring'] === true) {
@@ -5838,7 +5838,7 @@  discard block
 block discarded – undo
5838 5838
       return \grapheme_strstr($haystack, $needle, $before_needle);
5839 5839
     }
5840 5840
 
5841
-    preg_match('/^(.*?)' . preg_quote($needle, '/') . '/us', $haystack, $match);
5841
+    preg_match('/^(.*?)'.preg_quote($needle, '/').'/us', $haystack, $match);
5842 5842
 
5843 5843
     if (!isset($match[1])) {
5844 5844
       return false;
@@ -5945,7 +5945,7 @@  discard block
 block discarded – undo
5945 5945
           Bootup::is_php('5.4') === true
5946 5946
       ) {
5947 5947
 
5948
-        $langCode = $lang . '-Lower';
5948
+        $langCode = $lang.'-Lower';
5949 5949
         if (!in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) {
5950 5950
            $langCode = 'Any-Lower';
5951 5951
         }
@@ -5953,7 +5953,7 @@  discard block
 block discarded – undo
5953 5953
         return transliterator_transliterate($langCode, $str);
5954 5954
       }
5955 5955
 
5956
-      trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: ' . $lang, E_USER_WARNING);
5956
+      trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: '.$lang, E_USER_WARNING);
5957 5957
     }
5958 5958
 
5959 5959
     return \mb_strtolower($str, $encoding);
@@ -6013,7 +6013,7 @@  discard block
 block discarded – undo
6013 6013
           Bootup::is_php('5.4') === true
6014 6014
       ) {
6015 6015
 
6016
-        $langCode = $lang . '-Upper';
6016
+        $langCode = $lang.'-Upper';
6017 6017
         if (!in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) {
6018 6018
           $langCode = 'Any-Upper';
6019 6019
         }
@@ -6021,7 +6021,7 @@  discard block
 block discarded – undo
6021 6021
         return transliterator_transliterate($langCode, $str);
6022 6022
       }
6023 6023
 
6024
-      trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: ' . $lang, E_USER_WARNING);
6024
+      trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: '.$lang, E_USER_WARNING);
6025 6025
     }
6026 6026
 
6027 6027
     return \mb_strtoupper($str, $encoding);
@@ -6156,7 +6156,7 @@  discard block
 block discarded – undo
6156 6156
         &&
6157 6157
         self::$SUPPORT['mbstring'] === false
6158 6158
     ) {
6159
-      trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6159
+      trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
6160 6160
     }
6161 6161
 
6162 6162
     if (self::$SUPPORT['mbstring'] === true) {
@@ -6275,14 +6275,14 @@  discard block
 block discarded – undo
6275 6275
         &&
6276 6276
         self::$SUPPORT['mbstring'] === false
6277 6277
     ) {
6278
-      trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6278
+      trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
6279 6279
     }
6280 6280
 
6281 6281
     if (self::$SUPPORT['mbstring'] === true) {
6282 6282
       return \mb_substr_count($haystack, $needle, $encoding);
6283 6283
     }
6284 6284
 
6285
-    preg_match_all('/' . preg_quote($needle, '/') . '/us', $haystack, $matches, PREG_SET_ORDER);
6285
+    preg_match_all('/'.preg_quote($needle, '/').'/us', $haystack, $matches, PREG_SET_ORDER);
6286 6286
 
6287 6287
     return count($matches);
6288 6288
   }
@@ -6528,7 +6528,7 @@  discard block
 block discarded – undo
6528 6528
 
6529 6529
     $strSwappedCase = preg_replace_callback(
6530 6530
         '/[\S]/u',
6531
-        function ($match) use ($encoding) {
6531
+        function($match) use ($encoding) {
6532 6532
           $marchToUpper = UTF8::strtoupper($match[0], $encoding);
6533 6533
 
6534 6534
           if ($match[0] === $marchToUpper) {
@@ -6867,13 +6867,13 @@  discard block
 block discarded – undo
6867 6867
           $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1];
6868 6868
 
6869 6869
           if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already
6870
-            $buf .= $c1 . $c2;
6870
+            $buf .= $c1.$c2;
6871 6871
             $i++;
6872 6872
           } else { // not valid UTF8 - convert it
6873 6873
             $cc1tmp = ord($c1) / 64;
6874 6874
             $cc1 = self::chr_and_parse_int($cc1tmp) | "\xC0";
6875 6875
             $cc2 = ($c1 & "\x3F") | "\x80";
6876
-            $buf .= $cc1 . $cc2;
6876
+            $buf .= $cc1.$cc2;
6877 6877
           }
6878 6878
 
6879 6879
         } elseif ($c1 >= "\xE0" && $c1 <= "\xEF") { // looks like 3 bytes UTF8
@@ -6882,13 +6882,13 @@  discard block
 block discarded – undo
6882 6882
           $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2];
6883 6883
 
6884 6884
           if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already
6885
-            $buf .= $c1 . $c2 . $c3;
6885
+            $buf .= $c1.$c2.$c3;
6886 6886
             $i += 2;
6887 6887
           } else { // not valid UTF8 - convert it
6888 6888
             $cc1tmp = ord($c1) / 64;
6889 6889
             $cc1 = self::chr_and_parse_int($cc1tmp) | "\xC0";
6890 6890
             $cc2 = ($c1 & "\x3F") | "\x80";
6891
-            $buf .= $cc1 . $cc2;
6891
+            $buf .= $cc1.$cc2;
6892 6892
           }
6893 6893
 
6894 6894
         } elseif ($c1 >= "\xF0" && $c1 <= "\xF7") { // looks like 4 bytes UTF8
@@ -6898,20 +6898,20 @@  discard block
 block discarded – undo
6898 6898
           $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3];
6899 6899
 
6900 6900
           if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already
6901
-            $buf .= $c1 . $c2 . $c3 . $c4;
6901
+            $buf .= $c1.$c2.$c3.$c4;
6902 6902
             $i += 3;
6903 6903
           } else { // not valid UTF8 - convert it
6904 6904
             $cc1tmp = ord($c1) / 64;
6905 6905
             $cc1 = self::chr_and_parse_int($cc1tmp) | "\xC0";
6906 6906
             $cc2 = ($c1 & "\x3F") | "\x80";
6907
-            $buf .= $cc1 . $cc2;
6907
+            $buf .= $cc1.$cc2;
6908 6908
           }
6909 6909
 
6910 6910
         } else { // doesn't look like UTF8, but should be converted
6911 6911
           $cc1tmp = ord($c1) / 64;
6912 6912
           $cc1 = self::chr_and_parse_int($cc1tmp) | "\xC0";
6913 6913
           $cc2 = ($c1 & "\x3F") | "\x80";
6914
-          $buf .= $cc1 . $cc2;
6914
+          $buf .= $cc1.$cc2;
6915 6915
         }
6916 6916
 
6917 6917
       } elseif (($c1 & "\xC0") === "\x80") { // needs conversion
@@ -6922,7 +6922,7 @@  discard block
 block discarded – undo
6922 6922
         } else {
6923 6923
           $cc1 = self::chr_and_parse_int($ordC1 / 64) | "\xC0";
6924 6924
           $cc2 = ($c1 & "\x3F") | "\x80";
6925
-          $buf .= $cc1 . $cc2;
6925
+          $buf .= $cc1.$cc2;
6926 6926
         }
6927 6927
 
6928 6928
       } else { // it doesn't need conversion
@@ -6933,7 +6933,7 @@  discard block
 block discarded – undo
6933 6933
     // decode unicode escape sequences
6934 6934
     $buf = preg_replace_callback(
6935 6935
         '/\\\\u([0-9a-f]{4})/i',
6936
-        function ($match) {
6936
+        function($match) {
6937 6937
           return \mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
6938 6938
         },
6939 6939
         $buf
@@ -6987,7 +6987,7 @@  discard block
 block discarded – undo
6987 6987
    */
6988 6988
   public static function ucfirst($str, $encoding = 'UTF-8', $cleanUtf8 = false)
6989 6989
   {
6990
-    return self::strtoupper(self::substr($str, 0, 1, $encoding, $cleanUtf8), $encoding, $cleanUtf8) . self::substr($str, 1, null, $encoding, $cleanUtf8);
6990
+    return self::strtoupper(self::substr($str, 0, 1, $encoding, $cleanUtf8), $encoding, $cleanUtf8).self::substr($str, 1, null, $encoding, $cleanUtf8);
6991 6991
   }
6992 6992
 
6993 6993
   /**
@@ -7494,7 +7494,7 @@  discard block
 block discarded – undo
7494 7494
       return '';
7495 7495
     }
7496 7496
 
7497
-    preg_match('/^\s*+(?:\S++\s*+){1,' . $words . '}/u', $str, $matches);
7497
+    preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $str, $matches);
7498 7498
 
7499 7499
     if (
7500 7500
         !isset($matches[0])
@@ -7504,7 +7504,7 @@  discard block
 block discarded – undo
7504 7504
       return $str;
7505 7505
     }
7506 7506
 
7507
-    return self::rtrim($matches[0]) . $strAddOn;
7507
+    return self::rtrim($matches[0]).$strAddOn;
7508 7508
   }
7509 7509
 
7510 7510
   /**
@@ -7572,7 +7572,7 @@  discard block
 block discarded – undo
7572 7572
       $strReturn .= $break;
7573 7573
     }
7574 7574
 
7575
-    return $strReturn . implode('', $chars);
7575
+    return $strReturn.implode('', $chars);
7576 7576
   }
7577 7577
 
7578 7578
   /**
Please login to merge, or discard this patch.