Code Duplication    Length = 11-11 lines in 3 locations

src/voku/helper/UTF8.php 3 locations

@@ 393-403 (lines=11) @@
390
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
391
    }
392
393
    if (
394
        $encoding !== 'UTF-8'
395
        &&
396
        $encoding !== 'ISO-8859-1'
397
        &&
398
        $encoding !== 'WINDOWS-1252'
399
        &&
400
        self::$SUPPORT['mbstring'] === false
401
    ) {
402
      \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
403
    }
404
405
    $cacheKey = $code_point . $encoding;
406
    if (isset($CHAR_CACHE[$cacheKey]) === true) {
@@ 822-832 (lines=11) @@
819
        return self::to_iso8859($str);
820
      }
821
822
      if (
823
          $encoding !== 'UTF-8'
824
          &&
825
          $encoding !== 'ISO-8859-1'
826
          &&
827
          $encoding !== 'WINDOWS-1252'
828
          &&
829
          self::$SUPPORT['mbstring'] === false
830
      ) {
831
        \trigger_error('UTF8::encode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
832
      }
833
834
      $strEncoded = \mb_convert_encoding(
835
          $str,
@@ 1670-1680 (lines=11) @@
1667
      $flags = ENT_QUOTES | ENT_HTML5;
1668
    }
1669
1670
    if (
1671
        $encoding !== 'UTF-8'
1672
        &&
1673
        $encoding !== 'ISO-8859-1'
1674
        &&
1675
        $encoding !== 'WINDOWS-1252'
1676
        &&
1677
        self::$SUPPORT['mbstring'] === false
1678
    ) {
1679
      \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
1680
    }
1681
1682
    do {
1683
      $str_compare = $str;