| @@ 3680-3694 (lines=15) @@ | ||
| 3677 | * @return static |
|
| 3678 | * <p>Object whose $str has had tabs switched to spaces.</p> |
|
| 3679 | */ |
|
| 3680 | public function toSpaces(int $tabLength = 4): self |
|
| 3681 | { |
|
| 3682 | if ($tabLength === 4) { |
|
| 3683 | $tab = ' '; |
|
| 3684 | } elseif ($tabLength === 2) { |
|
| 3685 | $tab = ' '; |
|
| 3686 | } else { |
|
| 3687 | $tab = \str_repeat(' ', $tabLength); |
|
| 3688 | } |
|
| 3689 | ||
| 3690 | return static::create( |
|
| 3691 | \str_replace("\t", $tab, $this->str), |
|
| 3692 | $this->encoding |
|
| 3693 | ); |
|
| 3694 | } |
|
| 3695 | ||
| 3696 | /** |
|
| 3697 | * Return Stringy object as string, but you can also use (string) for automatically casting the object into a |
|
| @@ 3721-3735 (lines=15) @@ | ||
| 3718 | * @return static |
|
| 3719 | * <p>Object whose $str has had spaces switched to tabs.</p> |
|
| 3720 | */ |
|
| 3721 | public function toTabs(int $tabLength = 4): self |
|
| 3722 | { |
|
| 3723 | if ($tabLength === 4) { |
|
| 3724 | $tab = ' '; |
|
| 3725 | } elseif ($tabLength === 2) { |
|
| 3726 | $tab = ' '; |
|
| 3727 | } else { |
|
| 3728 | $tab = \str_repeat(' ', $tabLength); |
|
| 3729 | } |
|
| 3730 | ||
| 3731 | return static::create( |
|
| 3732 | \str_replace($tab, "\t", $this->str), |
|
| 3733 | $this->encoding |
|
| 3734 | ); |
|
| 3735 | } |
|
| 3736 | ||
| 3737 | /** |
|
| 3738 | * Converts the first character of each word in the string to uppercase |
|