Code Duplication    Length = 20-21 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 5863-5883 (lines=21) @@
5860
   *
5861
   * @return string str with all alphabetic characters converted to lowercase.
5862
   */
5863
  public static function strtolower($str, $encoding = 'UTF-8', $cleanUtf8 = false)
5864
  {
5865
    // init
5866
    $str = (string)$str;
5867
5868
    if (!isset($str[0])) {
5869
      return '';
5870
    }
5871
5872
    if ($cleanUtf8 === true) {
5873
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
5874
      // if invalid characters are found in $haystack before $needle
5875
      $str = self::clean($str);
5876
    }
5877
5878
    if ($encoding !== 'UTF-8') {
5879
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5880
    }
5881
5882
    return \mb_strtolower($str, $encoding);
5883
  }
5884
5885
  /**
5886
   * Generic case sensitive transformation for collation matching.
@@ 5909-5928 (lines=20) @@
5906
   *
5907
   * @return string str with all alphabetic characters converted to uppercase.
5908
   */
5909
  public static function strtoupper($str, $encoding = 'UTF-8', $cleanUtf8 = false)
5910
  {
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_strtoupper($str, $encoding);
5928
  }
5929
5930
  /**
5931
   * Translate characters or replace sub-strings.