| @@ 2864-2878 (lines=15) @@ | ||
| 2861 | * @return static |
|
| 2862 | * <p>Object whose $str has had tabs switched to spaces.</p> |
|
| 2863 | */ |
|
| 2864 | public function toSpaces(int $tabLength = 4): self |
|
| 2865 | { |
|
| 2866 | if ($tabLength === 4) { |
|
| 2867 | $tab = ' '; |
|
| 2868 | } elseif ($tabLength === 2) { |
|
| 2869 | $tab = ' '; |
|
| 2870 | } else { |
|
| 2871 | $tab = \str_repeat(' ', $tabLength); |
|
| 2872 | } |
|
| 2873 | ||
| 2874 | return static::create( |
|
| 2875 | \str_replace("\t", $tab, $this->str), |
|
| 2876 | $this->encoding |
|
| 2877 | ); |
|
| 2878 | } |
|
| 2879 | ||
| 2880 | /** |
|
| 2881 | * Return Stringy object as string, but you can also use (string) for automatically casting the object into a |
|
| @@ 2905-2919 (lines=15) @@ | ||
| 2902 | * @return static |
|
| 2903 | * <p>Object whose $str has had spaces switched to tabs.</p> |
|
| 2904 | */ |
|
| 2905 | public function toTabs(int $tabLength = 4): self |
|
| 2906 | { |
|
| 2907 | if ($tabLength === 4) { |
|
| 2908 | $tab = ' '; |
|
| 2909 | } elseif ($tabLength === 2) { |
|
| 2910 | $tab = ' '; |
|
| 2911 | } else { |
|
| 2912 | $tab = \str_repeat(' ', $tabLength); |
|
| 2913 | } |
|
| 2914 | ||
| 2915 | return static::create( |
|
| 2916 | \str_replace($tab, "\t", $this->str), |
|
| 2917 | $this->encoding |
|
| 2918 | ); |
|
| 2919 | } |
|
| 2920 | ||
| 2921 | /** |
|
| 2922 | * Converts the first character of each word in the string to uppercase |
|