Code Duplication    Length = 15-15 lines in 2 locations

src/Stringy.php 2 locations

@@ 3691-3705 (lines=15) @@
3688
     * @return static
3689
     *                <p>Object whose $str has had tabs switched to spaces.</p>
3690
     */
3691
    public function toSpaces(int $tabLength = 4): self
3692
    {
3693
        if ($tabLength === 4) {
3694
            $tab = '    ';
3695
        } elseif ($tabLength === 2) {
3696
            $tab = '  ';
3697
        } else {
3698
            $tab = \str_repeat(' ', $tabLength);
3699
        }
3700
3701
        return static::create(
3702
            \str_replace("\t", $tab, $this->str),
3703
            $this->encoding
3704
        );
3705
    }
3706
3707
    /**
3708
     * Return Stringy object as string, but you can also use (string) for automatically casting the object into a
@@ 3732-3746 (lines=15) @@
3729
     * @return static
3730
     *                <p>Object whose $str has had spaces switched to tabs.</p>
3731
     */
3732
    public function toTabs(int $tabLength = 4): self
3733
    {
3734
        if ($tabLength === 4) {
3735
            $tab = '    ';
3736
        } elseif ($tabLength === 2) {
3737
            $tab = '  ';
3738
        } else {
3739
            $tab = \str_repeat(' ', $tabLength);
3740
        }
3741
3742
        return static::create(
3743
            \str_replace($tab, "\t", $this->str),
3744
            $this->encoding
3745
        );
3746
    }
3747
3748
    /**
3749
     * Converts the first character of each word in the string to uppercase