Code Duplication    Length = 15-15 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 5087-5101 (lines=15) @@
5084
   *
5085
   * @return string|false The portion of haystack or false if needle is not found.
5086
   */
5087
  public static function strrchr($haystack, $needle, $before_needle = false, $encoding = 'UTF-8', $cleanUtf8 = false)
5088
  {
5089
    if ($encoding !== 'UTF-8') {
5090
      $encoding = self::normalize_encoding($encoding);
5091
    }
5092
5093
    if ($cleanUtf8 === true) {
5094
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
5095
      // if invalid characters are found in $haystack before $needle
5096
      $needle = self::clean($needle);
5097
      $haystack = self::clean($haystack);
5098
    }
5099
5100
    // fallback to "mb_"-function via polyfill
5101
    return \mb_strrchr($haystack, $needle, $before_needle, $encoding);
5102
  }
5103
5104
  /**
@@ 5145-5159 (lines=15) @@
5142
   *
5143
   * @return string|false <p>The portion of haystack or<br />false if needle is not found.</p>
5144
   */
5145
  public static function strrichr($haystack, $needle, $before_needle = false, $encoding = 'UTF-8', $cleanUtf8 = false)
5146
  {
5147
    if ($encoding !== 'UTF-8') {
5148
      $encoding = self::normalize_encoding($encoding);
5149
    }
5150
5151
    if ($cleanUtf8 === true) {
5152
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
5153
      // if invalid characters are found in $haystack before $needle
5154
      $needle = self::clean($needle);
5155
      $haystack = self::clean($haystack);
5156
    }
5157
5158
    return \mb_strrichr($haystack, $needle, $before_needle, $encoding);
5159
  }
5160
5161
  /**
5162
   * Find position of last occurrence of a case-insensitive string.