@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | // init |
| 63 | 63 | UTF8::checkForSupport(); |
| 64 | - $this->str = (string)$str; |
|
| 64 | + $this->str = (string) $str; |
|
| 65 | 65 | |
| 66 | 66 | if ($encoding) { |
| 67 | 67 | $this->encoding = $encoding; |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public function indexOf($needle, $offset = 0) |
| 159 | 159 | { |
| 160 | - return UTF8::strpos($this->str, (string)$needle, (int)$offset, $this->encoding); |
|
| 160 | + return UTF8::strpos($this->str, (string) $needle, (int) $offset, $this->encoding); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | $startOfStr = UTF8::strtolower($startOfStr, $this->encoding); |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | - return (string)$substring === $startOfStr; |
|
| 432 | + return (string) $substring === $startOfStr; |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | /** |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | $endOfStr = UTF8::strtolower($endOfStr, $this->encoding); |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | - return (string)$substring === $endOfStr; |
|
| 481 | + return (string) $substring === $endOfStr; |
|
| 482 | 482 | } |
| 483 | 483 | |
| 484 | 484 | /** |
@@ -666,7 +666,7 @@ discard block |
||
| 666 | 666 | */ |
| 667 | 667 | public function indexOfLast($needle, $offset = 0) |
| 668 | 668 | { |
| 669 | - return UTF8::strrpos($this->str, (string)$needle, (int)$offset, $this->encoding); |
|
| 669 | + return UTF8::strrpos($this->str, (string) $needle, (int) $offset, $this->encoding); |
|
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | /** |
@@ -966,7 +966,7 @@ discard block |
||
| 966 | 966 | { |
| 967 | 967 | // init |
| 968 | 968 | $length = $this->length(); |
| 969 | - $offset = (int)$offset; |
|
| 969 | + $offset = (int) $offset; |
|
| 970 | 970 | |
| 971 | 971 | if ($offset >= 0) { |
| 972 | 972 | return ($length > $offset); |
@@ -990,7 +990,7 @@ discard block |
||
| 990 | 990 | public function offsetGet($offset) |
| 991 | 991 | { |
| 992 | 992 | // init |
| 993 | - $offset = (int)$offset; |
|
| 993 | + $offset = (int) $offset; |
|
| 994 | 994 | $length = $this->length(); |
| 995 | 995 | |
| 996 | 996 | if ( |
@@ -1496,7 +1496,7 @@ discard block |
||
| 1496 | 1496 | |
| 1497 | 1497 | $stringy->str = preg_replace_callback( |
| 1498 | 1498 | '/[\S]/u', |
| 1499 | - function ($match) use ($encoding) { |
|
| 1499 | + function($match) use ($encoding) { |
|
| 1500 | 1500 | $marchToUpper = UTF8::strtoupper($match[0], $encoding); |
| 1501 | 1501 | |
| 1502 | 1502 | if ($match[0] == $marchToUpper) { |
@@ -1541,13 +1541,13 @@ discard block |
||
| 1541 | 1541 | |
| 1542 | 1542 | $stringy->str = preg_replace_callback( |
| 1543 | 1543 | '/([\S]+)/u', |
| 1544 | - function ($match) use ($encoding, $ignore) { |
|
| 1544 | + function($match) use ($encoding, $ignore) { |
|
| 1545 | 1545 | if ($ignore && in_array($match[0], $ignore, true)) { |
| 1546 | 1546 | return $match[0]; |
| 1547 | 1547 | } else { |
| 1548 | 1548 | $stringy = new Stringy($match[0], $encoding); |
| 1549 | 1549 | |
| 1550 | - return (string)$stringy->toLowerCase()->upperCaseFirst(); |
|
| 1550 | + return (string) $stringy->toLowerCase()->upperCaseFirst(); |
|
| 1551 | 1551 | } |
| 1552 | 1552 | }, |
| 1553 | 1553 | $stringy->str |
@@ -1629,9 +1629,9 @@ discard block |
||
| 1629 | 1629 | if (array_key_exists($key, $map)) { |
| 1630 | 1630 | return $map[$key]; |
| 1631 | 1631 | } elseif (is_numeric($this->str)) { |
| 1632 | - return ((int)$this->str > 0); |
|
| 1632 | + return ((int) $this->str > 0); |
|
| 1633 | 1633 | } else { |
| 1634 | - return (bool)$this->regexReplace('[[:space:]]', '')->str; |
|
| 1634 | + return (bool) $this->regexReplace('[[:space:]]', '')->str; |
|
| 1635 | 1635 | } |
| 1636 | 1636 | } |
| 1637 | 1637 | |
@@ -1801,7 +1801,7 @@ discard block |
||
| 1801 | 1801 | |
| 1802 | 1802 | $stringy->str = preg_replace_callback( |
| 1803 | 1803 | '/[-_\s]+(.)?/u', |
| 1804 | - function ($match) use ($encoding) { |
|
| 1804 | + function($match) use ($encoding) { |
|
| 1805 | 1805 | if (isset($match[1])) { |
| 1806 | 1806 | return UTF8::strtoupper($match[1], $encoding); |
| 1807 | 1807 | } else { |
@@ -1813,7 +1813,7 @@ discard block |
||
| 1813 | 1813 | |
| 1814 | 1814 | $stringy->str = preg_replace_callback( |
| 1815 | 1815 | '/[\d]+(.)?/u', |
| 1816 | - function ($match) use ($encoding) { |
|
| 1816 | + function($match) use ($encoding) { |
|
| 1817 | 1817 | return UTF8::strtoupper($match[0], $encoding); |
| 1818 | 1818 | }, |
| 1819 | 1819 | $stringy->str |
@@ -1836,9 +1836,9 @@ discard block |
||
| 1836 | 1836 | |
| 1837 | 1837 | $str = preg_replace_callback( |
| 1838 | 1838 | '/([\d|A-Z])/u', |
| 1839 | - function ($matches) { |
|
| 1839 | + function($matches) { |
|
| 1840 | 1840 | $match = $matches[1]; |
| 1841 | - $matchInt = (int)$match; |
|
| 1841 | + $matchInt = (int) $match; |
|
| 1842 | 1842 | |
| 1843 | 1843 | if ("$matchInt" == $match) { |
| 1844 | 1844 | return '_' . $match . '_'; |
@@ -1852,9 +1852,9 @@ discard block |
||
| 1852 | 1852 | $str = preg_replace( |
| 1853 | 1853 | array( |
| 1854 | 1854 | |
| 1855 | - '/\s+/', // convert spaces to "_" |
|
| 1856 | - '/^\s+|\s+$/', // trim leading & trailing spaces |
|
| 1857 | - '/_+/', // remove double "_" |
|
| 1855 | + '/\s+/', // convert spaces to "_" |
|
| 1856 | + '/^\s+|\s+$/', // trim leading & trailing spaces |
|
| 1857 | + '/_+/', // remove double "_" |
|
| 1858 | 1858 | ), |
| 1859 | 1859 | array( |
| 1860 | 1860 | '_', |