Code Duplication    Length = 12-12 lines in 2 locations

src/Stringy.php 2 locations

@@ 233-244 (lines=12) @@
230
     *
231
     * @noinspection PhpDocSignatureInspection
232
     */
233
    public function append(string ...$suffix): self
234
    {
235
        if (\count($suffix) <= 1) {
236
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
237
            $suffix = $suffix[0];
238
        } else {
239
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
240
            $suffix = \implode('', $suffix);
241
        }
242
243
        return static::create($this->str . $suffix, $this->encoding);
244
    }
245
246
    /**
247
     * Append an password (limited to chars that are good readable).
@@ 2393-2404 (lines=12) @@
2390
     *
2391
     * @noinspection PhpDocSignatureInspection
2392
     */
2393
    public function prepend(string ...$prefix): self
2394
    {
2395
        if (\count($prefix) <= 1) {
2396
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
2397
            $prefix = $prefix[0];
2398
        } else {
2399
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
2400
            $prefix = \implode('', $prefix);
2401
        }
2402
2403
        return static::create($prefix . $this->str, $this->encoding);
2404
    }
2405
2406
    /**
2407
     * Replaces all occurrences of $pattern in $str by $replacement.