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