Code Duplication    Length = 15-16 lines in 2 locations

includes/libraries/protect/AntiXSS/UTF8.php 2 locations

@@ 5637-5652 (lines=16) @@
5634
   *
5635
   * @return string|false The portion of haystack or false if needle is not found.
5636
   */
5637
  public static function strrchr($haystack, $needle, $before_needle = false, $encoding = 'UTF-8', $cleanUtf8 = false)
5638
  {
5639
    if ($encoding !== 'UTF-8') {
5640
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5641
    }
5642
5643
    if ($cleanUtf8 === true) {
5644
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
5645
      // if invalid characters are found in $haystack before $needle
5646
      $needle = self::clean($needle);
5647
      $haystack = self::clean($haystack);
5648
    }
5649
5650
    // fallback to "mb_"-function via polyfill
5651
    return \mb_strrchr($haystack, $needle, $before_needle, $encoding);
5652
  }
5653
5654
  /**
5655
   * Reverses characters order in the string.
@@ 5695-5709 (lines=15) @@
5692
   *
5693
   * @return string|false <p>The portion of haystack or<br />false if needle is not found.</p>
5694
   */
5695
  public static function strrichr($haystack, $needle, $before_needle = false, $encoding = 'UTF-8', $cleanUtf8 = false)
5696
  {
5697
    if ($encoding !== 'UTF-8') {
5698
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5699
    }
5700
5701
    if ($cleanUtf8 === true) {
5702
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
5703
      // if invalid characters are found in $haystack before $needle
5704
      $needle = self::clean($needle);
5705
      $haystack = self::clean($haystack);
5706
    }
5707
5708
    return \mb_strrichr($haystack, $needle, $before_needle, $encoding);
5709
  }
5710
5711
  /**
5712
   * Find position of last occurrence of a case-insensitive string.