Code Duplication    Length = 15-15 lines in 2 locations

src/Stringy.php 2 locations

@@ 2189-2203 (lines=15) @@
2186
     *
2187
     * @return static <p>Object whose $str has had tabs switched to spaces.</p>
2188
     */
2189
    public function toSpaces(int $tabLength = 4): self
2190
    {
2191
        if ($tabLength === 4) {
2192
            $tab = '    ';
2193
        } elseif ($tabLength === 2) {
2194
            $tab = '  ';
2195
        } else {
2196
            $tab = \str_repeat(' ', $tabLength);
2197
        }
2198
2199
        return static::create(
2200
            \str_replace("\t", $tab, $this->str),
2201
            $this->encoding
2202
        );
2203
    }
2204
2205
    /**
2206
     * Return Stringy object as string, but you can also use (string) for automatically casting the object into a
@@ 2225-2239 (lines=15) @@
2222
     *
2223
     * @return static <p>Object whose $str has had spaces switched to tabs.</p>
2224
     */
2225
    public function toTabs(int $tabLength = 4): self
2226
    {
2227
        if ($tabLength === 4) {
2228
            $tab = '    ';
2229
        } elseif ($tabLength === 2) {
2230
            $tab = '  ';
2231
        } else {
2232
            $tab = \str_repeat(' ', $tabLength);
2233
        }
2234
2235
        return static::create(
2236
            \str_replace($tab, "\t", $this->str),
2237
            $this->encoding
2238
        );
2239
    }
2240
2241
    /**
2242
     * Converts the first character of each word in the string to uppercase