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).
@@ 1721-1732 (lines=12) @@
1718
     *
1719
     * @noinspection PhpDocSignatureInspection
1720
     */
1721
    public function prepend(string ...$prefix): self
1722
    {
1723
        if (\count($prefix) <= 1) {
1724
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
1725
            $prefix = $prefix[0];
1726
        } else {
1727
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
1728
            $prefix = \implode('', ...$prefix);
1729
        }
1730
1731
        return static::create($prefix . $this->str, $this->encoding);
1732
    }
1733
1734
    /**
1735
     * Replaces all occurrences of $pattern in $str by $replacement.