Code Duplication    Length = 15-15 lines in 2 locations

src/Stringy.php 2 locations

@@ 3340-3354 (lines=15) @@
3337
     * @return static
3338
     *                <p>Object whose $str has had tabs switched to spaces.</p>
3339
     */
3340
    public function toSpaces(int $tabLength = 4): self
3341
    {
3342
        if ($tabLength === 4) {
3343
            $tab = '    ';
3344
        } elseif ($tabLength === 2) {
3345
            $tab = '  ';
3346
        } else {
3347
            $tab = \str_repeat(' ', $tabLength);
3348
        }
3349
3350
        return static::create(
3351
            \str_replace("\t", $tab, $this->str),
3352
            $this->encoding
3353
        );
3354
    }
3355
3356
    /**
3357
     * Return Stringy object as string, but you can also use (string) for automatically casting the object into a
@@ 3381-3395 (lines=15) @@
3378
     * @return static
3379
     *                <p>Object whose $str has had spaces switched to tabs.</p>
3380
     */
3381
    public function toTabs(int $tabLength = 4): self
3382
    {
3383
        if ($tabLength === 4) {
3384
            $tab = '    ';
3385
        } elseif ($tabLength === 2) {
3386
            $tab = '  ';
3387
        } else {
3388
            $tab = \str_repeat(' ', $tabLength);
3389
        }
3390
3391
        return static::create(
3392
            \str_replace($tab, "\t", $this->str),
3393
            $this->encoding
3394
        );
3395
    }
3396
3397
    /**
3398
     * Converts the first character of each word in the string to uppercase