Code Duplication    Length = 10-14 lines in 2 locations

src/Helpers/Str.php 2 locations

@@ 372-385 (lines=14) @@
369
     *
370
     * @return string
371
     */
372
    public static function replaceFirst($search, $replace, $subject)
373
    {
374
        if ($search == '') {
375
            return $subject;
376
        }
377
378
        $position = \strpos($subject, $search);
379
380
        if ($position !== false) {
381
            return \substr_replace($subject, $replace, $position, \strlen($search));
382
        }
383
384
        return $subject;
385
    }
386
387
    /**
388
     * Replace the last occurrence of a given value in the string.
@@ 396-405 (lines=10) @@
393
     *
394
     * @return string
395
     */
396
    public static function replaceLast($search, $replace, $subject)
397
    {
398
        $position = \strrpos($subject, $search);
399
400
        if ($position !== false) {
401
            return \substr_replace($subject, $replace, $position, \strlen($search));
402
        }
403
404
        return $subject;
405
    }
406
407
    /**
408
     * Begin a string with a single instance of a given value.