| @@ 2283-2297 (lines=15) @@ | ||
| 2280 | * @return static |
|
| 2281 | * <p>Object whose $str has had tabs switched to spaces.</p> |
|
| 2282 | */ |
|
| 2283 | public function toSpaces(int $tabLength = 4): self |
|
| 2284 | { |
|
| 2285 | if ($tabLength === 4) { |
|
| 2286 | $tab = ' '; |
|
| 2287 | } elseif ($tabLength === 2) { |
|
| 2288 | $tab = ' '; |
|
| 2289 | } else { |
|
| 2290 | $tab = \str_repeat(' ', $tabLength); |
|
| 2291 | } |
|
| 2292 | ||
| 2293 | return static::create( |
|
| 2294 | \str_replace("\t", $tab, $this->str), |
|
| 2295 | $this->encoding |
|
| 2296 | ); |
|
| 2297 | } |
|
| 2298 | ||
| 2299 | /** |
|
| 2300 | * Return Stringy object as string, but you can also use (string) for automatically casting the object into a |
|
| @@ 2320-2334 (lines=15) @@ | ||
| 2317 | * @return static |
|
| 2318 | * <p>Object whose $str has had spaces switched to tabs.</p> |
|
| 2319 | */ |
|
| 2320 | public function toTabs(int $tabLength = 4): self |
|
| 2321 | { |
|
| 2322 | if ($tabLength === 4) { |
|
| 2323 | $tab = ' '; |
|
| 2324 | } elseif ($tabLength === 2) { |
|
| 2325 | $tab = ' '; |
|
| 2326 | } else { |
|
| 2327 | $tab = \str_repeat(' ', $tabLength); |
|
| 2328 | } |
|
| 2329 | ||
| 2330 | return static::create( |
|
| 2331 | \str_replace($tab, "\t", $this->str), |
|
| 2332 | $this->encoding |
|
| 2333 | ); |
|
| 2334 | } |
|
| 2335 | ||
| 2336 | /** |
|
| 2337 | * Converts the first character of each word in the string to uppercase |
|