Code Duplication    Length = 15-15 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 5166-5180 (lines=15) @@
5163
   *
5164
   * @return string|false The portion of haystack or false if needle is not found.
5165
   */
5166
  public static function strrchr($haystack, $needle, $before_needle = false, $encoding = 'UTF-8', $cleanUtf8 = false)
5167
  {
5168
    if ($encoding !== 'UTF-8') {
5169
      $encoding = self::normalize_encoding($encoding);
5170
    }
5171
5172
    if ($cleanUtf8 === true) {
5173
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
5174
      // if invalid characters are found in $haystack before $needle
5175
      $needle = self::clean($needle);
5176
      $haystack = self::clean($haystack);
5177
    }
5178
5179
    // fallback to "mb_"-function via polyfill
5180
    return \mb_strrchr($haystack, $needle, $before_needle, $encoding);
5181
  }
5182
5183
  /**
@@ 5224-5238 (lines=15) @@
5221
   *
5222
   * @return string|false <p>The portion of haystack or<br />false if needle is not found.</p>
5223
   */
5224
  public static function strrichr($haystack, $needle, $before_needle = false, $encoding = 'UTF-8', $cleanUtf8 = false)
5225
  {
5226
    if ($encoding !== 'UTF-8') {
5227
      $encoding = self::normalize_encoding($encoding);
5228
    }
5229
5230
    if ($cleanUtf8 === true) {
5231
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
5232
      // if invalid characters are found in $haystack before $needle
5233
      $needle = self::clean($needle);
5234
      $haystack = self::clean($haystack);
5235
    }
5236
5237
    return \mb_strrichr($haystack, $needle, $before_needle, $encoding);
5238
  }
5239
5240
  /**
5241
   * Find position of last occurrence of a case-insensitive string.