Code Duplication    Length = 15-15 lines in 2 locations

src/Stringy.php 2 locations

@@ 2450-2464 (lines=15) @@
2447
     * @return static
2448
     *                <p>Object whose $str has had tabs switched to spaces.</p>
2449
     */
2450
    public function toSpaces(int $tabLength = 4): self
2451
    {
2452
        if ($tabLength === 4) {
2453
            $tab = '    ';
2454
        } elseif ($tabLength === 2) {
2455
            $tab = '  ';
2456
        } else {
2457
            $tab = \str_repeat(' ', $tabLength);
2458
        }
2459
2460
        return static::create(
2461
            \str_replace("\t", $tab, $this->str),
2462
            $this->encoding
2463
        );
2464
    }
2465
2466
    /**
2467
     * Return Stringy object as string, but you can also use (string) for automatically casting the object into a
@@ 2487-2501 (lines=15) @@
2484
     * @return static
2485
     *                <p>Object whose $str has had spaces switched to tabs.</p>
2486
     */
2487
    public function toTabs(int $tabLength = 4): self
2488
    {
2489
        if ($tabLength === 4) {
2490
            $tab = '    ';
2491
        } elseif ($tabLength === 2) {
2492
            $tab = '  ';
2493
        } else {
2494
            $tab = \str_repeat(' ', $tabLength);
2495
        }
2496
2497
        return static::create(
2498
            \str_replace($tab, "\t", $this->str),
2499
            $this->encoding
2500
        );
2501
    }
2502
2503
    /**
2504
     * Converts the first character of each word in the string to uppercase