Code Duplication    Length = 12-12 lines in 2 locations

src/Stringy.php 2 locations

@@ 208-219 (lines=12) @@
205
     *
206
     * @noinspection PhpDocSignatureInspection
207
     */
208
    public function append(string ...$suffix): self
209
    {
210
        if (\count($suffix) <= 1) {
211
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
212
            $suffix = $suffix[0];
213
        } else {
214
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
215
            $suffix = \implode('', $suffix);
216
        }
217
218
        return static::create($this->str . $suffix, $this->encoding);
219
    }
220
221
    /**
222
     * Append an password (limited to chars that are good readable).
@@ 2263-2274 (lines=12) @@
2260
     *
2261
     * @noinspection PhpDocSignatureInspection
2262
     */
2263
    public function prepend(string ...$prefix): self
2264
    {
2265
        if (\count($prefix) <= 1) {
2266
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
2267
            $prefix = $prefix[0];
2268
        } else {
2269
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
2270
            $prefix = \implode('', $prefix);
2271
        }
2272
2273
        return static::create($prefix . $this->str, $this->encoding);
2274
    }
2275
2276
    /**
2277
     * Replaces all occurrences of $pattern in $str by $replacement.