Code Duplication    Length = 15-15 lines in 2 locations

src/Stringy.php 2 locations

@@ 3572-3586 (lines=15) @@
3569
     * @return static
3570
     *                <p>Object whose $str has had tabs switched to spaces.</p>
3571
     */
3572
    public function toSpaces(int $tabLength = 4): self
3573
    {
3574
        if ($tabLength === 4) {
3575
            $tab = '    ';
3576
        } elseif ($tabLength === 2) {
3577
            $tab = '  ';
3578
        } else {
3579
            $tab = \str_repeat(' ', $tabLength);
3580
        }
3581
3582
        return static::create(
3583
            \str_replace("\t", $tab, $this->str),
3584
            $this->encoding
3585
        );
3586
    }
3587
3588
    /**
3589
     * Return Stringy object as string, but you can also use (string) for automatically casting the object into a
@@ 3613-3627 (lines=15) @@
3610
     * @return static
3611
     *                <p>Object whose $str has had spaces switched to tabs.</p>
3612
     */
3613
    public function toTabs(int $tabLength = 4): self
3614
    {
3615
        if ($tabLength === 4) {
3616
            $tab = '    ';
3617
        } elseif ($tabLength === 2) {
3618
            $tab = '  ';
3619
        } else {
3620
            $tab = \str_repeat(' ', $tabLength);
3621
        }
3622
3623
        return static::create(
3624
            \str_replace($tab, "\t", $this->str),
3625
            $this->encoding
3626
        );
3627
    }
3628
3629
    /**
3630
     * Converts the first character of each word in the string to uppercase