Code Duplication    Length = 12-12 lines in 2 locations

src/Stringy.php 2 locations

@@ 208-219 (lines=12) @@
205
     *
206
     * @noinspection PhpDocSignatureInspection
207
     */
208
    public function append(string ...$suffix): self
209
    {
210
        if (\count($suffix) <= 1) {
211
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
212
            $suffix = $suffix[0];
213
        } else {
214
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
215
            $suffix = \implode('', $suffix);
216
        }
217
218
        return static::create($this->str . $suffix, $this->encoding);
219
    }
220
221
    /**
222
     * Append an password (limited to chars that are good readable).
@@ 2005-2016 (lines=12) @@
2002
     *
2003
     * @noinspection PhpDocSignatureInspection
2004
     */
2005
    public function prepend(string ...$prefix): self
2006
    {
2007
        if (\count($prefix) <= 1) {
2008
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
2009
            $prefix = $prefix[0];
2010
        } else {
2011
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
2012
            $prefix = \implode('', $prefix);
2013
        }
2014
2015
        return static::create($prefix . $this->str, $this->encoding);
2016
    }
2017
2018
    /**
2019
     * Replaces all occurrences of $pattern in $str by $replacement.