Code Duplication    Length = 15-15 lines in 2 locations

src/Stringy.php 2 locations

@@ 4444-4458 (lines=15) @@
4441
     * @return static
4442
     *                <p>Object whose $str has had tabs switched to spaces.</p>
4443
     */
4444
    public function toSpaces(int $tabLength = 4): self
4445
    {
4446
        if ($tabLength === 4) {
4447
            $tab = '    ';
4448
        } elseif ($tabLength === 2) {
4449
            $tab = '  ';
4450
        } else {
4451
            $tab = \str_repeat(' ', $tabLength);
4452
        }
4453
4454
        return static::create(
4455
            \str_replace("\t", $tab, $this->str),
4456
            $this->encoding
4457
        );
4458
    }
4459
4460
    /**
4461
     * Return Stringy object as string, but you can also use (string) for automatically casting the object into a
@@ 4493-4507 (lines=15) @@
4490
     * @return static
4491
     *                <p>Object whose $str has had spaces switched to tabs.</p>
4492
     */
4493
    public function toTabs(int $tabLength = 4): self
4494
    {
4495
        if ($tabLength === 4) {
4496
            $tab = '    ';
4497
        } elseif ($tabLength === 2) {
4498
            $tab = '  ';
4499
        } else {
4500
            $tab = \str_repeat(' ', $tabLength);
4501
        }
4502
4503
        return static::create(
4504
            \str_replace($tab, "\t", $this->str),
4505
            $this->encoding
4506
        );
4507
    }
4508
4509
    /**
4510
     * Converts the first character of each word in the string to uppercase