Code Duplication    Length = 15-15 lines in 2 locations

src/Stringy.php 2 locations

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