Code Duplication    Length = 15-15 lines in 2 locations

src/Stringy.php 2 locations

@@ 3499-3513 (lines=15) @@
3496
     * @return static
3497
     *                <p>Object whose $str has had tabs switched to spaces.</p>
3498
     */
3499
    public function toSpaces(int $tabLength = 4): self
3500
    {
3501
        if ($tabLength === 4) {
3502
            $tab = '    ';
3503
        } elseif ($tabLength === 2) {
3504
            $tab = '  ';
3505
        } else {
3506
            $tab = \str_repeat(' ', $tabLength);
3507
        }
3508
3509
        return static::create(
3510
            \str_replace("\t", $tab, $this->str),
3511
            $this->encoding
3512
        );
3513
    }
3514
3515
    /**
3516
     * Return Stringy object as string, but you can also use (string) for automatically casting the object into a
@@ 3540-3554 (lines=15) @@
3537
     * @return static
3538
     *                <p>Object whose $str has had spaces switched to tabs.</p>
3539
     */
3540
    public function toTabs(int $tabLength = 4): self
3541
    {
3542
        if ($tabLength === 4) {
3543
            $tab = '    ';
3544
        } elseif ($tabLength === 2) {
3545
            $tab = '  ';
3546
        } else {
3547
            $tab = \str_repeat(' ', $tabLength);
3548
        }
3549
3550
        return static::create(
3551
            \str_replace($tab, "\t", $this->str),
3552
            $this->encoding
3553
        );
3554
    }
3555
3556
    /**
3557
     * Converts the first character of each word in the string to uppercase