Code Duplication    Length = 15-15 lines in 2 locations

src/Stringy.php 2 locations

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