Code Duplication    Length = 15-16 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 5750-5765 (lines=16) @@
5747
   *
5748
   * @return string|false The portion of haystack or false if needle is not found.
5749
   */
5750
  public static function strrchr($haystack, $needle, $before_needle = false, $encoding = 'UTF-8', $cleanUtf8 = false)
5751
  {
5752
    if ($encoding !== 'UTF-8') {
5753
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5754
    }
5755
5756
    if ($cleanUtf8 === true) {
5757
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
5758
      // if invalid characters are found in $haystack before $needle
5759
      $needle = self::clean($needle);
5760
      $haystack = self::clean($haystack);
5761
    }
5762
5763
    // fallback to "mb_"-function via polyfill
5764
    return \mb_strrchr($haystack, $needle, $before_needle, $encoding);
5765
  }
5766
5767
  /**
5768
   * Reverses characters order in the string.
@@ 5808-5822 (lines=15) @@
5805
   *
5806
   * @return string|false <p>The portion of haystack or<br>false if needle is not found.</p>
5807
   */
5808
  public static function strrichr($haystack, $needle, $before_needle = false, $encoding = 'UTF-8', $cleanUtf8 = false)
5809
  {
5810
    if ($encoding !== 'UTF-8') {
5811
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5812
    }
5813
5814
    if ($cleanUtf8 === true) {
5815
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
5816
      // if invalid characters are found in $haystack before $needle
5817
      $needle = self::clean($needle);
5818
      $haystack = self::clean($haystack);
5819
    }
5820
5821
    return \mb_strrichr($haystack, $needle, $before_needle, $encoding);
5822
  }
5823
5824
  /**
5825
   * Find position of last occurrence of a case-insensitive string.