Code Duplication    Length = 10-14 lines in 2 locations

src/Support/Str.php 2 locations

@@ 345-358 (lines=14) @@
342
     * @param  string  $subject
343
     * @return string
344
     */
345
    public static function replaceFirst($search, $replace, $subject)
346
    {
347
        if ($search == '') {
348
            return $subject;
349
        }
350
351
        $position = strpos($subject, $search);
352
353
        if ($position !== false) {
354
            return substr_replace($subject, $replace, $position, strlen($search));
355
        }
356
357
        return $subject;
358
    }
359
360
    /**
361
     * Replace the last occurrence of a given value in the string.
@@ 368-377 (lines=10) @@
365
     * @param  string  $subject
366
     * @return string
367
     */
368
    public static function replaceLast($search, $replace, $subject)
369
    {
370
        $position = strrpos($subject, $search);
371
372
        if ($position !== false) {
373
            return substr_replace($subject, $replace, $position, strlen($search));
374
        }
375
376
        return $subject;
377
    }
378
379
    /**
380
     * Begin a string with a single instance of a given value.