Code Duplication    Length = 7-9 lines in 9 locations

src/voku/helper/UTF8.php 9 locations

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