Code Duplication    Length = 15-15 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 4987-5001 (lines=15) @@
4984
   *
4985
   * @return string|false The portion of haystack or false if needle is not found.
4986
   */
4987
  public static function strrchr($haystack, $needle, $before_needle = false, $encoding = 'UTF-8', $cleanUtf8 = false)
4988
  {
4989
    if ($encoding !== 'UTF-8') {
4990
      $encoding = self::normalize_encoding($encoding);
4991
    }
4992
4993
    if ($cleanUtf8 === true) {
4994
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
4995
      // if invalid characters are found in $haystack before $needle
4996
      $needle = self::clean($needle);
4997
      $haystack = self::clean($haystack);
4998
    }
4999
5000
    return \mb_strrchr($haystack, $needle, $before_needle, $encoding);
5001
  }
5002
5003
  /**
5004
   * Reverses characters order in the string.
@@ 5044-5058 (lines=15) @@
5041
   *
5042
   * @return string|false <p>The portion of haystack or<br />false if needle is not found.</p>
5043
   */
5044
  public static function strrichr($haystack, $needle, $before_needle = false, $encoding = 'UTF-8', $cleanUtf8 = false)
5045
  {
5046
    if ($encoding !== 'UTF-8') {
5047
      $encoding = self::normalize_encoding($encoding);
5048
    }
5049
5050
    if ($cleanUtf8 === true) {
5051
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
5052
      // if invalid characters are found in $haystack before $needle
5053
      $needle = self::clean($needle);
5054
      $haystack = self::clean($haystack);
5055
    }
5056
5057
    return \mb_strrichr($haystack, $needle, $before_needle, $encoding);
5058
  }
5059
5060
  /**
5061
   * Find position of last occurrence of a case-insensitive string.