| @@ 4318-4332 (lines=15) @@ | ||
| 4315 | * @return static |
|
| 4316 | * <p>Object whose $str has had tabs switched to spaces.</p> |
|
| 4317 | */ |
|
| 4318 | public function toSpaces(int $tabLength = 4): self |
|
| 4319 | { |
|
| 4320 | if ($tabLength === 4) { |
|
| 4321 | $tab = ' '; |
|
| 4322 | } elseif ($tabLength === 2) { |
|
| 4323 | $tab = ' '; |
|
| 4324 | } else { |
|
| 4325 | $tab = \str_repeat(' ', $tabLength); |
|
| 4326 | } |
|
| 4327 | ||
| 4328 | return static::create( |
|
| 4329 | \str_replace("\t", $tab, $this->str), |
|
| 4330 | $this->encoding |
|
| 4331 | ); |
|
| 4332 | } |
|
| 4333 | ||
| 4334 | /** |
|
| 4335 | * Return Stringy object as string, but you can also use (string) for automatically casting the object into a |
|
| @@ 4367-4381 (lines=15) @@ | ||
| 4364 | * @return static |
|
| 4365 | * <p>Object whose $str has had spaces switched to tabs.</p> |
|
| 4366 | */ |
|
| 4367 | public function toTabs(int $tabLength = 4): self |
|
| 4368 | { |
|
| 4369 | if ($tabLength === 4) { |
|
| 4370 | $tab = ' '; |
|
| 4371 | } elseif ($tabLength === 2) { |
|
| 4372 | $tab = ' '; |
|
| 4373 | } else { |
|
| 4374 | $tab = \str_repeat(' ', $tabLength); |
|
| 4375 | } |
|
| 4376 | ||
| 4377 | return static::create( |
|
| 4378 | \str_replace($tab, "\t", $this->str), |
|
| 4379 | $this->encoding |
|
| 4380 | ); |
|
| 4381 | } |
|
| 4382 | ||
| 4383 | /** |
|
| 4384 | * Converts the first character of each word in the string to uppercase |
|