Code Duplication    Length = 15-15 lines in 2 locations

src/Stringy.php 2 locations

@@ 2304-2318 (lines=15) @@
2301
     * @return static
2302
     *                <p>Object whose $str has had tabs switched to spaces.</p>
2303
     */
2304
    public function toSpaces(int $tabLength = 4): self
2305
    {
2306
        if ($tabLength === 4) {
2307
            $tab = '    ';
2308
        } elseif ($tabLength === 2) {
2309
            $tab = '  ';
2310
        } else {
2311
            $tab = \str_repeat(' ', $tabLength);
2312
        }
2313
2314
        return static::create(
2315
            \str_replace("\t", $tab, $this->str),
2316
            $this->encoding
2317
        );
2318
    }
2319
2320
    /**
2321
     * Return Stringy object as string, but you can also use (string) for automatically casting the object into a
@@ 2341-2355 (lines=15) @@
2338
     * @return static
2339
     *                <p>Object whose $str has had spaces switched to tabs.</p>
2340
     */
2341
    public function toTabs(int $tabLength = 4): self
2342
    {
2343
        if ($tabLength === 4) {
2344
            $tab = '    ';
2345
        } elseif ($tabLength === 2) {
2346
            $tab = '  ';
2347
        } else {
2348
            $tab = \str_repeat(' ', $tabLength);
2349
        }
2350
2351
        return static::create(
2352
            \str_replace($tab, "\t", $this->str),
2353
            $this->encoding
2354
        );
2355
    }
2356
2357
    /**
2358
     * Converts the first character of each word in the string to uppercase