Code Duplication    Length = 15-15 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 5117-5131 (lines=15) @@
5114
   *
5115
   * @return string|false The portion of haystack or false if needle is not found.
5116
   */
5117
  public static function strrchr($haystack, $needle, $before_needle = false, $encoding = 'UTF-8', $cleanUtf8 = false)
5118
  {
5119
    if ($encoding !== 'UTF-8') {
5120
      $encoding = self::normalize_encoding($encoding);
5121
    }
5122
5123
    if ($cleanUtf8 === true) {
5124
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
5125
      // if invalid characters are found in $haystack before $needle
5126
      $needle = self::clean($needle);
5127
      $haystack = self::clean($haystack);
5128
    }
5129
5130
    // fallback to "mb_"-function via polyfill
5131
    return \mb_strrchr($haystack, $needle, $before_needle, $encoding);
5132
  }
5133
5134
  /**
@@ 5175-5189 (lines=15) @@
5172
   *
5173
   * @return string|false <p>The portion of haystack or<br />false if needle is not found.</p>
5174
   */
5175
  public static function strrichr($haystack, $needle, $before_needle = false, $encoding = 'UTF-8', $cleanUtf8 = false)
5176
  {
5177
    if ($encoding !== 'UTF-8') {
5178
      $encoding = self::normalize_encoding($encoding);
5179
    }
5180
5181
    if ($cleanUtf8 === true) {
5182
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
5183
      // if invalid characters are found in $haystack before $needle
5184
      $needle = self::clean($needle);
5185
      $haystack = self::clean($haystack);
5186
    }
5187
5188
    return \mb_strrichr($haystack, $needle, $before_needle, $encoding);
5189
  }
5190
5191
  /**
5192
   * Find position of last occurrence of a case-insensitive string.