Code Duplication    Length = 15-15 lines in 2 locations

src/Stringy.php 2 locations

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