Completed
Push — master ( f52b4d...49f69d )
by Lars
03:40
created
src/voku/helper/Bootup.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     if (!preg_match('//u', urldecode($uri))) {
92 92
       $uri = preg_replace_callback(
93 93
           '/[\x80-\xFF]+/',
94
-          function ($m) {
94
+          function($m) {
95 95
             return urlencode($m[0]);
96 96
           },
97 97
           $uri
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
       $uri = preg_replace_callback(
101 101
           '/(?:%[89A-F][0-9A-F])+/i',
102
-          function ($m) {
102
+          function($m) {
103 103
             return urlencode(UTF8::encode('UTF-8', urldecode($m[0])));
104 104
           },
105 105
           $uri
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
         // Use ob_start() to buffer content and avoid problem of headers already sent...
110 110
         if (headers_sent() === false) {
111 111
           $severProtocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1');
112
-          header($severProtocol . ' 301 Moved Permanently');
113
-          header('Location: ' . $uri);
112
+          header($severProtocol.' 301 Moved Permanently');
113
+          header('Location: '.$uri);
114 114
           exit();
115 115
         }
116 116
       }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
       if ($s[0] >= "\x80" && isset($n[0], $leading_combining[0]) && preg_match('/^\p{Mn}/u', $s)) {
198 198
         // Prevent leading combining chars
199 199
         // for NFC-safe concatenations.
200
-        $s = $leading_combining . $s;
200
+        $s = $leading_combining.$s;
201 201
       }
202 202
     }
203 203
 
Please login to merge, or discard this patch.
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   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2150,7 +2150,7 @@  discard block
 block discarded – undo
2150 2150
    * @param string $encodingLabel ISO-8859-1 || UTF-8
2151 2151
    * @param string $str
2152 2152
    *
2153
-   * @return false|string Will return false on error.
2153
+   * @return string Will return false on error.
2154 2154
    */
2155 2155
   public static function encode($encodingLabel, $str)
2156 2156
   {
@@ -5323,7 +5323,7 @@  discard block
 block discarded – undo
5323 5323
    *                              The string being checked, for the last occurrence
5324 5324
    *                              of needle
5325 5325
    *                              </p>
5326
-   * @param string|int $needle    <p>
5326
+   * @param string $needle    <p>
5327 5327
    *                              The string to find in haystack.
5328 5328
    *                              Or a code point as int.
5329 5329
    *                              </p>
@@ -5399,7 +5399,7 @@  discard block
 block discarded – undo
5399 5399
    * @param int    $offset
5400 5400
    * @param int    $length
5401 5401
    *
5402
-   * @return int|null
5402
+   * @return integer
5403 5403
    */
5404 5404
   public static function strspn($str, $mask, $offset = 0, $length = 2147483647)
5405 5405
   {
@@ -6017,7 +6017,7 @@  discard block
 block discarded – undo
6017 6017
    * 2) when any of these: àáâãäåæçèéêëìíîï  are followed by TWO chars from group B,
6018 6018
    * 3) when any of these: ðñòó  are followed by THREE chars from group B.
6019 6019
    *
6020
-   * @param string|array $str Any string or array.
6020
+   * @param string $str Any string or array.
6021 6021
    *
6022 6022
    * @return string The same string, but UTF8 encoded.
6023 6023
    */
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
   public static function add_bom_to_string($str)
820 820
   {
821 821
     if (!self::is_bom(substr($str, 0, 3))) {
822
-      $str = self::bom() . $str;
822
+      $str = self::bom().$str;
823 823
     }
824 824
 
825 825
     return $str;
@@ -2135,7 +2135,7 @@  discard block
 block discarded – undo
2135 2135
     self::checkForSupport();
2136 2136
 
2137 2137
     return mb_convert_encoding(
2138
-        '&#x' . dechex($code) . ';',
2138
+        '&#x'.dechex($code).';',
2139 2139
         'UTF-8',
2140 2140
         'HTML-ENTITIES'
2141 2141
     );
@@ -2373,7 +2373,7 @@  discard block
 block discarded – undo
2373 2373
           if ($var[0] >= "\x80" && isset($n[0], $leading_combining[0]) && preg_match('/^\p{Mn}/u', $var)) {
2374 2374
             // Prevent leading combining chars
2375 2375
             // for NFC-safe concatenations.
2376
-            $var = $leading_combining . $var;
2376
+            $var = $leading_combining.$var;
2377 2377
           }
2378 2378
         }
2379 2379
         break;
@@ -2640,7 +2640,7 @@  discard block
 block discarded – undo
2640 2640
    */
2641 2641
   protected static function getData($file)
2642 2642
   {
2643
-    $file = __DIR__ . '/data/' . $file . '.php';
2643
+    $file = __DIR__.'/data/'.$file.'.php';
2644 2644
     if (file_exists($file)) {
2645 2645
       /** @noinspection PhpIncludeInspection */
2646 2646
       return require $file;
@@ -3086,9 +3086,9 @@  discard block
 block discarded – undo
3086 3086
     if (ctype_digit((string)$int)) {
3087 3087
       $hex = dechex((int)$int);
3088 3088
 
3089
-      $hex = (strlen($hex) < 4 ? substr('0000' . $hex, -4) : $hex);
3089
+      $hex = (strlen($hex) < 4 ? substr('0000'.$hex, -4) : $hex);
3090 3090
 
3091
-      return $pfix . $hex;
3091
+      return $pfix.$hex;
3092 3092
     }
3093 3093
 
3094 3094
     return '';
@@ -3625,7 +3625,7 @@  discard block
 block discarded – undo
3625 3625
    */
3626 3626
   public static function lcfirst($str)
3627 3627
   {
3628
-    return self::strtolower(self::substr($str, 0, 1)) . self::substr($str, 1);
3628
+    return self::strtolower(self::substr($str, 0, 1)).self::substr($str, 1);
3629 3629
   }
3630 3630
 
3631 3631
   /**
@@ -4009,7 +4009,7 @@  discard block
 block discarded – undo
4009 4009
 
4010 4010
     if (is_array($what)) {
4011 4011
       foreach ($what as $item) {
4012
-        $str = preg_replace('/(' . preg_quote($item, '/') . ')+/', $item, $str);
4012
+        $str = preg_replace('/('.preg_quote($item, '/').')+/', $item, $str);
4013 4013
       }
4014 4014
     }
4015 4015
 
@@ -4108,7 +4108,7 @@  discard block
 block discarded – undo
4108 4108
   {
4109 4109
     static $rxClassCache = array();
4110 4110
 
4111
-    $cacheKey = $s . $class;
4111
+    $cacheKey = $s.$class;
4112 4112
 
4113 4113
     if (isset($rxClassCache[$cacheKey])) {
4114 4114
       return $rxClassCache[$cacheKey];
@@ -4119,7 +4119,7 @@  discard block
 block discarded – undo
4119 4119
     /** @noinspection SuspiciousLoopInspection */
4120 4120
     foreach (self::str_split($s) as $s) {
4121 4121
       if ('-' === $s) {
4122
-        $class[0] = '-' . $class[0];
4122
+        $class[0] = '-'.$class[0];
4123 4123
       } elseif (!isset($s[2])) {
4124 4124
         $class[0] .= preg_quote($s, '/');
4125 4125
       } elseif (1 === self::strlen($s)) {
@@ -4129,12 +4129,12 @@  discard block
 block discarded – undo
4129 4129
       }
4130 4130
     }
4131 4131
 
4132
-    $class[0] = '[' . $class[0] . ']';
4132
+    $class[0] = '['.$class[0].']';
4133 4133
 
4134 4134
     if (1 === count($class)) {
4135 4135
       $return = $class[0];
4136 4136
     } else {
4137
-      $return = '(?:' . implode('|', $class) . ')';
4137
+      $return = '(?:'.implode('|', $class).')';
4138 4138
     }
4139 4139
 
4140 4140
     $rxClassCache[$cacheKey] = $return;
@@ -4148,7 +4148,7 @@  discard block
 block discarded – undo
4148 4148
   public static function showSupport()
4149 4149
   {
4150 4150
     foreach (self::$support as $utf8Support) {
4151
-      echo $utf8Support . "\n<br>";
4151
+      echo $utf8Support."\n<br>";
4152 4152
     }
4153 4153
   }
4154 4154
 
@@ -4165,7 +4165,7 @@  discard block
 block discarded – undo
4165 4165
       return '';
4166 4166
     }
4167 4167
 
4168
-    return '&#' . self::ord($chr) . ';';
4168
+    return '&#'.self::ord($chr).';';
4169 4169
   }
4170 4170
 
4171 4171
   /**
@@ -4214,19 +4214,19 @@  discard block
 block discarded – undo
4214 4214
           $ret[] = $str[$i];
4215 4215
         } elseif ((($str[$i] & "\xE0") === "\xC0") && isset($str[$i + 1])) {
4216 4216
           if (($str[$i + 1] & "\xC0") === "\x80") {
4217
-            $ret[] = $str[$i] . $str[$i + 1];
4217
+            $ret[] = $str[$i].$str[$i + 1];
4218 4218
 
4219 4219
             $i++;
4220 4220
           }
4221 4221
         } elseif ((($str[$i] & "\xF0") === "\xE0") && isset($str[$i + 2])) {
4222 4222
           if ((($str[$i + 1] & "\xC0") === "\x80") && (($str[$i + 2] & "\xC0") === "\x80")) {
4223
-            $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2];
4223
+            $ret[] = $str[$i].$str[$i + 1].$str[$i + 2];
4224 4224
 
4225 4225
             $i += 2;
4226 4226
           }
4227 4227
         } elseif ((($str[$i] & "\xF8") === "\xF0") && isset($str[$i + 3])) {
4228 4228
           if ((($str[$i + 1] & "\xC0") === "\x80") && (($str[$i + 2] & "\xC0") === "\x80") && (($str[$i + 3] & "\xC0") === "\x80")) {
4229
-            $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3];
4229
+            $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3];
4230 4230
 
4231 4231
             $i += 3;
4232 4232
           }
@@ -4360,7 +4360,7 @@  discard block
 block discarded – undo
4360 4360
       if ('' === $s .= '') {
4361 4361
         $s = '/^(?<=.)$/';
4362 4362
       } else {
4363
-        $s = '/' . preg_quote($s, '/') . '/ui';
4363
+        $s = '/'.preg_quote($s, '/').'/ui';
4364 4364
       }
4365 4365
     }
4366 4366
 
@@ -4394,7 +4394,7 @@  discard block
 block discarded – undo
4394 4394
     }
4395 4395
 
4396 4396
     if (self::substr($str, $length - 1, 1) === ' ') {
4397
-      return self::substr($str, 0, $length - 1) . $strAddOn;
4397
+      return self::substr($str, 0, $length - 1).$strAddOn;
4398 4398
     }
4399 4399
 
4400 4400
     $str = self::substr($str, 0, $length);
@@ -4403,9 +4403,9 @@  discard block
 block discarded – undo
4403 4403
     $new_str = implode(' ', $array);
4404 4404
 
4405 4405
     if ($new_str === '') {
4406
-      $str = self::substr($str, 0, $length - 1) . $strAddOn;
4406
+      $str = self::substr($str, 0, $length - 1).$strAddOn;
4407 4407
     } else {
4408
-      $str = $new_str . $strAddOn;
4408
+      $str = $new_str.$strAddOn;
4409 4409
     }
4410 4410
 
4411 4411
     return $str;
@@ -4451,7 +4451,7 @@  discard block
 block discarded – undo
4451 4451
           $pre = '';
4452 4452
       }
4453 4453
 
4454
-      return $pre . $input . $post;
4454
+      return $pre.$input.$post;
4455 4455
     }
4456 4456
 
4457 4457
     return $input;
@@ -4585,7 +4585,7 @@  discard block
 block discarded – undo
4585 4585
         $a[] = grapheme_extract($str, 1, GRAPHEME_EXTR_COUNT, $p, $p);
4586 4586
       }
4587 4587
     } else {
4588
-      preg_match_all('/' . Grapheme::GRAPHEME_CLUSTER_RX . '/u', $str, $a);
4588
+      preg_match_all('/'.Grapheme::GRAPHEME_CLUSTER_RX.'/u', $str, $a);
4589 4589
       $a = $a[0];
4590 4590
     }
4591 4591
 
@@ -4726,7 +4726,7 @@  discard block
 block discarded – undo
4726 4726
 
4727 4727
       $bank = $ord >> 8;
4728 4728
       if (!array_key_exists($bank, (array)$UTF8_TO_ASCII)) {
4729
-        $bankfile = __DIR__ . '/data/' . sprintf('x%02x', $bank) . '.php';
4729
+        $bankfile = __DIR__.'/data/'.sprintf('x%02x', $bank).'.php';
4730 4730
         if (file_exists($bankfile)) {
4731 4731
           /** @noinspection PhpIncludeInspection */
4732 4732
           require $bankfile;
@@ -4816,7 +4816,7 @@  discard block
 block discarded – undo
4816 4816
    */
4817 4817
   public static function strcmp($str1, $str2)
4818 4818
   {
4819
-    return $str1 . '' === $str2 . '' ? 0 : strcmp(
4819
+    return $str1.'' === $str2.'' ? 0 : strcmp(
4820 4820
         Normalizer::normalize($str1, Normalizer::NFD),
4821 4821
         Normalizer::normalize($str2, Normalizer::NFD)
4822 4822
     );
@@ -4844,7 +4844,7 @@  discard block
 block discarded – undo
4844 4844
       $str = (string)$str;
4845 4845
     }
4846 4846
 
4847
-    if (preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $length)) {
4847
+    if (preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $length)) {
4848 4848
       /** @noinspection OffsetOperationsInspection */
4849 4849
       return self::strlen($length[1]);
4850 4850
     } else {
@@ -5053,7 +5053,7 @@  discard block
 block discarded – undo
5053 5053
    */
5054 5054
   public static function strnatcmp($str1, $str2)
5055 5055
   {
5056
-    return $str1 . '' === $str2 . '' ? 0 : strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2));
5056
+    return $str1.'' === $str2.'' ? 0 : strnatcmp(self::strtonatfold($str1), self::strtonatfold($str2));
5057 5057
   }
5058 5058
 
5059 5059
   /**
@@ -5134,7 +5134,7 @@  discard block
 block discarded – undo
5134 5134
       return false;
5135 5135
     }
5136 5136
 
5137
-    if (preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) {
5137
+    if (preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) {
5138 5138
       return substr($haystack, strpos($haystack, $m[0]));
5139 5139
     } else {
5140 5140
       return false;
@@ -5407,7 +5407,7 @@  discard block
 block discarded – undo
5407 5407
       $str = self::substr($str, $offset, $length);
5408 5408
     }
5409 5409
 
5410
-    return preg_match('/^' . self::rxClass($mask) . '+/u', $str, $str) ? self::strlen($str[0]) : 0;
5410
+    return preg_match('/^'.self::rxClass($mask).'+/u', $str, $str) ? self::strlen($str[0]) : 0;
5411 5411
   }
5412 5412
 
5413 5413
   /**
@@ -5844,7 +5844,7 @@  discard block
 block discarded – undo
5844 5844
 
5845 5845
     $strSwappedCase = preg_replace_callback(
5846 5846
         '/[\S]/u',
5847
-        function ($match) use ($encoding) {
5847
+        function($match) use ($encoding) {
5848 5848
           $marchToUpper = UTF8::strtoupper($match[0], $encoding);
5849 5849
 
5850 5850
           if ($match[0] == $marchToUpper) {
@@ -6053,40 +6053,40 @@  discard block
 block discarded – undo
6053 6053
         if ($c1 >= "\xc0" & $c1 <= "\xdf") { // looks like 2 bytes UTF8
6054 6054
 
6055 6055
           if ($c2 >= "\x80" && $c2 <= "\xbf") { // yeah, almost sure it's UTF8 already
6056
-            $buf .= $c1 . $c2;
6056
+            $buf .= $c1.$c2;
6057 6057
             $i++;
6058 6058
           } else { // not valid UTF8 - convert it
6059 6059
             $cc1 = (chr(ord($c1) / 64) | "\xc0");
6060 6060
             $cc2 = ($c1 & "\x3f") | "\x80";
6061
-            $buf .= $cc1 . $cc2;
6061
+            $buf .= $cc1.$cc2;
6062 6062
           }
6063 6063
 
6064 6064
         } elseif ($c1 >= "\xe0" & $c1 <= "\xef") { // looks like 3 bytes UTF8
6065 6065
 
6066 6066
           if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf") { // yeah, almost sure it's UTF8 already
6067
-            $buf .= $c1 . $c2 . $c3;
6067
+            $buf .= $c1.$c2.$c3;
6068 6068
             $i += 2;
6069 6069
           } else { // not valid UTF8 - convert it
6070 6070
             $cc1 = (chr(ord($c1) / 64) | "\xc0");
6071 6071
             $cc2 = ($c1 & "\x3f") | "\x80";
6072
-            $buf .= $cc1 . $cc2;
6072
+            $buf .= $cc1.$cc2;
6073 6073
           }
6074 6074
 
6075 6075
         } elseif ($c1 >= "\xf0" & $c1 <= "\xf7") { // looks like 4 bytes UTF8
6076 6076
 
6077 6077
           if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf" && $c4 >= "\x80" && $c4 <= "\xbf") { // yeah, almost sure it's UTF8 already
6078
-            $buf .= $c1 . $c2 . $c3 . $c4;
6078
+            $buf .= $c1.$c2.$c3.$c4;
6079 6079
             $i += 3;
6080 6080
           } else { // not valid UTF8 - convert it
6081 6081
             $cc1 = (chr(ord($c1) / 64) | "\xc0");
6082 6082
             $cc2 = ($c1 & "\x3f") | "\x80";
6083
-            $buf .= $cc1 . $cc2;
6083
+            $buf .= $cc1.$cc2;
6084 6084
           }
6085 6085
 
6086 6086
         } else { // doesn't look like UTF8, but should be converted
6087 6087
           $cc1 = (chr(ord($c1) / 64) | "\xc0");
6088 6088
           $cc2 = (($c1 & "\x3f") | "\x80");
6089
-          $buf .= $cc1 . $cc2;
6089
+          $buf .= $cc1.$cc2;
6090 6090
         }
6091 6091
 
6092 6092
       } elseif (($c1 & "\xc0") === "\x80") { // needs conversion
@@ -6097,7 +6097,7 @@  discard block
 block discarded – undo
6097 6097
         } else {
6098 6098
           $cc1 = (chr($ordC1 / 64) | "\xc0");
6099 6099
           $cc2 = (($c1 & "\x3f") | "\x80");
6100
-          $buf .= $cc1 . $cc2;
6100
+          $buf .= $cc1.$cc2;
6101 6101
         }
6102 6102
 
6103 6103
       } else { // it doesn't need conversion
@@ -6110,7 +6110,7 @@  discard block
 block discarded – undo
6110 6110
     // decode unicode escape sequences
6111 6111
     $buf = preg_replace_callback(
6112 6112
         '/\\\\u([0-9a-f]{4})/i',
6113
-        function ($match) {
6113
+        function($match) {
6114 6114
           return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
6115 6115
         },
6116 6116
         $buf
@@ -6119,7 +6119,7 @@  discard block
 block discarded – undo
6119 6119
     // decode UTF-8 codepoints
6120 6120
     $buf = preg_replace_callback(
6121 6121
         '/&#\d{2,4};/',
6122
-        function ($match) {
6122
+        function($match) {
6123 6123
           return mb_convert_encoding($match[0], 'UTF-8', 'HTML-ENTITIES');
6124 6124
         },
6125 6125
         $buf
@@ -6194,7 +6194,7 @@  discard block
 block discarded – undo
6194 6194
    */
6195 6195
   public static function ucfirst($str)
6196 6196
   {
6197
-    return self::strtoupper(self::substr($str, 0, 1)) . self::substr($str, 1);
6197
+    return self::strtoupper(self::substr($str, 0, 1)).self::substr($str, 1);
6198 6198
   }
6199 6199
 
6200 6200
   /**
@@ -6643,7 +6643,7 @@  discard block
 block discarded – undo
6643 6643
       return '';
6644 6644
     }
6645 6645
 
6646
-    preg_match('/^\s*+(?:\S++\s*+){1,' . $words . '}/u', $str, $matches);
6646
+    preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $str, $matches);
6647 6647
 
6648 6648
     if (
6649 6649
         !isset($matches[0])
@@ -6653,7 +6653,7 @@  discard block
 block discarded – undo
6653 6653
       return $str;
6654 6654
     }
6655 6655
 
6656
-    return self::rtrim($matches[0]) . $strAddOn;
6656
+    return self::rtrim($matches[0]).$strAddOn;
6657 6657
   }
6658 6658
 
6659 6659
   /**
@@ -6735,7 +6735,7 @@  discard block
 block discarded – undo
6735 6735
       $strReturn .= $break;
6736 6736
     }
6737 6737
 
6738
-    return $strReturn . implode('', $chars);
6738
+    return $strReturn.implode('', $chars);
6739 6739
   }
6740 6740
 
6741 6741
   /**
Please login to merge, or discard this patch.