Code Duplication    Length = 12-12 lines in 2 locations

src/Stringy.php 2 locations

@@ 190-201 (lines=12) @@
187
     *
188
     * @noinspection PhpDocSignatureInspection
189
     */
190
    public function append(string ...$suffix): self
191
    {
192
        if (\count($suffix) <= 1) {
193
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
194
            $suffix = $suffix[0];
195
        } else {
196
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
197
            $suffix = \implode('', $suffix);
198
        }
199
200
        return static::create($this->str . $suffix, $this->encoding);
201
    }
202
203
    /**
204
     * Append an password (limited to chars that are good readable).
@@ 1688-1699 (lines=12) @@
1685
     *
1686
     * @noinspection PhpDocSignatureInspection
1687
     */
1688
    public function prepend(string ...$prefix): self
1689
    {
1690
        if (\count($prefix) <= 1) {
1691
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
1692
            $prefix = $prefix[0];
1693
        } else {
1694
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
1695
            $prefix = \implode('', ...$prefix);
1696
        }
1697
1698
        return static::create($prefix . $this->str, $this->encoding);
1699
    }
1700
1701
    /**
1702
     * Replaces all occurrences of $pattern in $str by $replacement.