Code Duplication    Length = 15-15 lines in 2 locations

src/Stringy.php 2 locations

@@ 2311-2325 (lines=15) @@
2308
     * @return static
2309
     *                <p>Object whose $str has had tabs switched to spaces.</p>
2310
     */
2311
    public function toSpaces(int $tabLength = 4): self
2312
    {
2313
        if ($tabLength === 4) {
2314
            $tab = '    ';
2315
        } elseif ($tabLength === 2) {
2316
            $tab = '  ';
2317
        } else {
2318
            $tab = \str_repeat(' ', $tabLength);
2319
        }
2320
2321
        return static::create(
2322
            \str_replace("\t", $tab, $this->str),
2323
            $this->encoding
2324
        );
2325
    }
2326
2327
    /**
2328
     * Return Stringy object as string, but you can also use (string) for automatically casting the object into a
@@ 2348-2362 (lines=15) @@
2345
     * @return static
2346
     *                <p>Object whose $str has had spaces switched to tabs.</p>
2347
     */
2348
    public function toTabs(int $tabLength = 4): self
2349
    {
2350
        if ($tabLength === 4) {
2351
            $tab = '    ';
2352
        } elseif ($tabLength === 2) {
2353
            $tab = '  ';
2354
        } else {
2355
            $tab = \str_repeat(' ', $tabLength);
2356
        }
2357
2358
        return static::create(
2359
            \str_replace($tab, "\t", $this->str),
2360
            $this->encoding
2361
        );
2362
    }
2363
2364
    /**
2365
     * Converts the first character of each word in the string to uppercase