Code Duplication    Length = 11-11 lines in 3 locations

src/voku/helper/UTF8.php 3 locations

@@ 451-461 (lines=11) @@
448
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
449
    }
450
451
    if (
452
        $encoding !== 'UTF-8'
453
        &&
454
        $encoding !== 'ISO-8859-1'
455
        &&
456
        $encoding !== 'WINDOWS-1252'
457
        &&
458
        self::$SUPPORT['mbstring'] === false
459
    ) {
460
      \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
461
    }
462
463
    $cacheKey = $code_point . $encoding;
464
    if (isset($CHAR_CACHE[$cacheKey]) === true) {
@@ 935-945 (lines=11) @@
932
        return self::to_iso8859($str);
933
      }
934
935
      if (
936
          $encoding !== 'UTF-8'
937
          &&
938
          $encoding !== 'ISO-8859-1'
939
          &&
940
          $encoding !== 'WINDOWS-1252'
941
          &&
942
          self::$SUPPORT['mbstring'] === false
943
      ) {
944
        \trigger_error('UTF8::encode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
945
      }
946
947
      $strEncoded = \mb_convert_encoding(
948
          $str,
@@ 2041-2051 (lines=11) @@
2038
      $flags = ENT_QUOTES | ENT_HTML5;
2039
    }
2040
2041
    if (
2042
        $encoding !== 'UTF-8'
2043
        &&
2044
        $encoding !== 'ISO-8859-1'
2045
        &&
2046
        $encoding !== 'WINDOWS-1252'
2047
        &&
2048
        self::$SUPPORT['mbstring'] === false
2049
    ) {
2050
      \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
2051
    }
2052
2053
    do {
2054
      $str_compare = $str;