| @@ 2523-2537 (lines=15) @@ | ||
| 2520 | * @return static |
|
| 2521 | * <p>Object whose $str has had tabs switched to spaces.</p> |
|
| 2522 | */ |
|
| 2523 | public function toSpaces(int $tabLength = 4): self |
|
| 2524 | { |
|
| 2525 | if ($tabLength === 4) { |
|
| 2526 | $tab = ' '; |
|
| 2527 | } elseif ($tabLength === 2) { |
|
| 2528 | $tab = ' '; |
|
| 2529 | } else { |
|
| 2530 | $tab = \str_repeat(' ', $tabLength); |
|
| 2531 | } |
|
| 2532 | ||
| 2533 | return static::create( |
|
| 2534 | \str_replace("\t", $tab, $this->str), |
|
| 2535 | $this->encoding |
|
| 2536 | ); |
|
| 2537 | } |
|
| 2538 | ||
| 2539 | /** |
|
| 2540 | * Return Stringy object as string, but you can also use (string) for automatically casting the object into a |
|
| @@ 2560-2574 (lines=15) @@ | ||
| 2557 | * @return static |
|
| 2558 | * <p>Object whose $str has had spaces switched to tabs.</p> |
|
| 2559 | */ |
|
| 2560 | public function toTabs(int $tabLength = 4): self |
|
| 2561 | { |
|
| 2562 | if ($tabLength === 4) { |
|
| 2563 | $tab = ' '; |
|
| 2564 | } elseif ($tabLength === 2) { |
|
| 2565 | $tab = ' '; |
|
| 2566 | } else { |
|
| 2567 | $tab = \str_repeat(' ', $tabLength); |
|
| 2568 | } |
|
| 2569 | ||
| 2570 | return static::create( |
|
| 2571 | \str_replace($tab, "\t", $this->str), |
|
| 2572 | $this->encoding |
|
| 2573 | ); |
|
| 2574 | } |
|
| 2575 | ||
| 2576 | /** |
|
| 2577 | * Converts the first character of each word in the string to uppercase |
|