| @@ 2325-2339 (lines=15) @@ | ||
| 2322 | * @return static |
|
| 2323 | * <p>Object whose $str has had tabs switched to spaces.</p> |
|
| 2324 | */ |
|
| 2325 | public function toSpaces(int $tabLength = 4): self |
|
| 2326 | { |
|
| 2327 | if ($tabLength === 4) { |
|
| 2328 | $tab = ' '; |
|
| 2329 | } elseif ($tabLength === 2) { |
|
| 2330 | $tab = ' '; |
|
| 2331 | } else { |
|
| 2332 | $tab = \str_repeat(' ', $tabLength); |
|
| 2333 | } |
|
| 2334 | ||
| 2335 | return static::create( |
|
| 2336 | \str_replace("\t", $tab, $this->str), |
|
| 2337 | $this->encoding |
|
| 2338 | ); |
|
| 2339 | } |
|
| 2340 | ||
| 2341 | /** |
|
| 2342 | * Return Stringy object as string, but you can also use (string) for automatically casting the object into a |
|
| @@ 2362-2376 (lines=15) @@ | ||
| 2359 | * @return static |
|
| 2360 | * <p>Object whose $str has had spaces switched to tabs.</p> |
|
| 2361 | */ |
|
| 2362 | public function toTabs(int $tabLength = 4): self |
|
| 2363 | { |
|
| 2364 | if ($tabLength === 4) { |
|
| 2365 | $tab = ' '; |
|
| 2366 | } elseif ($tabLength === 2) { |
|
| 2367 | $tab = ' '; |
|
| 2368 | } else { |
|
| 2369 | $tab = \str_repeat(' ', $tabLength); |
|
| 2370 | } |
|
| 2371 | ||
| 2372 | return static::create( |
|
| 2373 | \str_replace($tab, "\t", $this->str), |
|
| 2374 | $this->encoding |
|
| 2375 | ); |
|
| 2376 | } |
|
| 2377 | ||
| 2378 | /** |
|
| 2379 | * Converts the first character of each word in the string to uppercase |
|