Code Duplication    Length = 12-12 lines in 2 locations

src/Stringy.php 2 locations

@@ 202-213 (lines=12) @@
199
     *
200
     * @noinspection PhpDocSignatureInspection
201
     */
202
    public function append(string ...$suffix): self
203
    {
204
        if (\count($suffix) <= 1) {
205
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
206
            $suffix = $suffix[0];
207
        } else {
208
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
209
            $suffix = \implode('', $suffix);
210
        }
211
212
        return static::create($this->str . $suffix, $this->encoding);
213
    }
214
215
    /**
216
     * Append an password (limited to chars that are good readable).
@@ 1579-1590 (lines=12) @@
1576
     *
1577
     * @noinspection PhpDocSignatureInspection
1578
     */
1579
    public function prepend(string ...$prefix): self
1580
    {
1581
        if (\count($prefix) <= 1) {
1582
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
1583
            $prefix = $prefix[0];
1584
        } else {
1585
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
1586
            $prefix = \implode('', ...$prefix);
1587
        }
1588
1589
        return static::create($prefix . $this->str, $this->encoding);
1590
    }
1591
1592
    /**
1593
     * Replaces all occurrences of $pattern in $str by $replacement.