Passed
Push — master ( 8d747a...27fda7 )
by Lars
02:43
created
src/voku/helper/UTF8.php 1 patch
Spacing   +119 added lines, -121 removed lines patch added patch discarded remove patch
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
   public static function add_bom_to_string(string $str): string
244 244
   {
245 245
     if (self::string_has_bom($str) === false) {
246
-      $str = self::bom() . $str;
246
+      $str = self::bom().$str;
247 247
     }
248 248
 
249 249
     return $str;
@@ -501,10 +501,10 @@  discard block
 block discarded – undo
501 501
         &&
502 502
         self::$SUPPORT['mbstring'] === false
503 503
     ) {
504
-      \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
504
+      \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
505 505
     }
506 506
 
507
-    $cacheKey = $code_point . $encoding;
507
+    $cacheKey = $code_point.$encoding;
508 508
     if (isset($CHAR_CACHE[$cacheKey]) === true) {
509 509
       return $CHAR_CACHE[$cacheKey];
510 510
     }
@@ -542,16 +542,16 @@  discard block
 block discarded – undo
542 542
     if ($code_point <= 0x7F) {
543 543
       $chr = self::$CHR[$code_point];
544 544
     } elseif ($code_point <= 0x7FF) {
545
-      $chr = self::$CHR[($code_point >> 6) + 0xC0] .
545
+      $chr = self::$CHR[($code_point >> 6) + 0xC0].
546 546
              self::$CHR[($code_point & 0x3F) + 0x80];
547 547
     } elseif ($code_point <= 0xFFFF) {
548
-      $chr = self::$CHR[($code_point >> 12) + 0xE0] .
549
-             self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] .
548
+      $chr = self::$CHR[($code_point >> 12) + 0xE0].
549
+             self::$CHR[(($code_point >> 6) & 0x3F) + 0x80].
550 550
              self::$CHR[($code_point & 0x3F) + 0x80];
551 551
     } else {
552
-      $chr = self::$CHR[($code_point >> 18) + 0xF0] .
553
-             self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] .
554
-             self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] .
552
+      $chr = self::$CHR[($code_point >> 18) + 0xF0].
553
+             self::$CHR[(($code_point >> 12) & 0x3F) + 0x80].
554
+             self::$CHR[(($code_point >> 6) & 0x3F) + 0x80].
555 555
              self::$CHR[($code_point & 0x3F) + 0x80];
556 556
     }
557 557
 
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 
600 600
     if (self::$SUPPORT['mbstring_func_overload'] === true) {
601 601
       return \array_map(
602
-          function ($data) {
602
+          function($data) {
603 603
             return UTF8::strlen($data, 'CP850'); // 8-BIT
604 604
           },
605 605
           $strSplit
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
    */
904 904
   public static function decimal_to_chr($int): string
905 905
   {
906
-    return self::html_entity_decode('&#' . $int . ';', ENT_QUOTES | ENT_HTML5);
906
+    return self::html_entity_decode('&#'.$int.';', ENT_QUOTES | ENT_HTML5);
907 907
   }
908 908
 
909 909
   /**
@@ -983,7 +983,7 @@  discard block
 block discarded – undo
983 983
           &&
984 984
           self::$SUPPORT['mbstring'] === false
985 985
       ) {
986
-        \trigger_error('UTF8::encode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
986
+        \trigger_error('UTF8::encode() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
987 987
       }
988 988
 
989 989
       $strEncoded = \mb_convert_encoding(
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
         return \rtrim(
1043 1043
                    self::substr($str, 0, $pos, $encoding),
1044 1044
                    $trimChars
1045
-               ) . $replacerForSkippedText;
1045
+               ).$replacerForSkippedText;
1046 1046
       }
1047 1047
 
1048 1048
       return $str;
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
                  ) - $pos_start;
1087 1087
 
1088 1088
       if (!$pos_end || $pos_end <= 0) {
1089
-        $extract = $replacerForSkippedText . \ltrim(
1089
+        $extract = $replacerForSkippedText.\ltrim(
1090 1090
                 self::substr(
1091 1091
                     $str,
1092 1092
                     $pos_start,
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
                 $trimChars
1097 1097
             );
1098 1098
       } else {
1099
-        $extract = $replacerForSkippedText . \trim(
1099
+        $extract = $replacerForSkippedText.\trim(
1100 1100
                 self::substr(
1101 1101
                     $str,
1102 1102
                     $pos_start,
@@ -1104,7 +1104,7 @@  discard block
 block discarded – undo
1104 1104
                     $encoding
1105 1105
                 ),
1106 1106
                 $trimChars
1107
-            ) . $replacerForSkippedText;
1107
+            ).$replacerForSkippedText;
1108 1108
       }
1109 1109
 
1110 1110
     } else {
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
         $extract = \rtrim(
1126 1126
                        self::substr($str, 0, $pos_end, $encoding),
1127 1127
                        $trimChars
1128
-                   ) . $replacerForSkippedText;
1128
+                   ).$replacerForSkippedText;
1129 1129
       } else {
1130 1130
         $extract = $str;
1131 1131
       }
@@ -1292,7 +1292,7 @@  discard block
 block discarded – undo
1292 1292
           ) {
1293 1293
             // Prevent leading combining chars
1294 1294
             // for NFC-safe concatenations.
1295
-            $var = $leading_combining . $var;
1295
+            $var = $leading_combining.$var;
1296 1296
           }
1297 1297
         }
1298 1298
 
@@ -1743,7 +1743,7 @@  discard block
 block discarded – undo
1743 1743
    */
1744 1744
   private static function getData(string $file)
1745 1745
   {
1746
-    $file = __DIR__ . '/data/' . $file . '.php';
1746
+    $file = __DIR__.'/data/'.$file.'.php';
1747 1747
     if (\file_exists($file)) {
1748 1748
       /** @noinspection PhpIncludeInspection */
1749 1749
       return require $file;
@@ -1820,16 +1820,16 @@  discard block
 block discarded – undo
1820 1820
    */
1821 1821
   public static function get_unique_string($entropyExtra = '', bool $md5 = true): string
1822 1822
   {
1823
-    $uniqueHelper = \mt_rand() .
1824
-                    \session_id() .
1825
-                    ($_SERVER['REMOTE_ADDR'] ?? '') .
1826
-                    ($_SERVER['SERVER_ADDR'] ?? '') .
1823
+    $uniqueHelper = \mt_rand().
1824
+                    \session_id().
1825
+                    ($_SERVER['REMOTE_ADDR'] ?? '').
1826
+                    ($_SERVER['SERVER_ADDR'] ?? '').
1827 1827
                     $entropyExtra;
1828 1828
 
1829 1829
     $uniqueString = \uniqid($uniqueHelper, true);
1830 1830
 
1831 1831
     if ($md5) {
1832
-      $uniqueString = \md5($uniqueString . $uniqueHelper);
1832
+      $uniqueString = \md5($uniqueString.$uniqueHelper);
1833 1833
     }
1834 1834
 
1835 1835
     return $uniqueString;
@@ -1964,7 +1964,7 @@  discard block
 block discarded – undo
1964 1964
     return \implode(
1965 1965
         '',
1966 1966
         \array_map(
1967
-            function ($data) use ($keepAsciiChars, $encoding) {
1967
+            function($data) use ($keepAsciiChars, $encoding) {
1968 1968
               return UTF8::single_chr_html_encode($data, $keepAsciiChars, $encoding);
1969 1969
             },
1970 1970
             self::split($str)
@@ -2080,7 +2080,7 @@  discard block
 block discarded – undo
2080 2080
         &&
2081 2081
         self::$SUPPORT['mbstring'] === false
2082 2082
     ) {
2083
-      \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
2083
+      \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
2084 2084
     }
2085 2085
 
2086 2086
     do {
@@ -2088,7 +2088,7 @@  discard block
 block discarded – undo
2088 2088
 
2089 2089
       $str = (string)\preg_replace_callback(
2090 2090
           "/&#\d{2,6};/",
2091
-          function ($matches) use ($encoding) {
2091
+          function($matches) use ($encoding) {
2092 2092
             $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES');
2093 2093
 
2094 2094
             if ($returnTmp !== '"' && $returnTmp !== "'") {
@@ -2427,9 +2427,9 @@  discard block
 block discarded – undo
2427 2427
   {
2428 2428
     $hex = \dechex($int);
2429 2429
 
2430
-    $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex);
2430
+    $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex);
2431 2431
 
2432
-    return $pfix . $hex;
2432
+    return $pfix.$hex;
2433 2433
   }
2434 2434
 
2435 2435
   /**
@@ -3322,7 +3322,7 @@  discard block
 block discarded – undo
3322 3322
         $cleanUtf8
3323 3323
     );
3324 3324
 
3325
-    return $strPartOne . $strPartTwo;
3325
+    return $strPartOne.$strPartTwo;
3326 3326
   }
3327 3327
 
3328 3328
   /**
@@ -3754,7 +3754,7 @@  discard block
 block discarded – undo
3754 3754
       }
3755 3755
     }
3756 3756
 
3757
-    $cacheKey = $chr_orig . $encoding;
3757
+    $cacheKey = $chr_orig.$encoding;
3758 3758
     if (isset($CHAR_CACHE[$cacheKey]) === true) {
3759 3759
       return $CHAR_CACHE[$cacheKey];
3760 3760
     }
@@ -3991,7 +3991,7 @@  discard block
 block discarded – undo
3991 3991
     }
3992 3992
 
3993 3993
     $str = (string)\preg_replace(
3994
-        $delimiter . $pattern . $delimiter . 'u' . $options,
3994
+        $delimiter.$pattern.$delimiter.'u'.$options,
3995 3995
         $replacement,
3996 3996
         $str
3997 3997
     );
@@ -4058,7 +4058,7 @@  discard block
 block discarded – undo
4058 4058
     if (\is_array($what) === true) {
4059 4059
       /** @noinspection ForeachSourceInspection */
4060 4060
       foreach ($what as $item) {
4061
-        $str = (string)\preg_replace('/(' . \preg_quote($item, '/') . ')+/', $item, $str);
4061
+        $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/', $item, $str);
4062 4062
       }
4063 4063
     }
4064 4064
 
@@ -4299,7 +4299,7 @@  discard block
 block discarded – undo
4299 4299
   {
4300 4300
     static $RX_CLASSS_CACHE = [];
4301 4301
 
4302
-    $cacheKey = $s . $class;
4302
+    $cacheKey = $s.$class;
4303 4303
 
4304 4304
     if (isset($RX_CLASSS_CACHE[$cacheKey])) {
4305 4305
       return $RX_CLASSS_CACHE[$cacheKey];
@@ -4311,7 +4311,7 @@  discard block
 block discarded – undo
4311 4311
     /** @noinspection SuspiciousLoopInspection */
4312 4312
     foreach (self::str_split($s) as $s) {
4313 4313
       if ('-' === $s) {
4314
-        $class[0] = '-' . $class[0];
4314
+        $class[0] = '-'.$class[0];
4315 4315
       } elseif (!isset($s[2])) {
4316 4316
         $class[0] .= \preg_quote($s, '/');
4317 4317
       } elseif (1 === self::strlen($s)) {
@@ -4322,13 +4322,13 @@  discard block
 block discarded – undo
4322 4322
     }
4323 4323
 
4324 4324
     if ($class[0]) {
4325
-      $class[0] = '[' . $class[0] . ']';
4325
+      $class[0] = '['.$class[0].']';
4326 4326
     }
4327 4327
 
4328 4328
     if (1 === \count($class)) {
4329 4329
       $return = $class[0];
4330 4330
     } else {
4331
-      $return = '(?:' . \implode('|', $class) . ')';
4331
+      $return = '(?:'.\implode('|', $class).')';
4332 4332
     }
4333 4333
 
4334 4334
     $RX_CLASSS_CACHE[$cacheKey] = $return;
@@ -4347,7 +4347,7 @@  discard block
 block discarded – undo
4347 4347
 
4348 4348
     echo '<pre>';
4349 4349
     foreach (self::$SUPPORT as $key => $value) {
4350
-      echo $key . ' - ' . \print_r($value, true) . "\n<br>";
4350
+      echo $key.' - '.\print_r($value, true)."\n<br>";
4351 4351
     }
4352 4352
     echo '</pre>';
4353 4353
   }
@@ -4379,7 +4379,7 @@  discard block
 block discarded – undo
4379 4379
       $encoding = self::normalize_encoding($encoding, 'UTF-8');
4380 4380
     }
4381 4381
 
4382
-    return '&#' . self::ord($char, $encoding) . ';';
4382
+    return '&#'.self::ord($char, $encoding).';';
4383 4383
   }
4384 4384
 
4385 4385
   /**
@@ -4451,7 +4451,7 @@  discard block
 block discarded – undo
4451 4451
         ) {
4452 4452
 
4453 4453
           if (($str[$i + 1] & "\xC0") === "\x80") {
4454
-            $ret[] = $str[$i] . $str[$i + 1];
4454
+            $ret[] = $str[$i].$str[$i + 1];
4455 4455
 
4456 4456
             $i++;
4457 4457
           }
@@ -4467,7 +4467,7 @@  discard block
 block discarded – undo
4467 4467
               &&
4468 4468
               ($str[$i + 2] & "\xC0") === "\x80"
4469 4469
           ) {
4470
-            $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2];
4470
+            $ret[] = $str[$i].$str[$i + 1].$str[$i + 2];
4471 4471
 
4472 4472
             $i += 2;
4473 4473
           }
@@ -4485,7 +4485,7 @@  discard block
 block discarded – undo
4485 4485
               &&
4486 4486
               ($str[$i + 3] & "\xC0") === "\x80"
4487 4487
           ) {
4488
-            $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3];
4488
+            $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3];
4489 4489
 
4490 4490
             $i += 3;
4491 4491
           }
@@ -4498,7 +4498,7 @@  discard block
 block discarded – undo
4498 4498
       $ret = \array_chunk($ret, $length);
4499 4499
 
4500 4500
       return \array_map(
4501
-          function ($item) {
4501
+          function($item) {
4502 4502
             return \implode('', $item);
4503 4503
           }, $ret
4504 4504
       );
@@ -4528,7 +4528,7 @@  discard block
 block discarded – undo
4528 4528
 
4529 4529
     $str = (string)\preg_replace_callback(
4530 4530
         '/[-_\s]+(.)?/u',
4531
-        function ($match) use ($encoding) {
4531
+        function($match) use ($encoding) {
4532 4532
           if (isset($match[1])) {
4533 4533
             return UTF8::strtoupper($match[1], $encoding);
4534 4534
           }
@@ -4540,7 +4540,7 @@  discard block
 block discarded – undo
4540 4540
 
4541 4541
     $str = (string)\preg_replace_callback(
4542 4542
         '/[\d]+(.)?/u',
4543
-        function ($match) use ($encoding) {
4543
+        function($match) use ($encoding) {
4544 4544
           return UTF8::strtoupper($match[0], $encoding);
4545 4545
         },
4546 4546
         $str
@@ -4880,7 +4880,7 @@  discard block
 block discarded – undo
4880 4880
     foreach (self::$ENCODINGS as $encodingTmp) {
4881 4881
       # INFO: //IGNORE and //TRANSLIT still throw notice
4882 4882
       /** @noinspection PhpUsageOfSilenceOperatorInspection */
4883
-      if (\md5(@\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str)) === $md5) {
4883
+      if (\md5(@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str)) === $md5) {
4884 4884
         return $encodingTmp;
4885 4885
       }
4886 4886
     }
@@ -4942,7 +4942,7 @@  discard block
 block discarded – undo
4942 4942
   public static function str_ensure_left(string $str, string $substring): string
4943 4943
   {
4944 4944
     if (!self::str_starts_with($str, $substring)) {
4945
-      $str = $substring . $str;
4945
+      $str = $substring.$str;
4946 4946
     }
4947 4947
 
4948 4948
     return $str;
@@ -5147,7 +5147,7 @@  discard block
 block discarded – undo
5147 5147
     $start = self::substr($str, 0, $index, $encoding);
5148 5148
     $end = self::substr($str, $index, $len, $encoding);
5149 5149
 
5150
-    return $start . $substring . $end;
5150
+    return $start.$substring.$end;
5151 5151
   }
5152 5152
 
5153 5153
   /**
@@ -5184,7 +5184,7 @@  discard block
 block discarded – undo
5184 5184
       if ('' === $s .= '') {
5185 5185
         $s = '/^(?<=.)$/';
5186 5186
       } else {
5187
-        $s = '/' . \preg_quote($s, '/') . '/ui';
5187
+        $s = '/'.\preg_quote($s, '/').'/ui';
5188 5188
       }
5189 5189
     }
5190 5190
 
@@ -5476,7 +5476,7 @@  discard block
 block discarded – undo
5476 5476
       return $str;
5477 5477
     }
5478 5478
 
5479
-    return self::substr($str, 0, $length - self::strlen($strAddOn), $encoding) . $strAddOn;
5479
+    return self::substr($str, 0, $length - self::strlen($strAddOn), $encoding).$strAddOn;
5480 5480
   }
5481 5481
 
5482 5482
   /**
@@ -5504,7 +5504,7 @@  discard block
 block discarded – undo
5504 5504
     }
5505 5505
 
5506 5506
     if (self::substr($str, $length - 1, 1, $encoding) === ' ') {
5507
-      return self::substr($str, 0, $length - 1, $encoding) . $strAddOn;
5507
+      return self::substr($str, 0, $length - 1, $encoding).$strAddOn;
5508 5508
     }
5509 5509
 
5510 5510
     $str = (string)self::substr($str, 0, $length, $encoding);
@@ -5513,9 +5513,9 @@  discard block
 block discarded – undo
5513 5513
     $new_str = \implode(' ', $array);
5514 5514
 
5515 5515
     if ($new_str === '') {
5516
-      $str = self::substr($str, 0, $length - 1, $encoding) . $strAddOn;
5516
+      $str = self::substr($str, 0, $length - 1, $encoding).$strAddOn;
5517 5517
     } else {
5518
-      $str = $new_str . $strAddOn;
5518
+      $str = $new_str.$strAddOn;
5519 5519
     }
5520 5520
 
5521 5521
     return $str;
@@ -5621,7 +5621,7 @@  discard block
 block discarded – undo
5621 5621
       $char = self::substr($str, -$i, 1, $encoding);
5622 5622
 
5623 5623
       if ($char == self::substr($otherStr, -$i, 1, $encoding)) {
5624
-        $longestCommonSuffix = $char . $longestCommonSuffix;
5624
+        $longestCommonSuffix = $char.$longestCommonSuffix;
5625 5625
       } else {
5626 5626
         break;
5627 5627
       }
@@ -5640,7 +5640,7 @@  discard block
 block discarded – undo
5640 5640
    */
5641 5641
   public static function str_matches_pattern(string $str, string $pattern): bool
5642 5642
   {
5643
-    if (\preg_match('/' . $pattern . '/u', $str)) {
5643
+    if (\preg_match('/'.$pattern.'/u', $str)) {
5644 5644
       return true;
5645 5645
     }
5646 5646
 
@@ -5730,7 +5730,7 @@  discard block
 block discarded – undo
5730 5730
         $pad_type = STR_PAD_BOTH;
5731 5731
       } else {
5732 5732
         throw new \InvalidArgumentException(
5733
-            'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'"
5733
+            'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'"
5734 5734
         );
5735 5735
       }
5736 5736
     }
@@ -5767,7 +5767,7 @@  discard block
 block discarded – undo
5767 5767
           $pre = '';
5768 5768
       }
5769 5769
 
5770
-      return $pre . $str . $post;
5770
+      return $pre.$str.$post;
5771 5771
     }
5772 5772
 
5773 5773
     return $str;
@@ -5895,7 +5895,7 @@  discard block
 block discarded – undo
5895 5895
   {
5896 5896
     return self::regex_replace(
5897 5897
         $str,
5898
-        '^' . \preg_quote($search, '/'),
5898
+        '^'.\preg_quote($search, '/'),
5899 5899
         self::str_replace('\\', '\\\\', $replacement)
5900 5900
     );
5901 5901
   }
@@ -5913,7 +5913,7 @@  discard block
 block discarded – undo
5913 5913
   {
5914 5914
     return self::regex_replace(
5915 5915
         $str,
5916
-        \preg_quote($search, '/') . '$',
5916
+        \preg_quote($search, '/').'$',
5917 5917
         self::str_replace('\\', '\\\\', $replacement)
5918 5918
     );
5919 5919
   }
@@ -6024,24 +6024,24 @@  discard block
 block discarded – undo
6024 6024
 
6025 6025
     $str = (string)\preg_replace_callback(
6026 6026
         '/([\d|A-Z])/u',
6027
-        function ($matches) use ($encoding) {
6027
+        function($matches) use ($encoding) {
6028 6028
           $match = $matches[1];
6029 6029
           $matchInt = (int)$match;
6030 6030
 
6031 6031
           if ((string)$matchInt == $match) {
6032
-            return '_' . $match . '_';
6032
+            return '_'.$match.'_';
6033 6033
           }
6034 6034
 
6035
-          return '_' . UTF8::strtolower($match, $encoding);
6035
+          return '_'.UTF8::strtolower($match, $encoding);
6036 6036
         },
6037 6037
         $str
6038 6038
     );
6039 6039
 
6040 6040
     $str = (string)\preg_replace(
6041 6041
         [
6042
-            '/\s+/',        // convert spaces to "_"
6043
-            '/^\s+|\s+$/',  // trim leading & trailing spaces
6044
-            '/_+/',         // remove double "_"
6042
+            '/\s+/', // convert spaces to "_"
6043
+            '/^\s+|\s+$/', // trim leading & trailing spaces
6044
+            '/_+/', // remove double "_"
6045 6045
         ],
6046 6046
         [
6047 6047
             '_',
@@ -6110,7 +6110,7 @@  discard block
 block discarded – undo
6110 6110
     }
6111 6111
 
6112 6112
     /** @noinspection NotOptimalRegularExpressionsInspection */
6113
-    \preg_match_all('/' . self::GRAPHEME_CLUSTER_RX . '/u', $str, $a);
6113
+    \preg_match_all('/'.self::GRAPHEME_CLUSTER_RX.'/u', $str, $a);
6114 6114
     $a = $a[0];
6115 6115
 
6116 6116
     if ($len === 1) {
@@ -6163,7 +6163,7 @@  discard block
 block discarded – undo
6163 6163
       $limit = -1;
6164 6164
     }
6165 6165
 
6166
-    $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit);
6166
+    $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit);
6167 6167
 
6168 6168
     if ($limit > 0 && \count($array) === $limit) {
6169 6169
       \array_pop($array);
@@ -6441,7 +6441,7 @@  discard block
 block discarded – undo
6441 6441
 
6442 6442
     $str = (string)\preg_replace_callback(
6443 6443
         '/([\S]+)/u',
6444
-        function ($match) use ($encoding, $ignore) {
6444
+        function($match) use ($encoding, $ignore) {
6445 6445
           if ($ignore && \in_array($match[0], $ignore, true)) {
6446 6446
             return $match[0];
6447 6447
           }
@@ -6510,16 +6510,16 @@  discard block
 block discarded – undo
6510 6510
     $str = (string)\preg_replace_callback(
6511 6511
         '~\b (_*) (?:                                                              # 1. Leading underscore and
6512 6512
                         ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ |              # 2. file path or 
6513
-                          [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) #    URL, domain, or email
6513
+                          [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) #    URL, domain, or email
6514 6514
                         |
6515
-                        ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' )            # 3. or small word (case-insensitive)
6515
+                        ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' )            # 3. or small word (case-insensitive)
6516 6516
                         |
6517
-                        ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' )     # 4. or word w/o internal caps
6517
+                        ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' )     # 4. or word w/o internal caps
6518 6518
                         |
6519
-                        ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' )     # 5. or some other word
6519
+                        ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' )     # 5. or some other word
6520 6520
                       ) (_*) \b                                                           # 6. With trailing underscore
6521 6521
                     ~ux',
6522
-        function ($matches) use ($encoding) {
6522
+        function($matches) use ($encoding) {
6523 6523
           // Preserve leading underscore
6524 6524
           $str = $matches[1];
6525 6525
           if ($matches[2]) {
@@ -6548,21 +6548,21 @@  discard block
 block discarded – undo
6548 6548
         '~(  \A [[:punct:]]*                # start of title...
6549 6549
                       |  [:.;?!][ ]+               # or of subsentence...
6550 6550
                       |  [ ][\'"“‘(\[][ ]* )       # or of inserted subphrase...
6551
-                      ( ' . $smallWordsRx . ' ) \b # ...followed by small word
6551
+                      ( ' . $smallWordsRx.' ) \b # ...followed by small word
6552 6552
                      ~uxi',
6553
-        function ($matches) use ($encoding) {
6554
-          return $matches[1] . static::str_upper_first($matches[2], $encoding);
6553
+        function($matches) use ($encoding) {
6554
+          return $matches[1].static::str_upper_first($matches[2], $encoding);
6555 6555
         },
6556 6556
         $str
6557 6557
     );
6558 6558
 
6559 6559
     // ...and end of title
6560 6560
     $str = (string)\preg_replace_callback(
6561
-        '~\b ( ' . $smallWordsRx . ' ) # small word...
6561
+        '~\b ( '.$smallWordsRx.' ) # small word...
6562 6562
                       (?= [[:punct:]]* \Z     # ...at the end of the title...
6563 6563
                       |   [\'"’”)\]] [ ] )    # ...or of an inserted subphrase?
6564 6564
                      ~uxi',
6565
-        function ($matches) use ($encoding) {
6565
+        function($matches) use ($encoding) {
6566 6566
           return static::str_upper_first($matches[1], $encoding);
6567 6567
         },
6568 6568
         $str
@@ -6573,10 +6573,10 @@  discard block
 block discarded – undo
6573 6573
     $str = (string)\preg_replace_callback(
6574 6574
         '~\b
6575 6575
                         (?<! -)                   # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight)
6576
-                        ( ' . $smallWordsRx . ' )
6576
+                        ( ' . $smallWordsRx.' )
6577 6577
                         (?= -[[:alpha:]]+)        # lookahead for "-someword"
6578 6578
                        ~uxi',
6579
-        function ($matches) use ($encoding) {
6579
+        function($matches) use ($encoding) {
6580 6580
           return static::str_upper_first($matches[1], $encoding);
6581 6581
         },
6582 6582
         $str
@@ -6587,11 +6587,11 @@  discard block
 block discarded – undo
6587 6587
         '~\b
6588 6588
                       (?<!…)                    # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in)
6589 6589
                       ( [[:alpha:]]+- )         # $1 = first word and hyphen, should already be properly capped
6590
-                      ( ' . $smallWordsRx . ' ) # ...followed by small word
6590
+                      ( ' . $smallWordsRx.' ) # ...followed by small word
6591 6591
                       (?!	- )                   # Negative lookahead for another -
6592 6592
                      ~uxi',
6593
-        function ($matches) use ($encoding) {
6594
-          return $matches[1] . static::str_upper_first($matches[2], $encoding);
6593
+        function($matches) use ($encoding) {
6594
+          return $matches[1].static::str_upper_first($matches[2], $encoding);
6595 6595
         },
6596 6596
         $str
6597 6597
     );
@@ -6737,7 +6737,7 @@  discard block
 block discarded – undo
6737 6737
 
6738 6738
     $truncated = self::substr($str, 0, $length, $encoding);
6739 6739
 
6740
-    return $truncated . $substring;
6740
+    return $truncated.$substring;
6741 6741
   }
6742 6742
 
6743 6743
   /**
@@ -6776,7 +6776,7 @@  discard block
 block discarded – undo
6776 6776
       }
6777 6777
     }
6778 6778
 
6779
-    $str = $truncated . $substring;
6779
+    $str = $truncated.$substring;
6780 6780
 
6781 6781
     return $str;
6782 6782
   }
@@ -6923,7 +6923,7 @@  discard block
 block discarded – undo
6923 6923
   public static function strcmp(string $str1, string $str2): int
6924 6924
   {
6925 6925
     /** @noinspection PhpUndefinedClassInspection */
6926
-    return $str1 . '' === $str2 . '' ? 0 : \strcmp(
6926
+    return $str1.'' === $str2.'' ? 0 : \strcmp(
6927 6927
         \Normalizer::normalize($str1, \Normalizer::NFD),
6928 6928
         \Normalizer::normalize($str2, \Normalizer::NFD)
6929 6929
     );
@@ -6957,7 +6957,7 @@  discard block
 block discarded – undo
6957 6957
       return null;
6958 6958
     }
6959 6959
 
6960
-    if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $length)) {
6960
+    if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $length)) {
6961 6961
       return self::strlen($length[1]);
6962 6962
     }
6963 6963
 
@@ -7167,7 +7167,7 @@  discard block
 block discarded – undo
7167 7167
         &&
7168 7168
         self::$SUPPORT['mbstring'] === false
7169 7169
     ) {
7170
-      \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
7170
+      \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
7171 7171
     }
7172 7172
 
7173 7173
     if (self::$SUPPORT['mbstring'] === true) {
@@ -7186,7 +7186,7 @@  discard block
 block discarded – undo
7186 7186
       return \stristr($haystack, $needle, $before_needle);
7187 7187
     }
7188 7188
 
7189
-    \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match);
7189
+    \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match);
7190 7190
 
7191 7191
     if (!isset($match[1])) {
7192 7192
       return false;
@@ -7252,7 +7252,7 @@  discard block
 block discarded – undo
7252 7252
         &&
7253 7253
         self::$SUPPORT['iconv'] === false
7254 7254
     ) {
7255
-      \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
7255
+      \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
7256 7256
     }
7257 7257
 
7258 7258
     if (
@@ -7356,7 +7356,7 @@  discard block
 block discarded – undo
7356 7356
    */
7357 7357
   public static function strnatcmp(string $str1, string $str2): int
7358 7358
   {
7359
-    return $str1 . '' === $str2 . '' ? 0 : \strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2));
7359
+    return $str1.'' === $str2.'' ? 0 : \strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2));
7360 7360
   }
7361 7361
 
7362 7362
   /**
@@ -7414,7 +7414,7 @@  discard block
 block discarded – undo
7414 7414
       return false;
7415 7415
     }
7416 7416
 
7417
-    if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) {
7417
+    if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) {
7418 7418
       return \substr($haystack, \strpos($haystack, $m[0]));
7419 7419
     }
7420 7420
 
@@ -7478,7 +7478,7 @@  discard block
 block discarded – undo
7478 7478
         &&
7479 7479
         self::$SUPPORT['mbstring'] === false
7480 7480
     ) {
7481
-      \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
7481
+      \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
7482 7482
     }
7483 7483
 
7484 7484
     if (
@@ -7699,7 +7699,7 @@  discard block
 block discarded – undo
7699 7699
         &&
7700 7700
         self::$SUPPORT['mbstring'] === false
7701 7701
     ) {
7702
-      \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
7702
+      \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
7703 7703
     }
7704 7704
 
7705 7705
     if (self::$SUPPORT['mbstring'] === true) {
@@ -7766,7 +7766,7 @@  discard block
 block discarded – undo
7766 7766
         &&
7767 7767
         self::$SUPPORT['mbstring'] === false
7768 7768
     ) {
7769
-      \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
7769
+      \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
7770 7770
     }
7771 7771
 
7772 7772
     if (self::$SUPPORT['mbstring'] === true) {
@@ -7831,7 +7831,7 @@  discard block
 block discarded – undo
7831 7831
       return 0;
7832 7832
     }
7833 7833
 
7834
-    return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $str) ? self::strlen($str[0]) : 0;
7834
+    return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $str) ? self::strlen($str[0]) : 0;
7835 7835
   }
7836 7836
 
7837 7837
   /**
@@ -7874,7 +7874,7 @@  discard block
 block discarded – undo
7874 7874
         &&
7875 7875
         self::$SUPPORT['mbstring'] === false
7876 7876
     ) {
7877
-      \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
7877
+      \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
7878 7878
     }
7879 7879
 
7880 7880
     if (self::$SUPPORT['mbstring'] === true) {
@@ -7889,7 +7889,7 @@  discard block
 block discarded – undo
7889 7889
       return \grapheme_strstr($haystack, $needle, $before_needle);
7890 7890
     }
7891 7891
 
7892
-    \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match);
7892
+    \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match);
7893 7893
 
7894 7894
     if (!isset($match[1])) {
7895 7895
       return false;
@@ -7988,9 +7988,9 @@  discard block
 block discarded – undo
7988 7988
 
7989 7989
       if (self::$SUPPORT['intl'] === true) {
7990 7990
 
7991
-        $langCode = $lang . '-Lower';
7991
+        $langCode = $lang.'-Lower';
7992 7992
         if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) {
7993
-          \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, E_USER_WARNING);
7993
+          \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, E_USER_WARNING);
7994 7994
 
7995 7995
           $langCode = 'Any-Lower';
7996 7996
         }
@@ -7999,7 +7999,7 @@  discard block
 block discarded – undo
7999 7999
         return transliterator_transliterate($langCode, $str);
8000 8000
       }
8001 8001
 
8002
-      \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, E_USER_WARNING);
8002
+      \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, E_USER_WARNING);
8003 8003
     }
8004 8004
 
8005 8005
     return \mb_strtolower($str, $encoding);
@@ -8057,9 +8057,9 @@  discard block
 block discarded – undo
8057 8057
 
8058 8058
       if (self::$SUPPORT['intl'] === true) {
8059 8059
 
8060
-        $langCode = $lang . '-Upper';
8060
+        $langCode = $lang.'-Upper';
8061 8061
         if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) {
8062
-          \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, E_USER_WARNING);
8062
+          \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, E_USER_WARNING);
8063 8063
 
8064 8064
           $langCode = 'Any-Upper';
8065 8065
         }
@@ -8068,7 +8068,7 @@  discard block
 block discarded – undo
8068 8068
         return transliterator_transliterate($langCode, $str);
8069 8069
       }
8070 8070
 
8071
-      \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: ' . $lang, E_USER_WARNING);
8071
+      \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: '.$lang, E_USER_WARNING);
8072 8072
     }
8073 8073
 
8074 8074
     return \mb_strtoupper($str, $encoding);
@@ -8224,7 +8224,7 @@  discard block
 block discarded – undo
8224 8224
         &&
8225 8225
         self::$SUPPORT['mbstring'] === false
8226 8226
     ) {
8227
-      \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
8227
+      \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
8228 8228
     }
8229 8229
 
8230 8230
     if (self::$SUPPORT['mbstring'] === true) {
@@ -8252,8 +8252,7 @@  discard block
 block discarded – undo
8252 8252
 
8253 8253
     if (self::is_ascii($str)) {
8254 8254
       return ($length === null) ?
8255
-          \substr($str, $offset) :
8256
-          \substr($str, $offset, $length);
8255
+          \substr($str, $offset) : \substr($str, $offset, $length);
8257 8256
     }
8258 8257
 
8259 8258
     // fallback via vanilla php
@@ -8388,14 +8387,14 @@  discard block
 block discarded – undo
8388 8387
         &&
8389 8388
         self::$SUPPORT['mbstring'] === false
8390 8389
     ) {
8391
-      \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
8390
+      \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', E_USER_WARNING);
8392 8391
     }
8393 8392
 
8394 8393
     if (self::$SUPPORT['mbstring'] === true) {
8395 8394
       return \mb_substr_count($haystack, $needle, $encoding);
8396 8395
     }
8397 8396
 
8398
-    \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, PREG_SET_ORDER);
8397
+    \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, PREG_SET_ORDER);
8399 8398
 
8400 8399
     return \count($matches);
8401 8400
   }
@@ -8595,8 +8594,7 @@  discard block
 block discarded – undo
8595 8594
 
8596 8595
     if (self::is_ascii($str)) {
8597 8596
       return ($length === null) ?
8598
-          \substr_replace($str, $replacement, $offset) :
8599
-          \substr_replace($str, $replacement, $offset, $length);
8597
+          \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length);
8600 8598
     }
8601 8599
 
8602 8600
     \preg_match_all('/./us', $str, $smatches);
@@ -9053,7 +9051,7 @@  discard block
 block discarded – undo
9053 9051
           $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1];
9054 9052
 
9055 9053
           if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already
9056
-            $buf .= $c1 . $c2;
9054
+            $buf .= $c1.$c2;
9057 9055
             $i++;
9058 9056
           } else { // not valid UTF8 - convert it
9059 9057
             $buf .= self::to_utf8_convert($c1);
@@ -9065,7 +9063,7 @@  discard block
 block discarded – undo
9065 9063
           $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2];
9066 9064
 
9067 9065
           if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already
9068
-            $buf .= $c1 . $c2 . $c3;
9066
+            $buf .= $c1.$c2.$c3;
9069 9067
             $i += 2;
9070 9068
           } else { // not valid UTF8 - convert it
9071 9069
             $buf .= self::to_utf8_convert($c1);
@@ -9078,7 +9076,7 @@  discard block
 block discarded – undo
9078 9076
           $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3];
9079 9077
 
9080 9078
           if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already
9081
-            $buf .= $c1 . $c2 . $c3 . $c4;
9079
+            $buf .= $c1.$c2.$c3.$c4;
9082 9080
             $i += 3;
9083 9081
           } else { // not valid UTF8 - convert it
9084 9082
             $buf .= self::to_utf8_convert($c1);
@@ -9100,7 +9098,7 @@  discard block
 block discarded – undo
9100 9098
     // decode unicode escape sequences
9101 9099
     $buf = \preg_replace_callback(
9102 9100
         '/\\\\u([0-9a-f]{4})/i',
9103
-        function ($match) {
9101
+        function($match) {
9104 9102
           return \mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
9105 9103
         },
9106 9104
         $buf
@@ -9142,7 +9140,7 @@  discard block
 block discarded – undo
9142 9140
     } else {
9143 9141
       $cc1 = self::$CHR[$ordC1 / 64] | "\xC0";
9144 9142
       $cc2 = ($int & "\x3F") | "\x80";
9145
-      $buf .= $cc1 . $cc2;
9143
+      $buf .= $cc1.$cc2;
9146 9144
     }
9147 9145
 
9148 9146
     return $buf;
@@ -9206,7 +9204,7 @@  discard block
 block discarded – undo
9206 9204
         $cleanUtf8
9207 9205
     );
9208 9206
 
9209
-    return $strPartOne . $strPartTwo;
9207
+    return $strPartOne.$strPartTwo;
9210 9208
   }
9211 9209
 
9212 9210
   /**
@@ -9251,7 +9249,7 @@  discard block
 block discarded – undo
9251 9249
       $str = self::clean($str);
9252 9250
     }
9253 9251
 
9254
-    $usePhpDefaultFunctions = !(bool)($charlist . \implode('', $exceptions));
9252
+    $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions));
9255 9253
 
9256 9254
     if (
9257 9255
         $usePhpDefaultFunctions === true
@@ -9753,7 +9751,7 @@  discard block
 block discarded – undo
9753 9751
       return '';
9754 9752
     }
9755 9753
 
9756
-    \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches);
9754
+    \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches);
9757 9755
 
9758 9756
     if (
9759 9757
         !isset($matches[0])
@@ -9763,7 +9761,7 @@  discard block
 block discarded – undo
9763 9761
       return $str;
9764 9762
     }
9765 9763
 
9766
-    return self::rtrim($matches[0]) . $strAddOn;
9764
+    return self::rtrim($matches[0]).$strAddOn;
9767 9765
   }
9768 9766
 
9769 9767
   /**
@@ -9828,7 +9826,7 @@  discard block
 block discarded – undo
9828 9826
       $strReturn .= $break;
9829 9827
     }
9830 9828
 
9831
-    return $strReturn . \implode('', $chars);
9829
+    return $strReturn.\implode('', $chars);
9832 9830
   }
9833 9831
 
9834 9832
   /**
Please login to merge, or discard this patch.