@@ -1903,9 +1903,9 @@ discard block |
||
1903 | 1903 | } |
1904 | 1904 | |
1905 | 1905 | $pos_end = min( |
1906 | - UTF8::strpos($text, ' ', $l, $this->encoding), |
|
1907 | - UTF8::strpos($text, '.', $l, $this->encoding) |
|
1908 | - ) - $pos_start; |
|
1906 | + UTF8::strpos($text, ' ', $l, $this->encoding), |
|
1907 | + UTF8::strpos($text, '.', $l, $this->encoding) |
|
1908 | + ) - $pos_start; |
|
1909 | 1909 | |
1910 | 1910 | if (!$pos_end || $pos_end <= 0) { |
1911 | 1911 | $extract = $replacerForSkippedText . ltrim( |
@@ -1945,9 +1945,9 @@ discard block |
||
1945 | 1945 | |
1946 | 1946 | if ($pos_end) { |
1947 | 1947 | $extract = rtrim( |
1948 | - UTF8::substr($text, 0, $pos_end, $this->encoding), |
|
1949 | - $trimChars |
|
1950 | - ) . $replacerForSkippedText; |
|
1948 | + UTF8::substr($text, 0, $pos_end, $this->encoding), |
|
1949 | + $trimChars |
|
1950 | + ) . $replacerForSkippedText; |
|
1951 | 1951 | } else { |
1952 | 1952 | $extract = $text; |
1953 | 1953 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | // init |
69 | 69 | UTF8::checkForSupport(); |
70 | 70 | |
71 | - $this->str = (string)$str; |
|
71 | + $this->str = (string) $str; |
|
72 | 72 | |
73 | 73 | if ($encoding) { |
74 | 74 | $this->encoding = $encoding; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function __toString() |
86 | 86 | { |
87 | - return (string)$this->str; |
|
87 | + return (string) $this->str; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function append($string) |
98 | 98 | { |
99 | - return static::create($this->str . $string, $this->encoding); |
|
99 | + return static::create($this->str.$string, $this->encoding); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -123,15 +123,15 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function appendUniqueIdentifier($entropyExtra = '', $md5 = true) |
125 | 125 | { |
126 | - $uniqueHelper = mt_rand() . |
|
127 | - session_id() . |
|
128 | - (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '') . |
|
129 | - (isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '') . |
|
126 | + $uniqueHelper = mt_rand(). |
|
127 | + session_id(). |
|
128 | + (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''). |
|
129 | + (isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : ''). |
|
130 | 130 | $entropyExtra; |
131 | 131 | |
132 | 132 | $uniqueString = uniqid($uniqueHelper, true); |
133 | 133 | if ($md5) { |
134 | - $uniqueString = md5($uniqueString . $uniqueHelper); |
|
134 | + $uniqueString = md5($uniqueString.$uniqueHelper); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | return $this->append($uniqueString); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | { |
150 | 150 | // init |
151 | 151 | $i = 0; |
152 | - $length = (int)$length; |
|
152 | + $length = (int) $length; |
|
153 | 153 | $str = $this->str; |
154 | 154 | $maxlength = UTF8::strlen($possibleChars, $this->encoding); |
155 | 155 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function indexOf($needle, $offset = 0) |
227 | 227 | { |
228 | - return UTF8::strpos($this->str, (string)$needle, (int)$offset, $this->encoding); |
|
228 | + return UTF8::strpos($this->str, (string) $needle, (int) $offset, $this->encoding); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function indexOfIgnoreCase($needle, $offset = 0) |
242 | 242 | { |
243 | - return UTF8::stripos($this->str, (string)$needle, (int)$offset, $this->encoding); |
|
243 | + return UTF8::stripos($this->str, (string) $needle, (int) $offset, $this->encoding); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | } |
329 | 329 | |
330 | 330 | $str = preg_replace( |
331 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
331 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
332 | 332 | $replacement, |
333 | 333 | $this->str |
334 | 334 | ); |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | $stringy = static::create($this->str, $this->encoding); |
490 | 490 | |
491 | 491 | if (!$stringy->startsWith($substring)) { |
492 | - $stringy->str = $substring . $stringy->str; |
|
492 | + $stringy->str = $substring.$stringy->str; |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | return $stringy; |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | $endOfStr = UTF8::strtolower($endOfStr, $this->encoding); |
588 | 588 | } |
589 | 589 | |
590 | - return (string)$substring === $endOfStr; |
|
590 | + return (string) $substring === $endOfStr; |
|
591 | 591 | } |
592 | 592 | |
593 | 593 | /** |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | */ |
708 | 708 | protected function matchesPattern($pattern) |
709 | 709 | { |
710 | - if (preg_match('/' . $pattern . '/u', $this->str)) { |
|
710 | + if (preg_match('/'.$pattern.'/u', $this->str)) { |
|
711 | 711 | return true; |
712 | 712 | } |
713 | 713 | |
@@ -872,7 +872,7 @@ discard block |
||
872 | 872 | $this->encoding |
873 | 873 | ); |
874 | 874 | |
875 | - $str = UTF8::strtoupper($first, $this->encoding) . $rest; |
|
875 | + $str = UTF8::strtoupper($first, $this->encoding).$rest; |
|
876 | 876 | |
877 | 877 | return static::create($str, $this->encoding); |
878 | 878 | } |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | */ |
891 | 891 | public function indexOfLast($needle, $offset = 0) |
892 | 892 | { |
893 | - return UTF8::strrpos($this->str, (string)$needle, (int)$offset, $this->encoding); |
|
893 | + return UTF8::strrpos($this->str, (string) $needle, (int) $offset, $this->encoding); |
|
894 | 894 | } |
895 | 895 | |
896 | 896 | /** |
@@ -906,7 +906,7 @@ discard block |
||
906 | 906 | */ |
907 | 907 | public function indexOfLastIgnoreCase($needle, $offset = 0) |
908 | 908 | { |
909 | - return UTF8::strripos($this->str, (string)$needle, (int)$offset, $this->encoding); |
|
909 | + return UTF8::strripos($this->str, (string) $needle, (int) $offset, $this->encoding); |
|
910 | 910 | } |
911 | 911 | |
912 | 912 | /** |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | $start = UTF8::substr($stringy->str, 0, $index, $stringy->encoding); |
928 | 928 | $end = UTF8::substr($stringy->str, $index, $stringy->length(), $stringy->encoding); |
929 | 929 | |
930 | - $stringy->str = $start . $substring . $end; |
|
930 | + $stringy->str = $start.$substring.$end; |
|
931 | 931 | |
932 | 932 | return $stringy; |
933 | 933 | } |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | $quotedPattern = preg_quote($pattern, '/'); |
954 | 954 | $replaceWildCards = str_replace('\*', '.*', $quotedPattern); |
955 | 955 | |
956 | - return $this->matchesPattern('^' . $replaceWildCards . '\z'); |
|
956 | + return $this->matchesPattern('^'.$replaceWildCards.'\z'); |
|
957 | 957 | } |
958 | 958 | |
959 | 959 | /** |
@@ -1185,7 +1185,7 @@ discard block |
||
1185 | 1185 | $char = UTF8::substr($this->str, -$i, 1, $encoding); |
1186 | 1186 | |
1187 | 1187 | if ($char == UTF8::substr($otherStr, -$i, 1, $encoding)) { |
1188 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
1188 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
1189 | 1189 | } else { |
1190 | 1190 | break; |
1191 | 1191 | } |
@@ -1260,7 +1260,7 @@ discard block |
||
1260 | 1260 | { |
1261 | 1261 | // init |
1262 | 1262 | $length = $this->length(); |
1263 | - $offset = (int)$offset; |
|
1263 | + $offset = (int) $offset; |
|
1264 | 1264 | |
1265 | 1265 | if ($offset >= 0) { |
1266 | 1266 | return ($length > $offset); |
@@ -1284,7 +1284,7 @@ discard block |
||
1284 | 1284 | public function offsetGet($offset) |
1285 | 1285 | { |
1286 | 1286 | // init |
1287 | - $offset = (int)$offset; |
|
1287 | + $offset = (int) $offset; |
|
1288 | 1288 | $length = $this->length(); |
1289 | 1289 | |
1290 | 1290 | if ( |
@@ -1346,7 +1346,7 @@ discard block |
||
1346 | 1346 | { |
1347 | 1347 | if (!in_array($padType, array('left', 'right', 'both'), true)) { |
1348 | 1348 | throw new \InvalidArgumentException( |
1349 | - 'Pad expects $padType ' . "to be one of 'left', 'right' or 'both'" |
|
1349 | + 'Pad expects $padType '."to be one of 'left', 'right' or 'both'" |
|
1350 | 1350 | ); |
1351 | 1351 | } |
1352 | 1352 | |
@@ -1417,7 +1417,7 @@ discard block |
||
1417 | 1417 | $stringy->encoding |
1418 | 1418 | ); |
1419 | 1419 | |
1420 | - $stringy->str = $leftPadding . $stringy->str . $rightPadding; |
|
1420 | + $stringy->str = $leftPadding.$stringy->str.$rightPadding; |
|
1421 | 1421 | |
1422 | 1422 | return $stringy; |
1423 | 1423 | } |
@@ -1461,7 +1461,7 @@ discard block |
||
1461 | 1461 | */ |
1462 | 1462 | public function prepend($string) |
1463 | 1463 | { |
1464 | - return static::create($string . $this->str, $this->encoding); |
|
1464 | + return static::create($string.$this->str, $this->encoding); |
|
1465 | 1465 | } |
1466 | 1466 | |
1467 | 1467 | /** |
@@ -1568,7 +1568,7 @@ discard block |
||
1568 | 1568 | */ |
1569 | 1569 | public function replaceBeginning($search, $replacement) |
1570 | 1570 | { |
1571 | - $str = $this->regexReplace('^' . preg_quote($search, '/'), UTF8::str_replace('\\', '\\\\', $replacement)); |
|
1571 | + $str = $this->regexReplace('^'.preg_quote($search, '/'), UTF8::str_replace('\\', '\\\\', $replacement)); |
|
1572 | 1572 | |
1573 | 1573 | return static::create($str, $this->encoding); |
1574 | 1574 | } |
@@ -1583,7 +1583,7 @@ discard block |
||
1583 | 1583 | */ |
1584 | 1584 | public function replaceEnding($search, $replacement) |
1585 | 1585 | { |
1586 | - $str = $this->regexReplace(preg_quote($search, '/') . '$', UTF8::str_replace('\\', '\\\\', $replacement)); |
|
1586 | + $str = $this->regexReplace(preg_quote($search, '/').'$', UTF8::str_replace('\\', '\\\\', $replacement)); |
|
1587 | 1587 | |
1588 | 1588 | return static::create($str, $this->encoding); |
1589 | 1589 | } |
@@ -1724,7 +1724,7 @@ discard block |
||
1724 | 1724 | } |
1725 | 1725 | } |
1726 | 1726 | |
1727 | - $stringy->str = $truncated . $substring; |
|
1727 | + $stringy->str = $truncated.$substring; |
|
1728 | 1728 | |
1729 | 1729 | return $stringy; |
1730 | 1730 | } |
@@ -1846,7 +1846,7 @@ discard block |
||
1846 | 1846 | $trimChars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1847 | 1847 | |
1848 | 1848 | if ($length === null) { |
1849 | - $length = (int)round($this->length() / 2, 0); |
|
1849 | + $length = (int) round($this->length() / 2, 0); |
|
1850 | 1850 | } |
1851 | 1851 | |
1852 | 1852 | if (empty($search)) { |
@@ -1866,7 +1866,7 @@ discard block |
||
1866 | 1866 | rtrim( |
1867 | 1867 | UTF8::substr($text, 0, $pos, $this->encoding), |
1868 | 1868 | $trimChars |
1869 | - ) . $replacerForSkippedText, |
|
1869 | + ).$replacerForSkippedText, |
|
1870 | 1870 | $this->encoding |
1871 | 1871 | ); |
1872 | 1872 | } |
@@ -1879,7 +1879,7 @@ discard block |
||
1879 | 1879 | $search, |
1880 | 1880 | $this->encoding |
1881 | 1881 | ); |
1882 | - $halfSide = (int)($wordPos - $length / 2 + UTF8::strlen($search, $this->encoding) / 2); |
|
1882 | + $halfSide = (int) ($wordPos - $length / 2 + UTF8::strlen($search, $this->encoding) / 2); |
|
1883 | 1883 | |
1884 | 1884 | if ($halfSide > 0) { |
1885 | 1885 | |
@@ -1908,7 +1908,7 @@ discard block |
||
1908 | 1908 | ) - $pos_start; |
1909 | 1909 | |
1910 | 1910 | if (!$pos_end || $pos_end <= 0) { |
1911 | - $extract = $replacerForSkippedText . ltrim( |
|
1911 | + $extract = $replacerForSkippedText.ltrim( |
|
1912 | 1912 | UTF8::substr( |
1913 | 1913 | $text, |
1914 | 1914 | $pos_start, |
@@ -1918,7 +1918,7 @@ discard block |
||
1918 | 1918 | $trimChars |
1919 | 1919 | ); |
1920 | 1920 | } else { |
1921 | - $extract = $replacerForSkippedText . trim( |
|
1921 | + $extract = $replacerForSkippedText.trim( |
|
1922 | 1922 | UTF8::substr( |
1923 | 1923 | $text, |
1924 | 1924 | $pos_start, |
@@ -1926,7 +1926,7 @@ discard block |
||
1926 | 1926 | $this->encoding |
1927 | 1927 | ), |
1928 | 1928 | $trimChars |
1929 | - ) . $replacerForSkippedText; |
|
1929 | + ).$replacerForSkippedText; |
|
1930 | 1930 | } |
1931 | 1931 | |
1932 | 1932 | } else { |
@@ -1947,7 +1947,7 @@ discard block |
||
1947 | 1947 | $extract = rtrim( |
1948 | 1948 | UTF8::substr($text, 0, $pos_end, $this->encoding), |
1949 | 1949 | $trimChars |
1950 | - ) . $replacerForSkippedText; |
|
1950 | + ).$replacerForSkippedText; |
|
1951 | 1951 | } else { |
1952 | 1952 | $extract = $text; |
1953 | 1953 | } |
@@ -2063,7 +2063,7 @@ discard block |
||
2063 | 2063 | $limit = -1; |
2064 | 2064 | } |
2065 | 2065 | |
2066 | - $array = preg_split('/' . preg_quote($pattern, '/') . '/u', $this->str, $limit); |
|
2066 | + $array = preg_split('/'.preg_quote($pattern, '/').'/u', $this->str, $limit); |
|
2067 | 2067 | |
2068 | 2068 | if ($limit > 0 && count($array) === $limit) { |
2069 | 2069 | array_pop($array); |
@@ -2136,14 +2136,14 @@ discard block |
||
2136 | 2136 | |
2137 | 2137 | $stringy->str = preg_replace_callback( |
2138 | 2138 | '/([\S]+)/u', |
2139 | - function ($match) use ($encoding, $ignore) { |
|
2139 | + function($match) use ($encoding, $ignore) { |
|
2140 | 2140 | if ($ignore && in_array($match[0], $ignore, true)) { |
2141 | 2141 | return $match[0]; |
2142 | 2142 | } |
2143 | 2143 | |
2144 | 2144 | $stringy = new Stringy($match[0], $encoding); |
2145 | 2145 | |
2146 | - return (string)$stringy->toLowerCase()->upperCaseFirst(); |
|
2146 | + return (string) $stringy->toLowerCase()->upperCaseFirst(); |
|
2147 | 2147 | }, |
2148 | 2148 | $stringy->str |
2149 | 2149 | ); |
@@ -2220,10 +2220,10 @@ discard block |
||
2220 | 2220 | } |
2221 | 2221 | |
2222 | 2222 | if (is_numeric($this->str)) { |
2223 | - return ((int)$this->str > 0); |
|
2223 | + return ((int) $this->str > 0); |
|
2224 | 2224 | } |
2225 | 2225 | |
2226 | - return (bool)$this->regexReplace('[[:space:]]', '')->str; |
|
2226 | + return (bool) $this->regexReplace('[[:space:]]', '')->str; |
|
2227 | 2227 | } |
2228 | 2228 | |
2229 | 2229 | /** |
@@ -2233,7 +2233,7 @@ discard block |
||
2233 | 2233 | */ |
2234 | 2234 | public function toString() |
2235 | 2235 | { |
2236 | - return (string)$this->str; |
|
2236 | + return (string) $this->str; |
|
2237 | 2237 | } |
2238 | 2238 | |
2239 | 2239 | /** |
@@ -2356,7 +2356,7 @@ discard block |
||
2356 | 2356 | $length -= $substringLength; |
2357 | 2357 | |
2358 | 2358 | $truncated = UTF8::substr($stringy->str, 0, $length, $stringy->encoding); |
2359 | - $stringy->str = $truncated . $substring; |
|
2359 | + $stringy->str = $truncated.$substring; |
|
2360 | 2360 | |
2361 | 2361 | return $stringy; |
2362 | 2362 | } |
@@ -2401,7 +2401,7 @@ discard block |
||
2401 | 2401 | |
2402 | 2402 | $stringy->str = preg_replace_callback( |
2403 | 2403 | '/[-_\s]+(.)?/u', |
2404 | - function ($match) use ($encoding) { |
|
2404 | + function($match) use ($encoding) { |
|
2405 | 2405 | if (isset($match[1])) { |
2406 | 2406 | return UTF8::strtoupper($match[1], $encoding); |
2407 | 2407 | } |
@@ -2413,7 +2413,7 @@ discard block |
||
2413 | 2413 | |
2414 | 2414 | $stringy->str = preg_replace_callback( |
2415 | 2415 | '/[\d]+(.)?/u', |
2416 | - function ($match) use ($encoding) { |
|
2416 | + function($match) use ($encoding) { |
|
2417 | 2417 | return UTF8::strtoupper($match[0], $encoding); |
2418 | 2418 | }, |
2419 | 2419 | $stringy->str |
@@ -2437,15 +2437,15 @@ discard block |
||
2437 | 2437 | |
2438 | 2438 | $str = preg_replace_callback( |
2439 | 2439 | '/([\d|A-Z])/u', |
2440 | - function ($matches) use ($encoding) { |
|
2440 | + function($matches) use ($encoding) { |
|
2441 | 2441 | $match = $matches[1]; |
2442 | - $matchInt = (int)$match; |
|
2442 | + $matchInt = (int) $match; |
|
2443 | 2443 | |
2444 | 2444 | if ("$matchInt" == $match) { |
2445 | - return '_' . $match . '_'; |
|
2445 | + return '_'.$match.'_'; |
|
2446 | 2446 | } |
2447 | 2447 | |
2448 | - return '_' . UTF8::strtolower($match, $encoding); |
|
2448 | + return '_'.UTF8::strtolower($match, $encoding); |
|
2449 | 2449 | }, |
2450 | 2450 | $str |
2451 | 2451 | ); |
@@ -2453,9 +2453,9 @@ discard block |
||
2453 | 2453 | $str = preg_replace( |
2454 | 2454 | array( |
2455 | 2455 | |
2456 | - '/\s+/', // convert spaces to "_" |
|
2457 | - '/^\s+|\s+$/', // trim leading & trailing spaces |
|
2458 | - '/_+/', // remove double "_" |
|
2456 | + '/\s+/', // convert spaces to "_" |
|
2457 | + '/^\s+|\s+$/', // trim leading & trailing spaces |
|
2458 | + '/_+/', // remove double "_" |
|
2459 | 2459 | ), |
2460 | 2460 | array( |
2461 | 2461 | '_', |
@@ -2481,7 +2481,7 @@ discard block |
||
2481 | 2481 | $first = UTF8::substr($this->str, 0, 1, $this->encoding); |
2482 | 2482 | $rest = UTF8::substr($this->str, 1, $this->length() - 1, $this->encoding); |
2483 | 2483 | |
2484 | - $str = UTF8::strtolower($first, $this->encoding) . $rest; |
|
2484 | + $str = UTF8::strtolower($first, $this->encoding).$rest; |
|
2485 | 2485 | |
2486 | 2486 | return static::create($str, $this->encoding); |
2487 | 2487 | } |
@@ -2819,7 +2819,7 @@ discard block |
||
2819 | 2819 | $restOfWord = UTF8::substr($word, 1, null, $encoding); |
2820 | 2820 | $firstCharacterUppercased = UTF8::strtoupper($firstCharacter, $encoding); |
2821 | 2821 | |
2822 | - return new static($firstCharacterUppercased . $restOfWord, $encoding); |
|
2822 | + return new static($firstCharacterUppercased.$restOfWord, $encoding); |
|
2823 | 2823 | } |
2824 | 2824 | |
2825 | 2825 | /** |
@@ -2833,7 +2833,7 @@ discard block |
||
2833 | 2833 | protected function capitalizePersonalNameByDelimiter($names, $delimiter) |
2834 | 2834 | { |
2835 | 2835 | // init |
2836 | - $names = explode((string)$delimiter, (string)$names); |
|
2836 | + $names = explode((string) $delimiter, (string) $names); |
|
2837 | 2837 | $encoding = $this->encoding; |
2838 | 2838 | |
2839 | 2839 | $specialCases = array( |