Code Duplication    Length = 15-15 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 5294-5308 (lines=15) @@
5291
   *
5292
   * @return string|false The portion of haystack or false if needle is not found.
5293
   */
5294
  public static function strrchr($haystack, $needle, $before_needle = false, $encoding = 'UTF-8', $cleanUtf8 = false)
5295
  {
5296
    if ($encoding !== 'UTF-8') {
5297
      $encoding = self::normalize_encoding($encoding);
5298
    }
5299
5300
    if ($cleanUtf8 === true) {
5301
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
5302
      // if invalid characters are found in $haystack before $needle
5303
      $needle = self::clean($needle);
5304
      $haystack = self::clean($haystack);
5305
    }
5306
5307
    // fallback to "mb_"-function via polyfill
5308
    return \mb_strrchr($haystack, $needle, $before_needle, $encoding);
5309
  }
5310
5311
  /**
@@ 5352-5366 (lines=15) @@
5349
   *
5350
   * @return string|false <p>The portion of haystack or<br />false if needle is not found.</p>
5351
   */
5352
  public static function strrichr($haystack, $needle, $before_needle = false, $encoding = 'UTF-8', $cleanUtf8 = false)
5353
  {
5354
    if ($encoding !== 'UTF-8') {
5355
      $encoding = self::normalize_encoding($encoding);
5356
    }
5357
5358
    if ($cleanUtf8 === true) {
5359
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
5360
      // if invalid characters are found in $haystack before $needle
5361
      $needle = self::clean($needle);
5362
      $haystack = self::clean($haystack);
5363
    }
5364
5365
    return \mb_strrichr($haystack, $needle, $before_needle, $encoding);
5366
  }
5367
5368
  /**
5369
   * Find position of last occurrence of a case-insensitive string.