| @@ 4451-4465 (lines=15) @@ | ||
| 4448 | * @return static |
|
| 4449 | * <p>Object whose $str has had tabs switched to spaces.</p> |
|
| 4450 | */ |
|
| 4451 | public function toSpaces(int $tabLength = 4): self |
|
| 4452 | { |
|
| 4453 | if ($tabLength === 4) { |
|
| 4454 | $tab = ' '; |
|
| 4455 | } elseif ($tabLength === 2) { |
|
| 4456 | $tab = ' '; |
|
| 4457 | } else { |
|
| 4458 | $tab = \str_repeat(' ', $tabLength); |
|
| 4459 | } |
|
| 4460 | ||
| 4461 | return static::create( |
|
| 4462 | \str_replace("\t", $tab, $this->str), |
|
| 4463 | $this->encoding |
|
| 4464 | ); |
|
| 4465 | } |
|
| 4466 | ||
| 4467 | /** |
|
| 4468 | * Return Stringy object as string, but you can also use (string) for automatically casting the object into a |
|
| @@ 4500-4514 (lines=15) @@ | ||
| 4497 | * @return static |
|
| 4498 | * <p>Object whose $str has had spaces switched to tabs.</p> |
|
| 4499 | */ |
|
| 4500 | public function toTabs(int $tabLength = 4): self |
|
| 4501 | { |
|
| 4502 | if ($tabLength === 4) { |
|
| 4503 | $tab = ' '; |
|
| 4504 | } elseif ($tabLength === 2) { |
|
| 4505 | $tab = ' '; |
|
| 4506 | } else { |
|
| 4507 | $tab = \str_repeat(' ', $tabLength); |
|
| 4508 | } |
|
| 4509 | ||
| 4510 | return static::create( |
|
| 4511 | \str_replace($tab, "\t", $this->str), |
|
| 4512 | $this->encoding |
|
| 4513 | ); |
|
| 4514 | } |
|
| 4515 | ||
| 4516 | /** |
|
| 4517 | * Converts the first character of each word in the string to uppercase |
|