@@ -136,7 +136,7 @@ |
||
136 | 136 | } |
137 | 137 | |
138 | 138 | if (!isset(static::$methodArgs[$name])) { |
139 | - throw new \BadMethodCallException($name . ' is not a valid method'); |
|
139 | + throw new \BadMethodCallException($name.' is not a valid method'); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | $numArgs = count($arguments); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | // init |
62 | 62 | UTF8::checkForSupport(); |
63 | - $this->str = (string)$str; |
|
63 | + $this->str = (string) $str; |
|
64 | 64 | |
65 | 65 | if ($encoding) { |
66 | 66 | $this->encoding = $encoding; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function append($string) |
97 | 97 | { |
98 | - return static::create($this->str . $string, $this->encoding); |
|
98 | + return static::create($this->str.$string, $this->encoding); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function indexOf($needle, $offset = 0) |
158 | 158 | { |
159 | - return UTF8::strpos($this->str, (string)$needle, (int)$offset, $this->encoding); |
|
159 | + return UTF8::strpos($this->str, (string) $needle, (int) $offset, $this->encoding); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | } |
239 | 239 | |
240 | 240 | $str = preg_replace( |
241 | - '/' . $pattern . '/u' . $options, |
|
241 | + '/'.$pattern.'/u'.$options, |
|
242 | 242 | $replacement, |
243 | 243 | $this->str |
244 | 244 | ); |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | $stringy = static::create($this->str, $this->encoding); |
400 | 400 | |
401 | 401 | if (!$stringy->startsWith($substring)) { |
402 | - $stringy->str = $substring . $stringy->str; |
|
402 | + $stringy->str = $substring.$stringy->str; |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | return $stringy; |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | $startOfStr = UTF8::strtolower($startOfStr, $this->encoding); |
429 | 429 | } |
430 | 430 | |
431 | - return (string)$substring === $startOfStr; |
|
431 | + return (string) $substring === $startOfStr; |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | /** |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | $endOfStr = UTF8::strtolower($endOfStr, $this->encoding); |
478 | 478 | } |
479 | 479 | |
480 | - return (string)$substring === $endOfStr; |
|
480 | + return (string) $substring === $endOfStr; |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | /** |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | */ |
574 | 574 | private function matchesPattern($pattern) |
575 | 575 | { |
576 | - if (preg_match('/' . $pattern . '/u', $this->str)) { |
|
576 | + if (preg_match('/'.$pattern.'/u', $this->str)) { |
|
577 | 577 | return true; |
578 | 578 | } else { |
579 | 579 | return false; |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | $this->encoding |
648 | 648 | ); |
649 | 649 | |
650 | - $str = UTF8::strtoupper($first, $this->encoding) . $rest; |
|
650 | + $str = UTF8::strtoupper($first, $this->encoding).$rest; |
|
651 | 651 | |
652 | 652 | return static::create($str, $this->encoding); |
653 | 653 | } |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | */ |
666 | 666 | public function indexOfLast($needle, $offset = 0) |
667 | 667 | { |
668 | - return UTF8::strrpos($this->str, (string)$needle, (int)$offset, $this->encoding); |
|
668 | + return UTF8::strrpos($this->str, (string) $needle, (int) $offset, $this->encoding); |
|
669 | 669 | } |
670 | 670 | |
671 | 671 | /** |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | $stringy->encoding |
690 | 690 | ); |
691 | 691 | |
692 | - $stringy->str = $start . $substring . $end; |
|
692 | + $stringy->str = $start.$substring.$end; |
|
693 | 693 | |
694 | 694 | return $stringy; |
695 | 695 | } |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | $char = UTF8::substr($this->str, -$i, 1, $encoding); |
891 | 891 | |
892 | 892 | if ($char == UTF8::substr($otherStr, -$i, 1, $encoding)) { |
893 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
893 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
894 | 894 | } else { |
895 | 895 | break; |
896 | 896 | } |
@@ -965,7 +965,7 @@ discard block |
||
965 | 965 | { |
966 | 966 | // init |
967 | 967 | $length = $this->length(); |
968 | - $offset = (int)$offset; |
|
968 | + $offset = (int) $offset; |
|
969 | 969 | |
970 | 970 | if ($offset >= 0) { |
971 | 971 | return ($length > $offset); |
@@ -989,7 +989,7 @@ discard block |
||
989 | 989 | public function offsetGet($offset) |
990 | 990 | { |
991 | 991 | // init |
992 | - $offset = (int)$offset; |
|
992 | + $offset = (int) $offset; |
|
993 | 993 | $length = $this->length(); |
994 | 994 | |
995 | 995 | if ( |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | { |
1051 | 1051 | if (!in_array($padType, array('left', 'right', 'both'), true)) { |
1052 | 1052 | throw new \InvalidArgumentException( |
1053 | - 'Pad expects $padType ' . "to be one of 'left', 'right' or 'both'" |
|
1053 | + 'Pad expects $padType '."to be one of 'left', 'right' or 'both'" |
|
1054 | 1054 | ); |
1055 | 1055 | } |
1056 | 1056 | |
@@ -1121,7 +1121,7 @@ discard block |
||
1121 | 1121 | $stringy->encoding |
1122 | 1122 | ); |
1123 | 1123 | |
1124 | - $stringy->str = $leftPadding . $stringy->str . $rightPadding; |
|
1124 | + $stringy->str = $leftPadding.$stringy->str.$rightPadding; |
|
1125 | 1125 | |
1126 | 1126 | return $stringy; |
1127 | 1127 | } |
@@ -1165,7 +1165,7 @@ discard block |
||
1165 | 1165 | */ |
1166 | 1166 | public function prepend($string) |
1167 | 1167 | { |
1168 | - return static::create($string . $this->str, $this->encoding); |
|
1168 | + return static::create($string.$this->str, $this->encoding); |
|
1169 | 1169 | } |
1170 | 1170 | |
1171 | 1171 | /** |
@@ -1272,7 +1272,7 @@ discard block |
||
1272 | 1272 | */ |
1273 | 1273 | public function replaceBeginning($search, $replacement) |
1274 | 1274 | { |
1275 | - $str = $this->regexReplace('^' . preg_quote($search, '/'), UTF8::str_replace('\\', '\\\\', $replacement)); |
|
1275 | + $str = $this->regexReplace('^'.preg_quote($search, '/'), UTF8::str_replace('\\', '\\\\', $replacement)); |
|
1276 | 1276 | |
1277 | 1277 | return static::create($str, $this->encoding); |
1278 | 1278 | } |
@@ -1287,7 +1287,7 @@ discard block |
||
1287 | 1287 | */ |
1288 | 1288 | public function replaceEnding($search, $replacement) |
1289 | 1289 | { |
1290 | - $str = $this->regexReplace(preg_quote($search, '/') . '$', UTF8::str_replace('\\', '\\\\', $replacement)); |
|
1290 | + $str = $this->regexReplace(preg_quote($search, '/').'$', UTF8::str_replace('\\', '\\\\', $replacement)); |
|
1291 | 1291 | |
1292 | 1292 | return static::create($str, $this->encoding); |
1293 | 1293 | } |
@@ -1336,7 +1336,7 @@ discard block |
||
1336 | 1336 | $truncated = UTF8::substr($truncated, 0, $lastPos, $encoding); |
1337 | 1337 | } |
1338 | 1338 | |
1339 | - $stringy->str = $truncated . $substring; |
|
1339 | + $stringy->str = $truncated.$substring; |
|
1340 | 1340 | |
1341 | 1341 | return $stringy; |
1342 | 1342 | } |
@@ -1377,13 +1377,13 @@ discard block |
||
1377 | 1377 | */ |
1378 | 1378 | public function appendUniqueIdentifier($extraPrefix = '') |
1379 | 1379 | { |
1380 | - $prefix = mt_rand() . |
|
1381 | - session_id() . |
|
1382 | - (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '') . |
|
1383 | - (isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '') . |
|
1380 | + $prefix = mt_rand(). |
|
1381 | + session_id(). |
|
1382 | + (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''). |
|
1383 | + (isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : ''). |
|
1384 | 1384 | $extraPrefix; |
1385 | 1385 | |
1386 | - return $this->str .= md5(uniqid($prefix, true) . $prefix); |
|
1386 | + return $this->str .= md5(uniqid($prefix, true).$prefix); |
|
1387 | 1387 | } |
1388 | 1388 | |
1389 | 1389 | /** |
@@ -1398,7 +1398,7 @@ discard block |
||
1398 | 1398 | { |
1399 | 1399 | // init |
1400 | 1400 | $i = 0; |
1401 | - $length = (int)$length; |
|
1401 | + $length = (int) $length; |
|
1402 | 1402 | $maxlength = UTF8::strlen($possibleChars); |
1403 | 1403 | |
1404 | 1404 | if ($maxlength === 0) { |
@@ -1590,7 +1590,7 @@ discard block |
||
1590 | 1590 | $limit = -1; |
1591 | 1591 | } |
1592 | 1592 | |
1593 | - $array = preg_split('/' . preg_quote($pattern, '/') . '/u', $this->str, $limit); |
|
1593 | + $array = preg_split('/'.preg_quote($pattern, '/').'/u', $this->str, $limit); |
|
1594 | 1594 | |
1595 | 1595 | if ($limit > 0 && count($array) === $limit) { |
1596 | 1596 | array_pop($array); |
@@ -1664,13 +1664,13 @@ discard block |
||
1664 | 1664 | |
1665 | 1665 | $stringy->str = preg_replace_callback( |
1666 | 1666 | '/([\S]+)/u', |
1667 | - function ($match) use ($encoding, $ignore) { |
|
1667 | + function($match) use ($encoding, $ignore) { |
|
1668 | 1668 | if ($ignore && in_array($match[0], $ignore, true)) { |
1669 | 1669 | return $match[0]; |
1670 | 1670 | } else { |
1671 | 1671 | $stringy = new Stringy($match[0], $encoding); |
1672 | 1672 | |
1673 | - return (string)$stringy->toLowerCase()->upperCaseFirst(); |
|
1673 | + return (string) $stringy->toLowerCase()->upperCaseFirst(); |
|
1674 | 1674 | } |
1675 | 1675 | }, |
1676 | 1676 | $stringy->str |
@@ -1744,9 +1744,9 @@ discard block |
||
1744 | 1744 | if (array_key_exists($key, $map)) { |
1745 | 1745 | return $map[$key]; |
1746 | 1746 | } elseif (is_numeric($this->str)) { |
1747 | - return ((int)$this->str > 0); |
|
1747 | + return ((int) $this->str > 0); |
|
1748 | 1748 | } else { |
1749 | - return (bool)$this->regexReplace('[[:space:]]', '')->str; |
|
1749 | + return (bool) $this->regexReplace('[[:space:]]', '')->str; |
|
1750 | 1750 | } |
1751 | 1751 | } |
1752 | 1752 | |
@@ -1757,7 +1757,7 @@ discard block |
||
1757 | 1757 | */ |
1758 | 1758 | public function toString() |
1759 | 1759 | { |
1760 | - return (string)$this->str; |
|
1760 | + return (string) $this->str; |
|
1761 | 1761 | } |
1762 | 1762 | |
1763 | 1763 | /** |
@@ -1881,7 +1881,7 @@ discard block |
||
1881 | 1881 | $length -= $substringLength; |
1882 | 1882 | |
1883 | 1883 | $truncated = UTF8::substr($stringy->str, 0, $length, $stringy->encoding); |
1884 | - $stringy->str = $truncated . $substring; |
|
1884 | + $stringy->str = $truncated.$substring; |
|
1885 | 1885 | |
1886 | 1886 | return $stringy; |
1887 | 1887 | } |
@@ -1926,7 +1926,7 @@ discard block |
||
1926 | 1926 | |
1927 | 1927 | $stringy->str = preg_replace_callback( |
1928 | 1928 | '/[-_\s]+(.)?/u', |
1929 | - function ($match) use ($encoding) { |
|
1929 | + function($match) use ($encoding) { |
|
1930 | 1930 | if (isset($match[1])) { |
1931 | 1931 | return UTF8::strtoupper($match[1], $encoding); |
1932 | 1932 | } else { |
@@ -1938,7 +1938,7 @@ discard block |
||
1938 | 1938 | |
1939 | 1939 | $stringy->str = preg_replace_callback( |
1940 | 1940 | '/[\d]+(.)?/u', |
1941 | - function ($match) use ($encoding) { |
|
1941 | + function($match) use ($encoding) { |
|
1942 | 1942 | return UTF8::strtoupper($match[0], $encoding); |
1943 | 1943 | }, |
1944 | 1944 | $stringy->str |
@@ -1961,14 +1961,14 @@ discard block |
||
1961 | 1961 | |
1962 | 1962 | $str = preg_replace_callback( |
1963 | 1963 | '/([\d|A-Z])/u', |
1964 | - function ($matches) { |
|
1964 | + function($matches) { |
|
1965 | 1965 | $match = $matches[1]; |
1966 | - $matchInt = (int)$match; |
|
1966 | + $matchInt = (int) $match; |
|
1967 | 1967 | |
1968 | 1968 | if ("$matchInt" == $match) { |
1969 | - return '_' . $match . '_'; |
|
1969 | + return '_'.$match.'_'; |
|
1970 | 1970 | } else { |
1971 | - return '_' . UTF8::strtolower($match); |
|
1971 | + return '_'.UTF8::strtolower($match); |
|
1972 | 1972 | } |
1973 | 1973 | }, |
1974 | 1974 | $str |
@@ -1977,9 +1977,9 @@ discard block |
||
1977 | 1977 | $str = preg_replace( |
1978 | 1978 | array( |
1979 | 1979 | |
1980 | - '/\s+/', // convert spaces to "_" |
|
1981 | - '/^\s+|\s+$/', // trim leading & trailing spaces |
|
1982 | - '/_+/', // remove double "_" |
|
1980 | + '/\s+/', // convert spaces to "_" |
|
1981 | + '/^\s+|\s+$/', // trim leading & trailing spaces |
|
1982 | + '/_+/', // remove double "_" |
|
1983 | 1983 | ), |
1984 | 1984 | array( |
1985 | 1985 | '_', |
@@ -2008,7 +2008,7 @@ discard block |
||
2008 | 2008 | $this->encoding |
2009 | 2009 | ); |
2010 | 2010 | |
2011 | - $str = UTF8::strtolower($first, $this->encoding) . $rest; |
|
2011 | + $str = UTF8::strtolower($first, $this->encoding).$rest; |
|
2012 | 2012 | |
2013 | 2013 | return static::create($str, $this->encoding); |
2014 | 2014 | } |