| @@ 3326-3340 (lines=15) @@ | ||
| 3323 | * @return static |
|
| 3324 | * <p>Object whose $str has had tabs switched to spaces.</p> |
|
| 3325 | */ |
|
| 3326 | public function toSpaces(int $tabLength = 4): self |
|
| 3327 | { |
|
| 3328 | if ($tabLength === 4) { |
|
| 3329 | $tab = ' '; |
|
| 3330 | } elseif ($tabLength === 2) { |
|
| 3331 | $tab = ' '; |
|
| 3332 | } else { |
|
| 3333 | $tab = \str_repeat(' ', $tabLength); |
|
| 3334 | } |
|
| 3335 | ||
| 3336 | return static::create( |
|
| 3337 | \str_replace("\t", $tab, $this->str), |
|
| 3338 | $this->encoding |
|
| 3339 | ); |
|
| 3340 | } |
|
| 3341 | ||
| 3342 | /** |
|
| 3343 | * Return Stringy object as string, but you can also use (string) for automatically casting the object into a |
|
| @@ 3367-3381 (lines=15) @@ | ||
| 3364 | * @return static |
|
| 3365 | * <p>Object whose $str has had spaces switched to tabs.</p> |
|
| 3366 | */ |
|
| 3367 | public function toTabs(int $tabLength = 4): self |
|
| 3368 | { |
|
| 3369 | if ($tabLength === 4) { |
|
| 3370 | $tab = ' '; |
|
| 3371 | } elseif ($tabLength === 2) { |
|
| 3372 | $tab = ' '; |
|
| 3373 | } else { |
|
| 3374 | $tab = \str_repeat(' ', $tabLength); |
|
| 3375 | } |
|
| 3376 | ||
| 3377 | return static::create( |
|
| 3378 | \str_replace($tab, "\t", $this->str), |
|
| 3379 | $this->encoding |
|
| 3380 | ); |
|
| 3381 | } |
|
| 3382 | ||
| 3383 | /** |
|
| 3384 | * Converts the first character of each word in the string to uppercase |
|