Code Duplication    Length = 15-15 lines in 2 locations

src/Stringy.php 2 locations

@@ 3210-3224 (lines=15) @@
3207
     * @return static
3208
     *                <p>Object whose $str has had tabs switched to spaces.</p>
3209
     */
3210
    public function toSpaces(int $tabLength = 4): self
3211
    {
3212
        if ($tabLength === 4) {
3213
            $tab = '    ';
3214
        } elseif ($tabLength === 2) {
3215
            $tab = '  ';
3216
        } else {
3217
            $tab = \str_repeat(' ', $tabLength);
3218
        }
3219
3220
        return static::create(
3221
            \str_replace("\t", $tab, $this->str),
3222
            $this->encoding
3223
        );
3224
    }
3225
3226
    /**
3227
     * Return Stringy object as string, but you can also use (string) for automatically casting the object into a
@@ 3251-3265 (lines=15) @@
3248
     * @return static
3249
     *                <p>Object whose $str has had spaces switched to tabs.</p>
3250
     */
3251
    public function toTabs(int $tabLength = 4): self
3252
    {
3253
        if ($tabLength === 4) {
3254
            $tab = '    ';
3255
        } elseif ($tabLength === 2) {
3256
            $tab = '  ';
3257
        } else {
3258
            $tab = \str_repeat(' ', $tabLength);
3259
        }
3260
3261
        return static::create(
3262
            \str_replace($tab, "\t", $this->str),
3263
            $this->encoding
3264
        );
3265
    }
3266
3267
    /**
3268
     * Converts the first character of each word in the string to uppercase