Code Duplication    Length = 20-21 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 5789-5809 (lines=21) @@
5786
   *
5787
   * @return string str with all alphabetic characters converted to lowercase.
5788
   */
5789
  public static function strtolower($str, $encoding = 'UTF-8', $cleanUtf8 = false)
5790
  {
5791
    // init
5792
    $str = (string)$str;
5793
5794
    if (!isset($str[0])) {
5795
      return '';
5796
    }
5797
5798
    if ($cleanUtf8 === true) {
5799
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
5800
      // if invalid characters are found in $haystack before $needle
5801
      $str = self::clean($str);
5802
    }
5803
5804
    if ($encoding !== 'UTF-8') {
5805
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5806
    }
5807
5808
    return \mb_strtolower($str, $encoding);
5809
  }
5810
5811
  /**
5812
   * Generic case sensitive transformation for collation matching.
@@ 5835-5854 (lines=20) @@
5832
   *
5833
   * @return string str with all alphabetic characters converted to uppercase.
5834
   */
5835
  public static function strtoupper($str, $encoding = 'UTF-8', $cleanUtf8 = false)
5836
  {
5837
    $str = (string)$str;
5838
5839
    if (!isset($str[0])) {
5840
      return '';
5841
    }
5842
5843
    if ($cleanUtf8 === true) {
5844
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
5845
      // if invalid characters are found in $haystack before $needle
5846
      $str = self::clean($str);
5847
    }
5848
5849
    if ($encoding !== 'UTF-8') {
5850
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5851
    }
5852
5853
    return \mb_strtoupper($str, $encoding);
5854
  }
5855
5856
  /**
5857
   * Translate characters or replace sub-strings.