| @@ 2346-2360 (lines=15) @@ | ||
| 2343 | * @return static |
|
| 2344 | * <p>Object whose $str has had tabs switched to spaces.</p> |
|
| 2345 | */ |
|
| 2346 | public function toSpaces(int $tabLength = 4): self |
|
| 2347 | { |
|
| 2348 | if ($tabLength === 4) { |
|
| 2349 | $tab = ' '; |
|
| 2350 | } elseif ($tabLength === 2) { |
|
| 2351 | $tab = ' '; |
|
| 2352 | } else { |
|
| 2353 | $tab = \str_repeat(' ', $tabLength); |
|
| 2354 | } |
|
| 2355 | ||
| 2356 | return static::create( |
|
| 2357 | \str_replace("\t", $tab, $this->str), |
|
| 2358 | $this->encoding |
|
| 2359 | ); |
|
| 2360 | } |
|
| 2361 | ||
| 2362 | /** |
|
| 2363 | * Return Stringy object as string, but you can also use (string) for automatically casting the object into a |
|
| @@ 2383-2397 (lines=15) @@ | ||
| 2380 | * @return static |
|
| 2381 | * <p>Object whose $str has had spaces switched to tabs.</p> |
|
| 2382 | */ |
|
| 2383 | public function toTabs(int $tabLength = 4): self |
|
| 2384 | { |
|
| 2385 | if ($tabLength === 4) { |
|
| 2386 | $tab = ' '; |
|
| 2387 | } elseif ($tabLength === 2) { |
|
| 2388 | $tab = ' '; |
|
| 2389 | } else { |
|
| 2390 | $tab = \str_repeat(' ', $tabLength); |
|
| 2391 | } |
|
| 2392 | ||
| 2393 | return static::create( |
|
| 2394 | \str_replace($tab, "\t", $this->str), |
|
| 2395 | $this->encoding |
|
| 2396 | ); |
|
| 2397 | } |
|
| 2398 | ||
| 2399 | /** |
|
| 2400 | * Converts the first character of each word in the string to uppercase |
|