Code Duplication    Length = 15-15 lines in 2 locations

src/Stringy.php 2 locations

@@ 3415-3429 (lines=15) @@
3412
     * @return static
3413
     *                <p>Object whose $str has had tabs switched to spaces.</p>
3414
     */
3415
    public function toSpaces(int $tabLength = 4): self
3416
    {
3417
        if ($tabLength === 4) {
3418
            $tab = '    ';
3419
        } elseif ($tabLength === 2) {
3420
            $tab = '  ';
3421
        } else {
3422
            $tab = \str_repeat(' ', $tabLength);
3423
        }
3424
3425
        return static::create(
3426
            \str_replace("\t", $tab, $this->str),
3427
            $this->encoding
3428
        );
3429
    }
3430
3431
    /**
3432
     * Return Stringy object as string, but you can also use (string) for automatically casting the object into a
@@ 3456-3470 (lines=15) @@
3453
     * @return static
3454
     *                <p>Object whose $str has had spaces switched to tabs.</p>
3455
     */
3456
    public function toTabs(int $tabLength = 4): self
3457
    {
3458
        if ($tabLength === 4) {
3459
            $tab = '    ';
3460
        } elseif ($tabLength === 2) {
3461
            $tab = '  ';
3462
        } else {
3463
            $tab = \str_repeat(' ', $tabLength);
3464
        }
3465
3466
        return static::create(
3467
            \str_replace($tab, "\t", $this->str),
3468
            $this->encoding
3469
        );
3470
    }
3471
3472
    /**
3473
     * Converts the first character of each word in the string to uppercase