Code Duplication    Length = 15-15 lines in 2 locations

src/Stringy.php 2 locations

@@ 3425-3439 (lines=15) @@
3422
     * @return static
3423
     *                <p>Object whose $str has had tabs switched to spaces.</p>
3424
     */
3425
    public function toSpaces(int $tabLength = 4): self
3426
    {
3427
        if ($tabLength === 4) {
3428
            $tab = '    ';
3429
        } elseif ($tabLength === 2) {
3430
            $tab = '  ';
3431
        } else {
3432
            $tab = \str_repeat(' ', $tabLength);
3433
        }
3434
3435
        return static::create(
3436
            \str_replace("\t", $tab, $this->str),
3437
            $this->encoding
3438
        );
3439
    }
3440
3441
    /**
3442
     * Return Stringy object as string, but you can also use (string) for automatically casting the object into a
@@ 3466-3480 (lines=15) @@
3463
     * @return static
3464
     *                <p>Object whose $str has had spaces switched to tabs.</p>
3465
     */
3466
    public function toTabs(int $tabLength = 4): self
3467
    {
3468
        if ($tabLength === 4) {
3469
            $tab = '    ';
3470
        } elseif ($tabLength === 2) {
3471
            $tab = '  ';
3472
        } else {
3473
            $tab = \str_repeat(' ', $tabLength);
3474
        }
3475
3476
        return static::create(
3477
            \str_replace($tab, "\t", $this->str),
3478
            $this->encoding
3479
        );
3480
    }
3481
3482
    /**
3483
     * Converts the first character of each word in the string to uppercase