Code Duplication    Length = 20-21 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 5888-5908 (lines=21) @@
5885
   *
5886
   * @return string str with all alphabetic characters converted to lowercase.
5887
   */
5888
  public static function strtolower($str, $encoding = 'UTF-8', $cleanUtf8 = false)
5889
  {
5890
    // init
5891
    $str = (string)$str;
5892
5893
    if (!isset($str[0])) {
5894
      return '';
5895
    }
5896
5897
    if ($cleanUtf8 === true) {
5898
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
5899
      // if invalid characters are found in $haystack before $needle
5900
      $str = self::clean($str);
5901
    }
5902
5903
    if ($encoding !== 'UTF-8') {
5904
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5905
    }
5906
5907
    return \mb_strtolower($str, $encoding);
5908
  }
5909
5910
  /**
5911
   * Generic case sensitive transformation for collation matching.
@@ 5934-5953 (lines=20) @@
5931
   *
5932
   * @return string str with all alphabetic characters converted to uppercase.
5933
   */
5934
  public static function strtoupper($str, $encoding = 'UTF-8', $cleanUtf8 = false)
5935
  {
5936
    $str = (string)$str;
5937
5938
    if (!isset($str[0])) {
5939
      return '';
5940
    }
5941
5942
    if ($cleanUtf8 === true) {
5943
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
5944
      // if invalid characters are found in $haystack before $needle
5945
      $str = self::clean($str);
5946
    }
5947
5948
    if ($encoding !== 'UTF-8') {
5949
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5950
    }
5951
5952
    return \mb_strtoupper($str, $encoding);
5953
  }
5954
5955
  /**
5956
   * Translate characters or replace sub-strings.