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).
@@ 2448-2459 (lines=12) @@
2445
     *
2446
     * @noinspection PhpDocSignatureInspection
2447
     */
2448
    public function prepend(string ...$prefix): self
2449
    {
2450
        if (\count($prefix) <= 1) {
2451
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
2452
            $prefix = $prefix[0];
2453
        } else {
2454
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
2455
            $prefix = \implode('', $prefix);
2456
        }
2457
2458
        return static::create($prefix . $this->str, $this->encoding);
2459
    }
2460
2461
    /**
2462
     * Replaces all occurrences of $pattern in $str by $replacement.