@@ -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); |
@@ -1579,9 +1579,9 @@ discard block |
||
1579 | 1579 | } |
1580 | 1580 | |
1581 | 1581 | $pos_end = min( |
1582 | - UTF8::strpos($text, ' ', $l, $this->encoding), |
|
1583 | - UTF8::strpos($text, '.', $l, $this->encoding) |
|
1584 | - ) - $pos_start; |
|
1582 | + UTF8::strpos($text, ' ', $l, $this->encoding), |
|
1583 | + UTF8::strpos($text, '.', $l, $this->encoding) |
|
1584 | + ) - $pos_start; |
|
1585 | 1585 | |
1586 | 1586 | if (!$pos_end || $pos_end <= 0) { |
1587 | 1587 | $extract = $ellipsis . ltrim( |
@@ -1621,9 +1621,9 @@ discard block |
||
1621 | 1621 | |
1622 | 1622 | if ($pos_end) { |
1623 | 1623 | $extract = rtrim( |
1624 | - UTF8::substr($text, 0, $pos_end, $this->encoding), |
|
1625 | - $trimChars |
|
1626 | - ) . $ellipsis; |
|
1624 | + UTF8::substr($text, 0, $pos_end, $this->encoding), |
|
1625 | + $trimChars |
|
1626 | + ) . $ellipsis; |
|
1627 | 1627 | } else { |
1628 | 1628 | $extract = $text; |
1629 | 1629 | } |
@@ -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 | /** |
@@ -121,13 +121,13 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function appendUniqueIdentifier($extraPrefix = '') |
123 | 123 | { |
124 | - $prefix = mt_rand() . |
|
125 | - session_id() . |
|
126 | - (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '') . |
|
127 | - (isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '') . |
|
124 | + $prefix = mt_rand(). |
|
125 | + session_id(). |
|
126 | + (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''). |
|
127 | + (isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : ''). |
|
128 | 128 | $extraPrefix; |
129 | 129 | |
130 | - return $this->append(md5(uniqid($prefix, true) . $prefix)); |
|
130 | + return $this->append(md5(uniqid($prefix, true).$prefix)); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | { |
143 | 143 | // init |
144 | 144 | $i = 0; |
145 | - $length = (int)$length; |
|
145 | + $length = (int) $length; |
|
146 | 146 | $str = $this->str; |
147 | 147 | $maxlength = UTF8::strlen($possibleChars, $this->encoding); |
148 | 148 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | */ |
219 | 219 | public function indexOf($needle, $offset = 0) |
220 | 220 | { |
221 | - return UTF8::strpos($this->str, (string)$needle, (int)$offset, $this->encoding); |
|
221 | + return UTF8::strpos($this->str, (string) $needle, (int) $offset, $this->encoding); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | /** |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | $str = preg_replace( |
303 | - '/' . $pattern . '/u' . $options, |
|
303 | + '/'.$pattern.'/u'.$options, |
|
304 | 304 | $replacement, |
305 | 305 | $this->str |
306 | 306 | ); |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | $stringy = static::create($this->str, $this->encoding); |
462 | 462 | |
463 | 463 | if (!$stringy->startsWith($substring)) { |
464 | - $stringy->str = $substring . $stringy->str; |
|
464 | + $stringy->str = $substring.$stringy->str; |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | return $stringy; |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | $endOfStr = UTF8::strtolower($endOfStr, $this->encoding); |
536 | 536 | } |
537 | 537 | |
538 | - return (string)$substring === $endOfStr; |
|
538 | + return (string) $substring === $endOfStr; |
|
539 | 539 | } |
540 | 540 | |
541 | 541 | /** |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | */ |
632 | 632 | private function matchesPattern($pattern) |
633 | 633 | { |
634 | - if (preg_match('/' . $pattern . '/u', $this->str)) { |
|
634 | + if (preg_match('/'.$pattern.'/u', $this->str)) { |
|
635 | 635 | return true; |
636 | 636 | } else { |
637 | 637 | return false; |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | $this->encoding |
706 | 706 | ); |
707 | 707 | |
708 | - $str = UTF8::strtoupper($first, $this->encoding) . $rest; |
|
708 | + $str = UTF8::strtoupper($first, $this->encoding).$rest; |
|
709 | 709 | |
710 | 710 | return static::create($str, $this->encoding); |
711 | 711 | } |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | */ |
724 | 724 | public function indexOfLast($needle, $offset = 0) |
725 | 725 | { |
726 | - return UTF8::strrpos($this->str, (string)$needle, (int)$offset, $this->encoding); |
|
726 | + return UTF8::strrpos($this->str, (string) $needle, (int) $offset, $this->encoding); |
|
727 | 727 | } |
728 | 728 | |
729 | 729 | /** |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | $start = UTF8::substr($stringy->str, 0, $index, $stringy->encoding); |
745 | 745 | $end = UTF8::substr($stringy->str, $index, $stringy->length(), $stringy->encoding); |
746 | 746 | |
747 | - $stringy->str = $start . $substring . $end; |
|
747 | + $stringy->str = $start.$substring.$end; |
|
748 | 748 | |
749 | 749 | return $stringy; |
750 | 750 | } |
@@ -968,7 +968,7 @@ discard block |
||
968 | 968 | $char = UTF8::substr($this->str, -$i, 1, $encoding); |
969 | 969 | |
970 | 970 | if ($char == UTF8::substr($otherStr, -$i, 1, $encoding)) { |
971 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
971 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
972 | 972 | } else { |
973 | 973 | break; |
974 | 974 | } |
@@ -1043,7 +1043,7 @@ discard block |
||
1043 | 1043 | { |
1044 | 1044 | // init |
1045 | 1045 | $length = $this->length(); |
1046 | - $offset = (int)$offset; |
|
1046 | + $offset = (int) $offset; |
|
1047 | 1047 | |
1048 | 1048 | if ($offset >= 0) { |
1049 | 1049 | return ($length > $offset); |
@@ -1067,7 +1067,7 @@ discard block |
||
1067 | 1067 | public function offsetGet($offset) |
1068 | 1068 | { |
1069 | 1069 | // init |
1070 | - $offset = (int)$offset; |
|
1070 | + $offset = (int) $offset; |
|
1071 | 1071 | $length = $this->length(); |
1072 | 1072 | |
1073 | 1073 | if ( |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | { |
1129 | 1129 | if (!in_array($padType, array('left', 'right', 'both'), true)) { |
1130 | 1130 | throw new \InvalidArgumentException( |
1131 | - 'Pad expects $padType ' . "to be one of 'left', 'right' or 'both'" |
|
1131 | + 'Pad expects $padType '."to be one of 'left', 'right' or 'both'" |
|
1132 | 1132 | ); |
1133 | 1133 | } |
1134 | 1134 | |
@@ -1199,7 +1199,7 @@ discard block |
||
1199 | 1199 | $stringy->encoding |
1200 | 1200 | ); |
1201 | 1201 | |
1202 | - $stringy->str = $leftPadding . $stringy->str . $rightPadding; |
|
1202 | + $stringy->str = $leftPadding.$stringy->str.$rightPadding; |
|
1203 | 1203 | |
1204 | 1204 | return $stringy; |
1205 | 1205 | } |
@@ -1243,7 +1243,7 @@ discard block |
||
1243 | 1243 | */ |
1244 | 1244 | public function prepend($string) |
1245 | 1245 | { |
1246 | - return static::create($string . $this->str, $this->encoding); |
|
1246 | + return static::create($string.$this->str, $this->encoding); |
|
1247 | 1247 | } |
1248 | 1248 | |
1249 | 1249 | /** |
@@ -1350,7 +1350,7 @@ discard block |
||
1350 | 1350 | */ |
1351 | 1351 | public function replaceBeginning($search, $replacement) |
1352 | 1352 | { |
1353 | - $str = $this->regexReplace('^' . preg_quote($search, '/'), UTF8::str_replace('\\', '\\\\', $replacement)); |
|
1353 | + $str = $this->regexReplace('^'.preg_quote($search, '/'), UTF8::str_replace('\\', '\\\\', $replacement)); |
|
1354 | 1354 | |
1355 | 1355 | return static::create($str, $this->encoding); |
1356 | 1356 | } |
@@ -1365,7 +1365,7 @@ discard block |
||
1365 | 1365 | */ |
1366 | 1366 | public function replaceEnding($search, $replacement) |
1367 | 1367 | { |
1368 | - $str = $this->regexReplace(preg_quote($search, '/') . '$', UTF8::str_replace('\\', '\\\\', $replacement)); |
|
1368 | + $str = $this->regexReplace(preg_quote($search, '/').'$', UTF8::str_replace('\\', '\\\\', $replacement)); |
|
1369 | 1369 | |
1370 | 1370 | return static::create($str, $this->encoding); |
1371 | 1371 | } |
@@ -1414,7 +1414,7 @@ discard block |
||
1414 | 1414 | $truncated = UTF8::substr($truncated, 0, $lastPos, $encoding); |
1415 | 1415 | } |
1416 | 1416 | |
1417 | - $stringy->str = $truncated . $substring; |
|
1417 | + $stringy->str = $truncated.$substring; |
|
1418 | 1418 | |
1419 | 1419 | return $stringy; |
1420 | 1420 | } |
@@ -1539,7 +1539,7 @@ discard block |
||
1539 | 1539 | rtrim( |
1540 | 1540 | UTF8::substr($text, 0, $pos, $this->encoding), |
1541 | 1541 | $trimChars |
1542 | - ) . $ellipsis, |
|
1542 | + ).$ellipsis, |
|
1543 | 1543 | $this->encoding |
1544 | 1544 | ); |
1545 | 1545 | } else { |
@@ -1554,7 +1554,7 @@ discard block |
||
1554 | 1554 | null, |
1555 | 1555 | $this->encoding |
1556 | 1556 | ); |
1557 | - $halfSide = (int)($wordPos - $length / 2 + UTF8::strlen($search, $this->encoding) / 2); |
|
1557 | + $halfSide = (int) ($wordPos - $length / 2 + UTF8::strlen($search, $this->encoding) / 2); |
|
1558 | 1558 | |
1559 | 1559 | if ($halfSide > 0) { |
1560 | 1560 | |
@@ -1583,7 +1583,7 @@ discard block |
||
1583 | 1583 | ) - $pos_start; |
1584 | 1584 | |
1585 | 1585 | if (!$pos_end || $pos_end <= 0) { |
1586 | - $extract = $ellipsis . ltrim( |
|
1586 | + $extract = $ellipsis.ltrim( |
|
1587 | 1587 | UTF8::substr( |
1588 | 1588 | $text, |
1589 | 1589 | $pos_start, |
@@ -1593,7 +1593,7 @@ discard block |
||
1593 | 1593 | $trimChars |
1594 | 1594 | ); |
1595 | 1595 | } else { |
1596 | - $extract = $ellipsis . trim( |
|
1596 | + $extract = $ellipsis.trim( |
|
1597 | 1597 | UTF8::substr( |
1598 | 1598 | $text, |
1599 | 1599 | $pos_start, |
@@ -1601,7 +1601,7 @@ discard block |
||
1601 | 1601 | $this->encoding |
1602 | 1602 | ), |
1603 | 1603 | $trimChars |
1604 | - ) . $ellipsis; |
|
1604 | + ).$ellipsis; |
|
1605 | 1605 | } |
1606 | 1606 | |
1607 | 1607 | } else { |
@@ -1622,7 +1622,7 @@ discard block |
||
1622 | 1622 | $extract = rtrim( |
1623 | 1623 | UTF8::substr($text, 0, $pos_end, $this->encoding), |
1624 | 1624 | $trimChars |
1625 | - ) . $ellipsis; |
|
1625 | + ).$ellipsis; |
|
1626 | 1626 | } else { |
1627 | 1627 | $extract = $text; |
1628 | 1628 | } |
@@ -1736,7 +1736,7 @@ discard block |
||
1736 | 1736 | $limit = -1; |
1737 | 1737 | } |
1738 | 1738 | |
1739 | - $array = preg_split('/' . preg_quote($pattern, '/') . '/u', $this->str, $limit); |
|
1739 | + $array = preg_split('/'.preg_quote($pattern, '/').'/u', $this->str, $limit); |
|
1740 | 1740 | |
1741 | 1741 | if ($limit > 0 && count($array) === $limit) { |
1742 | 1742 | array_pop($array); |
@@ -1810,13 +1810,13 @@ discard block |
||
1810 | 1810 | |
1811 | 1811 | $stringy->str = preg_replace_callback( |
1812 | 1812 | '/([\S]+)/u', |
1813 | - function ($match) use ($encoding, $ignore) { |
|
1813 | + function($match) use ($encoding, $ignore) { |
|
1814 | 1814 | if ($ignore && in_array($match[0], $ignore, true)) { |
1815 | 1815 | return $match[0]; |
1816 | 1816 | } else { |
1817 | 1817 | $stringy = new Stringy($match[0], $encoding); |
1818 | 1818 | |
1819 | - return (string)$stringy->toLowerCase()->upperCaseFirst(); |
|
1819 | + return (string) $stringy->toLowerCase()->upperCaseFirst(); |
|
1820 | 1820 | } |
1821 | 1821 | }, |
1822 | 1822 | $stringy->str |
@@ -1892,9 +1892,9 @@ discard block |
||
1892 | 1892 | if (array_key_exists($key, $map)) { |
1893 | 1893 | return $map[$key]; |
1894 | 1894 | } elseif (is_numeric($this->str)) { |
1895 | - return ((int)$this->str > 0); |
|
1895 | + return ((int) $this->str > 0); |
|
1896 | 1896 | } else { |
1897 | - return (bool)$this->regexReplace('[[:space:]]', '')->str; |
|
1897 | + return (bool) $this->regexReplace('[[:space:]]', '')->str; |
|
1898 | 1898 | } |
1899 | 1899 | } |
1900 | 1900 | |
@@ -1905,7 +1905,7 @@ discard block |
||
1905 | 1905 | */ |
1906 | 1906 | public function toString() |
1907 | 1907 | { |
1908 | - return (string)$this->str; |
|
1908 | + return (string) $this->str; |
|
1909 | 1909 | } |
1910 | 1910 | |
1911 | 1911 | /** |
@@ -2029,7 +2029,7 @@ discard block |
||
2029 | 2029 | $length -= $substringLength; |
2030 | 2030 | |
2031 | 2031 | $truncated = UTF8::substr($stringy->str, 0, $length, $stringy->encoding); |
2032 | - $stringy->str = $truncated . $substring; |
|
2032 | + $stringy->str = $truncated.$substring; |
|
2033 | 2033 | |
2034 | 2034 | return $stringy; |
2035 | 2035 | } |
@@ -2074,7 +2074,7 @@ discard block |
||
2074 | 2074 | |
2075 | 2075 | $stringy->str = preg_replace_callback( |
2076 | 2076 | '/[-_\s]+(.)?/u', |
2077 | - function ($match) use ($encoding) { |
|
2077 | + function($match) use ($encoding) { |
|
2078 | 2078 | if (isset($match[1])) { |
2079 | 2079 | return UTF8::strtoupper($match[1], $encoding); |
2080 | 2080 | } else { |
@@ -2086,7 +2086,7 @@ discard block |
||
2086 | 2086 | |
2087 | 2087 | $stringy->str = preg_replace_callback( |
2088 | 2088 | '/[\d]+(.)?/u', |
2089 | - function ($match) use ($encoding) { |
|
2089 | + function($match) use ($encoding) { |
|
2090 | 2090 | return UTF8::strtoupper($match[0], $encoding); |
2091 | 2091 | }, |
2092 | 2092 | $stringy->str |
@@ -2110,14 +2110,14 @@ discard block |
||
2110 | 2110 | |
2111 | 2111 | $str = preg_replace_callback( |
2112 | 2112 | '/([\d|A-Z])/u', |
2113 | - function ($matches) use ($encoding) { |
|
2113 | + function($matches) use ($encoding) { |
|
2114 | 2114 | $match = $matches[1]; |
2115 | - $matchInt = (int)$match; |
|
2115 | + $matchInt = (int) $match; |
|
2116 | 2116 | |
2117 | 2117 | if ("$matchInt" == $match) { |
2118 | - return '_' . $match . '_'; |
|
2118 | + return '_'.$match.'_'; |
|
2119 | 2119 | } else { |
2120 | - return '_' . UTF8::strtolower($match, $encoding); |
|
2120 | + return '_'.UTF8::strtolower($match, $encoding); |
|
2121 | 2121 | } |
2122 | 2122 | }, |
2123 | 2123 | $str |
@@ -2126,9 +2126,9 @@ discard block |
||
2126 | 2126 | $str = preg_replace( |
2127 | 2127 | array( |
2128 | 2128 | |
2129 | - '/\s+/', // convert spaces to "_" |
|
2130 | - '/^\s+|\s+$/', // trim leading & trailing spaces |
|
2131 | - '/_+/', // remove double "_" |
|
2129 | + '/\s+/', // convert spaces to "_" |
|
2130 | + '/^\s+|\s+$/', // trim leading & trailing spaces |
|
2131 | + '/_+/', // remove double "_" |
|
2132 | 2132 | ), |
2133 | 2133 | array( |
2134 | 2134 | '_', |
@@ -2154,7 +2154,7 @@ discard block |
||
2154 | 2154 | $first = UTF8::substr($this->str, 0, 1, $this->encoding); |
2155 | 2155 | $rest = UTF8::substr($this->str, 1, $this->length() - 1, $this->encoding); |
2156 | 2156 | |
2157 | - $str = UTF8::strtolower($first, $this->encoding) . $rest; |
|
2157 | + $str = UTF8::strtolower($first, $this->encoding).$rest; |
|
2158 | 2158 | |
2159 | 2159 | return static::create($str, $this->encoding); |
2160 | 2160 | } |