Code Duplication    Length = 20-21 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 4922-4942 (lines=21) @@
4919
   *
4920
   * @return string str with all alphabetic characters converted to lowercase.
4921
   */
4922
  public static function strtolower($str, $encoding = 'UTF-8', $cleanUtf8 = false)
4923
  {
4924
    // init
4925
    $str = (string)$str;
4926
4927
    if (!isset($str[0])) {
4928
      return '';
4929
    }
4930
4931
    if ($cleanUtf8 === true) {
4932
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
4933
      // if invalid characters are found in $haystack before $needle
4934
      $str = self::clean($str);
4935
    }
4936
4937
    if ($encoding !== 'UTF-8') {
4938
      $encoding = self::normalize_encoding($encoding);
4939
    }
4940
4941
    return \mb_strtolower($str, $encoding);
4942
  }
4943
4944
  /**
4945
   * Generic case sensitive transformation for collation matching.
@@ 4967-4986 (lines=20) @@
4964
   *
4965
   * @return string str with all alphabetic characters converted to uppercase.
4966
   */
4967
  public static function strtoupper($str, $encoding = 'UTF-8', $cleanUtf8 = false)
4968
  {
4969
    $str = (string)$str;
4970
4971
    if (!isset($str[0])) {
4972
      return '';
4973
    }
4974
4975
    if ($cleanUtf8 === true) {
4976
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
4977
      // if invalid characters are found in $haystack before $needle
4978
      $str = self::clean($str);
4979
    }
4980
4981
    if ($encoding !== 'UTF-8') {
4982
      $encoding = self::normalize_encoding($encoding);
4983
    }
4984
4985
    return \mb_strtoupper($str, $encoding);
4986
  }
4987
4988
  /**
4989
   * Translate characters or replace sub-strings.