Code Duplication    Length = 7-9 lines in 9 locations

src/voku/helper/UTF8.php 9 locations

@@ 976-984 (lines=9) @@
973
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
974
    }
975
976
    if (
977
        $encoding !== 'UTF-8'
978
        &&
979
        $encoding !== 'WINDOWS-1252'
980
        &&
981
        self::$SUPPORT['mbstring'] === false
982
    ) {
983
      trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
984
    }
985
986
    $cacheKey = $code_point . $encoding;
987
    if (isset($CHAR_CACHE[$cacheKey]) === true) {
@@ 1393-1401 (lines=9) @@
1390
        return self::to_iso8859($str);
1391
      }
1392
1393
      if (
1394
          $encoding !== 'UTF-8'
1395
          &&
1396
          $encoding !== 'WINDOWS-1252'
1397
          &&
1398
          self::$SUPPORT['mbstring'] === false
1399
      ) {
1400
        trigger_error('UTF8::encode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
1401
      }
1402
1403
      $strEncoded = \mb_convert_encoding(
1404
          $str,
@@ 5333-5339 (lines=7) @@
5330
      self::checkForSupport();
5331
    }
5332
5333
    if (
5334
        $encoding !== 'UTF-8'
5335
        &&
5336
        self::$SUPPORT['mbstring'] === false
5337
    ) {
5338
      trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5339
    }
5340
5341
    if (self::$SUPPORT['mbstring'] === true) {
5342
      return \mb_stristr($haystack, $needle, $before_needle, $encoding);
@@ 2292-2300 (lines=9) @@
2289
      }
2290
    }
2291
2292
    if (
2293
        $encoding !== 'UTF-8'
2294
        &&
2295
        $encoding !== 'WINDOWS-1252'
2296
        &&
2297
        self::$SUPPORT['mbstring'] === false
2298
    ) {
2299
      trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
2300
    }
2301
2302
    do {
2303
      $str_compare = $str;
@@ 5879-5885 (lines=7) @@
5876
      self::checkForSupport();
5877
    }
5878
5879
    if (
5880
        $encoding !== 'UTF-8'
5881
        &&
5882
        self::$SUPPORT['mbstring'] === false
5883
    ) {
5884
      trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5885
    }
5886
5887
    if (self::$SUPPORT['mbstring'] === true) {
5888
      return \mb_strripos($haystack, $needle, $offset, $encoding);
@@ 5962-5968 (lines=7) @@
5959
      self::checkForSupport();
5960
    }
5961
5962
    if (
5963
        $encoding !== 'UTF-8'
5964
        &&
5965
        self::$SUPPORT['mbstring'] === false
5966
    ) {
5967
      trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5968
    }
5969
5970
    if (self::$SUPPORT['mbstring'] === true) {
5971
      return \mb_strrpos($haystack, $needle, $offset, $encoding);
@@ 6076-6082 (lines=7) @@
6073
      self::checkForSupport();
6074
    }
6075
6076
    if (
6077
        $encoding !== 'UTF-8'
6078
        &&
6079
        self::$SUPPORT['mbstring'] === false
6080
    ) {
6081
      trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6082
    }
6083
6084
    if (self::$SUPPORT['mbstring'] === true) {
6085
      return \mb_strstr($haystack, $needle, $before_needle, $encoding);
@@ 6480-6486 (lines=7) @@
6477
      return substr($str, $offset, $length === null ? $str_length : $length);
6478
    }
6479
6480
    if (
6481
        $encoding !== 'UTF-8'
6482
        &&
6483
        self::$SUPPORT['mbstring'] === false
6484
    ) {
6485
      trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6486
    }
6487
6488
    if (self::$SUPPORT['mbstring'] === true) {
6489
      return \mb_substr($str, $offset, $length, $encoding);
@@ 6643-6649 (lines=7) @@
6640
      self::checkForSupport();
6641
    }
6642
6643
    if (
6644
        $encoding !== 'UTF-8'
6645
        &&
6646
        self::$SUPPORT['mbstring'] === false
6647
    ) {
6648
      trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6649
    }
6650
6651
    if (self::$SUPPORT['mbstring'] === true) {
6652
      return \mb_substr_count($haystack, $needle, $encoding);