Code Duplication    Length = 15-15 lines in 2 locations

src/Stringy.php 2 locations

@@ 3257-3271 (lines=15) @@
3254
     * @return static
3255
     *                <p>Object whose $str has had tabs switched to spaces.</p>
3256
     */
3257
    public function toSpaces(int $tabLength = 4): self
3258
    {
3259
        if ($tabLength === 4) {
3260
            $tab = '    ';
3261
        } elseif ($tabLength === 2) {
3262
            $tab = '  ';
3263
        } else {
3264
            $tab = \str_repeat(' ', $tabLength);
3265
        }
3266
3267
        return static::create(
3268
            \str_replace("\t", $tab, $this->str),
3269
            $this->encoding
3270
        );
3271
    }
3272
3273
    /**
3274
     * Return Stringy object as string, but you can also use (string) for automatically casting the object into a
@@ 3298-3312 (lines=15) @@
3295
     * @return static
3296
     *                <p>Object whose $str has had spaces switched to tabs.</p>
3297
     */
3298
    public function toTabs(int $tabLength = 4): self
3299
    {
3300
        if ($tabLength === 4) {
3301
            $tab = '    ';
3302
        } elseif ($tabLength === 2) {
3303
            $tab = '  ';
3304
        } else {
3305
            $tab = \str_repeat(' ', $tabLength);
3306
        }
3307
3308
        return static::create(
3309
            \str_replace($tab, "\t", $this->str),
3310
            $this->encoding
3311
        );
3312
    }
3313
3314
    /**
3315
     * Converts the first character of each word in the string to uppercase