Code Duplication    Length = 7-9 lines in 9 locations

src/voku/helper/UTF8.php 9 locations

@@ 1389-1397 (lines=9) @@
1386
        return self::to_iso8859($str);
1387
      }
1388
1389
      if (
1390
          $encoding !== 'UTF-8'
1391
          &&
1392
          $encoding !== 'WINDOWS-1252'
1393
          &&
1394
          self::$SUPPORT['mbstring'] === false
1395
      ) {
1396
        trigger_error('UTF8::encode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
1397
      }
1398
1399
      $strEncoded = \mb_convert_encoding(
1400
          $str,
@@ 972-980 (lines=9) @@
969
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
970
    }
971
972
    if (
973
        $encoding !== 'UTF-8'
974
        &&
975
        $encoding !== 'WINDOWS-1252'
976
        &&
977
        self::$SUPPORT['mbstring'] === false
978
    ) {
979
      trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
980
    }
981
982
    $cacheKey = $code_point . $encoding;
983
    if (isset($CHAR_CACHE[$cacheKey]) === true) {
@@ 2288-2296 (lines=9) @@
2285
      }
2286
    }
2287
2288
    if (
2289
        $encoding !== 'UTF-8'
2290
        &&
2291
        $encoding !== 'WINDOWS-1252'
2292
        &&
2293
        self::$SUPPORT['mbstring'] === false
2294
    ) {
2295
      trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
2296
    }
2297
2298
    do {
2299
      $str_compare = $str;
@@ 5339-5345 (lines=7) @@
5336
      self::checkForSupport();
5337
    }
5338
5339
    if (
5340
        $encoding !== 'UTF-8'
5341
        &&
5342
        self::$SUPPORT['mbstring'] === false
5343
    ) {
5344
      trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5345
    }
5346
5347
    if (self::$SUPPORT['mbstring'] === true) {
5348
      return \mb_stristr($haystack, $needle, $before_needle, $encoding);
@@ 5884-5890 (lines=7) @@
5881
      self::checkForSupport();
5882
    }
5883
5884
    if (
5885
        $encoding !== 'UTF-8'
5886
        &&
5887
        self::$SUPPORT['mbstring'] === false
5888
    ) {
5889
      trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5890
    }
5891
5892
    if (self::$SUPPORT['mbstring'] === true) {
5893
      return \mb_strripos($haystack, $needle, $offset, $encoding);
@@ 5967-5973 (lines=7) @@
5964
      self::checkForSupport();
5965
    }
5966
5967
    if (
5968
        $encoding !== 'UTF-8'
5969
        &&
5970
        self::$SUPPORT['mbstring'] === false
5971
    ) {
5972
      trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5973
    }
5974
5975
    if (self::$SUPPORT['mbstring'] === true) {
5976
      return \mb_strrpos($haystack, $needle, $offset, $encoding);
@@ 6081-6087 (lines=7) @@
6078
      self::checkForSupport();
6079
    }
6080
6081
    if (
6082
        $encoding !== 'UTF-8'
6083
        &&
6084
        self::$SUPPORT['mbstring'] === false
6085
    ) {
6086
      trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6087
    }
6088
6089
    if (self::$SUPPORT['mbstring'] === true) {
6090
      return \mb_strstr($haystack, $needle, $before_needle, $encoding);
@@ 6485-6491 (lines=7) @@
6482
      return substr($str, $offset, $length === null ? $str_length : $length);
6483
    }
6484
6485
    if (
6486
        $encoding !== 'UTF-8'
6487
        &&
6488
        self::$SUPPORT['mbstring'] === false
6489
    ) {
6490
      trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6491
    }
6492
6493
    if (self::$SUPPORT['mbstring'] === true) {
6494
      return \mb_substr($str, $offset, $length, $encoding);
@@ 6648-6654 (lines=7) @@
6645
      self::checkForSupport();
6646
    }
6647
6648
    if (
6649
        $encoding !== 'UTF-8'
6650
        &&
6651
        self::$SUPPORT['mbstring'] === false
6652
    ) {
6653
      trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6654
    }
6655
6656
    if (self::$SUPPORT['mbstring'] === true) {
6657
      return \mb_substr_count($haystack, $needle, $encoding);