Completed
Push — master ( fb7a32...f6356b )
by Lars
37:43 queued 22:36
created
src/voku/helper/UTF8.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
   public static function add_bom_to_string($str)
840 840
   {
841 841
     if (self::string_has_bom($str) === false) {
842
-      $str = self::bom() . $str;
842
+      $str = self::bom().$str;
843 843
     }
844 844
 
845 845
     return $str;
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
 
939 939
     // use static cache, if there is no support for "IntlChar"
940 940
     static $cache = array();
941
-    $cacheKey = $code_point . $encoding;
941
+    $cacheKey = $code_point.$encoding;
942 942
     if (isset($cache[$cacheKey]) === true) {
943 943
       return $cache[$cacheKey];
944 944
     }
@@ -946,16 +946,16 @@  discard block
 block discarded – undo
946 946
     if (0x80 > $code_point %= 0x200000) {
947 947
       $str = chr($code_point);
948 948
     } elseif (0x800 > $code_point) {
949
-      $str = chr(0xC0 | $code_point >> 6) .
949
+      $str = chr(0xC0 | $code_point >> 6).
950 950
              chr(0x80 | $code_point & 0x3F);
951 951
     } elseif (0x10000 > $code_point) {
952
-      $str = chr(0xE0 | $code_point >> 12) .
953
-             chr(0x80 | $code_point >> 6 & 0x3F) .
952
+      $str = chr(0xE0 | $code_point >> 12).
953
+             chr(0x80 | $code_point >> 6 & 0x3F).
954 954
              chr(0x80 | $code_point & 0x3F);
955 955
     } else {
956
-      $str = chr(0xF0 | $code_point >> 18) .
957
-             chr(0x80 | $code_point >> 12 & 0x3F) .
958
-             chr(0x80 | $code_point >> 6 & 0x3F) .
956
+      $str = chr(0xF0 | $code_point >> 18).
957
+             chr(0x80 | $code_point >> 12 & 0x3F).
958
+             chr(0x80 | $code_point >> 6 & 0x3F).
959 959
              chr(0x80 | $code_point & 0x3F);
960 960
     }
961 961
 
@@ -1211,7 +1211,7 @@  discard block
 block discarded – undo
1211 1211
   public static function decimal_to_chr($code)
1212 1212
   {
1213 1213
     return \mb_convert_encoding(
1214
-        '&#x' . dechex($code) . ';',
1214
+        '&#x'.dechex($code).';',
1215 1215
         'UTF-8',
1216 1216
         'HTML-ENTITIES'
1217 1217
     );
@@ -1477,7 +1477,7 @@  discard block
 block discarded – undo
1477 1477
           ) {
1478 1478
             // Prevent leading combining chars
1479 1479
             // for NFC-safe concatenations.
1480
-            $var = $leading_combining . $var;
1480
+            $var = $leading_combining.$var;
1481 1481
           }
1482 1482
         }
1483 1483
         break;
@@ -1895,7 +1895,7 @@  discard block
 block discarded – undo
1895 1895
    */
1896 1896
   private static function getData($file)
1897 1897
   {
1898
-    $file = __DIR__ . '/data/' . $file . '.php';
1898
+    $file = __DIR__.'/data/'.$file.'.php';
1899 1899
     if (file_exists($file)) {
1900 1900
       /** @noinspection PhpIncludeInspection */
1901 1901
       return require $file;
@@ -1998,7 +1998,7 @@  discard block
 block discarded – undo
1998 1998
     return implode(
1999 1999
         '',
2000 2000
         array_map(
2001
-            function ($data) use ($keepAsciiChars, $encoding) {
2001
+            function($data) use ($keepAsciiChars, $encoding) {
2002 2002
               return UTF8::single_chr_html_encode($data, $keepAsciiChars, $encoding);
2003 2003
             },
2004 2004
             self::split($str)
@@ -2117,7 +2117,7 @@  discard block
 block discarded – undo
2117 2117
 
2118 2118
       $str = preg_replace_callback(
2119 2119
           "/&#\d{2,6};/",
2120
-          function ($matches) use ($encoding) {
2120
+          function($matches) use ($encoding) {
2121 2121
             $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES');
2122 2122
 
2123 2123
             if ($returnTmp !== '"' && $returnTmp !== "'") {
@@ -2426,9 +2426,9 @@  discard block
 block discarded – undo
2426 2426
     if (ctype_digit((string)$int)) {
2427 2427
       $hex = dechex((int)$int);
2428 2428
 
2429
-      $hex = (strlen($hex) < 4 ? substr('0000' . $hex, -4) : $hex);
2429
+      $hex = (strlen($hex) < 4 ? substr('0000'.$hex, -4) : $hex);
2430 2430
 
2431
-      return $pfix . $hex;
2431
+      return $pfix.$hex;
2432 2432
     }
2433 2433
 
2434 2434
     return '';
@@ -3114,7 +3114,7 @@  discard block
 block discarded – undo
3114 3114
    */
3115 3115
   public static function lcfirst($str)
3116 3116
   {
3117
-    return self::strtolower(self::substr($str, 0, 1)) . self::substr($str, 1);
3117
+    return self::strtolower(self::substr($str, 0, 1)).self::substr($str, 1);
3118 3118
   }
3119 3119
 
3120 3120
   /**
@@ -3138,7 +3138,7 @@  discard block
 block discarded – undo
3138 3138
       return preg_replace('/^[\pZ\pC]+/u', '', $str);
3139 3139
     }
3140 3140
 
3141
-    return preg_replace('/^' . self::rxClass($chars) . '+/u', '', $str);
3141
+    return preg_replace('/^'.self::rxClass($chars).'+/u', '', $str);
3142 3142
   }
3143 3143
 
3144 3144
   /**
@@ -3584,7 +3584,7 @@  discard block
 block discarded – undo
3584 3584
     if (is_array($what)) {
3585 3585
       /** @noinspection ForeachSourceInspection */
3586 3586
       foreach ($what as $item) {
3587
-        $str = preg_replace('/(' . preg_quote($item, '/') . ')+/', $item, $str);
3587
+        $str = preg_replace('/('.preg_quote($item, '/').')+/', $item, $str);
3588 3588
       }
3589 3589
     }
3590 3590
 
@@ -3669,7 +3669,7 @@  discard block
 block discarded – undo
3669 3669
       return preg_replace('/[\pZ\pC]+$/u', '', $str);
3670 3670
     }
3671 3671
 
3672
-    return preg_replace('/' . self::rxClass($chars) . '+$/u', '', $str);
3672
+    return preg_replace('/'.self::rxClass($chars).'+$/u', '', $str);
3673 3673
   }
3674 3674
 
3675 3675
   /**
@@ -3684,7 +3684,7 @@  discard block
 block discarded – undo
3684 3684
   {
3685 3685
     static $rxClassCache = array();
3686 3686
 
3687
-    $cacheKey = $s . $class;
3687
+    $cacheKey = $s.$class;
3688 3688
 
3689 3689
     if (isset($rxClassCache[$cacheKey])) {
3690 3690
       return $rxClassCache[$cacheKey];
@@ -3696,7 +3696,7 @@  discard block
 block discarded – undo
3696 3696
     /** @noinspection SuspiciousLoopInspection */
3697 3697
     foreach (self::str_split($s) as $s) {
3698 3698
       if ('-' === $s) {
3699
-        $class[0] = '-' . $class[0];
3699
+        $class[0] = '-'.$class[0];
3700 3700
       } elseif (!isset($s[2])) {
3701 3701
         $class[0] .= preg_quote($s, '/');
3702 3702
       } elseif (1 === self::strlen($s)) {
@@ -3707,13 +3707,13 @@  discard block
 block discarded – undo
3707 3707
     }
3708 3708
 
3709 3709
     if ($class[0]) {
3710
-      $class[0] = '[' . $class[0] . ']';
3710
+      $class[0] = '['.$class[0].']';
3711 3711
     }
3712 3712
 
3713 3713
     if (1 === count($class)) {
3714 3714
       $return = $class[0];
3715 3715
     } else {
3716
-      $return = '(?:' . implode('|', $class) . ')';
3716
+      $return = '(?:'.implode('|', $class).')';
3717 3717
     }
3718 3718
 
3719 3719
     $rxClassCache[$cacheKey] = $return;
@@ -3727,7 +3727,7 @@  discard block
 block discarded – undo
3727 3727
   public static function showSupport()
3728 3728
   {
3729 3729
     foreach (self::$support as $utf8Support) {
3730
-      echo $utf8Support . "\n<br>";
3730
+      echo $utf8Support."\n<br>";
3731 3731
     }
3732 3732
   }
3733 3733
 
@@ -3761,7 +3761,7 @@  discard block
 block discarded – undo
3761 3761
       $encoding = self::normalize_encoding($encoding);
3762 3762
     }
3763 3763
 
3764
-    return '&#' . self::ord($char, $encoding) . ';';
3764
+    return '&#'.self::ord($char, $encoding).';';
3765 3765
   }
3766 3766
 
3767 3767
   /**
@@ -3813,19 +3813,19 @@  discard block
 block discarded – undo
3813 3813
           $ret[] = $str[$i];
3814 3814
         } elseif ((($str[$i] & "\xE0") === "\xC0") && isset($str[$i + 1])) {
3815 3815
           if (($str[$i + 1] & "\xC0") === "\x80") {
3816
-            $ret[] = $str[$i] . $str[$i + 1];
3816
+            $ret[] = $str[$i].$str[$i + 1];
3817 3817
 
3818 3818
             $i++;
3819 3819
           }
3820 3820
         } elseif ((($str[$i] & "\xF0") === "\xE0") && isset($str[$i + 2])) {
3821 3821
           if ((($str[$i + 1] & "\xC0") === "\x80") && (($str[$i + 2] & "\xC0") === "\x80")) {
3822
-            $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2];
3822
+            $ret[] = $str[$i].$str[$i + 1].$str[$i + 2];
3823 3823
 
3824 3824
             $i += 2;
3825 3825
           }
3826 3826
         } elseif ((($str[$i] & "\xF8") === "\xF0") && isset($str[$i + 3])) {
3827 3827
           if ((($str[$i + 1] & "\xC0") === "\x80") && (($str[$i + 2] & "\xC0") === "\x80") && (($str[$i + 3] & "\xC0") === "\x80")) {
3828
-            $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3];
3828
+            $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3];
3829 3829
 
3830 3830
             $i += 3;
3831 3831
           }
@@ -3836,7 +3836,7 @@  discard block
 block discarded – undo
3836 3836
     if ($length > 1) {
3837 3837
       $ret = array_chunk($ret, $length);
3838 3838
 
3839
-      return array_map(function ($item) {
3839
+      return array_map(function($item) {
3840 3840
         return implode('', $item);
3841 3841
       }, $ret);
3842 3842
     }
@@ -4024,7 +4024,7 @@  discard block
 block discarded – undo
4024 4024
       if ('' === $s .= '') {
4025 4025
         $s = '/^(?<=.)$/';
4026 4026
       } else {
4027
-        $s = '/' . preg_quote($s, '/') . '/ui';
4027
+        $s = '/'.preg_quote($s, '/').'/ui';
4028 4028
       }
4029 4029
     }
4030 4030
 
@@ -4082,7 +4082,7 @@  discard block
 block discarded – undo
4082 4082
     }
4083 4083
 
4084 4084
     if (self::substr($str, $length - 1, 1) === ' ') {
4085
-      return self::substr($str, 0, $length - 1) . $strAddOn;
4085
+      return self::substr($str, 0, $length - 1).$strAddOn;
4086 4086
     }
4087 4087
 
4088 4088
     $str = self::substr($str, 0, $length);
@@ -4091,9 +4091,9 @@  discard block
 block discarded – undo
4091 4091
     $new_str = implode(' ', $array);
4092 4092
 
4093 4093
     if ($new_str === '') {
4094
-      $str = self::substr($str, 0, $length - 1) . $strAddOn;
4094
+      $str = self::substr($str, 0, $length - 1).$strAddOn;
4095 4095
     } else {
4096
-      $str = $new_str . $strAddOn;
4096
+      $str = $new_str.$strAddOn;
4097 4097
     }
4098 4098
 
4099 4099
     return $str;
@@ -4148,7 +4148,7 @@  discard block
 block discarded – undo
4148 4148
           $pre = '';
4149 4149
       }
4150 4150
 
4151
-      return $pre . $str . $post;
4151
+      return $pre.$str.$post;
4152 4152
     }
4153 4153
 
4154 4154
     return $str;
@@ -4278,7 +4278,7 @@  discard block
 block discarded – undo
4278 4278
     }
4279 4279
 
4280 4280
     /** @noinspection PhpInternalEntityUsedInspection */
4281
-    preg_match_all('/' . Grapheme::GRAPHEME_CLUSTER_RX . '/u', $str, $a);
4281
+    preg_match_all('/'.Grapheme::GRAPHEME_CLUSTER_RX.'/u', $str, $a);
4282 4282
     $a = $a[0];
4283 4283
 
4284 4284
     if ($len === 1) {
@@ -4453,7 +4453,7 @@  discard block
 block discarded – undo
4453 4453
   public static function strcmp($str1, $str2)
4454 4454
   {
4455 4455
     /** @noinspection PhpUndefinedClassInspection */
4456
-    return $str1 . '' === $str2 . '' ? 0 : strcmp(
4456
+    return $str1.'' === $str2.'' ? 0 : strcmp(
4457 4457
         \Normalizer::normalize($str1, \Normalizer::NFD),
4458 4458
         \Normalizer::normalize($str2, \Normalizer::NFD)
4459 4459
     );
@@ -4484,7 +4484,7 @@  discard block
 block discarded – undo
4484 4484
       return null;
4485 4485
     }
4486 4486
 
4487
-    if (preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $length)) {
4487
+    if (preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $length)) {
4488 4488
       /** @noinspection OffsetOperationsInspection */
4489 4489
       return self::strlen($length[1]);
4490 4490
     }
@@ -4685,7 +4685,7 @@  discard block
 block discarded – undo
4685 4685
       return \grapheme_stristr($haystack, $needle, $before_needle);
4686 4686
     }
4687 4687
 
4688
-    preg_match('/^(.*?)' . preg_quote($needle, '/') . '/usi', $haystack, $match);
4688
+    preg_match('/^(.*?)'.preg_quote($needle, '/').'/usi', $haystack, $match);
4689 4689
 
4690 4690
     if (!isset($match[1])) {
4691 4691
       return false;
@@ -4803,7 +4803,7 @@  discard block
 block discarded – undo
4803 4803
    */
4804 4804
   public static function strnatcmp($str1, $str2)
4805 4805
   {
4806
-    return $str1 . '' === $str2 . '' ? 0 : strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2));
4806
+    return $str1.'' === $str2.'' ? 0 : strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2));
4807 4807
   }
4808 4808
 
4809 4809
   /**
@@ -4864,7 +4864,7 @@  discard block
 block discarded – undo
4864 4864
       return false;
4865 4865
     }
4866 4866
 
4867
-    if (preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) {
4867
+    if (preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) {
4868 4868
       return substr($haystack, strpos($haystack, $m[0]));
4869 4869
     } else {
4870 4870
       return false;
@@ -4941,7 +4941,7 @@  discard block
 block discarded – undo
4941 4941
     }
4942 4942
 
4943 4943
     if (self::$support['intl'] === true) {
4944
-      $returnTmp =  \grapheme_strpos($haystack, $needle, $offset);
4944
+      $returnTmp = \grapheme_strpos($haystack, $needle, $offset);
4945 4945
       if ($returnTmp !== false) {
4946 4946
         return $returnTmp;
4947 4947
       }
@@ -5122,7 +5122,7 @@  discard block
 block discarded – undo
5122 5122
     }
5123 5123
 
5124 5124
     if (self::$support['intl'] === true) {
5125
-      $returnTmp =  \grapheme_strripos($haystack, $needle, $offset);
5125
+      $returnTmp = \grapheme_strripos($haystack, $needle, $offset);
5126 5126
       if ($returnTmp !== false) {
5127 5127
         return $returnTmp;
5128 5128
       }
@@ -5246,7 +5246,7 @@  discard block
 block discarded – undo
5246 5246
       return 0;
5247 5247
     }
5248 5248
 
5249
-    return preg_match('/^' . self::rxClass($mask) . '+/u', $str, $str) ? self::strlen($str[0]) : 0;
5249
+    return preg_match('/^'.self::rxClass($mask).'+/u', $str, $str) ? self::strlen($str[0]) : 0;
5250 5250
   }
5251 5251
 
5252 5252
   /**
@@ -5299,7 +5299,7 @@  discard block
 block discarded – undo
5299 5299
       return \grapheme_strstr($haystack, $needle, $before_needle);
5300 5300
     }
5301 5301
 
5302
-    preg_match('/^(.*?)' . preg_quote($needle, '/') . '/us', $haystack, $match);
5302
+    preg_match('/^(.*?)'.preg_quote($needle, '/').'/us', $haystack, $match);
5303 5303
 
5304 5304
     if (!isset($match[1])) {
5305 5305
       return false;
@@ -5668,7 +5668,7 @@  discard block
 block discarded – undo
5668 5668
       return \mb_substr_count($haystack, $needle, $encoding);
5669 5669
     }
5670 5670
 
5671
-    preg_match_all('/' . preg_quote($needle, '/') . '/us', $haystack, $matches, PREG_SET_ORDER);
5671
+    preg_match_all('/'.preg_quote($needle, '/').'/us', $haystack, $matches, PREG_SET_ORDER);
5672 5672
     return count($matches);
5673 5673
   }
5674 5674
 
@@ -5889,7 +5889,7 @@  discard block
 block discarded – undo
5889 5889
 
5890 5890
     $strSwappedCase = preg_replace_callback(
5891 5891
         '/[\S]/u',
5892
-        function ($match) use ($encoding) {
5892
+        function($match) use ($encoding) {
5893 5893
           $marchToUpper = UTF8::strtoupper($match[0], $encoding);
5894 5894
 
5895 5895
           if ($match[0] === $marchToUpper) {
@@ -6071,7 +6071,7 @@  discard block
 block discarded – undo
6071 6071
 
6072 6072
       $bank = $ord >> 8;
6073 6073
       if (!array_key_exists($bank, (array)$UTF8_TO_ASCII)) {
6074
-        $bankfile = __DIR__ . '/data/' . sprintf('x%02x', $bank) . '.php';
6074
+        $bankfile = __DIR__.'/data/'.sprintf('x%02x', $bank).'.php';
6075 6075
         if (file_exists($bankfile)) {
6076 6076
           /** @noinspection PhpIncludeInspection */
6077 6077
           require $bankfile;
@@ -6192,40 +6192,40 @@  discard block
 block discarded – undo
6192 6192
         if ($c1 >= "\xc0" & $c1 <= "\xdf") { // looks like 2 bytes UTF8
6193 6193
 
6194 6194
           if ($c2 >= "\x80" && $c2 <= "\xbf") { // yeah, almost sure it's UTF8 already
6195
-            $buf .= $c1 . $c2;
6195
+            $buf .= $c1.$c2;
6196 6196
             $i++;
6197 6197
           } else { // not valid UTF8 - convert it
6198 6198
             $cc1 = (chr(ord($c1) / 64) | "\xc0");
6199 6199
             $cc2 = ($c1 & "\x3f") | "\x80";
6200
-            $buf .= $cc1 . $cc2;
6200
+            $buf .= $cc1.$cc2;
6201 6201
           }
6202 6202
 
6203 6203
         } elseif ($c1 >= "\xe0" & $c1 <= "\xef") { // looks like 3 bytes UTF8
6204 6204
 
6205 6205
           if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf") { // yeah, almost sure it's UTF8 already
6206
-            $buf .= $c1 . $c2 . $c3;
6206
+            $buf .= $c1.$c2.$c3;
6207 6207
             $i += 2;
6208 6208
           } else { // not valid UTF8 - convert it
6209 6209
             $cc1 = (chr(ord($c1) / 64) | "\xc0");
6210 6210
             $cc2 = ($c1 & "\x3f") | "\x80";
6211
-            $buf .= $cc1 . $cc2;
6211
+            $buf .= $cc1.$cc2;
6212 6212
           }
6213 6213
 
6214 6214
         } elseif ($c1 >= "\xf0" & $c1 <= "\xf7") { // looks like 4 bytes UTF8
6215 6215
 
6216 6216
           if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf" && $c4 >= "\x80" && $c4 <= "\xbf") { // yeah, almost sure it's UTF8 already
6217
-            $buf .= $c1 . $c2 . $c3 . $c4;
6217
+            $buf .= $c1.$c2.$c3.$c4;
6218 6218
             $i += 3;
6219 6219
           } else { // not valid UTF8 - convert it
6220 6220
             $cc1 = (chr(ord($c1) / 64) | "\xc0");
6221 6221
             $cc2 = ($c1 & "\x3f") | "\x80";
6222
-            $buf .= $cc1 . $cc2;
6222
+            $buf .= $cc1.$cc2;
6223 6223
           }
6224 6224
 
6225 6225
         } else { // doesn't look like UTF8, but should be converted
6226 6226
           $cc1 = (chr(ord($c1) / 64) | "\xc0");
6227 6227
           $cc2 = (($c1 & "\x3f") | "\x80");
6228
-          $buf .= $cc1 . $cc2;
6228
+          $buf .= $cc1.$cc2;
6229 6229
         }
6230 6230
 
6231 6231
       } elseif (($c1 & "\xc0") === "\x80") { // needs conversion
@@ -6236,7 +6236,7 @@  discard block
 block discarded – undo
6236 6236
         } else {
6237 6237
           $cc1 = (chr($ordC1 / 64) | "\xc0");
6238 6238
           $cc2 = (($c1 & "\x3f") | "\x80");
6239
-          $buf .= $cc1 . $cc2;
6239
+          $buf .= $cc1.$cc2;
6240 6240
         }
6241 6241
 
6242 6242
       } else { // it doesn't need conversion
@@ -6247,7 +6247,7 @@  discard block
 block discarded – undo
6247 6247
     // decode unicode escape sequences
6248 6248
     $buf = preg_replace_callback(
6249 6249
         '/\\\\u([0-9a-f]{4})/i',
6250
-        function ($match) {
6250
+        function($match) {
6251 6251
           return \mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
6252 6252
         },
6253 6253
         $buf
@@ -6256,7 +6256,7 @@  discard block
 block discarded – undo
6256 6256
     // decode UTF-8 codepoints
6257 6257
     $buf = preg_replace_callback(
6258 6258
         '/&#\d{2,6};/',
6259
-        function ($match) {
6259
+        function($match) {
6260 6260
           return \mb_convert_encoding($match[0], 'UTF-8', 'HTML-ENTITIES');
6261 6261
         },
6262 6262
         $buf
@@ -6305,7 +6305,7 @@  discard block
 block discarded – undo
6305 6305
    */
6306 6306
   public static function ucfirst($str, $encoding = 'UTF-8', $cleanUtf8 = false)
6307 6307
   {
6308
-    return self::strtoupper(self::substr($str, 0, 1, $encoding, $cleanUtf8), $encoding, $cleanUtf8) . self::substr($str, 1, null, $encoding, $cleanUtf8);
6308
+    return self::strtoupper(self::substr($str, 0, 1, $encoding, $cleanUtf8), $encoding, $cleanUtf8).self::substr($str, 1, null, $encoding, $cleanUtf8);
6309 6309
   }
6310 6310
 
6311 6311
   /**
@@ -6834,7 +6834,7 @@  discard block
 block discarded – undo
6834 6834
       return '';
6835 6835
     }
6836 6836
 
6837
-    preg_match('/^\s*+(?:\S++\s*+){1,' . $words . '}/u', $str, $matches);
6837
+    preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $str, $matches);
6838 6838
 
6839 6839
     if (
6840 6840
         !isset($matches[0])
@@ -6844,7 +6844,7 @@  discard block
 block discarded – undo
6844 6844
       return $str;
6845 6845
     }
6846 6846
 
6847
-    return self::rtrim($matches[0]) . $strAddOn;
6847
+    return self::rtrim($matches[0]).$strAddOn;
6848 6848
   }
6849 6849
 
6850 6850
   /**
@@ -6912,7 +6912,7 @@  discard block
 block discarded – undo
6912 6912
       $strReturn .= $break;
6913 6913
     }
6914 6914
 
6915
-    return $strReturn . implode('', $chars);
6915
+    return $strReturn.implode('', $chars);
6916 6916
   }
6917 6917
 
6918 6918
   /**
Please login to merge, or discard this patch.