@@ -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; |
@@ -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 | /** |
@@ -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 | /** |
@@ -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 | /** |
@@ -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 ( |
@@ -1536,7 +1536,7 @@ discard block |
||
| 1536 | 1536 | |
| 1537 | 1537 | $stringy->str = preg_replace_callback( |
| 1538 | 1538 | '/[\S]/u', |
| 1539 | - function ($match) use ($encoding) { |
|
| 1539 | + function($match) use ($encoding) { |
|
| 1540 | 1540 | $marchToUpper = UTF8::strtoupper($match[0], $encoding); |
| 1541 | 1541 | |
| 1542 | 1542 | if ($match[0] == $marchToUpper) { |
@@ -1581,13 +1581,13 @@ discard block |
||
| 1581 | 1581 | |
| 1582 | 1582 | $stringy->str = preg_replace_callback( |
| 1583 | 1583 | '/([\S]+)/u', |
| 1584 | - function ($match) use ($encoding, $ignore) { |
|
| 1584 | + function($match) use ($encoding, $ignore) { |
|
| 1585 | 1585 | if ($ignore && in_array($match[0], $ignore, true)) { |
| 1586 | 1586 | return $match[0]; |
| 1587 | 1587 | } else { |
| 1588 | 1588 | $stringy = new Stringy($match[0], $encoding); |
| 1589 | 1589 | |
| 1590 | - return (string)$stringy->toLowerCase()->upperCaseFirst(); |
|
| 1590 | + return (string) $stringy->toLowerCase()->upperCaseFirst(); |
|
| 1591 | 1591 | } |
| 1592 | 1592 | }, |
| 1593 | 1593 | $stringy->str |
@@ -1669,9 +1669,9 @@ discard block |
||
| 1669 | 1669 | if (array_key_exists($key, $map)) { |
| 1670 | 1670 | return $map[$key]; |
| 1671 | 1671 | } elseif (is_numeric($this->str)) { |
| 1672 | - return ((int)$this->str > 0); |
|
| 1672 | + return ((int) $this->str > 0); |
|
| 1673 | 1673 | } else { |
| 1674 | - return (bool)$this->regexReplace('[[:space:]]', '')->str; |
|
| 1674 | + return (bool) $this->regexReplace('[[:space:]]', '')->str; |
|
| 1675 | 1675 | } |
| 1676 | 1676 | } |
| 1677 | 1677 | |
@@ -1682,7 +1682,7 @@ discard block |
||
| 1682 | 1682 | */ |
| 1683 | 1683 | public function toString() |
| 1684 | 1684 | { |
| 1685 | - return (string)$this->str; |
|
| 1685 | + return (string) $this->str; |
|
| 1686 | 1686 | } |
| 1687 | 1687 | |
| 1688 | 1688 | /** |
@@ -1851,7 +1851,7 @@ discard block |
||
| 1851 | 1851 | |
| 1852 | 1852 | $stringy->str = preg_replace_callback( |
| 1853 | 1853 | '/[-_\s]+(.)?/u', |
| 1854 | - function ($match) use ($encoding) { |
|
| 1854 | + function($match) use ($encoding) { |
|
| 1855 | 1855 | if (isset($match[1])) { |
| 1856 | 1856 | return UTF8::strtoupper($match[1], $encoding); |
| 1857 | 1857 | } else { |
@@ -1863,7 +1863,7 @@ discard block |
||
| 1863 | 1863 | |
| 1864 | 1864 | $stringy->str = preg_replace_callback( |
| 1865 | 1865 | '/[\d]+(.)?/u', |
| 1866 | - function ($match) use ($encoding) { |
|
| 1866 | + function($match) use ($encoding) { |
|
| 1867 | 1867 | return UTF8::strtoupper($match[0], $encoding); |
| 1868 | 1868 | }, |
| 1869 | 1869 | $stringy->str |
@@ -1886,9 +1886,9 @@ discard block |
||
| 1886 | 1886 | |
| 1887 | 1887 | $str = preg_replace_callback( |
| 1888 | 1888 | '/([\d|A-Z])/u', |
| 1889 | - function ($matches) { |
|
| 1889 | + function($matches) { |
|
| 1890 | 1890 | $match = $matches[1]; |
| 1891 | - $matchInt = (int)$match; |
|
| 1891 | + $matchInt = (int) $match; |
|
| 1892 | 1892 | |
| 1893 | 1893 | if ("$matchInt" == $match) { |
| 1894 | 1894 | return '_' . $match . '_'; |
@@ -1902,9 +1902,9 @@ discard block |
||
| 1902 | 1902 | $str = preg_replace( |
| 1903 | 1903 | array( |
| 1904 | 1904 | |
| 1905 | - '/\s+/', // convert spaces to "_" |
|
| 1906 | - '/^\s+|\s+$/', // trim leading & trailing spaces |
|
| 1907 | - '/_+/', // remove double "_" |
|
| 1905 | + '/\s+/', // convert spaces to "_" |
|
| 1906 | + '/^\s+|\s+$/', // trim leading & trailing spaces |
|
| 1907 | + '/_+/', // remove double "_" |
|
| 1908 | 1908 | ), |
| 1909 | 1909 | array( |
| 1910 | 1910 | '_', |