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) {
@@ 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,
@@ 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;
@@ 5337-5343 (lines=7) @@
5334
      self::checkForSupport();
5335
    }
5336
5337
    if (
5338
        $encoding !== 'UTF-8'
5339
        &&
5340
        self::$SUPPORT['mbstring'] === false
5341
    ) {
5342
      trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5343
    }
5344
5345
    if (self::$SUPPORT['mbstring'] === true) {
5346
      return \mb_stristr($haystack, $needle, $before_needle, $encoding);
@@ 5881-5887 (lines=7) @@
5878
      self::checkForSupport();
5879
    }
5880
5881
    if (
5882
        $encoding !== 'UTF-8'
5883
        &&
5884
        self::$SUPPORT['mbstring'] === false
5885
    ) {
5886
      trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5887
    }
5888
5889
    if (self::$SUPPORT['mbstring'] === true) {
5890
      return \mb_strripos($haystack, $needle, $offset, $encoding);
@@ 5964-5970 (lines=7) @@
5961
      self::checkForSupport();
5962
    }
5963
5964
    if (
5965
        $encoding !== 'UTF-8'
5966
        &&
5967
        self::$SUPPORT['mbstring'] === false
5968
    ) {
5969
      trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5970
    }
5971
5972
    if (self::$SUPPORT['mbstring'] === true) {
5973
      return \mb_strrpos($haystack, $needle, $offset, $encoding);
@@ 6078-6084 (lines=7) @@
6075
      self::checkForSupport();
6076
    }
6077
6078
    if (
6079
        $encoding !== 'UTF-8'
6080
        &&
6081
        self::$SUPPORT['mbstring'] === false
6082
    ) {
6083
      trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6084
    }
6085
6086
    if (self::$SUPPORT['mbstring'] === true) {
6087
      return \mb_strstr($haystack, $needle, $before_needle, $encoding);
@@ 6482-6488 (lines=7) @@
6479
      return substr($str, $offset, $length === null ? $str_length : $length);
6480
    }
6481
6482
    if (
6483
        $encoding !== 'UTF-8'
6484
        &&
6485
        self::$SUPPORT['mbstring'] === false
6486
    ) {
6487
      trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6488
    }
6489
6490
    if (self::$SUPPORT['mbstring'] === true) {
6491
      return \mb_substr($str, $offset, $length, $encoding);
@@ 6645-6651 (lines=7) @@
6642
      self::checkForSupport();
6643
    }
6644
6645
    if (
6646
        $encoding !== 'UTF-8'
6647
        &&
6648
        self::$SUPPORT['mbstring'] === false
6649
    ) {
6650
      trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6651
    }
6652
6653
    if (self::$SUPPORT['mbstring'] === true) {
6654
      return \mb_substr_count($haystack, $needle, $encoding);