Code Duplication    Length = 7-9 lines in 9 locations

src/voku/helper/UTF8.php 9 locations

@@ 982-990 (lines=9) @@
979
      $encoding = self::normalize_encoding($encoding, 'UTF-8');
980
    }
981
982
    if (
983
        $encoding !== 'UTF-8'
984
        &&
985
        $encoding !== 'WINDOWS-1252'
986
        &&
987
        self::$SUPPORT['mbstring'] === false
988
    ) {
989
      trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
990
    }
991
992
    $cacheKey = $code_point . $encoding;
993
    if (isset($CHAR_CACHE[$cacheKey]) === true) {
@@ 1394-1402 (lines=9) @@
1391
        return self::to_iso8859($str);
1392
      }
1393
1394
      if (
1395
          $encoding !== 'UTF-8'
1396
          &&
1397
          $encoding !== 'WINDOWS-1252'
1398
          &&
1399
          self::$SUPPORT['mbstring'] === false
1400
      ) {
1401
        trigger_error('UTF8::encode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
1402
      }
1403
1404
      $strEncoded = \mb_convert_encoding(
1405
          $str,
@@ 2293-2301 (lines=9) @@
2290
      }
2291
    }
2292
2293
    if (
2294
        $encoding !== 'UTF-8'
2295
        &&
2296
        $encoding !== 'WINDOWS-1252'
2297
        &&
2298
        self::$SUPPORT['mbstring'] === false
2299
    ) {
2300
      trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
2301
    }
2302
2303
    do {
2304
      $str_compare = $str;
@@ 5348-5354 (lines=7) @@
5345
      self::checkForSupport();
5346
    }
5347
5348
    if (
5349
        $encoding !== 'UTF-8'
5350
        &&
5351
        self::$SUPPORT['mbstring'] === false
5352
    ) {
5353
      trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5354
    }
5355
5356
    if (self::$SUPPORT['mbstring'] === true) {
5357
      return \mb_stristr($haystack, $needle, $before_needle, $encoding);
@@ 5893-5899 (lines=7) @@
5890
      self::checkForSupport();
5891
    }
5892
5893
    if (
5894
        $encoding !== 'UTF-8'
5895
        &&
5896
        self::$SUPPORT['mbstring'] === false
5897
    ) {
5898
      trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5899
    }
5900
5901
    if (self::$SUPPORT['mbstring'] === true) {
5902
      return \mb_strripos($haystack, $needle, $offset, $encoding);
@@ 5976-5982 (lines=7) @@
5973
      self::checkForSupport();
5974
    }
5975
5976
    if (
5977
        $encoding !== 'UTF-8'
5978
        &&
5979
        self::$SUPPORT['mbstring'] === false
5980
    ) {
5981
      trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
5982
    }
5983
5984
    if (self::$SUPPORT['mbstring'] === true) {
5985
      return \mb_strrpos($haystack, $needle, $offset, $encoding);
@@ 6090-6096 (lines=7) @@
6087
      self::checkForSupport();
6088
    }
6089
6090
    if (
6091
        $encoding !== 'UTF-8'
6092
        &&
6093
        self::$SUPPORT['mbstring'] === false
6094
    ) {
6095
      trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6096
    }
6097
6098
    if (self::$SUPPORT['mbstring'] === true) {
6099
      return \mb_strstr($haystack, $needle, $before_needle, $encoding);
@@ 6493-6499 (lines=7) @@
6490
      return substr($str, $offset, $length === null ? $str_length : $length);
6491
    }
6492
6493
    if (
6494
        $encoding !== 'UTF-8'
6495
        &&
6496
        self::$SUPPORT['mbstring'] === false
6497
    ) {
6498
      trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6499
    }
6500
6501
    if (self::$SUPPORT['mbstring'] === true) {
6502
      return \mb_substr($str, $offset, $length, $encoding);
@@ 6656-6662 (lines=7) @@
6653
      self::checkForSupport();
6654
    }
6655
6656
    if (
6657
        $encoding !== 'UTF-8'
6658
        &&
6659
        self::$SUPPORT['mbstring'] === false
6660
    ) {
6661
      trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', E_USER_WARNING);
6662
    }
6663
6664
    if (self::$SUPPORT['mbstring'] === true) {
6665
      return \mb_substr_count($haystack, $needle, $encoding);