Code Duplication    Length = 15-15 lines in 2 locations

src/Stringy.php 2 locations

@@ 3710-3724 (lines=15) @@
3707
     * @return static
3708
     *                <p>Object whose $str has had tabs switched to spaces.</p>
3709
     */
3710
    public function toSpaces(int $tabLength = 4): self
3711
    {
3712
        if ($tabLength === 4) {
3713
            $tab = '    ';
3714
        } elseif ($tabLength === 2) {
3715
            $tab = '  ';
3716
        } else {
3717
            $tab = \str_repeat(' ', $tabLength);
3718
        }
3719
3720
        return static::create(
3721
            \str_replace("\t", $tab, $this->str),
3722
            $this->encoding
3723
        );
3724
    }
3725
3726
    /**
3727
     * Return Stringy object as string, but you can also use (string) for automatically casting the object into a
@@ 3751-3765 (lines=15) @@
3748
     * @return static
3749
     *                <p>Object whose $str has had spaces switched to tabs.</p>
3750
     */
3751
    public function toTabs(int $tabLength = 4): self
3752
    {
3753
        if ($tabLength === 4) {
3754
            $tab = '    ';
3755
        } elseif ($tabLength === 2) {
3756
            $tab = '  ';
3757
        } else {
3758
            $tab = \str_repeat(' ', $tabLength);
3759
        }
3760
3761
        return static::create(
3762
            \str_replace($tab, "\t", $this->str),
3763
            $this->encoding
3764
        );
3765
    }
3766
3767
    /**
3768
     * Converts the first character of each word in the string to uppercase