Completed
Pull Request — master (#35)
by Lars
04:16
created
src/voku/helper/data/caseFolding_full.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -217,6 +217,6 @@
 block discarded – undo
217 217
         ),
218 218
 );
219 219
 
220
-$result =& $data;
220
+$result = & $data;
221 221
 unset($data);
222 222
 return $result;
Please login to merge, or discard this patch.
src/voku/helper/data/translit_extra.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -217,6 +217,6 @@
 block discarded – undo
217 217
         ),
218 218
 );
219 219
 
220
-$result =& $data;
220
+$result = & $data;
221 221
 unset($data);
222 222
 return $result;
Please login to merge, or discard this patch.
src/voku/helper/UTF8.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5379,7 +5379,7 @@  discard block
 block discarded – undo
5379 5379
    *                              The string being checked, for the last occurrence
5380 5380
    *                              of needle
5381 5381
    *                              </p>
5382
-   * @param string|int $needle    <p>
5382
+   * @param string $needle    <p>
5383 5383
    *                              The string to find in haystack.
5384 5384
    *                              Or a code point as int.
5385 5385
    *                              </p>
@@ -5455,7 +5455,7 @@  discard block
 block discarded – undo
5455 5455
    * @param int    $offset
5456 5456
    * @param int    $length
5457 5457
    *
5458
-   * @return int|null
5458
+   * @return integer
5459 5459
    */
5460 5460
   public static function strspn($str, $mask, $offset = 0, $length = 2147483647)
5461 5461
   {
@@ -6073,7 +6073,7 @@  discard block
 block discarded – undo
6073 6073
    * 2) when any of these: àáâãäåæçèéêëìíîï  are followed by TWO chars from group B,
6074 6074
    * 3) when any of these: ðñòó  are followed by THREE chars from group B.
6075 6075
    *
6076
-   * @param string|array $str Any string or array.
6076
+   * @param string $str Any string or array.
6077 6077
    *
6078 6078
    * @return string The same string, but UTF8 encoded.
6079 6079
    */
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
   public static function add_bom_to_string($str)
835 835
   {
836 836
     if (self::string_has_bom($str) === false) {
837
-      $str = self::bom() . $str;
837
+      $str = self::bom().$str;
838 838
     }
839 839
 
840 840
     return $str;
@@ -2154,7 +2154,7 @@  discard block
 block discarded – undo
2154 2154
     self::checkForSupport();
2155 2155
 
2156 2156
     return \mb_convert_encoding(
2157
-        '&#x' . dechex($code) . ';',
2157
+        '&#x'.dechex($code).';',
2158 2158
         'UTF-8',
2159 2159
         'HTML-ENTITIES'
2160 2160
     );
@@ -2434,7 +2434,7 @@  discard block
 block discarded – undo
2434 2434
           if ($var[0] >= "\x80" && isset($n[0], $leading_combining[0]) && preg_match('/^\p{Mn}/u', $var)) {
2435 2435
             // Prevent leading combining chars
2436 2436
             // for NFC-safe concatenations.
2437
-            $var = $leading_combining . $var;
2437
+            $var = $leading_combining.$var;
2438 2438
           }
2439 2439
         }
2440 2440
         break;
@@ -2721,7 +2721,7 @@  discard block
 block discarded – undo
2721 2721
    */
2722 2722
   protected static function getData($file)
2723 2723
   {
2724
-    $file = __DIR__ . '/data/' . $file . '.php';
2724
+    $file = __DIR__.'/data/'.$file.'.php';
2725 2725
     if (file_exists($file)) {
2726 2726
       /** @noinspection PhpIncludeInspection */
2727 2727
       return require $file;
@@ -2846,7 +2846,7 @@  discard block
 block discarded – undo
2846 2846
 
2847 2847
     return implode(
2848 2848
         array_map(
2849
-            function ($data) use ($keepAsciiChars) {
2849
+            function($data) use ($keepAsciiChars) {
2850 2850
               return self::single_chr_html_encode($data, $keepAsciiChars);
2851 2851
             },
2852 2852
             self::split($str)
@@ -3213,9 +3213,9 @@  discard block
 block discarded – undo
3213 3213
     if (ctype_digit((string)$int)) {
3214 3214
       $hex = dechex((int)$int);
3215 3215
 
3216
-      $hex = (strlen($hex) < 4 ? substr('0000' . $hex, -4) : $hex);
3216
+      $hex = (strlen($hex) < 4 ? substr('0000'.$hex, -4) : $hex);
3217 3217
 
3218
-      return $pfix . $hex;
3218
+      return $pfix.$hex;
3219 3219
     }
3220 3220
 
3221 3221
     return '';
@@ -3793,7 +3793,7 @@  discard block
 block discarded – undo
3793 3793
    */
3794 3794
   public static function lcfirst($str)
3795 3795
   {
3796
-    return self::strtolower(self::substr($str, 0, 1)) . self::substr($str, 1);
3796
+    return self::strtolower(self::substr($str, 0, 1)).self::substr($str, 1);
3797 3797
   }
3798 3798
 
3799 3799
   /**
@@ -4199,7 +4199,7 @@  discard block
 block discarded – undo
4199 4199
 
4200 4200
     if (is_array($what)) {
4201 4201
       foreach ($what as $item) {
4202
-        $str = preg_replace('/(' . preg_quote($item, '/') . ')+/', $item, $str);
4202
+        $str = preg_replace('/('.preg_quote($item, '/').')+/', $item, $str);
4203 4203
       }
4204 4204
     }
4205 4205
 
@@ -4299,7 +4299,7 @@  discard block
 block discarded – undo
4299 4299
   {
4300 4300
     static $rxClassCache = array();
4301 4301
 
4302
-    $cacheKey = $s . $class;
4302
+    $cacheKey = $s.$class;
4303 4303
 
4304 4304
     if (isset($rxClassCache[$cacheKey])) {
4305 4305
       return $rxClassCache[$cacheKey];
@@ -4310,7 +4310,7 @@  discard block
 block discarded – undo
4310 4310
     /** @noinspection SuspiciousLoopInspection */
4311 4311
     foreach (self::str_split($s) as $s) {
4312 4312
       if ('-' === $s) {
4313
-        $class[0] = '-' . $class[0];
4313
+        $class[0] = '-'.$class[0];
4314 4314
       } elseif (!isset($s[2])) {
4315 4315
         $class[0] .= preg_quote($s, '/');
4316 4316
       } elseif (1 === self::strlen($s)) {
@@ -4320,12 +4320,12 @@  discard block
 block discarded – undo
4320 4320
       }
4321 4321
     }
4322 4322
 
4323
-    $class[0] = '[' . $class[0] . ']';
4323
+    $class[0] = '['.$class[0].']';
4324 4324
 
4325 4325
     if (1 === count($class)) {
4326 4326
       $return = $class[0];
4327 4327
     } else {
4328
-      $return = '(?:' . implode('|', $class) . ')';
4328
+      $return = '(?:'.implode('|', $class).')';
4329 4329
     }
4330 4330
 
4331 4331
     $rxClassCache[$cacheKey] = $return;
@@ -4339,7 +4339,7 @@  discard block
 block discarded – undo
4339 4339
   public static function showSupport()
4340 4340
   {
4341 4341
     foreach (self::$support as $utf8Support) {
4342
-      echo $utf8Support . "\n<br>";
4342
+      echo $utf8Support."\n<br>";
4343 4343
     }
4344 4344
   }
4345 4345
 
@@ -4365,7 +4365,7 @@  discard block
 block discarded – undo
4365 4365
       return $char;
4366 4366
     }
4367 4367
 
4368
-    return '&#' . self::ord($char) . ';';
4368
+    return '&#'.self::ord($char).';';
4369 4369
   }
4370 4370
 
4371 4371
   /**
@@ -4414,19 +4414,19 @@  discard block
 block discarded – undo
4414 4414
           $ret[] = $str[$i];
4415 4415
         } elseif ((($str[$i] & "\xE0") === "\xC0") && isset($str[$i + 1])) {
4416 4416
           if (($str[$i + 1] & "\xC0") === "\x80") {
4417
-            $ret[] = $str[$i] . $str[$i + 1];
4417
+            $ret[] = $str[$i].$str[$i + 1];
4418 4418
 
4419 4419
             $i++;
4420 4420
           }
4421 4421
         } elseif ((($str[$i] & "\xF0") === "\xE0") && isset($str[$i + 2])) {
4422 4422
           if ((($str[$i + 1] & "\xC0") === "\x80") && (($str[$i + 2] & "\xC0") === "\x80")) {
4423
-            $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2];
4423
+            $ret[] = $str[$i].$str[$i + 1].$str[$i + 2];
4424 4424
 
4425 4425
             $i += 2;
4426 4426
           }
4427 4427
         } elseif ((($str[$i] & "\xF8") === "\xF0") && isset($str[$i + 3])) {
4428 4428
           if ((($str[$i + 1] & "\xC0") === "\x80") && (($str[$i + 2] & "\xC0") === "\x80") && (($str[$i + 3] & "\xC0") === "\x80")) {
4429
-            $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3];
4429
+            $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3];
4430 4430
 
4431 4431
             $i += 3;
4432 4432
           }
@@ -4560,7 +4560,7 @@  discard block
 block discarded – undo
4560 4560
       if ('' === $s .= '') {
4561 4561
         $s = '/^(?<=.)$/';
4562 4562
       } else {
4563
-        $s = '/' . preg_quote($s, '/') . '/ui';
4563
+        $s = '/'.preg_quote($s, '/').'/ui';
4564 4564
       }
4565 4565
     }
4566 4566
 
@@ -4594,7 +4594,7 @@  discard block
 block discarded – undo
4594 4594
     }
4595 4595
 
4596 4596
     if (self::substr($str, $length - 1, 1) === ' ') {
4597
-      return self::substr($str, 0, $length - 1) . $strAddOn;
4597
+      return self::substr($str, 0, $length - 1).$strAddOn;
4598 4598
     }
4599 4599
 
4600 4600
     $str = self::substr($str, 0, $length);
@@ -4603,9 +4603,9 @@  discard block
 block discarded – undo
4603 4603
     $new_str = implode(' ', $array);
4604 4604
 
4605 4605
     if ($new_str === '') {
4606
-      $str = self::substr($str, 0, $length - 1) . $strAddOn;
4606
+      $str = self::substr($str, 0, $length - 1).$strAddOn;
4607 4607
     } else {
4608
-      $str = $new_str . $strAddOn;
4608
+      $str = $new_str.$strAddOn;
4609 4609
     }
4610 4610
 
4611 4611
     return $str;
@@ -4651,7 +4651,7 @@  discard block
 block discarded – undo
4651 4651
           $pre = '';
4652 4652
       }
4653 4653
 
4654
-      return $pre . $input . $post;
4654
+      return $pre.$input.$post;
4655 4655
     }
4656 4656
 
4657 4657
     return $input;
@@ -4785,7 +4785,7 @@  discard block
 block discarded – undo
4785 4785
         $a[] = \grapheme_extract($str, 1, GRAPHEME_EXTR_COUNT, $p, $p);
4786 4786
       }
4787 4787
     } else {
4788
-      preg_match_all('/' . Grapheme::GRAPHEME_CLUSTER_RX . '/u', $str, $a);
4788
+      preg_match_all('/'.Grapheme::GRAPHEME_CLUSTER_RX.'/u', $str, $a);
4789 4789
       $a = $a[0];
4790 4790
     }
4791 4791
 
@@ -4926,7 +4926,7 @@  discard block
 block discarded – undo
4926 4926
 
4927 4927
       $bank = $ord >> 8;
4928 4928
       if (!array_key_exists($bank, (array)$UTF8_TO_ASCII)) {
4929
-        $bankfile = __DIR__ . '/data/' . sprintf('x%02x', $bank) . '.php';
4929
+        $bankfile = __DIR__.'/data/'.sprintf('x%02x', $bank).'.php';
4930 4930
         if (file_exists($bankfile)) {
4931 4931
           /** @noinspection PhpIncludeInspection */
4932 4932
           require $bankfile;
@@ -5016,7 +5016,7 @@  discard block
 block discarded – undo
5016 5016
    */
5017 5017
   public static function strcmp($str1, $str2)
5018 5018
   {
5019
-    return $str1 . '' === $str2 . '' ? 0 : strcmp(
5019
+    return $str1.'' === $str2.'' ? 0 : strcmp(
5020 5020
         \Normalizer::normalize($str1, \Normalizer::NFD),
5021 5021
         \Normalizer::normalize($str2, \Normalizer::NFD)
5022 5022
     );
@@ -5044,7 +5044,7 @@  discard block
 block discarded – undo
5044 5044
       $str = (string)$str;
5045 5045
     }
5046 5046
 
5047
-    if (preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $length)) {
5047
+    if (preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $length)) {
5048 5048
       /** @noinspection OffsetOperationsInspection */
5049 5049
       return self::strlen($length[1]);
5050 5050
     } else {
@@ -5268,7 +5268,7 @@  discard block
 block discarded – undo
5268 5268
    */
5269 5269
   public static function strnatcmp($str1, $str2)
5270 5270
   {
5271
-    return $str1 . '' === $str2 . '' ? 0 : strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2));
5271
+    return $str1.'' === $str2.'' ? 0 : strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2));
5272 5272
   }
5273 5273
 
5274 5274
   /**
@@ -5349,7 +5349,7 @@  discard block
 block discarded – undo
5349 5349
       return false;
5350 5350
     }
5351 5351
 
5352
-    if (preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) {
5352
+    if (preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) {
5353 5353
       return substr($haystack, strpos($haystack, $m[0]));
5354 5354
     } else {
5355 5355
       return false;
@@ -5626,7 +5626,7 @@  discard block
 block discarded – undo
5626 5626
       $str = self::substr($str, $offset, $length);
5627 5627
     }
5628 5628
 
5629
-    return preg_match('/^' . self::rxClass($mask) . '+/u', $str, $str) ? self::strlen($str[0]) : 0;
5629
+    return preg_match('/^'.self::rxClass($mask).'+/u', $str, $str) ? self::strlen($str[0]) : 0;
5630 5630
   }
5631 5631
 
5632 5632
   /**
@@ -6069,7 +6069,7 @@  discard block
 block discarded – undo
6069 6069
 
6070 6070
     $strSwappedCase = preg_replace_callback(
6071 6071
         '/[\S]/u',
6072
-        function ($match) use ($encoding) {
6072
+        function($match) use ($encoding) {
6073 6073
           $marchToUpper = UTF8::strtoupper($match[0], $encoding);
6074 6074
 
6075 6075
           if ($match[0] === $marchToUpper) {
@@ -6278,40 +6278,40 @@  discard block
 block discarded – undo
6278 6278
         if ($c1 >= "\xc0" & $c1 <= "\xdf") { // looks like 2 bytes UTF8
6279 6279
 
6280 6280
           if ($c2 >= "\x80" && $c2 <= "\xbf") { // yeah, almost sure it's UTF8 already
6281
-            $buf .= $c1 . $c2;
6281
+            $buf .= $c1.$c2;
6282 6282
             $i++;
6283 6283
           } else { // not valid UTF8 - convert it
6284 6284
             $cc1 = (chr(ord($c1) / 64) | "\xc0");
6285 6285
             $cc2 = ($c1 & "\x3f") | "\x80";
6286
-            $buf .= $cc1 . $cc2;
6286
+            $buf .= $cc1.$cc2;
6287 6287
           }
6288 6288
 
6289 6289
         } elseif ($c1 >= "\xe0" & $c1 <= "\xef") { // looks like 3 bytes UTF8
6290 6290
 
6291 6291
           if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf") { // yeah, almost sure it's UTF8 already
6292
-            $buf .= $c1 . $c2 . $c3;
6292
+            $buf .= $c1.$c2.$c3;
6293 6293
             $i += 2;
6294 6294
           } else { // not valid UTF8 - convert it
6295 6295
             $cc1 = (chr(ord($c1) / 64) | "\xc0");
6296 6296
             $cc2 = ($c1 & "\x3f") | "\x80";
6297
-            $buf .= $cc1 . $cc2;
6297
+            $buf .= $cc1.$cc2;
6298 6298
           }
6299 6299
 
6300 6300
         } elseif ($c1 >= "\xf0" & $c1 <= "\xf7") { // looks like 4 bytes UTF8
6301 6301
 
6302 6302
           if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf" && $c4 >= "\x80" && $c4 <= "\xbf") { // yeah, almost sure it's UTF8 already
6303
-            $buf .= $c1 . $c2 . $c3 . $c4;
6303
+            $buf .= $c1.$c2.$c3.$c4;
6304 6304
             $i += 3;
6305 6305
           } else { // not valid UTF8 - convert it
6306 6306
             $cc1 = (chr(ord($c1) / 64) | "\xc0");
6307 6307
             $cc2 = ($c1 & "\x3f") | "\x80";
6308
-            $buf .= $cc1 . $cc2;
6308
+            $buf .= $cc1.$cc2;
6309 6309
           }
6310 6310
 
6311 6311
         } else { // doesn't look like UTF8, but should be converted
6312 6312
           $cc1 = (chr(ord($c1) / 64) | "\xc0");
6313 6313
           $cc2 = (($c1 & "\x3f") | "\x80");
6314
-          $buf .= $cc1 . $cc2;
6314
+          $buf .= $cc1.$cc2;
6315 6315
         }
6316 6316
 
6317 6317
       } elseif (($c1 & "\xc0") === "\x80") { // needs conversion
@@ -6322,7 +6322,7 @@  discard block
 block discarded – undo
6322 6322
         } else {
6323 6323
           $cc1 = (chr($ordC1 / 64) | "\xc0");
6324 6324
           $cc2 = (($c1 & "\x3f") | "\x80");
6325
-          $buf .= $cc1 . $cc2;
6325
+          $buf .= $cc1.$cc2;
6326 6326
         }
6327 6327
 
6328 6328
       } else { // it doesn't need conversion
@@ -6335,7 +6335,7 @@  discard block
 block discarded – undo
6335 6335
     // decode unicode escape sequences
6336 6336
     $buf = preg_replace_callback(
6337 6337
         '/\\\\u([0-9a-f]{4})/i',
6338
-        function ($match) {
6338
+        function($match) {
6339 6339
           return \mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
6340 6340
         },
6341 6341
         $buf
@@ -6344,7 +6344,7 @@  discard block
 block discarded – undo
6344 6344
     // decode UTF-8 codepoints
6345 6345
     $buf = preg_replace_callback(
6346 6346
         '/&#\d{2,4};/',
6347
-        function ($match) {
6347
+        function($match) {
6348 6348
           return \mb_convert_encoding($match[0], 'UTF-8', 'HTML-ENTITIES');
6349 6349
         },
6350 6350
         $buf
@@ -6419,7 +6419,7 @@  discard block
 block discarded – undo
6419 6419
    */
6420 6420
   public static function ucfirst($str)
6421 6421
   {
6422
-    return self::strtoupper(self::substr($str, 0, 1)) . self::substr($str, 1);
6422
+    return self::strtoupper(self::substr($str, 0, 1)).self::substr($str, 1);
6423 6423
   }
6424 6424
 
6425 6425
   /**
@@ -6868,7 +6868,7 @@  discard block
 block discarded – undo
6868 6868
       return '';
6869 6869
     }
6870 6870
 
6871
-    preg_match('/^\s*+(?:\S++\s*+){1,' . $words . '}/u', $str, $matches);
6871
+    preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $str, $matches);
6872 6872
 
6873 6873
     if (
6874 6874
         !isset($matches[0])
@@ -6878,7 +6878,7 @@  discard block
 block discarded – undo
6878 6878
       return $str;
6879 6879
     }
6880 6880
 
6881
-    return self::rtrim($matches[0]) . $strAddOn;
6881
+    return self::rtrim($matches[0]).$strAddOn;
6882 6882
   }
6883 6883
 
6884 6884
   /**
@@ -6960,7 +6960,7 @@  discard block
 block discarded – undo
6960 6960
       $strReturn .= $break;
6961 6961
     }
6962 6962
 
6963
-    return $strReturn . implode('', $chars);
6963
+    return $strReturn.implode('', $chars);
6964 6964
   }
6965 6965
 
6966 6966
   /**
Please login to merge, or discard this patch.
src/voku/helper/Bootup.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     if (!preg_match('//u', urldecode($uri))) {
90 90
       $uri = preg_replace_callback(
91 91
           '/[\x80-\xFF]+/',
92
-          function ($m) {
92
+          function($m) {
93 93
             return urlencode($m[0]);
94 94
           },
95 95
           $uri
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
       $uri = preg_replace_callback(
99 99
           '/(?:%[89A-F][0-9A-F])+/i',
100
-          function ($m) {
100
+          function($m) {
101 101
             return urlencode(UTF8::encode('UTF-8', urldecode($m[0])));
102 102
           },
103 103
           $uri
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
         // Use ob_start() to buffer content and avoid problem of headers already sent...
108 108
         if (headers_sent() === false) {
109 109
           $severProtocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1');
110
-          header($severProtocol . ' 301 Moved Permanently');
111
-          header('Location: ' . $uri);
110
+          header($severProtocol.' 301 Moved Permanently');
111
+          header('Location: '.$uri);
112 112
           exit();
113 113
         }
114 114
       }
Please login to merge, or discard this patch.