Code Duplication    Length = 13-13 lines in 2 locations

src/Stringy.php 2 locations

@@ 288-300 (lines=13) @@
285
     * @return static
286
     *                <p>Object with appended $suffix.</p>
287
     */
288
    public function appendStringy(...$suffix): self
289
    {
290
        $suffixStr = '';
291
        foreach ($suffix as $suffixTmp) {
292
            if ($suffixTmp instanceof CollectionStringy) {
293
                $suffixStr .= $suffixTmp->implode('');
294
            } else {
295
                $suffixStr .= $suffixTmp->toString();
296
            }
297
        }
298
299
        return static::create($this->str . $suffixStr, $this->encoding);
300
    }
301
302
    /**
303
     * Append an unique identifier.
@@ 2662-2674 (lines=13) @@
2659
     * @return static
2660
     *                <p>Object with appended $prefix.</p>
2661
     */
2662
    public function prependStringy(...$prefix): self
2663
    {
2664
        $prefixStr = '';
2665
        foreach ($prefix as $prefixTmp) {
2666
            if ($prefixTmp instanceof CollectionStringy) {
2667
                $prefixStr .= $prefixTmp->implode('');
2668
            } else {
2669
                $prefixStr .= $prefixTmp->toString();
2670
            }
2671
        }
2672
2673
        return static::create($prefixStr . $this->str, $this->encoding);
2674
    }
2675
2676
    /**
2677
     * Replaces all occurrences of $pattern in $str by $replacement.