Code Duplication    Length = 20-21 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 5805-5825 (lines=21) @@
5802
   *
5803
   * @return string str with all alphabetic characters converted to lowercase.
5804
   */
5805
  public static function strtolower($str, $encoding = 'UTF-8', $cleanUtf8 = false)
5806
  {
5807
    // init
5808
    $str = (string)$str;
5809
5810
    if (!isset($str[0])) {
5811
      return '';
5812
    }
5813
5814
    if ($cleanUtf8 === true) {
5815
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
5816
      // if invalid characters are found in $haystack before $needle
5817
      $str = self::clean($str);
5818
    }
5819
5820
    if ($encoding !== 'UTF-8') {
5821
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5822
    }
5823
5824
    return \mb_strtolower($str, $encoding);
5825
  }
5826
5827
  /**
5828
   * Generic case sensitive transformation for collation matching.
@@ 5851-5870 (lines=20) @@
5848
   *
5849
   * @return string str with all alphabetic characters converted to uppercase.
5850
   */
5851
  public static function strtoupper($str, $encoding = 'UTF-8', $cleanUtf8 = false)
5852
  {
5853
    $str = (string)$str;
5854
5855
    if (!isset($str[0])) {
5856
      return '';
5857
    }
5858
5859
    if ($cleanUtf8 === true) {
5860
      // "\mb_strpos" and "\iconv_strpos" returns wrong position,
5861
      // if invalid characters are found in $haystack before $needle
5862
      $str = self::clean($str);
5863
    }
5864
5865
    if ($encoding !== 'UTF-8') {
5866
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
5867
    }
5868
5869
    return \mb_strtoupper($str, $encoding);
5870
  }
5871
5872
  /**
5873
   * Translate characters or replace sub-strings.