Code Duplication    Length = 20-21 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 5908-5928 (lines=21) @@
5905
   *
5906
   * @return string str with all alphabetic characters converted to lowercase.
5907
   */
5908
  public static function strtolower($str, $encoding = 'UTF-8', $cleanUtf8 = false)
5909
  {
5910
    // init
5911
    $str = (string)$str;
5912
5913
    if (!isset($str[0])) {
5914
      return '';
5915
    }
5916
5917
    if ($cleanUtf8 === true) {
5918
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
5919
      // if invalid characters are found in $haystack before $needle
5920
      $str = self::clean($str);
5921
    }
5922
5923
    if ($encoding !== 'UTF-8') {
5924
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5925
    }
5926
5927
    return \mb_strtolower($str, $encoding);
5928
  }
5929
5930
  /**
5931
   * Generic case sensitive transformation for collation matching.
@@ 5954-5973 (lines=20) @@
5951
   *
5952
   * @return string str with all alphabetic characters converted to uppercase.
5953
   */
5954
  public static function strtoupper($str, $encoding = 'UTF-8', $cleanUtf8 = false)
5955
  {
5956
    $str = (string)$str;
5957
5958
    if (!isset($str[0])) {
5959
      return '';
5960
    }
5961
5962
    if ($cleanUtf8 === true) {
5963
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
5964
      // if invalid characters are found in $haystack before $needle
5965
      $str = self::clean($str);
5966
    }
5967
5968
    if ($encoding !== 'UTF-8') {
5969
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5970
    }
5971
5972
    return \mb_strtoupper($str, $encoding);
5973
  }
5974
5975
  /**
5976
   * Translate characters or replace sub-strings.