Code Duplication    Length = 12-12 lines in 2 locations

src/Stringy.php 2 locations

@@ 231-242 (lines=12) @@
228
     * @return static
229
     *                <p>Object with appended $suffix.</p>
230
     */
231
    public function append(string ...$suffix): self
232
    {
233
        if (\count($suffix) <= 1) {
234
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
235
            $suffix = $suffix[0];
236
        } else {
237
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
238
            $suffix = \implode('', $suffix);
239
        }
240
241
        return static::create($this->str . $suffix, $this->encoding);
242
    }
243
244
    /**
245
     * Append an password (limited to chars that are good readable).
@@ 2637-2648 (lines=12) @@
2634
     * @return static
2635
     *                <p>Object with appended $prefix.</p>
2636
     */
2637
    public function prepend(string ...$prefix): self
2638
    {
2639
        if (\count($prefix) <= 1) {
2640
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
2641
            $prefix = $prefix[0];
2642
        } else {
2643
            /** @noinspection CallableParameterUseCaseInTypeContextInspection */
2644
            $prefix = \implode('', $prefix);
2645
        }
2646
2647
        return static::create($prefix . $this->str, $this->encoding);
2648
    }
2649
2650
    /**
2651
     * Returns a new string starting with $prefix.