Code Duplication    Length = 15-15 lines in 2 locations

src/Stringy.php 2 locations

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