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).
@@ 1604-1615 (lines=12) @@
1601
     *
1602
     * @noinspection PhpDocSignatureInspection
1603
     */
1604
    public function prepend(string ...$prefix): self
1605
    {
1606
        if (\count($prefix) <= 1) {
1607
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
1608
            $prefix = $prefix[0];
1609
        } else {
1610
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
1611
            $prefix = \implode('', ...$prefix);
1612
        }
1613
1614
        return static::create($prefix . $this->str, $this->encoding);
1615
    }
1616
1617
    /**
1618
     * Replaces all occurrences of $pattern in $str by $replacement.